@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 41 lines 1.49 KB
Raw
1 import type * as appsync from "@distilled.cloud/aws/appsync";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { GraphqlApi } from "./GraphqlApi.ts";
5
6 /**
7 * Runtime binding for `appsync:GetIntrospectionSchema` — read a
8 * {@link GraphqlApi}'s live schema (SDL or introspection JSON) from a Lambda
9 * (or other AWS runtime), e.g. for schema registries, codegen services, or
10 * federation gateways that discover the schema at runtime.
11 *
12 * The response `schema` is a streaming body — collect it with
13 * `Stream.mkString(Stream.decodeText(response.schema!))`. Provide
14 * `AppSync.GetIntrospectionSchemaHttp` on the hosting function's Effect to
15 * implement the binding.
16 *
17 * ### Reading the Schema
18 * **Example:** Fetch the API's SDL at runtime
19 * ```typescript
20 * const getSchema = yield* AppSync.GetIntrospectionSchema(api);
21 *
22 * const response = yield* getSchema({ format: "SDL" });
23 * const sdl = yield* Stream.mkString(Stream.decodeText(response.schema!));
24 * ```
25 *
26 * @binding
27 */
28 export interface GetIntrospectionSchema extends Binding.Service<
29 GetIntrospectionSchema,
30 "AWS.AppSync.GetIntrospectionSchema",
31 (
32 api: GraphqlApi,
33 ) => Effect.Effect<
34 (
35 request: Omit<appsync.GetIntrospectionSchemaRequest, "apiId">,
36 ) => Effect.Effect<appsync.GetIntrospectionSchemaResponse, appsync.GetIntrospectionSchemaError>
37 >
38 > {}
39 export const GetIntrospectionSchema = Binding.Service<GetIntrospectionSchema>(
40 "AWS.AppSync.GetIntrospectionSchema",
41 );