-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01-sequential.ts
More file actions
23 lines (20 loc) · 1020 Bytes
/
Copy path01-sequential.ts
File metadata and controls
23 lines (20 loc) · 1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Sequential Execution
//
// The simplest pattern: two Lambda calls in sequence, each result
// feeding into the next. The compiler chains them as Task → Task → Pass.
//
// ASL output:
// Invoke_enrichFn (Task, ResultPath: $.enriched)
// → Invoke_transformFn (Task, uses $.enriched.data)
// → Return_Result (Pass, End: true)
import { Steps, SimpleStepContext } from '../../packages/core/src/runtime/index';
import { Lambda } from '../../packages/core/src/runtime/services/Lambda';
const enrichFn = Lambda<{ id: string }, { data: string }>('arn:aws:lambda:us-east-1:123:function:Enrich');
const transformFn = Lambda<{ data: string }, { output: string }>('arn:aws:lambda:us-east-1:123:function:Transform');
export const sequential = Steps.createFunction(
async (context: SimpleStepContext, input: { id: string }) => {
const enriched = await enrichFn.call({ id: input.id });
const transformed = await transformFn.call({ data: enriched.data });
return { output: transformed.output };
},
);