@wooksjs/event-wf 0.4.20 → 0.4.22

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
@@ -34,7 +34,7 @@ class WooksWorkflow extends wf.Workflow {
34
34
  this.wooks = wooks;
35
35
  }
36
36
  resolveStep(stepId) {
37
- const stepIdNorm = '/' + stepId.replace(/\/\/+/g, '/');
37
+ const stepIdNorm = ('/' + stepId).replace(/\/\/+/g, '/');
38
38
  try {
39
39
  useWFContext();
40
40
  const found = this.wooks.lookup('WF_STEP', stepIdNorm);
package/dist/index.d.ts CHANGED
@@ -86,10 +86,10 @@ declare function useWFContext<T extends TEmpty>(): {
86
86
  setStore: <K_2 extends "resume" | keyof _wooksjs_event_core.TGenericContextStore<TWFEventData> | keyof T>(key: K_2, v: (TWFContextStore & T & _wooksjs_event_core.TGenericContextStore<TWFEventData>)[K_2]) => void;
87
87
  };
88
88
 
89
- declare class WooksWorkflow<T> extends Workflow<T> {
89
+ declare class WooksWorkflow<T, IR> extends Workflow<T, IR> {
90
90
  protected wooks: Wooks;
91
91
  constructor(wooks: Wooks);
92
- protected resolveStep<I, D>(stepId: string): Step<T, I, D>;
92
+ protected resolveStep<I, IR>(stepId: string): Step<T, I, IR>;
93
93
  }
94
94
 
95
95
  declare const wfShortcuts: {
@@ -104,25 +104,25 @@ interface TWooksWfOptions {
104
104
  eventOptions?: TEventOptions;
105
105
  router?: TWooksOptions['router'];
106
106
  }
107
- declare class WooksWf<T> extends WooksAdapterBase {
107
+ declare class WooksWf<T = any, IR = any> extends WooksAdapterBase {
108
108
  protected opts?: TWooksWfOptions | undefined;
109
109
  protected logger: TConsoleBase;
110
- protected wf: WooksWorkflow<T>;
110
+ protected wf: WooksWorkflow<T, IR>;
111
111
  constructor(opts?: TWooksWfOptions | undefined, wooks?: Wooks | WooksAdapterBase);
112
- attachSpy<I>(fn: TWorkflowSpy<T, I>): () => void;
113
- detachSpy<I>(fn: TWorkflowSpy<T, I>): void;
114
- step<I = any, D = any>(id: string, opts: {
115
- input?: D;
116
- handler: string | TStepHandler<T, I, D>;
112
+ attachSpy<I>(fn: TWorkflowSpy<T, I, IR>): () => void;
113
+ detachSpy<I>(fn: TWorkflowSpy<T, I, IR>): void;
114
+ step<I = any>(id: string, opts: {
115
+ input?: I;
116
+ handler: string | TStepHandler<T, I, IR>;
117
117
  }): _prostojs_router.TProstoRouterPathHandle<Record<string, string | string[]>>;
118
118
  flow(id: string, schema: TWorkflowSchema<T>, prefix?: string, init?: () => void | Promise<void>): _prostojs_router.TProstoRouterPathHandle<Record<string, string | string[]>>;
119
- start<I>(schemaId: string, inputContext: T, input?: I, spy?: TWorkflowSpy<T, I>, cleanup?: () => void): Promise<TFlowOutput<T, I>>;
119
+ start<I>(schemaId: string, inputContext: T, input?: I, spy?: TWorkflowSpy<T, I, IR>, cleanup?: () => void): Promise<TFlowOutput<T, I, IR>>;
120
120
  resume<I>(state: {
121
121
  schemaId: string;
122
122
  indexes: number[];
123
123
  context: T;
124
- }, input?: I, spy?: TWorkflowSpy<T, I>, cleanup?: () => void): Promise<TFlowOutput<T, I>>;
125
- protected _start<I>(schemaId: string, inputContext: T, indexes?: number[], input?: I, spy?: TWorkflowSpy<T, I>, cleanup?: () => void): Promise<TFlowOutput<T, I>>;
124
+ }, input?: I, spy?: TWorkflowSpy<T, I, IR>, cleanup?: () => void): Promise<TFlowOutput<T, I, IR>>;
125
+ protected _start<I>(schemaId: string, inputContext: T, indexes?: number[], input?: I, spy?: TWorkflowSpy<T, I, IR>, cleanup?: () => void): Promise<TFlowOutput<T, I, IR>>;
126
126
  protected onError(e: Error): void;
127
127
  protected error(e: string | Error): void;
128
128
  }
@@ -132,7 +132,7 @@ declare class WooksWf<T> extends WooksAdapterBase {
132
132
  * @param wooks Wooks | WooksAdapterBase
133
133
  * @returns WooksWf
134
134
  */
135
- declare function createWfApp<T>(opts?: TWooksWfOptions, wooks?: Wooks | WooksAdapterBase): WooksWf<T>;
135
+ declare function createWfApp<T>(opts?: TWooksWfOptions, wooks?: Wooks | WooksAdapterBase): WooksWf<T, any>;
136
136
 
137
137
  declare function useWfState(): {
138
138
  ctx: <T>() => T;
package/dist/index.mjs CHANGED
@@ -32,7 +32,7 @@ class WooksWorkflow extends Workflow {
32
32
  this.wooks = wooks;
33
33
  }
34
34
  resolveStep(stepId) {
35
- const stepIdNorm = '/' + stepId.replace(/\/\/+/g, '/');
35
+ const stepIdNorm = ('/' + stepId).replace(/\/\/+/g, '/');
36
36
  try {
37
37
  useWFContext();
38
38
  const found = this.wooks.lookup('WF_STEP', stepIdNorm);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wooksjs/event-wf",
3
- "version": "0.4.20",
3
+ "version": "0.4.22",
4
4
  "description": "@wooksjs/event-wf",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -33,12 +33,12 @@
33
33
  "author": "Artem Maltsev",
34
34
  "license": "MIT",
35
35
  "peerDependencies": {
36
- "wooks": "0.4.20",
37
- "@wooksjs/event-core": "0.4.20"
36
+ "wooks": "0.4.22",
37
+ "@wooksjs/event-core": "0.4.22"
38
38
  },
39
39
  "dependencies": {
40
40
  "@prostojs/logger": "^0.4.0",
41
- "@prostojs/wf": "^0.0.14"
41
+ "@prostojs/wf": "^0.0.15"
42
42
  },
43
43
  "bugs": {
44
44
  "url": "https://github.com/wooksjs/wooksjs/issues"