footprintjs 4.3.1 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.js +4 -3
- package/dist/esm/advanced.js +2 -2
- package/dist/esm/lib/builder/index.js +2 -1
- package/dist/esm/lib/builder/types.js +2 -2
- package/dist/esm/lib/engine/handlers/SubflowInputMapper.js +10 -5
- package/dist/esm/lib/engine/narrative/CombinedNarrativeRecorder.js +2 -1
- package/dist/esm/lib/engine/narrative/narrativeTypes.js +1 -1
- package/dist/esm/lib/engine/types.js +14 -1
- package/dist/esm/lib/pause/types.js +1 -1
- package/dist/lib/builder/index.js +4 -2
- package/dist/lib/builder/types.js +4 -1
- package/dist/lib/engine/handlers/SubflowInputMapper.js +10 -5
- package/dist/lib/engine/narrative/CombinedNarrativeRecorder.js +2 -1
- package/dist/lib/engine/narrative/narrativeTypes.js +1 -1
- package/dist/lib/engine/types.js +15 -2
- package/dist/lib/pause/types.js +1 -1
- package/dist/types/advanced.d.ts +1 -1
- package/dist/types/lib/builder/index.d.ts +1 -0
- package/dist/types/lib/builder/types.d.ts +1 -0
- package/dist/types/lib/engine/narrative/narrativeTypes.d.ts +4 -0
- package/dist/types/lib/engine/types.d.ts +34 -9
- package/dist/types/lib/pause/types.d.ts +13 -16
- package/package.json +1 -1
|
@@ -136,31 +136,28 @@ export interface FlowchartCheckpoint {
|
|
|
136
136
|
* await executor.resume(checkpoint, { approved: true, approver: 'Jane' });
|
|
137
137
|
* ```
|
|
138
138
|
*/
|
|
139
|
-
export interface PausableHandler<TScope = any, TInput = unknown> {
|
|
139
|
+
export interface PausableHandler<TScope = any, TInput = unknown, TPauseData = unknown> {
|
|
140
140
|
/**
|
|
141
141
|
* First-run phase. Return data to pause, or void/undefined to continue normally.
|
|
142
142
|
*
|
|
143
143
|
* Any non-void return value becomes the `pauseData` in the checkpoint.
|
|
144
|
-
* The
|
|
145
|
-
*
|
|
144
|
+
* The consumer defines the `TPauseData` type — the FE uses it to render
|
|
145
|
+
* the right UI (form fields, approval buttons, etc.).
|
|
146
146
|
*
|
|
147
147
|
* @example
|
|
148
148
|
* ```typescript
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* }
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
* }
|
|
159
|
-
* // void return → no pause, continues normally
|
|
160
|
-
* }
|
|
149
|
+
* // TPauseData = { question: string; riskLevel: string }
|
|
150
|
+
* const handler: PausableHandler<MyState, { approved: boolean }, { question: string; riskLevel: string }> = {
|
|
151
|
+
* execute: async (scope) => {
|
|
152
|
+
* return { question: `Approve order ${scope.orderId}?`, riskLevel: 'high' };
|
|
153
|
+
* },
|
|
154
|
+
* resume: async (scope, input) => {
|
|
155
|
+
* scope.approved = input.approved;
|
|
156
|
+
* },
|
|
157
|
+
* };
|
|
161
158
|
* ```
|
|
162
159
|
*/
|
|
163
|
-
execute: (scope: TScope) => Promise<
|
|
160
|
+
execute: (scope: TScope) => Promise<TPauseData | void> | TPauseData | void;
|
|
164
161
|
/**
|
|
165
162
|
* Resume phase. Called with the resume input when execution continues.
|
|
166
163
|
*
|
package/package.json
CHANGED