| 1 | import type * as sfn from "@distilled.cloud/aws/sfn"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { StateMachine } from "./StateMachine.ts"; |
| 5 | |
| 6 | export interface GetExecutionHistoryRequest |
| 7 | extends sfn.GetExecutionHistoryInput {} |
| 8 | |
| 9 | /** |
| 10 | * Runtime binding for `states:GetExecutionHistory`. |
| 11 | * |
| 12 | * Bind this operation to a {@link StateMachine} inside a function runtime |
| 13 | * to page through an execution's event history (state transitions, task |
| 14 | * results, failures). IAM access is scoped to executions of the bound |
| 15 | * state machine. Not supported by `EXPRESS` state machines. |
| 16 | * ### Polling Executions |
| 17 | * **Example:** Inspect why an execution failed |
| 18 | * ```typescript |
| 19 | * const getExecutionHistory = |
| 20 | * yield* StepFunctions.GetExecutionHistory(machine); |
| 21 | * |
| 22 | * const { events } = yield* getExecutionHistory({ |
| 23 | * executionArn, |
| 24 | * reverseOrder: true, |
| 25 | * maxResults: 10, |
| 26 | * }); |
| 27 | * // events[0].type === "ExecutionFailed" carries the error details |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface GetExecutionHistory extends Binding.Service< |
| 33 | GetExecutionHistory, |
| 34 | "AWS.StepFunctions.GetExecutionHistory", |
| 35 | ( |
| 36 | stateMachine: StateMachine, |
| 37 | ) => Effect.Effect< |
| 38 | ( |
| 39 | request: GetExecutionHistoryRequest, |
| 40 | ) => Effect.Effect< |
| 41 | sfn.GetExecutionHistoryOutput, |
| 42 | sfn.GetExecutionHistoryError |
| 43 | > |
| 44 | > |
| 45 | > {} |
| 46 | export const GetExecutionHistory = Binding.Service<GetExecutionHistory>( |
| 47 | "AWS.StepFunctions.GetExecutionHistory", |
| 48 | ); |