| 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 { Activity } from "./Activity.ts"; |
| 5 | |
| 6 | export interface SendTaskFailureRequest extends sfn.SendTaskFailureInput {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `states:SendTaskFailure`. |
| 10 | * |
| 11 | * Fails a callback-pattern task (`.waitForTaskToken`) or an |
| 12 | * {@link Activity} task. Bind without arguments for task tokens issued by |
| 13 | * service-integration Task states, or pass an `Activity` to scope access. |
| 14 | * ### Callback Pattern |
| 15 | * **Example:** Fail a waiting task |
| 16 | * ```typescript |
| 17 | * const sendTaskFailure = yield* StepFunctions.SendTaskFailure(); |
| 18 | * |
| 19 | * yield* sendTaskFailure({ |
| 20 | * taskToken: token, |
| 21 | * error: "ApprovalRejected", |
| 22 | * cause: "the reviewer rejected the request", |
| 23 | * }); |
| 24 | * ``` |
| 25 | * |
| 26 | * @binding |
| 27 | */ |
| 28 | export interface SendTaskFailure extends Binding.Service< |
| 29 | SendTaskFailure, |
| 30 | "AWS.StepFunctions.SendTaskFailure", |
| 31 | ( |
| 32 | activity?: Activity, |
| 33 | ) => Effect.Effect< |
| 34 | ( |
| 35 | request: SendTaskFailureRequest, |
| 36 | ) => Effect.Effect<sfn.SendTaskFailureOutput, sfn.SendTaskFailureError> |
| 37 | > |
| 38 | > {} |
| 39 | export const SendTaskFailure = Binding.Service<SendTaskFailure>( |
| 40 | "AWS.StepFunctions.SendTaskFailure", |
| 41 | ); |