Skip to content

Class: WorkflowEngine<T>

Defined in: index.ts:300

Type Parameters

T

T extends NodesDefinition = NodesDefinition

The type of NodesDefinition used.

Constructors

Constructor

new WorkflowEngine<T>(options): WorkflowEngine<T>

Defined in: index.ts:319

Parameters

options

Configuration options.

errorHandler?

ErrorHandler

Optional error handler. Uses DefaultErrorHandler if not provided.

nodeDefinitions

T

The definitions for the nodes used in the workflow.

plugins?

Plugin[] = []

Optional array of plugins for lifecycle hooks.

transformEngines?

TransformEngine[]

Optional array of transform engines (executed in pipeline).

validator?

Validator

Optional validator for input/output validation.

workflow

WorkflowDefinition<T>

The workflow definition.

Returns

WorkflowEngine<T>

Properties

nodeDefinitions

nodeDefinitions: T

Defined in: index.ts:302


workflow

workflow: Workflow

Defined in: index.ts:301

Methods

execute()

Call Signature

execute(args): Promise<Snapshot>

Defined in: index.ts:411

Parameters
args

Execution arguments.

externalPayload?

unknown

External data to pass to the execution.

globals?

unknown

Global variables to pass to transformers and executors.

snapshot

Snapshot

The snapshot to resume from.

stepLimit?

number

Maximum number of steps to execute (default: 100).

Returns

Promise<Snapshot>

The resulting snapshot after execution.

Call Signature

execute(args): Promise<Snapshot>

Defined in: index.ts:417

Parameters
args

Execution arguments.

externalPayload?

unknown

External data to pass to the execution.

globals?

unknown

Global variables to pass to transformers and executors.

initialNodeId

string

The ID of the node to start from (if starting new).

stepLimit?

number

Maximum number of steps to execute (default: 100).

workflowId?

string

The ID of the workflow (if starting new).

Returns

Promise<Snapshot>

The resulting snapshot after execution.


executeStep()

executeStep(snapshot, externalPayload?, globals?): Promise<Snapshot>

Defined in: index.ts:500

Parameters

snapshot

Snapshot

The current snapshot.

externalPayload?

unknown

External payload for the step.

globals?

unknown

Global variables.

Returns

Promise<Snapshot>

The new snapshot after the step execution.


validateWorkflow()

validateWorkflow(): Promise<void>

Defined in: index.ts:350

Returns

Promise<void>

Throws

Error if a node type is missing from the definitions.