@aws-amplify/api-graphql 4.0.1-console-preview.4b7d177.0 → 4.0.1-console-preview.11cf989.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.
- package/lib/Providers/AWSAppSyncRealTimeProvider/index.d.ts +1 -3
- package/lib/Providers/AWSAppSyncRealTimeProvider/index.js +9 -24
- package/lib/internals/InternalGraphQLAPI.d.ts +1 -0
- package/lib/internals/InternalGraphQLAPI.js +2 -1
- package/lib/tsconfig.tsbuildinfo +47 -17
- package/lib/utils/resolveConfig.d.ts +1 -1
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +1 -3
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js +9 -24
- package/lib-esm/internals/InternalGraphQLAPI.d.ts +1 -0
- package/lib-esm/internals/InternalGraphQLAPI.js +2 -1
- package/lib-esm/tsconfig.tsbuildinfo +47 -17
- package/lib-esm/utils/resolveConfig.d.ts +1 -1
- package/package.json +22 -11
- package/src/Providers/AWSAppSyncRealTimeProvider/index.ts +8 -14
- package/src/internals/InternalGraphQLAPI.ts +2 -1
|
@@ -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/
|
|
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 =
|
|
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 (
|
|
743
|
-
switch (
|
|
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 =
|
|
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 ||
|
|
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*/,
|
|
202
|
+
return [4 /*yield*/, this._api.post(endpoint, {
|
|
202
203
|
headers: headers,
|
|
203
204
|
body: body,
|
|
204
205
|
region: region,
|
package/lib/tsconfig.tsbuildinfo
CHANGED
|
@@ -645,9 +645,17 @@
|
|
|
645
645
|
"version": "5067e5e3fd2990550510443981e456d48c85dd04669b1ac98246fe7e1de8dd76",
|
|
646
646
|
"signature": "5067e5e3fd2990550510443981e456d48c85dd04669b1ac98246fe7e1de8dd76"
|
|
647
647
|
},
|
|
648
|
+
"../../core/lib-esm/singleton/Notifications/InAppMessaging/types.d.ts": {
|
|
649
|
+
"version": "ee9f33d464c617286d9d10d95ae291234dc1a312668adedbf01d5bf781fa0d48",
|
|
650
|
+
"signature": "ee9f33d464c617286d9d10d95ae291234dc1a312668adedbf01d5bf781fa0d48"
|
|
651
|
+
},
|
|
652
|
+
"../../core/lib-esm/singleton/Notifications/types.d.ts": {
|
|
653
|
+
"version": "bd1d2ac08bda9d5008be61a478895d69e2c4681ee35ef5c5707e3a1cc33986a9",
|
|
654
|
+
"signature": "bd1d2ac08bda9d5008be61a478895d69e2c4681ee35ef5c5707e3a1cc33986a9"
|
|
655
|
+
},
|
|
648
656
|
"../../core/lib-esm/singleton/types.d.ts": {
|
|
649
|
-
"version": "
|
|
650
|
-
"signature": "
|
|
657
|
+
"version": "0e365945a1b317a939f3adede4fb611a3cade9892bf7ebf9cd6ea6f0e1f1617e",
|
|
658
|
+
"signature": "0e365945a1b317a939f3adede4fb611a3cade9892bf7ebf9cd6ea6f0e1f1617e"
|
|
651
659
|
},
|
|
652
660
|
"../../core/lib-esm/parseAWSExports.d.ts": {
|
|
653
661
|
"version": "9c2b50924961e9da2c7ced6ea9b1119ff68297217345c6bfd74dc927beb07a78",
|
|
@@ -1130,8 +1138,8 @@
|
|
|
1130
1138
|
"signature": "e02f9f6928bd974cc18803419ecc30e12dc39fb3c4383eaa897bf8d868135ef1"
|
|
1131
1139
|
},
|
|
1132
1140
|
"../../core/lib-esm/Hub/types/AuthTypes.d.ts": {
|
|
1133
|
-
"version": "
|
|
1134
|
-
"signature": "
|
|
1141
|
+
"version": "a04a1debf29ca7be5a11859eca422ede0355a7ffac49027843c21a1566aacc2a",
|
|
1142
|
+
"signature": "a04a1debf29ca7be5a11859eca422ede0355a7ffac49027843c21a1566aacc2a"
|
|
1135
1143
|
},
|
|
1136
1144
|
"../../core/lib-esm/Hub/types/HubTypes.d.ts": {
|
|
1137
1145
|
"version": "9a23afdd036a23560984aeeec5dbdfc3ddd3e50bd8ca87929fca3d0a13292148",
|
|
@@ -1166,8 +1174,8 @@
|
|
|
1166
1174
|
"signature": "92395e3e6898e201a167d96559042af069933f1a96662305bdc01fda3627bfbf"
|
|
1167
1175
|
},
|
|
1168
1176
|
"../../core/lib-esm/libraryUtils.d.ts": {
|
|
1169
|
-
"version": "
|
|
1170
|
-
"signature": "
|
|
1177
|
+
"version": "6c64a38ac2b21b0e6505c5de98394c334e6c3cde067e206ad8df44fb29474fd6",
|
|
1178
|
+
"signature": "6c64a38ac2b21b0e6505c5de98394c334e6c3cde067e206ad8df44fb29474fd6"
|
|
1171
1179
|
},
|
|
1172
1180
|
"../src/types/PubSub.ts": {
|
|
1173
1181
|
"version": "70ac482472a54d226119a9a20fbb3f3baa04e9e305526ab90559626561206a64",
|
|
@@ -1366,8 +1374,8 @@
|
|
|
1366
1374
|
"signature": "a21e6b4bebe10b7e0ad199954dff9c5b9813e6552585fd5a944a691d5d0250ed"
|
|
1367
1375
|
},
|
|
1368
1376
|
"../../core/lib-esm/I18n/index.d.ts": {
|
|
1369
|
-
"version": "
|
|
1370
|
-
"signature": "
|
|
1377
|
+
"version": "3cdc09269c30f50499132846639d826e03fb74007685505c5f0ce9691f627f75",
|
|
1378
|
+
"signature": "3cdc09269c30f50499132846639d826e03fb74007685505c5f0ce9691f627f75"
|
|
1371
1379
|
},
|
|
1372
1380
|
"../../core/lib-esm/index.d.ts": {
|
|
1373
1381
|
"version": "961b863ef850a0b1d97c21a273560ee4434a313849b41f4dc9505804f9a6108c",
|
|
@@ -1394,12 +1402,12 @@
|
|
|
1394
1402
|
"signature": "b0afc2803af9e818fad28464e4e62ee1b255d282f8f19ba8a2459b7bab4d789e"
|
|
1395
1403
|
},
|
|
1396
1404
|
"../src/Providers/AWSAppSyncRealTimeProvider/index.ts": {
|
|
1397
|
-
"version": "
|
|
1398
|
-
"signature": "
|
|
1405
|
+
"version": "f8705479ea9a4e277dec482c8db14962f1ec78b281ddb806a265ac515e99906c",
|
|
1406
|
+
"signature": "06482fe555f7555e160c985b684718636c0ca7b00893c317e5b8058df388b490"
|
|
1399
1407
|
},
|
|
1400
1408
|
"../src/internals/InternalGraphQLAPI.ts": {
|
|
1401
|
-
"version": "
|
|
1402
|
-
"signature": "
|
|
1409
|
+
"version": "93686822478e203cb6dad02d8432b98f04fc7e3c875d3a9eb6059b31919b9720",
|
|
1410
|
+
"signature": "186c82c1cbd4eb233c4fde8e8f264511fbba3187e270c384c570343dee075ee4"
|
|
1403
1411
|
},
|
|
1404
1412
|
"../src/internals/v6.ts": {
|
|
1405
1413
|
"version": "49f318f6c79f74c78ad69e2b9bc41d3c61503c0ddb0acbd59480de34ca229adf",
|
|
@@ -1435,7 +1443,7 @@
|
|
|
1435
1443
|
},
|
|
1436
1444
|
"../src/utils/resolveConfig.ts": {
|
|
1437
1445
|
"version": "0fb2071d51a0132ad718f803dc493064d8f784be4d8e1a0b52a43404ea738c64",
|
|
1438
|
-
"signature": "
|
|
1446
|
+
"signature": "d478965a8e7c9f4b505cc28b821b30f42bc71e21d70b14c354a13f8b89278b55"
|
|
1439
1447
|
},
|
|
1440
1448
|
"../src/utils/resolveCredentials.ts": {
|
|
1441
1449
|
"version": "22c610d9879b27de3f79333284f54ce4f330b35e930837627cdfc0d276bf8a57",
|
|
@@ -2464,6 +2472,16 @@
|
|
|
2464
2472
|
"../../../node_modules/@types/node/base.d.ts",
|
|
2465
2473
|
"../../../node_modules/@types/node/index.d.ts"
|
|
2466
2474
|
],
|
|
2475
|
+
"../../core/lib-esm/singleton/Notifications/InAppMessaging/types.d.ts": [
|
|
2476
|
+
"../../core/lib-esm/providers/pinpoint/types/index.d.ts",
|
|
2477
|
+
"../../../node_modules/@types/node/base.d.ts",
|
|
2478
|
+
"../../../node_modules/@types/node/index.d.ts"
|
|
2479
|
+
],
|
|
2480
|
+
"../../core/lib-esm/singleton/Notifications/types.d.ts": [
|
|
2481
|
+
"../../core/lib-esm/singleton/Notifications/InAppMessaging/types.d.ts",
|
|
2482
|
+
"../../../node_modules/@types/node/base.d.ts",
|
|
2483
|
+
"../../../node_modules/@types/node/index.d.ts"
|
|
2484
|
+
],
|
|
2467
2485
|
"../../core/lib-esm/singleton/types.d.ts": [
|
|
2468
2486
|
"../../core/lib-esm/singleton/API/types.d.ts",
|
|
2469
2487
|
"../../core/lib-esm/singleton/Analytics/types.d.ts",
|
|
@@ -2471,6 +2489,7 @@
|
|
|
2471
2489
|
"../../core/lib-esm/singleton/Geo/types.d.ts",
|
|
2472
2490
|
"../../core/lib-esm/singleton/Storage/types.d.ts",
|
|
2473
2491
|
"../../core/lib-esm/I18n/types.d.ts",
|
|
2492
|
+
"../../core/lib-esm/singleton/Notifications/types.d.ts",
|
|
2474
2493
|
"../../../node_modules/@types/node/base.d.ts",
|
|
2475
2494
|
"../../../node_modules/@types/node/index.d.ts"
|
|
2476
2495
|
],
|
|
@@ -3570,7 +3589,6 @@
|
|
|
3570
3589
|
"../src/Providers/constants.ts",
|
|
3571
3590
|
"../src/utils/ConnectionStateMonitor.ts",
|
|
3572
3591
|
"../src/utils/ReconnectionMonitor.ts",
|
|
3573
|
-
"../../core/lib-esm/singleton/API/types.d.ts",
|
|
3574
3592
|
"../../core/lib-esm/libraryUtils.d.ts",
|
|
3575
3593
|
"../../api-rest/lib-esm/index.d.ts",
|
|
3576
3594
|
"../../../node_modules/@types/node/index.d.ts"
|
|
@@ -3852,7 +3870,6 @@
|
|
|
3852
3870
|
"../src/types/PubSub.ts",
|
|
3853
3871
|
"../../api-rest/lib-esm/index.d.ts",
|
|
3854
3872
|
"../src/Providers/constants.ts",
|
|
3855
|
-
"../../core/lib-esm/singleton/API/types.d.ts",
|
|
3856
3873
|
"../../core/lib-esm/libraryUtils.d.ts"
|
|
3857
3874
|
],
|
|
3858
3875
|
"../src/types/index.ts": [
|
|
@@ -4613,7 +4630,7 @@
|
|
|
4613
4630
|
"../src/utils/resolveCredentials.ts"
|
|
4614
4631
|
],
|
|
4615
4632
|
"../src/utils/resolveConfig.ts": [
|
|
4616
|
-
"../../core/lib-esm/
|
|
4633
|
+
"../../core/lib-esm/libraryUtils.d.ts"
|
|
4617
4634
|
],
|
|
4618
4635
|
"../src/utils/errors/assertValidationError.ts": [
|
|
4619
4636
|
"../src/utils/errors/validation.ts"
|
|
@@ -4748,11 +4765,16 @@
|
|
|
4748
4765
|
"../../../node_modules/@types/node/base.d.ts",
|
|
4749
4766
|
"../../../node_modules/@types/node/index.d.ts"
|
|
4750
4767
|
],
|
|
4751
|
-
"../../core/lib-esm/singleton/
|
|
4768
|
+
"../../core/lib-esm/singleton/Notifications/InAppMessaging/types.d.ts": [
|
|
4752
4769
|
"../../core/lib-esm/providers/pinpoint/types/index.d.ts",
|
|
4753
4770
|
"../../../node_modules/@types/node/base.d.ts",
|
|
4754
4771
|
"../../../node_modules/@types/node/index.d.ts"
|
|
4755
4772
|
],
|
|
4773
|
+
"../../core/lib-esm/singleton/Notifications/types.d.ts": [
|
|
4774
|
+
"../../core/lib-esm/singleton/Notifications/InAppMessaging/types.d.ts",
|
|
4775
|
+
"../../../node_modules/@types/node/base.d.ts",
|
|
4776
|
+
"../../../node_modules/@types/node/index.d.ts"
|
|
4777
|
+
],
|
|
4756
4778
|
"../../core/lib-esm/singleton/types.d.ts": [
|
|
4757
4779
|
"../../core/lib-esm/singleton/API/types.d.ts",
|
|
4758
4780
|
"../../core/lib-esm/singleton/Analytics/types.d.ts",
|
|
@@ -4760,6 +4782,7 @@
|
|
|
4760
4782
|
"../../core/lib-esm/singleton/Geo/types.d.ts",
|
|
4761
4783
|
"../../core/lib-esm/singleton/Storage/types.d.ts",
|
|
4762
4784
|
"../../core/lib-esm/I18n/types.d.ts",
|
|
4785
|
+
"../../core/lib-esm/singleton/Notifications/types.d.ts",
|
|
4763
4786
|
"../../../node_modules/@types/node/base.d.ts",
|
|
4764
4787
|
"../../../node_modules/@types/node/index.d.ts"
|
|
4765
4788
|
],
|
|
@@ -4787,6 +4810,11 @@
|
|
|
4787
4810
|
"../../../node_modules/@types/node/base.d.ts",
|
|
4788
4811
|
"../../../node_modules/@types/node/index.d.ts"
|
|
4789
4812
|
],
|
|
4813
|
+
"../../core/lib-esm/singleton/Analytics/types.d.ts": [
|
|
4814
|
+
"../../core/lib-esm/providers/pinpoint/types/index.d.ts",
|
|
4815
|
+
"../../../node_modules/@types/node/base.d.ts",
|
|
4816
|
+
"../../../node_modules/@types/node/index.d.ts"
|
|
4817
|
+
],
|
|
4790
4818
|
"../../core/lib-esm/utils/retry/retry.d.ts": [
|
|
4791
4819
|
"../../core/lib-esm/types/index.d.ts",
|
|
4792
4820
|
"../../../node_modules/@types/node/base.d.ts",
|
|
@@ -5915,6 +5943,8 @@
|
|
|
5915
5943
|
"../../core/lib-esm/singleton/Geo/types.d.ts",
|
|
5916
5944
|
"../../core/lib-esm/singleton/Storage/types.d.ts",
|
|
5917
5945
|
"../../core/lib-esm/I18n/types.d.ts",
|
|
5946
|
+
"../../core/lib-esm/singleton/Notifications/InAppMessaging/types.d.ts",
|
|
5947
|
+
"../../core/lib-esm/singleton/Notifications/types.d.ts",
|
|
5918
5948
|
"../../core/lib-esm/singleton/types.d.ts",
|
|
5919
5949
|
"../../core/lib-esm/parseAWSExports.d.ts",
|
|
5920
5950
|
"../../core/lib-esm/singleton/Auth/utils/index.d.ts",
|
|
@@ -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/
|
|
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 =
|
|
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 (
|
|
741
|
-
switch (
|
|
725
|
+
return __generator(this, function (_d) {
|
|
726
|
+
switch (_d.label) {
|
|
742
727
|
case 0: return [4 /*yield*/, fetchAuthSession()];
|
|
743
728
|
case 1:
|
|
744
|
-
session =
|
|
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 ||
|
|
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,
|
|
@@ -645,9 +645,17 @@
|
|
|
645
645
|
"version": "5067e5e3fd2990550510443981e456d48c85dd04669b1ac98246fe7e1de8dd76",
|
|
646
646
|
"signature": "5067e5e3fd2990550510443981e456d48c85dd04669b1ac98246fe7e1de8dd76"
|
|
647
647
|
},
|
|
648
|
+
"../../core/lib-esm/singleton/Notifications/InAppMessaging/types.d.ts": {
|
|
649
|
+
"version": "ee9f33d464c617286d9d10d95ae291234dc1a312668adedbf01d5bf781fa0d48",
|
|
650
|
+
"signature": "ee9f33d464c617286d9d10d95ae291234dc1a312668adedbf01d5bf781fa0d48"
|
|
651
|
+
},
|
|
652
|
+
"../../core/lib-esm/singleton/Notifications/types.d.ts": {
|
|
653
|
+
"version": "bd1d2ac08bda9d5008be61a478895d69e2c4681ee35ef5c5707e3a1cc33986a9",
|
|
654
|
+
"signature": "bd1d2ac08bda9d5008be61a478895d69e2c4681ee35ef5c5707e3a1cc33986a9"
|
|
655
|
+
},
|
|
648
656
|
"../../core/lib-esm/singleton/types.d.ts": {
|
|
649
|
-
"version": "
|
|
650
|
-
"signature": "
|
|
657
|
+
"version": "0e365945a1b317a939f3adede4fb611a3cade9892bf7ebf9cd6ea6f0e1f1617e",
|
|
658
|
+
"signature": "0e365945a1b317a939f3adede4fb611a3cade9892bf7ebf9cd6ea6f0e1f1617e"
|
|
651
659
|
},
|
|
652
660
|
"../../core/lib-esm/parseAWSExports.d.ts": {
|
|
653
661
|
"version": "9c2b50924961e9da2c7ced6ea9b1119ff68297217345c6bfd74dc927beb07a78",
|
|
@@ -1130,8 +1138,8 @@
|
|
|
1130
1138
|
"signature": "e02f9f6928bd974cc18803419ecc30e12dc39fb3c4383eaa897bf8d868135ef1"
|
|
1131
1139
|
},
|
|
1132
1140
|
"../../core/lib-esm/Hub/types/AuthTypes.d.ts": {
|
|
1133
|
-
"version": "
|
|
1134
|
-
"signature": "
|
|
1141
|
+
"version": "a04a1debf29ca7be5a11859eca422ede0355a7ffac49027843c21a1566aacc2a",
|
|
1142
|
+
"signature": "a04a1debf29ca7be5a11859eca422ede0355a7ffac49027843c21a1566aacc2a"
|
|
1135
1143
|
},
|
|
1136
1144
|
"../../core/lib-esm/Hub/types/HubTypes.d.ts": {
|
|
1137
1145
|
"version": "9a23afdd036a23560984aeeec5dbdfc3ddd3e50bd8ca87929fca3d0a13292148",
|
|
@@ -1166,8 +1174,8 @@
|
|
|
1166
1174
|
"signature": "92395e3e6898e201a167d96559042af069933f1a96662305bdc01fda3627bfbf"
|
|
1167
1175
|
},
|
|
1168
1176
|
"../../core/lib-esm/libraryUtils.d.ts": {
|
|
1169
|
-
"version": "
|
|
1170
|
-
"signature": "
|
|
1177
|
+
"version": "6c64a38ac2b21b0e6505c5de98394c334e6c3cde067e206ad8df44fb29474fd6",
|
|
1178
|
+
"signature": "6c64a38ac2b21b0e6505c5de98394c334e6c3cde067e206ad8df44fb29474fd6"
|
|
1171
1179
|
},
|
|
1172
1180
|
"../src/types/PubSub.ts": {
|
|
1173
1181
|
"version": "70ac482472a54d226119a9a20fbb3f3baa04e9e305526ab90559626561206a64",
|
|
@@ -1366,8 +1374,8 @@
|
|
|
1366
1374
|
"signature": "a21e6b4bebe10b7e0ad199954dff9c5b9813e6552585fd5a944a691d5d0250ed"
|
|
1367
1375
|
},
|
|
1368
1376
|
"../../core/lib-esm/I18n/index.d.ts": {
|
|
1369
|
-
"version": "
|
|
1370
|
-
"signature": "
|
|
1377
|
+
"version": "3cdc09269c30f50499132846639d826e03fb74007685505c5f0ce9691f627f75",
|
|
1378
|
+
"signature": "3cdc09269c30f50499132846639d826e03fb74007685505c5f0ce9691f627f75"
|
|
1371
1379
|
},
|
|
1372
1380
|
"../../core/lib-esm/index.d.ts": {
|
|
1373
1381
|
"version": "961b863ef850a0b1d97c21a273560ee4434a313849b41f4dc9505804f9a6108c",
|
|
@@ -1394,12 +1402,12 @@
|
|
|
1394
1402
|
"signature": "b0afc2803af9e818fad28464e4e62ee1b255d282f8f19ba8a2459b7bab4d789e"
|
|
1395
1403
|
},
|
|
1396
1404
|
"../src/Providers/AWSAppSyncRealTimeProvider/index.ts": {
|
|
1397
|
-
"version": "
|
|
1398
|
-
"signature": "
|
|
1405
|
+
"version": "f8705479ea9a4e277dec482c8db14962f1ec78b281ddb806a265ac515e99906c",
|
|
1406
|
+
"signature": "06482fe555f7555e160c985b684718636c0ca7b00893c317e5b8058df388b490"
|
|
1399
1407
|
},
|
|
1400
1408
|
"../src/internals/InternalGraphQLAPI.ts": {
|
|
1401
|
-
"version": "
|
|
1402
|
-
"signature": "
|
|
1409
|
+
"version": "93686822478e203cb6dad02d8432b98f04fc7e3c875d3a9eb6059b31919b9720",
|
|
1410
|
+
"signature": "186c82c1cbd4eb233c4fde8e8f264511fbba3187e270c384c570343dee075ee4"
|
|
1403
1411
|
},
|
|
1404
1412
|
"../src/internals/v6.ts": {
|
|
1405
1413
|
"version": "49f318f6c79f74c78ad69e2b9bc41d3c61503c0ddb0acbd59480de34ca229adf",
|
|
@@ -1435,7 +1443,7 @@
|
|
|
1435
1443
|
},
|
|
1436
1444
|
"../src/utils/resolveConfig.ts": {
|
|
1437
1445
|
"version": "0fb2071d51a0132ad718f803dc493064d8f784be4d8e1a0b52a43404ea738c64",
|
|
1438
|
-
"signature": "
|
|
1446
|
+
"signature": "d478965a8e7c9f4b505cc28b821b30f42bc71e21d70b14c354a13f8b89278b55"
|
|
1439
1447
|
},
|
|
1440
1448
|
"../src/utils/resolveCredentials.ts": {
|
|
1441
1449
|
"version": "22c610d9879b27de3f79333284f54ce4f330b35e930837627cdfc0d276bf8a57",
|
|
@@ -2464,6 +2472,16 @@
|
|
|
2464
2472
|
"../../../node_modules/@types/node/base.d.ts",
|
|
2465
2473
|
"../../../node_modules/@types/node/index.d.ts"
|
|
2466
2474
|
],
|
|
2475
|
+
"../../core/lib-esm/singleton/Notifications/InAppMessaging/types.d.ts": [
|
|
2476
|
+
"../../core/lib-esm/providers/pinpoint/types/index.d.ts",
|
|
2477
|
+
"../../../node_modules/@types/node/base.d.ts",
|
|
2478
|
+
"../../../node_modules/@types/node/index.d.ts"
|
|
2479
|
+
],
|
|
2480
|
+
"../../core/lib-esm/singleton/Notifications/types.d.ts": [
|
|
2481
|
+
"../../core/lib-esm/singleton/Notifications/InAppMessaging/types.d.ts",
|
|
2482
|
+
"../../../node_modules/@types/node/base.d.ts",
|
|
2483
|
+
"../../../node_modules/@types/node/index.d.ts"
|
|
2484
|
+
],
|
|
2467
2485
|
"../../core/lib-esm/singleton/types.d.ts": [
|
|
2468
2486
|
"../../core/lib-esm/singleton/API/types.d.ts",
|
|
2469
2487
|
"../../core/lib-esm/singleton/Analytics/types.d.ts",
|
|
@@ -2471,6 +2489,7 @@
|
|
|
2471
2489
|
"../../core/lib-esm/singleton/Geo/types.d.ts",
|
|
2472
2490
|
"../../core/lib-esm/singleton/Storage/types.d.ts",
|
|
2473
2491
|
"../../core/lib-esm/I18n/types.d.ts",
|
|
2492
|
+
"../../core/lib-esm/singleton/Notifications/types.d.ts",
|
|
2474
2493
|
"../../../node_modules/@types/node/base.d.ts",
|
|
2475
2494
|
"../../../node_modules/@types/node/index.d.ts"
|
|
2476
2495
|
],
|
|
@@ -3570,7 +3589,6 @@
|
|
|
3570
3589
|
"../src/Providers/constants.ts",
|
|
3571
3590
|
"../src/utils/ConnectionStateMonitor.ts",
|
|
3572
3591
|
"../src/utils/ReconnectionMonitor.ts",
|
|
3573
|
-
"../../core/lib-esm/singleton/API/types.d.ts",
|
|
3574
3592
|
"../../core/lib-esm/libraryUtils.d.ts",
|
|
3575
3593
|
"../../api-rest/lib-esm/index.d.ts",
|
|
3576
3594
|
"../../../node_modules/@types/node/index.d.ts"
|
|
@@ -3852,7 +3870,6 @@
|
|
|
3852
3870
|
"../src/types/PubSub.ts",
|
|
3853
3871
|
"../../api-rest/lib-esm/index.d.ts",
|
|
3854
3872
|
"../src/Providers/constants.ts",
|
|
3855
|
-
"../../core/lib-esm/singleton/API/types.d.ts",
|
|
3856
3873
|
"../../core/lib-esm/libraryUtils.d.ts"
|
|
3857
3874
|
],
|
|
3858
3875
|
"../src/types/index.ts": [
|
|
@@ -4613,7 +4630,7 @@
|
|
|
4613
4630
|
"../src/utils/resolveCredentials.ts"
|
|
4614
4631
|
],
|
|
4615
4632
|
"../src/utils/resolveConfig.ts": [
|
|
4616
|
-
"../../core/lib-esm/
|
|
4633
|
+
"../../core/lib-esm/libraryUtils.d.ts"
|
|
4617
4634
|
],
|
|
4618
4635
|
"../src/utils/errors/assertValidationError.ts": [
|
|
4619
4636
|
"../src/utils/errors/validation.ts"
|
|
@@ -4748,11 +4765,16 @@
|
|
|
4748
4765
|
"../../../node_modules/@types/node/base.d.ts",
|
|
4749
4766
|
"../../../node_modules/@types/node/index.d.ts"
|
|
4750
4767
|
],
|
|
4751
|
-
"../../core/lib-esm/singleton/
|
|
4768
|
+
"../../core/lib-esm/singleton/Notifications/InAppMessaging/types.d.ts": [
|
|
4752
4769
|
"../../core/lib-esm/providers/pinpoint/types/index.d.ts",
|
|
4753
4770
|
"../../../node_modules/@types/node/base.d.ts",
|
|
4754
4771
|
"../../../node_modules/@types/node/index.d.ts"
|
|
4755
4772
|
],
|
|
4773
|
+
"../../core/lib-esm/singleton/Notifications/types.d.ts": [
|
|
4774
|
+
"../../core/lib-esm/singleton/Notifications/InAppMessaging/types.d.ts",
|
|
4775
|
+
"../../../node_modules/@types/node/base.d.ts",
|
|
4776
|
+
"../../../node_modules/@types/node/index.d.ts"
|
|
4777
|
+
],
|
|
4756
4778
|
"../../core/lib-esm/singleton/types.d.ts": [
|
|
4757
4779
|
"../../core/lib-esm/singleton/API/types.d.ts",
|
|
4758
4780
|
"../../core/lib-esm/singleton/Analytics/types.d.ts",
|
|
@@ -4760,6 +4782,7 @@
|
|
|
4760
4782
|
"../../core/lib-esm/singleton/Geo/types.d.ts",
|
|
4761
4783
|
"../../core/lib-esm/singleton/Storage/types.d.ts",
|
|
4762
4784
|
"../../core/lib-esm/I18n/types.d.ts",
|
|
4785
|
+
"../../core/lib-esm/singleton/Notifications/types.d.ts",
|
|
4763
4786
|
"../../../node_modules/@types/node/base.d.ts",
|
|
4764
4787
|
"../../../node_modules/@types/node/index.d.ts"
|
|
4765
4788
|
],
|
|
@@ -4787,6 +4810,11 @@
|
|
|
4787
4810
|
"../../../node_modules/@types/node/base.d.ts",
|
|
4788
4811
|
"../../../node_modules/@types/node/index.d.ts"
|
|
4789
4812
|
],
|
|
4813
|
+
"../../core/lib-esm/singleton/Analytics/types.d.ts": [
|
|
4814
|
+
"../../core/lib-esm/providers/pinpoint/types/index.d.ts",
|
|
4815
|
+
"../../../node_modules/@types/node/base.d.ts",
|
|
4816
|
+
"../../../node_modules/@types/node/index.d.ts"
|
|
4817
|
+
],
|
|
4790
4818
|
"../../core/lib-esm/utils/retry/retry.d.ts": [
|
|
4791
4819
|
"../../core/lib-esm/types/index.d.ts",
|
|
4792
4820
|
"../../../node_modules/@types/node/base.d.ts",
|
|
@@ -5915,6 +5943,8 @@
|
|
|
5915
5943
|
"../../core/lib-esm/singleton/Geo/types.d.ts",
|
|
5916
5944
|
"../../core/lib-esm/singleton/Storage/types.d.ts",
|
|
5917
5945
|
"../../core/lib-esm/I18n/types.d.ts",
|
|
5946
|
+
"../../core/lib-esm/singleton/Notifications/InAppMessaging/types.d.ts",
|
|
5947
|
+
"../../core/lib-esm/singleton/Notifications/types.d.ts",
|
|
5918
5948
|
"../../core/lib-esm/singleton/types.d.ts",
|
|
5919
5949
|
"../../core/lib-esm/parseAWSExports.d.ts",
|
|
5920
5950
|
"../../core/lib-esm/singleton/Auth/utils/index.d.ts",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/api-graphql",
|
|
3
|
-
"version": "4.0.1-console-preview.
|
|
3
|
+
"version": "4.0.1-console-preview.11cf989.0+11cf989",
|
|
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.
|
|
51
|
-
"@aws-amplify/auth": "6.0.1-console-preview.
|
|
52
|
-
"@aws-amplify/core": "6.0.1-console-preview.
|
|
50
|
+
"@aws-amplify/api-rest": "4.0.1-console-preview.11cf989.0+11cf989",
|
|
51
|
+
"@aws-amplify/auth": "6.0.1-console-preview.11cf989.0+11cf989",
|
|
52
|
+
"@aws-amplify/core": "6.0.1-console-preview.11cf989.0+11cf989",
|
|
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":
|
|
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
|
-
"
|
|
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": "
|
|
123
|
+
"gitHead": "11cf9890e0229d7f36a7b2375e57bc0decf9935a"
|
|
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
|
-
|
|
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
|
|
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
|
|
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,
|