@wooksjs/event-wf 0.4.5 → 0.4.6
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 +16 -3
- package/dist/index.mjs +16 -3
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -24,7 +24,7 @@ function resumeWfContext(data, options) {
|
|
|
24
24
|
* @returns set of hooks { getCtx, restoreCtx, clearCtx, hookStore, getStore, setStore }
|
|
25
25
|
*/
|
|
26
26
|
function useWFContext() {
|
|
27
|
-
return eventCore.useEventContext('
|
|
27
|
+
return eventCore.useEventContext('WF');
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/******************************************************************************
|
|
@@ -126,6 +126,19 @@ class WooksWf extends wooks.WooksAdapterBase {
|
|
|
126
126
|
null;
|
|
127
127
|
if (handlers && handlers.length) {
|
|
128
128
|
let result = {};
|
|
129
|
+
let firstStep = true;
|
|
130
|
+
const _spy = (...args) => {
|
|
131
|
+
if (spy) {
|
|
132
|
+
spy(...args);
|
|
133
|
+
}
|
|
134
|
+
if (firstStep && args[0] === 'step') {
|
|
135
|
+
// cleanup input after the first step
|
|
136
|
+
firstStep = false;
|
|
137
|
+
restoreCtx();
|
|
138
|
+
const { store } = useWFContext();
|
|
139
|
+
store('event').set('input', undefined);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
129
142
|
try {
|
|
130
143
|
for (const handler of handlers) {
|
|
131
144
|
restoreCtx();
|
|
@@ -136,11 +149,11 @@ class WooksWf extends wooks.WooksAdapterBase {
|
|
|
136
149
|
}
|
|
137
150
|
restoreCtx();
|
|
138
151
|
if (resume) {
|
|
139
|
-
result = yield this.wf.resume(id, { context: inputContext, indexes }, input,
|
|
152
|
+
result = yield this.wf.resume(id, { context: inputContext, indexes }, input, _spy);
|
|
140
153
|
break;
|
|
141
154
|
}
|
|
142
155
|
else {
|
|
143
|
-
result = yield this.wf.start(id, inputContext, input,
|
|
156
|
+
result = yield this.wf.start(id, inputContext, input, _spy);
|
|
144
157
|
break;
|
|
145
158
|
}
|
|
146
159
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -22,7 +22,7 @@ function resumeWfContext(data, options) {
|
|
|
22
22
|
* @returns set of hooks { getCtx, restoreCtx, clearCtx, hookStore, getStore, setStore }
|
|
23
23
|
*/
|
|
24
24
|
function useWFContext() {
|
|
25
|
-
return useEventContext('
|
|
25
|
+
return useEventContext('WF');
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/******************************************************************************
|
|
@@ -124,6 +124,19 @@ class WooksWf extends WooksAdapterBase {
|
|
|
124
124
|
null;
|
|
125
125
|
if (handlers && handlers.length) {
|
|
126
126
|
let result = {};
|
|
127
|
+
let firstStep = true;
|
|
128
|
+
const _spy = (...args) => {
|
|
129
|
+
if (spy) {
|
|
130
|
+
spy(...args);
|
|
131
|
+
}
|
|
132
|
+
if (firstStep && args[0] === 'step') {
|
|
133
|
+
// cleanup input after the first step
|
|
134
|
+
firstStep = false;
|
|
135
|
+
restoreCtx();
|
|
136
|
+
const { store } = useWFContext();
|
|
137
|
+
store('event').set('input', undefined);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
127
140
|
try {
|
|
128
141
|
for (const handler of handlers) {
|
|
129
142
|
restoreCtx();
|
|
@@ -134,11 +147,11 @@ class WooksWf extends WooksAdapterBase {
|
|
|
134
147
|
}
|
|
135
148
|
restoreCtx();
|
|
136
149
|
if (resume) {
|
|
137
|
-
result = yield this.wf.resume(id, { context: inputContext, indexes }, input,
|
|
150
|
+
result = yield this.wf.resume(id, { context: inputContext, indexes }, input, _spy);
|
|
138
151
|
break;
|
|
139
152
|
}
|
|
140
153
|
else {
|
|
141
|
-
result = yield this.wf.start(id, inputContext, input,
|
|
154
|
+
result = yield this.wf.start(id, inputContext, input, _spy);
|
|
142
155
|
break;
|
|
143
156
|
}
|
|
144
157
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wooksjs/event-wf",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
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.4.
|
|
29
|
-
"@wooksjs/event-core": "0.4.
|
|
28
|
+
"wooks": "0.4.6",
|
|
29
|
+
"@wooksjs/event-core": "0.4.6"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@prostojs/logger": "^0.3.6",
|