Adaptors

Adaptors are functions which perform a specific task, e.g. download a file or split a text. Each Adaptor consists of

  • a manifest which metadata of the task inputs and outputs, and

  • a JavaScript function which programmatically transforms a set of inputs to a set of outputs.

a set of inputs to a set of outputs. Both sets of inputs and outputs are predefined in an adaptor manifest file which also describes the data type of each input and output argument. Defining the data type of input and output arguments provides two advantages. First, it allows the engine to check if values computed by the adaptor function are valid. Secondly, it allows adaptors to be linked by binding an output of an adaptor as an input for another adaptor.

Each adaptor must include at least one input argument and one output argument. Unlike JavaScript functions, an adaptor can return more than one argument.

Example adaptor

The split-text adaptor splits a text into a list of sub-texts using a specified separator. The adaptor has two input arguments and two output arguments. The first input argument is a requried text to be split, and the second is an optional separator to determine where to make each split. When no value is provided separator arguments, it defaults to \n (newline). The first output argument is a list of texts split at each point where the separator occurs in the input text, or an empty list if no occurrences found. The second output argument is the number times the separator occurs in the input text.

The split-text adaptor does not need to be aware of the source of the text to be split, the input values can be an output of another transformation step or it can be a user provided value.

List of adaptors

A full list of available data adaptors can be found on https://data-flo.io/transformations#adaptors