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
- TypeScript-to-ASL compiler now supports JSONata as the default query language
- Standard JS methods compile directly: string manipulation, math, type conversion, object utilities
- Higher-order array functions (map, filter, reduce, find, some, every) with pure callbacks compile to JSONat lambdas
- Full arithmetic support: *, /, %, - work natively (previously JSONPath-only limitation)
- JSONPath still fully supported via --query-language jsonpath flag, no regressions
- Clear error messages when JSONata-only features are used in JSONPath mode
- All documentation and examples updated for dual-mode support
TypeScript-to-ASL compiler for AWS Step Functions. Define workflows as typed async functions, compile to Amazon States Language with full data flow inference, and deploy with CDK or the CLI.
6
+
TypeScript-to-ASL compiler for AWS Step Functions. Define workflows as typed async functions, compile to Amazon States Language with full data flow inference, and deploy with CDK or the CLI. Supports both JSONata (default) and JSONPath query languages.
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`) 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 data flow fields from variable usage — you never write path expressions. In JSONata mode (the default), standard JavaScript methods like `Math.round()`, `str.toUpperCase()`, and `arr.filter()` compile directly to JSONata built-ins. Service bindings are resolved at compile time, with CDK token substitution at synth time.
This produces `output/orderWorkflow.asl.json` — useful for reviewing the generated state machine before deploying.
131
+
This produces `output/orderWorkflow.asl.json` — useful for reviewing the generated state machine before deploying. The default query language is JSONata, which supports richer expressions (arithmetic, string methods, Math functions, higher-order array functions). Use `--query-language jsonpath` if you need the original ASL query language.
Multiplication, division, and modulo are **not supported** -- ASL only provides `States.MathAdd`.
56
+
In **JSONPath mode**, multiplication, division, and modulo are not supported — ASL only provides `States.MathAdd`. In **JSONata mode** (the default), all arithmetic operators work natively: `*`, `/`, `%`, `-`, `+`.
SimpleSteps supports two ASL query languages. JSONata is the default and recommended mode.
29
+
30
+
### JSONata (default)
31
+
32
+
JSONata provides native arithmetic, string manipulation, type conversion, higher-order array functions, and more — most JavaScript patterns compile directly:
JSONPath mode has more restrictions — no arithmetic beyond addition, no string/Math methods. See [Limitations](./limitations.md) for details.
81
+
26
82
## Entry Points
27
83
28
84
### `Steps.createFunction()`
@@ -257,17 +313,16 @@ Substeps can contain any supported control flow: `if/else`, `try/catch`, loops,
257
313
258
314
See [Limitations](./limitations.md#substeps) for constraints.
259
315
260
-
## Automatic Data Flow (No JSONPath)
316
+
## Automatic Data Flow
261
317
262
-
One of SimpleSteps' key design goals: **you never write JSONPath or data flow fields**. The compiler derives all of them from your variable usage.
318
+
One of SimpleSteps' key design goals: **you never write path expressions or data flow fields**. The compiler derives all of them from your variable usage.
263
319
264
-
| ASL Field | Derived From |
265
-
|---|---|
266
-
|`Parameters`| Service call arguments — the compiler maps each argument to a `"field.$": "$.variable"` reference |
267
-
|`ResultPath`| Variable assignment — `const x = await svc.call(...)` stores the result at `$.x`|
268
-
|`InputPath`| Variable references in service call arguments — the compiler determines what data the state needs |
269
-
|`ResultSelector`| Automatic `.Payload` extraction for Lambda results (so you access `result.field`, not `result.Payload.field`) |
270
-
|`OutputPath`|*Not yet implemented* — planned optimization for payload size reduction via variable liveness analysis |
320
+
In **JSONata mode** (default), the compiler emits `Arguments` with `{% %}` expressions. In **JSONPath mode**, it emits `Parameters` with `"field.$": "$.variable"` references. Either way, you write plain TypeScript:
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.
0 commit comments