Skip to content

@saflib/workflows


Function: defineWorkflow()

defineWorkflow<I, C>(config): WorkflowDefinition<I, C>

Helper, identity function to infer types.

By using this function on a Workflow object, it properly types the input object in the context function, and the context in the callbacks for the steps.

Type Parameters

Type ParameterDefault type
I extends readonly WorkflowArgument[]-
Cany

Parameters

ParameterType
config{ checklistDescription?: (context) => string; context: (arg) => C; description: string; docFiles: Record<string, string>; id: string; input: I; sourceUrl: string; steps: WorkflowStep<C, AnyStateMachine>[]; templateFiles: Record<string, string>; versionControl?: { allowPaths?: string[]; }; }
config.checklistDescription?(context) => string
config.context(arg) => C
config.descriptionstring
config.docFilesRecord<string, string>
config.idstring
config.inputI
config.sourceUrlstring
config.stepsWorkflowStep<C, AnyStateMachine>[]
config.templateFilesRecord<string, string>
config.versionControl?{ allowPaths?: string[]; }
config.versionControl.allowPaths?string[]

Returns

WorkflowDefinition<I, C>