@pogodisco/zephyr 1.2.2 → 1.2.3

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.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from "./event-stream.js";
2
2
  export * from "./registry.js";
3
3
  export * from "./workflow-executor.js";
4
4
  export * from "./workflow-composer.js";
5
+ export * from "./workflow-module.js";
5
6
  export * from "./utils.js";
6
7
  export * from "./types.js";
7
8
  export * from "./utils.js";
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ export * from "./event-stream.js";
2
2
  export * from "./registry.js";
3
3
  export * from "./workflow-executor.js";
4
4
  export * from "./workflow-composer.js";
5
+ export * from "./workflow-module.js";
5
6
  export * from "./utils.js";
6
7
  export * from "./types.js";
7
8
  export * from "./utils.js";
@@ -0,0 +1,7 @@
1
+ import { ActionRegistry } from "./types.js";
2
+ import { createWorkflow } from "./workflow-composer.js";
3
+ export declare function workflowModule<Reg extends ActionRegistry, Context extends Record<string, any>, Flows extends Record<string, any>>(registry: Reg, context: Context, factory: (wf: ReturnType<typeof createWorkflow<Reg, Context>>) => Flows): {
4
+ wf: <Input = unknown>(name: string) => import("./workflow-composer.js").WorkflowBuilder<Reg, Input, Context, [], {}>;
5
+ } & Flows & {
6
+ extend<Extra extends Record<string, any>>(overrides: Partial<Flows> & Extra): Flows & Extra;
7
+ };
@@ -0,0 +1,37 @@
1
+ import { createWorkflow } from "./workflow-composer.js";
2
+ // export function workflowModule<
3
+ // Reg extends ActionRegistry,
4
+ // Context extends Record<string, any>,
5
+ // Flows extends Record<string, any>,
6
+ // >(
7
+ // registry: Reg,
8
+ // context: Context,
9
+ // factory: (wf: ReturnType<typeof createWorkflow<Reg, Context>>) => Flows,
10
+ // ) {
11
+ // const wf = createWorkflow(registry, context);
12
+ // const flows = factory(wf);
13
+ //
14
+ // return {
15
+ // ...flows,
16
+ // extend(overrides: Partial<Flows>): Flows {
17
+ // return {
18
+ // ...flows,
19
+ // ...overrides,
20
+ // };
21
+ // },
22
+ // };
23
+ // }
24
+ export function workflowModule(registry, context, factory) {
25
+ const wf = createWorkflow(registry, context);
26
+ const flows = factory(wf);
27
+ return {
28
+ wf,
29
+ ...flows,
30
+ extend(overrides) {
31
+ return {
32
+ ...flows,
33
+ ...overrides,
34
+ };
35
+ },
36
+ };
37
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pogodisco/zephyr",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },