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
Copy file name to clipboardExpand all lines: README.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ TypeScript-to-ASL compiler for AWS Step Functions. Define workflows as typed asy
11
11
12
12
At my previous company we had dozens of Step Functions deployed with CDK. They were incredibly hard to read and maintain. The CDK approach defines a program by stringing together a tree of construct objects — `.next().next().next()` chains with raw JSONPath and `sfn.CustomState` workarounds. That's exactly the kind of work a compiler should handle.
13
13
14
-
SimpleSteps compiles typed async functions to ASL state machines. The compiler performs whole-program data flow analysis and derives all JSONPath expressions (`Parameters`, `ResultPath`, `InputPath`, `ResultSelector`, `OutputPath`) from variable usage. Service bindings are resolved at compile time, with CDK token substitution at synth time.
14
+
SimpleSteps compiles typed async functions to ASL state machines. The compiler performs whole-program data flow analysis and derives all JSONPath expressions (`Parameters`, `ResultPath`, `InputPath`, `ResultSelector`) from variable usage. Service bindings are resolved at compile time, with CDK token substitution at synth time.
Unlike `for...of`, `Steps.map()` supports closures over prior `await` results and can capture iteration results into a variable.
160
+
All iteration styles (`for...of`, `Steps.map()`, `Steps.items()`, `Steps.sequential()`) support closures over prior `await` results. `Steps.map()` additionally captures iteration results into a variable.
161
+
162
+
### Steps.items()
163
+
164
+
`Steps.items()` wraps an array for use with `for...of`, adding MaxConcurrency control:
Use `Steps.items()` when you prefer imperative `for...of` syntax but need concurrency control. Use `Steps.map()` when you need to collect iteration results.
149
175
150
176
### Parallel Execution
151
177
@@ -241,7 +267,7 @@ One of SimpleSteps' key design goals: **you never write JSONPath or data flow fi
241
267
|`ResultPath`| Variable assignment — `const x = await svc.call(...)` stores the result at `$.x`|
242
268
|`InputPath`| Variable references in service call arguments — the compiler determines what data the state needs |
243
269
|`ResultSelector`| Automatic `.Payload` extraction for Lambda results (so you access `result.field`, not `result.Payload.field`) |
244
-
|`OutputPath`|Variable liveness analysis — the compiler prunes fields that are no longer needed downstream|
270
+
|`OutputPath`|*Not yet implemented* — planned optimization for payload size reduction via variable liveness analysis|
245
271
246
272
In CDK, you'd write `sfn.JsonPath.stringAt('$.order.total')` and manually set `outputPath: '$.Payload'`. In SimpleSteps, you write `order.total` and the compiler handles the rest.
Copy file name to clipboardExpand all lines: docs/limitations.md
+10-15Lines changed: 10 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -115,33 +115,28 @@ Workaround for rest parameters: pass an explicit array parameter instead.
115
115
116
116
## Closures and Variable Capture
117
117
118
-
Map state iterations have isolated state — each iteration receives only its array element as input.
118
+
Map state iterations have isolated state — each iteration receives only its array element as input. The compiler automatically detects outer-scope variables referenced inside a loop body and projects them into each iteration via ASL's `ItemSelector`.
119
119
120
-
**`Steps.map()` supports closures** — prior `await` results are automatically projected into each iteration via ASL's `ItemSelector`:
120
+
**All iteration styles support closures** — `for...of`, `Steps.map()`, `Steps.items()`, and `Steps.sequential()` all capture outer `await` results automatically:
Compile-time constants and service bindings are accessible in all Map iterations. Only runtime variables (service call results) are restricted in `for...of`.
143
-
144
-
Workaround for `for...of`: Use `Steps.map()` instead (which supports closures), use `Steps.sequential()` for sequential iteration, or restructure the data so each item carries what it needs.
139
+
Compile-time constants and service bindings are also accessible in all Map iterations.
0 commit comments