1 | import { Handler } from "../handler";
|
2 | import { AppSyncIdentity, AppSyncResolverEventHeaders } from "./appsync-resolver";
|
3 |
|
4 | /**
|
5 | * An AWS Amplify GraphQL resolver event. It differs slightly from a native ('direct') AppSync resolver event.
|
6 | *
|
7 | * @see https://docs.amplify.aws/cli/graphql/custom-business-logic/#structure-of-the-function-event
|
8 | */
|
9 | export interface AmplifyGraphQlResolverEvent<TArguments = Record<string, any>, TSource = Record<string, any>> {
|
10 | /** The name of the parent object type (data model) of the field being resolved. */
|
11 | typeName: string;
|
12 | /** The field within the given type to resolve. */
|
13 | fieldName: string;
|
14 | /** A map of GraphQL arguments passed to the field being resolved. */
|
15 | arguments: TArguments;
|
16 | /** The identity used to authenticate the request to AppSync. */
|
17 | identity?: AppSyncIdentity;
|
18 | /** The parent object's value if resolving a nested field. */
|
19 | source: TSource;
|
20 | /** The request headers */
|
21 | request: {
|
22 | headers: AppSyncResolverEventHeaders;
|
23 | domainName: string | null;
|
24 | };
|
25 | /** The object returned by a possible previous pipeline resolver function. */
|
26 | prev: { result: { [key: string]: any } } | null;
|
27 | }
|
28 |
|
29 | /**
|
30 | * A handler for Amplify GraphQL Lambda resolvers. The returned result will be resolved as the value (no need to convert to a JSON string).
|
31 | *
|
32 | * @see https://docs.amplify.aws/cli/graphql/custom-business-logic/#structure-of-the-function-event
|
33 | */
|
34 | export type AmplifyGraphQlResolverHandler<
|
35 | TArguments = Record<string, any>,
|
36 | TSource = Record<string, any>,
|
37 | TResult = any,
|
38 | > = Handler<AmplifyGraphQlResolverEvent<TArguments, TSource>, TResult>;
|