@wooksjs/event-wf 0.4.16 → 0.4.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 +5 -5
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +5 -5
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -34,7 +34,7 @@ class WooksWorkflow extends wf.Workflow {
|
|
|
34
34
|
this.wooks = wooks;
|
|
35
35
|
}
|
|
36
36
|
resolveStep(stepId) {
|
|
37
|
-
const stepIdNorm = stepId
|
|
37
|
+
const stepIdNorm = stepId.replace(/\/+/, '/');
|
|
38
38
|
try {
|
|
39
39
|
useWFContext();
|
|
40
40
|
const found = this.wooks.lookup('WF_STEP', stepIdNorm);
|
|
@@ -49,7 +49,7 @@ class WooksWorkflow extends wf.Workflow {
|
|
|
49
49
|
return found.route.handlers[0]();
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
throw new Error(`Step "${
|
|
52
|
+
throw new Error(`Step "${stepIdNorm}" not found.`);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -81,8 +81,8 @@ class WooksWf extends wooks.WooksAdapterBase {
|
|
|
81
81
|
start(schemaId, inputContext, input, spy, cleanup) {
|
|
82
82
|
return this._start(schemaId, inputContext, undefined, input, spy, cleanup);
|
|
83
83
|
}
|
|
84
|
-
resume(
|
|
85
|
-
return this._start(schemaId, state.context, state.indexes, input, spy, cleanup);
|
|
84
|
+
resume(state, input, spy, cleanup) {
|
|
85
|
+
return this._start(state.schemaId, state.context, state.indexes, input, spy, cleanup);
|
|
86
86
|
}
|
|
87
87
|
async _start(schemaId, inputContext, indexes, input, spy, cleanup) {
|
|
88
88
|
const resume = !!indexes?.length;
|
|
@@ -120,7 +120,7 @@ class WooksWf extends wooks.WooksAdapterBase {
|
|
|
120
120
|
}
|
|
121
121
|
restoreCtx();
|
|
122
122
|
if (resume) {
|
|
123
|
-
result = await this.wf.resume(id,
|
|
123
|
+
result = await this.wf.resume({ schemaId: id, context: inputContext, indexes }, input, _spy);
|
|
124
124
|
break;
|
|
125
125
|
}
|
|
126
126
|
else {
|
package/dist/index.d.ts
CHANGED
|
@@ -117,7 +117,8 @@ declare class WooksWf<T> extends WooksAdapterBase {
|
|
|
117
117
|
}): _prostojs_router.TProstoRouterPathHandle<Record<string, string | string[]>>;
|
|
118
118
|
flow(id: string, schema: TWorkflowSchema<T>, prefix?: string, init?: () => void | Promise<void>): _prostojs_router.TProstoRouterPathHandle<Record<string, string | string[]>>;
|
|
119
119
|
start<I>(schemaId: string, inputContext: T, input?: I, spy?: TWorkflowSpy<T, I>, cleanup?: () => void): Promise<TFlowOutput<T, I>>;
|
|
120
|
-
resume<I>(
|
|
120
|
+
resume<I>(state: {
|
|
121
|
+
schemaId: string;
|
|
121
122
|
indexes: number[];
|
|
122
123
|
context: T;
|
|
123
124
|
}, input?: I, spy?: TWorkflowSpy<T, I>, cleanup?: () => void): Promise<TFlowOutput<T, I>>;
|
package/dist/index.mjs
CHANGED
|
@@ -32,7 +32,7 @@ class WooksWorkflow extends Workflow {
|
|
|
32
32
|
this.wooks = wooks;
|
|
33
33
|
}
|
|
34
34
|
resolveStep(stepId) {
|
|
35
|
-
const stepIdNorm = stepId
|
|
35
|
+
const stepIdNorm = stepId.replace(/\/+/, '/');
|
|
36
36
|
try {
|
|
37
37
|
useWFContext();
|
|
38
38
|
const found = this.wooks.lookup('WF_STEP', stepIdNorm);
|
|
@@ -47,7 +47,7 @@ class WooksWorkflow extends Workflow {
|
|
|
47
47
|
return found.route.handlers[0]();
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
throw new Error(`Step "${
|
|
50
|
+
throw new Error(`Step "${stepIdNorm}" not found.`);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -79,8 +79,8 @@ class WooksWf extends WooksAdapterBase {
|
|
|
79
79
|
start(schemaId, inputContext, input, spy, cleanup) {
|
|
80
80
|
return this._start(schemaId, inputContext, undefined, input, spy, cleanup);
|
|
81
81
|
}
|
|
82
|
-
resume(
|
|
83
|
-
return this._start(schemaId, state.context, state.indexes, input, spy, cleanup);
|
|
82
|
+
resume(state, input, spy, cleanup) {
|
|
83
|
+
return this._start(state.schemaId, state.context, state.indexes, input, spy, cleanup);
|
|
84
84
|
}
|
|
85
85
|
async _start(schemaId, inputContext, indexes, input, spy, cleanup) {
|
|
86
86
|
const resume = !!indexes?.length;
|
|
@@ -118,7 +118,7 @@ class WooksWf extends WooksAdapterBase {
|
|
|
118
118
|
}
|
|
119
119
|
restoreCtx();
|
|
120
120
|
if (resume) {
|
|
121
|
-
result = await this.wf.resume(id,
|
|
121
|
+
result = await this.wf.resume({ schemaId: id, context: inputContext, indexes }, input, _spy);
|
|
122
122
|
break;
|
|
123
123
|
}
|
|
124
124
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wooksjs/event-wf",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.18",
|
|
4
4
|
"description": "@wooksjs/event-wf",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"author": "Artem Maltsev",
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"wooks": "0.4.
|
|
37
|
-
"@wooksjs/event-core": "0.4.
|
|
36
|
+
"wooks": "0.4.18",
|
|
37
|
+
"@wooksjs/event-core": "0.4.18"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@prostojs/logger": "^0.4.0",
|
|
41
|
-
"@prostojs/wf": "^0.0.
|
|
41
|
+
"@prostojs/wf": "^0.0.14"
|
|
42
42
|
},
|
|
43
43
|
"bugs": {
|
|
44
44
|
"url": "https://github.com/wooksjs/wooksjs/issues"
|