@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

main
ts 39 lines 1.47 KB
Raw
1 import type * as codeconnections from "@distilled.cloud/aws/codeconnections";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { Connection } from "./Connection.ts";
5
6 /**
7 * Runtime binding for `codeconnections:GetConnection`.
8 *
9 * Bind this operation to a {@link Connection} to read the connection's live
10 * state — status (`PENDING`/`AVAILABLE`/`ERROR`), provider type, and owner —
11 * from inside a function runtime. Useful for workloads that gate work on the
12 * connection's OAuth handshake having been completed. Provide the
13 * implementation with `Effect.provide(AWS.CodeConnections.GetConnectionHttp)`.
14 * ### Inspecting a Connection
15 * **Example:** Gate on the Connection Being AVAILABLE
16 * ```typescript
17 * // init — bind the operation to the connection
18 * const getConnection = yield* AWS.CodeConnections.GetConnection(connection);
19 *
20 * // runtime
21 * const { Connection: live } = yield* getConnection();
22 * if (live?.ConnectionStatus !== "AVAILABLE") {
23 * return yield* HttpServerResponse.text("handshake pending", { status: 409 });
24 * }
25 * ```
26 *
27 * @binding
28 */
29 export interface GetConnection extends Binding.Service<
30 GetConnection,
31 "AWS.CodeConnections.GetConnection",
32 (
33 connection: Connection,
34 ) => Effect.Effect<
35 () => Effect.Effect<codeconnections.GetConnectionOutput, codeconnections.GetConnectionError>
36 >
37 > {}
38
39 export const GetConnection = Binding.Service<GetConnection>("AWS.CodeConnections.GetConnection");