@aws-amplify/api 4.0.21-in-app-messaging.37 → 4.0.21-in-app-messaging.47

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 CHANGED
@@ -3,6 +3,14 @@
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.0.24](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/api@4.0.23...@aws-amplify/api@4.0.24) (2021-11-12)
7
+
8
+ **Note:** Version bump only for package @aws-amplify/api
9
+
10
+ ## [4.0.23](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/api@4.0.22...@aws-amplify/api@4.0.23) (2021-11-09)
11
+
12
+ **Note:** Version bump only for package @aws-amplify/api
13
+
6
14
  ## [4.0.22](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/api@4.0.21...@aws-amplify/api@4.0.22) (2021-10-28)
7
15
 
8
16
  **Note:** Version bump only for package @aws-amplify/api
@@ -12257,7 +12257,7 @@ var __read = undefined && undefined.__read || function (o, n) {
12257
12257
  return ar;
12258
12258
  };
12259
12259
  /*
12260
- * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
12260
+ * Copyright 2017-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
12261
12261
  *
12262
12262
  * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
12263
12263
  * the License. A copy of the License is located at
@@ -12393,6 +12393,8 @@ var START_ACK_TIMEOUT = 15000;
12393
12393
  */
12394
12394
 
12395
12395
  var DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;
12396
+ var standardDomainPattern = /^https:\/\/\w{26}\.appsync\-api\.\w{2}(?:(?:\-\w{2,})+)\-\d\.amazonaws.com\/graphql$/i;
12397
+ var customDomainPath = '/realtime';
12396
12398
 
12397
12399
  var AWSAppSyncRealTimeProvider =
12398
12400
  /** @class */
@@ -12423,6 +12425,11 @@ function (_super) {
12423
12425
  throw new Error('Operation not supported');
12424
12426
  });
12425
12427
  });
12428
+ }; // Check if url matches standard domain pattern
12429
+
12430
+
12431
+ AWSAppSyncRealTimeProvider.prototype.isCustomDomain = function (url) {
12432
+ return url.match(standardDomainPattern) === null;
12426
12433
  };
12427
12434
 
12428
12435
  AWSAppSyncRealTimeProvider.prototype.subscribe = function (_topics, options) {
@@ -12905,7 +12912,7 @@ function (_super) {
12905
12912
 
12906
12913
  return new Promise(function (res, rej) {
12907
12914
  return __awaiter(_this, void 0, void 0, function () {
12908
- var protocol, discoverableEndpoint, payloadString, headerString, _a, _b, headerQs, payloadQs, awsRealTimeUrl, err_3;
12915
+ var payloadString, headerString, _a, _b, headerQs, payloadQs, discoverableEndpoint, protocol, awsRealTimeUrl, err_3;
12909
12916
 
12910
12917
  return __generator(this, function (_c) {
12911
12918
  switch (_c.label) {
@@ -12923,8 +12930,6 @@ function (_super) {
12923
12930
  _c.trys.push([1, 4,, 5]);
12924
12931
 
12925
12932
  this.socketStatus = SOCKET_STATUS.CONNECTING;
12926
- protocol = this.isSSLEnabled ? 'wss://' : 'ws://';
12927
- discoverableEndpoint = appSyncGraphqlEndpoint.replace('https://', protocol).replace('http://', protocol).replace('appsync-api', 'appsync-realtime-api').replace('gogi-beta', 'grt-beta');
12928
12933
  payloadString = '{}';
12929
12934
  _b = (_a = JSON).stringify;
12930
12935
  return [4
@@ -12943,6 +12948,16 @@ function (_super) {
12943
12948
  headerString = _b.apply(_a, [_c.sent()]);
12944
12949
  headerQs = buffer__WEBPACK_IMPORTED_MODULE_4__["Buffer"].from(headerString).toString('base64');
12945
12950
  payloadQs = buffer__WEBPACK_IMPORTED_MODULE_4__["Buffer"].from(payloadString).toString('base64');
12951
+ discoverableEndpoint = appSyncGraphqlEndpoint;
12952
+
12953
+ if (this.isCustomDomain(discoverableEndpoint)) {
12954
+ discoverableEndpoint = discoverableEndpoint.concat(customDomainPath);
12955
+ } else {
12956
+ discoverableEndpoint = discoverableEndpoint.replace('appsync-api', 'appsync-realtime-api').replace('gogi-beta', 'grt-beta');
12957
+ }
12958
+
12959
+ protocol = this.isSSLEnabled ? 'wss://' : 'ws://';
12960
+ discoverableEndpoint = discoverableEndpoint.replace('https://', protocol).replace('http://', protocol);
12946
12961
  awsRealTimeUrl = discoverableEndpoint + "?header=" + headerQs + "&payload=" + payloadQs;
12947
12962
  return [4
12948
12963
  /*yield*/