Exporting results from the DAG so that the client part of a Sift (e.g. the Gmail Chrome Extension) can access it e.g. for visualization is accomplished via the exports property. Exports are used the same way by a node as stores are, with the addition that data stored in an export is accessible read-only by the clients on the frontend.

๐Ÿ“˜

Exports are accessible in the clients read-only. If you need to send data back from the frontend client to the Sift's computation context on the server use a webhook input.

The name of an export and its properties will be used to create a storage instance in the clients. E.g. for a web client an export will manifest as an ObjectStore in IndexedDB (with the name export1 in the example below) and the other defined characteristics such as secondary indexes will also be created. The created storage instance also shares some features with stores like the key$schema property, since they can be used interchangeably as node ouputs.

exports are synchronised to clients and are accessible after synchronisation.

Special cases of exports are the restricted outputs _email.id and _email.tid. A node can output data there for the framework to import at a later stage. In order to output data there the id of an email needs to be used as a key for _email.id and the thread id of an email for the _email.tid. Since the key is already known the key$schema property for those exports is redundant. You can read more about the callbacks that receive the data that are stored in imports here.

{
  "nodes": [{
    "#": "node1",
    "implementation": {
      "javascript": "server/node1_impl.js",
      "sandbox": "quay.io/repository/redsift/sandbox-javascript:v4",
      "when": {
        "interval": 100
      },
      "qos":{
        "long": true
      }
    },
    "input": {
      "bucket": "port1",
      "select": "*"
    },
    "outputs": {
      "store1": {}
    }
  }],
  "outputs": {
    "exports": {
      "export1": {
          "key$schema": "string",
          "twoI":{
            "nameOfTwoI": "string"
          }
      },
      "tidList": {
          "import": "_email.tid"
      }
    }
  }
}