First-run phase. Return data to pause, or void/undefined to continue normally.
Any non-void return value becomes the pauseData in the checkpoint.
The consumer defines the TPauseData type — the FE uses it to render
the right UI (form fields, approval buttons, etc.).
// TPauseData = { question: string; riskLevel: string }
const handler: PausableHandler<MyState, { approved: boolean }, { question: string; riskLevel: string }> = {
execute: async (scope) => {
return { question: `Approve order ${scope.orderId}?`, riskLevel: 'high' };
},
resume: async (scope, input) => {
scope.approved = input.approved;
},
};
Resume phase. Called with the resume input when execution continues.
The scope is restored from the checkpoint's sharedState. Writes during
resume are committed and visible to subsequent stages.
Handler for a pausable stage — has two phases: execute and resume.
executeruns the first time. Return any non-void value to pause (that value becomes the checkpoint'spauseData); return void/undefined to continue normally.resumeruns when the flowchart is resumed. It receives the resume input.Both phases receive the same scope. After execute pauses, the scope state is preserved in the checkpoint. On resume, the scope is restored before calling resume.
Example