Skip to content

@saflib/workflows


Type Alias: WorkflowStep<C, M> ​

WorkflowStep<C, M> > = object

A step in a workflow with an actor and its corresponding input.

Type Parameters ​

Type Parameter
C
M extends AnyStateMachine

Properties ​

commitAfter? ​

optional commitAfter: object

Whether to commit the changes after the step has been executed, and with what message.

message ​

message: string | (arg) => string


input() ​

input: (arg) => InputFrom<M>>

The input for the step, based on the context for the invoking workflow.

Parameters ​

ParameterType
arg{ context: C & WorkflowContext; }
arg.contextC & WorkflowContext

Returns ​

InputFrom<M>


machine ​

machine: M

The state machine for the step. Either a core step or a workflow definition which has been converted to a state machine with makeWorkflowMachine.


skipIf() ​

skipIf: (arg) => boolean

A function that determines if the step should be skipped.

Parameters ​

ParameterType
arg{ context: C & WorkflowContext; }
arg.contextC & WorkflowContext

Returns ​

boolean


validate() ​

validate: (arg) => Promise<string | undefined>>

A function that validates the step after it has been executed. If it returns a string, that string is prompted to the agent and the workflow is kept from moving forward until the validate function returns undefined.

Parameters ​

ParameterType
arg{ context: C & WorkflowContext; }
arg.contextC & WorkflowContext

Returns ​

Promise<string | undefined>