1import type * as appsync from "@distilled.cloud/aws/appsync";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4
5/**
6 * Runtime binding for `appsync:EvaluateCode` — evaluate `APPSYNC_JS`
7 * resolver/function code against a mock context without touching a deployed
8 * resolver. Useful for CI/tooling functions that validate resolver code
9 * before it ships.
10 *
11 * An account-level operation: the binding takes no resource. GraphQL
12 * *evaluation* errors do not fail the effect — they surface on the
13 * response's `error` field. Provide `AppSync.EvaluateCodeHttp` on the
14 * hosting function's Effect to implement the binding.
15 *
16 * ### Evaluating Resolver Code
17 * **Example:** Run a resolver's request function against a mock context
18 * ```typescript
19 * // init — account-level binding takes no resource
20 * const evaluateCode = yield* AppSync.EvaluateCode();
21 *
22 * // runtime
23 * const result = yield* evaluateCode({
24 * runtime: AppSync.APPSYNC_JS,
25 * code: `
26 * export function request(ctx) { return { payload: ctx.args.a + ctx.args.b }; }
27 * export function response(ctx) { return ctx.result; }
28 * `,
29 * context: JSON.stringify({ arguments: { a: 2, b: 3 } }),
30 * function: "request",
31 * });
32 * // JSON.parse(result.evaluationResult!) → { payload: 5 }
33 * ```
34 *
35 * @binding
36 */
37export interface EvaluateCode extends Binding.Service<
38 EvaluateCode,
39 "AWS.AppSync.EvaluateCode",
40 () => Effect.Effect<
41 (
42 request: appsync.EvaluateCodeRequest,
43 ) => Effect.Effect<appsync.EvaluateCodeResponse, appsync.EvaluateCodeError>
44 >
45> {}
46export const EvaluateCode = Binding.Service<EvaluateCode>(
47 "AWS.AppSync.EvaluateCode",
48);