Skip to main content
This reference documents the type system used in Workflow Builder’s Domain Specific Language (DSL).

Expressions

Expressions evaluate to a value using a specified expression engine. Currently, JSONata is the supported expression type.

ExpressionType

export enum ExpressionType {
  JSONATA = 'jsonata',
}

TExpr

export type TExpr = { 
  type: ExpressionType.JSONATA; 
  src: string 
};

Evaluation scope

All expressions are evaluated against an environment containing:
VariableDescriptionExample
__context__Global workflow context__context__.customerId
__steps__Step outputs by ID__steps__.stepId.name
__datasources__Datasource outputs by alias__datasources__.dsId.data
__each__Current item in iterations__each__.id

Value providers

TFieldRef

Defines how to access a field from different sources.
export enum FieldRefSource {
  CONTEXT = 'CONTEXT',
  STEP = 'STEP',
  DATASOURCE = 'DATASOURCE',
  EACH = 'EACH',
}

export type TFieldRef =
  | { source: FieldRefSource.CONTEXT; path: string }
  | { source: FieldRefSource.STEP; stepId: string; path: string }
  | { source: FieldRefSource.DATASOURCE; key: string; path: string }
  | { source: FieldRefSource.EACH; path: string };
SourceDescription
CONTEXTAccess from global context
STEPAccess from step output
DATASOURCEAccess from datasource output
EACHAccess current item in loops
The path property uses dot notation (e.g., "director.id") powered by the dot-props library.

TValueProvider

Defines how to produce a value:
export type TValueProvider = 
  | { type: "const"; value: unknown }
  | { type: "field"; ref: TFieldRef } 
  | { type: "expr"; expr: TExpr };
TypeDescription
constHardcoded value
fieldValue from a field reference
exprComputed expression result

TParamValue

Used for datasource or function parameters:
export type TParamValue = 
  | TValueProvider 
  | { [k: string]: TParamValue } 
  | TParamValue[];

Datasource calls

TDataSourceCall

export enum DataSourceType {
  COMMENDA_LOGICAL_BACKEND = 'COMMENDA_LOGICAL_BACKEND',
}

export type TDataSourceCall = {
  id: string;
  alias: string;
  type: DataSourceType.COMMENDA_LOGICAL_BACKEND;
  dataSourceID: string;
  params?: TParamValue;
  select?: TExpr;
  scope?: 'per-step' | 'per-item';
};
PropertyDescription
idUnique identifier
aliasReference name for accessing results
typeDatasource type
dataSourceIDDatabase reference to datasource definition
paramsParameters to pass to the datasource
selectExpression to transform output (default: entire output)
scopeper-step (default) or per-item for batch workflows

Iterator providers

TIterableProvider

Provides an array for iteration:
export enum IterableType {
  EXPRESSION = 'EXPRESSION',
  STEP = 'STEP',
  DATASOURCE = 'DATASOURCE',
}

export type TIterableProvider =
  | { type: IterableType.EXPRESSION; expr: TExpr }
  | { type: IterableType.STEP; stepId: string; select?: TExpr }
  | { type: IterableType.DATASOURCE; key: string; select?: TExpr };
TypeDescription
EXPRESSIONEvaluate expression against context
STEPAccess step output array
DATASOURCEAccess datasource output array

Mappings

TMapping

Specifies how to write values to a target:
export type TMapping = {
  id: string;
  targetPath: string;
  value: TValueProvider;
  mode?: 'set' | 'append';
};
PropertyDescription
idUnique identifier
targetPathDot-notation destination path
valueHow to derive the value
modeset (replace, default) or append (for arrays)

Example

{
  "id": "map-directorId",
  "targetPath": "directorId",
  "value": {
    "type": "expr",
    "expr": { "src": "__each__.id" }
  },
  "mode": "set"
}
This sets directorId to the current batch item’s id.

Step types enum

export enum WorkflowStepType {
  START = 'start',
  END = 'end',
  HUMAN_URL_REDIRECT = 'human.url_redirect',
  HUMAN_FORM = 'human.form',
  HUMAN_CONFIRM = 'human.confirm',
  HUMAN_DOC_UPLOAD = 'human.doc_upload',
  SYS_SUB_WORKFLOW = 'sys.sub_workflow',
  GATEWAY_PARALLEL_SPLIT = 'gateway.parallel_split',
  GATEWAY_PARALLEL_JOIN = 'gateway.parallel_join',
  GATEWAY_EXCLUSIVE_SPLIT = 'gateway.exclusive_split',
  GATEWAY_INCLUSIVE_SPLIT = 'gateway.inclusive_split',
}

Sub-workflow modes

export enum SubWorkflowStepMode {
  SINGLE = 'SINGLE',
  BATCH = 'BATCH',
}
ModeDescription
SINGLEExecute one child workflow
BATCHExecute child workflow for each item in collection

Next steps

Definition types

Workflow definition structure

Runtime types

Execution runtime types