The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import type * as sfn from "@distilled.cloud/aws/sfn"; |
| 2 | import * as Binding from "alchemy/Binding"; |
| 3 | import type * as Effect from "effect/Effect"; |
| 4 | import type { StateMachine } from "./StateMachine.ts"; |
| 5 | |
| 6 | export interface StartExecutionRequest extends Omit<sfn.StartExecutionInput, "stateMachineArn"> {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `states:StartExecution`. |
| 10 | * |
| 11 | * Bind this operation to a {@link StateMachine} inside a function runtime to |
| 12 | * get a callable that starts asynchronous executions with the state machine |
| 13 | * ARN injected automatically. |
| 14 | * ### Starting Executions |
| 15 | * **Example:** Start a workflow execution |
| 16 | * ```typescript |
| 17 | * const startExecution = yield* StepFunctions.StartExecution(machine); |
| 18 | * |
| 19 | * const execution = yield* startExecution({ |
| 20 | * input: JSON.stringify({ orderId: "123" }), |
| 21 | * }); |
| 22 | * // execution.executionArn identifies the running workflow |
| 23 | * ``` |
| 24 | * |
| 25 | * **Example:** Idempotent start via execution name |
| 26 | * ```typescript |
| 27 | * const execution = yield* startExecution({ |
| 28 | * name: `order-${orderId}`, |
| 29 | * input: JSON.stringify({ orderId }), |
| 30 | * }); |
| 31 | * ``` |
| 32 | * |
| 33 | * @binding |
| 34 | */ |
| 35 | export interface StartExecution extends Binding.Service< |
| 36 | StartExecution, |
| 37 | "AWS.StepFunctions.StartExecution", |
| 38 | ( |
| 39 | stateMachine: StateMachine, |
| 40 | ) => Effect.Effect< |
| 41 | ( |
| 42 | request?: StartExecutionRequest, |
| 43 | ) => Effect.Effect<sfn.StartExecutionOutput, sfn.StartExecutionError> |
| 44 | > |
| 45 | > {} |
| 46 | export const StartExecution = Binding.Service<StartExecution>("AWS.StepFunctions.StartExecution"); |