@pogodisco/zephyr 1.3.2 → 1.3.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/types.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  import { createWorkflow } from "./workflow-composer.js";
2
2
  export type Action<F extends (...args: any[]) => any = (...args: any[]) => any> = F;
3
- export interface ActionRegistry {
4
- [key: string]: Action;
5
- }
3
+ export type ActionRegistry = Record<string, (...args: any[]) => any>;
6
4
  export type MergeActionRegistries<A extends ActionRegistry, B extends ActionRegistry> = Omit<A, keyof B> & B;
7
5
  export type ExecutionFrame = {
8
6
  stepId: string;
@@ -13,8 +11,8 @@ export type ExecutionFrame = {
13
11
  output?: any;
14
12
  error?: any;
15
13
  };
16
- export type ActionParams<Reg extends ActionRegistry, K extends keyof Reg> = Parameters<Reg[K]>;
17
- export type ActionReturn<Reg extends ActionRegistry, K extends keyof Reg> = Awaited<ReturnType<Reg[K]>>;
14
+ export type ActionParams<Reg, K extends keyof Reg> = Reg[K] extends (...args: infer P) => any ? P : never;
15
+ export type ActionReturn<Reg, K extends keyof Reg> = Reg[K] extends (...args: any[]) => infer R ? Awaited<R> : never;
18
16
  export type WorkflowMiddleware<Reg extends ActionRegistry = any> = {
19
17
  (ctx: {
20
18
  stepId: string;
@@ -49,7 +49,7 @@ export declare class WorkflowBuilder<Reg extends ActionRegistry, Input = unknown
49
49
  input: Input;
50
50
  results: Results;
51
51
  context: Context;
52
- }) => ActionParams<Reg, ActionName>): WorkflowBuilder<Reg, Input, Context, [...Steps, StepDef<Reg, ID, ActionName>], Results & { [K in ID]: Awaited<ReturnType<Reg[ActionName]>>; }, undefined>;
52
+ }) => ActionParams<Reg, ActionName>): WorkflowBuilder<Reg, Input, Context, [...Steps, StepDef<Reg, ID, ActionName>], Results & { [K in ID]: ActionReturn<Reg, ActionName>; }, undefined>;
53
53
  parallel<Branches extends WorkflowBuilder<Reg, Input, Context, any, any>[]>(...branches: {
54
54
  [K in keyof Branches]: (builder: WorkflowBuilder<Reg, Input, Context, [], Results>) => Branches[K];
55
55
  }): WorkflowBuilder<Reg, Input, Context, [
@@ -62,7 +62,7 @@ export declare class WorkflowBuilder<Reg extends ActionRegistry, Input = unknown
62
62
  }) => undefined : (ctx: {
63
63
  input: Input;
64
64
  results: Results;
65
- }) => ActionParams<Reg, ActionName>): WorkflowBuilder<Reg, Input, Context, [...Steps, StepDef<Reg, ID, ActionName>], Results & { [K in ID]: Awaited<ReturnType<Reg[ActionName]>>; }, undefined>;
65
+ }) => ActionParams<Reg, ActionName>): WorkflowBuilder<Reg, Input, Context, [...Steps, StepDef<Reg, ID, ActionName>], Results & { [K in ID]: ActionReturn<Reg, ActionName>; }, undefined>;
66
66
  subflow<Prefix extends string, SubInput, SubResults, SubSteps extends StepDef<Reg, any, any>[], SubOutput>(prefix: Prefix, workflow: WorkflowDef<Reg, SubInput, SubResults, SubSteps, SubOutput>, resolveInput?: (ctx: {
67
67
  input: Input;
68
68
  results: Results;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pogodisco/zephyr",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },