@aws-amplify/api-graphql 4.0.17-unstable.5c56101.0 → 4.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -579,8 +579,6 @@ export function generateGraphQLDocument(
579
579
  );
580
580
  }
581
581
 
582
- console.log('indexQueryArgs', indexQueryArgs!);
583
-
584
582
  let graphQLOperationType: 'mutation' | 'query' | 'subscription' | undefined;
585
583
  let graphQLSelectionSet: string | undefined;
586
584
  let graphQLArguments: Record<string, any> | undefined;
@@ -613,10 +611,10 @@ export function generateGraphQLDocument(
613
611
  return acc;
614
612
  },
615
613
  {},
616
- )
614
+ )
617
615
  : {
618
616
  [primaryKeyFieldName]: `${fields[primaryKeyFieldName].type}!`,
619
- });
617
+ });
620
618
  graphQLSelectionSet ?? (graphQLSelectionSet = selectionSetFields);
621
619
  case 'LIST':
622
620
  graphQLArguments ??
@@ -660,13 +658,13 @@ export function generateGraphQLDocument(
660
658
  graphQLArguments
661
659
  ? `(${Object.entries(graphQLArguments).map(
662
660
  ([fieldName, type]) => `\$${fieldName}: ${type}`,
663
- )})`
661
+ )})`
664
662
  : ''
665
663
  } { ${graphQLFieldName}${
666
664
  graphQLArguments
667
665
  ? `(${Object.keys(graphQLArguments).map(
668
666
  fieldName => `${fieldName}: \$${fieldName}`,
669
- )})`
667
+ )})`
670
668
  : ''
671
669
  } { ${graphQLSelectionSet} } }`;
672
670
 
@@ -716,7 +714,7 @@ export function buildGraphQLVariables(
716
714
 
717
715
  return !isReadOnly;
718
716
  }),
719
- )
717
+ )
720
718
  : {},
721
719
  };
722
720
  break;
@@ -732,7 +730,7 @@ export function buildGraphQLVariables(
732
730
  return acc;
733
731
  },
734
732
  {},
735
- )
733
+ )
736
734
  : { [primaryKeyFieldName]: arg[primaryKeyFieldName] };
737
735
  }
738
736
 
@@ -40,7 +40,7 @@ const logger = new ConsoleLogger('GraphQLAPI');
40
40
  const isAmplifyInstance = (
41
41
  amplify:
42
42
  | AmplifyClassV6
43
- | ((fn: (amplify: any) => Promise<any>) => Promise<AmplifyClassV6>)
43
+ | ((fn: (amplify: any) => Promise<any>) => Promise<AmplifyClassV6>),
44
44
  ): amplify is AmplifyClassV6 => {
45
45
  return typeof amplify !== 'function';
46
46
  };
@@ -68,7 +68,7 @@ export class InternalGraphQLAPIClass {
68
68
  private async _headerBasedAuth(
69
69
  amplify: AmplifyClassV6,
70
70
  authMode: GraphQLAuthMode,
71
- additionalHeaders: Record<string, string> = {}
71
+ additionalHeaders: Record<string, string> = {},
72
72
  ) {
73
73
  const {
74
74
  region: region,
@@ -159,7 +159,7 @@ export class InternalGraphQLAPIClass {
159
159
  | ((fn: (amplify: any) => Promise<any>) => Promise<AmplifyClassV6>),
160
160
  { query: paramQuery, variables = {}, authMode, authToken }: GraphQLOptions,
161
161
  additionalHeaders?: CustomHeaders,
162
- customUserAgentDetails?: CustomUserAgentDetails
162
+ customUserAgentDetails?: CustomUserAgentDetails,
163
163
  ): Observable<GraphQLResult<T>> | Promise<GraphQLResult<T>> {
164
164
  const query =
165
165
  typeof paramQuery === 'string'
@@ -167,7 +167,7 @@ export class InternalGraphQLAPIClass {
167
167
  : parse(print(paramQuery));
168
168
 
169
169
  const [operationDef = {}] = query.definitions.filter(
170
- def => def.kind === 'OperationDefinition'
170
+ def => def.kind === 'OperationDefinition',
171
171
  );
172
172
  const { operation: operationType } =
173
173
  operationDef as OperationDefinitionNode;
@@ -188,19 +188,24 @@ export class InternalGraphQLAPIClass {
188
188
  headers,
189
189
  abortController,
190
190
  customUserAgentDetails,
191
- authToken
191
+ authToken,
192
192
  );
193
193
  } else {
194
- const wrapper = (amplifyInstance: AmplifyClassV6) =>
195
- this._graphql<T>(
194
+ // NOTE: this wrapper function must be await-able so the Amplify server context manager can
195
+ // destroy the context only after it completes
196
+ const wrapper = async (amplifyInstance: AmplifyClassV6) => {
197
+ const result = await this._graphql<T>(
196
198
  amplifyInstance,
197
199
  { query, variables, authMode },
198
200
  headers,
199
201
  abortController,
200
202
  customUserAgentDetails,
201
- authToken
203
+ authToken,
202
204
  );
203
205
 
206
+ return result;
207
+ };
208
+
204
209
  responsePromise = amplify(wrapper) as unknown as Promise<
205
210
  GraphQLResult<T>
206
211
  >;
@@ -208,7 +213,7 @@ export class InternalGraphQLAPIClass {
208
213
 
209
214
  this._api.updateRequestToBeCancellable(
210
215
  responsePromise,
211
- abortController
216
+ abortController,
212
217
  );
213
218
  return responsePromise;
214
219
  case 'subscription':
@@ -217,7 +222,7 @@ export class InternalGraphQLAPIClass {
217
222
  { query, variables, authMode },
218
223
  headers,
219
224
  customUserAgentDetails,
220
- authToken
225
+ authToken,
221
226
  );
222
227
  default:
223
228
  throw new Error(`invalid operation type: ${operationType}`);
@@ -230,7 +235,7 @@ export class InternalGraphQLAPIClass {
230
235
  additionalHeaders: CustomHeaders = {},
231
236
  abortController: AbortController,
232
237
  customUserAgentDetails?: CustomUserAgentDetails,
233
- authToken?: string
238
+ authToken?: string,
234
239
  ): Promise<GraphQLResult<T>> {
235
240
  const {
236
241
  region: region,
@@ -263,7 +268,7 @@ export class InternalGraphQLAPIClass {
263
268
  const requestOptions: RequestOptions = {
264
269
  method: 'POST',
265
270
  url: new AmplifyUrl(
266
- customEndpoint || appSyncGraphqlEndpoint || ''
271
+ customEndpoint || appSyncGraphqlEndpoint || '',
267
272
  ).toString(),
268
273
  queryString: print(query as DocumentNode),
269
274
  };
@@ -287,7 +292,7 @@ export class InternalGraphQLAPIClass {
287
292
  (await this._headerBasedAuth(
288
293
  amplify,
289
294
  authMode!,
290
- additionalCustomHeaders
295
+ additionalCustomHeaders,
291
296
  ))),
292
297
  /**
293
298
  * Custom endpoint headers.
@@ -300,8 +305,8 @@ export class InternalGraphQLAPIClass {
300
305
  ? await this._headerBasedAuth(
301
306
  amplify,
302
307
  authMode!,
303
- additionalCustomHeaders
304
- )
308
+ additionalCustomHeaders,
309
+ )
305
310
  : {})) ||
306
311
  {}),
307
312
  // Custom headers included in Amplify configuration options:
@@ -361,7 +366,7 @@ export class InternalGraphQLAPIClass {
361
366
  let response: any;
362
367
 
363
368
  try {
364
- const { body: responseBody } = await this._api.post({
369
+ const { body: responseBody } = await this._api.post(amplify, {
365
370
  url: new AmplifyUrl(endpoint),
366
371
  options: {
367
372
  headers,
@@ -392,7 +397,7 @@ export class InternalGraphQLAPIClass {
392
397
  null,
393
398
  null,
394
399
  null,
395
- err as any
400
+ err as any,
396
401
  ),
397
402
  ],
398
403
  };
@@ -430,7 +435,7 @@ export class InternalGraphQLAPIClass {
430
435
  { query, variables, authMode }: GraphQLOptions,
431
436
  additionalHeaders: CustomHeaders = {},
432
437
  customUserAgentDetails?: CustomUserAgentDetails,
433
- authToken?: string
438
+ authToken?: string,
434
439
  ): Observable<any> {
435
440
  const config = resolveConfig(amplify);
436
441
 
@@ -457,7 +462,7 @@ export class InternalGraphQLAPIClass {
457
462
  authToken,
458
463
  libraryConfigHeaders,
459
464
  },
460
- customUserAgentDetails
465
+ customUserAgentDetails,
461
466
  )
462
467
  .pipe(
463
468
  catchError(e => {
@@ -465,7 +470,7 @@ export class InternalGraphQLAPIClass {
465
470
  throw repackageUnauthError(e);
466
471
  }
467
472
  throw e;
468
- })
473
+ }),
469
474
  );
470
475
  }
471
476
  }
@@ -30,12 +30,12 @@ export function getFactory(
30
30
  modelIntrospection: ModelIntrospectionSchema,
31
31
  model: SchemaModel,
32
32
  operation: ModelOperation,
33
- useContext = false
33
+ useContext = false,
34
34
  ) {
35
35
  const getWithContext = async (
36
36
  contextSpec: AmplifyServer.ContextSpec & GraphQLOptionsV6<unknown, string>,
37
37
  arg?: any,
38
- options?: any
38
+ options?: any,
39
39
  ) => {
40
40
  return _get(
41
41
  client,
@@ -44,7 +44,7 @@ export function getFactory(
44
44
  arg,
45
45
  options,
46
46
  operation,
47
- contextSpec
47
+ contextSpec,
48
48
  );
49
49
  };
50
50
 
@@ -62,7 +62,7 @@ async function _get(
62
62
  arg: QueryArgs,
63
63
  options: AuthModeParams & ListArgs,
64
64
  operation: ModelOperation,
65
- context?: AmplifyServer.ContextSpec
65
+ context?: AmplifyServer.ContextSpec,
66
66
  ) {
67
67
  const { name } = model;
68
68
 
@@ -70,13 +70,13 @@ async function _get(
70
70
  modelIntrospection.models,
71
71
  name,
72
72
  operation,
73
- options
73
+ options,
74
74
  );
75
75
  const variables = buildGraphQLVariables(
76
76
  model,
77
77
  operation,
78
78
  arg,
79
- modelIntrospection
79
+ modelIntrospection,
80
80
  );
81
81
 
82
82
  try {
@@ -92,16 +92,16 @@ async function _get(
92
92
  query,
93
93
  variables,
94
94
  },
95
- headers
96
- )) as GraphQLResult<any>)
95
+ headers,
96
+ )) as GraphQLResult<any>)
97
97
  : ((await (client as V6Client<Record<string, any>>).graphql(
98
98
  {
99
99
  ...auth,
100
100
  query,
101
101
  variables,
102
102
  },
103
- headers
104
- )) as GraphQLResult<any>);
103
+ headers,
104
+ )) as GraphQLResult<any>);
105
105
 
106
106
  // flatten response
107
107
  if (data) {
@@ -119,7 +119,7 @@ async function _get(
119
119
  modelIntrospection,
120
120
  auth.authMode,
121
121
  auth.authToken,
122
- !!context
122
+ !!context,
123
123
  );
124
124
 
125
125
  return { data: initialized, extensions };
@@ -26,11 +26,11 @@ export function listFactory(
26
26
  client: ClientWithModels,
27
27
  modelIntrospection: ModelIntrospectionSchema,
28
28
  model: SchemaModel,
29
- context = false
29
+ context = false,
30
30
  ) {
31
31
  const listWithContext = async (
32
32
  contextSpec: AmplifyServer.ContextSpec,
33
- args?: ListArgs
33
+ args?: ListArgs,
34
34
  ) => {
35
35
  return _list(client, modelIntrospection, model, args, contextSpec);
36
36
  };
@@ -47,7 +47,7 @@ async function _list(
47
47
  modelIntrospection: ModelIntrospectionSchema,
48
48
  model: SchemaModel,
49
49
  args?: ListArgs & AuthModeParams,
50
- contextSpec?: AmplifyServer.ContextSpec
50
+ contextSpec?: AmplifyServer.ContextSpec,
51
51
  ) {
52
52
  const { name } = model;
53
53
 
@@ -55,13 +55,13 @@ async function _list(
55
55
  modelIntrospection.models,
56
56
  name,
57
57
  'LIST',
58
- args
58
+ args,
59
59
  );
60
60
  const variables = buildGraphQLVariables(
61
61
  model,
62
62
  'LIST',
63
63
  args,
64
- modelIntrospection
64
+ modelIntrospection,
65
65
  );
66
66
 
67
67
  try {
@@ -77,16 +77,16 @@ async function _list(
77
77
  query,
78
78
  variables,
79
79
  },
80
- headers
81
- )) as GraphQLResult<any>)
80
+ headers,
81
+ )) as GraphQLResult<any>)
82
82
  : ((await (client as V6Client<Record<string, any>>).graphql(
83
83
  {
84
84
  ...auth,
85
85
  query,
86
86
  variables,
87
87
  },
88
- headers
89
- )) as GraphQLResult<any>);
88
+ headers,
89
+ )) as GraphQLResult<any>);
90
90
 
91
91
  // flatten response
92
92
  if (data !== undefined) {
@@ -110,7 +110,7 @@ async function _list(
110
110
  modelIntrospection,
111
111
  auth.authMode,
112
112
  auth.authToken,
113
- !!contextSpec
113
+ !!contextSpec,
114
114
  );
115
115
 
116
116
  return {
@@ -20,7 +20,7 @@ export function subscriptionFactory(
20
20
  client: any,
21
21
  modelIntrospection: ModelIntrospectionSchema,
22
22
  model: SchemaModel,
23
- operation: ModelOperation
23
+ operation: ModelOperation,
24
24
  ) {
25
25
  const { name } = model as any;
26
26
 
@@ -28,13 +28,13 @@ export function subscriptionFactory(
28
28
  const query = generateGraphQLDocument(
29
29
  modelIntrospection.models,
30
30
  name,
31
- operation
31
+ operation,
32
32
  );
33
33
  const variables = buildGraphQLVariables(
34
34
  model,
35
35
  operation,
36
36
  args,
37
- modelIntrospection
37
+ modelIntrospection,
38
38
  );
39
39
 
40
40
  const auth = authModeParams(client, args);
@@ -47,7 +47,7 @@ export function subscriptionFactory(
47
47
  query,
48
48
  variables,
49
49
  },
50
- headers
50
+ headers,
51
51
  ) as GraphqlSubscriptionResult<object>;
52
52
 
53
53
  return observable.pipe(
@@ -60,10 +60,10 @@ export function subscriptionFactory(
60
60
  [data],
61
61
  modelIntrospection,
62
62
  auth.authMode,
63
- auth.authToken
63
+ auth.authToken,
64
64
  );
65
65
  return initialized;
66
- })
66
+ }),
67
67
  );
68
68
  };
69
69
 
@@ -30,7 +30,7 @@ export function generateClientWithAmplifyInstance<
30
30
  | V6ClientSSRRequest<T>
31
31
  | V6ClientSSRCookies<T> = V6ClientSSRCookies<T>,
32
32
  >(
33
- params: ServerClientGenerationParams & CommonPublicClientOptions
33
+ params: ServerClientGenerationParams & CommonPublicClientOptions,
34
34
  ): ClientType {
35
35
  const client = {
36
36
  [__amplify]: params.amplify,
@@ -101,12 +101,12 @@ export function graphql<
101
101
  >(
102
102
  this: V6Client,
103
103
  options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
104
- additionalHeaders?: CustomHeaders
104
+ additionalHeaders?: CustomHeaders,
105
105
  ): GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING> {
106
- // inject client-level auth
106
+ // inject client-level auth
107
107
  options.authMode = options.authMode || this[__authMode];
108
108
  options.authToken = options.authToken || this[__authToken];
109
-
109
+
110
110
  /**
111
111
  * The correctness of these typings depends on correct string branding or overrides.
112
112
  * Neither of these can actually be validated at runtime. Hence, we don't perform
@@ -115,7 +115,7 @@ export function graphql<
115
115
  const result = GraphQLAPI.graphql(
116
116
  this[__amplify],
117
117
  options,
118
- additionalHeaders
118
+ additionalHeaders,
119
119
  );
120
120
  return result as any;
121
121
  }
@@ -128,7 +128,7 @@ export function graphql<
128
128
  export function cancel(
129
129
  this: V6Client,
130
130
  promise: Promise<any>,
131
- message?: string
131
+ message?: string,
132
132
  ): boolean {
133
133
  return GraphQLAPI.cancel(promise, message);
134
134
  }
@@ -52,13 +52,13 @@ export function generateClient<T extends Record<any, any> = never>({
52
52
  const wrappedGraphql = (
53
53
  contextSpec: AmplifyServer.ContextSpec,
54
54
  options: GraphQLOptionsV6,
55
- additionalHeaders?: CustomHeaders
55
+ additionalHeaders?: CustomHeaders,
56
56
  ) => {
57
57
  const amplifyInstance = getAmplifyServerContext(contextSpec).amplify;
58
58
  return prevGraphql.call(
59
59
  { [__amplify]: amplifyInstance },
60
60
  options,
61
- additionalHeaders as any
61
+ additionalHeaders as any,
62
62
  );
63
63
  };
64
64
 
@@ -1,7 +1,11 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { AmplifyClassV6, ResourcesConfig } from '@aws-amplify/core';
4
- import { ModelTypes, CustomHeaders, EnumTypes } from '@aws-amplify/data-schema-types';
4
+ import {
5
+ ModelTypes,
6
+ CustomHeaders,
7
+ EnumTypes,
8
+ } from '@aws-amplify/data-schema-types';
5
9
  import { Source, DocumentNode, GraphQLError } from 'graphql';
6
10
  export { OperationTypeNode } from 'graphql';
7
11
  import { Observable } from 'rxjs';
@@ -72,7 +76,7 @@ export type GraphQLSubscription<T> = T & {
72
76
  export type GraphQLReturnType<T> = T extends {}
73
77
  ? {
74
78
  [K in keyof T]?: GraphQLReturnType<T[K]>;
75
- }
79
+ }
76
80
  : T;
77
81
 
78
82
  /**
@@ -93,13 +97,14 @@ type PagedList<T, TYPENAME> = {
93
97
  * array, this will only be the case when we also have errors,
94
98
  * which will then be *thrown*.
95
99
  */
96
- type WithListsFixed<T> = T extends PagedList<infer IT, infer NAME>
97
- ? PagedList<Exclude<IT, null | undefined>, NAME>
98
- : T extends {}
99
- ? {
100
- [K in keyof T]: WithListsFixed<T[K]>;
101
- }
102
- : T;
100
+ type WithListsFixed<T> =
101
+ T extends PagedList<infer IT, infer NAME>
102
+ ? PagedList<Exclude<IT, null | undefined>, NAME>
103
+ : T extends {}
104
+ ? {
105
+ [K in keyof T]: WithListsFixed<T[K]>;
106
+ }
107
+ : T;
103
108
 
104
109
  /**
105
110
  * Returns an updated response type to always return a value.
@@ -115,14 +120,12 @@ type NeverEmpty<T> = {
115
120
  * If empty members are present, there will also be errors present,
116
121
  * and the response will instead be *thrown*.
117
122
  */
118
- type FixedQueryResult<T> = Exclude<
119
- T[keyof T],
120
- null | undefined
121
- > extends PagedList<any, any>
122
- ? {
123
- [K in keyof T]-?: WithListsFixed<Exclude<T[K], null | undefined>>;
124
- }
125
- : T;
123
+ type FixedQueryResult<T> =
124
+ Exclude<T[keyof T], null | undefined> extends PagedList<any, any>
125
+ ? {
126
+ [K in keyof T]-?: WithListsFixed<Exclude<T[K], null | undefined>>;
127
+ }
128
+ : T;
126
129
 
127
130
  /**
128
131
  * The return value from a `graphql({query})` call when `query` is a subscription.
@@ -181,7 +184,7 @@ export interface AWSAppSyncRealTimeProviderOptions {
181
184
 
182
185
  export type AWSAppSyncRealTimeProvider = {
183
186
  subscribe(
184
- options?: AWSAppSyncRealTimeProviderOptions
187
+ options?: AWSAppSyncRealTimeProviderOptions,
185
188
  ): Observable<Record<string, unknown>>;
186
189
  };
187
190
 
@@ -235,15 +238,16 @@ export type UnknownGraphQLResponse =
235
238
  export type GraphQLVariablesV6<
236
239
  FALLBACK_TYPES = unknown,
237
240
  TYPED_GQL_STRING extends string = string,
238
- > = TYPED_GQL_STRING extends GeneratedQuery<infer IN, any>
239
- ? IN
240
- : TYPED_GQL_STRING extends GeneratedMutation<infer IN, any>
241
- ? IN
242
- : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, any>
243
- ? IN
244
- : FALLBACK_TYPES extends GraphQLOperationType<infer IN, any>
245
- ? IN
246
- : any;
241
+ > =
242
+ TYPED_GQL_STRING extends GeneratedQuery<infer IN, any>
243
+ ? IN
244
+ : TYPED_GQL_STRING extends GeneratedMutation<infer IN, any>
245
+ ? IN
246
+ : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, any>
247
+ ? IN
248
+ : FALLBACK_TYPES extends GraphQLOperationType<infer IN, any>
249
+ ? IN
250
+ : any;
247
251
 
248
252
  /**
249
253
  * The expected return type with respect to the given `FALLBACK_TYPE`
@@ -252,22 +256,23 @@ export type GraphQLVariablesV6<
252
256
  export type GraphQLResponseV6<
253
257
  FALLBACK_TYPE = unknown,
254
258
  TYPED_GQL_STRING extends string = string,
255
- > = TYPED_GQL_STRING extends GeneratedQuery<infer IN, infer QUERY_OUT>
256
- ? Promise<GraphQLResult<FixedQueryResult<QUERY_OUT>>>
257
- : TYPED_GQL_STRING extends GeneratedMutation<infer IN, infer MUTATION_OUT>
258
- ? Promise<GraphQLResult<NeverEmpty<MUTATION_OUT>>>
259
- : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, infer SUB_OUT>
260
- ? GraphqlSubscriptionResult<NeverEmpty<SUB_OUT>>
261
- : FALLBACK_TYPE extends GraphQLQuery<infer T>
262
- ? Promise<GraphQLResult<FALLBACK_TYPE>>
263
- : FALLBACK_TYPE extends GraphQLSubscription<infer T>
264
- ? GraphqlSubscriptionResult<FALLBACK_TYPE>
265
- : FALLBACK_TYPE extends GraphQLOperationType<
266
- infer IN,
267
- infer CUSTOM_OUT
268
- >
269
- ? CUSTOM_OUT
270
- : UnknownGraphQLResponse;
259
+ > =
260
+ TYPED_GQL_STRING extends GeneratedQuery<infer IN, infer QUERY_OUT>
261
+ ? Promise<GraphQLResult<FixedQueryResult<QUERY_OUT>>>
262
+ : TYPED_GQL_STRING extends GeneratedMutation<infer IN, infer MUTATION_OUT>
263
+ ? Promise<GraphQLResult<NeverEmpty<MUTATION_OUT>>>
264
+ : TYPED_GQL_STRING extends GeneratedSubscription<infer IN, infer SUB_OUT>
265
+ ? GraphqlSubscriptionResult<NeverEmpty<SUB_OUT>>
266
+ : FALLBACK_TYPE extends GraphQLQuery<infer T>
267
+ ? Promise<GraphQLResult<FALLBACK_TYPE>>
268
+ : FALLBACK_TYPE extends GraphQLSubscription<infer T>
269
+ ? GraphqlSubscriptionResult<FALLBACK_TYPE>
270
+ : FALLBACK_TYPE extends GraphQLOperationType<
271
+ infer IN,
272
+ infer CUSTOM_OUT
273
+ >
274
+ ? CUSTOM_OUT
275
+ : UnknownGraphQLResponse;
271
276
 
272
277
  /**
273
278
  * The shape customers can use to provide `T` to `graphql<T>()` to specify both
@@ -414,7 +419,7 @@ export type GraphQLMethod = <
414
419
  TYPED_GQL_STRING extends string = string,
415
420
  >(
416
421
  options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
417
- additionalHeaders?: CustomHeaders | undefined
422
+ additionalHeaders?: CustomHeaders | undefined,
418
423
  ) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
419
424
 
420
425
  export type GraphQLMethodSSR = <
@@ -423,7 +428,7 @@ export type GraphQLMethodSSR = <
423
428
  >(
424
429
  contextSpec: AmplifyServer.ContextSpec,
425
430
  options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
426
- additionalHeaders?: CustomHeaders | undefined
431
+ additionalHeaders?: CustomHeaders | undefined,
427
432
  ) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
428
433
 
429
434
  /**
@@ -69,10 +69,10 @@ export class ConnectionStateMonitor {
69
69
  this._initialNetworkStateSubscription = ReachabilityMonitor().subscribe(
70
70
  ({ online }) => {
71
71
  this.record(
72
- online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE
72
+ online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE,
73
73
  );
74
74
  this._initialNetworkStateSubscription?.unsubscribe();
75
- }
75
+ },
76
76
  );
77
77
 
78
78
  this._linkedConnectionStateObservable =
@@ -94,9 +94,9 @@ export class ConnectionStateMonitor {
94
94
  this._networkMonitoringSubscription = ReachabilityMonitor().subscribe(
95
95
  ({ online }) => {
96
96
  this.record(
97
- online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE
97
+ online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE,
98
98
  );
99
- }
99
+ },
100
100
  );
101
101
  }
102
102
  }
@@ -126,14 +126,14 @@ export class ConnectionStateMonitor {
126
126
  .pipe(
127
127
  map(value => {
128
128
  return this.connectionStatesTranslator(value);
129
- })
129
+ }),
130
130
  )
131
131
  .pipe(
132
132
  filter(current => {
133
133
  const toInclude = current !== previous;
134
134
  previous = current;
135
135
  return toInclude;
136
- })
136
+ }),
137
137
  );
138
138
  }
139
139
 
@@ -9,7 +9,7 @@ import { APIValidationErrorCode, validationErrorMap } from './validation';
9
9
  */
10
10
  export function assertValidationError(
11
11
  assertion: boolean,
12
- name: APIValidationErrorCode
12
+ name: APIValidationErrorCode,
13
13
  ): asserts assertion {
14
14
  const { message, recoverySuggestion } = validationErrorMap[name];
15
15