You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test: add comprehensive tests for map step compilation, type constraints, and edge cases
- Introduced new integration tests for flow compilation involving map steps
- Added runtime validation tests for step dependencies and slug validation
- Included type inference validation tests for map method constraints
- Covered edge cases such as empty arrays and various runtime options
- Added tests for flow with only map steps and multiple independent chains
- Ensured correct parameter ordering and handling of dependencies in compiled SQL
- Expanded coverage for root and dependent map compilation scenarios
- Included tests for flow with only map steps and chaining behaviors
- Improved test suite robustness for map step handling in flow compilation
Add `.map()` method to Flow DSL for defining map-type steps
7
+
8
+
The new `.map()` method enables defining steps that process arrays element-by-element, complementing the existing SQL Core map infrastructure. Key features:
9
+
10
+
-**Root maps**: Process flow input arrays directly by omitting the `array` property
11
+
-**Dependent maps**: Process another step's array output using `array: 'stepSlug'`
12
+
-**Type-safe**: Enforces Json-compatible types with full TypeScript inference
13
+
-**Different handler signature**: Receives individual items `(item, context)` instead of full input object
14
+
-**Always returns arrays**: Return type is `HandlerReturnType[]`
15
+
-**SQL generation**: Correctly adds `step_type => 'map'` parameter to `pgflow.add_step()`
- Can only depend on a single array-returning step
146
+
- TypeScript may not track type transformations between chained maps (use type assertions if needed)
147
+
76
148
### Context Object
77
149
78
150
Step handlers can optionally receive a second parameter - the **context object** - which provides access to platform resources and runtime information.
@@ -114,6 +186,11 @@ All platforms provide these core resources:
114
186
msg_id:number;
115
187
}
116
188
```
189
+
-**`context.workerConfig`** - Resolved worker configuration with all defaults applied
190
+
```typescript
191
+
// Provides access to worker settings like retry limits
0 commit comments