@wooksjs/event-wf 0.4.27 → 0.4.29
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 +4 -4
- package/dist/index.d.ts +8 -8
- package/dist/index.mjs +4 -4
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -93,14 +93,14 @@ class WooksWf extends wooks.WooksAdapterBase {
|
|
|
93
93
|
id,
|
|
94
94
|
}));
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
start(schemaId, inputContext, input, spy, cleanup) {
|
|
97
97
|
return this._start(schemaId, inputContext, undefined, input, spy, cleanup);
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
resume(state, input, spy, cleanup) {
|
|
100
100
|
return this._start(state.schemaId, state.context, state.indexes, input, spy, cleanup);
|
|
101
101
|
}
|
|
102
102
|
async _start(schemaId, inputContext, indexes, input, spy, cleanup) {
|
|
103
|
-
const resume =
|
|
103
|
+
const resume = !!indexes?.length;
|
|
104
104
|
const { restoreCtx, clearCtx } = (resume ? resumeWfContext : createWfContext)({
|
|
105
105
|
inputContext,
|
|
106
106
|
schemaId,
|
|
@@ -133,7 +133,7 @@ class WooksWf extends wooks.WooksAdapterBase {
|
|
|
133
133
|
}
|
|
134
134
|
restoreCtx();
|
|
135
135
|
if (resume) {
|
|
136
|
-
result = await this.wf.resume({ schemaId: id, context: inputContext, indexes
|
|
136
|
+
result = await this.wf.resume({ schemaId: id, context: inputContext, indexes }, input, _spy);
|
|
137
137
|
break;
|
|
138
138
|
}
|
|
139
139
|
else {
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { Wooks, TWooksHandler, TWooksOptions, WooksAdapterBase } from 'wooks';
|
|
|
9
9
|
declare function useWfState(): {
|
|
10
10
|
ctx: <T>() => T;
|
|
11
11
|
input: <I>() => I | undefined;
|
|
12
|
-
schemaId: string;
|
|
12
|
+
schemaId: string | undefined;
|
|
13
13
|
indexes: () => number[] | undefined;
|
|
14
14
|
resume: boolean;
|
|
15
15
|
};
|
|
@@ -30,14 +30,14 @@ declare function createWfContext(data: Omit<TWFEventData, 'type'>, options: TEve
|
|
|
30
30
|
restoreCtx: () => _wooksjs_event_core.TGenericContextStore<TEmpty>;
|
|
31
31
|
clearCtx: () => null;
|
|
32
32
|
store: <K extends "resume" | keyof _wooksjs_event_core.TGenericContextStore<TWFEventData>>(key: K) => {
|
|
33
|
-
value: (TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>)[K]
|
|
33
|
+
value: (TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>)[K];
|
|
34
34
|
hook: <K2 extends keyof Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2) => {
|
|
35
35
|
value: Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K][K2];
|
|
36
36
|
isDefined: boolean;
|
|
37
37
|
};
|
|
38
38
|
init: <K2_1 extends keyof Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2_1, getter: () => Required<Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>[K2_1]) => Required<Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>[K2_1];
|
|
39
39
|
set: <K2_2 extends keyof Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2_2, v: Required<(TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>)[K]>[K2_2]) => Required<(TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>)[K]>[K2_2];
|
|
40
|
-
get: <K2_3 extends keyof Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2_3) => Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K][K2_3];
|
|
40
|
+
get: <K2_3 extends keyof Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2_3) => Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K][K2_3] | undefined;
|
|
41
41
|
has: <K2_4 extends keyof Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2_4) => boolean;
|
|
42
42
|
del: <K2_5 extends keyof Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2_5) => void;
|
|
43
43
|
entries: () => [string, unknown][];
|
|
@@ -51,14 +51,14 @@ declare function resumeWfContext(data: Omit<TWFEventData, 'type'>, options: TEve
|
|
|
51
51
|
restoreCtx: () => _wooksjs_event_core.TGenericContextStore<TEmpty>;
|
|
52
52
|
clearCtx: () => null;
|
|
53
53
|
store: <K extends "resume" | keyof _wooksjs_event_core.TGenericContextStore<TWFEventData>>(key: K) => {
|
|
54
|
-
value: (TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>)[K]
|
|
54
|
+
value: (TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>)[K];
|
|
55
55
|
hook: <K2 extends keyof Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2) => {
|
|
56
56
|
value: Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K][K2];
|
|
57
57
|
isDefined: boolean;
|
|
58
58
|
};
|
|
59
59
|
init: <K2_1 extends keyof Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2_1, getter: () => Required<Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>[K2_1]) => Required<Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>[K2_1];
|
|
60
60
|
set: <K2_2 extends keyof Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2_2, v: Required<(TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>)[K]>[K2_2]) => Required<(TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>)[K]>[K2_2];
|
|
61
|
-
get: <K2_3 extends keyof Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2_3) => Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K][K2_3];
|
|
61
|
+
get: <K2_3 extends keyof Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2_3) => Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K][K2_3] | undefined;
|
|
62
62
|
has: <K2_4 extends keyof Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2_4) => boolean;
|
|
63
63
|
del: <K2_5 extends keyof Required<TWFContextStore & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2_5) => void;
|
|
64
64
|
entries: () => [string, unknown][];
|
|
@@ -77,14 +77,14 @@ declare function useWFContext<T extends TEmpty>(): {
|
|
|
77
77
|
restoreCtx: () => _wooksjs_event_core.TGenericContextStore<TEmpty>;
|
|
78
78
|
clearCtx: () => null;
|
|
79
79
|
store: <K extends "resume" | keyof _wooksjs_event_core.TGenericContextStore<TWFEventData> | keyof T>(key: K) => {
|
|
80
|
-
value: (TWFContextStore & T & _wooksjs_event_core.TGenericContextStore<TWFEventData>)[K]
|
|
80
|
+
value: (TWFContextStore & T & _wooksjs_event_core.TGenericContextStore<TWFEventData>)[K];
|
|
81
81
|
hook: <K2 extends keyof Required<TWFContextStore & T & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2) => {
|
|
82
82
|
value: Required<TWFContextStore & T & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K][K2];
|
|
83
83
|
isDefined: boolean;
|
|
84
84
|
};
|
|
85
85
|
init: <K2_1 extends keyof Required<TWFContextStore & T & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2_1, getter: () => Required<Required<TWFContextStore & T & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>[K2_1]) => Required<Required<TWFContextStore & T & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>[K2_1];
|
|
86
86
|
set: <K2_2 extends keyof Required<TWFContextStore & T & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2_2, v: Required<(TWFContextStore & T & _wooksjs_event_core.TGenericContextStore<TWFEventData>)[K]>[K2_2]) => Required<(TWFContextStore & T & _wooksjs_event_core.TGenericContextStore<TWFEventData>)[K]>[K2_2];
|
|
87
|
-
get: <K2_3 extends keyof Required<TWFContextStore & T & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2_3) => Required<TWFContextStore & T & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K][K2_3];
|
|
87
|
+
get: <K2_3 extends keyof Required<TWFContextStore & T & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2_3) => Required<TWFContextStore & T & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K][K2_3] | undefined;
|
|
88
88
|
has: <K2_4 extends keyof Required<TWFContextStore & T & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2_4) => boolean;
|
|
89
89
|
del: <K2_5 extends keyof Required<TWFContextStore & T & _wooksjs_event_core.TGenericContextStore<TWFEventData>>[K]>(key2: K2_5) => void;
|
|
90
90
|
entries: () => [string, unknown][];
|
|
@@ -97,7 +97,7 @@ declare function useWFContext<T extends TEmpty>(): {
|
|
|
97
97
|
declare class WooksWorkflow<T, IR> extends Workflow<T, IR> {
|
|
98
98
|
protected wooks: Wooks;
|
|
99
99
|
constructor(wooks: Wooks);
|
|
100
|
-
protected resolveStep<I,
|
|
100
|
+
protected resolveStep<I, IR2>(stepId: string): Step<T, I, IR2>;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
declare const wfShortcuts: {
|
package/dist/index.mjs
CHANGED
|
@@ -91,14 +91,14 @@ class WooksWf extends WooksAdapterBase {
|
|
|
91
91
|
id,
|
|
92
92
|
}));
|
|
93
93
|
}
|
|
94
|
-
|
|
94
|
+
start(schemaId, inputContext, input, spy, cleanup) {
|
|
95
95
|
return this._start(schemaId, inputContext, undefined, input, spy, cleanup);
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
resume(state, input, spy, cleanup) {
|
|
98
98
|
return this._start(state.schemaId, state.context, state.indexes, input, spy, cleanup);
|
|
99
99
|
}
|
|
100
100
|
async _start(schemaId, inputContext, indexes, input, spy, cleanup) {
|
|
101
|
-
const resume =
|
|
101
|
+
const resume = !!indexes?.length;
|
|
102
102
|
const { restoreCtx, clearCtx } = (resume ? resumeWfContext : createWfContext)({
|
|
103
103
|
inputContext,
|
|
104
104
|
schemaId,
|
|
@@ -131,7 +131,7 @@ class WooksWf extends WooksAdapterBase {
|
|
|
131
131
|
}
|
|
132
132
|
restoreCtx();
|
|
133
133
|
if (resume) {
|
|
134
|
-
result = await this.wf.resume({ schemaId: id, context: inputContext, indexes
|
|
134
|
+
result = await this.wf.resume({ schemaId: id, context: inputContext, indexes }, input, _spy);
|
|
135
135
|
break;
|
|
136
136
|
}
|
|
137
137
|
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.29",
|
|
4
4
|
"description": "@wooksjs/event-wf",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -33,8 +33,8 @@
|
|
|
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.29",
|
|
37
|
+
"@wooksjs/event-core": "0.4.29"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@prostojs/logger": "^0.4.0",
|