@moostjs/event-wf 0.3.21 → 0.3.23

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
@@ -110,26 +110,24 @@ class MoostWf {
110
110
  }
111
111
  }
112
112
 
113
- function WStep(path) {
113
+ function Step(path) {
114
114
  return getWfMate().decorate('handlers', { path, type: 'WF_STEP' }, true);
115
115
  }
116
- function WFlow(path) {
116
+ function Workflow(path) {
117
117
  return getWfMate().decorate('handlers', { path, type: 'WF_FLOW' }, true);
118
118
  }
119
- function WSchema(schema) {
119
+ function WorkflowSchema(schema) {
120
120
  return getWfMate().decorate('wfSchema', schema);
121
121
  }
122
- const WfCtx = (name) => moost.Resolve(() => {
123
- const c = eventWf.useWfState().ctx();
124
- return name ? c[name] : c;
125
- }, name || 'WfCtx');
126
- const WfResume = () => moost.Resolve(() => eventWf.useWfState().resume);
127
- const WfIndexes = () => moost.Resolve(() => eventWf.useWfState().indexes);
128
- const WfSchemaId = () => moost.Resolve(() => eventWf.useWfState().schemaId);
129
- const WfInput = (name) => moost.Resolve(() => {
130
- const i = eventWf.useWfState().input();
131
- return typeof i !== 'undefined' ? (name ? i[name] : i) : undefined;
132
- }, name || 'WfInput');
122
+ const WorkflowParam = (name) => {
123
+ switch (name) {
124
+ case 'resume': return moost.Resolve(() => eventWf.useWfState().resume, 'Workflow-Resume');
125
+ case 'indexes': return moost.Resolve(() => eventWf.useWfState().indexes, 'Workflow-Indexes');
126
+ case 'schemaId': return moost.Resolve(() => eventWf.useWfState().schemaId, 'Workflow-SchemaId');
127
+ case 'context': return moost.Resolve(() => eventWf.useWfState().ctx(), 'Workflow-Context');
128
+ case 'input': return moost.Resolve(() => eventWf.useWfState().input(), 'Workflow-Input');
129
+ }
130
+ };
133
131
 
134
132
  Object.defineProperty(exports, "useWFContext", {
135
133
  enumerable: true,
@@ -144,11 +142,7 @@ Object.defineProperty(exports, "StepRetriableError", {
144
142
  get: function () { return wf.StepRetriableError; }
145
143
  });
146
144
  exports.MoostWf = MoostWf;
147
- exports.WFlow = WFlow;
148
- exports.WSchema = WSchema;
149
- exports.WStep = WStep;
150
- exports.WfCtx = WfCtx;
151
- exports.WfIndexes = WfIndexes;
152
- exports.WfInput = WfInput;
153
- exports.WfResume = WfResume;
154
- exports.WfSchemaId = WfSchemaId;
145
+ exports.Step = Step;
146
+ exports.Workflow = Workflow;
147
+ exports.WorkflowParam = WorkflowParam;
148
+ exports.WorkflowSchema = WorkflowSchema;
package/dist/index.d.ts CHANGED
@@ -28,13 +28,9 @@ declare class MoostWf<T = any, IR = any> implements TMoostAdapter<TWfHandlerMeta
28
28
  bindHandler<T extends object = object>(opts: TMoostAdapterOptions<TWfHandlerMeta, T>): void;
29
29
  }
30
30
 
31
- declare function WStep(path?: string): MethodDecorator;
32
- declare function WFlow(path?: string): MethodDecorator;
33
- declare function WSchema<T>(schema: TWorkflowSchema<T>): MethodDecorator;
34
- declare const WfCtx: (name?: string) => ParameterDecorator & PropertyDecorator;
35
- declare const WfResume: () => ParameterDecorator & PropertyDecorator;
36
- declare const WfIndexes: () => ParameterDecorator & PropertyDecorator;
37
- declare const WfSchemaId: () => ParameterDecorator & PropertyDecorator;
38
- declare const WfInput: (name?: string) => ParameterDecorator & PropertyDecorator;
31
+ declare function Step(path?: string): MethodDecorator;
32
+ declare function Workflow(path?: string): MethodDecorator;
33
+ declare function WorkflowSchema<T>(schema: TWorkflowSchema<T>): MethodDecorator;
34
+ declare const WorkflowParam: (name: 'resume' | 'indexes' | 'schemaId' | 'context' | 'input') => ParameterDecorator & PropertyDecorator;
39
35
 
40
- export { MoostWf, type TWfHandlerMeta, WFlow, WSchema, WStep, WfCtx, WfIndexes, WfInput, WfResume, WfSchemaId };
36
+ export { MoostWf, Step, type TWfHandlerMeta, Workflow, WorkflowParam, WorkflowSchema };
package/dist/index.mjs CHANGED
@@ -109,25 +109,23 @@ class MoostWf {
109
109
  }
110
110
  }
111
111
 
112
- function WStep(path) {
112
+ function Step(path) {
113
113
  return getWfMate().decorate('handlers', { path, type: 'WF_STEP' }, true);
114
114
  }
115
- function WFlow(path) {
115
+ function Workflow(path) {
116
116
  return getWfMate().decorate('handlers', { path, type: 'WF_FLOW' }, true);
117
117
  }
118
- function WSchema(schema) {
118
+ function WorkflowSchema(schema) {
119
119
  return getWfMate().decorate('wfSchema', schema);
120
120
  }
121
- const WfCtx = (name) => Resolve(() => {
122
- const c = useWfState().ctx();
123
- return name ? c[name] : c;
124
- }, name || 'WfCtx');
125
- const WfResume = () => Resolve(() => useWfState().resume);
126
- const WfIndexes = () => Resolve(() => useWfState().indexes);
127
- const WfSchemaId = () => Resolve(() => useWfState().schemaId);
128
- const WfInput = (name) => Resolve(() => {
129
- const i = useWfState().input();
130
- return typeof i !== 'undefined' ? (name ? i[name] : i) : undefined;
131
- }, name || 'WfInput');
121
+ const WorkflowParam = (name) => {
122
+ switch (name) {
123
+ case 'resume': return Resolve(() => useWfState().resume, 'Workflow-Resume');
124
+ case 'indexes': return Resolve(() => useWfState().indexes, 'Workflow-Indexes');
125
+ case 'schemaId': return Resolve(() => useWfState().schemaId, 'Workflow-SchemaId');
126
+ case 'context': return Resolve(() => useWfState().ctx(), 'Workflow-Context');
127
+ case 'input': return Resolve(() => useWfState().input(), 'Workflow-Input');
128
+ }
129
+ };
132
130
 
133
- export { MoostWf, WFlow, WSchema, WStep, WfCtx, WfIndexes, WfInput, WfResume, WfSchemaId };
131
+ export { MoostWf, Step, Workflow, WorkflowParam, WorkflowSchema };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moostjs/event-wf",
3
- "version": "0.3.21",
3
+ "version": "0.3.23",
4
4
  "description": "@moostjs/event-wf",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -37,13 +37,13 @@
37
37
  },
38
38
  "peerDependencies": {},
39
39
  "dependencies": {
40
- "moost": "0.3.21",
41
- "wooks": "^0.4.24",
42
- "@wooksjs/event-core": "^0.4.24",
43
- "@wooksjs/event-wf": "^0.4.24",
40
+ "moost": "0.3.23",
41
+ "wooks": "^0.4.26",
42
+ "@wooksjs/event-core": "^0.4.26",
43
+ "@wooksjs/event-wf": "^0.4.26",
44
44
  "@prostojs/infact": "^0.1.13",
45
- "@prostojs/mate": "^0.2.1",
46
- "@prostojs/wf": "^0.0.17"
45
+ "@prostojs/mate": "^0.3.0",
46
+ "@prostojs/wf": "^0.0.18"
47
47
  },
48
48
  "homepage": "https://github.com/moostjs/moostjs/tree/main/packages/event-wf#readme"
49
49
  }