@aws-amplify/pubsub 4.1.15 → 4.2.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/CHANGELOG.md +16 -0
- package/dist/aws-amplify-pubsub.js +19 -4
- package/dist/aws-amplify-pubsub.js.map +1 -1
- package/dist/aws-amplify-pubsub.min.js +2 -2
- package/dist/aws-amplify-pubsub.min.js.map +1 -1
- package/lib/Providers/AWSAppSyncRealTimeProvider.d.ts +1 -0
- package/lib/Providers/AWSAppSyncRealTimeProvider.js +19 -8
- package/lib/Providers/AWSAppSyncRealTimeProvider.js.map +1 -1
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider.d.ts +1 -0
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider.js +19 -8
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider.js.map +1 -1
- package/package.json +5 -5
- package/src/Providers/AWSAppSyncRealTimeProvider.ts +28 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.2.0](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/pubsub@4.1.15...@aws-amplify/pubsub@4.2.0) (2021-11-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* AWSAppSyncRealTimeProvider websocket init fix ([#9200](https://github.com/aws-amplify/amplify-js/issues/9200)) ([99dbdda](https://github.com/aws-amplify/amplify-js/commit/99dbddad8c8b0d017c9004961b53b6f9198719b7))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **amplify-js:** add CD support ([#9171](https://github.com/aws-amplify/amplify-js/issues/9171)) ([d30709f](https://github.com/aws-amplify/amplify-js/commit/d30709fd25236026af8378ab7ac7dad1ec914f83))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [4.1.15](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/pubsub@4.1.14...@aws-amplify/pubsub@4.1.15) (2021-11-09)
|
|
7
23
|
|
|
8
24
|
|
|
@@ -7850,7 +7850,7 @@ var __read = undefined && undefined.__read || function (o, n) {
|
|
|
7850
7850
|
return ar;
|
|
7851
7851
|
};
|
|
7852
7852
|
/*
|
|
7853
|
-
* Copyright 2017-
|
|
7853
|
+
* Copyright 2017-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
7854
7854
|
*
|
|
7855
7855
|
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
7856
7856
|
* the License. A copy of the License is located at
|
|
@@ -7986,6 +7986,8 @@ var START_ACK_TIMEOUT = 15000;
|
|
|
7986
7986
|
*/
|
|
7987
7987
|
|
|
7988
7988
|
var DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;
|
|
7989
|
+
var standardDomainPattern = /^https:\/\/\w{26}\.appsync\-api\.\w{2}(?:(?:\-\w{2,})+)\-\d\.amazonaws.com\/graphql$/i;
|
|
7990
|
+
var customDomainPath = '/realtime';
|
|
7989
7991
|
|
|
7990
7992
|
var AWSAppSyncRealTimeProvider =
|
|
7991
7993
|
/** @class */
|
|
@@ -8016,6 +8018,11 @@ function (_super) {
|
|
|
8016
8018
|
throw new Error('Operation not supported');
|
|
8017
8019
|
});
|
|
8018
8020
|
});
|
|
8021
|
+
}; // Check if url matches standard domain pattern
|
|
8022
|
+
|
|
8023
|
+
|
|
8024
|
+
AWSAppSyncRealTimeProvider.prototype.isCustomDomain = function (url) {
|
|
8025
|
+
return url.match(standardDomainPattern) === null;
|
|
8019
8026
|
};
|
|
8020
8027
|
|
|
8021
8028
|
AWSAppSyncRealTimeProvider.prototype.subscribe = function (_topics, options) {
|
|
@@ -8498,7 +8505,7 @@ function (_super) {
|
|
|
8498
8505
|
|
|
8499
8506
|
return new Promise(function (res, rej) {
|
|
8500
8507
|
return __awaiter(_this, void 0, void 0, function () {
|
|
8501
|
-
var
|
|
8508
|
+
var payloadString, headerString, _a, _b, headerQs, payloadQs, discoverableEndpoint, protocol, awsRealTimeUrl, err_3;
|
|
8502
8509
|
|
|
8503
8510
|
return __generator(this, function (_c) {
|
|
8504
8511
|
switch (_c.label) {
|
|
@@ -8516,8 +8523,6 @@ function (_super) {
|
|
|
8516
8523
|
_c.trys.push([1, 4,, 5]);
|
|
8517
8524
|
|
|
8518
8525
|
this.socketStatus = SOCKET_STATUS.CONNECTING;
|
|
8519
|
-
protocol = this.isSSLEnabled ? 'wss://' : 'ws://';
|
|
8520
|
-
discoverableEndpoint = appSyncGraphqlEndpoint.replace('https://', protocol).replace('http://', protocol).replace('appsync-api', 'appsync-realtime-api').replace('gogi-beta', 'grt-beta');
|
|
8521
8526
|
payloadString = '{}';
|
|
8522
8527
|
_b = (_a = JSON).stringify;
|
|
8523
8528
|
return [4
|
|
@@ -8536,6 +8541,16 @@ function (_super) {
|
|
|
8536
8541
|
headerString = _b.apply(_a, [_c.sent()]);
|
|
8537
8542
|
headerQs = buffer__WEBPACK_IMPORTED_MODULE_4__["Buffer"].from(headerString).toString('base64');
|
|
8538
8543
|
payloadQs = buffer__WEBPACK_IMPORTED_MODULE_4__["Buffer"].from(payloadString).toString('base64');
|
|
8544
|
+
discoverableEndpoint = appSyncGraphqlEndpoint;
|
|
8545
|
+
|
|
8546
|
+
if (this.isCustomDomain(discoverableEndpoint)) {
|
|
8547
|
+
discoverableEndpoint = discoverableEndpoint.concat(customDomainPath);
|
|
8548
|
+
} else {
|
|
8549
|
+
discoverableEndpoint = discoverableEndpoint.replace('appsync-api', 'appsync-realtime-api').replace('gogi-beta', 'grt-beta');
|
|
8550
|
+
}
|
|
8551
|
+
|
|
8552
|
+
protocol = this.isSSLEnabled ? 'wss://' : 'ws://';
|
|
8553
|
+
discoverableEndpoint = discoverableEndpoint.replace('https://', protocol).replace('http://', protocol);
|
|
8539
8554
|
awsRealTimeUrl = discoverableEndpoint + "?header=" + headerQs + "&payload=" + payloadQs;
|
|
8540
8555
|
return [4
|
|
8541
8556
|
/*yield*/
|