@pipedream/faunadb

0.3.8 • 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.mjs 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" } }
        }
      }
    }
  }
}

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" } }
          }
        }
      }
    }
  },
  {
    "ts": 1588739721810000,
    "action": "remove",
    "document": {
      "@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:

Readme

Keywords

Package Sidebar

Install

npm i @pipedream/faunadb

Weekly Downloads

1

Version

0.3.8

License

none

Unpacked Size

17.5 kB

Total Files

8

Last publish

Collaborators

  • ctrlaltdylan
  • celador
  • sacerdoti
  • dylburger
  • casret
  • tjk