Skip to content

@saflib/workflows


Interface: WorkflowDefinition<I, C> ​

An interface that includes everything that makes up a workflow.

Type Parameters ​

Type ParameterDefault type
I extends readonly WorkflowArgument[]any
Cany

Properties ​

checklistDescription()? ​

optional checklistDescription: (context) => string

Description that will be printed when the workflow itself is part of a checklist. Experimental! Still need to experiment with workflows in workflows.

Parameters ​

ParameterType
contextC

Returns ​

string


context() ​

context: (arg) => C

The context specific to this workflow, generated from the input and available to use in each step.

Parameters ​

ParameterType
arg{ input: Omit<CreateArgsTypeBase<I>, FlagKeys<I>> & Partial<Pick<CreateArgsTypeBase<I>, FlagKeys<I>>> & object; }
arg.inputOmit<CreateArgsTypeBase<I>, FlagKeys<I>> & Partial<Pick<CreateArgsTypeBase<I>, FlagKeys<I>>> & object

Returns ​

C


description ​

description: string

Description of the workflow which will be shown in the CLI tool.


docFiles ​

docFiles: Record<string, string>>

A map of ids to doc file absolute paths which will be referenced as part of the workflow.


id ​

id: string

Unique id for the workflow, for invoking it with the CLI tool.


input ​

input: I

The input specific to this workflow.


sourceUrl ​

sourceUrl: string

The source URL of the workflow. Set to import.meta.url.


steps ​

steps: WorkflowStep<C, AnyStateMachine>>[]

An array of steps to be executed in the workflow. Each step is a state machine, and a function which takes the context and returns the input for the state machine.


templateFiles ​

templateFiles: Record<string, string>>

A map of ids to template file absolute paths which will be copied and updated as part of the workflow.


versionControl? ​

optional versionControl: object

Configure version control for the workflow. Right now, just provide paths which the workflow will consider safe to change as part of the workflow.

allowPaths? ​

optional allowPaths: string[] | (__namedParameters) => string[]

commitEachStep? ​

optional commitEachStep: boolean