1import type * as sfn from "@distilled.cloud/aws/sfn";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { StateMachine } from "./StateMachine.ts";
5
6export interface StartSyncExecutionRequest extends Omit<
7 sfn.StartSyncExecutionInput,
8 "stateMachineArn"
9> {}
10
11/**
12 * Runtime binding for `states:StartSyncExecution`.
13 *
14 * Bind this operation to an `EXPRESS` {@link StateMachine} inside a function
15 * runtime to run the workflow synchronously — the call returns once the
16 * execution finishes, with its status and output. Not available for
17 * `STANDARD` workflows.
18 * ### Synchronous Execution
19 * **Example:** Run an EXPRESS workflow and read its output
20 * ```typescript
21 * const startSyncExecution = yield* StepFunctions.StartSyncExecution(machine);
22 *
23 * const result = yield* startSyncExecution({
24 * input: JSON.stringify({ value: 21 }),
25 * });
26 * if (result.status === "SUCCEEDED") {
27 * const output = JSON.parse(String(result.output));
28 * }
29 * ```
30 *
31 * @binding
32 */
33export interface StartSyncExecution extends Binding.Service<
34 StartSyncExecution,
35 "AWS.StepFunctions.StartSyncExecution",
36 (
37 stateMachine: StateMachine,
38 ) => Effect.Effect<
39 (
40 request?: StartSyncExecutionRequest,
41 ) => Effect.Effect<
42 sfn.StartSyncExecutionOutput,
43 sfn.StartSyncExecutionError
44 >
45 >
46> {}
47export const StartSyncExecution = Binding.Service<StartSyncExecution>(
48 "AWS.StepFunctions.StartSyncExecution",
49);