@moostjs/event-wf 0.5.29 → 0.5.31
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 +8 -9
- package/dist/index.d.ts +5 -4
- package/dist/index.mjs +11 -11
- package/package.json +9 -7
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
//#region rolldown:runtime
|
|
3
2
|
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
@@ -81,7 +80,7 @@ var MoostWf = class {
|
|
|
81
80
|
loggerTitle: LOGGER_TITLE,
|
|
82
81
|
getIterceptorHandler: () => this.moost?.getGlobalInterceptorHandler(),
|
|
83
82
|
getControllerInstance: () => this.moost,
|
|
84
|
-
callControllerMethod: () => new Error("WF Handler not found"),
|
|
83
|
+
callControllerMethod: () => /* @__PURE__ */ new Error("WF Handler not found"),
|
|
85
84
|
logErrors: this.debug,
|
|
86
85
|
targetPath: "",
|
|
87
86
|
handlerType: "__SYSTEM__"
|
|
@@ -134,7 +133,7 @@ var MoostWf = class {
|
|
|
134
133
|
});
|
|
135
134
|
if (handler.type === "WF_STEP") {
|
|
136
135
|
this.wfApp.step(targetPath, { handler: fn });
|
|
137
|
-
opts.logHandler(
|
|
136
|
+
opts.logHandler(`[36m(${handler.type})[32m${targetPath}`);
|
|
138
137
|
} else {
|
|
139
138
|
const mate = getWfMate();
|
|
140
139
|
let wfSchema = mate.read(opts.fakeInstance, opts.method)?.wfSchema;
|
|
@@ -145,7 +144,7 @@ var MoostWf = class {
|
|
|
145
144
|
};
|
|
146
145
|
this.toInit.push(() => {
|
|
147
146
|
this.wfApp.flow(targetPath, wfSchema || [], opts.prefix === "/" ? "" : opts.prefix, _fn);
|
|
148
|
-
opts.logHandler(
|
|
147
|
+
opts.logHandler(`[36m(${handler.type})[32m${targetPath}`);
|
|
149
148
|
});
|
|
150
149
|
}
|
|
151
150
|
}
|
|
@@ -168,17 +167,17 @@ var MoostWf = class {
|
|
|
168
167
|
};
|
|
169
168
|
|
|
170
169
|
//#endregion
|
|
171
|
-
exports.MoostWf = MoostWf
|
|
172
|
-
exports.Step = Step
|
|
170
|
+
exports.MoostWf = MoostWf;
|
|
171
|
+
exports.Step = Step;
|
|
173
172
|
Object.defineProperty(exports, 'StepRetriableError', {
|
|
174
173
|
enumerable: true,
|
|
175
174
|
get: function () {
|
|
176
175
|
return __prostojs_wf.StepRetriableError;
|
|
177
176
|
}
|
|
178
177
|
});
|
|
179
|
-
exports.Workflow = Workflow
|
|
180
|
-
exports.WorkflowParam = WorkflowParam
|
|
181
|
-
exports.WorkflowSchema = WorkflowSchema
|
|
178
|
+
exports.Workflow = Workflow;
|
|
179
|
+
exports.WorkflowParam = WorkflowParam;
|
|
180
|
+
exports.WorkflowSchema = WorkflowSchema;
|
|
182
181
|
Object.defineProperty(exports, 'useWFContext', {
|
|
183
182
|
enumerable: true,
|
|
184
183
|
get: function () {
|
package/dist/index.d.ts
CHANGED
|
@@ -7,17 +7,17 @@ import { TMoostAdapter, Moost, TMoostAdapterOptions } from 'moost';
|
|
|
7
7
|
declare function Step(path?: string): MethodDecorator;
|
|
8
8
|
declare function Workflow(path?: string): MethodDecorator;
|
|
9
9
|
declare function WorkflowSchema<T>(schema: TWorkflowSchema<T>): MethodDecorator;
|
|
10
|
-
declare const WorkflowParam: (name:
|
|
10
|
+
declare const WorkflowParam: (name: "resume" | "indexes" | "schemaId" | "stepId" | "context" | "input" | "state") => ParameterDecorator & PropertyDecorator;
|
|
11
11
|
|
|
12
12
|
interface TWfHandlerMeta {
|
|
13
13
|
path: string;
|
|
14
14
|
}
|
|
15
15
|
declare class MoostWf<T = any, IR = any> implements TMoostAdapter<TWfHandlerMeta> {
|
|
16
|
-
protected opts?: WooksWf<T, IR> | TWooksWfOptions | undefined;
|
|
16
|
+
protected opts?: (WooksWf<T, IR> | TWooksWfOptions) | undefined;
|
|
17
17
|
private readonly debug?;
|
|
18
18
|
readonly name = "workflow";
|
|
19
19
|
protected wfApp: WooksWf<T, IR>;
|
|
20
|
-
constructor(opts?: WooksWf<T, IR> | TWooksWfOptions | undefined, debug?: boolean | undefined);
|
|
20
|
+
constructor(opts?: (WooksWf<T, IR> | TWooksWfOptions) | undefined, debug?: boolean | undefined);
|
|
21
21
|
onNotFound(): Promise<unknown>;
|
|
22
22
|
protected moost?: Moost;
|
|
23
23
|
protected toInit: Array<() => void>;
|
|
@@ -34,4 +34,5 @@ declare class MoostWf<T = any, IR = any> implements TMoostAdapter<TWfHandlerMeta
|
|
|
34
34
|
bindHandler<T extends object = object>(opts: TMoostAdapterOptions<TWfHandlerMeta, T>): void;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
export { MoostWf, Step,
|
|
37
|
+
export { MoostWf, Step, Workflow, WorkflowParam, WorkflowSchema };
|
|
38
|
+
export type { TWfHandlerMeta };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WooksWf, createWfApp, useWFContext, useWfState } from "@wooksjs/event-wf";
|
|
1
|
+
import { WooksWf, createWfApp, useWFContext, useWfState, useWfState as useWfState$1 } from "@wooksjs/event-wf";
|
|
2
2
|
import { Resolve, defineMoostEventHandler, getMoostInfact, getMoostMate, setControllerContext } from "moost";
|
|
3
3
|
import { useEventId } from "@wooksjs/event-core";
|
|
4
4
|
import { StepRetriableError } from "@prostojs/wf";
|
|
@@ -27,13 +27,13 @@ function WorkflowSchema(schema) {
|
|
|
27
27
|
}
|
|
28
28
|
const WorkflowParam = (name) => {
|
|
29
29
|
switch (name) {
|
|
30
|
-
case "state": return Resolve(() => useWfState(), "Workflow-State");
|
|
31
|
-
case "resume": return Resolve(() => useWfState().resume, "Workflow-Resume");
|
|
32
|
-
case "indexes": return Resolve(() => useWfState().indexes, "Workflow-Indexes");
|
|
33
|
-
case "schemaId": return Resolve(() => useWfState().schemaId, "Workflow-SchemaId");
|
|
34
|
-
case "stepId": return Resolve(() => useWfState().stepId(), "Workflow-StepId");
|
|
35
|
-
case "context": return Resolve(() => useWfState().ctx(), "Workflow-Context");
|
|
36
|
-
case "input": return Resolve(() => useWfState().input(), "Workflow-Input");
|
|
30
|
+
case "state": return Resolve(() => useWfState$1(), "Workflow-State");
|
|
31
|
+
case "resume": return Resolve(() => useWfState$1().resume, "Workflow-Resume");
|
|
32
|
+
case "indexes": return Resolve(() => useWfState$1().indexes, "Workflow-Indexes");
|
|
33
|
+
case "schemaId": return Resolve(() => useWfState$1().schemaId, "Workflow-SchemaId");
|
|
34
|
+
case "stepId": return Resolve(() => useWfState$1().stepId(), "Workflow-StepId");
|
|
35
|
+
case "context": return Resolve(() => useWfState$1().ctx(), "Workflow-Context");
|
|
36
|
+
case "input": return Resolve(() => useWfState$1().input(), "Workflow-Input");
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
|
|
@@ -57,7 +57,7 @@ var MoostWf = class {
|
|
|
57
57
|
loggerTitle: LOGGER_TITLE,
|
|
58
58
|
getIterceptorHandler: () => this.moost?.getGlobalInterceptorHandler(),
|
|
59
59
|
getControllerInstance: () => this.moost,
|
|
60
|
-
callControllerMethod: () => new Error("WF Handler not found"),
|
|
60
|
+
callControllerMethod: () => /* @__PURE__ */ new Error("WF Handler not found"),
|
|
61
61
|
logErrors: this.debug,
|
|
62
62
|
targetPath: "",
|
|
63
63
|
handlerType: "__SYSTEM__"
|
|
@@ -110,7 +110,7 @@ var MoostWf = class {
|
|
|
110
110
|
});
|
|
111
111
|
if (handler.type === "WF_STEP") {
|
|
112
112
|
this.wfApp.step(targetPath, { handler: fn });
|
|
113
|
-
opts.logHandler(
|
|
113
|
+
opts.logHandler(`[36m(${handler.type})[32m${targetPath}`);
|
|
114
114
|
} else {
|
|
115
115
|
const mate = getWfMate();
|
|
116
116
|
let wfSchema = mate.read(opts.fakeInstance, opts.method)?.wfSchema;
|
|
@@ -121,7 +121,7 @@ var MoostWf = class {
|
|
|
121
121
|
};
|
|
122
122
|
this.toInit.push(() => {
|
|
123
123
|
this.wfApp.flow(targetPath, wfSchema || [], opts.prefix === "/" ? "" : opts.prefix, _fn);
|
|
124
|
-
opts.logHandler(
|
|
124
|
+
opts.logHandler(`[36m(${handler.type})[32m${targetPath}`);
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moostjs/event-wf",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.31",
|
|
4
4
|
"description": "@moostjs/event-wf",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -36,18 +36,20 @@
|
|
|
36
36
|
"bugs": {
|
|
37
37
|
"url": "https://github.com/moostjs/moostjs/issues"
|
|
38
38
|
},
|
|
39
|
-
"
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@wooksjs/event-core": "^0.6.1",
|
|
40
41
|
"@prostojs/infact": "^0.3.3",
|
|
41
42
|
"@prostojs/mate": "^0.3.3",
|
|
43
|
+
"wooks": "^0.6.1",
|
|
44
|
+
"moost": "^0.5.31"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
42
47
|
"@prostojs/wf": "^0.0.18",
|
|
43
|
-
"@wooksjs/event-
|
|
44
|
-
"@wooksjs/event-wf": "^0.6.0",
|
|
45
|
-
"wooks": "^0.6.0",
|
|
46
|
-
"moost": "^0.5.29"
|
|
48
|
+
"@wooksjs/event-wf": "^0.6.1"
|
|
47
49
|
},
|
|
48
50
|
"homepage": "https://github.com/moostjs/moostjs/tree/main/packages/event-wf#readme",
|
|
49
51
|
"devDependencies": {
|
|
50
|
-
"vitest": "
|
|
52
|
+
"vitest": "3.2.4"
|
|
51
53
|
},
|
|
52
54
|
"scripts": {
|
|
53
55
|
"pub": "pnpm publish --access public",
|