GraphQL
Source:
src/AWS/AppSync/GraphQL.ts
Runtime binding for the appsync:GraphQL data-plane action — execute
GraphQL operations against a GraphqlApi’s endpoint from a Lambda
(or other AWS runtime), SigV4-signed with the host Function’s IAM role.
The API must accept AWS_IAM authentication (as its primary mode or an
additional provider). Provide AppSync.GraphQLHttp on the hosting
function’s Effect to implement the binding.
Executing GraphQL Operations
Section titled “Executing GraphQL Operations”const api = yield* AppSync.GraphqlApi("Api", { authenticationType: "AWS_IAM", schema,});const graphql = yield* AppSync.GraphQL(api);
const result = yield* graphql.execute<{ add: number }>({ query: "query($a: Int!, $b: Int!) { add(a: $a, b: $b) }", variables: { a: 2, b: 3 },});// result.data?.add === 5; field errors appear on result.errors