import { Handler } from '../handler'; export type AppSyncResolverHandler | null> = Handler< AppSyncResolverEvent, TResult >; // https:docs.aws.amazon.com/appsync/latest/devguide/tutorial-lambda-resolvers.html#advanced-use-case-batching export type AppSyncBatchResolverHandler | null> = Handler< Array>, TResult[] >; // See https://docs.aws.amazon.com/appsync/latest/devguide/security-authz.html#aws-lambda-authorization export type AppSyncAuthorizerHander = Handler< AppSyncAuthorizerEvent, AppSyncAuthorizerResult >; export interface AppSyncResolverEventHeaders { [name: string]: string | undefined; } export type AppSyncIdentity = | AppSyncIdentityIAM | AppSyncIdentityCognito | AppSyncIdentityOIDC | AppSyncIdentityLambda | undefined | null; /** * See https://docs.aws.amazon.com/appsync/latest/devguide/resolver-context-reference.html * * @param TArguments type of the arguments * @param TSource type of the source */ export interface AppSyncResolverEvent | null> { arguments: TArguments; identity?: AppSyncIdentity; source: TSource; request: { headers: AppSyncResolverEventHeaders; }; info: { selectionSetList: string[]; selectionSetGraphQL: string; parentTypeName: string; fieldName: string; variables: { [key: string]: any }; }; prev: { result: { [key: string]: any } } | null; stash: { [key: string]: any }; } export interface AppSyncAuthorizerEvent { authorizationToken: string; requestContext: { apiId: string; accountId: string; requestId: string; queryString: string; variables: { [key: string]: any }; }; } export interface AppSyncAuthorizerResult { isAuthorized: boolean; resolverContext?: TResolverContext; deniedFields?: string[]; ttlOverride?: number; } export interface AppSyncIdentityIAM { accountId: string; cognitoIdentityPoolId: string; cognitoIdentityId: string; sourceIp: string[]; username: string; userArn: string; cognitoIdentityAuthType: string; cognitoIdentityAuthProvider: string; } export interface AppSyncIdentityCognito { sub: string; issuer: string; username: string; claims: any; sourceIp: string[]; defaultAuthStrategy: string; groups: string[] | null; } export interface AppSyncIdentityOIDC { claims: any; issuer: string; sub: string; } export interface AppSyncIdentityLambda { resolverContext: any; }