@pogodisco/zephyr 1.2.3 → 1.2.5
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ActionRegistry } from "./types.js";
|
|
2
|
+
type SubflowResult<SubResults, SubOutput> = SubOutput extends undefined ? SubResults : SubOutput;
|
|
2
3
|
type StepResult<Reg extends ActionRegistry, ActionName extends keyof Reg> = Awaited<ReturnType<Reg[ActionName]>>;
|
|
3
4
|
export type StepDef<Reg extends ActionRegistry, ID extends string = string, ActionName extends keyof Reg = any> = {
|
|
4
5
|
id: ID;
|
|
@@ -17,7 +18,7 @@ export type WorkflowDef<Reg extends ActionRegistry, Input, Results, Steps extend
|
|
|
17
18
|
outputResolver?: (ctx: any) => Output;
|
|
18
19
|
};
|
|
19
20
|
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
20
|
-
export declare class WorkflowBuilder<Reg extends ActionRegistry, Input = unknown, Context extends Record<string, any> = {}, Steps extends StepDef<Reg, any, any>[] = [], Results = {}> {
|
|
21
|
+
export declare class WorkflowBuilder<Reg extends ActionRegistry, Input = unknown, Context extends Record<string, any> = {}, Steps extends StepDef<Reg, any, any>[] = [], Results = {}, Output = undefined> {
|
|
21
22
|
private name;
|
|
22
23
|
private registry;
|
|
23
24
|
private context;
|
|
@@ -39,7 +40,7 @@ export declare class WorkflowBuilder<Reg extends ActionRegistry, Input = unknown
|
|
|
39
40
|
input: Input;
|
|
40
41
|
results: Results;
|
|
41
42
|
context: Context;
|
|
42
|
-
}) => Parameters<Reg[ActionName]>[0]): WorkflowBuilder<Reg, Input, Context, [...Steps, StepDef<Reg, ID, ActionName>], Results & { [K in ID]: Awaited<ReturnType<Reg[ActionName]>>; }>;
|
|
43
|
+
}) => Parameters<Reg[ActionName]>[0]): WorkflowBuilder<Reg, Input, Context, [...Steps, StepDef<Reg, ID, ActionName>], Results & { [K in ID]: Awaited<ReturnType<Reg[ActionName]>>; }, undefined>;
|
|
43
44
|
parallel<Branches extends WorkflowBuilder<Reg, Input, Context, any, any>[]>(...branches: {
|
|
44
45
|
[K in keyof Branches]: (builder: WorkflowBuilder<Reg, Input, Context, [], Results>) => Branches[K];
|
|
45
46
|
}): WorkflowBuilder<Reg, Input, Context, [
|
|
@@ -49,8 +50,8 @@ export declare class WorkflowBuilder<Reg extends ActionRegistry, Input = unknown
|
|
|
49
50
|
join<ID extends string, ActionName extends keyof Reg & string>(id: ID, action: ActionName, resolve: (ctx: {
|
|
50
51
|
input: Input;
|
|
51
52
|
results: Results;
|
|
52
|
-
}) => Parameters<Reg[ActionName]>[0]): WorkflowBuilder<Reg, Input, Context, [...Steps, StepDef<Reg, ID, ActionName>], Results & { [K in ID]: Awaited<ReturnType<Reg[ActionName]>>; }>;
|
|
53
|
-
subflow<Prefix extends string, SubInput, SubResults, SubSteps extends StepDef<Reg, any, any>[]>(prefix: Prefix, workflow: WorkflowDef<Reg, SubInput, SubResults, SubSteps>, resolveInput: (ctx: {
|
|
53
|
+
}) => Parameters<Reg[ActionName]>[0]): WorkflowBuilder<Reg, Input, Context, [...Steps, StepDef<Reg, ID, ActionName>], Results & { [K in ID]: Awaited<ReturnType<Reg[ActionName]>>; }, undefined>;
|
|
54
|
+
subflow<Prefix extends string, SubInput, SubResults, SubSteps extends StepDef<Reg, any, any>[], SubOutput>(prefix: Prefix, workflow: WorkflowDef<Reg, SubInput, SubResults, SubSteps, SubOutput>, resolveInput: (ctx: {
|
|
54
55
|
input: Input;
|
|
55
56
|
results: Results;
|
|
56
57
|
context: Context;
|
|
@@ -58,7 +59,7 @@ export declare class WorkflowBuilder<Reg extends ActionRegistry, Input = unknown
|
|
|
58
59
|
...Steps,
|
|
59
60
|
...SubSteps
|
|
60
61
|
], Results & {
|
|
61
|
-
[K in Prefix]: SubResults
|
|
62
|
+
[K in Prefix]: SubflowResult<SubResults, SubOutput>;
|
|
62
63
|
}>;
|
|
63
64
|
output<Output>(fn: (ctx: {
|
|
64
65
|
input: Input;
|
|
@@ -69,5 +70,5 @@ export declare class WorkflowBuilder<Reg extends ActionRegistry, Input = unknown
|
|
|
69
70
|
private validateDependencies;
|
|
70
71
|
private getEndSteps;
|
|
71
72
|
}
|
|
72
|
-
export declare function createWorkflow<Reg extends ActionRegistry, Context extends Record<string, any> = {}>(registry: Reg, context?: Context): <Input = unknown>(name: string) => WorkflowBuilder<Reg, Input, Context, [], {}>;
|
|
73
|
+
export declare function createWorkflow<Reg extends ActionRegistry, Context extends Record<string, any> = {}>(registry: Reg, context?: Context): <Input = unknown>(name: string) => WorkflowBuilder<Reg, Input, Context, [], {}, undefined>;
|
|
73
74
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActionRegistry } from "./types.js";
|
|
2
2
|
import { createWorkflow } from "./workflow-composer.js";
|
|
3
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, [], {}>;
|
|
4
|
+
wf: <Input = unknown>(name: string) => import("./workflow-composer.js").WorkflowBuilder<Reg, Input, Context, [], {}, undefined>;
|
|
5
5
|
} & Flows & {
|
|
6
6
|
extend<Extra extends Record<string, any>>(overrides: Partial<Flows> & Extra): Flows & Extra;
|
|
7
7
|
};
|