@wooksjs/event-wf 0.4.32 → 0.4.34

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 CHANGED
@@ -35,6 +35,7 @@ function useWfState() {
35
35
  ctx: () => event.get('inputContext'),
36
36
  input: () => event.get('input'),
37
37
  schemaId: event.get('schemaId'),
38
+ stepId: () => event.get('stepId'),
38
39
  indexes: () => event.get('indexes'),
39
40
  resume: getCtx().resume,
40
41
  };
@@ -48,9 +49,10 @@ class WooksWorkflow extends wf.Workflow {
48
49
  resolveStep(stepId) {
49
50
  const stepIdNorm = `/${stepId}`.replace(/\/\/+/g, '/');
50
51
  try {
51
- useWFContext();
52
+ const store = useWFContext().store('event');
52
53
  const found = this.wooks.lookup('WF_STEP', stepIdNorm);
53
54
  if (found.handlers?.length) {
55
+ store.set('stepId', stepIdNorm);
54
56
  return found.handlers[0]();
55
57
  }
56
58
  }
@@ -104,6 +106,7 @@ class WooksWf extends wooks.WooksAdapterBase {
104
106
  const { restoreCtx, clearCtx } = (resume ? resumeWfContext : createWfContext)({
105
107
  inputContext,
106
108
  schemaId,
109
+ stepId: null,
107
110
  indexes,
108
111
  input,
109
112
  }, this.mergeEventOptions(this.opts?.eventOptions));
package/dist/index.d.ts CHANGED
@@ -10,12 +10,14 @@ declare function useWfState(): {
10
10
  ctx: <T>() => T;
11
11
  input: <I>() => I | undefined;
12
12
  schemaId: string | undefined;
13
+ stepId: () => string | null | undefined;
13
14
  indexes: () => number[] | undefined;
14
15
  resume: boolean;
15
16
  };
16
17
 
17
18
  interface TWFEventData {
18
19
  schemaId: string;
20
+ stepId: string | null;
19
21
  inputContext: unknown;
20
22
  indexes?: number[];
21
23
  input?: unknown;
package/dist/index.mjs CHANGED
@@ -33,6 +33,7 @@ function useWfState() {
33
33
  ctx: () => event.get('inputContext'),
34
34
  input: () => event.get('input'),
35
35
  schemaId: event.get('schemaId'),
36
+ stepId: () => event.get('stepId'),
36
37
  indexes: () => event.get('indexes'),
37
38
  resume: getCtx().resume,
38
39
  };
@@ -46,9 +47,10 @@ class WooksWorkflow extends Workflow {
46
47
  resolveStep(stepId) {
47
48
  const stepIdNorm = `/${stepId}`.replace(/\/\/+/g, '/');
48
49
  try {
49
- useWFContext();
50
+ const store = useWFContext().store('event');
50
51
  const found = this.wooks.lookup('WF_STEP', stepIdNorm);
51
52
  if (found.handlers?.length) {
53
+ store.set('stepId', stepIdNorm);
52
54
  return found.handlers[0]();
53
55
  }
54
56
  }
@@ -102,6 +104,7 @@ class WooksWf extends WooksAdapterBase {
102
104
  const { restoreCtx, clearCtx } = (resume ? resumeWfContext : createWfContext)({
103
105
  inputContext,
104
106
  schemaId,
107
+ stepId: null,
105
108
  indexes,
106
109
  input,
107
110
  }, this.mergeEventOptions(this.opts?.eventOptions));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wooksjs/event-wf",
3
- "version": "0.4.32",
3
+ "version": "0.4.34",
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.32",
37
- "@wooksjs/event-core": "0.4.32"
36
+ "wooks": "0.4.34",
37
+ "@wooksjs/event-core": "0.4.34"
38
38
  },
39
39
  "dependencies": {
40
40
  "@prostojs/logger": "^0.4.0",