Human-readable display label for the stage (shown in the narrative/trace).
The stage's work — a (scope) => … function, or a PausableHandler for human-in-the-loop pauses.
Stable stage id used in traces, the commit log, and runtimeStageId. Keep it unique within the chart.
Optionaloptions: FlowChartOptions
Optional { description?, structureRecorders?, retry?, touches?, tags?, failFast? }
(FlowChartOptions). retry, touches and tags apply to this first stage; failFast is read
only by flowChartSelector and is ignored here.
const chart = flowChart<State>('FetchUser', async (scope) => {
scope.user = await getUser();
}, 'fetch-user')
.addFunction('Process', processFn, 'process')
.build();
const trace = narrative();
const result = await chart.recorder(trace).run();
console.log(trace.getEntries().map((e) => e.text).join('\n'));
Start a flowchart with its first stage; returns a fluent builder.
Chain .addFunction() / .addDeciderFunction() / .addSelectorFunction() /
.addSubFlowChart() etc. to add more stages, then finish with .build().
Human-readable display label for the stage (shown in the narrative/trace).
The stage's work — a (scope) => … function, or a PausableHandler for human-in-the-loop pauses.
Stable stage id used in traces, the commit log, and runtimeStageId. Keep it unique within the chart.
Optionaloptions: FlowChartOptions
Optional { description?, structureRecorders?, retry?, touches?, tags?, failFast? }
(FlowChartOptions). retry, touches and tags apply to this first stage; failFast is read
only by flowChartSelector and is ignored here.
const chart = flowChart<State>('FetchUser', async (scope) => {
scope.user = await getUser();
}, 'fetch-user')
.addFunction('Process', processFn, 'process')
.build();
const trace = narrative();
const result = await chart.recorder(trace).run();
console.log(trace.getEntries().map((e) => e.text).join('\n'));
Start a flowchart with its first stage; returns a fluent builder.
Chain
.addFunction()/.addDeciderFunction()/.addSelectorFunction()/.addSubFlowChart()etc. to add more stages, then finish with.build().