Skip to content

Commit 677cca6

Browse files
committed
* docs and example
1 parent 993b1c1 commit 677cca6

5 files changed

Lines changed: 27 additions & 12 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ npx simplesteps compile workflow.ts -o output/
136136
| `if/else`, `switch/case` | Choice state |
137137
| `while`, `do...while` | Choice + back-edge loop |
138138
| `for (const item of array)` | Map state (parallel, with closures) |
139-
| `await Steps.map(items, cb, opts?)` | Map state (results, closures, MaxConcurrency) |
140-
| `for (const item of Steps.items(arr, opts?))` | Map state (for...of + MaxConcurrency) |
139+
| `await Steps.map(items, cb, opts?)` | Map state (results, closures, MaxConcurrency, Retry) |
140+
| `for (const item of Steps.items(arr, opts?))` | Map state (for...of + MaxConcurrency, Retry) |
141141
| `await Promise.all([...])` | Parallel state |
142142
| Deferred-await (`const p = call(); await p`) | Parallel state (auto-batched) |
143143
| `await Steps.delay({ seconds: 30 })` | Wait state |

docs/language-reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ Every TypeScript construct supported by SimpleSteps and its ASL mapping.
1111
| `if/else`, `switch/case` | Choice |
1212
| `while`, `do...while` | Choice + back-edge loop |
1313
| `for (const item of array)` | Map (parallel, with closures) |
14-
| `await Steps.map(items, callback, opts?)` | Map (with result capture, closures, MaxConcurrency) |
15-
| `for (const item of Steps.items(array, opts?))` | Map (for...of with MaxConcurrency + closures) |
14+
| `await Steps.map(items, callback, opts?)` | Map (with result capture, closures, MaxConcurrency, Retry) |
15+
| `for (const item of Steps.items(array, opts?))` | Map (for...of with MaxConcurrency, Retry, closures) |
1616
| `for (const item of Steps.sequential(array))` | Map (sequential, `MaxConcurrency: 1`) |
1717
| `await Promise.all([...])` | Parallel |
1818
| Deferred-await (`const p = call(); await p`) | Parallel (auto-batched) |

examples/aws-cdk-comparison/output/05-parallel-processing.asl.json

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,25 @@
4444
}
4545
}
4646
],
47-
"ResultSelector": {
48-
"profile.$": "$[0]",
49-
"history.$": "$[1]",
50-
"recommendations.$": "$[2]"
51-
},
47+
"ResultPath": "$.__parallel",
48+
"Next": "Assign_profile"
49+
},
50+
"Assign_profile": {
51+
"Type": "Pass",
52+
"InputPath": "$.__parallel[0]",
53+
"ResultPath": "$.profile",
54+
"Next": "Assign_history"
55+
},
56+
"Assign_history": {
57+
"Type": "Pass",
58+
"InputPath": "$.__parallel[1]",
59+
"ResultPath": "$.history",
60+
"Next": "Assign_recommendations"
61+
},
62+
"Assign_recommendations": {
63+
"Type": "Pass",
64+
"InputPath": "$.__parallel[2]",
65+
"ResultPath": "$.recommendations",
5266
"Next": "Return_Result"
5367
},
5468
"Return_Result": {

examples/showcase/19-parallel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
// Array destructuring captures each branch's output:
88
// const [a, b] = await Promise.all([callA(), callB()])
9-
// → Parallel state with ResultSelector mapping $[0]→a, $[1]→b
9+
// → Parallel state with ResultPath + Assign Pass states for each binding
1010

1111
import { Steps, SimpleStepContext } from '../../packages/core/src/runtime/index';
1212
import { Lambda } from '../../packages/core/src/runtime/services/Lambda';

examples/showcase/32-deferred-await.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
// const [a, b] = await Promise.all([call1(), call2()]);
1818
//
1919
// ASL output:
20-
// Parallel (Parallel, 2 branches,
21-
// ResultSelector: { order: $[0], payment: $[1] })
20+
// Parallel (Parallel, 2 branches, ResultPath: $.__parallel)
2221
// Branch 0: Invoke_getOrder (Task, End)
2322
// Branch 1: Invoke_getPayment (Task, End)
23+
// → Assign_order (Pass, InputPath: $.__parallel[0], ResultPath: $.order)
24+
// → Assign_payment (Pass, InputPath: $.__parallel[1], ResultPath: $.payment)
2425
// → Return_Result (Pass, End)
2526

2627
import { Steps, SimpleStepContext } from '../../packages/core/src/runtime/index';

0 commit comments

Comments
 (0)