import type * as sfn from "@distilled.cloud/aws/sfn"; import type * as Effect from "effect/Effect"; import * as Binding from "../../Binding.ts"; import type { StateMachine } from "./StateMachine.ts"; export interface StartExecutionRequest extends Omit< sfn.StartExecutionInput, "stateMachineArn" > {} /** * Runtime binding for `states:StartExecution`. * * Bind this operation to a {@link StateMachine} inside a function runtime to * get a callable that starts asynchronous executions with the state machine * ARN injected automatically. * ### Starting Executions * **Example:** Start a workflow execution * ```typescript * const startExecution = yield* StepFunctions.StartExecution(machine); * * const execution = yield* startExecution({ * input: JSON.stringify({ orderId: "123" }), * }); * // execution.executionArn identifies the running workflow * ``` * * **Example:** Idempotent start via execution name * ```typescript * const execution = yield* startExecution({ * name: `order-${orderId}`, * input: JSON.stringify({ orderId }), * }); * ``` * * @binding */ export interface StartExecution extends Binding.Service< StartExecution, "AWS.StepFunctions.StartExecution", ( stateMachine: StateMachine, ) => Effect.Effect< ( request?: StartExecutionRequest, ) => Effect.Effect > > {} export const StartExecution = Binding.Service( "AWS.StepFunctions.StartExecution", );