@wooksjs/event-wf 0.3.9 → 0.3.10
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 +13 -5
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +13 -5
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -98,13 +98,13 @@ class WooksWf extends wooks.WooksAdapterBase {
|
|
|
98
98
|
this.wf.register(id, schema);
|
|
99
99
|
return this.on('WF_FLOW', id, () => ({ init, id }));
|
|
100
100
|
}
|
|
101
|
-
start(schemaId, inputContext, input) {
|
|
102
|
-
return this._start(schemaId, inputContext, undefined, input);
|
|
101
|
+
start(schemaId, inputContext, input, cleanup) {
|
|
102
|
+
return this._start(schemaId, inputContext, undefined, input, cleanup);
|
|
103
103
|
}
|
|
104
|
-
resume(schemaId, inputContext, indexes, input) {
|
|
105
|
-
return this._start(schemaId, inputContext, indexes, input);
|
|
104
|
+
resume(schemaId, inputContext, indexes, input, cleanup) {
|
|
105
|
+
return this._start(schemaId, inputContext, indexes, input, cleanup);
|
|
106
106
|
}
|
|
107
|
-
_start(schemaId, inputContext, indexes, input) {
|
|
107
|
+
_start(schemaId, inputContext, indexes, input, cleanup) {
|
|
108
108
|
var _a, _b;
|
|
109
109
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
110
|
const resume = !!(indexes === null || indexes === void 0 ? void 0 : indexes.length);
|
|
@@ -136,9 +136,17 @@ class WooksWf extends wooks.WooksAdapterBase {
|
|
|
136
136
|
break;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
+
if (cleanup) {
|
|
140
|
+
restoreCtx();
|
|
141
|
+
cleanup();
|
|
142
|
+
}
|
|
139
143
|
clearCtx();
|
|
140
144
|
return result;
|
|
141
145
|
}
|
|
146
|
+
if (cleanup) {
|
|
147
|
+
restoreCtx();
|
|
148
|
+
cleanup();
|
|
149
|
+
}
|
|
142
150
|
clearCtx();
|
|
143
151
|
throw new Error('Unknown schemaId: ' + schemaId);
|
|
144
152
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -140,9 +140,9 @@ export declare class WooksWf<T> extends WooksAdapterBase {
|
|
|
140
140
|
handler: string | TStepHandler<T, I, D>;
|
|
141
141
|
}): TProstoRouterPathHandle<Record<string, string | string[]>>;
|
|
142
142
|
flow(id: string, schema: TWorkflowSchema<T>, init?: () => void | Promise<void>): TProstoRouterPathHandle<Record<string, string | string[]>>;
|
|
143
|
-
start<I>(schemaId: string, inputContext: T, input?: I): Promise<TFlowOutput<T, I>>;
|
|
144
|
-
resume<I>(schemaId: string, inputContext: T, indexes: number[], input?: I): Promise<TFlowOutput<T, I>>;
|
|
145
|
-
protected _start<I>(schemaId: string, inputContext: T, indexes?: number[], input?: I): Promise<TFlowOutput<T, I>>;
|
|
143
|
+
start<I>(schemaId: string, inputContext: T, input?: I, cleanup?: () => void): Promise<TFlowOutput<T, I>>;
|
|
144
|
+
resume<I>(schemaId: string, inputContext: T, indexes: number[], input?: I, cleanup?: () => void): Promise<TFlowOutput<T, I>>;
|
|
145
|
+
protected _start<I>(schemaId: string, inputContext: T, indexes?: number[], input?: I, cleanup?: () => void): Promise<TFlowOutput<T, I>>;
|
|
146
146
|
protected onError(e: Error): void;
|
|
147
147
|
protected error(e: string | Error): void;
|
|
148
148
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -96,13 +96,13 @@ class WooksWf extends WooksAdapterBase {
|
|
|
96
96
|
this.wf.register(id, schema);
|
|
97
97
|
return this.on('WF_FLOW', id, () => ({ init, id }));
|
|
98
98
|
}
|
|
99
|
-
start(schemaId, inputContext, input) {
|
|
100
|
-
return this._start(schemaId, inputContext, undefined, input);
|
|
99
|
+
start(schemaId, inputContext, input, cleanup) {
|
|
100
|
+
return this._start(schemaId, inputContext, undefined, input, cleanup);
|
|
101
101
|
}
|
|
102
|
-
resume(schemaId, inputContext, indexes, input) {
|
|
103
|
-
return this._start(schemaId, inputContext, indexes, input);
|
|
102
|
+
resume(schemaId, inputContext, indexes, input, cleanup) {
|
|
103
|
+
return this._start(schemaId, inputContext, indexes, input, cleanup);
|
|
104
104
|
}
|
|
105
|
-
_start(schemaId, inputContext, indexes, input) {
|
|
105
|
+
_start(schemaId, inputContext, indexes, input, cleanup) {
|
|
106
106
|
var _a, _b;
|
|
107
107
|
return __awaiter(this, void 0, void 0, function* () {
|
|
108
108
|
const resume = !!(indexes === null || indexes === void 0 ? void 0 : indexes.length);
|
|
@@ -134,9 +134,17 @@ class WooksWf extends WooksAdapterBase {
|
|
|
134
134
|
break;
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
+
if (cleanup) {
|
|
138
|
+
restoreCtx();
|
|
139
|
+
cleanup();
|
|
140
|
+
}
|
|
137
141
|
clearCtx();
|
|
138
142
|
return result;
|
|
139
143
|
}
|
|
144
|
+
if (cleanup) {
|
|
145
|
+
restoreCtx();
|
|
146
|
+
cleanup();
|
|
147
|
+
}
|
|
140
148
|
clearCtx();
|
|
141
149
|
throw new Error('Unknown schemaId: ' + schemaId);
|
|
142
150
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wooksjs/event-wf",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"description": "@wooksjs/event-wf",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"author": "Artem Maltsev",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"wooks": "0.3.
|
|
29
|
-
"@wooksjs/event-core": "0.3.
|
|
28
|
+
"wooks": "0.3.10",
|
|
29
|
+
"@wooksjs/event-core": "0.3.10"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@prostojs/logger": "^0.3.6",
|