@moostjs/event-wf 0.5.33 → 0.6.0

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/README.md CHANGED
@@ -1 +1,63 @@
1
1
  # @moostjs/event-wf
2
+
3
+ Workflow event adapter for [Moost](https://moost.org), wrapping [@wooksjs/event-wf](https://github.com/wooksjs/wooksjs/tree/main/packages/event-wf) and [@prostojs/wf](https://github.com/prostojs/wf). Define workflow steps and flows using decorators, with full access to Moost's dependency injection, interceptors, and pipes.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @moostjs/event-wf
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```ts
14
+ import { MoostWf, Step, Workflow, WorkflowSchema, WorkflowParam } from '@moostjs/event-wf'
15
+ import { Controller, Moost } from 'moost'
16
+
17
+ @Controller()
18
+ class MyWorkflows {
19
+ @Step('greet')
20
+ greet(@WorkflowParam('input') input: string) {
21
+ return `Hello, ${input}!`
22
+ }
23
+
24
+ @Workflow('my-flow')
25
+ @WorkflowSchema([{ step: 'greet' }])
26
+ myFlow() {}
27
+ }
28
+
29
+ const app = new Moost()
30
+ const wf = new MoostWf()
31
+ app.adapter(wf).controllers(MyWorkflows).init()
32
+
33
+ // Start a workflow
34
+ const result = await wf.start('my-flow', {}, 'World')
35
+ ```
36
+
37
+ ## AI Agent Skills
38
+
39
+ This package includes skill files for AI coding agents (Claude Code, Cursor, Windsurf, Codex, OpenCode). Install them to give your agent deep knowledge of the `@moostjs/event-wf` API:
40
+
41
+ ```bash
42
+ # Project-local (recommended — version-locked, commits with your repo)
43
+ npx moostjs-event-wf-skill
44
+
45
+ # Global (available across all your projects)
46
+ npx moostjs-event-wf-skill --global
47
+ ```
48
+
49
+ To auto-install on `npm install`, add a postinstall script to your `package.json`:
50
+
51
+ ```json
52
+ {
53
+ "scripts": {
54
+ "postinstall": "moostjs-event-wf-skill --postinstall"
55
+ }
56
+ }
57
+ ```
58
+
59
+ ## [Official Documentation](https://moost.org/wf/)
60
+
61
+ ## License
62
+
63
+ MIT
package/dist/index.cjs CHANGED
@@ -23,7 +23,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  //#endregion
24
24
  const __wooksjs_event_wf = __toESM(require("@wooksjs/event-wf"));
25
25
  const moost = __toESM(require("moost"));
26
- const __wooksjs_event_core = __toESM(require("@wooksjs/event-core"));
27
26
  const __prostojs_wf = __toESM(require("@prostojs/wf"));
28
27
 
29
28
  //#region packages/event-wf/src/meta-types.ts
@@ -33,22 +32,67 @@ function getWfMate() {
33
32
 
34
33
  //#endregion
35
34
  //#region packages/event-wf/src/decorators/wf.decorator.ts
36
- function Step(path) {
35
+ /**
36
+ * Registers a method as a workflow step handler.
37
+ *
38
+ * @param path - Step identifier used in workflow schemas. Defaults to the method name.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * @Step('validate')
43
+ * validateInput(@WorkflowParam('input') data: unknown) {
44
+ * return schema.parse(data)
45
+ * }
46
+ * ```
47
+ */ function Step(path) {
37
48
  return getWfMate().decorate("handlers", {
38
49
  path,
39
50
  type: "WF_STEP"
40
51
  }, true);
41
52
  }
42
- function Workflow(path) {
53
+ /**
54
+ * Registers a method as a workflow flow entry point.
55
+ * Use with `@WorkflowSchema` to define the step sequence.
56
+ *
57
+ * @param path - Workflow identifier. Defaults to the method name.
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * @Workflow('onboarding')
62
+ * @WorkflowSchema([{ step: 'validate' }, { step: 'save' }])
63
+ * onboarding() {}
64
+ * ```
65
+ */ function Workflow(path) {
43
66
  return getWfMate().decorate("handlers", {
44
67
  path,
45
68
  type: "WF_FLOW"
46
69
  }, true);
47
70
  }
48
- function WorkflowSchema(schema) {
71
+ /**
72
+ * Attaches a workflow schema (step sequence) to a `@Workflow` method.
73
+ *
74
+ * @param schema - Array of step definitions composing the workflow.
75
+ */ function WorkflowSchema(schema) {
49
76
  return getWfMate().decorate("wfSchema", schema);
50
77
  }
51
- const WorkflowParam = (name) => {
78
+ /**
79
+ * Parameter decorator that resolves a workflow context value into a step handler argument.
80
+ *
81
+ * @param name - The workflow value to resolve:
82
+ * - `'state'` — Full workflow state object
83
+ * - `'resume'` — Whether the workflow is being resumed
84
+ * - `'indexes'` — Current step indexes
85
+ * - `'schemaId'` — Active workflow schema identifier
86
+ * - `'stepId'` — Current step identifier
87
+ * - `'context'` — Workflow context data
88
+ * - `'input'` — Input passed to `start()` or `resume()`
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * @Step('process')
93
+ * handle(@WorkflowParam('input') data: string, @WorkflowParam('context') ctx: MyCtx) { }
94
+ * ```
95
+ */ const WorkflowParam = (name) => {
52
96
  switch (name) {
53
97
  case "state": return (0, moost.Resolve)(() => (0, __wooksjs_event_wf.useWfState)(), "Workflow-State");
54
98
  case "resume": return (0, moost.Resolve)(() => (0, __wooksjs_event_wf.useWfState)().resume, "Workflow-Resume");
@@ -57,6 +101,7 @@ const WorkflowParam = (name) => {
57
101
  case "stepId": return (0, moost.Resolve)(() => (0, __wooksjs_event_wf.useWfState)().stepId(), "Workflow-StepId");
58
102
  case "context": return (0, moost.Resolve)(() => (0, __wooksjs_event_wf.useWfState)().ctx(), "Workflow-Context");
59
103
  case "input": return (0, moost.Resolve)(() => (0, __wooksjs_event_wf.useWfState)().input(), "Workflow-Input");
104
+ default: throw new Error(`Unknown WorkflowParam: ${name}`);
60
105
  }
61
106
  };
62
107
 
@@ -74,7 +119,20 @@ function _define_property(obj, key, value) {
74
119
  }
75
120
  const LOGGER_TITLE = "moost-wf";
76
121
  const CONTEXT_TYPE = "WF";
77
- var MoostWf = class {
122
+ /**
123
+ * Moost adapter for workflow events. Wraps `@wooksjs/event-wf` to register
124
+ * `@Step` and `@Workflow` handlers with full Moost DI and interceptor support.
125
+ *
126
+ * @template T - Workflow context type.
127
+ * @template IR - Intermediate result type.
128
+ *
129
+ * @example
130
+ * ```ts
131
+ * const wf = new MoostWf()
132
+ * app.adapter(wf).controllers(MyWorkflows).init()
133
+ * const result = await wf.start('my-flow', {}, input)
134
+ * ```
135
+ */ var MoostWf = class {
78
136
  async onNotFound() {
79
137
  return (0, moost.defineMoostEventHandler)({
80
138
  loggerTitle: LOGGER_TITLE,
@@ -92,25 +150,40 @@ var MoostWf = class {
92
150
  fn();
93
151
  });
94
152
  }
95
- getWfApp() {
153
+ /** Returns the underlying `WooksWf` application instance. */ getWfApp() {
96
154
  return this.wfApp;
97
155
  }
98
- attachSpy(fn) {
156
+ /** Attaches a spy function that observes workflow step executions. */ attachSpy(fn) {
99
157
  return this.wfApp.attachSpy(fn);
100
158
  }
101
- detachSpy(fn) {
159
+ /** Detaches a previously attached workflow spy. */ detachSpy(fn) {
102
160
  this.wfApp.detachSpy(fn);
103
161
  }
104
- start(schemaId, initialContext, input) {
105
- return this.wfApp.start(schemaId, initialContext, input, () => {}, () => {
106
- const scopeId = (0, __wooksjs_event_core.useEventId)().getId();
107
- (0, moost.getMoostInfact)().unregisterScope(scopeId);
162
+ /**
163
+ * Starts a new workflow execution.
164
+ *
165
+ * @param schemaId - Identifier of the registered workflow schema.
166
+ * @param initialContext - Initial context data for the workflow.
167
+ * @param input - Optional input passed to the first step.
168
+ */ start(schemaId, initialContext, input) {
169
+ return this.wfApp.start(schemaId, initialContext, {
170
+ input,
171
+ cleanup: () => {
172
+ (0, moost.getMoostInfact)().unregisterScope((0, moost.useScopeId)());
173
+ }
108
174
  });
109
175
  }
110
- resume(state, input) {
111
- return this.wfApp.resume(state, input, () => {}, () => {
112
- const scopeId = (0, __wooksjs_event_core.useEventId)().getId();
113
- (0, moost.getMoostInfact)().unregisterScope(scopeId);
176
+ /**
177
+ * Resumes a previously paused workflow from a saved state.
178
+ *
179
+ * @param state - Saved workflow state containing schema, context, and step indexes.
180
+ * @param input - Optional input for the resumed step.
181
+ */ resume(state, input) {
182
+ return this.wfApp.resume(state, {
183
+ input,
184
+ cleanup: () => {
185
+ (0, moost.getMoostInfact)().unregisterScope((0, moost.useScopeId)());
186
+ }
114
187
  });
115
188
  }
116
189
  bindHandler(opts) {
@@ -119,13 +192,14 @@ var MoostWf = class {
119
192
  if (!["WF_STEP", "WF_FLOW"].includes(handler.type)) continue;
120
193
  const schemaId = handler.path;
121
194
  const path = typeof schemaId === "string" ? schemaId : typeof opts.method === "string" ? opts.method : "";
122
- const targetPath = `${`${opts.prefix || ""}/${path}`.replace(/\/\/+/g, "/")}${path.endsWith("//") ? "/" : ""}`;
195
+ const targetPath = `${`${opts.prefix || ""}/${path}`.replaceAll(/\/\/+/g, "/")}${path.endsWith("//") ? "/" : ""}`;
123
196
  fn = (0, moost.defineMoostEventHandler)({
124
197
  contextType: CONTEXT_TYPE,
125
198
  loggerTitle: LOGGER_TITLE,
126
199
  getIterceptorHandler: opts.getIterceptorHandler,
127
200
  getControllerInstance: opts.getInstance,
128
201
  controllerMethod: opts.method,
202
+ controllerName: opts.controllerName,
129
203
  resolveArgs: opts.resolveArgs,
130
204
  manualUnscope: true,
131
205
  targetPath,
@@ -178,15 +252,15 @@ Object.defineProperty(exports, 'StepRetriableError', {
178
252
  exports.Workflow = Workflow;
179
253
  exports.WorkflowParam = WorkflowParam;
180
254
  exports.WorkflowSchema = WorkflowSchema;
181
- Object.defineProperty(exports, 'useWFContext', {
255
+ Object.defineProperty(exports, 'useWfState', {
182
256
  enumerable: true,
183
257
  get: function () {
184
- return __wooksjs_event_wf.useWFContext;
258
+ return __wooksjs_event_wf.useWfState;
185
259
  }
186
260
  });
187
- Object.defineProperty(exports, 'useWfState', {
261
+ Object.defineProperty(exports, 'wfKind', {
188
262
  enumerable: true,
189
263
  get: function () {
190
- return __wooksjs_event_wf.useWfState;
264
+ return __wooksjs_event_wf.wfKind;
191
265
  }
192
266
  });
package/dist/index.d.ts CHANGED
@@ -1,17 +1,81 @@
1
1
  import { TWorkflowSchema, TWorkflowSpy, TFlowOutput } from '@prostojs/wf';
2
2
  export { StepRetriableError, TFlowOutput, TWorkflowSchema } from '@prostojs/wf';
3
3
  import { WooksWf, TWooksWfOptions } from '@wooksjs/event-wf';
4
- export { useWFContext, useWfState } from '@wooksjs/event-wf';
4
+ export { useWfState, wfKind } from '@wooksjs/event-wf';
5
5
  import { TMoostAdapter, Moost, TMoostAdapterOptions } from 'moost';
6
6
 
7
+ /**
8
+ * Registers a method as a workflow step handler.
9
+ *
10
+ * @param path - Step identifier used in workflow schemas. Defaults to the method name.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * @Step('validate')
15
+ * validateInput(@WorkflowParam('input') data: unknown) {
16
+ * return schema.parse(data)
17
+ * }
18
+ * ```
19
+ */
7
20
  declare function Step(path?: string): MethodDecorator;
21
+ /**
22
+ * Registers a method as a workflow flow entry point.
23
+ * Use with `@WorkflowSchema` to define the step sequence.
24
+ *
25
+ * @param path - Workflow identifier. Defaults to the method name.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * @Workflow('onboarding')
30
+ * @WorkflowSchema([{ step: 'validate' }, { step: 'save' }])
31
+ * onboarding() {}
32
+ * ```
33
+ */
8
34
  declare function Workflow(path?: string): MethodDecorator;
35
+ /**
36
+ * Attaches a workflow schema (step sequence) to a `@Workflow` method.
37
+ *
38
+ * @param schema - Array of step definitions composing the workflow.
39
+ */
9
40
  declare function WorkflowSchema<T>(schema: TWorkflowSchema<T>): MethodDecorator;
41
+ /**
42
+ * Parameter decorator that resolves a workflow context value into a step handler argument.
43
+ *
44
+ * @param name - The workflow value to resolve:
45
+ * - `'state'` — Full workflow state object
46
+ * - `'resume'` — Whether the workflow is being resumed
47
+ * - `'indexes'` — Current step indexes
48
+ * - `'schemaId'` — Active workflow schema identifier
49
+ * - `'stepId'` — Current step identifier
50
+ * - `'context'` — Workflow context data
51
+ * - `'input'` — Input passed to `start()` or `resume()`
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * @Step('process')
56
+ * handle(@WorkflowParam('input') data: string, @WorkflowParam('context') ctx: MyCtx) { }
57
+ * ```
58
+ */
10
59
  declare const WorkflowParam: (name: "resume" | "indexes" | "schemaId" | "stepId" | "context" | "input" | "state") => ParameterDecorator & PropertyDecorator;
11
60
 
61
+ /** Metadata attached to a workflow handler by the adapter. */
12
62
  interface TWfHandlerMeta {
13
63
  path: string;
14
64
  }
65
+ /**
66
+ * Moost adapter for workflow events. Wraps `@wooksjs/event-wf` to register
67
+ * `@Step` and `@Workflow` handlers with full Moost DI and interceptor support.
68
+ *
69
+ * @template T - Workflow context type.
70
+ * @template IR - Intermediate result type.
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * const wf = new MoostWf()
75
+ * app.adapter(wf).controllers(MyWorkflows).init()
76
+ * const result = await wf.start('my-flow', {}, input)
77
+ * ```
78
+ */
15
79
  declare class MoostWf<T = any, IR = any> implements TMoostAdapter<TWfHandlerMeta> {
16
80
  protected opts?: (WooksWf<T, IR> | TWooksWfOptions) | undefined;
17
81
  private readonly debug?;
@@ -20,12 +84,28 @@ declare class MoostWf<T = any, IR = any> implements TMoostAdapter<TWfHandlerMeta
20
84
  constructor(opts?: (WooksWf<T, IR> | TWooksWfOptions) | undefined, debug?: boolean | undefined);
21
85
  onNotFound(): Promise<unknown>;
22
86
  protected moost?: Moost;
23
- protected toInit: Array<() => void>;
87
+ protected toInit: (() => void)[];
24
88
  onInit(moost: Moost): void;
89
+ /** Returns the underlying `WooksWf` application instance. */
25
90
  getWfApp(): WooksWf<T, IR>;
91
+ /** Attaches a spy function that observes workflow step executions. */
26
92
  attachSpy<I>(fn: TWorkflowSpy<T, I, IR>): () => void;
93
+ /** Detaches a previously attached workflow spy. */
27
94
  detachSpy<I>(fn: TWorkflowSpy<T, I, IR>): void;
95
+ /**
96
+ * Starts a new workflow execution.
97
+ *
98
+ * @param schemaId - Identifier of the registered workflow schema.
99
+ * @param initialContext - Initial context data for the workflow.
100
+ * @param input - Optional input passed to the first step.
101
+ */
28
102
  start<I>(schemaId: string, initialContext: T, input?: I): Promise<TFlowOutput<T, I, IR>>;
103
+ /**
104
+ * Resumes a previously paused workflow from a saved state.
105
+ *
106
+ * @param state - Saved workflow state containing schema, context, and step indexes.
107
+ * @param input - Optional input for the resumed step.
108
+ */
29
109
  resume<I>(state: {
30
110
  schemaId: string;
31
111
  context: T;
package/dist/index.mjs CHANGED
@@ -1,6 +1,5 @@
1
- import { WooksWf, createWfApp, useWFContext, useWfState, useWfState as useWfState$1 } from "@wooksjs/event-wf";
2
- import { Resolve, defineMoostEventHandler, getMoostInfact, getMoostMate, setControllerContext } from "moost";
3
- import { useEventId } from "@wooksjs/event-core";
1
+ import { WooksWf, createWfApp, useWfState, useWfState as useWfState$1, wfKind } from "@wooksjs/event-wf";
2
+ import { Resolve, defineMoostEventHandler, getMoostInfact, getMoostMate, setControllerContext, useScopeId } from "moost";
4
3
  import { StepRetriableError } from "@prostojs/wf";
5
4
 
6
5
  //#region packages/event-wf/src/meta-types.ts
@@ -10,22 +9,67 @@ function getWfMate() {
10
9
 
11
10
  //#endregion
12
11
  //#region packages/event-wf/src/decorators/wf.decorator.ts
13
- function Step(path) {
12
+ /**
13
+ * Registers a method as a workflow step handler.
14
+ *
15
+ * @param path - Step identifier used in workflow schemas. Defaults to the method name.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * @Step('validate')
20
+ * validateInput(@WorkflowParam('input') data: unknown) {
21
+ * return schema.parse(data)
22
+ * }
23
+ * ```
24
+ */ function Step(path) {
14
25
  return getWfMate().decorate("handlers", {
15
26
  path,
16
27
  type: "WF_STEP"
17
28
  }, true);
18
29
  }
19
- function Workflow(path) {
30
+ /**
31
+ * Registers a method as a workflow flow entry point.
32
+ * Use with `@WorkflowSchema` to define the step sequence.
33
+ *
34
+ * @param path - Workflow identifier. Defaults to the method name.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * @Workflow('onboarding')
39
+ * @WorkflowSchema([{ step: 'validate' }, { step: 'save' }])
40
+ * onboarding() {}
41
+ * ```
42
+ */ function Workflow(path) {
20
43
  return getWfMate().decorate("handlers", {
21
44
  path,
22
45
  type: "WF_FLOW"
23
46
  }, true);
24
47
  }
25
- function WorkflowSchema(schema) {
48
+ /**
49
+ * Attaches a workflow schema (step sequence) to a `@Workflow` method.
50
+ *
51
+ * @param schema - Array of step definitions composing the workflow.
52
+ */ function WorkflowSchema(schema) {
26
53
  return getWfMate().decorate("wfSchema", schema);
27
54
  }
28
- const WorkflowParam = (name) => {
55
+ /**
56
+ * Parameter decorator that resolves a workflow context value into a step handler argument.
57
+ *
58
+ * @param name - The workflow value to resolve:
59
+ * - `'state'` — Full workflow state object
60
+ * - `'resume'` — Whether the workflow is being resumed
61
+ * - `'indexes'` — Current step indexes
62
+ * - `'schemaId'` — Active workflow schema identifier
63
+ * - `'stepId'` — Current step identifier
64
+ * - `'context'` — Workflow context data
65
+ * - `'input'` — Input passed to `start()` or `resume()`
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * @Step('process')
70
+ * handle(@WorkflowParam('input') data: string, @WorkflowParam('context') ctx: MyCtx) { }
71
+ * ```
72
+ */ const WorkflowParam = (name) => {
29
73
  switch (name) {
30
74
  case "state": return Resolve(() => useWfState$1(), "Workflow-State");
31
75
  case "resume": return Resolve(() => useWfState$1().resume, "Workflow-Resume");
@@ -34,6 +78,7 @@ const WorkflowParam = (name) => {
34
78
  case "stepId": return Resolve(() => useWfState$1().stepId(), "Workflow-StepId");
35
79
  case "context": return Resolve(() => useWfState$1().ctx(), "Workflow-Context");
36
80
  case "input": return Resolve(() => useWfState$1().input(), "Workflow-Input");
81
+ default: throw new Error(`Unknown WorkflowParam: ${name}`);
37
82
  }
38
83
  };
39
84
 
@@ -51,7 +96,20 @@ function _define_property(obj, key, value) {
51
96
  }
52
97
  const LOGGER_TITLE = "moost-wf";
53
98
  const CONTEXT_TYPE = "WF";
54
- var MoostWf = class {
99
+ /**
100
+ * Moost adapter for workflow events. Wraps `@wooksjs/event-wf` to register
101
+ * `@Step` and `@Workflow` handlers with full Moost DI and interceptor support.
102
+ *
103
+ * @template T - Workflow context type.
104
+ * @template IR - Intermediate result type.
105
+ *
106
+ * @example
107
+ * ```ts
108
+ * const wf = new MoostWf()
109
+ * app.adapter(wf).controllers(MyWorkflows).init()
110
+ * const result = await wf.start('my-flow', {}, input)
111
+ * ```
112
+ */ var MoostWf = class {
55
113
  async onNotFound() {
56
114
  return defineMoostEventHandler({
57
115
  loggerTitle: LOGGER_TITLE,
@@ -69,25 +127,40 @@ var MoostWf = class {
69
127
  fn();
70
128
  });
71
129
  }
72
- getWfApp() {
130
+ /** Returns the underlying `WooksWf` application instance. */ getWfApp() {
73
131
  return this.wfApp;
74
132
  }
75
- attachSpy(fn) {
133
+ /** Attaches a spy function that observes workflow step executions. */ attachSpy(fn) {
76
134
  return this.wfApp.attachSpy(fn);
77
135
  }
78
- detachSpy(fn) {
136
+ /** Detaches a previously attached workflow spy. */ detachSpy(fn) {
79
137
  this.wfApp.detachSpy(fn);
80
138
  }
81
- start(schemaId, initialContext, input) {
82
- return this.wfApp.start(schemaId, initialContext, input, () => {}, () => {
83
- const scopeId = useEventId().getId();
84
- getMoostInfact().unregisterScope(scopeId);
139
+ /**
140
+ * Starts a new workflow execution.
141
+ *
142
+ * @param schemaId - Identifier of the registered workflow schema.
143
+ * @param initialContext - Initial context data for the workflow.
144
+ * @param input - Optional input passed to the first step.
145
+ */ start(schemaId, initialContext, input) {
146
+ return this.wfApp.start(schemaId, initialContext, {
147
+ input,
148
+ cleanup: () => {
149
+ getMoostInfact().unregisterScope(useScopeId());
150
+ }
85
151
  });
86
152
  }
87
- resume(state, input) {
88
- return this.wfApp.resume(state, input, () => {}, () => {
89
- const scopeId = useEventId().getId();
90
- getMoostInfact().unregisterScope(scopeId);
153
+ /**
154
+ * Resumes a previously paused workflow from a saved state.
155
+ *
156
+ * @param state - Saved workflow state containing schema, context, and step indexes.
157
+ * @param input - Optional input for the resumed step.
158
+ */ resume(state, input) {
159
+ return this.wfApp.resume(state, {
160
+ input,
161
+ cleanup: () => {
162
+ getMoostInfact().unregisterScope(useScopeId());
163
+ }
91
164
  });
92
165
  }
93
166
  bindHandler(opts) {
@@ -96,13 +169,14 @@ var MoostWf = class {
96
169
  if (!["WF_STEP", "WF_FLOW"].includes(handler.type)) continue;
97
170
  const schemaId = handler.path;
98
171
  const path = typeof schemaId === "string" ? schemaId : typeof opts.method === "string" ? opts.method : "";
99
- const targetPath = `${`${opts.prefix || ""}/${path}`.replace(/\/\/+/g, "/")}${path.endsWith("//") ? "/" : ""}`;
172
+ const targetPath = `${`${opts.prefix || ""}/${path}`.replaceAll(/\/\/+/g, "/")}${path.endsWith("//") ? "/" : ""}`;
100
173
  fn = defineMoostEventHandler({
101
174
  contextType: CONTEXT_TYPE,
102
175
  loggerTitle: LOGGER_TITLE,
103
176
  getIterceptorHandler: opts.getIterceptorHandler,
104
177
  getControllerInstance: opts.getInstance,
105
178
  controllerMethod: opts.method,
179
+ controllerName: opts.controllerName,
106
180
  resolveArgs: opts.resolveArgs,
107
181
  manualUnscope: true,
108
182
  targetPath,
@@ -144,4 +218,4 @@ var MoostWf = class {
144
218
  };
145
219
 
146
220
  //#endregion
147
- export { MoostWf, Step, StepRetriableError, Workflow, WorkflowParam, WorkflowSchema, useWFContext, useWfState };
221
+ export { MoostWf, Step, StepRetriableError, Workflow, WorkflowParam, WorkflowSchema, useWfState, wfKind };
package/package.json CHANGED
@@ -1,12 +1,39 @@
1
1
  {
2
2
  "name": "@moostjs/event-wf",
3
- "version": "0.5.33",
3
+ "version": "0.6.0",
4
4
  "description": "@moostjs/event-wf",
5
+ "keywords": [
6
+ "composables",
7
+ "framework",
8
+ "moost",
9
+ "moostjs",
10
+ "prostojs",
11
+ "wooksjs"
12
+ ],
13
+ "homepage": "https://github.com/moostjs/moostjs/tree/main/packages/event-wf#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/moostjs/moostjs/issues"
16
+ },
17
+ "license": "MIT",
18
+ "author": "Artem Maltsev",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/moostjs/moostjs.git",
22
+ "directory": "packages/event-wf"
23
+ },
24
+ "bin": {
25
+ "moostjs-event-wf-skill": "./scripts/setup-skills.js"
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "skills",
30
+ "scripts/setup-skills.js"
31
+ ],
32
+ "type": "module",
33
+ "sideEffects": false,
5
34
  "main": "dist/index.cjs",
6
35
  "module": "dist/index.mjs",
7
36
  "types": "dist/index.d.ts",
8
- "sideEffects": false,
9
- "type": "module",
10
37
  "exports": {
11
38
  "./package.json": "./package.json",
12
39
  ".": {
@@ -15,44 +42,23 @@
15
42
  "require": "./dist/index.cjs"
16
43
  }
17
44
  },
18
- "files": [
19
- "dist"
20
- ],
21
- "repository": {
22
- "type": "git",
23
- "url": "git+https://github.com/moostjs/moostjs.git",
24
- "directory": "packages/event-wf"
25
- },
26
- "keywords": [
27
- "moost",
28
- "moostjs",
29
- "composables",
30
- "framework",
31
- "wooksjs",
32
- "prostojs"
33
- ],
34
- "author": "Artem Maltsev",
35
- "license": "MIT",
36
- "bugs": {
37
- "url": "https://github.com/moostjs/moostjs/issues"
38
- },
39
- "peerDependencies": {
40
- "@wooksjs/event-core": "^0.6.2",
41
- "@prostojs/infact": "^0.3.3",
42
- "@prostojs/mate": "^0.3.3",
43
- "wooks": "^0.6.2",
44
- "moost": "^0.5.33"
45
- },
46
45
  "dependencies": {
47
46
  "@prostojs/wf": "^0.0.18",
48
- "@wooksjs/event-wf": "^0.6.2"
47
+ "@wooksjs/event-wf": "^0.7.3"
49
48
  },
50
- "homepage": "https://github.com/moostjs/moostjs/tree/main/packages/event-wf#readme",
51
49
  "devDependencies": {
52
50
  "vitest": "3.2.4"
53
51
  },
52
+ "peerDependencies": {
53
+ "@prostojs/infact": "^0.4.1",
54
+ "@prostojs/mate": "^0.4.0",
55
+ "@wooksjs/event-core": "^0.7.3",
56
+ "wooks": "^0.7.3",
57
+ "moost": "^0.6.0"
58
+ },
54
59
  "scripts": {
55
60
  "pub": "pnpm publish --access public",
56
- "test": "vitest"
61
+ "test": "vitest",
62
+ "setup-skills": "node ./scripts/setup-skills.js"
57
63
  }
58
64
  }