Mapping

The Mapping function type transforms input data into output data using formulas.

It is defined like this:

type: mapping
mapping:
  id:
    $var: input.record.id
  fullName:
    $concat:
      - $var: input.record.firstName
      - ' '
      - $var: input.record.lastName

The mapping is a YAML object where each key is an output field and the value is a formula expression.

Variables

  • credentials – Authentication credentials from the current connection
  • parameters – Function-level and collection-level parameters combined
  • Function-specific input variables

Using in Actions and Flow Nodes

You can use this function in flow nodes with transform-data type.

It is structured a bit differently than the standard definition. Here is an example:

type: transform-data
config:
  output:
    outputField:
      $var: input.sourceField

Using in Connector Files

When used in connector files, the mapping is written in a separate file named <function-name>.map.yml (or <function-name>.yml).

For example:

# "record-from-api" function of the "Contacts" data collection.
# File location: data/contacts/record-from-api.map.yml
id:
  $var: $.fields.id
createdAt:
  $var: $.fields.created_at