@pipedream/faunadb

    0.3.3 • Public • Published

    FaunaDB Event Sources

    FaunaDB Event Sources collect data from FaunaDB (for example, changes to a collection) and emits them as individual events. These events can trigger Pipedream workflows, and are accessible as a real-time, private SSE stream, and via REST API.

    Watch this video to learn how to create an event source to track changes to documents in a Fauna collection and build a Pipedream workflow to run on every change.

    Sources

    Changes to Documents in a Collection

    Click here to create this source

    The changes-to-collection.js source tracks add and remove events to documents in a specific collection. Each time you add or remove a document from this collection, this event source emits an event of the following shape:

    Click to expand
    {
      "ts": 1588738648630000,
      "action": "add",
      "document": {
        "@ref": {
          "id": "264744257335591434",
          "collection": {
            "@ref": {
              "id": "test",
              "collection": { "@ref": { "id": "collections" } }
            }
          }
        }
      },
      "instance": {
        "@ref": {
          "id": "264744257335591434",
          "collection": {
            "@ref": {
              "id": "test",
              "collection": { "@ref": { "id": "collections" } }
            }
          }
        }
      }
    }

    If you set the Emit changes as a single event property to true, Pipedream will emit a single event with all the changes since the last time the source ran. That event has the following shape:

    Click to expand
    [
      {
        "ts": 1588738648630000,
        "action": "add",
        "document": {
          "@ref": {
            "id": "264744257335591434",
            "collection": {
              "@ref": {
                "id": "test",
                "collection": { "@ref": { "id": "collections" } }
              }
            }
          }
        },
        "instance": {
          "@ref": {
            "id": "264744257335591434",
            "collection": {
              "@ref": {
                "id": "test",
                "collection": { "@ref": { "id": "collections" } }
              }
            }
          }
        }
      },
      {
        "ts": 1588739721810000,
        "action": "remove",
        "document": {
          "@ref": {
            "id": "264744257335591434",
            "collection": {
              "@ref": {
                "id": "test",
                "collection": { "@ref": { "id": "collections" } }
              }
            }
          }
        },
        "instance": {
          "@ref": {
            "id": "264744257335591434",
            "collection": {
              "@ref": {
                "id": "test",
                "collection": { "@ref": { "id": "collections" } }
              }
            }
          }
        }
      }
    ]

    Workflows

    Here are a few example workflows you can copy and modify in any way:

    Install

    npm i @pipedream/faunadb

    DownloadsWeekly Downloads

    1

    Version

    0.3.3

    License

    MIT

    Unpacked Size

    9.75 kB

    Total Files

    5

    Last publish

    Collaborators

    • tjk
    • sacerdoti
    • dylburger
    • casret