@aws-amplify/api-graphql 4.0.2 → 4.0.3-unstable.407b52e.0

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.
Files changed (52) hide show
  1. package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js +32 -12
  2. package/dist/cjs/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -1
  3. package/dist/cjs/internals/APIClient.js +17 -1
  4. package/dist/cjs/internals/APIClient.js.map +1 -1
  5. package/dist/cjs/internals/InternalGraphQLAPI.js +38 -16
  6. package/dist/cjs/internals/InternalGraphQLAPI.js.map +1 -1
  7. package/dist/cjs/internals/generateClient.js +1 -0
  8. package/dist/cjs/internals/generateClient.js.map +1 -1
  9. package/dist/cjs/internals/operations/get.js +3 -2
  10. package/dist/cjs/internals/operations/get.js.map +1 -1
  11. package/dist/cjs/internals/operations/list.js +3 -2
  12. package/dist/cjs/internals/operations/list.js.map +1 -1
  13. package/dist/cjs/internals/operations/subscription.js +2 -1
  14. package/dist/cjs/internals/operations/subscription.js.map +1 -1
  15. package/dist/cjs/types/index.js +2 -1
  16. package/dist/cjs/types/index.js.map +1 -1
  17. package/dist/esm/GraphQLAPI.d.ts +2 -3
  18. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +3 -3
  19. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs +32 -12
  20. package/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs.map +1 -1
  21. package/dist/esm/index.mjs +1 -1
  22. package/dist/esm/internals/APIClient.d.ts +9 -1
  23. package/dist/esm/internals/APIClient.mjs +17 -2
  24. package/dist/esm/internals/APIClient.mjs.map +1 -1
  25. package/dist/esm/internals/InternalGraphQLAPI.d.ts +2 -3
  26. package/dist/esm/internals/InternalGraphQLAPI.mjs +38 -16
  27. package/dist/esm/internals/InternalGraphQLAPI.mjs.map +1 -1
  28. package/dist/esm/internals/generateClient.mjs +2 -1
  29. package/dist/esm/internals/generateClient.mjs.map +1 -1
  30. package/dist/esm/internals/operations/get.mjs +4 -3
  31. package/dist/esm/internals/operations/get.mjs.map +1 -1
  32. package/dist/esm/internals/operations/list.mjs +4 -3
  33. package/dist/esm/internals/operations/list.mjs.map +1 -1
  34. package/dist/esm/internals/operations/subscription.mjs +3 -2
  35. package/dist/esm/internals/operations/subscription.mjs.map +1 -1
  36. package/dist/esm/internals/types.d.ts +2 -0
  37. package/dist/esm/internals/v6.d.ts +2 -3
  38. package/dist/esm/types/index.d.ts +9 -10
  39. package/dist/esm/types/index.mjs +2 -1
  40. package/dist/esm/types/index.mjs.map +1 -1
  41. package/package.json +6 -6
  42. package/src/GraphQLAPI.ts +2 -1
  43. package/src/Providers/AWSAppSyncRealTimeProvider/index.ts +39 -11
  44. package/src/internals/APIClient.ts +25 -0
  45. package/src/internals/InternalGraphQLAPI.ts +61 -21
  46. package/src/internals/generateClient.ts +8 -1
  47. package/src/internals/operations/get.ts +14 -6
  48. package/src/internals/operations/list.ts +13 -6
  49. package/src/internals/operations/subscription.ts +11 -5
  50. package/src/internals/types.ts +2 -0
  51. package/src/internals/v6.ts +2 -1
  52. package/src/types/index.ts +13 -13
@@ -2,6 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { AmplifyClassV6 } from '@aws-amplify/core';
4
4
  import { GraphQLAuthMode } from '@aws-amplify/core/internals/utils';
5
+ import { CustomHeaders } from '@aws-amplify/data-schema-types';
5
6
 
6
7
  /**
7
8
  * @private
@@ -18,4 +19,5 @@ export type ClientGenerationParams = {
18
19
  export type CommonPublicClientOptions = {
19
20
  authMode?: GraphQLAuthMode;
20
21
  authToken?: string;
22
+ headers?: CustomHeaders;
21
23
  };
@@ -7,6 +7,7 @@ import {
7
7
  GraphQLOptionsV6,
8
8
  GraphQLResponseV6,
9
9
  } from '../types';
10
+ import { CustomHeaders } from '@aws-amplify/data-schema-types';
10
11
 
11
12
  /**
12
13
  * Invokes graphql operations against a graphql service, providing correct input and
@@ -98,7 +99,7 @@ export function graphql<
98
99
  >(
99
100
  this: V6Client,
100
101
  options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
101
- additionalHeaders?: { [key: string]: string }
102
+ additionalHeaders?: CustomHeaders
102
103
  ): GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING> {
103
104
  /**
104
105
  * The correctness of these typings depends on correct string branding or overrides.
@@ -1,7 +1,7 @@
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 } from '@aws-amplify/data-schema-types';
4
+ import { ModelTypes, CustomHeaders } from '@aws-amplify/data-schema-types';
5
5
  import { Source, DocumentNode, GraphQLError } from 'graphql';
6
6
  export { OperationTypeNode } from 'graphql';
7
7
  import { Observable } from 'rxjs';
@@ -176,7 +176,7 @@ export interface AWSAppSyncRealTimeProviderOptions {
176
176
  apiKey?: string;
177
177
  region?: string;
178
178
  graphql_headers?: () => {} | (() => Promise<{}>);
179
- additionalHeaders?: { [key: string]: string };
179
+ additionalHeaders?: CustomHeaders;
180
180
  }
181
181
 
182
182
  export type AWSAppSyncRealTimeProvider = {
@@ -363,6 +363,7 @@ type ExcludeNeverFields<O> = {
363
363
  export const __amplify = Symbol('amplify');
364
364
  export const __authMode = Symbol('authMode');
365
365
  export const __authToken = Symbol('authToken');
366
+ export const __headers = Symbol('headers');
366
367
 
367
368
  export type ClientWithModels =
368
369
  | V6Client<Record<string, any>>
@@ -373,6 +374,7 @@ export type V6Client<T extends Record<any, any> = never> = ExcludeNeverFields<{
373
374
  [__amplify]: AmplifyClassV6;
374
375
  [__authMode]?: GraphQLAuthMode;
375
376
  [__authToken]?: string;
377
+ [__headers]?: CustomHeaders;
376
378
  graphql: GraphQLMethod;
377
379
  cancel: (promise: Promise<any>, message?: string) => boolean;
378
380
  isCancelError: (error: any) => boolean;
@@ -384,6 +386,7 @@ export type V6ClientSSRRequest<T extends Record<any, any> = never> =
384
386
  [__amplify]: AmplifyClassV6;
385
387
  [__authMode]?: GraphQLAuthMode;
386
388
  [__authToken]?: string;
389
+ [__headers]?: CustomHeaders;
387
390
  graphql: GraphQLMethodSSR;
388
391
  cancel: (promise: Promise<any>, message?: string) => boolean;
389
392
  isCancelError: (error: any) => boolean;
@@ -395,6 +398,7 @@ export type V6ClientSSRCookies<T extends Record<any, any> = never> =
395
398
  [__amplify]: AmplifyClassV6;
396
399
  [__authMode]?: GraphQLAuthMode;
397
400
  [__authToken]?: string;
401
+ [__headers]?: CustomHeaders;
398
402
  graphql: GraphQLMethod;
399
403
  cancel: (promise: Promise<any>, message?: string) => boolean;
400
404
  isCancelError: (error: any) => boolean;
@@ -406,11 +410,7 @@ export type GraphQLMethod = <
406
410
  TYPED_GQL_STRING extends string = string
407
411
  >(
408
412
  options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
409
- additionalHeaders?:
410
- | {
411
- [key: string]: string;
412
- }
413
- | undefined
413
+ additionalHeaders?: CustomHeaders | undefined
414
414
  ) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
415
415
 
416
416
  export type GraphQLMethodSSR = <
@@ -419,11 +419,7 @@ export type GraphQLMethodSSR = <
419
419
  >(
420
420
  contextSpec: AmplifyServer.ContextSpec,
421
421
  options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
422
- additionalHeaders?:
423
- | {
424
- [key: string]: string;
425
- }
426
- | undefined
422
+ additionalHeaders?: CustomHeaders | undefined
427
423
  ) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
428
424
 
429
425
  /**
@@ -442,7 +438,11 @@ export type ServerClientGenerationParams = {
442
438
 
443
439
  export type QueryArgs = Record<string, unknown>;
444
440
 
445
- export type ListArgs = { selectionSet?: string[]; filter?: {} };
441
+ export type ListArgs = {
442
+ selectionSet?: string[];
443
+ filter?: {};
444
+ headers?: CustomHeaders;
445
+ };
446
446
 
447
447
  export type AuthModeParams = {
448
448
  authMode?: GraphQLAuthMode;