@pogodisco/zephyr 1.4.0 → 1.4.1

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,10 +1,12 @@
1
1
  import { ActionRegistry, WorkflowObserver } from "./types.js";
2
2
  import { createWorkflow, WorkflowDef } from "./workflow-composer.js";
3
- type DepWorkflows<Deps extends ModuleMap> = keyof Deps extends never ? {} : {
3
+ type UnionToIntersection<U> = (U extends any ? (x: U) => any : never) extends (x: infer I) => any ? I : never;
4
+ type EnsureWorkflowRecord<T> = T extends Record<string, WorkflowDef<any, any, any, any, any>> ? T : Record<string, WorkflowDef<any, any, any, any, any>>;
5
+ type DepWorkflows<Deps extends ModuleMap> = keyof Deps extends never ? {} : EnsureWorkflowRecord<UnionToIntersection<{
4
6
  [D in keyof Deps & string]: {
5
7
  [K in keyof Deps[D]["workflows"] & string as `${D}.${K}`]: Deps[D]["workflows"][K];
6
8
  };
7
- }[keyof Deps & string];
9
+ }[keyof Deps & string]>>;
8
10
  type WorkflowRegistry<Own extends ModuleShape, Deps extends ModuleMap> = Own & DepWorkflows<Deps>;
9
11
  type AnyWorkflow = WorkflowDef<any, any, any, any, any>;
10
12
  type ModuleShape = Record<string, AnyWorkflow>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pogodisco/zephyr",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },