@pgflow/dsl 0.0.0-array-map-steps-cd94242a-20251008042921 → 0.0.0-condition-4354fcb6-20260108134756

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/dsl.d.ts CHANGED
@@ -1,9 +1,21 @@
1
1
  export type Json = string | number | boolean | null | Json[] | {
2
- [key: string]: Json | undefined;
2
+ [key: string]: Json;
3
3
  };
4
4
  export type Simplify<T> = {
5
5
  [KeyType in keyof T]: T[KeyType];
6
6
  } & {};
7
+ /**
8
+ * ContainmentPattern<T> - Type for JSON containment (@>) patterns
9
+ *
10
+ * Matches PostgreSQL's @> containment semantics where a pattern is a
11
+ * recursive partial structure that the target must contain:
12
+ * - Primitives: exact value match
13
+ * - Objects: all keys optional, recursively applied
14
+ * - Arrays: elements expected to be present in target array
15
+ */
16
+ export type ContainmentPattern<T> = T extends readonly (infer U)[] ? ContainmentPattern<U>[] : T extends object ? {
17
+ [K in keyof T]?: ContainmentPattern<T[K]>;
18
+ } : T;
7
19
  type AwaitedReturn<T> = T extends (...args: any[]) => Promise<infer R> ? R : T extends (...args: any[]) => infer R ? R : never;
8
20
  export interface Env {
9
21
  [key: string]: string | undefined;
@@ -13,8 +25,12 @@ export interface UserEnv extends Env {
13
25
  }
14
26
  export type AnyInput = Json;
15
27
  export type AnyOutput = Json;
28
+ export interface StepMeta<TOutput = AnyOutput, TSkippable extends boolean = boolean> {
29
+ output: TOutput;
30
+ skippable: TSkippable;
31
+ }
16
32
  export type EmptySteps = Record<never, never>;
17
- export type AnySteps = Record<string, AnyOutput>;
33
+ export type AnySteps = Record<string, StepMeta>;
18
34
  export type EmptyDeps = Record<never, never[]>;
19
35
  export type DefaultDeps = Record<string, string[]>;
20
36
  export type AnyDeps = Record<string, string[]>;
@@ -48,10 +64,17 @@ export type ExtractFlowOutput<TFlow extends AnyFlow> = TFlow extends Flow<infer
48
64
  [K in keyof ExtractFlowLeafSteps<TFlow> as K extends string ? K : never]: StepOutput<TFlow, K & string>;
49
65
  } : never;
50
66
  /**
51
- * Extracts the steps type from a Flow
67
+ * Extracts the steps type from a Flow (unwraps StepMeta to just output types)
68
+ * @template TFlow - The Flow type to extract from
69
+ */
70
+ export type ExtractFlowSteps<TFlow extends AnyFlow> = TFlow extends Flow<infer _TI, infer _TC, infer TS, infer _TD, infer _TEnv> ? {
71
+ [K in keyof TS]: TS[K]['output'];
72
+ } : never;
73
+ /**
74
+ * Extracts the raw steps type from a Flow (includes StepMeta structure with skippable info)
52
75
  * @template TFlow - The Flow type to extract from
53
76
  */
54
- export type ExtractFlowSteps<TFlow extends AnyFlow> = TFlow extends Flow<infer _TI, infer _TC, infer TS, infer _TD, infer _TEnv> ? TS : never;
77
+ export type ExtractFlowStepsRaw<TFlow extends AnyFlow> = TFlow extends Flow<infer _TI, infer _TC, infer TS, infer _TD, infer _TEnv> ? TS : never;
55
78
  /**
56
79
  * Extracts the dependencies type from a Flow
57
80
  * @template TFlow - The Flow type to extract from
@@ -91,7 +114,7 @@ export type ExtractFlowContext<TFlow extends AnyFlow> = TFlow extends Flow<infer
91
114
  * }
92
115
  * ```
93
116
  */
94
- export type CompatibleFlow<F extends AnyFlow, PlatformResources extends Record<string, unknown>, UserResources extends Record<string, unknown> = Record<string, never>> = (FlowContext<ExtractFlowEnv<F>> & PlatformResources & UserResources) extends ExtractFlowContext<F> ? F : never;
117
+ export type CompatibleFlow<F extends AnyFlow, PlatformResources extends Record<string, unknown>, UserResources extends Record<string, unknown> = Record<string, never>> = FlowContext<ExtractFlowEnv<F>> & PlatformResources & UserResources extends ExtractFlowContext<F> ? F : never;
95
118
  /**
96
119
  * Extracts the dependencies type from a Flow
97
120
  * @template TFlow - The Flow type to extract from
@@ -99,6 +122,7 @@ export type CompatibleFlow<F extends AnyFlow, PlatformResources extends Record<s
99
122
  type StepDepsOf<TFlow extends AnyFlow, TStepSlug extends string> = TStepSlug extends keyof ExtractFlowDeps<TFlow> ? ExtractFlowDeps<TFlow>[TStepSlug][number] : never;
100
123
  /**
101
124
  * Extracts only the leaf steps from a Flow (steps that are not dependencies of any other steps)
125
+ * Returns the output types, not the full StepMeta structure
102
126
  * @template TFlow - The Flow type to extract from
103
127
  */
104
128
  export type ExtractFlowLeafSteps<TFlow extends AnyFlow> = {
@@ -106,17 +130,28 @@ export type ExtractFlowLeafSteps<TFlow extends AnyFlow> = {
106
130
  };
107
131
  export type StepOutput<TFlow extends AnyFlow, TStepSlug extends string> = TStepSlug extends keyof ExtractFlowSteps<TFlow> ? ExtractFlowSteps<TFlow>[TStepSlug] : never;
108
132
  /**
109
- * This ensures that:
110
- * 1. The run input is always included
111
- * 2. Only declared dependencies are included
112
- * 3. No extra properties are allowed
113
- * Utility type to extract the input type for a specific step in a flow
133
+ * Checks if a step is skippable (has whenUnmet: 'skip' | 'skip-cascade' or retriesExhausted: 'skip' | 'skip-cascade')
134
+ * @template TFlow - The Flow type
135
+ * @template TStepSlug - The step slug to check
114
136
  */
115
- export type StepInput<TFlow extends AnyFlow, TStepSlug extends string> = {
116
- run: ExtractFlowInput<TFlow>;
117
- } & {
118
- [K in Extract<keyof ExtractFlowSteps<TFlow>, StepDepsOf<TFlow, TStepSlug>>]: ExtractFlowSteps<TFlow>[K];
137
+ export type IsStepSkippable<TFlow extends AnyFlow, TStepSlug extends string> = TStepSlug extends keyof ExtractFlowStepsRaw<TFlow> ? ExtractFlowStepsRaw<TFlow>[TStepSlug]['skippable'] : false;
138
+ type RequiredDeps<TFlow extends AnyFlow, TStepSlug extends string> = {
139
+ [K in Extract<keyof ExtractFlowSteps<TFlow>, StepDepsOf<TFlow, TStepSlug>> as IsStepSkippable<TFlow, K & string> extends true ? never : K]: ExtractFlowSteps<TFlow>[K];
119
140
  };
141
+ type OptionalDeps<TFlow extends AnyFlow, TStepSlug extends string> = {
142
+ [K in Extract<keyof ExtractFlowSteps<TFlow>, StepDepsOf<TFlow, TStepSlug>> as IsStepSkippable<TFlow, K & string> extends true ? K : never]?: ExtractFlowSteps<TFlow>[K];
143
+ };
144
+ /**
145
+ * Asymmetric step input type:
146
+ * - Root steps (no dependencies): receive flow input directly
147
+ * - Dependent steps: receive only their dependencies (flow input available via context)
148
+ * - Skippable deps (whenUnmet/retriesExhausted: 'skip' | 'skip-cascade') are optional
149
+ * - Required deps are required
150
+ *
151
+ * This enables functional composition where subflows can receive typed inputs
152
+ * without the 'run' wrapper that previously blocked type matching.
153
+ */
154
+ export type StepInput<TFlow extends AnyFlow, TStepSlug extends string> = StepDepsOf<TFlow, TStepSlug> extends never ? ExtractFlowInput<TFlow> : Simplify<RequiredDeps<TFlow, TStepSlug> & OptionalDeps<TFlow, TStepSlug>>;
120
155
  export interface RuntimeOptions {
121
156
  maxAttempts?: number;
122
157
  baseDelay?: number;
@@ -149,13 +184,183 @@ export interface BaseContext<TEnv extends Env = Env> {
149
184
  rawMessage: MessageRecord;
150
185
  workerConfig: Readonly<WorkerConfig>;
151
186
  }
152
- export interface FlowContext<TEnv extends Env = Env> extends BaseContext<TEnv> {
187
+ /**
188
+ * Flow context extends base with stepTask and flowInput.
189
+ *
190
+ * Note: flowInput is a Promise to support lazy loading. Only root non-map steps
191
+ * receive flow_input from SQL; other step types lazy-load it on demand.
192
+ * Use `await ctx.flowInput` to access the original flow input.
193
+ */
194
+ export interface FlowContext<TEnv extends Env = Env, TFlowInput extends AnyInput = AnyInput> extends BaseContext<TEnv> {
153
195
  stepTask: StepTaskRecord<AnyFlow>;
196
+ flowInput: Promise<TFlowInput>;
154
197
  }
155
198
  export type Context<T extends Record<string, unknown> = Record<string, never>, TEnv extends Env = Env> = FlowContext<TEnv> & T;
199
+ /**
200
+ * Options for handling unmet conditions (when 'if' pattern doesn't match input)
201
+ *
202
+ * @example
203
+ * // Fail the step (and run) when pattern doesn't match
204
+ * { if: { enabled: true }, whenUnmet: 'fail' }
205
+ *
206
+ * @example
207
+ * // Skip this step only when pattern doesn't match
208
+ * { if: { enabled: true }, whenUnmet: 'skip' }
209
+ *
210
+ * @example
211
+ * // Skip this step and all dependents when pattern doesn't match
212
+ * { if: { enabled: true }, whenUnmet: 'skip-cascade' }
213
+ *
214
+ * @remarks
215
+ * - `'fail'`: When pattern doesn't match, step fails -> run fails (default)
216
+ * - `'skip'`: When pattern doesn't match, skip step and continue (step key omitted from dependent inputs)
217
+ * - `'skip-cascade'`: When pattern doesn't match, skip step + mark all dependents as skipped
218
+ */
219
+ export type WhenUnmetMode = 'fail' | 'skip' | 'skip-cascade';
220
+ /**
221
+ * Options for handling errors after all retries are exhausted
222
+ *
223
+ * @example
224
+ * // Fail the run after retries exhausted (default)
225
+ * { retriesExhausted: 'fail' }
226
+ *
227
+ * @example
228
+ * // Skip this step after retries exhausted, continue run
229
+ * { retriesExhausted: 'skip' }
230
+ *
231
+ * @example
232
+ * // Skip this step and all dependents after retries exhausted
233
+ * { retriesExhausted: 'skip-cascade' }
234
+ *
235
+ * @remarks
236
+ * - `'fail'`: Step fails -> run fails (default behavior)
237
+ * - `'skip'`: Mark step as skipped, continue run (step key omitted from dependent inputs)
238
+ * - `'skip-cascade'`: Skip step + mark all dependents as skipped too
239
+ *
240
+ * @note
241
+ * TYPE_VIOLATION errors (e.g., single step returns non-array for map dependent)
242
+ * are NOT subject to retriesExhausted - these always hard fail as they indicate
243
+ * programming errors, not runtime conditions.
244
+ */
245
+ export type RetriesExhaustedMode = 'fail' | 'skip' | 'skip-cascade';
246
+ /**
247
+ * Helper type for dependent step handlers - creates deps object with correct optionality.
248
+ * Skippable deps (steps with whenUnmet/retriesExhausted: 'skip' | 'skip-cascade') are optional.
249
+ * Required deps are required.
250
+ */
251
+ type DepsWithOptionalSkippable<TSteps extends AnySteps, TDeps extends string> = {
252
+ [K in TDeps as K extends keyof TSteps ? TSteps[K]['skippable'] extends true ? never : K : K]: K extends keyof TSteps ? TSteps[K]['output'] : never;
253
+ } & {
254
+ [K in TDeps as K extends keyof TSteps ? TSteps[K]['skippable'] extends true ? K : never : never]?: K extends keyof TSteps ? TSteps[K]['output'] : never;
255
+ };
156
256
  export interface StepRuntimeOptions extends RuntimeOptions {
157
257
  startDelay?: number;
258
+ /**
259
+ * Pattern to match using PostgreSQL's @> (contains) operator
260
+ *
261
+ * @example
262
+ * // Root step: match against flow input
263
+ * { if: { role: 'admin', active: true } }
264
+ *
265
+ * @example
266
+ * // Dependent step: match against dependency outputs
267
+ * { if: { prevStep: { status: 'success' } } }
268
+ *
269
+ * @remarks
270
+ * - Primitives: exact value match
271
+ * - Objects: all keys optional, recursively applied
272
+ * - Arrays: elements expected to be present in target array
273
+ *
274
+ * @see WhenUnmetMode for controlling what happens when pattern doesn't match
275
+ */
276
+ if?: Json;
277
+ /**
278
+ * Negative pattern - step executes when input does NOT match this pattern
279
+ *
280
+ * @example
281
+ * // Root step: execute when NOT an admin
282
+ * { ifNot: { role: 'admin' } }
283
+ *
284
+ * @example
285
+ * // Combined with 'if' for AND semantics: "active admin who is NOT suspended"
286
+ * { if: { role: 'admin', active: true }, ifNot: { suspended: true } }
287
+ *
288
+ * @remarks
289
+ * - Uses PostgreSQL's @> containment check, negated
290
+ * - When combined with 'if', BOTH must pass (AND semantics)
291
+ * - For mutual exclusion: use same pattern with if on one step, ifNot on another
292
+ *
293
+ * @see WhenUnmetMode for controlling what happens when condition not met
294
+ */
295
+ ifNot?: Json;
296
+ /**
297
+ * What to do when the 'if' pattern doesn't match the input
298
+ *
299
+ * @default 'skip'
300
+ *
301
+ * @example
302
+ * { whenUnmet: 'fail' } // Pattern doesn't match -> step fails -> run fails
303
+ * { whenUnmet: 'skip' } // Pattern doesn't match -> skip step, continue run
304
+ * { whenUnmet: 'skip-cascade' } // Pattern doesn't match -> skip step + all dependents
305
+ *
306
+ * @see WhenUnmetMode for detailed documentation of each mode
307
+ */
308
+ whenUnmet?: WhenUnmetMode;
309
+ /**
310
+ * What to do when handler throws an error after all retries are exhausted
311
+ *
312
+ * @default 'fail'
313
+ *
314
+ * @example
315
+ * { retriesExhausted: 'fail' } // Step fails -> run fails
316
+ * { retriesExhausted: 'skip' } // Skip step, continue run
317
+ * { retriesExhausted: 'skip-cascade' } // Skip step + all dependents
318
+ *
319
+ * @remarks
320
+ * Only applies after maxAttempts retries are exhausted.
321
+ * TYPE_VIOLATION errors always fail regardless of this setting.
322
+ *
323
+ * @see RetriesExhaustedMode for detailed documentation of each mode
324
+ */
325
+ retriesExhausted?: RetriesExhaustedMode;
158
326
  }
327
+ interface BaseStepRuntimeOptions extends RuntimeOptions {
328
+ startDelay?: number;
329
+ retriesExhausted?: RetriesExhaustedMode;
330
+ }
331
+ /**
332
+ * Condition with 'if' required (ifNot optional) - allows whenUnmet.
333
+ * whenUnmet only makes sense when there's a condition to be "unmet".
334
+ */
335
+ type WithIfCondition<T> = {
336
+ if: ContainmentPattern<T>;
337
+ ifNot?: ContainmentPattern<T>;
338
+ whenUnmet?: WhenUnmetMode;
339
+ };
340
+ /**
341
+ * Condition with 'ifNot' required (if optional) - allows whenUnmet.
342
+ */
343
+ type WithIfNotCondition<T> = {
344
+ if?: ContainmentPattern<T>;
345
+ ifNot: ContainmentPattern<T>;
346
+ whenUnmet?: WhenUnmetMode;
347
+ };
348
+ /**
349
+ * No condition - if, ifNot, and whenUnmet are all forbidden.
350
+ * This ensures whenUnmet can only be used with a condition.
351
+ */
352
+ type WithoutCondition = {
353
+ if?: never;
354
+ ifNot?: never;
355
+ whenUnmet?: never;
356
+ };
357
+ /**
358
+ * Discriminated union for condition options.
359
+ * whenUnmet is only allowed when if or ifNot is provided.
360
+ */
361
+ type ConditionOpts<T> = WithIfCondition<T> | WithIfNotCondition<T> | WithoutCondition;
362
+ export type RootStepOptions<TFlowInput> = BaseStepRuntimeOptions & ConditionOpts<TFlowInput>;
363
+ export type DependentStepOptions<TDeps> = BaseStepRuntimeOptions & ConditionOpts<TDeps>;
159
364
  export interface StepDefinition<TInput extends AnyInput, TOutput extends AnyOutput, TContext = FlowContext> {
160
365
  slug: string;
161
366
  handler: (input: TInput, context: TContext) => TOutput | Promise<TOutput>;
@@ -181,22 +386,43 @@ Steps extends AnySteps = EmptySteps, StepDependencies extends AnyDeps = EmptyDep
181
386
  } & RuntimeOptions>, stepDefinitions?: Record<string, StepDefinition<AnyInput, AnyOutput>>, stepOrder?: string[]);
182
387
  /**
183
388
  * Get a specific step definition by slug with proper typing
389
+ *
390
+ * Returns the step definition with asymmetric input typing:
391
+ * - Root steps (no dependencies): input is flowInput directly
392
+ * - Dependent steps: input is deps object only (flowInput available via context)
393
+ * - Skippable deps are optional, required deps are required
394
+ *
184
395
  * @throws Error if the step with the given slug doesn't exist
185
396
  */
186
- getStepDefinition<SlugType extends keyof Steps & keyof StepDependencies>(slug: SlugType): StepDefinition<Simplify<{
187
- run: TFlowInput;
188
- } & {
189
- [K in StepDependencies[SlugType][number]]: K extends keyof Steps ? Steps[K] : never;
190
- }>, Steps[SlugType]>;
191
- step<Slug extends string, THandler extends (input: Simplify<{
192
- run: TFlowInput;
397
+ getStepDefinition<SlugType extends keyof Steps & keyof StepDependencies>(slug: SlugType): StepDefinition<StepDependencies[SlugType] extends [] | readonly [] ? TFlowInput : Simplify<{
398
+ [K in StepDependencies[SlugType][number] as K extends keyof Steps ? Steps[K]['skippable'] extends true ? never : K : never]: K extends keyof Steps ? Steps[K]['output'] : never;
193
399
  } & {
194
- [K in Deps]: K extends keyof Steps ? Steps[K] : never;
195
- }>, context: FlowContext<TEnv> & TContext) => any, Deps extends Extract<keyof Steps, string> = never>(opts: Simplify<{
400
+ [K in StepDependencies[SlugType][number] as K extends keyof Steps ? Steps[K]['skippable'] extends true ? K : never : never]?: K extends keyof Steps ? Steps[K]['output'] : never;
401
+ }>, // Dependent step: only deps (skippable deps optional)
402
+ Steps[SlugType]['output'], FlowContext<TEnv, TFlowInput> & TContext>;
403
+ step<Slug extends string, TOutput, TWhenUnmet extends WhenUnmetMode | undefined = undefined, TRetries extends RetriesExhaustedMode | undefined = undefined>(opts: Simplify<{
196
404
  slug: Slug extends keyof Steps ? never : Slug;
197
- dependsOn?: Deps[];
198
- } & StepRuntimeOptions>, handler: THandler): Flow<TFlowInput, TContext, Steps & {
199
- [K in Slug]: AwaitedReturn<THandler>;
405
+ dependsOn?: never;
406
+ retriesExhausted?: TRetries;
407
+ } & ((WithIfCondition<TFlowInput> & {
408
+ whenUnmet?: TWhenUnmet;
409
+ }) | (WithIfNotCondition<TFlowInput> & {
410
+ whenUnmet?: TWhenUnmet;
411
+ }) | WithoutCondition) & Omit<BaseStepRuntimeOptions, 'retriesExhausted'>>, handler: (flowInput: TFlowInput, context: FlowContext<TEnv, TFlowInput> & TContext) => TOutput | Promise<TOutput>): Flow<TFlowInput, TContext, Steps & {
412
+ [K in Slug]: StepMeta<Awaited<TOutput>, TWhenUnmet extends 'skip' | 'skip-cascade' ? true : TRetries extends 'skip' | 'skip-cascade' ? true : false>;
413
+ }, StepDependencies & {
414
+ [K in Slug]: [];
415
+ }, TEnv>;
416
+ step<Slug extends string, Deps extends Extract<keyof Steps, string>, TOutput, TWhenUnmet extends WhenUnmetMode | undefined = undefined, TRetries extends RetriesExhaustedMode | undefined = undefined>(opts: Simplify<{
417
+ slug: Slug extends keyof Steps ? never : Slug;
418
+ dependsOn: [Deps, ...Deps[]];
419
+ retriesExhausted?: TRetries;
420
+ } & ((WithIfCondition<Simplify<DepsWithOptionalSkippable<Steps, Deps>>> & {
421
+ whenUnmet?: TWhenUnmet;
422
+ }) | (WithIfNotCondition<Simplify<DepsWithOptionalSkippable<Steps, Deps>>> & {
423
+ whenUnmet?: TWhenUnmet;
424
+ }) | WithoutCondition) & Omit<BaseStepRuntimeOptions, 'retriesExhausted'>>, handler: (deps: Simplify<DepsWithOptionalSkippable<Steps, Deps>>, context: FlowContext<TEnv, TFlowInput> & TContext) => TOutput | Promise<TOutput>): Flow<TFlowInput, TContext, Steps & {
425
+ [K in Slug]: StepMeta<Awaited<TOutput>, TWhenUnmet extends 'skip' | 'skip-cascade' ? true : TRetries extends 'skip' | 'skip-cascade' ? true : false>;
200
426
  }, StepDependencies & {
201
427
  [K in Slug]: Deps[];
202
428
  }, TEnv>;
@@ -210,18 +436,32 @@ Steps extends AnySteps = EmptySteps, StepDependencies extends AnyDeps = EmptyDep
210
436
  * @template THandler - The handler function that must return an array or Promise<array>
211
437
  * @template Deps - The step dependencies (must be existing step slugs)
212
438
  * @param opts - Step configuration including slug, dependencies, and runtime options
213
- * @param handler - Function that processes input and returns an array
439
+ * @param handler - Function that processes input and returns an array (null/undefined rejected)
214
440
  * @returns A new Flow instance with the array step added
215
441
  */
216
- array<Slug extends string, THandler extends (input: Simplify<{
217
- run: TFlowInput;
218
- } & {
219
- [K in Deps]: K extends keyof Steps ? Steps[K] : never;
220
- }>, context: BaseContext & TContext) => Array<Json> | Promise<Array<Json>>, Deps extends Extract<keyof Steps, string> = never>(opts: Simplify<{
442
+ array<Slug extends string, TOutput extends readonly any[], TWhenUnmet extends WhenUnmetMode | undefined = undefined, TRetries extends RetriesExhaustedMode | undefined = undefined>(opts: Simplify<{
221
443
  slug: Slug extends keyof Steps ? never : Slug;
222
- dependsOn?: Deps[];
223
- } & StepRuntimeOptions>, handler: THandler): Flow<TFlowInput, TContext, Steps & {
224
- [K in Slug]: AwaitedReturn<THandler>;
444
+ dependsOn?: never;
445
+ retriesExhausted?: TRetries;
446
+ } & ((WithIfCondition<TFlowInput> & {
447
+ whenUnmet?: TWhenUnmet;
448
+ }) | (WithIfNotCondition<TFlowInput> & {
449
+ whenUnmet?: TWhenUnmet;
450
+ }) | WithoutCondition) & Omit<BaseStepRuntimeOptions, 'retriesExhausted'>>, handler: (flowInput: TFlowInput, context: FlowContext<TEnv, TFlowInput> & TContext) => TOutput | Promise<TOutput>): Flow<TFlowInput, TContext, Steps & {
451
+ [K in Slug]: StepMeta<Awaited<TOutput>, TWhenUnmet extends 'skip' | 'skip-cascade' ? true : TRetries extends 'skip' | 'skip-cascade' ? true : false>;
452
+ }, StepDependencies & {
453
+ [K in Slug]: [];
454
+ }, TEnv>;
455
+ array<Slug extends string, Deps extends Extract<keyof Steps, string>, TOutput extends readonly any[], TWhenUnmet extends WhenUnmetMode | undefined = undefined, TRetries extends RetriesExhaustedMode | undefined = undefined>(opts: Simplify<{
456
+ slug: Slug extends keyof Steps ? never : Slug;
457
+ dependsOn: [Deps, ...Deps[]];
458
+ retriesExhausted?: TRetries;
459
+ } & ((WithIfCondition<Simplify<DepsWithOptionalSkippable<Steps, Deps>>> & {
460
+ whenUnmet?: TWhenUnmet;
461
+ }) | (WithIfNotCondition<Simplify<DepsWithOptionalSkippable<Steps, Deps>>> & {
462
+ whenUnmet?: TWhenUnmet;
463
+ }) | WithoutCondition) & Omit<BaseStepRuntimeOptions, 'retriesExhausted'>>, handler: (deps: Simplify<DepsWithOptionalSkippable<Steps, Deps>>, context: FlowContext<TEnv, TFlowInput> & TContext) => TOutput | Promise<TOutput>): Flow<TFlowInput, TContext, Steps & {
464
+ [K in Slug]: StepMeta<Awaited<TOutput>, TWhenUnmet extends 'skip' | 'skip-cascade' ? true : TRetries extends 'skip' | 'skip-cascade' ? true : false>;
225
465
  }, StepDependencies & {
226
466
  [K in Slug]: Deps[];
227
467
  }, TEnv>;
@@ -236,21 +476,35 @@ Steps extends AnySteps = EmptySteps, StepDependencies extends AnyDeps = EmptyDep
236
476
  * @param handler - Function that processes individual array elements
237
477
  * @returns A new Flow instance with the map step added
238
478
  */
239
- map<Slug extends string, THandler>(opts: Simplify<{
479
+ map<Slug extends string, THandler extends TFlowInput extends readonly (infer Item)[] ? (item: Item, context: FlowContext<TEnv, TFlowInput> & TContext) => Json | Promise<Json> : never, TWhenUnmet extends WhenUnmetMode | undefined = undefined, TRetries extends RetriesExhaustedMode | undefined = undefined>(opts: Simplify<{
240
480
  slug: Slug extends keyof Steps ? never : Slug;
241
- } & StepRuntimeOptions>, handler: TFlowInput extends readonly (infer Item)[] ? THandler & ((item: Item, context: BaseContext & TContext) => Json | Promise<Json>) : never): Flow<TFlowInput, TContext & BaseContext, Steps & {
242
- [K in Slug]: AwaitedReturn<THandler>[];
481
+ retriesExhausted?: TRetries;
482
+ } & ((WithIfCondition<TFlowInput> & {
483
+ whenUnmet?: TWhenUnmet;
484
+ }) | (WithIfNotCondition<TFlowInput> & {
485
+ whenUnmet?: TWhenUnmet;
486
+ }) | WithoutCondition) & Omit<BaseStepRuntimeOptions, 'retriesExhausted'>>, handler: THandler): Flow<TFlowInput, TContext, Steps & {
487
+ [K in Slug]: StepMeta<AwaitedReturn<THandler>[], TWhenUnmet extends 'skip' | 'skip-cascade' ? true : TRetries extends 'skip' | 'skip-cascade' ? true : false>;
243
488
  }, StepDependencies & {
244
489
  [K in Slug]: [];
245
- }>;
246
- map<Slug extends string, TArrayDep extends Extract<keyof Steps, string>, THandler>(opts: Simplify<{
490
+ }, TEnv>;
491
+ map<Slug extends string, TArrayDep extends Extract<keyof Steps, string>, THandler extends Steps[TArrayDep]['output'] extends readonly (infer Item)[] ? (item: Item, context: FlowContext<TEnv, TFlowInput> & TContext) => Json | Promise<Json> : never, TWhenUnmet extends WhenUnmetMode | undefined = undefined, TRetries extends RetriesExhaustedMode | undefined = undefined>(opts: Simplify<{
247
492
  slug: Slug extends keyof Steps ? never : Slug;
248
493
  array: TArrayDep;
249
- } & StepRuntimeOptions>, handler: Steps[TArrayDep] extends readonly (infer Item)[] ? THandler & ((item: Item, context: BaseContext & TContext) => Json | Promise<Json>) : never): Flow<TFlowInput, TContext & BaseContext, Steps & {
250
- [K in Slug]: AwaitedReturn<THandler>[];
494
+ retriesExhausted?: TRetries;
495
+ } & ((WithIfCondition<{
496
+ [K in TArrayDep]: Steps[K]['output'];
497
+ }> & {
498
+ whenUnmet?: TWhenUnmet;
499
+ }) | (WithIfNotCondition<{
500
+ [K in TArrayDep]: Steps[K]['output'];
501
+ }> & {
502
+ whenUnmet?: TWhenUnmet;
503
+ }) | WithoutCondition) & Omit<BaseStepRuntimeOptions, 'retriesExhausted'>>, handler: THandler): Flow<TFlowInput, TContext, Steps & {
504
+ [K in Slug]: StepMeta<AwaitedReturn<THandler>[], TWhenUnmet extends 'skip' | 'skip-cascade' ? true : TRetries extends 'skip' | 'skip-cascade' ? true : false>;
251
505
  }, StepDependencies & {
252
506
  [K in Slug]: [TArrayDep];
253
- }>;
507
+ }, TEnv>;
254
508
  }
255
509
  export {};
256
510
  //# sourceMappingURL=dsl.d.ts.map
package/dist/dsl.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"dsl.d.ts","sourceRoot":"","sources":["../src/dsl.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,IAAI,GACZ,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,IAAI,EAAE,GACN;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,CAAC;AAGxC,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;KAAG,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;CAAE,GAAG,EAAE,CAAC;AAKpE,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,GAClE,CAAC,GACD,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,CAAC,GACnC,CAAC,GACD,KAAK,CAAC;AAOZ,MAAM,WAAW,GAAG;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnC;AAGD,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC;AAKpD,MAAM,WAAW,OAAQ,SAAQ,GAAG;CAAG;AAOvC,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC;AAC5B,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC;AAG7B,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC9C,MAAM,MAAM,QAAQ,GAAG,MAAM,C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ACJ,KAAK,CACV;KACF,EACD,gBAAgB,GAAG;SAAG,CAAC,IAAI,IAAI,GAAG,CAAC,SAAS,CAAC;KAAE,EAC/C,IAAI,CACL;CAyEF"}
package/dist/dsl.js CHANGED
@@ -27,6 +27,12 @@ export class Flow {
27
27
  }
28
28
  /**
29
29
  * Get a specific step definition by slug with proper typing
30
+ *
31
+ * Returns the step definition with asymmetric input typing:
32
+ * - Root steps (no dependencies): input is flowInput directly
33
+ * - Dependent steps: input is deps object only (flowInput available via context)
34
+ * - Skippable deps are optional, required deps are required
35
+ *
30
36
  * @throws Error if the step with the given slug doesn't exist
31
37
  */
32
38
  getStepDefinition(slug) {
@@ -34,12 +40,9 @@ export class Flow {
34
40
  if (!(slug in this.stepDefinitions)) {
35
41
  throw new Error(`Step "${String(slug)}" does not exist in flow "${this.slug}"`);
36
42
  }
37
- // Use a type assertion directive to tell TypeScript that this is safe
38
- // @ts-expect-error The type system cannot track that this.stepDefinitions[slug] has the correct type
39
- // but we know it's safe because we only add steps through the strongly-typed `step` method
40
43
  return this.stepDefinitions[slug];
41
44
  }
42
- // SlugType extends keyof Steps & keyof StepDependencies
45
+ // Implementation (type safety enforced by overloads above)
43
46
  step(opts, handler) {
44
47
  const slug = opts.slug;
45
48
  // Validate the step slug
@@ -66,12 +69,20 @@ export class Flow {
66
69
  options.timeout = opts.timeout;
67
70
  if (opts.startDelay !== undefined)
68
71
  options.startDelay = opts.startDelay;
72
+ if (opts.if !== undefined)
73
+ options.if = opts.if;
74
+ if (opts.ifNot !== undefined)
75
+ options.ifNot = opts.ifNot;
76
+ if (opts.whenUnmet !== undefined)
77
+ options.whenUnmet = opts.whenUnmet;
78
+ if (opts.retriesExhausted !== undefined)
79
+ options.retriesExhausted = opts.retriesExhausted;
69
80
  // Validate runtime options (optional for step level)
70
81
  validateRuntimeOptions(options, { optional: true });
71
- // Preserve the exact type of the handler
82
+ // Create step definition (type assertions needed due to complex generic constraints)
72
83
  const newStepDefinition = {
73
84
  slug,
74
- handler: handler, // Type assertion needed due to complex generic constraints
85
+ handler,
75
86
  dependencies: dependencies,
76
87
  options,
77
88
  };
@@ -82,24 +93,10 @@ export class Flow {
82
93
  // Create a new stepOrder array with the new slug appended
83
94
  const newStepOrder = [...this.stepOrder, slug];
84
95
  // Create a new flow with the same slug and options but with updated type parameters
85
- // We need to use type assertions here because TypeScript cannot track the exact relationship
86
- // between the specific step definition types and the generic Flow type parameters
87
- // This is safe because we're constructing the newStepDefinitions in a type-safe way above
96
+ // Type safety is enforced by the overload signatures above
88
97
  return new Flow({ slug: this.slug, ...this.options }, newStepDefinitions, newStepOrder);
89
98
  }
90
- /**
91
- * Add an array-returning step to the flow with compile-time type safety
92
- *
93
- * This method provides semantic clarity and type enforcement for steps that return arrays,
94
- * while maintaining full compatibility with the existing step system by delegating to `.step()`.
95
- *
96
- * @template Slug - The unique identifier for this step
97
- * @template THandler - The handler function that must return an array or Promise<array>
98
- * @template Deps - The step dependencies (must be existing step slugs)
99
- * @param opts - Step configuration including slug, dependencies, and runtime options
100
- * @param handler - Function that processes input and returns an array
101
- * @returns A new Flow instance with the array step added
102
- */
99
+ // Implementation
103
100
  array(opts, handler) {
104
101
  // Delegate to existing .step() method for maximum code reuse
105
102
  return this.step(opts, handler);
@@ -136,6 +133,14 @@ export class Flow {
136
133
  options.timeout = opts.timeout;
137
134
  if (opts.startDelay !== undefined)
138
135
  options.startDelay = opts.startDelay;
136
+ if (opts.if !== undefined)
137
+ options.if = opts.if;
138
+ if (opts.ifNot !== undefined)
139
+ options.ifNot = opts.ifNot;
140
+ if (opts.whenUnmet !== undefined)
141
+ options.whenUnmet = opts.whenUnmet;
142
+ if (opts.retriesExhausted !== undefined)
143
+ options.retriesExhausted = opts.retriesExhausted;
139
144
  // Validate runtime options
140
145
  validateRuntimeOptions(options, { optional: true });
141
146
  // Create the map step definition with stepType
@@ -3,21 +3,21 @@ type Input = {
3
3
  url: string;
4
4
  };
5
5
  export declare const AnalyzeWebsite: Flow<Input, {}, import("./dsl.js").EmptySteps & {
6
- website: {
6
+ website: import("./dsl.js").StepMeta<{
7
7
  content: string;
8
- };
8
+ }, false>;
9
9
  } & {
10
- sentiment: {
10
+ sentiment: import("./dsl.js").StepMeta<{
11
11
  score: number;
12
- };
12
+ }, false>;
13
13
  } & {
14
- summary: {
14
+ summary: import("./dsl.js").StepMeta<{
15
15
  aiSummary: string;
16
- };
16
+ }, false>;
17
17
  } & {
18
- saveToDb: string;
18
+ saveToDb: import("./dsl.js").StepMeta<string, false>;
19
19
  }, import("./dsl.js").EmptyDeps & {
20
- website: never[];
20
+ website: [];
21
21
  } & {
22
22
  sentiment: "website"[];
23
23
  } & {
@@ -1 +1 @@
1
- {"version":3,"file":"example-flow.d.ts","sourceRoot":"","sources":["../src/example-flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhC,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;0BA4BxB,CAAC"}
1
+ {"version":3,"file":"example-flow.d.ts","sourceRoot":"","sources":["../src/example-flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhC,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;0BAiCxB,CAAC"}