@aws-amplify/pubsub 4.3.3-unstable.4 → 4.3.3-unstable.5
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/dist/aws-amplify-pubsub.js +174 -145
- 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/constants.d.ts +82 -0
- package/lib/Providers/AWSAppSyncRealTimeProvider/constants.js +90 -0
- package/lib/Providers/AWSAppSyncRealTimeProvider/constants.js.map +1 -0
- package/lib/Providers/{AWSAppSyncRealTimeProvider.d.ts → AWSAppSyncRealTimeProvider/index.d.ts} +14 -3
- package/lib/Providers/{AWSAppSyncRealTimeProvider.js → AWSAppSyncRealTimeProvider/index.js} +43 -125
- package/lib/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -0
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/constants.d.ts +82 -0
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/constants.js +88 -0
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/constants.js.map +1 -0
- package/lib-esm/Providers/{AWSAppSyncRealTimeProvider.d.ts → AWSAppSyncRealTimeProvider/index.d.ts} +14 -3
- package/lib-esm/Providers/{AWSAppSyncRealTimeProvider.js → AWSAppSyncRealTimeProvider/index.js} +9 -91
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -0
- package/package.json +13 -7
- package/src/Providers/AWSAppSyncRealTimeProvider/constants.ts +95 -0
- package/src/Providers/{AWSAppSyncRealTimeProvider.ts → AWSAppSyncRealTimeProvider/index.ts} +23 -101
- package/lib/Providers/AWSAppSyncRealTimeProvider.js.map +0 -1
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider.js.map +0 -1
|
@@ -7614,10 +7614,135 @@ function (_super) {
|
|
|
7614
7614
|
|
|
7615
7615
|
/***/ }),
|
|
7616
7616
|
|
|
7617
|
-
/***/ "./lib-esm/Providers/AWSAppSyncRealTimeProvider.js":
|
|
7618
|
-
|
|
7619
|
-
!*** ./lib-esm/Providers/AWSAppSyncRealTimeProvider.js ***!
|
|
7620
|
-
|
|
7617
|
+
/***/ "./lib-esm/Providers/AWSAppSyncRealTimeProvider/constants.js":
|
|
7618
|
+
/*!*******************************************************************!*\
|
|
7619
|
+
!*** ./lib-esm/Providers/AWSAppSyncRealTimeProvider/constants.js ***!
|
|
7620
|
+
\*******************************************************************/
|
|
7621
|
+
/*! exports provided: MAX_DELAY_MS, NON_RETRYABLE_CODES, MESSAGE_TYPES, SUBSCRIPTION_STATUS, SOCKET_STATUS, AMPLIFY_SYMBOL, AWS_APPSYNC_REALTIME_HEADERS, CONNECTION_INIT_TIMEOUT, START_ACK_TIMEOUT, DEFAULT_KEEP_ALIVE_TIMEOUT */
|
|
7622
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
7623
|
+
|
|
7624
|
+
"use strict";
|
|
7625
|
+
__webpack_require__.r(__webpack_exports__);
|
|
7626
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MAX_DELAY_MS", function() { return MAX_DELAY_MS; });
|
|
7627
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NON_RETRYABLE_CODES", function() { return NON_RETRYABLE_CODES; });
|
|
7628
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MESSAGE_TYPES", function() { return MESSAGE_TYPES; });
|
|
7629
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SUBSCRIPTION_STATUS", function() { return SUBSCRIPTION_STATUS; });
|
|
7630
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SOCKET_STATUS", function() { return SOCKET_STATUS; });
|
|
7631
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AMPLIFY_SYMBOL", function() { return AMPLIFY_SYMBOL; });
|
|
7632
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AWS_APPSYNC_REALTIME_HEADERS", function() { return AWS_APPSYNC_REALTIME_HEADERS; });
|
|
7633
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CONNECTION_INIT_TIMEOUT", function() { return CONNECTION_INIT_TIMEOUT; });
|
|
7634
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "START_ACK_TIMEOUT", function() { return START_ACK_TIMEOUT; });
|
|
7635
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_KEEP_ALIVE_TIMEOUT", function() { return DEFAULT_KEEP_ALIVE_TIMEOUT; });
|
|
7636
|
+
var MAX_DELAY_MS = 5000;
|
|
7637
|
+
var NON_RETRYABLE_CODES = [400, 401, 403];
|
|
7638
|
+
var MESSAGE_TYPES;
|
|
7639
|
+
|
|
7640
|
+
(function (MESSAGE_TYPES) {
|
|
7641
|
+
/**
|
|
7642
|
+
* Client -> Server message.
|
|
7643
|
+
* This message type is the first message after handshake and this will initialize AWS AppSync RealTime communication
|
|
7644
|
+
*/
|
|
7645
|
+
MESSAGE_TYPES["GQL_CONNECTION_INIT"] = "connection_init";
|
|
7646
|
+
/**
|
|
7647
|
+
* Server -> Client message
|
|
7648
|
+
* This message type is in case there is an issue with AWS AppSync RealTime when establishing connection
|
|
7649
|
+
*/
|
|
7650
|
+
|
|
7651
|
+
MESSAGE_TYPES["GQL_CONNECTION_ERROR"] = "connection_error";
|
|
7652
|
+
/**
|
|
7653
|
+
* Server -> Client message.
|
|
7654
|
+
* This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message
|
|
7655
|
+
*/
|
|
7656
|
+
|
|
7657
|
+
MESSAGE_TYPES["GQL_CONNECTION_ACK"] = "connection_ack";
|
|
7658
|
+
/**
|
|
7659
|
+
* Client -> Server message.
|
|
7660
|
+
* This message type is for register subscriptions with AWS AppSync RealTime
|
|
7661
|
+
*/
|
|
7662
|
+
|
|
7663
|
+
MESSAGE_TYPES["GQL_START"] = "start";
|
|
7664
|
+
/**
|
|
7665
|
+
* Server -> Client message.
|
|
7666
|
+
* This message type is for the ack response from AWS AppSync RealTime for GQL_START message
|
|
7667
|
+
*/
|
|
7668
|
+
|
|
7669
|
+
MESSAGE_TYPES["GQL_START_ACK"] = "start_ack";
|
|
7670
|
+
/**
|
|
7671
|
+
* Server -> Client message.
|
|
7672
|
+
* This message type is for subscription message from AWS AppSync RealTime
|
|
7673
|
+
*/
|
|
7674
|
+
|
|
7675
|
+
MESSAGE_TYPES["GQL_DATA"] = "data";
|
|
7676
|
+
/**
|
|
7677
|
+
* Server -> Client message.
|
|
7678
|
+
* This message type helps the client to know is still receiving messages from AWS AppSync RealTime
|
|
7679
|
+
*/
|
|
7680
|
+
|
|
7681
|
+
MESSAGE_TYPES["GQL_CONNECTION_KEEP_ALIVE"] = "ka";
|
|
7682
|
+
/**
|
|
7683
|
+
* Client -> Server message.
|
|
7684
|
+
* This message type is for unregister subscriptions with AWS AppSync RealTime
|
|
7685
|
+
*/
|
|
7686
|
+
|
|
7687
|
+
MESSAGE_TYPES["GQL_STOP"] = "stop";
|
|
7688
|
+
/**
|
|
7689
|
+
* Server -> Client message.
|
|
7690
|
+
* This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message
|
|
7691
|
+
*/
|
|
7692
|
+
|
|
7693
|
+
MESSAGE_TYPES["GQL_COMPLETE"] = "complete";
|
|
7694
|
+
/**
|
|
7695
|
+
* Server -> Client message.
|
|
7696
|
+
* This message type is for sending error messages from AWS AppSync RealTime to the client
|
|
7697
|
+
*/
|
|
7698
|
+
|
|
7699
|
+
MESSAGE_TYPES["GQL_ERROR"] = "error";
|
|
7700
|
+
})(MESSAGE_TYPES || (MESSAGE_TYPES = {}));
|
|
7701
|
+
|
|
7702
|
+
var SUBSCRIPTION_STATUS;
|
|
7703
|
+
|
|
7704
|
+
(function (SUBSCRIPTION_STATUS) {
|
|
7705
|
+
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["PENDING"] = 0] = "PENDING";
|
|
7706
|
+
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["CONNECTED"] = 1] = "CONNECTED";
|
|
7707
|
+
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["FAILED"] = 2] = "FAILED";
|
|
7708
|
+
})(SUBSCRIPTION_STATUS || (SUBSCRIPTION_STATUS = {}));
|
|
7709
|
+
|
|
7710
|
+
var SOCKET_STATUS;
|
|
7711
|
+
|
|
7712
|
+
(function (SOCKET_STATUS) {
|
|
7713
|
+
SOCKET_STATUS[SOCKET_STATUS["CLOSED"] = 0] = "CLOSED";
|
|
7714
|
+
SOCKET_STATUS[SOCKET_STATUS["READY"] = 1] = "READY";
|
|
7715
|
+
SOCKET_STATUS[SOCKET_STATUS["CONNECTING"] = 2] = "CONNECTING";
|
|
7716
|
+
})(SOCKET_STATUS || (SOCKET_STATUS = {}));
|
|
7717
|
+
|
|
7718
|
+
var AMPLIFY_SYMBOL = typeof Symbol !== 'undefined' && typeof Symbol["for"] === 'function' ? Symbol["for"]('amplify_default') : '@@amplify_default';
|
|
7719
|
+
var AWS_APPSYNC_REALTIME_HEADERS = {
|
|
7720
|
+
accept: 'application/json, text/javascript',
|
|
7721
|
+
'content-encoding': 'amz-1.0',
|
|
7722
|
+
'content-type': 'application/json; charset=UTF-8'
|
|
7723
|
+
};
|
|
7724
|
+
/**
|
|
7725
|
+
* Time in milleseconds to wait for GQL_CONNECTION_INIT message
|
|
7726
|
+
*/
|
|
7727
|
+
|
|
7728
|
+
var CONNECTION_INIT_TIMEOUT = 15000;
|
|
7729
|
+
/**
|
|
7730
|
+
* Time in milleseconds to wait for GQL_START_ACK message
|
|
7731
|
+
*/
|
|
7732
|
+
|
|
7733
|
+
var START_ACK_TIMEOUT = 15000;
|
|
7734
|
+
/**
|
|
7735
|
+
* Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message
|
|
7736
|
+
*/
|
|
7737
|
+
|
|
7738
|
+
var DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;
|
|
7739
|
+
|
|
7740
|
+
/***/ }),
|
|
7741
|
+
|
|
7742
|
+
/***/ "./lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js":
|
|
7743
|
+
/*!***************************************************************!*\
|
|
7744
|
+
!*** ./lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js ***!
|
|
7745
|
+
\***************************************************************/
|
|
7621
7746
|
/*! exports provided: AWSAppSyncRealTimeProvider */
|
|
7622
7747
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
7623
7748
|
|
|
@@ -7639,8 +7764,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7639
7764
|
/* harmony import */ var _aws_amplify_cache__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_cache__WEBPACK_IMPORTED_MODULE_6__);
|
|
7640
7765
|
/* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @aws-amplify/auth */ "@aws-amplify/auth");
|
|
7641
7766
|
/* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_7__);
|
|
7642
|
-
/* harmony import */ var _PubSubProvider__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*!
|
|
7643
|
-
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*!
|
|
7767
|
+
/* harmony import */ var _PubSubProvider__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../PubSubProvider */ "./lib-esm/Providers/PubSubProvider.js");
|
|
7768
|
+
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../index */ "./lib-esm/index.js");
|
|
7769
|
+
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./constants */ "./lib-esm/Providers/AWSAppSyncRealTimeProvider/constants.js");
|
|
7644
7770
|
var __extends = undefined && undefined.__extends || function () {
|
|
7645
7771
|
var _extendStatics = function extendStatics(d, b) {
|
|
7646
7772
|
_extendStatics = Object.setPrototypeOf || {
|
|
@@ -7876,119 +8002,17 @@ var __read = undefined && undefined.__read || function (o, n) {
|
|
|
7876
8002
|
|
|
7877
8003
|
|
|
7878
8004
|
|
|
8005
|
+
|
|
7879
8006
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["Logger"]('AWSAppSyncRealTimeProvider');
|
|
7880
|
-
var AMPLIFY_SYMBOL = typeof Symbol !== 'undefined' && typeof Symbol["for"] === 'function' ? Symbol["for"]('amplify_default') : '@@amplify_default';
|
|
7881
8007
|
|
|
7882
8008
|
var dispatchApiEvent = function dispatchApiEvent(event, data, message) {
|
|
7883
8009
|
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["Hub"].dispatch('api', {
|
|
7884
8010
|
event: event,
|
|
7885
8011
|
data: data,
|
|
7886
8012
|
message: message
|
|
7887
|
-
}, 'PubSub', AMPLIFY_SYMBOL);
|
|
8013
|
+
}, 'PubSub', _constants__WEBPACK_IMPORTED_MODULE_10__["AMPLIFY_SYMBOL"]);
|
|
7888
8014
|
};
|
|
7889
8015
|
|
|
7890
|
-
var MAX_DELAY_MS = 5000;
|
|
7891
|
-
var NON_RETRYABLE_CODES = [400, 401, 403];
|
|
7892
|
-
var MESSAGE_TYPES;
|
|
7893
|
-
|
|
7894
|
-
(function (MESSAGE_TYPES) {
|
|
7895
|
-
/**
|
|
7896
|
-
* Client -> Server message.
|
|
7897
|
-
* This message type is the first message after handshake and this will initialize AWS AppSync RealTime communication
|
|
7898
|
-
*/
|
|
7899
|
-
MESSAGE_TYPES["GQL_CONNECTION_INIT"] = "connection_init";
|
|
7900
|
-
/**
|
|
7901
|
-
* Server -> Client message
|
|
7902
|
-
* This message type is in case there is an issue with AWS AppSync RealTime when establishing connection
|
|
7903
|
-
*/
|
|
7904
|
-
|
|
7905
|
-
MESSAGE_TYPES["GQL_CONNECTION_ERROR"] = "connection_error";
|
|
7906
|
-
/**
|
|
7907
|
-
* Server -> Client message.
|
|
7908
|
-
* This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message
|
|
7909
|
-
*/
|
|
7910
|
-
|
|
7911
|
-
MESSAGE_TYPES["GQL_CONNECTION_ACK"] = "connection_ack";
|
|
7912
|
-
/**
|
|
7913
|
-
* Client -> Server message.
|
|
7914
|
-
* This message type is for register subscriptions with AWS AppSync RealTime
|
|
7915
|
-
*/
|
|
7916
|
-
|
|
7917
|
-
MESSAGE_TYPES["GQL_START"] = "start";
|
|
7918
|
-
/**
|
|
7919
|
-
* Server -> Client message.
|
|
7920
|
-
* This message type is for the ack response from AWS AppSync RealTime for GQL_START message
|
|
7921
|
-
*/
|
|
7922
|
-
|
|
7923
|
-
MESSAGE_TYPES["GQL_START_ACK"] = "start_ack";
|
|
7924
|
-
/**
|
|
7925
|
-
* Server -> Client message.
|
|
7926
|
-
* This message type is for subscription message from AWS AppSync RealTime
|
|
7927
|
-
*/
|
|
7928
|
-
|
|
7929
|
-
MESSAGE_TYPES["GQL_DATA"] = "data";
|
|
7930
|
-
/**
|
|
7931
|
-
* Server -> Client message.
|
|
7932
|
-
* This message type helps the client to know is still receiving messages from AWS AppSync RealTime
|
|
7933
|
-
*/
|
|
7934
|
-
|
|
7935
|
-
MESSAGE_TYPES["GQL_CONNECTION_KEEP_ALIVE"] = "ka";
|
|
7936
|
-
/**
|
|
7937
|
-
* Client -> Server message.
|
|
7938
|
-
* This message type is for unregister subscriptions with AWS AppSync RealTime
|
|
7939
|
-
*/
|
|
7940
|
-
|
|
7941
|
-
MESSAGE_TYPES["GQL_STOP"] = "stop";
|
|
7942
|
-
/**
|
|
7943
|
-
* Server -> Client message.
|
|
7944
|
-
* This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message
|
|
7945
|
-
*/
|
|
7946
|
-
|
|
7947
|
-
MESSAGE_TYPES["GQL_COMPLETE"] = "complete";
|
|
7948
|
-
/**
|
|
7949
|
-
* Server -> Client message.
|
|
7950
|
-
* This message type is for sending error messages from AWS AppSync RealTime to the client
|
|
7951
|
-
*/
|
|
7952
|
-
|
|
7953
|
-
MESSAGE_TYPES["GQL_ERROR"] = "error";
|
|
7954
|
-
})(MESSAGE_TYPES || (MESSAGE_TYPES = {}));
|
|
7955
|
-
|
|
7956
|
-
var SUBSCRIPTION_STATUS;
|
|
7957
|
-
|
|
7958
|
-
(function (SUBSCRIPTION_STATUS) {
|
|
7959
|
-
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["PENDING"] = 0] = "PENDING";
|
|
7960
|
-
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["CONNECTED"] = 1] = "CONNECTED";
|
|
7961
|
-
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["FAILED"] = 2] = "FAILED";
|
|
7962
|
-
})(SUBSCRIPTION_STATUS || (SUBSCRIPTION_STATUS = {}));
|
|
7963
|
-
|
|
7964
|
-
var SOCKET_STATUS;
|
|
7965
|
-
|
|
7966
|
-
(function (SOCKET_STATUS) {
|
|
7967
|
-
SOCKET_STATUS[SOCKET_STATUS["CLOSED"] = 0] = "CLOSED";
|
|
7968
|
-
SOCKET_STATUS[SOCKET_STATUS["READY"] = 1] = "READY";
|
|
7969
|
-
SOCKET_STATUS[SOCKET_STATUS["CONNECTING"] = 2] = "CONNECTING";
|
|
7970
|
-
})(SOCKET_STATUS || (SOCKET_STATUS = {}));
|
|
7971
|
-
|
|
7972
|
-
var AWS_APPSYNC_REALTIME_HEADERS = {
|
|
7973
|
-
accept: 'application/json, text/javascript',
|
|
7974
|
-
'content-encoding': 'amz-1.0',
|
|
7975
|
-
'content-type': 'application/json; charset=UTF-8'
|
|
7976
|
-
};
|
|
7977
|
-
/**
|
|
7978
|
-
* Time in milleseconds to wait for GQL_CONNECTION_INIT message
|
|
7979
|
-
*/
|
|
7980
|
-
|
|
7981
|
-
var CONNECTION_INIT_TIMEOUT = 15000;
|
|
7982
|
-
/**
|
|
7983
|
-
* Time in milleseconds to wait for GQL_START_ACK message
|
|
7984
|
-
*/
|
|
7985
|
-
|
|
7986
|
-
var START_ACK_TIMEOUT = 15000;
|
|
7987
|
-
/**
|
|
7988
|
-
* Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message
|
|
7989
|
-
*/
|
|
7990
|
-
|
|
7991
|
-
var DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;
|
|
7992
8016
|
var standardDomainPattern = /^https:\/\/\w{26}\.appsync\-api\.\w{2}(?:(?:\-\w{2,})+)\-\d\.amazonaws.com\/graphql$/i;
|
|
7993
8017
|
var customDomainPath = '/realtime';
|
|
7994
8018
|
|
|
@@ -8000,13 +8024,17 @@ function (_super) {
|
|
|
8000
8024
|
function AWSAppSyncRealTimeProvider() {
|
|
8001
8025
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
8002
8026
|
|
|
8003
|
-
_this.socketStatus = SOCKET_STATUS.CLOSED;
|
|
8004
|
-
_this.keepAliveTimeout = DEFAULT_KEEP_ALIVE_TIMEOUT;
|
|
8027
|
+
_this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
8028
|
+
_this.keepAliveTimeout = _constants__WEBPACK_IMPORTED_MODULE_10__["DEFAULT_KEEP_ALIVE_TIMEOUT"];
|
|
8005
8029
|
_this.subscriptionObserverMap = new Map();
|
|
8006
8030
|
_this.promiseArray = [];
|
|
8007
8031
|
return _this;
|
|
8008
8032
|
}
|
|
8009
8033
|
|
|
8034
|
+
AWSAppSyncRealTimeProvider.prototype.getNewWebSocket = function (url, protocol) {
|
|
8035
|
+
return new WebSocket(url, protocol);
|
|
8036
|
+
};
|
|
8037
|
+
|
|
8010
8038
|
AWSAppSyncRealTimeProvider.prototype.getProviderName = function () {
|
|
8011
8039
|
return 'AWSAppSyncRealTimeProvider';
|
|
8012
8040
|
};
|
|
@@ -8078,7 +8106,7 @@ function (_super) {
|
|
|
8078
8106
|
];
|
|
8079
8107
|
}
|
|
8080
8108
|
|
|
8081
|
-
if (subscriptionState === SUBSCRIPTION_STATUS.CONNECTED) {
|
|
8109
|
+
if (subscriptionState === _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].CONNECTED) {
|
|
8082
8110
|
this._sendUnsubscriptionMessage(subscriptionId_1);
|
|
8083
8111
|
} else {
|
|
8084
8112
|
throw new Error('Subscription never connected');
|
|
@@ -8142,7 +8170,7 @@ function (_super) {
|
|
|
8142
8170
|
appSyncGraphqlEndpoint = options.appSyncGraphqlEndpoint, authenticationType = options.authenticationType, query = options.query, variables = options.variables, apiKey = options.apiKey, region = options.region, _d = options.graphql_headers, graphql_headers = _d === void 0 ? function () {
|
|
8143
8171
|
return {};
|
|
8144
8172
|
} : _d, _e = options.additionalHeaders, additionalHeaders = _e === void 0 ? {} : _e;
|
|
8145
|
-
subscriptionState = SUBSCRIPTION_STATUS.PENDING;
|
|
8173
|
+
subscriptionState = _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].PENDING;
|
|
8146
8174
|
data = {
|
|
8147
8175
|
query: query,
|
|
8148
8176
|
variables: variables
|
|
@@ -8185,7 +8213,7 @@ function (_super) {
|
|
|
8185
8213
|
authorization: __assign({}, headerObj)
|
|
8186
8214
|
}
|
|
8187
8215
|
},
|
|
8188
|
-
type: MESSAGE_TYPES.GQL_START
|
|
8216
|
+
type: _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_START
|
|
8189
8217
|
};
|
|
8190
8218
|
stringToAWSRealTime = JSON.stringify(subscriptionMessage);
|
|
8191
8219
|
_k.label = 3;
|
|
@@ -8242,7 +8270,7 @@ function (_super) {
|
|
|
8242
8270
|
subscriptionFailedCallback: subscriptionFailedCallback,
|
|
8243
8271
|
startAckTimeoutId: setTimeout(function () {
|
|
8244
8272
|
_this._timeoutStartSubscriptionAck.call(_this, subscriptionId);
|
|
8245
|
-
}, START_ACK_TIMEOUT)
|
|
8273
|
+
}, _constants__WEBPACK_IMPORTED_MODULE_10__["START_ACK_TIMEOUT"])
|
|
8246
8274
|
});
|
|
8247
8275
|
|
|
8248
8276
|
if (this.awsRealTimeSocket) {
|
|
@@ -8270,7 +8298,7 @@ function (_super) {
|
|
|
8270
8298
|
if (subscriptionObserver) {
|
|
8271
8299
|
subscriptionState = subscriptionObserver.subscriptionState; // This in case unsubscribe is invoked before sending start subscription message
|
|
8272
8300
|
|
|
8273
|
-
if (subscriptionState === SUBSCRIPTION_STATUS.PENDING) {
|
|
8301
|
+
if (subscriptionState === _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].PENDING) {
|
|
8274
8302
|
return [2
|
|
8275
8303
|
/*return*/
|
|
8276
8304
|
, new Promise(function (res, rej) {
|
|
@@ -8300,11 +8328,11 @@ function (_super) {
|
|
|
8300
8328
|
|
|
8301
8329
|
AWSAppSyncRealTimeProvider.prototype._sendUnsubscriptionMessage = function (subscriptionId) {
|
|
8302
8330
|
try {
|
|
8303
|
-
if (this.awsRealTimeSocket && this.awsRealTimeSocket.readyState === WebSocket.OPEN && this.socketStatus === SOCKET_STATUS.READY) {
|
|
8331
|
+
if (this.awsRealTimeSocket && this.awsRealTimeSocket.readyState === WebSocket.OPEN && this.socketStatus === _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].READY) {
|
|
8304
8332
|
// Preparing unsubscribe message to stop receiving messages for that subscription
|
|
8305
8333
|
var unsubscribeMessage = {
|
|
8306
8334
|
id: subscriptionId,
|
|
8307
|
-
type: MESSAGE_TYPES.GQL_STOP
|
|
8335
|
+
type: _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_STOP
|
|
8308
8336
|
};
|
|
8309
8337
|
var stringToAWSRealTime = JSON.stringify(unsubscribeMessage);
|
|
8310
8338
|
this.awsRealTimeSocket.send(stringToAWSRealTime);
|
|
@@ -8330,7 +8358,7 @@ function (_super) {
|
|
|
8330
8358
|
}
|
|
8331
8359
|
|
|
8332
8360
|
if (!this.awsRealTimeSocket) {
|
|
8333
|
-
this.socketStatus = SOCKET_STATUS.CLOSED;
|
|
8361
|
+
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
8334
8362
|
return;
|
|
8335
8363
|
}
|
|
8336
8364
|
|
|
@@ -8346,7 +8374,7 @@ function (_super) {
|
|
|
8346
8374
|
tempSocket.onerror = null;
|
|
8347
8375
|
tempSocket.close(1000);
|
|
8348
8376
|
this.awsRealTimeSocket = undefined;
|
|
8349
|
-
this.socketStatus = SOCKET_STATUS.CLOSED;
|
|
8377
|
+
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
8350
8378
|
}
|
|
8351
8379
|
};
|
|
8352
8380
|
|
|
@@ -8377,7 +8405,7 @@ function (_super) {
|
|
|
8377
8405
|
variables: variables
|
|
8378
8406
|
});
|
|
8379
8407
|
|
|
8380
|
-
if (type === MESSAGE_TYPES.GQL_DATA && payload && payload.data) {
|
|
8408
|
+
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_DATA && payload && payload.data) {
|
|
8381
8409
|
if (observer) {
|
|
8382
8410
|
observer.next(payload);
|
|
8383
8411
|
} else {
|
|
@@ -8387,7 +8415,7 @@ function (_super) {
|
|
|
8387
8415
|
return;
|
|
8388
8416
|
}
|
|
8389
8417
|
|
|
8390
|
-
if (type === MESSAGE_TYPES.GQL_START_ACK) {
|
|
8418
|
+
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_START_ACK) {
|
|
8391
8419
|
logger.debug("subscription ready for " + JSON.stringify({
|
|
8392
8420
|
query: query,
|
|
8393
8421
|
variables: variables
|
|
@@ -8402,7 +8430,7 @@ function (_super) {
|
|
|
8402
8430
|
query: query,
|
|
8403
8431
|
variables: variables
|
|
8404
8432
|
}, 'Connection established for subscription');
|
|
8405
|
-
var subscriptionState = SUBSCRIPTION_STATUS.CONNECTED;
|
|
8433
|
+
var subscriptionState = _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].CONNECTED;
|
|
8406
8434
|
|
|
8407
8435
|
if (observer) {
|
|
8408
8436
|
this.subscriptionObserverMap.set(id, {
|
|
@@ -8420,14 +8448,14 @@ function (_super) {
|
|
|
8420
8448
|
return;
|
|
8421
8449
|
}
|
|
8422
8450
|
|
|
8423
|
-
if (type === MESSAGE_TYPES.GQL_CONNECTION_KEEP_ALIVE) {
|
|
8451
|
+
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_CONNECTION_KEEP_ALIVE) {
|
|
8424
8452
|
if (this.keepAliveTimeoutId) clearTimeout(this.keepAliveTimeoutId);
|
|
8425
8453
|
this.keepAliveTimeoutId = setTimeout(this._errorDisconnect.bind(this, _index__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].TIMEOUT_DISCONNECT), this.keepAliveTimeout);
|
|
8426
8454
|
return;
|
|
8427
8455
|
}
|
|
8428
8456
|
|
|
8429
|
-
if (type === MESSAGE_TYPES.GQL_ERROR) {
|
|
8430
|
-
var subscriptionState = SUBSCRIPTION_STATUS.FAILED;
|
|
8457
|
+
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_ERROR) {
|
|
8458
|
+
var subscriptionState = _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].FAILED;
|
|
8431
8459
|
|
|
8432
8460
|
if (observer) {
|
|
8433
8461
|
this.subscriptionObserverMap.set(id, {
|
|
@@ -8469,7 +8497,7 @@ function (_super) {
|
|
|
8469
8497
|
this.awsRealTimeSocket.close();
|
|
8470
8498
|
}
|
|
8471
8499
|
|
|
8472
|
-
this.socketStatus = SOCKET_STATUS.CLOSED;
|
|
8500
|
+
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
8473
8501
|
};
|
|
8474
8502
|
|
|
8475
8503
|
AWSAppSyncRealTimeProvider.prototype._timeoutStartSubscriptionAck = function (subscriptionId) {
|
|
@@ -8488,7 +8516,7 @@ function (_super) {
|
|
|
8488
8516
|
observer: observer,
|
|
8489
8517
|
query: query,
|
|
8490
8518
|
variables: variables,
|
|
8491
|
-
subscriptionState: SUBSCRIPTION_STATUS.FAILED
|
|
8519
|
+
subscriptionState: _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].FAILED
|
|
8492
8520
|
});
|
|
8493
8521
|
|
|
8494
8522
|
if (observer && !observer.closed) {
|
|
@@ -8518,7 +8546,7 @@ function (_super) {
|
|
|
8518
8546
|
region = _a.region,
|
|
8519
8547
|
additionalHeaders = _a.additionalHeaders;
|
|
8520
8548
|
|
|
8521
|
-
if (this.socketStatus === SOCKET_STATUS.READY) {
|
|
8549
|
+
if (this.socketStatus === _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].READY) {
|
|
8522
8550
|
return;
|
|
8523
8551
|
}
|
|
8524
8552
|
|
|
@@ -8533,7 +8561,7 @@ function (_super) {
|
|
|
8533
8561
|
res: res,
|
|
8534
8562
|
rej: rej
|
|
8535
8563
|
});
|
|
8536
|
-
if (!(this.socketStatus === SOCKET_STATUS.CLOSED)) return [3
|
|
8564
|
+
if (!(this.socketStatus === _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED)) return [3
|
|
8537
8565
|
/*break*/
|
|
8538
8566
|
, 5];
|
|
8539
8567
|
_c.label = 1;
|
|
@@ -8541,7 +8569,7 @@ function (_super) {
|
|
|
8541
8569
|
case 1:
|
|
8542
8570
|
_c.trys.push([1, 4,, 5]);
|
|
8543
8571
|
|
|
8544
|
-
this.socketStatus = SOCKET_STATUS.CONNECTING;
|
|
8572
|
+
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CONNECTING;
|
|
8545
8573
|
payloadString = '{}';
|
|
8546
8574
|
_b = (_a = JSON).stringify;
|
|
8547
8575
|
return [4
|
|
@@ -8583,7 +8611,7 @@ function (_super) {
|
|
|
8583
8611
|
logger.debug('Notifying connection successful');
|
|
8584
8612
|
res();
|
|
8585
8613
|
});
|
|
8586
|
-
this.socketStatus = SOCKET_STATUS.READY;
|
|
8614
|
+
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].READY;
|
|
8587
8615
|
this.promiseArray = [];
|
|
8588
8616
|
return [3
|
|
8589
8617
|
/*break*/
|
|
@@ -8602,7 +8630,7 @@ function (_super) {
|
|
|
8602
8630
|
}
|
|
8603
8631
|
|
|
8604
8632
|
this.awsRealTimeSocket = undefined;
|
|
8605
|
-
this.socketStatus = SOCKET_STATUS.CLOSED;
|
|
8633
|
+
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
8606
8634
|
return [3
|
|
8607
8635
|
/*break*/
|
|
8608
8636
|
, 5];
|
|
@@ -8625,7 +8653,7 @@ function (_super) {
|
|
|
8625
8653
|
logger.debug("Initializaling retryable Handshake");
|
|
8626
8654
|
return [4
|
|
8627
8655
|
/*yield*/
|
|
8628
|
-
, Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["jitteredExponentialRetry"])(this._initializeHandshake.bind(this), [awsRealTimeUrl], MAX_DELAY_MS)];
|
|
8656
|
+
, Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["jitteredExponentialRetry"])(this._initializeHandshake.bind(this), [awsRealTimeUrl], _constants__WEBPACK_IMPORTED_MODULE_10__["MAX_DELAY_MS"])];
|
|
8629
8657
|
|
|
8630
8658
|
case 1:
|
|
8631
8659
|
_a.sent();
|
|
@@ -8657,7 +8685,7 @@ function (_super) {
|
|
|
8657
8685
|
/*yield*/
|
|
8658
8686
|
, function () {
|
|
8659
8687
|
return new Promise(function (res, rej) {
|
|
8660
|
-
var newSocket =
|
|
8688
|
+
var newSocket = _this.getNewWebSocket(awsRealTimeUrl, 'graphql-ws');
|
|
8661
8689
|
|
|
8662
8690
|
newSocket.onerror = function () {
|
|
8663
8691
|
logger.debug("WebSocket connection error");
|
|
@@ -8700,9 +8728,9 @@ function (_super) {
|
|
|
8700
8728
|
var type = data.type,
|
|
8701
8729
|
_a = data.payload,
|
|
8702
8730
|
_b = (_a === void 0 ? {} : _a).connectionTimeoutMs,
|
|
8703
|
-
connectionTimeoutMs = _b === void 0 ? DEFAULT_KEEP_ALIVE_TIMEOUT : _b;
|
|
8731
|
+
connectionTimeoutMs = _b === void 0 ? _constants__WEBPACK_IMPORTED_MODULE_10__["DEFAULT_KEEP_ALIVE_TIMEOUT"] : _b;
|
|
8704
8732
|
|
|
8705
|
-
if (type === MESSAGE_TYPES.GQL_CONNECTION_ACK) {
|
|
8733
|
+
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_CONNECTION_ACK) {
|
|
8706
8734
|
ackOk_1 = true;
|
|
8707
8735
|
|
|
8708
8736
|
if (_this.awsRealTimeSocket) {
|
|
@@ -8726,7 +8754,7 @@ function (_super) {
|
|
|
8726
8754
|
return;
|
|
8727
8755
|
}
|
|
8728
8756
|
|
|
8729
|
-
if (type === MESSAGE_TYPES.GQL_CONNECTION_ERROR) {
|
|
8757
|
+
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_CONNECTION_ERROR) {
|
|
8730
8758
|
var _c = data.payload,
|
|
8731
8759
|
_d = (_c === void 0 ? {} : _c).errors,
|
|
8732
8760
|
_e = __read(_d === void 0 ? [] : _d, 1),
|
|
@@ -8745,17 +8773,17 @@ function (_super) {
|
|
|
8745
8773
|
};
|
|
8746
8774
|
|
|
8747
8775
|
var gqlInit = {
|
|
8748
|
-
type: MESSAGE_TYPES.GQL_CONNECTION_INIT
|
|
8776
|
+
type: _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_CONNECTION_INIT
|
|
8749
8777
|
};
|
|
8750
8778
|
|
|
8751
8779
|
_this.awsRealTimeSocket.send(JSON.stringify(gqlInit));
|
|
8752
8780
|
|
|
8753
|
-
setTimeout(checkAckOk.bind(_this, ackOk_1), CONNECTION_INIT_TIMEOUT);
|
|
8781
|
+
setTimeout(checkAckOk.bind(_this, ackOk_1), _constants__WEBPACK_IMPORTED_MODULE_10__["CONNECTION_INIT_TIMEOUT"]);
|
|
8754
8782
|
}
|
|
8755
8783
|
|
|
8756
8784
|
function checkAckOk(ackOk) {
|
|
8757
8785
|
if (!ackOk) {
|
|
8758
|
-
rej(new Error("Connection timeout: ack from AWSRealTime was not received on " + CONNECTION_INIT_TIMEOUT + " ms"));
|
|
8786
|
+
rej(new Error("Connection timeout: ack from AWSRealTime was not received on " + _constants__WEBPACK_IMPORTED_MODULE_10__["CONNECTION_INIT_TIMEOUT"] + " ms"));
|
|
8759
8787
|
}
|
|
8760
8788
|
}
|
|
8761
8789
|
});
|
|
@@ -8773,7 +8801,7 @@ function (_super) {
|
|
|
8773
8801
|
err_4 = _b.sent();
|
|
8774
8802
|
_a = err_4, errorType = _a.errorType, errorCode = _a.errorCode;
|
|
8775
8803
|
|
|
8776
|
-
if (NON_RETRYABLE_CODES.includes(errorCode)) {
|
|
8804
|
+
if (_constants__WEBPACK_IMPORTED_MODULE_10__["NON_RETRYABLE_CODES"].includes(errorCode)) {
|
|
8777
8805
|
throw new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["NonRetryableError"](errorType);
|
|
8778
8806
|
} else if (errorType) {
|
|
8779
8807
|
throw new Error(errorType);
|
|
@@ -8825,6 +8853,7 @@ function (_super) {
|
|
|
8825
8853
|
case 1:
|
|
8826
8854
|
handler = headerHandler[authenticationType];
|
|
8827
8855
|
host = url__WEBPACK_IMPORTED_MODULE_2__["parse"](appSyncGraphqlEndpoint !== null && appSyncGraphqlEndpoint !== void 0 ? appSyncGraphqlEndpoint : '').host;
|
|
8856
|
+
logger.debug("Authenticating with " + authenticationType);
|
|
8828
8857
|
return [4
|
|
8829
8858
|
/*yield*/
|
|
8830
8859
|
, handler({
|
|
@@ -8986,7 +9015,7 @@ function (_super) {
|
|
|
8986
9015
|
url: "" + appSyncGraphqlEndpoint + canonicalUri,
|
|
8987
9016
|
data: payload,
|
|
8988
9017
|
method: 'POST',
|
|
8989
|
-
headers: __assign({}, AWS_APPSYNC_REALTIME_HEADERS)
|
|
9018
|
+
headers: __assign({}, _constants__WEBPACK_IMPORTED_MODULE_10__["AWS_APPSYNC_REALTIME_HEADERS"])
|
|
8990
9019
|
};
|
|
8991
9020
|
signed_params = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["Signer"].sign(request, creds, endpointInfo);
|
|
8992
9021
|
return [2
|
|
@@ -10110,7 +10139,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10110
10139
|
/* harmony import */ var _AWSAppSyncProvider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AWSAppSyncProvider */ "./lib-esm/Providers/AWSAppSyncProvider.js");
|
|
10111
10140
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AWSAppSyncProvider", function() { return _AWSAppSyncProvider__WEBPACK_IMPORTED_MODULE_1__["AWSAppSyncProvider"]; });
|
|
10112
10141
|
|
|
10113
|
-
/* harmony import */ var _AWSAppSyncRealTimeProvider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./AWSAppSyncRealTimeProvider */ "./lib-esm/Providers/AWSAppSyncRealTimeProvider.js");
|
|
10142
|
+
/* harmony import */ var _AWSAppSyncRealTimeProvider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./AWSAppSyncRealTimeProvider */ "./lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js");
|
|
10114
10143
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AWSAppSyncRealTimeProvider", function() { return _AWSAppSyncRealTimeProvider__WEBPACK_IMPORTED_MODULE_2__["AWSAppSyncRealTimeProvider"]; });
|
|
10115
10144
|
|
|
10116
10145
|
/* harmony import */ var _AWSIotProvider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./AWSIotProvider */ "./lib-esm/Providers/AWSIotProvider.js");
|