Skip to main content
This reference documents the types used to define workflows.

TWorkflowDefinition

The root type for a workflow definition:
export type TWorkflowDefinition = {
  id: string;
  name: string;
  steps: TWorkflowStepDefinition[];
  stepTransitions: TWorkflowStepTransition[];
  stepGroups?: TStepGroup[];
  legacyServiceRequestType?: string;
};
PropertyDescription
idUnique identifier
nameHuman-readable name
stepsArray of step definitions
stepTransitionsConnections between steps
stepGroupsUI groupings for steps
legacyServiceRequestTypeMaps to service request type

Step definitions

TWorkflowBaseStepDefinition

Base properties shared by all steps:
export type TWorkflowBaseStepDefinition = {
  id: string;
  type: WorkflowStepType;
  name: string;
  outputSchema?: Record<string, any>;
  group?: {
    groupId: string;
    order: number;
  };
  legacyServiceRequestTaskKey?: string;
  activationPolicy?: TStepActivationPolicy;
  ui: {
    reactFlow: {
      position: {
        x: number;
        y: number;
      };
    };
  };
};
PropertyDescription
idUnique step identifier
typeStep type enum value
nameDisplay label
outputSchemaJSON Schema for output validation
groupGrouping metadata
legacyServiceRequestTaskKeyLegacy task mapping
activationPolicyDefault activation state
ui.reactFlow.positionVisual editor coordinates

TStepActivationPolicy

export type TStepActivationPolicy = {
  defaultStatus?: WorkflowRuntimeStepStatus;
};

Control flow steps

export type TStartWorkflowStepDefinition = TWorkflowBaseStepDefinition & {
  type: WorkflowStepType.START;
};

export type TEndWorkflowStepDefinition = TWorkflowBaseStepDefinition & {
  type: WorkflowStepType.END;
};

Human steps

export type TBaseHumanStepDefinition = TWorkflowBaseStepDefinition & {
  type:
    | WorkflowStepType.HUMAN_URL_REDIRECT
    | WorkflowStepType.HUMAN_FORM
    | WorkflowStepType.HUMAN_CONFIRM
    | WorkflowStepType.HUMAN_DOC_UPLOAD;
};

Gateway steps

export type TBaseGatewayStepDefinition = TWorkflowBaseStepDefinition & {
  type:
    | WorkflowStepType.GATEWAY_PARALLEL_SPLIT
    | WorkflowStepType.GATEWAY_PARALLEL_JOIN
    | WorkflowStepType.GATEWAY_EXCLUSIVE_SPLIT
    | WorkflowStepType.GATEWAY_INCLUSIVE_SPLIT;
};

Sub-workflow steps

Base definition

export type TBaseSubWorkflowStepDefinition = TWorkflowBaseStepDefinition & {
  type: WorkflowStepType.SYS_SUB_WORKFLOW;
  mode: SubWorkflowStepMode;
  childWorkflowTemplateVersionId: string;
  dataSources?: TDataSourceCall[];
  inputMapping?: TMapping[];
  contextProjection?: TMapping[];
  childWorkflowName?: TExpr;
};
PropertyDescription
modeSINGLE or BATCH
childWorkflowTemplateVersionIdChild workflow to execute
dataSourcesData to fetch before execution
inputMappingHow to populate child context
contextProjectionHow to project child outputs back
childWorkflowNameDynamic naming expression

Single mode

export type TSingleWorkflowStepDefinition = TBaseSubWorkflowStepDefinition & {
  mode: SubWorkflowStepMode.SINGLE;
};

Batch mode

export type TBatchWorkflowStepDefinition = TBaseSubWorkflowStepDefinition & {
  mode: SubWorkflowStepMode.BATCH;
  iterable: TIterableProvider;
};
The iterable property defines how to construct the batch collection.

Union type

export type TWorkflowStepDefinition =
  | TWorkflowBaseStepDefinition
  | TSingleWorkflowStepDefinition
  | TBatchWorkflowStepDefinition
  | TStartWorkflowStepDefinition
  | TEndWorkflowStepDefinition
  | TBaseHumanStepDefinition
  | TBaseGatewayStepDefinition;

Step transitions

TWorkflowStepTransition

export type TWorkflowStepTransition = {
  id: string;
  fromStepId: string;
  toStepId: string;
  condition?: TExpr;
  isDefault?: boolean;
  label?: string;
  onArrival?: TStepTransitionOnArrival;
  ui: {
    reactFlow: {
      handle: {
        sourceHandle: string;
        targetHandle: string;
      };
    };
  };
};
PropertyDescription
idUnique identifier
fromStepIdSource step
toStepIdTarget step
conditionOptional conditional expression
isDefaultDefault branch for exclusive gateways
labelDisplay label
onArrivalActions when transition activates target
ui.reactFlow.handleVisual editor handle references

TStepTransitionOnArrival

export type TStepTransitionOnArrival = {
  status?: WorkflowRuntimeStepStatus;
};
Use this to set the target step’s status when the transition fires. For example, set to ACTION_REQUIRED when an issue is reported.

Step groups

TStepGroup

export type TStepGroup = {
  id: string;
  name: string;
  stepIds: string[];
  legacyServiceRequestTaskGroupKey?: string;
};
PropertyDescription
idUnique identifier
nameDisplay name
stepIdsSteps belonging to this group
legacyServiceRequestTaskGroupKeyLegacy task group mapping

Example definition

{
  "id": "workflow-1",
  "name": "Customer Verification",
  "steps": [
    {
      "id": "start",
      "type": "start",
      "name": "Start",
      "ui": { "reactFlow": { "position": { "x": 0, "y": 0 } } }
    },
    {
      "id": "verify",
      "type": "human.confirm",
      "name": "Verify Documents",
      "outputSchema": {
        "type": "object",
        "properties": {
          "verified": { "type": "boolean" }
        }
      },
      "ui": { "reactFlow": { "position": { "x": 200, "y": 0 } } }
    },
    {
      "id": "end",
      "type": "end",
      "name": "End",
      "ui": { "reactFlow": { "position": { "x": 400, "y": 0 } } }
    }
  ],
  "stepTransitions": [
    {
      "id": "t1",
      "fromStepId": "start",
      "toStepId": "verify",
      "ui": { "reactFlow": { "handle": { "sourceHandle": "out", "targetHandle": "in" } } }
    },
    {
      "id": "t2",
      "fromStepId": "verify",
      "toStepId": "end",
      "ui": { "reactFlow": { "handle": { "sourceHandle": "out", "targetHandle": "in" } } }
    }
  ]
}

Next steps

Runtime types

Execution runtime types

Validation rules

Definition validation rules