The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import type * as appflow from "@distilled.cloud/aws/appflow"; |
| 2 | import * as Binding from "alchemy/Binding"; |
| 3 | import type * as Effect from "effect/Effect"; |
| 4 | import type { Flow } from "./Flow.ts"; |
| 5 | |
| 6 | export interface StartFlowRequest extends Omit<appflow.StartFlowRequest, "flowName"> {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `appflow:StartFlow`. |
| 10 | * |
| 11 | * Bind this operation to a {@link Flow} in the function's init phase to get a |
| 12 | * callable that activates the flow — for on-demand flows this triggers a |
| 13 | * single run and returns its `executionId`; for schedule and event-triggered |
| 14 | * flows it activates the flow. The flow name is injected automatically and |
| 15 | * `appflow:StartFlow` is granted on the flow. Provide the implementation with |
| 16 | * `Effect.provide(AWS.AppFlow.StartFlowHttp)`. |
| 17 | * ### Running Flows |
| 18 | * **Example:** Start an On-Demand Flow Run from a Handler |
| 19 | * ```typescript |
| 20 | * export default MyFunction.make( |
| 21 | * { main: import.meta.url, functionUrl: true }, |
| 22 | * Effect.gen(function* () { |
| 23 | * const flow = yield* AWS.AppFlow.Flow("CopyFlow", { ... }); |
| 24 | * // init — bind the operation to the flow |
| 25 | * const startFlow = yield* AWS.AppFlow.StartFlow(flow); |
| 26 | * |
| 27 | * return { |
| 28 | * fetch: Effect.gen(function* () { |
| 29 | * // runtime — trigger a run |
| 30 | * const run = yield* startFlow(); |
| 31 | * return HttpServerResponse.json({ executionId: run.executionId }); |
| 32 | * }).pipe(Effect.orDie), |
| 33 | * }; |
| 34 | * }).pipe(Effect.provide(AWS.AppFlow.StartFlowHttp)), |
| 35 | * ); |
| 36 | * ``` |
| 37 | * |
| 38 | * @binding |
| 39 | */ |
| 40 | export interface StartFlow extends Binding.Service< |
| 41 | StartFlow, |
| 42 | "AWS.AppFlow.StartFlow", |
| 43 | ( |
| 44 | flow: Flow, |
| 45 | ) => Effect.Effect< |
| 46 | (request?: StartFlowRequest) => Effect.Effect<appflow.StartFlowResponse, appflow.StartFlowError> |
| 47 | > |
| 48 | > {} |
| 49 | |
| 50 | export const StartFlow = Binding.Service<StartFlow>("AWS.AppFlow.StartFlow"); |