| 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 | |
| 5 | export interface ValidateStateMachineDefinitionRequest |
| 6 | extends sfn.ValidateStateMachineDefinitionInput {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `states:ValidateStateMachineDefinition` — AWS's |
| 10 | * static ASL validator (the Tier-4 check op for the Step Functions DSL). |
| 11 | * |
| 12 | * Service-scoped (no resource argument): validates any definition string |
| 13 | * without creating or updating a state machine. `StateMachine`'s reconcile |
| 14 | * runs this same check as a pre-flight; bind it in a function runtime to |
| 15 | * validate definitions on demand (e.g. compiled `Sfn` programs before a |
| 16 | * deployment pipeline applies them). |
| 17 | * ### Validating Definitions |
| 18 | * **Example:** Validate a definition string |
| 19 | * ```typescript |
| 20 | * const validate = yield* StepFunctions.ValidateStateMachineDefinition(); |
| 21 | * |
| 22 | * const report = yield* validate({ |
| 23 | * definition: JSON.stringify(definition), |
| 24 | * type: "EXPRESS", |
| 25 | * severity: "ERROR", |
| 26 | * }); |
| 27 | * // report.result === "OK" | "FAIL"; report.diagnostics lists findings |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface ValidateStateMachineDefinition extends Binding.Service< |
| 33 | ValidateStateMachineDefinition, |
| 34 | "AWS.StepFunctions.ValidateStateMachineDefinition", |
| 35 | () => Effect.Effect< |
| 36 | ( |
| 37 | request: ValidateStateMachineDefinitionRequest, |
| 38 | ) => Effect.Effect< |
| 39 | sfn.ValidateStateMachineDefinitionOutput, |
| 40 | sfn.ValidateStateMachineDefinitionError |
| 41 | > |
| 42 | > |
| 43 | > {} |
| 44 | export const ValidateStateMachineDefinition = |
| 45 | Binding.Service<ValidateStateMachineDefinition>( |
| 46 | "AWS.StepFunctions.ValidateStateMachineDefinition", |
| 47 | ); |