1 | import { Handler } from "../handler";
|
2 |
|
3 | export type AppSyncResolverHandler<TArguments, TResult, TSource = Record<string, any> | null> = Handler<
|
4 | AppSyncResolverEvent<TArguments, TSource>,
|
5 | TResult
|
6 | >;
|
7 |
|
8 |
|
9 | export type AppSyncBatchResolverHandler<TArguments, TResult, TSource = Record<string, any> | null> = Handler<
|
10 | Array<AppSyncResolverEvent<TArguments, TSource>>,
|
11 | TResult[]
|
12 | >;
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | export type AppSyncAuthorizerHander<TResolverContext = undefined> = AppSyncAuthorizerHandler<TResolverContext>;
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | export type AppSyncAuthorizerHandler<TResolverContext = undefined> = Handler<
|
25 | AppSyncAuthorizerEvent,
|
26 | AppSyncAuthorizerResult<TResolverContext>
|
27 | >;
|
28 |
|
29 | export interface AppSyncResolverEventHeaders {
|
30 | [name: string]: string | undefined;
|
31 | }
|
32 |
|
33 | export interface AppSyncAuthorizerEventHeaders {
|
34 | [name: string]: string | undefined;
|
35 | }
|
36 |
|
37 | export type AppSyncIdentity =
|
38 | | AppSyncIdentityIAM
|
39 | | AppSyncIdentityCognito
|
40 | | AppSyncIdentityOIDC
|
41 | | AppSyncIdentityLambda
|
42 | | undefined
|
43 | | null;
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 | export interface AppSyncResolverEvent<TArguments, TSource = Record<string, any> | null> {
|
54 | arguments: TArguments;
|
55 | identity?: AppSyncIdentity;
|
56 | source: TSource;
|
57 | request: {
|
58 | headers: AppSyncResolverEventHeaders;
|
59 |
|
60 | domainName: string | null;
|
61 | };
|
62 | info: {
|
63 | selectionSetList: string[];
|
64 | selectionSetGraphQL: string;
|
65 | parentTypeName: string;
|
66 | fieldName: string;
|
67 | variables: { [key: string]: any };
|
68 | };
|
69 | prev: { result: { [key: string]: any } } | null;
|
70 | stash: { [key: string]: any };
|
71 | }
|
72 |
|
73 | export interface AppSyncAuthorizerEvent {
|
74 | authorizationToken: string;
|
75 | requestContext: {
|
76 | apiId: string;
|
77 | accountId: string;
|
78 | requestId: string;
|
79 | queryString: string;
|
80 | operationName?: string;
|
81 | variables: { [key: string]: any };
|
82 | };
|
83 | requestHeaders: AppSyncAuthorizerEventHeaders;
|
84 | }
|
85 |
|
86 | export interface AppSyncAuthorizerResult<TResolverContext = undefined> {
|
87 | isAuthorized: boolean;
|
88 | resolverContext?: TResolverContext;
|
89 | deniedFields?: string[];
|
90 | ttlOverride?: number;
|
91 | }
|
92 | export interface AppSyncIdentityIAM {
|
93 | accountId: string;
|
94 | cognitoIdentityPoolId: string;
|
95 | cognitoIdentityId: string;
|
96 | sourceIp: string[];
|
97 | username: string;
|
98 | userArn: string;
|
99 | cognitoIdentityAuthType: string;
|
100 | cognitoIdentityAuthProvider: string;
|
101 | }
|
102 |
|
103 | export interface AppSyncIdentityCognito {
|
104 | sub: string;
|
105 | issuer: string;
|
106 | username: string;
|
107 | claims: any;
|
108 | sourceIp: string[];
|
109 | defaultAuthStrategy: string;
|
110 | groups: string[] | null;
|
111 | }
|
112 |
|
113 | export interface AppSyncIdentityOIDC {
|
114 | claims: any;
|
115 | issuer: string;
|
116 | sub: string;
|
117 | }
|
118 |
|
119 | export interface AppSyncIdentityLambda {
|
120 | resolverContext: any;
|
121 | }
|