@wooksjs/event-wf 0.7.1 → 0.7.2

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
@@ -74,13 +74,13 @@ const wfSeeds = (data) => ({
74
74
  * composables from the parent scope (e.g. HTTP) via the parent chain.
75
75
  */
76
76
  function createWfContext(data, options, parentCtx) {
77
- const ctx = new __wooksjs_event_core.EventContext(parentCtx ? {
77
+ const ctxOptions = parentCtx ? {
78
78
  ...options,
79
79
  parent: parentCtx
80
- } : options);
81
- return (fn) => (0, __wooksjs_event_core.run)(ctx, () => {
82
- ctx.set(resumeKey, false);
83
- return ctx.seed(wfKind, wfSeeds(data), fn);
80
+ } : options;
81
+ return (fn) => (0, __wooksjs_event_core.createEventContext)(ctxOptions, wfKind, wfSeeds(data), () => {
82
+ (0, __wooksjs_event_core.current)().set(resumeKey, false);
83
+ return fn();
84
84
  });
85
85
  }
86
86
  /**
@@ -89,13 +89,13 @@ function createWfContext(data, options, parentCtx) {
89
89
  * linked to the parent.
90
90
  */
91
91
  function resumeWfContext(data, options, parentCtx) {
92
- const ctx = new __wooksjs_event_core.EventContext(parentCtx ? {
92
+ const ctxOptions = parentCtx ? {
93
93
  ...options,
94
94
  parent: parentCtx
95
- } : options);
96
- return (fn) => (0, __wooksjs_event_core.run)(ctx, () => {
97
- ctx.set(resumeKey, true);
98
- return ctx.seed(wfKind, wfSeeds(data), fn);
95
+ } : options;
96
+ return (fn) => (0, __wooksjs_event_core.createEventContext)(ctxOptions, wfKind, wfSeeds(data), () => {
97
+ (0, __wooksjs_event_core.current)().set(resumeKey, true);
98
+ return fn();
99
99
  });
100
100
  }
101
101
 
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { EventContext, current, defineEventKind, key, run, slot, useLogger, useRouteParams } from "@wooksjs/event-core";
1
+ import { createEventContext, current, defineEventKind, key, slot, useLogger, useRouteParams } from "@wooksjs/event-core";
2
2
  import { StepRetriableError, Workflow, createStep } from "@prostojs/wf";
3
3
  import { WooksAdapterBase } from "wooks";
4
4
 
@@ -51,13 +51,13 @@ const wfSeeds = (data) => ({
51
51
  * composables from the parent scope (e.g. HTTP) via the parent chain.
52
52
  */
53
53
  function createWfContext(data, options, parentCtx) {
54
- const ctx = new EventContext(parentCtx ? {
54
+ const ctxOptions = parentCtx ? {
55
55
  ...options,
56
56
  parent: parentCtx
57
- } : options);
58
- return (fn) => run(ctx, () => {
59
- ctx.set(resumeKey, false);
60
- return ctx.seed(wfKind, wfSeeds(data), fn);
57
+ } : options;
58
+ return (fn) => createEventContext(ctxOptions, wfKind, wfSeeds(data), () => {
59
+ current().set(resumeKey, false);
60
+ return fn();
61
61
  });
62
62
  }
63
63
  /**
@@ -66,13 +66,13 @@ function createWfContext(data, options, parentCtx) {
66
66
  * linked to the parent.
67
67
  */
68
68
  function resumeWfContext(data, options, parentCtx) {
69
- const ctx = new EventContext(parentCtx ? {
69
+ const ctxOptions = parentCtx ? {
70
70
  ...options,
71
71
  parent: parentCtx
72
- } : options);
73
- return (fn) => run(ctx, () => {
74
- ctx.set(resumeKey, true);
75
- return ctx.seed(wfKind, wfSeeds(data), fn);
72
+ } : options;
73
+ return (fn) => createEventContext(ctxOptions, wfKind, wfSeeds(data), () => {
74
+ current().set(resumeKey, true);
75
+ return fn();
76
76
  });
77
77
  }
78
78
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wooksjs/event-wf",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "@wooksjs/event-wf",
5
5
  "keywords": [
6
6
  "app",
@@ -47,13 +47,13 @@
47
47
  "devDependencies": {
48
48
  "typescript": "^5.9.3",
49
49
  "vitest": "^3.2.4",
50
- "wooks": "^0.7.1",
51
- "@wooksjs/event-core": "^0.7.1"
50
+ "@wooksjs/event-core": "^0.7.2",
51
+ "wooks": "^0.7.2"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@prostojs/logger": "^0.4.3",
55
- "@wooksjs/event-core": "^0.7.1",
56
- "wooks": "^0.7.1"
55
+ "@wooksjs/event-core": "^0.7.2",
56
+ "wooks": "^0.7.2"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "rolldown -c ../../rolldown.config.mjs",