@pgflow/dsl 0.6.1 → 0.7.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
@@ -73,6 +73,144 @@ This design ensures:
73
73
  - Data doesn't need to be manually forwarded through intermediate steps
74
74
  - Steps can combine original input with processed data from previous steps
75
75
 
76
+ ### Step Methods
77
+
78
+ The Flow DSL provides three methods for defining steps in your workflow:
79
+
80
+ #### `.step()` - Regular Steps
81
+
82
+ The standard method for adding steps to a flow. Each step processes input and returns output.
83
+
84
+ ```typescript
85
+ .step(
86
+ { slug: 'process', dependsOn: ['previous'] },
87
+ async (input) => {
88
+ // Access input.run and input.previous
89
+ return { result: 'processed' };
90
+ }
91
+ )
92
+ ```
93
+
94
+ #### `.array()` - Array-Returning Steps
95
+
96
+ A semantic wrapper around `.step()` that provides type enforcement for steps that return arrays. Useful for data fetching or collection steps that will be processed by map steps.
97
+
98
+ ```typescript
99
+ // Fetch an array of items to be processed
100
+ .array(
101
+ { slug: 'fetch_items' },
102
+ async () => [1, 2, 3, 4, 5]
103
+ )
104
+
105
+ // With dependencies - combining data from multiple sources
106
+ .array(
107
+ { slug: 'combine_results', dependsOn: ['source1', 'source2'] },
108
+ async (input) => [...input.source1, ...input.source2]
109
+ )
110
+ ```
111
+
112
+ **Key Points:**
113
+ - Return type is enforced to be an array at compile time
114
+ - Commonly used as input for subsequent map steps
115
+ - Can depend on other steps just like regular steps
116
+
117
+ #### `.map()` - Array Processing Steps
118
+
119
+ Processes arrays element-by-element, similar to JavaScript's `Array.map()`. The handler receives individual items instead of the full input object.
120
+
121
+ **Two Modes of Operation:**
122
+
123
+ 1. **Root Map** (no `array:` property): Processes the flow's input array directly
124
+ - The flow input MUST be an array when using root maps
125
+ - Omitting the `array:` property tells pgflow to use the flow input
126
+
127
+ 2. **Dependent Map** (with `array:` property): Processes another step's array output
128
+ - The `array:` property specifies which step's output to process
129
+ - That step must return an array
130
+
131
+ ```typescript
132
+ // ROOT MAP - No array: property means use flow input
133
+ // Flow input MUST be an array (e.g., ["hello", "world"])
134
+ new Flow<string[]>({ slug: 'process_strings' })
135
+ .map(
136
+ { slug: 'uppercase' }, // No array: property!
137
+ (item) => item.toUpperCase()
138
+ );
139
+ // Each string in the input array gets uppercased in parallel
140
+
141
+ // DEPENDENT MAP - array: property specifies the source step
142
+ new Flow<{}>({ slug: 'data_pipeline' })
143
+ .array({ slug: 'numbers' }, () => [1, 2, 3])
144
+ .map(
145
+ { slug: 'double', array: 'numbers' }, // Processes 'numbers' output
146
+ (n) => n * 2
147
+ )
148
+ .map(
149
+ { slug: 'square', array: 'double' }, // Chains from 'double'
150
+ (n) => n * n
151
+ );
152
+ // Results: numbers: [1,2,3] → double: [2,4,6] → square: [4,16,36]
153
+ ```
154
+
155
+ **Key differences from regular steps:**
156
+ - Uses `array:` to specify dependency (not `dependsOn:`)
157
+ - When `array:` is omitted, uses flow input array (root map)
158
+ - Handler signature is `(item, context) => result` instead of `(input, context) => result`
159
+ - Return type is always an array
160
+ - Map steps can have at most one dependency (the array source)
161
+ - Generates SQL with `step_type => 'map'` parameter for pgflow's map processing
162
+
163
+ **Type Safety:**
164
+ The `.map()` method provides full TypeScript type inference for array elements:
165
+
166
+ ```typescript
167
+ type User = { id: number; name: string };
168
+
169
+ new Flow<{}>({ slug: 'user_flow' })
170
+ .array({ slug: 'users' }, (): User[] => [
171
+ { id: 1, name: 'Alice' },
172
+ { id: 2, name: 'Bob' }
173
+ ])
174
+ .map({ slug: 'greet', array: 'users' }, (user) => {
175
+ // TypeScript knows user is of type User
176
+ return `Hello, ${user.name} (ID: ${user.id})`;
177
+ });
178
+ ```
179
+
180
+ **Common Patterns:**
181
+
182
+ ```typescript
183
+ // Batch processing - process multiple items in parallel
184
+ new Flow<number[]>({ slug: 'batch_processor' })
185
+ .map({ slug: 'validate' }, (item) => {
186
+ if (item < 0) throw new Error('Invalid item');
187
+ return item;
188
+ })
189
+ .map({ slug: 'process', array: 'validate' }, async (item) => {
190
+ // Each item processed in its own task
191
+ return await expensiveOperation(item);
192
+ });
193
+
194
+ // Data transformation pipeline
195
+ new Flow<{}>({ slug: 'etl_pipeline' })
196
+ .step({ slug: 'fetch_urls' }, () => ['url1', 'url2', 'url3'])
197
+ .map({ slug: 'scrape', array: 'fetch_urls' }, async (url) => {
198
+ return await fetchContent(url);
199
+ })
200
+ .map({ slug: 'extract', array: 'scrape' }, (html) => {
201
+ return extractData(html);
202
+ })
203
+ .step({ slug: 'aggregate', dependsOn: ['extract'] }, (input) => {
204
+ // input.extract is the aggregated array from all map tasks
205
+ return consolidateResults(input.extract);
206
+ });
207
+ ```
208
+
209
+ **Limitations:**
210
+ - Can only depend on a single array-returning step
211
+ - TypeScript may not track type transformations between chained maps (use type assertions if needed)
212
+ - Root maps require the entire flow input to be an array
213
+
76
214
  ### Context Object
77
215
 
78
216
  Step handlers can optionally receive a second parameter - the **context object** - which provides access to platform resources and runtime information.
@@ -114,6 +252,11 @@ All platforms provide these core resources:
114
252
  msg_id: number;
115
253
  }
116
254
  ```
255
+ - **`context.workerConfig`** - Resolved worker configuration with all defaults applied
256
+ ```typescript
257
+ // Provides access to worker settings like retry limits
258
+ const isLastAttempt = context.rawMessage.read_ct >= context.workerConfig.retry.limit;
259
+ ```
117
260
 
118
261
  #### Supabase Platform Resources
119
262
 
package/dist/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # @pgflow/dsl
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 524db03: Add `.array()` method for type-safe array step creation
8
+
9
+ Introduces a new `.array()` method that provides compile-time type safety for array-returning handlers with zero runtime overhead.
10
+
11
+ - Enforces array return types at compile time
12
+ - Pure delegation to existing `.step()` method
13
+ - Full support for dependencies and runtime options
14
+ - Backward compatible
15
+
16
+ ```typescript
17
+ flow.array({ slug: 'items' }, () => [1, 2, 3]); // ✅ Valid
18
+ flow.array({ slug: 'invalid' }, () => 42); // ❌ Compile error
19
+ ```
20
+
21
+ - 524db03: Add `.map()` method to Flow DSL for defining map-type steps
22
+
23
+ The new `.map()` method enables defining steps that process arrays element-by-element, complementing the existing SQL Core map infrastructure. Key features:
24
+
25
+ - **Root maps**: Process flow input arrays directly by omitting the `array` property
26
+ - **Dependent maps**: Process another step's array output using `array: 'stepSlug'`
27
+ - **Type-safe**: Enforces Json-compatible types with full TypeScript inference
28
+ - **Compile-time duplicate slug detection**: TypeScript now prevents duplicate step slugs at compile-time
29
+ - **Different handler signature**: Receives individual items `(item, context)` instead of full input object
30
+ - **Always returns arrays**: Return type is `HandlerReturnType[]`
31
+ - **SQL generation**: Correctly adds `step_type => 'map'` parameter to `pgflow.add_step()`
32
+
33
+ Example usage:
34
+
35
+ ```typescript
36
+ // Root map - processes array input
37
+ new Flow<string[]>({ slug: 'process' }).map({ slug: 'uppercase' }, (item) =>
38
+ item.toUpperCase()
39
+ );
40
+
41
+ // Dependent map - processes another step's output
42
+ new Flow<{}>({ slug: 'workflow' })
43
+ .array({ slug: 'items' }, () => [1, 2, 3])
44
+ .map({ slug: 'double', array: 'items' }, (n) => n * 2);
45
+ ```
46
+
3
47
  ## 0.6.1
4
48
 
5
49
  ## 0.6.0
package/dist/README.md CHANGED
@@ -73,6 +73,144 @@ This design ensures:
73
73
  - Data doesn't need to be manually forwarded through intermediate steps
74
74
  - Steps can combine original input with processed data from previous steps
75
75
 
76
+ ### Step Methods
77
+
78
+ The Flow DSL provides three methods for defining steps in your workflow:
79
+
80
+ #### `.step()` - Regular Steps
81
+
82
+ The standard method for adding steps to a flow. Each step processes input and returns output.
83
+
84
+ ```typescript
85
+ .step(
86
+ { slug: 'process', dependsOn: ['previous'] },
87
+ async (input) => {
88
+ // Access input.run and input.previous
89
+ return { result: 'processed' };
90
+ }
91
+ )
92
+ ```
93
+
94
+ #### `.array()` - Array-Returning Steps
95
+
96
+ A semantic wrapper around `.step()` that provides type enforcement for steps that return arrays. Useful for data fetching or collection steps that will be processed by map steps.
97
+
98
+ ```typescript
99
+ // Fetch an array of items to be processed
100
+ .array(
101
+ { slug: 'fetch_items' },
102
+ async () => [1, 2, 3, 4, 5]
103
+ )
104
+
105
+ // With dependencies - combining data from multiple sources
106
+ .array(
107
+ { slug: 'combine_results', dependsOn: ['source1', 'source2'] },
108
+ async (input) => [...input.source1, ...input.source2]
109
+ )
110
+ ```
111
+
112
+ **Key Points:**
113
+ - Return type is enforced to be an array at compile time
114
+ - Commonly used as input for subsequent map steps
115
+ - Can depend on other steps just like regular steps
116
+
117
+ #### `.map()` - Array Processing Steps
118
+
119
+ Processes arrays element-by-element, similar to JavaScript's `Array.map()`. The handler receives individual items instead of the full input object.
120
+
121
+ **Two Modes of Operation:**
122
+
123
+ 1. **Root Map** (no `array:` property): Processes the flow's input array directly
124
+ - The flow input MUST be an array when using root maps
125
+ - Omitting the `array:` property tells pgflow to use the flow input
126
+
127
+ 2. **Dependent Map** (with `array:` property): Processes another step's array output
128
+ - The `array:` property specifies which step's output to process
129
+ - That step must return an array
130
+
131
+ ```typescript
132
+ // ROOT MAP - No array: property means use flow input
133
+ // Flow input MUST be an array (e.g., ["hello", "world"])
134
+ new Flow<string[]>({ slug: 'process_strings' })
135
+ .map(
136
+ { slug: 'uppercase' }, // No array: property!
137
+ (item) => item.toUpperCase()
138
+ );
139
+ // Each string in the input array gets uppercased in parallel
140
+
141
+ // DEPENDENT MAP - array: property specifies the source step
142
+ new Flow<{}>({ slug: 'data_pipeline' })
143
+ .array({ slug: 'numbers' }, () => [1, 2, 3])
144
+ .map(
145
+ { slug: 'double', array: 'numbers' }, // Processes 'numbers' output
146
+ (n) => n * 2
147
+ )
148
+ .map(
149
+ { slug: 'square', array: 'double' }, // Chains from 'double'
150
+ (n) => n * n
151
+ );
152
+ // Results: numbers: [1,2,3] → double: [2,4,6] → square: [4,16,36]
153
+ ```
154
+
155
+ **Key differences from regular steps:**
156
+ - Uses `array:` to specify dependency (not `dependsOn:`)
157
+ - When `array:` is omitted, uses flow input array (root map)
158
+ - Handler signature is `(item, context) => result` instead of `(input, context) => result`
159
+ - Return type is always an array
160
+ - Map steps can have at most one dependency (the array source)
161
+ - Generates SQL with `step_type => 'map'` parameter for pgflow's map processing
162
+
163
+ **Type Safety:**
164
+ The `.map()` method provides full TypeScript type inference for array elements:
165
+
166
+ ```typescript
167
+ type User = { id: number; name: string };
168
+
169
+ new Flow<{}>({ slug: 'user_flow' })
170
+ .array({ slug: 'users' }, (): User[] => [
171
+ { id: 1, name: 'Alice' },
172
+ { id: 2, name: 'Bob' }
173
+ ])
174
+ .map({ slug: 'greet', array: 'users' }, (user) => {
175
+ // TypeScript knows user is of type User
176
+ return `Hello, ${user.name} (ID: ${user.id})`;
177
+ });
178
+ ```
179
+
180
+ **Common Patterns:**
181
+
182
+ ```typescript
183
+ // Batch processing - process multiple items in parallel
184
+ new Flow<number[]>({ slug: 'batch_processor' })
185
+ .map({ slug: 'validate' }, (item) => {
186
+ if (item < 0) throw new Error('Invalid item');
187
+ return item;
188
+ })
189
+ .map({ slug: 'process', array: 'validate' }, async (item) => {
190
+ // Each item processed in its own task
191
+ return await expensiveOperation(item);
192
+ });
193
+
194
+ // Data transformation pipeline
195
+ new Flow<{}>({ slug: 'etl_pipeline' })
196
+ .step({ slug: 'fetch_urls' }, () => ['url1', 'url2', 'url3'])
197
+ .map({ slug: 'scrape', array: 'fetch_urls' }, async (url) => {
198
+ return await fetchContent(url);
199
+ })
200
+ .map({ slug: 'extract', array: 'scrape' }, (html) => {
201
+ return extractData(html);
202
+ })
203
+ .step({ slug: 'aggregate', dependsOn: ['extract'] }, (input) => {
204
+ // input.extract is the aggregated array from all map tasks
205
+ return consolidateResults(input.extract);
206
+ });
207
+ ```
208
+
209
+ **Limitations:**
210
+ - Can only depend on a single array-returning step
211
+ - TypeScript may not track type transformations between chained maps (use type assertions if needed)
212
+ - Root maps require the entire flow input to be an array
213
+
76
214
  ### Context Object
77
215
 
78
216
  Step handlers can optionally receive a second parameter - the **context object** - which provides access to platform resources and runtime information.
@@ -114,6 +252,11 @@ All platforms provide these core resources:
114
252
  msg_id: number;
115
253
  }
116
254
  ```
255
+ - **`context.workerConfig`** - Resolved worker configuration with all defaults applied
256
+ ```typescript
257
+ // Provides access to worker settings like retry limits
258
+ const isLastAttempt = context.rawMessage.read_ct >= context.workerConfig.retry.limit;
259
+ ```
117
260
 
118
261
  #### Supabase Platform Resources
119
262
 
@@ -1 +1 @@
1
- {"version":3,"file":"compile-flow.d.ts","sourceRoot":"","sources":["../src/compile-flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAsC,MAAM,UAAU,CAAC;AAEvE;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,EAAE,CAyBnD"}
1
+ {"version":3,"file":"compile-flow.d.ts","sourceRoot":"","sources":["../src/compile-flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAsC,MAAM,UAAU,CAAC;AAEvE;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,EAAE,CA+BnD"}
@@ -20,7 +20,12 @@ export function compileFlow(flow) {
20
20
  const depsArray = step.dependencies.map((dep) => `'${dep}'`).join(', ');
21
21
  depsClause = `, ARRAY[${depsArray}]`;
22
22
  }
23
- statements.push(`SELECT pgflow.add_step('${flow.slug}', '${step.slug}'${depsClause}${stepOptions});`);
23
+ // Add step_type parameter for map steps
24
+ let stepTypeClause = '';
25
+ if (step.stepType === 'map') {
26
+ stepTypeClause = `, step_type => 'map'`;
27
+ }
28
+ statements.push(`SELECT pgflow.add_step('${flow.slug}', '${step.slug}'${depsClause}${stepOptions}${stepTypeClause});`);
24
29
  }
25
30
  return statements;
26
31
  }
package/dist/dsl.d.ts CHANGED
@@ -1,5 +1,5 @@
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];
@@ -21,18 +21,18 @@ export type AnyDeps = Record<string, string[]>;
21
21
  /**
22
22
  * Represents a Flow that has not steps nor deps defined yet
23
23
  */
24
- export type EmptyFlow = Flow<AnyInput, BaseContext, EmptySteps, EmptyDeps>;
24
+ export type EmptyFlow = Flow<AnyInput, {}, EmptySteps, EmptyDeps>;
25
25
  /**
26
26
  * Represents any Flow with flexible input, context, steps, and dependencies.
27
27
  * This type is intentionally more permissive to allow for better type inference
28
28
  * in utility types like StepOutput.
29
29
  */
30
- export type AnyFlow = Flow<any, any, any, any>;
30
+ export type AnyFlow = Flow<any, any, any, any, any>;
31
31
  /**
32
32
  * Extracts the input type from a Flow
33
33
  * @template TFlow - The Flow type to extract from
34
34
  */
35
- export type ExtractFlowInput<TFlow extends AnyFlow> = TFlow extends Flow<infer TI, infer _TC, infer _TS, infer _TD> ? TI : never;
35
+ export type ExtractFlowInput<TFlow extends AnyFlow> = TFlow extends Flow<infer TI, infer _TC, infer _TS, infer _TD, infer _TEnv> ? TI : never;
36
36
  /**
37
37
  * Utility type to extract all possible step inputs from a flow
38
38
  * This creates a union of all step input types
@@ -44,24 +44,54 @@ export type AllStepInputs<TFlow extends AnyFlow> = {
44
44
  * Extracts the output type from a Flow
45
45
  * @template TFlow - The Flow type to extract from
46
46
  */
47
- export type ExtractFlowOutput<TFlow extends AnyFlow> = TFlow extends Flow<infer _TI, infer _TC, infer _TS, infer _TD> ? {
47
+ export type ExtractFlowOutput<TFlow extends AnyFlow> = TFlow extends Flow<infer _TI, infer _TC, infer _TS, infer _TD, infer _TEnv> ? {
48
48
  [K in keyof ExtractFlowLeafSteps<TFlow> as K extends string ? K : never]: StepOutput<TFlow, K & string>;
49
49
  } : never;
50
50
  /**
51
51
  * Extracts the steps type from a Flow
52
52
  * @template TFlow - The Flow type to extract from
53
53
  */
54
- export type ExtractFlowSteps<TFlow extends AnyFlow> = TFlow extends Flow<infer _TI, infer _TC, infer TS, infer _TD> ? TS : never;
54
+ export type ExtractFlowSteps<TFlow extends AnyFlow> = TFlow extends Flow<infer _TI, infer _TC, infer TS, infer _TD, infer _TEnv> ? TS : never;
55
55
  /**
56
56
  * Extracts the dependencies type from a Flow
57
57
  * @template TFlow - The Flow type to extract from
58
58
  */
59
- export type ExtractFlowDeps<TFlow extends AnyFlow> = TFlow extends Flow<infer _TI, infer _TC, infer _TS, infer TD> ? TD : never;
59
+ export type ExtractFlowDeps<TFlow extends AnyFlow> = TFlow extends Flow<infer _TI, infer _TC, infer _TS, infer TD, infer _TEnv> ? TD : never;
60
60
  /**
61
- * Extracts the context type from a Flow
61
+ * Extracts the environment type from a Flow
62
62
  * @template TFlow - The Flow type to extract from
63
+ * Returns the TEnv type parameter
63
64
  */
64
- export type ExtractFlowContext<TFlow extends AnyFlow> = TFlow extends Flow<infer _TI, infer TC, infer _TS, infer _TD> ? TC : never;
65
+ export type ExtractFlowEnv<TFlow extends AnyFlow> = TFlow extends Flow<infer _TI, infer _TC, infer _TS, infer _TD, infer TEnv> ? TEnv : never;
66
+ /**
67
+ * Extracts the full handler context type from a Flow
68
+ * @template TFlow - The Flow type to extract from
69
+ * Returns FlowContext<TEnv> & TContext (the complete context handlers receive)
70
+ */
71
+ export type ExtractFlowContext<TFlow extends AnyFlow> = TFlow extends Flow<infer _TI, infer TC, infer _TS, infer _TD, infer TEnv> ? FlowContext<TEnv> & TC : never;
72
+ /**
73
+ * Type guard that ensures a flow's context requirements can be satisfied
74
+ * by the resources provided by the platform and optional user resources.
75
+ *
76
+ * A flow is compatible if the provided platform and user resources can satisfy
77
+ * all the context requirements declared by the flow.
78
+ *
79
+ * @template F - The Flow type to check for compatibility
80
+ * @template PlatformResources - Resources provided by the execution platform (e.g., Supabase resources)
81
+ * @template UserResources - Additional user-provided resources (default: empty)
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * // In a platform worker:
86
+ * type SupabaseCompatibleFlow<F extends AnyFlow> = CompatibleFlow<F, SupabaseResources>;
87
+ *
88
+ * // Usage:
89
+ * function startWorker<F extends AnyFlow>(flow: SupabaseCompatibleFlow<F>) {
90
+ * // flow is guaranteed to be compatible with Supabase platform
91
+ * }
92
+ * ```
93
+ */
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;
65
95
  /**
66
96
  * Extracts the dependencies type from a Flow
67
97
  * @template TFlow - The Flow type to extract from
@@ -92,23 +122,49 @@ export interface RuntimeOptions {
92
122
  baseDelay?: number;
93
123
  timeout?: number;
94
124
  }
95
- export interface BaseContext {
96
- env: Env & ValidEnv<UserEnv>;
125
+ export interface WorkerConfig {
126
+ maxConcurrent: number;
127
+ maxPollSeconds: number;
128
+ pollIntervalMs: number;
129
+ batchSize: number;
130
+ visibilityTimeout: number;
131
+ }
132
+ export interface MessageRecord {
133
+ msg_id: number;
134
+ read_ct: number;
135
+ enqueued_at: string;
136
+ vt: string;
137
+ message: Json;
138
+ }
139
+ export interface StepTaskRecord<TFlow extends AnyFlow> {
140
+ flow_slug: string;
141
+ run_id: string;
142
+ step_slug: string;
143
+ input: Json;
144
+ msg_id: number;
145
+ }
146
+ export interface BaseContext<TEnv extends Env = Env> {
147
+ env: TEnv & ValidEnv<UserEnv>;
97
148
  shutdownSignal: AbortSignal;
149
+ rawMessage: MessageRecord;
150
+ workerConfig: Readonly<WorkerConfig>;
151
+ }
152
+ export interface FlowContext<TEnv extends Env = Env> extends BaseContext<TEnv> {
153
+ stepTask: StepTaskRecord<AnyFlow>;
98
154
  }
99
- export type Context<T extends Record<string, unknown> = Record<string, never>> = BaseContext & T;
100
- type ExtractHandlerContext<T> = T extends (input: any, context: infer C) => any ? C : never;
155
+ export type Context<T extends Record<string, unknown> = Record<string, never>, TEnv extends Env = Env> = FlowContext<TEnv> & T;
101
156
  export interface StepRuntimeOptions extends RuntimeOptions {
102
157
  startDelay?: number;
103
158
  }
104
- export interface StepDefinition<TInput extends AnyInput, TOutput extends AnyOutput, TContext = BaseContext> {
159
+ export interface StepDefinition<TInput extends AnyInput, TOutput extends AnyOutput, TContext = FlowContext> {
105
160
  slug: string;
106
161
  handler: (input: TInput, context: TContext) => TOutput | Promise<TOutput>;
107
162
  dependencies: string[];
108
163
  options: StepRuntimeOptions;
164
+ stepType?: 'single' | 'map';
109
165
  }
110
- export declare class Flow<TFlowInput extends AnyInput = AnyInput, TContext = BaseContext, // Accumulated context requirements (starts with BaseContext)
111
- Steps extends AnySteps = EmptySteps, StepDependencies extends AnyDeps = EmptyDeps> {
166
+ export declare class Flow<TFlowInput extends AnyInput = AnyInput, TContext extends Record<string, unknown> = {}, // Accumulated custom context (FlowContext is always provided)
167
+ Steps extends AnySteps = EmptySteps, StepDependencies extends AnyDeps = EmptyDeps, TEnv extends Env = Env> {
112
168
  /**
113
169
  * Store step definitions with their proper types
114
170
  *
@@ -136,13 +192,64 @@ Steps extends AnySteps = EmptySteps, StepDependencies extends AnyDeps = EmptyDep
136
192
  run: TFlowInput;
137
193
  } & {
138
194
  [K in Deps]: K extends keyof Steps ? Steps[K] : never;
139
- }>, context: BaseContext & TContext) => any, Deps extends Extract<keyof Steps, string> = never>(opts: Simplify<{
140
- slug: Slug;
195
+ }>, context: FlowContext<TEnv> & TContext) => any, Deps extends Extract<keyof Steps, string> = never>(opts: Simplify<{
196
+ slug: Slug extends keyof Steps ? never : Slug;
141
197
  dependsOn?: Deps[];
142
- } & StepRuntimeOptions>, handler: THandler): Flow<TFlowInput, TContext & BaseContext & ExtractHandlerContext<THandler>, Steps & {
198
+ } & StepRuntimeOptions>, handler: THandler): Flow<TFlowInput, TContext, Steps & {
143
199
  [K in Slug]: AwaitedReturn<THandler>;
144
200
  }, StepDependencies & {
145
201
  [K in Slug]: Deps[];
202
+ }, TEnv>;
203
+ /**
204
+ * Add an array-returning step to the flow with compile-time type safety
205
+ *
206
+ * This method provides semantic clarity and type enforcement for steps that return arrays,
207
+ * while maintaining full compatibility with the existing step system by delegating to `.step()`.
208
+ *
209
+ * @template Slug - The unique identifier for this step
210
+ * @template THandler - The handler function that must return an array or Promise<array>
211
+ * @template Deps - The step dependencies (must be existing step slugs)
212
+ * @param opts - Step configuration including slug, dependencies, and runtime options
213
+ * @param handler - Function that processes input and returns an array (null/undefined rejected)
214
+ * @returns A new Flow instance with the array step added
215
+ */
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<{
221
+ slug: Slug extends keyof Steps ? never : Slug;
222
+ dependsOn?: Deps[];
223
+ } & StepRuntimeOptions>, handler: THandler): Flow<TFlowInput, TContext, Steps & {
224
+ [K in Slug]: AwaitedReturn<THandler>;
225
+ }, StepDependencies & {
226
+ [K in Slug]: Deps[];
227
+ }, TEnv>;
228
+ /**
229
+ * Add a map step to the flow that processes arrays element by element
230
+ *
231
+ * Map steps apply a handler function to each element of an array, producing
232
+ * a new array with the transformed elements. The handler receives individual
233
+ * array elements, not the full input object.
234
+ *
235
+ * @param opts - Step configuration including slug and optional array dependency
236
+ * @param handler - Function that processes individual array elements
237
+ * @returns A new Flow instance with the map step added
238
+ */
239
+ map<Slug extends string, THandler extends TFlowInput extends readonly (infer Item)[] ? (item: Item, context: BaseContext & TContext) => Json | Promise<Json> : never>(opts: Simplify<{
240
+ slug: Slug extends keyof Steps ? never : Slug;
241
+ } & StepRuntimeOptions>, handler: THandler): Flow<TFlowInput, TContext & BaseContext, Steps & {
242
+ [K in Slug]: AwaitedReturn<THandler>[];
243
+ }, StepDependencies & {
244
+ [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<{
247
+ slug: Slug extends keyof Steps ? never : Slug;
248
+ array: TArrayDep;
249
+ } & StepRuntimeOptions>, handler: THandler): Flow<TFlowInput, TContext & BaseContext, Steps & {
250
+ [K in Slug]: AwaitedReturn<THandler>[];
251
+ }, StepDependencies & {
252
+ [K in Slug]: [TArrayDep];
146
253
  }>;
147
254
  }
148
255
  export {};
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;AAGpE,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,E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AAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GACrE,KAAK,EAET,IAAI,EAAE,QAAQ,CAAC;QAAE,IAAI,EAAE,IAAI,SAAS,MAAM,KAAK,GAAG,KAAK,GAAG,IAAI,CAAA;KAAE,GAAG,kBAAkB,CAAC,EACtF,OAAO,EAAE,QAAQ,GAChB,IAAI,CACL,UAAU,EACV,QAAQ,GAAG,WAAW,EACtB,KAAK,GAAG;SAAG,CAAC,IAAI,IAAI,GAAG,aAAa,CAAC,QAAQ,CAAC,EAAE;KAAE,EAClD,gBAAgB,GAAG;SAAG,CAAC,IAAI,IAAI,GAAG,EAAE;KAAE,CACvC;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,GAAG,QAAQ,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GACrE,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,GAAG,WAAW,EACtB,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,CAChD;CA8DF"}
package/dist/dsl.js CHANGED
@@ -87,4 +87,73 @@ export class Flow {
87
87
  // This is safe because we're constructing the newStepDefinitions in a type-safe way above
88
88
  return new Flow({ slug: this.slug, ...this.options }, newStepDefinitions, newStepOrder);
89
89
  }
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
+ */
103
+ array(opts, handler) {
104
+ // Delegate to existing .step() method for maximum code reuse
105
+ return this.step(opts, handler);
106
+ }
107
+ // Implementation
108
+ map(opts, handler) {
109
+ const slug = opts.slug;
110
+ // Validate the step slug
111
+ validateSlug(slug);
112
+ if (this.stepDefinitions[slug]) {
113
+ throw new Error(`Step "${slug}" already exists in flow "${this.slug}"`);
114
+ }
115
+ // Determine dependencies based on whether array is specified
116
+ let dependencies = [];
117
+ const arrayDep = opts.array;
118
+ if (arrayDep) {
119
+ // Dependent map - validate single dependency exists and returns array
120
+ if (!this.stepDefinitions[arrayDep]) {
121
+ throw new Error(`Step "${slug}" depends on undefined step "${arrayDep}"`);
122
+ }
123
+ dependencies = [arrayDep];
124
+ }
125
+ else {
126
+ // Root map - flow input must be an array (type system enforces this)
127
+ dependencies = [];
128
+ }
129
+ // Extract runtime options
130
+ const options = {};
131
+ if (opts.maxAttempts !== undefined)
132
+ options.maxAttempts = opts.maxAttempts;
133
+ if (opts.baseDelay !== undefined)
134
+ options.baseDelay = opts.baseDelay;
135
+ if (opts.timeout !== undefined)
136
+ options.timeout = opts.timeout;
137
+ if (opts.startDelay !== undefined)
138
+ options.startDelay = opts.startDelay;
139
+ // Validate runtime options
140
+ validateRuntimeOptions(options, { optional: true });
141
+ // Create the map step definition with stepType
142
+ // Note: We use AnyInput/AnyOutput here because the actual types are handled at the type level via overloads
143
+ const newStepDefinition = {
144
+ slug,
145
+ handler: handler, // Type assertion needed due to complex generic constraints
146
+ dependencies,
147
+ options,
148
+ stepType: 'map', // Mark this as a map step
149
+ };
150
+ const newStepDefinitions = {
151
+ ...this.stepDefinitions,
152
+ [slug]: newStepDefinition,
153
+ };
154
+ // Create a new stepOrder array with the new slug appended
155
+ const newStepOrder = [...this.stepOrder, slug];
156
+ // Create and return new Flow instance with updated types
157
+ return new Flow({ slug: this.slug, ...this.options }, newStepDefinitions, newStepOrder); // Type assertion handled by overloads
158
+ }
90
159
  }
@@ -2,7 +2,7 @@ import { Flow } from './dsl.js';
2
2
  type Input = {
3
3
  url: string;
4
4
  };
5
- export declare const AnalyzeWebsite: Flow<Input, import("./dsl.js").BaseContext, import("./dsl.js").EmptySteps & {
5
+ export declare const AnalyzeWebsite: Flow<Input, {}, import("./dsl.js").EmptySteps & {
6
6
  website: {
7
7
  content: string;
8
8
  };
@@ -24,6 +24,6 @@ export declare const AnalyzeWebsite: Flow<Input, import("./dsl.js").BaseContext,
24
24
  summary: "website"[];
25
25
  } & {
26
26
  saveToDb: ("sentiment" | "summary")[];
27
- }>;
27
+ }, import("./dsl.js").Env>;
28
28
  export {};
29
29
  //# sourceMappingURL=example-flow.d.ts.map
@@ -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;;;;;;;;;;;;;;;;;;;;;;EA4BxB,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;;;;;;;;;;;;;;;;;;;;;;0BA4BxB,CAAC"}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgflow/dsl",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  import type { Sql } from 'postgres';
2
2
  import type { SupabaseClient } from '@supabase/supabase-js';
3
- import { Flow as CoreFlow, type AnyInput, type AnySteps, type AnyDeps, EmptySteps, EmptyDeps, type Env, type UserEnv, type ValidEnv, type AnyFlow, type Json, type BaseContext } from '../index.js';
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
5
  sql: Sql;
6
6
  /**
@@ -16,17 +16,7 @@ export interface SupabaseEnv extends Env {
16
16
  SB_EXECUTION_ID: string;
17
17
  EDGE_WORKER_LOG_LEVEL?: string;
18
18
  }
19
- export type SupabasePlatformContext = BaseContext & SupabaseResources & {
20
- env: SupabaseEnv & ValidEnv<UserEnv>;
21
- };
22
- export type SupabaseMessageContext<T extends Json = Json> = SupabasePlatformContext & {
23
- rawMessage: any;
24
- };
25
- export type SupabaseStepTaskContext<F extends AnyFlow = AnyFlow> = SupabasePlatformContext & {
26
- rawMessage: any;
27
- stepTask: any;
28
- };
29
- export declare class Flow<I extends AnyInput = AnyInput, ExtraCtx extends Record<string, unknown> = Record<string, never>, S extends AnySteps = EmptySteps, D extends AnyDeps = EmptyDeps> extends CoreFlow<I, SupabasePlatformContext & ExtraCtx, // <── full ctx in handlers
30
- S, D> {
19
+ export type SupabasePlatformContext = SupabaseResources;
20
+ export declare class Flow<I extends AnyInput = AnyInput, CustomCtx extends Record<string, unknown> = {}, S extends AnySteps = EmptySteps, D extends AnyDeps = EmptyDeps, TEnv extends Env = SupabaseEnv> extends CoreFlow<I, SupabasePlatformContext & CustomCtx, S, D, TEnv> {
31
21
  }
32
22
  //# sourceMappingURL=supabase.d.ts.map
@@ -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,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAC5D,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,WAAW,EAC1C,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,kBAAkB,EAAQ,MAAM,CAAC;IACjC,YAAY,EAAc,MAAM,CAAC;IACjC,iBAAiB,EAAQ,MAAM,CAAC;IAChC,yBAAyB,EAAE,MAAM,CAAC;IAClC,eAAe,EAAW,MAAM,CAAC;IACjC,qBAAqB,CAAC,EAAI,MAAM,CAAC;CAClC;AAGD,MAAM,MAAM,uBAAuB,GACjC,WAAW,GAAG,iBAAiB,GAAG;IAChC,GAAG,EAAE,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;CACtC,CAAC;AAGJ,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,IACtD,uBAAuB,GAAG;IACxB,UAAU,EAAE,GAAG,CAAC;CACjB,CAAC;AAEJ,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,OAAO,GAAG,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GxD,qBAAa,IAAI,CACf,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAE7B,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,EAC9C,CAAC,SAAS,QAAQ,GAAG,UAAU,EAC/B,CAAC,SAAS,OAAO,GAAK,SAAS,EAC/B,IAAI,SAAS,GAAG,GAAG,WAAW,CAC9B,SAAQ,QAAQ,CAChB,CAAC,EACD,uBAAuB,GAAG,SAAS,EACnC,CAAC,EAAE,CAAC,EACJ,IAAI,CACL;CAAG"}
@@ -1,4 +1,4 @@
1
1
  import { Flow as CoreFlow } from '../index.js';
2
- /* ---------- 5. pre-wired Flow helper -------------------------------- */
2
+ /* ---------- 4. pre-wired Flow helper -------------------------------- */
3
3
  export class Flow extends CoreFlow {
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgflow/dsl",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",