@aws-amplify/api-graphql 4.0.1-console-preview.0bbe168.0 → 4.0.1-console-preview.deaebd5.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.
@@ -1,8 +1,7 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { PubSubContentObserver } from '../../types/PubSub';
3
3
  import { SUBSCRIPTION_STATUS } from '../constants';
4
- import { GraphQLAuthMode } from '@aws-amplify/core/lib-esm/singleton/API/types';
5
- import { CustomUserAgentDetails } from '@aws-amplify/core/internals/utils';
4
+ import { CustomUserAgentDetails, GraphQLAuthMode } from '@aws-amplify/core/internals/utils';
6
5
  import { DocumentType } from '@aws-amplify/api-rest';
7
6
  export declare type ObserverQuery = {
8
7
  observer: PubSubContentObserver;
@@ -59,7 +58,6 @@ export declare class AWSAppSyncRealTimeProvider {
59
58
  private _initializeRetryableHandshake;
60
59
  private _initializeHandshake;
61
60
  private _awsRealTimeHeaderBasedAuth;
62
- private _awsRealTimeCUPHeader;
63
61
  private _awsRealTimeOPENIDHeader;
64
62
  private _awsRealTimeApiKeyHeader;
65
63
  private _awsRealTimeIAMHeader;
@@ -85,7 +85,7 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function () {
85
85
  };
86
86
  AWSAppSyncRealTimeProvider.prototype.subscribe = function (options, customUserAgentDetails) {
87
87
  var _this = this;
88
- var appSyncGraphqlEndpoint = options.appSyncGraphqlEndpoint, region = options.region, query = options.query, variables = options.variables, authenticationType = options.authenticationType;
88
+ var _a = options || {}, appSyncGraphqlEndpoint = _a.appSyncGraphqlEndpoint, region = _a.region, query = _a.query, variables = _a.variables, authenticationType = _a.authenticationType, additionalHeaders = _a.additionalHeaders;
89
89
  return new rxjs_1.Observable(function (observer) {
90
90
  if (!options || !appSyncGraphqlEndpoint) {
91
91
  observer.error({
@@ -108,6 +108,7 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function () {
108
108
  region: region,
109
109
  authenticationType: authenticationType,
110
110
  appSyncGraphqlEndpoint: appSyncGraphqlEndpoint,
111
+ additionalHeaders: additionalHeaders,
111
112
  },
112
113
  observer: observer,
113
114
  subscriptionId: subscriptionId_1,
@@ -697,7 +698,7 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function () {
697
698
  case 1:
698
699
  handler = headerHandler[authenticationType.type];
699
700
  host = url.parse(appSyncGraphqlEndpoint !== null && appSyncGraphqlEndpoint !== void 0 ? appSyncGraphqlEndpoint : '').host;
700
- logger.debug("Authenticating with " + authenticationType);
701
+ logger.debug("Authenticating with " + JSON.stringify(authenticationType));
701
702
  apiKey = void 0;
702
703
  if (authenticationType.type === 'apiKey') {
703
704
  apiKey = authenticationType.apiKey;
@@ -718,34 +719,18 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function () {
718
719
  });
719
720
  });
720
721
  };
721
- AWSAppSyncRealTimeProvider.prototype._awsRealTimeCUPHeader = function (_a) {
722
- var host = _a.host;
723
- return tslib_1.__awaiter(this, void 0, void 0, function () {
724
- var session;
725
- return tslib_1.__generator(this, function (_b) {
726
- switch (_b.label) {
727
- case 0: return [4 /*yield*/, core_1.fetchAuthSession()];
728
- case 1:
729
- session = _b.sent();
730
- return [2 /*return*/, {
731
- Authorization: session.tokens.accessToken.toString(),
732
- host: host,
733
- }];
734
- }
735
- });
736
- });
737
- };
738
722
  AWSAppSyncRealTimeProvider.prototype._awsRealTimeOPENIDHeader = function (_a) {
739
723
  var host = _a.host;
724
+ var _b, _c;
740
725
  return tslib_1.__awaiter(this, void 0, void 0, function () {
741
726
  var session;
742
- return tslib_1.__generator(this, function (_b) {
743
- switch (_b.label) {
727
+ return tslib_1.__generator(this, function (_d) {
728
+ switch (_d.label) {
744
729
  case 0: return [4 /*yield*/, core_1.fetchAuthSession()];
745
730
  case 1:
746
- session = _b.sent();
731
+ session = _d.sent();
747
732
  return [2 /*return*/, {
748
- Authorization: session.tokens.accessToken.toString(),
733
+ Authorization: (_c = (_b = session === null || session === void 0 ? void 0 : session.tokens) === null || _b === void 0 ? void 0 : _b.accessToken) === null || _c === void 0 ? void 0 : _c.toString(),
749
734
  host: host,
750
735
  }];
751
736
  }
@@ -804,7 +789,7 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function () {
804
789
  };
805
790
  AWSAppSyncRealTimeProvider.prototype._customAuthHeader = function (_a) {
806
791
  var host = _a.host, additionalHeaders = _a.additionalHeaders;
807
- if (!additionalHeaders || !additionalHeaders['Authorization']) {
792
+ if (!(additionalHeaders === null || additionalHeaders === void 0 ? void 0 : additionalHeaders['Authorization'])) {
808
793
  throw new Error('No auth token specified');
809
794
  }
810
795
  return {
@@ -17,6 +17,7 @@ export declare class InternalGraphQLAPIClass {
17
17
  private _options;
18
18
  private appSyncRealTime;
19
19
  Cache: import("@aws-amplify/core/lib-esm/Cache/types").ICache;
20
+ private _api;
20
21
  /**
21
22
  * Initialize GraphQL API with AWS configuration
22
23
  * @param {Object} options - Configuration object for API
@@ -29,6 +29,7 @@ var InternalGraphQLAPIClass = /** @class */ (function () {
29
29
  */
30
30
  function InternalGraphQLAPIClass(options) {
31
31
  this.Cache = core_1.Cache;
32
+ this._api = { post: api_rest_1.post };
32
33
  this._options = options;
33
34
  logger.debug('API Options', this._options);
34
35
  }
@@ -198,7 +199,7 @@ var InternalGraphQLAPIClass = /** @class */ (function () {
198
199
  _j.label = 7;
199
200
  case 7:
200
201
  _j.trys.push([7, 9, , 10]);
201
- return [4 /*yield*/, api_rest_1.post(endpoint, {
202
+ return [4 /*yield*/, this._api.post(endpoint, {
202
203
  headers: headers,
203
204
  body: body,
204
205
  region: region,
@@ -641,9 +641,13 @@
641
641
  "version": "9b1f66012e58888f1bd2f5b8b749784d7d592ad7d5ac48972511e2e942161e96",
642
642
  "signature": "9b1f66012e58888f1bd2f5b8b749784d7d592ad7d5ac48972511e2e942161e96"
643
643
  },
644
+ "../../core/lib-esm/I18n/types.d.ts": {
645
+ "version": "5067e5e3fd2990550510443981e456d48c85dd04669b1ac98246fe7e1de8dd76",
646
+ "signature": "5067e5e3fd2990550510443981e456d48c85dd04669b1ac98246fe7e1de8dd76"
647
+ },
644
648
  "../../core/lib-esm/singleton/types.d.ts": {
645
- "version": "af16d87d2c348b5836e843c29a74040f82a9bf08cafb54207db1d2f41127b972",
646
- "signature": "af16d87d2c348b5836e843c29a74040f82a9bf08cafb54207db1d2f41127b972"
649
+ "version": "b3b302a35346f1630df8a21c463dd73a69d85ad8e58b836bcbca6b4ff46235ca",
650
+ "signature": "b3b302a35346f1630df8a21c463dd73a69d85ad8e58b836bcbca6b4ff46235ca"
647
651
  },
648
652
  "../../core/lib-esm/parseAWSExports.d.ts": {
649
653
  "version": "9c2b50924961e9da2c7ced6ea9b1119ff68297217345c6bfd74dc927beb07a78",
@@ -694,8 +698,8 @@
694
698
  "signature": "8c542877559cd6f411ab47e35a3acb905c0b220461153cf3d5da6ac865cd2245"
695
699
  },
696
700
  "../../../node_modules/@types/events/index.d.ts": {
697
- "version": "400db42c3a46984118bff14260d60cec580057dc1ab4c2d7310beb643e4f5935",
698
- "signature": "400db42c3a46984118bff14260d60cec580057dc1ab4c2d7310beb643e4f5935"
701
+ "version": "e5da7fdc42b400e8cf1121991f3c32efc0750ccd76024db6cad68e38e91a60a3",
702
+ "signature": "e5da7fdc42b400e8cf1121991f3c32efc0750ccd76024db6cad68e38e91a60a3"
699
703
  },
700
704
  "../../../node_modules/@types/node/inspector.d.ts": {
701
705
  "version": "7e49dbf1543b3ee54853ade4c5e9fa460b6a4eca967efe6bf943e0c505d087ed",
@@ -1126,8 +1130,8 @@
1126
1130
  "signature": "e02f9f6928bd974cc18803419ecc30e12dc39fb3c4383eaa897bf8d868135ef1"
1127
1131
  },
1128
1132
  "../../core/lib-esm/Hub/types/AuthTypes.d.ts": {
1129
- "version": "b8e5ba29dd7f2369f52d2b2ea829e168399e177879cae7fce6ad10e4f50975f3",
1130
- "signature": "b8e5ba29dd7f2369f52d2b2ea829e168399e177879cae7fce6ad10e4f50975f3"
1133
+ "version": "a04a1debf29ca7be5a11859eca422ede0355a7ffac49027843c21a1566aacc2a",
1134
+ "signature": "a04a1debf29ca7be5a11859eca422ede0355a7ffac49027843c21a1566aacc2a"
1131
1135
  },
1132
1136
  "../../core/lib-esm/Hub/types/HubTypes.d.ts": {
1133
1137
  "version": "9a23afdd036a23560984aeeec5dbdfc3ddd3e50bd8ca87929fca3d0a13292148",
@@ -1162,8 +1166,8 @@
1162
1166
  "signature": "92395e3e6898e201a167d96559042af069933f1a96662305bdc01fda3627bfbf"
1163
1167
  },
1164
1168
  "../../core/lib-esm/libraryUtils.d.ts": {
1165
- "version": "0f0269450c924ed45441071963c5bcb05c19b8cb4179e1e1af10ac6f3b82c53c",
1166
- "signature": "0f0269450c924ed45441071963c5bcb05c19b8cb4179e1e1af10ac6f3b82c53c"
1169
+ "version": "6c64a38ac2b21b0e6505c5de98394c334e6c3cde067e206ad8df44fb29474fd6",
1170
+ "signature": "6c64a38ac2b21b0e6505c5de98394c334e6c3cde067e206ad8df44fb29474fd6"
1167
1171
  },
1168
1172
  "../src/types/PubSub.ts": {
1169
1173
  "version": "70ac482472a54d226119a9a20fbb3f3baa04e9e305526ab90559626561206a64",
@@ -1361,13 +1365,9 @@
1361
1365
  "version": "a21e6b4bebe10b7e0ad199954dff9c5b9813e6552585fd5a944a691d5d0250ed",
1362
1366
  "signature": "a21e6b4bebe10b7e0ad199954dff9c5b9813e6552585fd5a944a691d5d0250ed"
1363
1367
  },
1364
- "../../core/lib-esm/I18n/types.d.ts": {
1365
- "version": "c7525ce0da03c467948253477743c85a19d4d80af168491ac93f171892b05361",
1366
- "signature": "c7525ce0da03c467948253477743c85a19d4d80af168491ac93f171892b05361"
1367
- },
1368
1368
  "../../core/lib-esm/I18n/index.d.ts": {
1369
- "version": "5750131d1fc5684bf3d6dd7e22f64526d3ca52d362676e26e85bf0a573b11c56",
1370
- "signature": "5750131d1fc5684bf3d6dd7e22f64526d3ca52d362676e26e85bf0a573b11c56"
1369
+ "version": "3cdc09269c30f50499132846639d826e03fb74007685505c5f0ce9691f627f75",
1370
+ "signature": "3cdc09269c30f50499132846639d826e03fb74007685505c5f0ce9691f627f75"
1371
1371
  },
1372
1372
  "../../core/lib-esm/index.d.ts": {
1373
1373
  "version": "961b863ef850a0b1d97c21a273560ee4434a313849b41f4dc9505804f9a6108c",
@@ -1394,12 +1394,12 @@
1394
1394
  "signature": "b0afc2803af9e818fad28464e4e62ee1b255d282f8f19ba8a2459b7bab4d789e"
1395
1395
  },
1396
1396
  "../src/Providers/AWSAppSyncRealTimeProvider/index.ts": {
1397
- "version": "bdf3278d057e57afeadef186e7e3c29eb13984bfef25d6103c529b34ab1e7233",
1398
- "signature": "1ca983fc0bd67090f0a821be987a560152b74428b00d1e32d6a1ba687a3036db"
1397
+ "version": "f8705479ea9a4e277dec482c8db14962f1ec78b281ddb806a265ac515e99906c",
1398
+ "signature": "06482fe555f7555e160c985b684718636c0ca7b00893c317e5b8058df388b490"
1399
1399
  },
1400
1400
  "../src/internals/InternalGraphQLAPI.ts": {
1401
- "version": "db89d8ef6882a3bf3877f5f1ab2a5dd1c0e4263c815260a362661c8dfec49cb7",
1402
- "signature": "4321d78cf978abcc5646ba30c694ba92707a891b79697f77ab7d451d0d14db7e"
1401
+ "version": "93686822478e203cb6dad02d8432b98f04fc7e3c875d3a9eb6059b31919b9720",
1402
+ "signature": "186c82c1cbd4eb233c4fde8e8f264511fbba3187e270c384c570343dee075ee4"
1403
1403
  },
1404
1404
  "../src/internals/v6.ts": {
1405
1405
  "version": "49f318f6c79f74c78ad69e2b9bc41d3c61503c0ddb0acbd59480de34ca229adf",
@@ -1435,7 +1435,7 @@
1435
1435
  },
1436
1436
  "../src/utils/resolveConfig.ts": {
1437
1437
  "version": "0fb2071d51a0132ad718f803dc493064d8f784be4d8e1a0b52a43404ea738c64",
1438
- "signature": "79c87fb1bbcb52ffc89fc563eaf1a55a0a345a7067ff2130c6a80372c029df2b"
1438
+ "signature": "d478965a8e7c9f4b505cc28b821b30f42bc71e21d70b14c354a13f8b89278b55"
1439
1439
  },
1440
1440
  "../src/utils/resolveCredentials.ts": {
1441
1441
  "version": "22c610d9879b27de3f79333284f54ce4f330b35e930837627cdfc0d276bf8a57",
@@ -2460,12 +2460,17 @@
2460
2460
  "../../../node_modules/@types/node/base.d.ts",
2461
2461
  "../../../node_modules/@types/node/index.d.ts"
2462
2462
  ],
2463
+ "../../core/lib-esm/I18n/types.d.ts": [
2464
+ "../../../node_modules/@types/node/base.d.ts",
2465
+ "../../../node_modules/@types/node/index.d.ts"
2466
+ ],
2463
2467
  "../../core/lib-esm/singleton/types.d.ts": [
2464
2468
  "../../core/lib-esm/singleton/API/types.d.ts",
2465
2469
  "../../core/lib-esm/singleton/Analytics/types.d.ts",
2466
2470
  "../../core/lib-esm/singleton/Auth/types.d.ts",
2467
2471
  "../../core/lib-esm/singleton/Geo/types.d.ts",
2468
2472
  "../../core/lib-esm/singleton/Storage/types.d.ts",
2473
+ "../../core/lib-esm/I18n/types.d.ts",
2469
2474
  "../../../node_modules/@types/node/base.d.ts",
2470
2475
  "../../../node_modules/@types/node/index.d.ts"
2471
2476
  ],
@@ -3510,10 +3515,6 @@
3510
3515
  "../../../node_modules/@types/node/base.d.ts",
3511
3516
  "../../../node_modules/@types/node/index.d.ts"
3512
3517
  ],
3513
- "../../core/lib-esm/I18n/types.d.ts": [
3514
- "../../../node_modules/@types/node/base.d.ts",
3515
- "../../../node_modules/@types/node/index.d.ts"
3516
- ],
3517
3518
  "../../core/lib-esm/I18n/index.d.ts": [
3518
3519
  "../../core/lib-esm/I18n/types.d.ts",
3519
3520
  "../../../node_modules/@types/node/base.d.ts",
@@ -3569,7 +3570,6 @@
3569
3570
  "../src/Providers/constants.ts",
3570
3571
  "../src/utils/ConnectionStateMonitor.ts",
3571
3572
  "../src/utils/ReconnectionMonitor.ts",
3572
- "../../core/lib-esm/singleton/API/types.d.ts",
3573
3573
  "../../core/lib-esm/libraryUtils.d.ts",
3574
3574
  "../../api-rest/lib-esm/index.d.ts",
3575
3575
  "../../../node_modules/@types/node/index.d.ts"
@@ -3851,7 +3851,6 @@
3851
3851
  "../src/types/PubSub.ts",
3852
3852
  "../../api-rest/lib-esm/index.d.ts",
3853
3853
  "../src/Providers/constants.ts",
3854
- "../../core/lib-esm/singleton/API/types.d.ts",
3855
3854
  "../../core/lib-esm/libraryUtils.d.ts"
3856
3855
  ],
3857
3856
  "../src/types/index.ts": [
@@ -4612,7 +4611,7 @@
4612
4611
  "../src/utils/resolveCredentials.ts"
4613
4612
  ],
4614
4613
  "../src/utils/resolveConfig.ts": [
4615
- "../../core/lib-esm/singleton/API/types.d.ts"
4614
+ "../../core/lib-esm/libraryUtils.d.ts"
4616
4615
  ],
4617
4616
  "../src/utils/errors/assertValidationError.ts": [
4618
4617
  "../src/utils/errors/validation.ts"
@@ -4758,6 +4757,7 @@
4758
4757
  "../../core/lib-esm/singleton/Auth/types.d.ts",
4759
4758
  "../../core/lib-esm/singleton/Geo/types.d.ts",
4760
4759
  "../../core/lib-esm/singleton/Storage/types.d.ts",
4760
+ "../../core/lib-esm/I18n/types.d.ts",
4761
4761
  "../../../node_modules/@types/node/base.d.ts",
4762
4762
  "../../../node_modules/@types/node/index.d.ts"
4763
4763
  ],
@@ -4860,6 +4860,15 @@
4860
4860
  "../../../node_modules/@types/node/base.d.ts",
4861
4861
  "../../../node_modules/@types/node/index.d.ts"
4862
4862
  ],
4863
+ "../../core/lib-esm/I18n/types.d.ts": [
4864
+ "../../../node_modules/@types/node/base.d.ts",
4865
+ "../../../node_modules/@types/node/index.d.ts"
4866
+ ],
4867
+ "../../core/lib-esm/I18n/index.d.ts": [
4868
+ "../../core/lib-esm/I18n/types.d.ts",
4869
+ "../../../node_modules/@types/node/base.d.ts",
4870
+ "../../../node_modules/@types/node/index.d.ts"
4871
+ ],
4863
4872
  "../../core/lib-esm/Signer/Signer.d.ts": [
4864
4873
  "../../../node_modules/@types/node/base.d.ts",
4865
4874
  "../../../node_modules/@types/node/index.d.ts"
@@ -5475,15 +5484,6 @@
5475
5484
  "../../../node_modules/@types/node/base.d.ts",
5476
5485
  "../../../node_modules/@types/node/index.d.ts"
5477
5486
  ],
5478
- "../../core/lib-esm/I18n/index.d.ts": [
5479
- "../../core/lib-esm/I18n/types.d.ts",
5480
- "../../../node_modules/@types/node/base.d.ts",
5481
- "../../../node_modules/@types/node/index.d.ts"
5482
- ],
5483
- "../../core/lib-esm/I18n/types.d.ts": [
5484
- "../../../node_modules/@types/node/base.d.ts",
5485
- "../../../node_modules/@types/node/index.d.ts"
5486
- ],
5487
5487
  "../../core/lib-esm/Cache/InMemoryCache.d.ts": [
5488
5488
  "../../core/lib-esm/Cache/StorageCache.d.ts",
5489
5489
  "../../core/lib-esm/Cache/types/index.d.ts",
@@ -5912,6 +5912,7 @@
5912
5912
  "../../core/lib-esm/singleton/Analytics/types.d.ts",
5913
5913
  "../../core/lib-esm/singleton/Geo/types.d.ts",
5914
5914
  "../../core/lib-esm/singleton/Storage/types.d.ts",
5915
+ "../../core/lib-esm/I18n/types.d.ts",
5915
5916
  "../../core/lib-esm/singleton/types.d.ts",
5916
5917
  "../../core/lib-esm/parseAWSExports.d.ts",
5917
5918
  "../../core/lib-esm/singleton/Auth/utils/index.d.ts",
@@ -6092,7 +6093,6 @@
6092
6093
  "../../core/lib-esm/Cache/StorageCache.d.ts",
6093
6094
  "../../core/lib-esm/Cache/BrowserStorageCache.d.ts",
6094
6095
  "../../core/lib-esm/Cache/InMemoryCache.d.ts",
6095
- "../../core/lib-esm/I18n/types.d.ts",
6096
6096
  "../../core/lib-esm/I18n/index.d.ts",
6097
6097
  "../../core/lib-esm/index.d.ts",
6098
6098
  "../../../node_modules/@types/uuid/index.d.ts",
@@ -4,5 +4,5 @@
4
4
  export declare const resolveConfig: () => {
5
5
  endpoint: string;
6
6
  region: string;
7
- defaultAuthMode: import("@aws-amplify/core/lib-esm/singleton/API/types").GraphQLAuthMode;
7
+ defaultAuthMode: import("@aws-amplify/core/lib-esm/libraryUtils").GraphQLAuthMode;
8
8
  };
@@ -1,8 +1,7 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { PubSubContentObserver } from '../../types/PubSub';
3
3
  import { SUBSCRIPTION_STATUS } from '../constants';
4
- import { GraphQLAuthMode } from '@aws-amplify/core/lib-esm/singleton/API/types';
5
- import { CustomUserAgentDetails } from '@aws-amplify/core/internals/utils';
4
+ import { CustomUserAgentDetails, GraphQLAuthMode } from '@aws-amplify/core/internals/utils';
6
5
  import { DocumentType } from '@aws-amplify/api-rest';
7
6
  export declare type ObserverQuery = {
8
7
  observer: PubSubContentObserver;
@@ -59,7 +58,6 @@ export declare class AWSAppSyncRealTimeProvider {
59
58
  private _initializeRetryableHandshake;
60
59
  private _initializeHandshake;
61
60
  private _awsRealTimeHeaderBasedAuth;
62
- private _awsRealTimeCUPHeader;
63
61
  private _awsRealTimeOPENIDHeader;
64
62
  private _awsRealTimeApiKeyHeader;
65
63
  private _awsRealTimeIAMHeader;
@@ -83,7 +83,7 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function () {
83
83
  };
84
84
  AWSAppSyncRealTimeProvider.prototype.subscribe = function (options, customUserAgentDetails) {
85
85
  var _this = this;
86
- var appSyncGraphqlEndpoint = options.appSyncGraphqlEndpoint, region = options.region, query = options.query, variables = options.variables, authenticationType = options.authenticationType;
86
+ var _a = options || {}, appSyncGraphqlEndpoint = _a.appSyncGraphqlEndpoint, region = _a.region, query = _a.query, variables = _a.variables, authenticationType = _a.authenticationType, additionalHeaders = _a.additionalHeaders;
87
87
  return new Observable(function (observer) {
88
88
  if (!options || !appSyncGraphqlEndpoint) {
89
89
  observer.error({
@@ -106,6 +106,7 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function () {
106
106
  region: region,
107
107
  authenticationType: authenticationType,
108
108
  appSyncGraphqlEndpoint: appSyncGraphqlEndpoint,
109
+ additionalHeaders: additionalHeaders,
109
110
  },
110
111
  observer: observer,
111
112
  subscriptionId: subscriptionId_1,
@@ -695,7 +696,7 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function () {
695
696
  case 1:
696
697
  handler = headerHandler[authenticationType.type];
697
698
  host = url.parse(appSyncGraphqlEndpoint !== null && appSyncGraphqlEndpoint !== void 0 ? appSyncGraphqlEndpoint : '').host;
698
- logger.debug("Authenticating with " + authenticationType);
699
+ logger.debug("Authenticating with " + JSON.stringify(authenticationType));
699
700
  apiKey = void 0;
700
701
  if (authenticationType.type === 'apiKey') {
701
702
  apiKey = authenticationType.apiKey;
@@ -716,34 +717,18 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function () {
716
717
  });
717
718
  });
718
719
  };
719
- AWSAppSyncRealTimeProvider.prototype._awsRealTimeCUPHeader = function (_a) {
720
- var host = _a.host;
721
- return __awaiter(this, void 0, void 0, function () {
722
- var session;
723
- return __generator(this, function (_b) {
724
- switch (_b.label) {
725
- case 0: return [4 /*yield*/, fetchAuthSession()];
726
- case 1:
727
- session = _b.sent();
728
- return [2 /*return*/, {
729
- Authorization: session.tokens.accessToken.toString(),
730
- host: host,
731
- }];
732
- }
733
- });
734
- });
735
- };
736
720
  AWSAppSyncRealTimeProvider.prototype._awsRealTimeOPENIDHeader = function (_a) {
737
721
  var host = _a.host;
722
+ var _b, _c;
738
723
  return __awaiter(this, void 0, void 0, function () {
739
724
  var session;
740
- return __generator(this, function (_b) {
741
- switch (_b.label) {
725
+ return __generator(this, function (_d) {
726
+ switch (_d.label) {
742
727
  case 0: return [4 /*yield*/, fetchAuthSession()];
743
728
  case 1:
744
- session = _b.sent();
729
+ session = _d.sent();
745
730
  return [2 /*return*/, {
746
- Authorization: session.tokens.accessToken.toString(),
731
+ Authorization: (_c = (_b = session === null || session === void 0 ? void 0 : session.tokens) === null || _b === void 0 ? void 0 : _b.accessToken) === null || _c === void 0 ? void 0 : _c.toString(),
747
732
  host: host,
748
733
  }];
749
734
  }
@@ -802,7 +787,7 @@ var AWSAppSyncRealTimeProvider = /** @class */ (function () {
802
787
  };
803
788
  AWSAppSyncRealTimeProvider.prototype._customAuthHeader = function (_a) {
804
789
  var host = _a.host, additionalHeaders = _a.additionalHeaders;
805
- if (!additionalHeaders || !additionalHeaders['Authorization']) {
790
+ if (!(additionalHeaders === null || additionalHeaders === void 0 ? void 0 : additionalHeaders['Authorization'])) {
806
791
  throw new Error('No auth token specified');
807
792
  }
808
793
  return {
@@ -17,6 +17,7 @@ export declare class InternalGraphQLAPIClass {
17
17
  private _options;
18
18
  private appSyncRealTime;
19
19
  Cache: import("@aws-amplify/core/lib-esm/Cache/types").ICache;
20
+ private _api;
20
21
  /**
21
22
  * Initialize GraphQL API with AWS configuration
22
23
  * @param {Object} options - Configuration object for API
@@ -27,6 +27,7 @@ var InternalGraphQLAPIClass = /** @class */ (function () {
27
27
  */
28
28
  function InternalGraphQLAPIClass(options) {
29
29
  this.Cache = Cache;
30
+ this._api = { post: post };
30
31
  this._options = options;
31
32
  logger.debug('API Options', this._options);
32
33
  }
@@ -196,7 +197,7 @@ var InternalGraphQLAPIClass = /** @class */ (function () {
196
197
  _j.label = 7;
197
198
  case 7:
198
199
  _j.trys.push([7, 9, , 10]);
199
- return [4 /*yield*/, post(endpoint, {
200
+ return [4 /*yield*/, this._api.post(endpoint, {
200
201
  headers: headers,
201
202
  body: body,
202
203
  region: region,
@@ -641,9 +641,13 @@
641
641
  "version": "9b1f66012e58888f1bd2f5b8b749784d7d592ad7d5ac48972511e2e942161e96",
642
642
  "signature": "9b1f66012e58888f1bd2f5b8b749784d7d592ad7d5ac48972511e2e942161e96"
643
643
  },
644
+ "../../core/lib-esm/I18n/types.d.ts": {
645
+ "version": "5067e5e3fd2990550510443981e456d48c85dd04669b1ac98246fe7e1de8dd76",
646
+ "signature": "5067e5e3fd2990550510443981e456d48c85dd04669b1ac98246fe7e1de8dd76"
647
+ },
644
648
  "../../core/lib-esm/singleton/types.d.ts": {
645
- "version": "af16d87d2c348b5836e843c29a74040f82a9bf08cafb54207db1d2f41127b972",
646
- "signature": "af16d87d2c348b5836e843c29a74040f82a9bf08cafb54207db1d2f41127b972"
649
+ "version": "b3b302a35346f1630df8a21c463dd73a69d85ad8e58b836bcbca6b4ff46235ca",
650
+ "signature": "b3b302a35346f1630df8a21c463dd73a69d85ad8e58b836bcbca6b4ff46235ca"
647
651
  },
648
652
  "../../core/lib-esm/parseAWSExports.d.ts": {
649
653
  "version": "9c2b50924961e9da2c7ced6ea9b1119ff68297217345c6bfd74dc927beb07a78",
@@ -694,8 +698,8 @@
694
698
  "signature": "8c542877559cd6f411ab47e35a3acb905c0b220461153cf3d5da6ac865cd2245"
695
699
  },
696
700
  "../../../node_modules/@types/events/index.d.ts": {
697
- "version": "400db42c3a46984118bff14260d60cec580057dc1ab4c2d7310beb643e4f5935",
698
- "signature": "400db42c3a46984118bff14260d60cec580057dc1ab4c2d7310beb643e4f5935"
701
+ "version": "e5da7fdc42b400e8cf1121991f3c32efc0750ccd76024db6cad68e38e91a60a3",
702
+ "signature": "e5da7fdc42b400e8cf1121991f3c32efc0750ccd76024db6cad68e38e91a60a3"
699
703
  },
700
704
  "../../../node_modules/@types/node/inspector.d.ts": {
701
705
  "version": "7e49dbf1543b3ee54853ade4c5e9fa460b6a4eca967efe6bf943e0c505d087ed",
@@ -1126,8 +1130,8 @@
1126
1130
  "signature": "e02f9f6928bd974cc18803419ecc30e12dc39fb3c4383eaa897bf8d868135ef1"
1127
1131
  },
1128
1132
  "../../core/lib-esm/Hub/types/AuthTypes.d.ts": {
1129
- "version": "b8e5ba29dd7f2369f52d2b2ea829e168399e177879cae7fce6ad10e4f50975f3",
1130
- "signature": "b8e5ba29dd7f2369f52d2b2ea829e168399e177879cae7fce6ad10e4f50975f3"
1133
+ "version": "a04a1debf29ca7be5a11859eca422ede0355a7ffac49027843c21a1566aacc2a",
1134
+ "signature": "a04a1debf29ca7be5a11859eca422ede0355a7ffac49027843c21a1566aacc2a"
1131
1135
  },
1132
1136
  "../../core/lib-esm/Hub/types/HubTypes.d.ts": {
1133
1137
  "version": "9a23afdd036a23560984aeeec5dbdfc3ddd3e50bd8ca87929fca3d0a13292148",
@@ -1162,8 +1166,8 @@
1162
1166
  "signature": "92395e3e6898e201a167d96559042af069933f1a96662305bdc01fda3627bfbf"
1163
1167
  },
1164
1168
  "../../core/lib-esm/libraryUtils.d.ts": {
1165
- "version": "0f0269450c924ed45441071963c5bcb05c19b8cb4179e1e1af10ac6f3b82c53c",
1166
- "signature": "0f0269450c924ed45441071963c5bcb05c19b8cb4179e1e1af10ac6f3b82c53c"
1169
+ "version": "6c64a38ac2b21b0e6505c5de98394c334e6c3cde067e206ad8df44fb29474fd6",
1170
+ "signature": "6c64a38ac2b21b0e6505c5de98394c334e6c3cde067e206ad8df44fb29474fd6"
1167
1171
  },
1168
1172
  "../src/types/PubSub.ts": {
1169
1173
  "version": "70ac482472a54d226119a9a20fbb3f3baa04e9e305526ab90559626561206a64",
@@ -1361,13 +1365,9 @@
1361
1365
  "version": "a21e6b4bebe10b7e0ad199954dff9c5b9813e6552585fd5a944a691d5d0250ed",
1362
1366
  "signature": "a21e6b4bebe10b7e0ad199954dff9c5b9813e6552585fd5a944a691d5d0250ed"
1363
1367
  },
1364
- "../../core/lib-esm/I18n/types.d.ts": {
1365
- "version": "c7525ce0da03c467948253477743c85a19d4d80af168491ac93f171892b05361",
1366
- "signature": "c7525ce0da03c467948253477743c85a19d4d80af168491ac93f171892b05361"
1367
- },
1368
1368
  "../../core/lib-esm/I18n/index.d.ts": {
1369
- "version": "5750131d1fc5684bf3d6dd7e22f64526d3ca52d362676e26e85bf0a573b11c56",
1370
- "signature": "5750131d1fc5684bf3d6dd7e22f64526d3ca52d362676e26e85bf0a573b11c56"
1369
+ "version": "3cdc09269c30f50499132846639d826e03fb74007685505c5f0ce9691f627f75",
1370
+ "signature": "3cdc09269c30f50499132846639d826e03fb74007685505c5f0ce9691f627f75"
1371
1371
  },
1372
1372
  "../../core/lib-esm/index.d.ts": {
1373
1373
  "version": "961b863ef850a0b1d97c21a273560ee4434a313849b41f4dc9505804f9a6108c",
@@ -1394,12 +1394,12 @@
1394
1394
  "signature": "b0afc2803af9e818fad28464e4e62ee1b255d282f8f19ba8a2459b7bab4d789e"
1395
1395
  },
1396
1396
  "../src/Providers/AWSAppSyncRealTimeProvider/index.ts": {
1397
- "version": "bdf3278d057e57afeadef186e7e3c29eb13984bfef25d6103c529b34ab1e7233",
1398
- "signature": "1ca983fc0bd67090f0a821be987a560152b74428b00d1e32d6a1ba687a3036db"
1397
+ "version": "f8705479ea9a4e277dec482c8db14962f1ec78b281ddb806a265ac515e99906c",
1398
+ "signature": "06482fe555f7555e160c985b684718636c0ca7b00893c317e5b8058df388b490"
1399
1399
  },
1400
1400
  "../src/internals/InternalGraphQLAPI.ts": {
1401
- "version": "db89d8ef6882a3bf3877f5f1ab2a5dd1c0e4263c815260a362661c8dfec49cb7",
1402
- "signature": "4321d78cf978abcc5646ba30c694ba92707a891b79697f77ab7d451d0d14db7e"
1401
+ "version": "93686822478e203cb6dad02d8432b98f04fc7e3c875d3a9eb6059b31919b9720",
1402
+ "signature": "186c82c1cbd4eb233c4fde8e8f264511fbba3187e270c384c570343dee075ee4"
1403
1403
  },
1404
1404
  "../src/internals/v6.ts": {
1405
1405
  "version": "49f318f6c79f74c78ad69e2b9bc41d3c61503c0ddb0acbd59480de34ca229adf",
@@ -1435,7 +1435,7 @@
1435
1435
  },
1436
1436
  "../src/utils/resolveConfig.ts": {
1437
1437
  "version": "0fb2071d51a0132ad718f803dc493064d8f784be4d8e1a0b52a43404ea738c64",
1438
- "signature": "79c87fb1bbcb52ffc89fc563eaf1a55a0a345a7067ff2130c6a80372c029df2b"
1438
+ "signature": "d478965a8e7c9f4b505cc28b821b30f42bc71e21d70b14c354a13f8b89278b55"
1439
1439
  },
1440
1440
  "../src/utils/resolveCredentials.ts": {
1441
1441
  "version": "22c610d9879b27de3f79333284f54ce4f330b35e930837627cdfc0d276bf8a57",
@@ -2460,12 +2460,17 @@
2460
2460
  "../../../node_modules/@types/node/base.d.ts",
2461
2461
  "../../../node_modules/@types/node/index.d.ts"
2462
2462
  ],
2463
+ "../../core/lib-esm/I18n/types.d.ts": [
2464
+ "../../../node_modules/@types/node/base.d.ts",
2465
+ "../../../node_modules/@types/node/index.d.ts"
2466
+ ],
2463
2467
  "../../core/lib-esm/singleton/types.d.ts": [
2464
2468
  "../../core/lib-esm/singleton/API/types.d.ts",
2465
2469
  "../../core/lib-esm/singleton/Analytics/types.d.ts",
2466
2470
  "../../core/lib-esm/singleton/Auth/types.d.ts",
2467
2471
  "../../core/lib-esm/singleton/Geo/types.d.ts",
2468
2472
  "../../core/lib-esm/singleton/Storage/types.d.ts",
2473
+ "../../core/lib-esm/I18n/types.d.ts",
2469
2474
  "../../../node_modules/@types/node/base.d.ts",
2470
2475
  "../../../node_modules/@types/node/index.d.ts"
2471
2476
  ],
@@ -3510,10 +3515,6 @@
3510
3515
  "../../../node_modules/@types/node/base.d.ts",
3511
3516
  "../../../node_modules/@types/node/index.d.ts"
3512
3517
  ],
3513
- "../../core/lib-esm/I18n/types.d.ts": [
3514
- "../../../node_modules/@types/node/base.d.ts",
3515
- "../../../node_modules/@types/node/index.d.ts"
3516
- ],
3517
3518
  "../../core/lib-esm/I18n/index.d.ts": [
3518
3519
  "../../core/lib-esm/I18n/types.d.ts",
3519
3520
  "../../../node_modules/@types/node/base.d.ts",
@@ -3569,7 +3570,6 @@
3569
3570
  "../src/Providers/constants.ts",
3570
3571
  "../src/utils/ConnectionStateMonitor.ts",
3571
3572
  "../src/utils/ReconnectionMonitor.ts",
3572
- "../../core/lib-esm/singleton/API/types.d.ts",
3573
3573
  "../../core/lib-esm/libraryUtils.d.ts",
3574
3574
  "../../api-rest/lib-esm/index.d.ts",
3575
3575
  "../../../node_modules/@types/node/index.d.ts"
@@ -3851,7 +3851,6 @@
3851
3851
  "../src/types/PubSub.ts",
3852
3852
  "../../api-rest/lib-esm/index.d.ts",
3853
3853
  "../src/Providers/constants.ts",
3854
- "../../core/lib-esm/singleton/API/types.d.ts",
3855
3854
  "../../core/lib-esm/libraryUtils.d.ts"
3856
3855
  ],
3857
3856
  "../src/types/index.ts": [
@@ -4612,7 +4611,7 @@
4612
4611
  "../src/utils/resolveCredentials.ts"
4613
4612
  ],
4614
4613
  "../src/utils/resolveConfig.ts": [
4615
- "../../core/lib-esm/singleton/API/types.d.ts"
4614
+ "../../core/lib-esm/libraryUtils.d.ts"
4616
4615
  ],
4617
4616
  "../src/utils/errors/assertValidationError.ts": [
4618
4617
  "../src/utils/errors/validation.ts"
@@ -4758,6 +4757,7 @@
4758
4757
  "../../core/lib-esm/singleton/Auth/types.d.ts",
4759
4758
  "../../core/lib-esm/singleton/Geo/types.d.ts",
4760
4759
  "../../core/lib-esm/singleton/Storage/types.d.ts",
4760
+ "../../core/lib-esm/I18n/types.d.ts",
4761
4761
  "../../../node_modules/@types/node/base.d.ts",
4762
4762
  "../../../node_modules/@types/node/index.d.ts"
4763
4763
  ],
@@ -4860,6 +4860,15 @@
4860
4860
  "../../../node_modules/@types/node/base.d.ts",
4861
4861
  "../../../node_modules/@types/node/index.d.ts"
4862
4862
  ],
4863
+ "../../core/lib-esm/I18n/types.d.ts": [
4864
+ "../../../node_modules/@types/node/base.d.ts",
4865
+ "../../../node_modules/@types/node/index.d.ts"
4866
+ ],
4867
+ "../../core/lib-esm/I18n/index.d.ts": [
4868
+ "../../core/lib-esm/I18n/types.d.ts",
4869
+ "../../../node_modules/@types/node/base.d.ts",
4870
+ "../../../node_modules/@types/node/index.d.ts"
4871
+ ],
4863
4872
  "../../core/lib-esm/Signer/Signer.d.ts": [
4864
4873
  "../../../node_modules/@types/node/base.d.ts",
4865
4874
  "../../../node_modules/@types/node/index.d.ts"
@@ -5475,15 +5484,6 @@
5475
5484
  "../../../node_modules/@types/node/base.d.ts",
5476
5485
  "../../../node_modules/@types/node/index.d.ts"
5477
5486
  ],
5478
- "../../core/lib-esm/I18n/index.d.ts": [
5479
- "../../core/lib-esm/I18n/types.d.ts",
5480
- "../../../node_modules/@types/node/base.d.ts",
5481
- "../../../node_modules/@types/node/index.d.ts"
5482
- ],
5483
- "../../core/lib-esm/I18n/types.d.ts": [
5484
- "../../../node_modules/@types/node/base.d.ts",
5485
- "../../../node_modules/@types/node/index.d.ts"
5486
- ],
5487
5487
  "../../core/lib-esm/Cache/InMemoryCache.d.ts": [
5488
5488
  "../../core/lib-esm/Cache/StorageCache.d.ts",
5489
5489
  "../../core/lib-esm/Cache/types/index.d.ts",
@@ -5912,6 +5912,7 @@
5912
5912
  "../../core/lib-esm/singleton/Analytics/types.d.ts",
5913
5913
  "../../core/lib-esm/singleton/Geo/types.d.ts",
5914
5914
  "../../core/lib-esm/singleton/Storage/types.d.ts",
5915
+ "../../core/lib-esm/I18n/types.d.ts",
5915
5916
  "../../core/lib-esm/singleton/types.d.ts",
5916
5917
  "../../core/lib-esm/parseAWSExports.d.ts",
5917
5918
  "../../core/lib-esm/singleton/Auth/utils/index.d.ts",
@@ -6092,7 +6093,6 @@
6092
6093
  "../../core/lib-esm/Cache/StorageCache.d.ts",
6093
6094
  "../../core/lib-esm/Cache/BrowserStorageCache.d.ts",
6094
6095
  "../../core/lib-esm/Cache/InMemoryCache.d.ts",
6095
- "../../core/lib-esm/I18n/types.d.ts",
6096
6096
  "../../core/lib-esm/I18n/index.d.ts",
6097
6097
  "../../core/lib-esm/index.d.ts",
6098
6098
  "../../../node_modules/@types/uuid/index.d.ts",
@@ -4,5 +4,5 @@
4
4
  export declare const resolveConfig: () => {
5
5
  endpoint: string;
6
6
  region: string;
7
- defaultAuthMode: import("@aws-amplify/core/lib-esm/singleton/API/types").GraphQLAuthMode;
7
+ defaultAuthMode: import("@aws-amplify/core/lib-esm/libraryUtils").GraphQLAuthMode;
8
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/api-graphql",
3
- "version": "4.0.1-console-preview.0bbe168.0+0bbe168",
3
+ "version": "4.0.1-console-preview.deaebd5.0+deaebd5",
4
4
  "description": "Api-graphql category of aws-amplify",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib-esm/index.js",
@@ -47,9 +47,9 @@
47
47
  "internals"
48
48
  ],
49
49
  "dependencies": {
50
- "@aws-amplify/api-rest": "4.0.1-console-preview.0bbe168.0+0bbe168",
51
- "@aws-amplify/auth": "6.0.1-console-preview.0bbe168.0+0bbe168",
52
- "@aws-amplify/core": "6.0.1-console-preview.0bbe168.0+0bbe168",
50
+ "@aws-amplify/api-rest": "4.0.1-console-preview.deaebd5.0+deaebd5",
51
+ "@aws-amplify/auth": "6.0.1-console-preview.deaebd5.0+deaebd5",
52
+ "@aws-amplify/core": "6.0.1-console-preview.deaebd5.0+deaebd5",
53
53
  "@aws-sdk/types": "3.387.0",
54
54
  "graphql": "15.8.0",
55
55
  "rxjs": "^7.8.1",
@@ -67,7 +67,9 @@
67
67
  "jest": {
68
68
  "globals": {
69
69
  "ts-jest": {
70
- "diagnostics": false,
70
+ "diagnostics": {
71
+ "pathRegex": "(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$"
72
+ },
71
73
  "tsConfig": {
72
74
  "lib": [
73
75
  "es5",
@@ -77,7 +79,10 @@
77
79
  "es2017.object"
78
80
  ],
79
81
  "allowJs": true,
80
- "noEmitOnError": false
82
+ "noEmitOnError": false,
83
+ "types": [
84
+ "@types/jest"
85
+ ]
81
86
  }
82
87
  }
83
88
  },
@@ -85,6 +90,11 @@
85
90
  "^.+\\.(js|jsx|ts|tsx)$": "ts-jest"
86
91
  },
87
92
  "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$",
93
+ "testPathIgnorePatterns": [
94
+ "<rootDir>/__tests__/helpers.ts",
95
+ "<rootDir>/__tests__/fixtures/",
96
+ "<rootDir>/__tests__/utils/"
97
+ ],
88
98
  "moduleFileExtensions": [
89
99
  "ts",
90
100
  "tsx",
@@ -103,11 +113,12 @@
103
113
  }
104
114
  },
105
115
  "coveragePathIgnorePatterns": [
106
- "/node_modules/",
107
- "dist",
108
- "lib",
109
- "lib-esm"
116
+ "<rootDir>/node_modules/",
117
+ "<rootDir>/dist",
118
+ "<rootDir>/lib",
119
+ "<rootDir>/lib-esm",
120
+ "<rootDir>/__tests__"
110
121
  ]
111
122
  },
112
- "gitHead": "0bbe168c66929877174b331c71f7666bb16529d6"
123
+ "gitHead": "deaebd5a938733ff2b25aaec39c042843ef2289c"
113
124
  }
@@ -38,7 +38,6 @@ import {
38
38
  ReconnectEvent,
39
39
  ReconnectionMonitor,
40
40
  } from '../../utils/ReconnectionMonitor';
41
- import { GraphQLAuthMode } from '@aws-amplify/core/lib-esm/singleton/API/types';
42
41
 
43
42
  import {
44
43
  CustomUserAgentDetails,
@@ -48,6 +47,7 @@ import {
48
47
  getAmplifyUserAgent,
49
48
  isNonRetryableError,
50
49
  jitteredExponentialRetry,
50
+ GraphQLAuthMode,
51
51
  } from '@aws-amplify/core/internals/utils';
52
52
  import { DocumentType } from '@aws-amplify/api-rest';
53
53
 
@@ -196,7 +196,8 @@ export class AWSAppSyncRealTimeProvider {
196
196
  query,
197
197
  variables,
198
198
  authenticationType,
199
- } = options;
199
+ additionalHeaders,
200
+ } = options || {};
200
201
 
201
202
  return new Observable(observer => {
202
203
  if (!options || !appSyncGraphqlEndpoint) {
@@ -225,6 +226,7 @@ export class AWSAppSyncRealTimeProvider {
225
226
  region,
226
227
  authenticationType,
227
228
  appSyncGraphqlEndpoint,
229
+ additionalHeaders,
228
230
  },
229
231
  observer,
230
232
  subscriptionId,
@@ -294,7 +296,7 @@ export class AWSAppSyncRealTimeProvider {
294
296
  options: AWSAppSyncRealTimeProviderOptions;
295
297
  observer: PubSubContentObserver;
296
298
  subscriptionId: string;
297
- customUserAgentDetails: CustomUserAgentDetails;
299
+ customUserAgentDetails: CustomUserAgentDetails | undefined;
298
300
  }) {
299
301
  const {
300
302
  appSyncGraphqlEndpoint,
@@ -899,7 +901,7 @@ export class AWSAppSyncRealTimeProvider {
899
901
 
900
902
  const { host } = url.parse(appSyncGraphqlEndpoint ?? '');
901
903
 
902
- logger.debug(`Authenticating with ${authenticationType}`);
904
+ logger.debug(`Authenticating with ${JSON.stringify(authenticationType)}`);
903
905
  let apiKey;
904
906
  if (authenticationType.type === 'apiKey') {
905
907
  apiKey = authenticationType.apiKey;
@@ -918,21 +920,13 @@ export class AWSAppSyncRealTimeProvider {
918
920
  }
919
921
  }
920
922
 
921
- private async _awsRealTimeCUPHeader({ host }: AWSAppSyncRealTimeAuthInput) {
922
- const session = await fetchAuthSession();
923
- return {
924
- Authorization: session.tokens.accessToken.toString(),
925
- host,
926
- };
927
- }
928
-
929
923
  private async _awsRealTimeOPENIDHeader({
930
924
  host,
931
925
  }: AWSAppSyncRealTimeAuthInput) {
932
926
  const session = await fetchAuthSession();
933
927
 
934
928
  return {
935
- Authorization: session.tokens.accessToken.toString(),
929
+ Authorization: session?.tokens?.accessToken?.toString(),
936
930
  host,
937
931
  };
938
932
  }
@@ -991,7 +985,7 @@ export class AWSAppSyncRealTimeProvider {
991
985
  host,
992
986
  additionalHeaders,
993
987
  }: AWSAppSyncRealTimeAuthInput) {
994
- if (!additionalHeaders || !additionalHeaders['Authorization']) {
988
+ if (!additionalHeaders?.['Authorization']) {
995
989
  throw new Error('No auth token specified');
996
990
  }
997
991
 
@@ -49,6 +49,7 @@ export class InternalGraphQLAPIClass {
49
49
  private appSyncRealTime: AWSAppSyncRealTimeProvider | null;
50
50
 
51
51
  Cache = Cache;
52
+ private _api = { post };
52
53
 
53
54
  /**
54
55
  * Initialize GraphQL API with AWS configuration
@@ -241,7 +242,7 @@ export class InternalGraphQLAPIClass {
241
242
 
242
243
  let response;
243
244
  try {
244
- response = await post(endpoint, {
245
+ response = await this._api.post(endpoint, {
245
246
  headers,
246
247
  body,
247
248
  region,