@pgflow/dsl 0.0.0-array-map-steps-302d00a8-20250922101336 → 0.0.0-array-map-steps-302d00a8-20250925065142
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/CHANGELOG.md +46 -0
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @pgflow/dsl
|
|
2
2
|
|
|
3
|
+
## 0.0.0-array-map-steps-302d00a8-20250925065142
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fa05f56: 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
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 6449647: Add `.map()` method to Flow DSL for defining map-type steps
|
|
24
|
+
|
|
25
|
+
The new `.map()` method enables defining steps that process arrays element-by-element, complementing the existing SQL Core map infrastructure. Key features:
|
|
26
|
+
|
|
27
|
+
- **Root maps**: Process flow input arrays directly by omitting the `array` property
|
|
28
|
+
- **Dependent maps**: Process another step's array output using `array: 'stepSlug'`
|
|
29
|
+
- **Type-safe**: Enforces Json-compatible types with full TypeScript inference
|
|
30
|
+
- **Compile-time duplicate slug detection**: TypeScript now prevents duplicate step slugs at compile-time
|
|
31
|
+
- **Different handler signature**: Receives individual items `(item, context)` instead of full input object
|
|
32
|
+
- **Always returns arrays**: Return type is `HandlerReturnType[]`
|
|
33
|
+
- **SQL generation**: Correctly adds `step_type => 'map'` parameter to `pgflow.add_step()`
|
|
34
|
+
|
|
35
|
+
Example usage:
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
// Root map - processes array input
|
|
39
|
+
new Flow<string[]>({ slug: 'process' }).map({ slug: 'uppercase' }, (item) =>
|
|
40
|
+
item.toUpperCase()
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
// Dependent map - processes another step's output
|
|
44
|
+
new Flow<{}>({ slug: 'workflow' })
|
|
45
|
+
.array({ slug: 'items' }, () => [1, 2, 3])
|
|
46
|
+
.map({ slug: 'double', array: 'items' }, (n) => n * 2);
|
|
47
|
+
```
|
|
48
|
+
|
|
3
49
|
## 0.6.1
|
|
4
50
|
|
|
5
51
|
## 0.6.0
|
package/dist/package.json
CHANGED