@moostjs/event-wf 0.6.17 → 0.6.18
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/index.cjs +27 -9
- package/dist/index.d.ts +13 -7
- package/dist/index.mjs +17 -11
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -127,7 +127,7 @@ const CONTEXT_TYPE = "WF";
|
|
|
127
127
|
* ```ts
|
|
128
128
|
* const wf = new MoostWf()
|
|
129
129
|
* app.adapter(wf).controllers(MyWorkflows).init()
|
|
130
|
-
* const result = await wf.start('my-flow', {}, input)
|
|
130
|
+
* const result = await wf.start('my-flow', {}, { input })
|
|
131
131
|
* ```
|
|
132
132
|
*/ var MoostWf = class {
|
|
133
133
|
async onNotFound() {
|
|
@@ -169,8 +169,8 @@ const CONTEXT_TYPE = "WF";
|
|
|
169
169
|
* @returns The outlet result (form payload + token), finished response, or error.
|
|
170
170
|
*/ handleOutlet(config) {
|
|
171
171
|
return (0, _wooksjs_event_wf.handleWfOutletRequest)(config, {
|
|
172
|
-
start: (schemaId, context, opts) => this.start(schemaId, context, opts
|
|
173
|
-
resume: (state, opts) => this.resume(state, opts
|
|
172
|
+
start: (schemaId, context, opts) => this.start(schemaId, context, opts),
|
|
173
|
+
resume: (state, opts) => this.resume(state, opts)
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
176
|
/**
|
|
@@ -178,10 +178,14 @@ const CONTEXT_TYPE = "WF";
|
|
|
178
178
|
*
|
|
179
179
|
* @param schemaId - Identifier of the registered workflow schema.
|
|
180
180
|
* @param initialContext - Initial context data for the workflow.
|
|
181
|
-
* @param
|
|
182
|
-
|
|
181
|
+
* @param opts - Optional run options: `input` for the first step, `eventContext`
|
|
182
|
+
* to link this run to a parent event scope (e.g. an HTTP request), and
|
|
183
|
+
* `strategy.name` to pick the initial state strategy. Passing a bare
|
|
184
|
+
* `input` value (legacy positional form) is no longer supported — wrap it
|
|
185
|
+
* in `{ input }`.
|
|
186
|
+
*/ start(schemaId, initialContext, opts) {
|
|
183
187
|
return this.wfApp.start(schemaId, initialContext, {
|
|
184
|
-
|
|
188
|
+
...opts,
|
|
185
189
|
cleanup: () => {
|
|
186
190
|
(0, moost.getMoostInfact)().unregisterScope((0, moost.useScopeId)());
|
|
187
191
|
}
|
|
@@ -191,10 +195,12 @@ const CONTEXT_TYPE = "WF";
|
|
|
191
195
|
* Resumes a previously paused workflow from a saved state.
|
|
192
196
|
*
|
|
193
197
|
* @param state - Saved workflow state containing schema, context, and step indexes.
|
|
194
|
-
* @param
|
|
195
|
-
|
|
198
|
+
* @param opts - Optional run options: `input` for the resumed step, `eventContext`
|
|
199
|
+
* for parent-chain composable access, and `strategy.name` for the strategy
|
|
200
|
+
* that loaded this state. Legacy positional `input` is no longer supported.
|
|
201
|
+
*/ resume(state, opts) {
|
|
196
202
|
return this.wfApp.resume(state, {
|
|
197
|
-
|
|
203
|
+
...opts,
|
|
198
204
|
cleanup: () => {
|
|
199
205
|
(0, moost.getMoostInfact)().unregisterScope((0, moost.useScopeId)());
|
|
200
206
|
}
|
|
@@ -341,6 +347,12 @@ Object.defineProperty(exports, 'outletHttp', {
|
|
|
341
347
|
return _prostojs_wf_outlets.outletHttp;
|
|
342
348
|
}
|
|
343
349
|
});
|
|
350
|
+
Object.defineProperty(exports, 'swapStrategy', {
|
|
351
|
+
enumerable: true,
|
|
352
|
+
get: function () {
|
|
353
|
+
return _wooksjs_event_wf.swapStrategy;
|
|
354
|
+
}
|
|
355
|
+
});
|
|
344
356
|
Object.defineProperty(exports, 'useWfFinished', {
|
|
345
357
|
enumerable: true,
|
|
346
358
|
get: function () {
|
|
@@ -359,6 +371,12 @@ Object.defineProperty(exports, 'useWfState', {
|
|
|
359
371
|
return _wooksjs_event_wf.useWfState;
|
|
360
372
|
}
|
|
361
373
|
});
|
|
374
|
+
Object.defineProperty(exports, 'useWfStrategy', {
|
|
375
|
+
enumerable: true,
|
|
376
|
+
get: function () {
|
|
377
|
+
return _wooksjs_event_wf.useWfStrategy;
|
|
378
|
+
}
|
|
379
|
+
});
|
|
362
380
|
Object.defineProperty(exports, 'wfKind', {
|
|
363
381
|
enumerable: true,
|
|
364
382
|
get: function () {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TWorkflowSchema, TWorkflowSpy, TFlowOutput } from '@prostojs/wf';
|
|
2
2
|
export { StepRetriableError, TFlowOutput, TWorkflowSchema } from '@prostojs/wf';
|
|
3
|
-
import { WooksWf, TWooksWfOptions, WfOutletTriggerConfig } from '@wooksjs/event-wf';
|
|
4
|
-
export { WfFinishedResponse, WfOutletTokenConfig, WfOutletTriggerConfig, WfOutletTriggerDeps, createEmailOutlet, createHttpOutlet, createOutletHandler, handleWfOutletRequest, useWfFinished, useWfOutlet, useWfState, wfKind } from '@wooksjs/event-wf';
|
|
3
|
+
import { WooksWf, TWooksWfOptions, WfOutletTriggerConfig, TWfRunOptions } from '@wooksjs/event-wf';
|
|
4
|
+
export { WfFinishedResponse, WfOutletTokenConfig, WfOutletTriggerConfig, WfOutletTriggerDeps, WfPauseRequest, createEmailOutlet, createHttpOutlet, createOutletHandler, handleWfOutletRequest, swapStrategy, useWfFinished, useWfOutlet, useWfState, useWfStrategy, wfKind } from '@wooksjs/event-wf';
|
|
5
5
|
import { TMoostAdapter, Moost, TMoostAdapterOptions } from 'moost';
|
|
6
6
|
export { EncapsulatedStateStrategy, HandleStateStrategy, WfOutlet, WfOutletRequest, WfOutletResult, WfState, WfStateStore, WfStateStoreMemory, WfStateStrategy, outlet, outletEmail, outletHttp } from '@prostojs/wf/outlets';
|
|
7
7
|
|
|
@@ -91,7 +91,7 @@ interface TWfHandlerMeta {
|
|
|
91
91
|
* ```ts
|
|
92
92
|
* const wf = new MoostWf()
|
|
93
93
|
* app.adapter(wf).controllers(MyWorkflows).init()
|
|
94
|
-
* const result = await wf.start('my-flow', {}, input)
|
|
94
|
+
* const result = await wf.start('my-flow', {}, { input })
|
|
95
95
|
* ```
|
|
96
96
|
*/
|
|
97
97
|
declare class MoostWf<T = any, IR = any> implements TMoostAdapter<TWfHandlerMeta> {
|
|
@@ -128,20 +128,26 @@ declare class MoostWf<T = any, IR = any> implements TMoostAdapter<TWfHandlerMeta
|
|
|
128
128
|
*
|
|
129
129
|
* @param schemaId - Identifier of the registered workflow schema.
|
|
130
130
|
* @param initialContext - Initial context data for the workflow.
|
|
131
|
-
* @param
|
|
131
|
+
* @param opts - Optional run options: `input` for the first step, `eventContext`
|
|
132
|
+
* to link this run to a parent event scope (e.g. an HTTP request), and
|
|
133
|
+
* `strategy.name` to pick the initial state strategy. Passing a bare
|
|
134
|
+
* `input` value (legacy positional form) is no longer supported — wrap it
|
|
135
|
+
* in `{ input }`.
|
|
132
136
|
*/
|
|
133
|
-
start<I>(schemaId: string, initialContext: T,
|
|
137
|
+
start<I>(schemaId: string, initialContext: T, opts?: TWfRunOptions<I, T, IR>): Promise<TFlowOutput<T, I, IR>>;
|
|
134
138
|
/**
|
|
135
139
|
* Resumes a previously paused workflow from a saved state.
|
|
136
140
|
*
|
|
137
141
|
* @param state - Saved workflow state containing schema, context, and step indexes.
|
|
138
|
-
* @param
|
|
142
|
+
* @param opts - Optional run options: `input` for the resumed step, `eventContext`
|
|
143
|
+
* for parent-chain composable access, and `strategy.name` for the strategy
|
|
144
|
+
* that loaded this state. Legacy positional `input` is no longer supported.
|
|
139
145
|
*/
|
|
140
146
|
resume<I>(state: {
|
|
141
147
|
schemaId: string;
|
|
142
148
|
context: T;
|
|
143
149
|
indexes: number[];
|
|
144
|
-
},
|
|
150
|
+
}, opts?: TWfRunOptions<I, T, IR>): Promise<TFlowOutput<T, I, IR>>;
|
|
145
151
|
bindHandler<T extends object = object>(opts: TMoostAdapterOptions<TWfHandlerMeta, T>): void;
|
|
146
152
|
}
|
|
147
153
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WooksWf, createEmailOutlet, createHttpOutlet, createOutletHandler, createWfApp, handleWfOutletRequest, handleWfOutletRequest as handleWfOutletRequest$1, useWfFinished, useWfOutlet, useWfState, useWfState as useWfState$1, wfKind } from "@wooksjs/event-wf";
|
|
1
|
+
import { WooksWf, createEmailOutlet, createHttpOutlet, createOutletHandler, createWfApp, handleWfOutletRequest, handleWfOutletRequest as handleWfOutletRequest$1, swapStrategy, useWfFinished, useWfOutlet, useWfState, useWfState as useWfState$1, useWfStrategy, wfKind } from "@wooksjs/event-wf";
|
|
2
2
|
import { Resolve, defineMoostEventHandler, getMoostInfact, getMoostMate, setControllerContext, useScopeId } from "moost";
|
|
3
3
|
import { StepRetriableError } from "@prostojs/wf";
|
|
4
4
|
import { EncapsulatedStateStrategy, HandleStateStrategy, WfStateStoreMemory, outlet, outletEmail, outletHttp } from "@prostojs/wf/outlets";
|
|
@@ -126,7 +126,7 @@ const CONTEXT_TYPE = "WF";
|
|
|
126
126
|
* ```ts
|
|
127
127
|
* const wf = new MoostWf()
|
|
128
128
|
* app.adapter(wf).controllers(MyWorkflows).init()
|
|
129
|
-
* const result = await wf.start('my-flow', {}, input)
|
|
129
|
+
* const result = await wf.start('my-flow', {}, { input })
|
|
130
130
|
* ```
|
|
131
131
|
*/ var MoostWf = class {
|
|
132
132
|
async onNotFound() {
|
|
@@ -168,8 +168,8 @@ const CONTEXT_TYPE = "WF";
|
|
|
168
168
|
* @returns The outlet result (form payload + token), finished response, or error.
|
|
169
169
|
*/ handleOutlet(config) {
|
|
170
170
|
return handleWfOutletRequest$1(config, {
|
|
171
|
-
start: (schemaId, context, opts) => this.start(schemaId, context, opts
|
|
172
|
-
resume: (state, opts) => this.resume(state, opts
|
|
171
|
+
start: (schemaId, context, opts) => this.start(schemaId, context, opts),
|
|
172
|
+
resume: (state, opts) => this.resume(state, opts)
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
/**
|
|
@@ -177,10 +177,14 @@ const CONTEXT_TYPE = "WF";
|
|
|
177
177
|
*
|
|
178
178
|
* @param schemaId - Identifier of the registered workflow schema.
|
|
179
179
|
* @param initialContext - Initial context data for the workflow.
|
|
180
|
-
* @param
|
|
181
|
-
|
|
180
|
+
* @param opts - Optional run options: `input` for the first step, `eventContext`
|
|
181
|
+
* to link this run to a parent event scope (e.g. an HTTP request), and
|
|
182
|
+
* `strategy.name` to pick the initial state strategy. Passing a bare
|
|
183
|
+
* `input` value (legacy positional form) is no longer supported — wrap it
|
|
184
|
+
* in `{ input }`.
|
|
185
|
+
*/ start(schemaId, initialContext, opts) {
|
|
182
186
|
return this.wfApp.start(schemaId, initialContext, {
|
|
183
|
-
|
|
187
|
+
...opts,
|
|
184
188
|
cleanup: () => {
|
|
185
189
|
getMoostInfact().unregisterScope(useScopeId());
|
|
186
190
|
}
|
|
@@ -190,10 +194,12 @@ const CONTEXT_TYPE = "WF";
|
|
|
190
194
|
* Resumes a previously paused workflow from a saved state.
|
|
191
195
|
*
|
|
192
196
|
* @param state - Saved workflow state containing schema, context, and step indexes.
|
|
193
|
-
* @param
|
|
194
|
-
|
|
197
|
+
* @param opts - Optional run options: `input` for the resumed step, `eventContext`
|
|
198
|
+
* for parent-chain composable access, and `strategy.name` for the strategy
|
|
199
|
+
* that loaded this state. Legacy positional `input` is no longer supported.
|
|
200
|
+
*/ resume(state, opts) {
|
|
195
201
|
return this.wfApp.resume(state, {
|
|
196
|
-
|
|
202
|
+
...opts,
|
|
197
203
|
cleanup: () => {
|
|
198
204
|
getMoostInfact().unregisterScope(useScopeId());
|
|
199
205
|
}
|
|
@@ -268,4 +274,4 @@ const CONTEXT_TYPE = "WF";
|
|
|
268
274
|
};
|
|
269
275
|
|
|
270
276
|
//#endregion
|
|
271
|
-
export { EncapsulatedStateStrategy, HandleStateStrategy, MoostWf, Step, StepRetriableError, StepTTL, WfStateStoreMemory, Workflow, WorkflowParam, WorkflowSchema, createEmailOutlet, createHttpOutlet, createOutletHandler, handleWfOutletRequest, outlet, outletEmail, outletHttp, useWfFinished, useWfOutlet, useWfState, wfKind };
|
|
277
|
+
export { EncapsulatedStateStrategy, HandleStateStrategy, MoostWf, Step, StepRetriableError, StepTTL, WfStateStoreMemory, Workflow, WorkflowParam, WorkflowSchema, createEmailOutlet, createHttpOutlet, createOutletHandler, handleWfOutletRequest, outlet, outletEmail, outletHttp, swapStrategy, useWfFinished, useWfOutlet, useWfState, useWfStrategy, wfKind };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moostjs/event-wf",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.18",
|
|
4
4
|
"description": "@moostjs/event-wf",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"composables",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@prostojs/wf": "^0.2.1",
|
|
42
|
-
"@wooksjs/event-wf": "^0.7.
|
|
42
|
+
"@wooksjs/event-wf": "^0.7.16"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"vitest": "3.2.4"
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@prostojs/infact": "^0.4.1",
|
|
49
49
|
"@prostojs/mate": "^0.4.0",
|
|
50
|
-
"@wooksjs/event-core": "^0.7.
|
|
51
|
-
"wooks": "^0.7.
|
|
52
|
-
"moost": "^0.6.
|
|
50
|
+
"@wooksjs/event-core": "^0.7.16",
|
|
51
|
+
"wooks": "^0.7.16",
|
|
52
|
+
"moost": "^0.6.18"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"pub": "pnpm publish --access public",
|