@pgflow/dsl 0.10.0 → 0.12.0

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/README.md CHANGED
@@ -38,23 +38,23 @@ export const AnalyzeWebsite = new Flow<Input>({
38
38
  })
39
39
  .step(
40
40
  { slug: 'website' },
41
- async (input) => await scrapeWebsite(input.run.url)
41
+ async (flowInput) => await scrapeWebsite(flowInput.url)
42
42
  )
43
43
  .step(
44
44
  { slug: 'sentiment', dependsOn: ['website'] },
45
- async (input) => await analyzeSentiment(input.website.content)
45
+ async (deps) => await analyzeSentiment(deps.website.content)
46
46
  )
47
47
  .step(
48
48
  { slug: 'summary', dependsOn: ['website'] },
49
- async (input) => await summarizeWithAI(input.website.content)
49
+ async (deps) => await summarizeWithAI(deps.website.content)
50
50
  )
51
51
  .step(
52
52
  { slug: 'saveToDb', dependsOn: ['sentiment', 'summary'] },
53
- async (input) => {
53
+ async (deps, ctx) => {
54
54
  return await saveToDb({
55
- websiteUrl: input.run.url,
56
- sentiment: input.sentiment.score,
57
- summary: input.summary.aiSummary,
55
+ websiteUrl: ctx.flowInput.url,
56
+ sentiment: deps.sentiment.score,
57
+ summary: deps.summary.aiSummary,
58
58
  });
59
59
  }
60
60
  );
@@ -62,16 +62,22 @@ export const AnalyzeWebsite = new Flow<Input>({
62
62
 
63
63
  ### Understanding Data Flow
64
64
 
65
- In pgflow, each step receives an `input` object that contains:
65
+ In pgflow, step handlers use **asymmetric signatures** based on whether they have dependencies:
66
66
 
67
- 1. **`input.run`** - The original flow input (available to all steps)
68
- 2. **`input.{stepName}`** - Outputs from dependency steps
67
+ **Root steps (no dependencies):**
68
+ - First parameter: `flowInput` - the original flow input directly
69
+ - Second parameter: `ctx` - context object (env, supabase, flowInput, etc.)
70
+
71
+ **Dependent steps (with dependsOn):**
72
+ - First parameter: `deps` - object with outputs from dependency steps (`deps.{stepName}`)
73
+ - Second parameter: `ctx` - context object (includes `ctx.flowInput` if needed)
69
74
 
70
75
  This design ensures:
71
76
 
72
- - Original flow parameters are accessible throughout the entire flow
73
- - Data doesn't need to be manually forwarded through intermediate steps
74
- - Steps can combine original input with processed data from previous steps
77
+ - Root steps receive flow input directly for clean, simple handlers
78
+ - Dependent steps focus on their dependencies without wrapping
79
+ - Original flow input is always accessible via `ctx.flowInput` when needed
80
+ - Steps can combine dependency outputs with original input via context
75
81
 
76
82
  ### Step Methods
77
83
 
@@ -84,8 +90,9 @@ The standard method for adding steps to a flow. Each step processes input and re
84
90
  ```typescript
85
91
  .step(
86
92
  { slug: 'process', dependsOn: ['previous'] },
87
- async (input) => {
88
- // Access input.run and input.previous
93
+ async (deps, ctx) => {
94
+ // Access deps.previous for dependency output
95
+ // Access ctx.flowInput if original flow input is needed
89
96
  return { result: 'processed' };
90
97
  }
91
98
  )
@@ -105,7 +112,7 @@ A semantic wrapper around `.step()` that provides type enforcement for steps tha
105
112
  // With dependencies - combining data from multiple sources
106
113
  .array(
107
114
  { slug: 'combineResults', dependsOn: ['source1', 'source2'] },
108
- async (input) => [...input.source1, ...input.source2]
115
+ async (deps) => [...deps.source1, ...deps.source2]
109
116
  )
110
117
  ```
111
118
 
@@ -200,9 +207,9 @@ new Flow<{}>({ slug: 'etlPipeline' })
200
207
  .map({ slug: 'extract', array: 'scrape' }, (html) => {
201
208
  return extractData(html);
202
209
  })
203
- .step({ slug: 'aggregate', dependsOn: ['extract'] }, (input) => {
204
- // input.extract is the aggregated array from all map tasks
205
- return consolidateResults(input.extract);
210
+ .step({ slug: 'aggregate', dependsOn: ['extract'] }, (deps) => {
211
+ // deps.extract is the aggregated array from all map tasks
212
+ return consolidateResults(deps.extract);
206
213
  });
207
214
  ```
208
215
 
@@ -218,9 +225,9 @@ Step handlers can optionally receive a second parameter - the **context object**
218
225
  ```typescript
219
226
  .step(
220
227
  { slug: 'saveToDb' },
221
- async (input, context) => {
228
+ async (flowInput, ctx) => {
222
229
  // Access platform resources through context
223
- const result = await context.sql`SELECT * FROM users WHERE id = ${input.userId}`;
230
+ const result = await ctx.sql`SELECT * FROM users WHERE id = ${flowInput.userId}`;
224
231
  return result[0];
225
232
  }
226
233
  )
@@ -230,40 +237,40 @@ Step handlers can optionally receive a second parameter - the **context object**
230
237
 
231
238
  All platforms provide these core resources:
232
239
 
233
- - **`context.env`** - Environment variables (`Record<string, string | undefined>`)
234
- - **`context.shutdownSignal`** - AbortSignal for graceful shutdown handling
235
- - **`context.rawMessage`** - Original pgmq message with metadata
240
+ - **`ctx.env`** - Environment variables (`Record<string, string | undefined>`)
241
+ - **`ctx.flowInput`** - Original flow input (typed as the flow's input type)
242
+ - **`ctx.shutdownSignal`** - AbortSignal for graceful shutdown handling
243
+ - **`ctx.rawMessage`** - Original pgmq message with metadata
236
244
  ```typescript
237
245
  interface PgmqMessageRecord<T> {
238
246
  msg_id: number;
239
247
  read_ct: number;
240
248
  enqueued_at: Date;
241
249
  vt: Date;
242
- message: T; // <-- this is your 'input'
250
+ message: T;
243
251
  }
244
252
  ```
245
- - **`context.stepTask`** - Current step task details (flow handlers only)
253
+ - **`ctx.stepTask`** - Current step task details (flow handlers only)
246
254
  ```typescript
247
255
  interface StepTaskRecord<TFlow> {
248
256
  flow_slug: string;
249
257
  run_id: string;
250
258
  step_slug: string;
251
- input: StepInput<TFlow, StepSlug>; // <-- this is handler 'input'
252
259
  msg_id: number;
253
260
  }
254
261
  ```
255
- - **`context.workerConfig`** - Resolved worker configuration with all defaults applied
262
+ - **`ctx.workerConfig`** - Resolved worker configuration with all defaults applied
256
263
  ```typescript
257
264
  // Provides access to worker settings like retry limits
258
- const isLastAttempt = context.rawMessage.read_ct >= context.workerConfig.retry.limit;
265
+ const isLastAttempt = ctx.rawMessage.read_ct >= ctx.workerConfig.retry.limit;
259
266
  ```
260
267
 
261
268
  #### Supabase Platform Resources
262
269
 
263
270
  When using the Supabase platform with EdgeWorker, additional resources are available:
264
271
 
265
- - **`context.sql`** - PostgreSQL client (postgres.js)
266
- - **`context.supabase`** - Supabase client with service role key for full database access
272
+ - **`ctx.sql`** - PostgreSQL client (postgres.js)
273
+ - **`ctx.supabase`** - Supabase client with service role key for full database access
267
274
 
268
275
  To use Supabase resources, import the `Flow` class from the Supabase preset:
269
276
 
@@ -272,17 +279,17 @@ import { Flow } from '@pgflow/dsl/supabase';
272
279
 
273
280
  const MyFlow = new Flow<{ userId: string }>({
274
281
  slug: 'myFlow',
275
- }).step({ slug: 'process' }, async (input, context) => {
276
- // TypeScript knows context includes Supabase resources
277
- const { data } = await context.supabase
282
+ }).step({ slug: 'process' }, async (flowInput, ctx) => {
283
+ // TypeScript knows ctx includes Supabase resources
284
+ const { data } = await ctx.supabase
278
285
  .from('users')
279
286
  .select('*')
280
- .eq('id', input.userId);
287
+ .eq('id', flowInput.userId);
281
288
 
282
289
  // Use SQL directly
283
- const stats = await context.sql`
284
- SELECT COUNT(*) as total FROM events
285
- WHERE user_id = ${input.userId}
290
+ const stats = await ctx.sql`
291
+ SELECT COUNT(*) as total FROM events
292
+ WHERE user_id = ${flowInput.userId}
286
293
  `;
287
294
 
288
295
  return { user: data[0], eventCount: stats[0].total };
package/dist/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @pgflow/dsl
2
2
 
3
+ ## 0.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 37402eb: BREAKING: Asymmetric handler signatures - remove `run` key from step inputs
8
+
9
+ - Root steps: `(flowInput, ctx) => ...` - flow input directly as first param
10
+ - Dependent steps: `(deps, ctx) => ...` - only dependency outputs as first param
11
+ - Access flow input in dependent steps via `await ctx.flowInput` (async/lazy-loaded)
12
+ - Lazy loading prevents data duplication for map steps processing large arrays
13
+ - Enables functional composition and simplifies types for future subflows
14
+
15
+ ### Patch Changes
16
+
17
+ - 5dc5cfc: Fix Supabase Edge Runtime compatibility by replacing npm:postgres with jsr:@oscar6echo/postgres fork. The npm package fails to parse database URLs in Deno edge environments, causing CONNECT_TIMEOUT errors.
18
+
19
+ ## 0.11.0
20
+
3
21
  ## 0.10.0
4
22
 
5
23
  ### Patch Changes
package/dist/README.md CHANGED
@@ -38,23 +38,23 @@ export const AnalyzeWebsite = new Flow<Input>({
38
38
  })
39
39
  .step(
40
40
  { slug: 'website' },
41
- async (input) => await scrapeWebsite(input.run.url)
41
+ async (flowInput) => await scrapeWebsite(flowInput.url)
42
42
  )
43
43
  .step(
44
44
  { slug: 'sentiment', dependsOn: ['website'] },
45
- async (input) => await analyzeSentiment(input.website.content)
45
+ async (deps) => await analyzeSentiment(deps.website.content)
46
46
  )
47
47
  .step(
48
48
  { slug: 'summary', dependsOn: ['website'] },
49
- async (input) => await summarizeWithAI(input.website.content)
49
+ async (deps) => await summarizeWithAI(deps.website.content)
50
50
  )
51
51
  .step(
52
52
  { slug: 'saveToDb', dependsOn: ['sentiment', 'summary'] },
53
- async (input) => {
53
+ async (deps, ctx) => {
54
54
  return await saveToDb({
55
- websiteUrl: input.run.url,
56
- sentiment: input.sentiment.score,
57
- summary: input.summary.aiSummary,
55
+ websiteUrl: ctx.flowInput.url,
56
+ sentiment: deps.sentiment.score,
57
+ summary: deps.summary.aiSummary,
58
58
  });
59
59
  }
60
60
  );
@@ -62,16 +62,22 @@ export const AnalyzeWebsite = new Flow<Input>({
62
62
 
63
63
  ### Understanding Data Flow
64
64
 
65
- In pgflow, each step receives an `input` object that contains:
65
+ In pgflow, step handlers use **asymmetric signatures** based on whether they have dependencies:
66
66
 
67
- 1. **`input.run`** - The original flow input (available to all steps)
68
- 2. **`input.{stepName}`** - Outputs from dependency steps
67
+ **Root steps (no dependencies):**
68
+ - First parameter: `flowInput` - the original flow input directly
69
+ - Second parameter: `ctx` - context object (env, supabase, flowInput, etc.)
70
+
71
+ **Dependent steps (with dependsOn):**
72
+ - First parameter: `deps` - object with outputs from dependency steps (`deps.{stepName}`)
73
+ - Second parameter: `ctx` - context object (includes `ctx.flowInput` if needed)
69
74
 
70
75
  This design ensures:
71
76
 
72
- - Original flow parameters are accessible throughout the entire flow
73
- - Data doesn't need to be manually forwarded through intermediate steps
74
- - Steps can combine original input with processed data from previous steps
77
+ - Root steps receive flow input directly for clean, simple handlers
78
+ - Dependent steps focus on their dependencies without wrapping
79
+ - Original flow input is always accessible via `ctx.flowInput` when needed
80
+ - Steps can combine dependency outputs with original input via context
75
81
 
76
82
  ### Step Methods
77
83
 
@@ -84,8 +90,9 @@ The standard method for adding steps to a flow. Each step processes input and re
84
90
  ```typescript
85
91
  .step(
86
92
  { slug: 'process', dependsOn: ['previous'] },
87
- async (input) => {
88
- // Access input.run and input.previous
93
+ async (deps, ctx) => {
94
+ // Access deps.previous for dependency output
95
+ // Access ctx.flowInput if original flow input is needed
89
96
  return { result: 'processed' };
90
97
  }
91
98
  )
@@ -105,7 +112,7 @@ A semantic wrapper around `.step()` that provides type enforcement for steps tha
105
112
  // With dependencies - combining data from multiple sources
106
113
  .array(
107
114
  { slug: 'combineResults', dependsOn: ['source1', 'source2'] },
108
- async (input) => [...input.source1, ...input.source2]
115
+ async (deps) => [...deps.source1, ...deps.source2]
109
116
  )
110
117
  ```
111
118
 
@@ -200,9 +207,9 @@ new Flow<{}>({ slug: 'etlPipeline' })
200
207
  .map({ slug: 'extract', array: 'scrape' }, (html) => {
201
208
  return extractData(html);
202
209
  })
203
- .step({ slug: 'aggregate', dependsOn: ['extract'] }, (input) => {
204
- // input.extract is the aggregated array from all map tasks
205
- return consolidateResults(input.extract);
210
+ .step({ slug: 'aggregate', dependsOn: ['extract'] }, (deps) => {
211
+ // deps.extract is the aggregated array from all map tasks
212
+ return consolidateResults(deps.extract);
206
213
  });
207
214
  ```
208
215
 
@@ -218,9 +225,9 @@ Step handlers can optionally receive a second parameter - the **context object**
218
225
  ```typescript
219
226
  .step(
220
227
  { slug: 'saveToDb' },
221
- async (input, context) => {
228
+ async (flowInput, ctx) => {
222
229
  // Access platform resources through context
223
- const result = await context.sql`SELECT * FROM users WHERE id = ${input.userId}`;
230
+ const result = await ctx.sql`SELECT * FROM users WHERE id = ${flowInput.userId}`;
224
231
  return result[0];
225
232
  }
226
233
  )
@@ -230,40 +237,40 @@ Step handlers can optionally receive a second parameter - the **context object**
230
237
 
231
238
  All platforms provide these core resources:
232
239
 
233
- - **`context.env`** - Environment variables (`Record<string, string | undefined>`)
234
- - **`context.shutdownSignal`** - AbortSignal for graceful shutdown handling
235
- - **`context.rawMessage`** - Original pgmq message with metadata
240
+ - **`ctx.env`** - Environment variables (`Record<string, string | undefined>`)
241
+ - **`ctx.flowInput`** - Original flow input (typed as the flow's input type)
242
+ - **`ctx.shutdownSignal`** - AbortSignal for graceful shutdown handling
243
+ - **`ctx.rawMessage`** - Original pgmq message with metadata
236
244
  ```typescript
237
245
  interface PgmqMessageRecord<T> {
238
246
  msg_id: number;
239
247
  read_ct: number;
240
248
  enqueued_at: Date;
241
249
  vt: Date;
242
- message: T; // <-- this is your 'input'
250
+ message: T;
243
251
  }
244
252
  ```
245
- - **`context.stepTask`** - Current step task details (flow handlers only)
253
+ - **`ctx.stepTask`** - Current step task details (flow handlers only)
246
254
  ```typescript
247
255
  interface StepTaskRecord<TFlow> {
248
256
  flow_slug: string;
249
257
  run_id: string;
250
258
  step_slug: string;
251
- input: StepInput<TFlow, StepSlug>; // <-- this is handler 'input'
252
259
  msg_id: number;
253
260
  }
254
261
  ```
255
- - **`context.workerConfig`** - Resolved worker configuration with all defaults applied
262
+ - **`ctx.workerConfig`** - Resolved worker configuration with all defaults applied
256
263
  ```typescript
257
264
  // Provides access to worker settings like retry limits
258
- const isLastAttempt = context.rawMessage.read_ct >= context.workerConfig.retry.limit;
265
+ const isLastAttempt = ctx.rawMessage.read_ct >= ctx.workerConfig.retry.limit;
259
266
  ```
260
267
 
261
268
  #### Supabase Platform Resources
262
269
 
263
270
  When using the Supabase platform with EdgeWorker, additional resources are available:
264
271
 
265
- - **`context.sql`** - PostgreSQL client (postgres.js)
266
- - **`context.supabase`** - Supabase client with service role key for full database access
272
+ - **`ctx.sql`** - PostgreSQL client (postgres.js)
273
+ - **`ctx.supabase`** - Supabase client with service role key for full database access
267
274
 
268
275
  To use Supabase resources, import the `Flow` class from the Supabase preset:
269
276
 
@@ -272,17 +279,17 @@ import { Flow } from '@pgflow/dsl/supabase';
272
279
 
273
280
  const MyFlow = new Flow<{ userId: string }>({
274
281
  slug: 'myFlow',
275
- }).step({ slug: 'process' }, async (input, context) => {
276
- // TypeScript knows context includes Supabase resources
277
- const { data } = await context.supabase
282
+ }).step({ slug: 'process' }, async (flowInput, ctx) => {
283
+ // TypeScript knows ctx includes Supabase resources
284
+ const { data } = await ctx.supabase
278
285
  .from('users')
279
286
  .select('*')
280
- .eq('id', input.userId);
287
+ .eq('id', flowInput.userId);
281
288
 
282
289
  // Use SQL directly
283
- const stats = await context.sql`
284
- SELECT COUNT(*) as total FROM events
285
- WHERE user_id = ${input.userId}
290
+ const stats = await ctx.sql`
291
+ SELECT COUNT(*) as total FROM events
292
+ WHERE user_id = ${flowInput.userId}
286
293
  `;
287
294
 
288
295
  return { user: data[0], eventCount: stats[0].total };
package/dist/dsl.d.ts CHANGED
@@ -106,15 +106,14 @@ export type ExtractFlowLeafSteps<TFlow extends AnyFlow> = {
106
106
  };
107
107
  export type StepOutput<TFlow extends AnyFlow, TStepSlug extends string> = TStepSlug extends keyof ExtractFlowSteps<TFlow> ? ExtractFlowSteps<TFlow>[TStepSlug] : never;
108
108
  /**
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
109
+ * Asymmetric step input type:
110
+ * - Root steps (no dependencies): receive flow input directly
111
+ * - Dependent steps: receive only their dependencies (flow input available via context)
112
+ *
113
+ * This enables functional composition where subflows can receive typed inputs
114
+ * without the 'run' wrapper that previously blocked type matching.
114
115
  */
115
- export type StepInput<TFlow extends AnyFlow, TStepSlug extends string> = {
116
- run: ExtractFlowInput<TFlow>;
117
- } & {
116
+ export type StepInput<TFlow extends AnyFlow, TStepSlug extends string> = StepDepsOf<TFlow, TStepSlug> extends never ? ExtractFlowInput<TFlow> : {
118
117
  [K in Extract<keyof ExtractFlowSteps<TFlow>, StepDepsOf<TFlow, TStepSlug>>]: ExtractFlowSteps<TFlow>[K];
119
118
  };
120
119
  export interface RuntimeOptions {
@@ -149,8 +148,16 @@ export interface BaseContext<TEnv extends Env = Env> {
149
148
  rawMessage: MessageRecord;
150
149
  workerConfig: Readonly<WorkerConfig>;
151
150
  }
152
- export interface FlowContext<TEnv extends Env = Env> extends BaseContext<TEnv> {
151
+ /**
152
+ * Flow context extends base with stepTask and flowInput.
153
+ *
154
+ * Note: flowInput is a Promise to support lazy loading. Only root non-map steps
155
+ * receive flow_input from SQL; other step types lazy-load it on demand.
156
+ * Use `await ctx.flowInput` to access the original flow input.
157
+ */
158
+ export interface FlowContext<TEnv extends Env = Env, TFlowInput extends AnyInput = AnyInput> extends BaseContext<TEnv> {
153
159
  stepTask: StepTaskRecord<AnyFlow>;
160
+ flowInput: Promise<TFlowInput>;
154
161
  }
155
162
  export type Context<T extends Record<string, unknown> = Record<string, never>, TEnv extends Env = Env> = FlowContext<TEnv> & T;
156
163
  export interface StepRuntimeOptions extends RuntimeOptions {
@@ -181,22 +188,32 @@ Steps extends AnySteps = EmptySteps, StepDependencies extends AnyDeps = EmptyDep
181
188
  } & RuntimeOptions>, stepDefinitions?: Record<string, StepDefinition<AnyInput, AnyOutput>>, stepOrder?: string[]);
182
189
  /**
183
190
  * Get a specific step definition by slug with proper typing
191
+ *
192
+ * Returns the step definition with asymmetric input typing:
193
+ * - Root steps (no dependencies): input is flowInput directly
194
+ * - Dependent steps: input is deps object only (flowInput available via context)
195
+ *
184
196
  * @throws Error if the step with the given slug doesn't exist
185
197
  */
186
- getStepDefinition<SlugType extends keyof Steps & keyof StepDependencies>(slug: SlugType): StepDefinition<Simplify<{
187
- run: TFlowInput;
188
- } & {
198
+ getStepDefinition<SlugType extends keyof Steps & keyof StepDependencies>(slug: SlugType): StepDefinition<StepDependencies[SlugType] extends [] | readonly [] ? TFlowInput : Simplify<{
189
199
  [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;
193
- } & {
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<{
200
+ }>, // Dependent step: only deps
201
+ Steps[SlugType], FlowContext<TEnv, TFlowInput> & TContext>;
202
+ step<Slug extends string, TOutput>(opts: Simplify<{
196
203
  slug: Slug extends keyof Steps ? never : Slug;
197
- dependsOn?: Deps[];
198
- } & StepRuntimeOptions>, handler: THandler): Flow<TFlowInput, TContext, Steps & {
199
- [K in Slug]: AwaitedReturn<THandler>;
204
+ dependsOn?: never;
205
+ } & StepRuntimeOptions>, handler: (flowInput: TFlowInput, context: FlowContext<TEnv, TFlowInput> & TContext) => TOutput | Promise<TOutput>): Flow<TFlowInput, TContext, Steps & {
206
+ [K in Slug]: Awaited<TOutput>;
207
+ }, StepDependencies & {
208
+ [K in Slug]: [];
209
+ }, TEnv>;
210
+ step<Slug extends string, Deps extends Extract<keyof Steps, string>, TOutput>(opts: Simplify<{
211
+ slug: Slug extends keyof Steps ? never : Slug;
212
+ dependsOn: [Deps, ...Deps[]];
213
+ } & StepRuntimeOptions>, handler: (deps: {
214
+ [K in Deps]: K extends keyof Steps ? Steps[K] : never;
215
+ }, context: FlowContext<TEnv, TFlowInput> & TContext) => TOutput | Promise<TOutput>): Flow<TFlowInput, TContext, Steps & {
216
+ [K in Slug]: Awaited<TOutput>;
200
217
  }, StepDependencies & {
201
218
  [K in Slug]: Deps[];
202
219
  }, TEnv>;
@@ -213,15 +230,21 @@ Steps extends AnySteps = EmptySteps, StepDependencies extends AnyDeps = EmptyDep
213
230
  * @param handler - Function that processes input and returns an array (null/undefined rejected)
214
231
  * @returns A new Flow instance with the array step added
215
232
  */
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) => readonly any[] | Promise<readonly any[]>, Deps extends Extract<keyof Steps, string> = never>(opts: Simplify<{
233
+ array<Slug extends string, TOutput extends readonly any[]>(opts: Simplify<{
221
234
  slug: Slug extends keyof Steps ? never : Slug;
222
- dependsOn?: Deps[];
223
- } & StepRuntimeOptions>, handler: THandler): Flow<TFlowInput, TContext, Steps & {
224
- [K in Slug]: AwaitedReturn<THandler>;
235
+ dependsOn?: never;
236
+ } & StepRuntimeOptions>, handler: (flowInput: TFlowInput, context: FlowContext<TEnv, TFlowInput> & TContext) => TOutput | Promise<TOutput>): Flow<TFlowInput, TContext, Steps & {
237
+ [K in Slug]: Awaited<TOutput>;
238
+ }, StepDependencies & {
239
+ [K in Slug]: [];
240
+ }, TEnv>;
241
+ array<Slug extends string, Deps extends Extract<keyof Steps, string>, TOutput extends readonly any[]>(opts: Simplify<{
242
+ slug: Slug extends keyof Steps ? never : Slug;
243
+ dependsOn: [Deps, ...Deps[]];
244
+ } & StepRuntimeOptions>, handler: (deps: {
245
+ [K in Deps]: K extends keyof Steps ? Steps[K] : never;
246
+ }, context: FlowContext<TEnv, TFlowInput> & TContext) => TOutput | Promise<TOutput>): Flow<TFlowInput, TContext, Steps & {
247
+ [K in Slug]: Awaited<TOutput>;
225
248
  }, StepDependencies & {
226
249
  [K in Slug]: Deps[];
227
250
  }, TEnv>;
@@ -236,21 +259,21 @@ Steps extends AnySteps = EmptySteps, StepDependencies extends AnyDeps = EmptyDep
236
259
  * @param handler - Function that processes individual array elements
237
260
  * @returns A new Flow instance with the map step added
238
261
  */
239
- map<Slug extends string, THandler extends TFlowInput extends readonly (infer Item)[] ? (item: Item, context: BaseContext & TContext) => Json | Promise<Json> : never>(opts: Simplify<{
262
+ map<Slug extends string, THandler extends TFlowInput extends readonly (infer Item)[] ? (item: Item, context: FlowContext<TEnv, TFlowInput> & TContext) => Json | Promise<Json> : never>(opts: Simplify<{
240
263
  slug: Slug extends keyof Steps ? never : Slug;
241
- } & StepRuntimeOptions>, handler: THandler): Flow<TFlowInput, TContext & BaseContext, Steps & {
264
+ } & StepRuntimeOptions>, handler: THandler): Flow<TFlowInput, TContext, Steps & {
242
265
  [K in Slug]: AwaitedReturn<THandler>[];
243
266
  }, StepDependencies & {
244
267
  [K in Slug]: [];
245
- }>;
246
- map<Slug extends string, TArrayDep extends Extract<keyof Steps, string>, THandler extends Steps[TArrayDep] extends readonly (infer Item)[] ? (item: Item, context: BaseContext & TContext) => Json | Promise<Json> : never>(opts: Simplify<{
268
+ }, TEnv>;
269
+ map<Slug extends string, TArrayDep extends Extract<keyof Steps, string>, THandler extends Steps[TArrayDep] extends readonly (infer Item)[] ? (item: Item, context: FlowContext<TEnv, TFlowInput> & TContext) => Json | Promise<Json> : never>(opts: Simplify<{
247
270
  slug: Slug extends keyof Steps ? never : Slug;
248
271
  array: TArrayDep;
249
- } & StepRuntimeOptions>, handler: THandler): Flow<TFlowInput, TContext & BaseContext, Steps & {
272
+ } & StepRuntimeOptions>, handler: THandler): Flow<TFlowInput, TContext, Steps & {
250
273
  [K in Slug]: AwaitedReturn<THandler>[];
251
274
  }, StepDependencies & {
252
275
  [K in Slug]: [TArrayDep];
253
- }>;
276
+ }, TEnv>;
254
277
  }
255
278
  export {};
256
279
  //# 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,CAAA;CAAE,CAAC;AAG5B,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;KAAG,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,CA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AAI,CACL;IAGD,GAAG,CACD,IAAI,SAAS,MAAM,EACnB,SAAS,SAAS,OAAO,CAAC,MAAM,KAAK,EAAE,MAAM,CAAC,EAC9C,QAAQ,SAAS,KAAK,CAAC,SAAS,CAAC,SAAS,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE,GAC7D,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,QAAQ,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GACvF,KAAK,EAET,IAAI,EAAE,QAAQ,CAAC;QAAE,IAAI,EAAE,IAAI,SAAS,MAAM,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,SAAS,CAAA;KAAE,GAAG,kBAAkB,CAAC,EACxG,OAAO,EAAE,QAAQ,GAChB,IAAI,CACL,UAAU,EACV,QAAQ,EACR,KAAK,GAAG;SAAG,CAAC,IAAI,IAAI,GAAG,aAAa,CAAC,QAAQ,CAAC,EAAE;KAAE,EAClD,gBAAgB,GAAG;SAAG,CAAC,IAAI,IAAI,GAAG,CAAC,SAAS,CAAC;KAAE,EAC/C,IAAI,CACL;CA8DF"}
package/dist/dsl.js CHANGED
@@ -27,6 +27,11 @@ 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
+ *
30
35
  * @throws Error if the step with the given slug doesn't exist
31
36
  */
32
37
  getStepDefinition(slug) {
@@ -39,7 +44,7 @@ export class Flow {
39
44
  // but we know it's safe because we only add steps through the strongly-typed `step` method
40
45
  return this.stepDefinitions[slug];
41
46
  }
42
- // SlugType extends keyof Steps & keyof StepDependencies
47
+ // Implementation (type safety enforced by overloads above)
43
48
  step(opts, handler) {
44
49
  const slug = opts.slug;
45
50
  // Validate the step slug
@@ -68,10 +73,10 @@ export class Flow {
68
73
  options.startDelay = opts.startDelay;
69
74
  // Validate runtime options (optional for step level)
70
75
  validateRuntimeOptions(options, { optional: true });
71
- // Preserve the exact type of the handler
76
+ // Create step definition (type assertions needed due to complex generic constraints)
72
77
  const newStepDefinition = {
73
78
  slug,
74
- handler: handler, // Type assertion needed due to complex generic constraints
79
+ handler,
75
80
  dependencies: dependencies,
76
81
  options,
77
82
  };
@@ -82,24 +87,10 @@ export class Flow {
82
87
  // Create a new stepOrder array with the new slug appended
83
88
  const newStepOrder = [...this.stepOrder, slug];
84
89
  // 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
90
+ // Type safety is enforced by the overload signatures above
88
91
  return new Flow({ slug: this.slug, ...this.options }, newStepDefinitions, newStepOrder);
89
92
  }
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 (null/undefined rejected)
101
- * @returns A new Flow instance with the array step added
102
- */
93
+ // Implementation
103
94
  array(opts, handler) {
104
95
  // Delegate to existing .step() method for maximum code reuse
105
96
  return this.step(opts, handler);
@@ -17,7 +17,7 @@ export declare const AnalyzeWebsite: Flow<Input, {}, import("./dsl.js").EmptySte
17
17
  } & {
18
18
  saveToDb: string;
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"}
@@ -5,14 +5,23 @@ export const AnalyzeWebsite = new Flow({
5
5
  baseDelay: 5,
6
6
  timeout: 10,
7
7
  })
8
- .step({ slug: 'website' }, async (input) => await scrapeWebsite(input.run.url))
9
- .step({ slug: 'sentiment', dependsOn: ['website'], timeout: 30, maxAttempts: 5 }, async (input) => await analyzeSentiment(input.website.content))
10
- .step({ slug: 'summary', dependsOn: ['website'] }, async (input) => await summarizeWithAI(input.website.content))
11
- .step({ slug: 'saveToDb', dependsOn: ['sentiment', 'summary'] }, async (input) => {
8
+ .step({ slug: 'website' },
9
+ // Root step: receives flowInput directly
10
+ async (flowInput) => await scrapeWebsite(flowInput.url))
11
+ .step({ slug: 'sentiment', dependsOn: ['website'], timeout: 30, maxAttempts: 5 },
12
+ // Dependent step: receives deps, flowInput via context
13
+ async (deps) => await analyzeSentiment(deps.website.content))
14
+ .step({ slug: 'summary', dependsOn: ['website'] },
15
+ // Dependent step: receives deps
16
+ async (deps) => await summarizeWithAI(deps.website.content))
17
+ .step({ slug: 'saveToDb', dependsOn: ['sentiment', 'summary'] },
18
+ // Dependent step needing flowInput: access via await ctx.flowInput
19
+ async (deps, ctx) => {
20
+ const flowInput = await ctx.flowInput;
12
21
  const results = await saveToDb({
13
- websiteUrl: input.run.url,
14
- sentiment: input.sentiment.score,
15
- summary: input.summary.aiSummary,
22
+ websiteUrl: flowInput.url,
23
+ sentiment: deps.sentiment.score,
24
+ summary: deps.summary.aiSummary,
16
25
  });
17
26
  return results.status;
18
27
  });
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgflow/dsl",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,8 +1,8 @@
1
- import type { Sql } from 'postgres';
1
+ import type postgres from 'postgres';
2
2
  import type { SupabaseClient } from '@supabase/supabase-js';
3
3
  import { Flow as CoreFlow, type AnyInput, type AnySteps, type AnyDeps, EmptySteps, EmptyDeps, type Env } from '../index.js';
4
4
  export interface SupabaseResources extends Record<string, unknown> {
5
- sql: Sql;
5
+ sql: postgres.Sql;
6
6
  /**
7
7
  * Supabase client with service role key for full database access
8
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"supabase.d.ts","sourceRoot":"","sources":["../../src/platforms/supabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACL,IAAI,IAAI,QAAQ,EAChB,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,KAAK,OAAO,EAC1C,UAAU,EAAE,SAAS,EAAE,KAAK,GAAG,EAChC,MAAM,aAAa,CAAC;AAGrB,MAAM,WAAW,iBAAkB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAChE,GAAG,EAAc,GAAG,CAAC;IACrB;;OAEG;IACH,QAAQ,EAAS,cAAc,CAAC;CACjC;AAGD,MAAM,WAAW,WAAY,SAAQ,GAAG;IACtC,eAAe,EAAY,MAAM,CAAC;IAClC,YAAY,EAAe,MAAM,CAAC;IAClC,iBAAiB,EAAU,MAAM,CAAC;IAClC,y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