@aws-amplify/api-graphql 2.3.3-unstable.1 → 2.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.
|
@@ -11110,10 +11110,135 @@ function (_super) {
|
|
|
11110
11110
|
|
|
11111
11111
|
/***/ }),
|
|
11112
11112
|
|
|
11113
|
-
/***/ "../pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js":
|
|
11114
|
-
|
|
11115
|
-
!*** ../pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js ***!
|
|
11116
|
-
|
|
11113
|
+
/***/ "../pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider/constants.js":
|
|
11114
|
+
/*!***************************************************************************!*\
|
|
11115
|
+
!*** ../pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider/constants.js ***!
|
|
11116
|
+
\***************************************************************************/
|
|
11117
|
+
/*! 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 */
|
|
11118
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
11119
|
+
|
|
11120
|
+
"use strict";
|
|
11121
|
+
__webpack_require__.r(__webpack_exports__);
|
|
11122
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MAX_DELAY_MS", function() { return MAX_DELAY_MS; });
|
|
11123
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NON_RETRYABLE_CODES", function() { return NON_RETRYABLE_CODES; });
|
|
11124
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MESSAGE_TYPES", function() { return MESSAGE_TYPES; });
|
|
11125
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SUBSCRIPTION_STATUS", function() { return SUBSCRIPTION_STATUS; });
|
|
11126
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SOCKET_STATUS", function() { return SOCKET_STATUS; });
|
|
11127
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AMPLIFY_SYMBOL", function() { return AMPLIFY_SYMBOL; });
|
|
11128
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AWS_APPSYNC_REALTIME_HEADERS", function() { return AWS_APPSYNC_REALTIME_HEADERS; });
|
|
11129
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CONNECTION_INIT_TIMEOUT", function() { return CONNECTION_INIT_TIMEOUT; });
|
|
11130
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "START_ACK_TIMEOUT", function() { return START_ACK_TIMEOUT; });
|
|
11131
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_KEEP_ALIVE_TIMEOUT", function() { return DEFAULT_KEEP_ALIVE_TIMEOUT; });
|
|
11132
|
+
var MAX_DELAY_MS = 5000;
|
|
11133
|
+
var NON_RETRYABLE_CODES = [400, 401, 403];
|
|
11134
|
+
var MESSAGE_TYPES;
|
|
11135
|
+
|
|
11136
|
+
(function (MESSAGE_TYPES) {
|
|
11137
|
+
/**
|
|
11138
|
+
* Client -> Server message.
|
|
11139
|
+
* This message type is the first message after handshake and this will initialize AWS AppSync RealTime communication
|
|
11140
|
+
*/
|
|
11141
|
+
MESSAGE_TYPES["GQL_CONNECTION_INIT"] = "connection_init";
|
|
11142
|
+
/**
|
|
11143
|
+
* Server -> Client message
|
|
11144
|
+
* This message type is in case there is an issue with AWS AppSync RealTime when establishing connection
|
|
11145
|
+
*/
|
|
11146
|
+
|
|
11147
|
+
MESSAGE_TYPES["GQL_CONNECTION_ERROR"] = "connection_error";
|
|
11148
|
+
/**
|
|
11149
|
+
* Server -> Client message.
|
|
11150
|
+
* This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message
|
|
11151
|
+
*/
|
|
11152
|
+
|
|
11153
|
+
MESSAGE_TYPES["GQL_CONNECTION_ACK"] = "connection_ack";
|
|
11154
|
+
/**
|
|
11155
|
+
* Client -> Server message.
|
|
11156
|
+
* This message type is for register subscriptions with AWS AppSync RealTime
|
|
11157
|
+
*/
|
|
11158
|
+
|
|
11159
|
+
MESSAGE_TYPES["GQL_START"] = "start";
|
|
11160
|
+
/**
|
|
11161
|
+
* Server -> Client message.
|
|
11162
|
+
* This message type is for the ack response from AWS AppSync RealTime for GQL_START message
|
|
11163
|
+
*/
|
|
11164
|
+
|
|
11165
|
+
MESSAGE_TYPES["GQL_START_ACK"] = "start_ack";
|
|
11166
|
+
/**
|
|
11167
|
+
* Server -> Client message.
|
|
11168
|
+
* This message type is for subscription message from AWS AppSync RealTime
|
|
11169
|
+
*/
|
|
11170
|
+
|
|
11171
|
+
MESSAGE_TYPES["GQL_DATA"] = "data";
|
|
11172
|
+
/**
|
|
11173
|
+
* Server -> Client message.
|
|
11174
|
+
* This message type helps the client to know is still receiving messages from AWS AppSync RealTime
|
|
11175
|
+
*/
|
|
11176
|
+
|
|
11177
|
+
MESSAGE_TYPES["GQL_CONNECTION_KEEP_ALIVE"] = "ka";
|
|
11178
|
+
/**
|
|
11179
|
+
* Client -> Server message.
|
|
11180
|
+
* This message type is for unregister subscriptions with AWS AppSync RealTime
|
|
11181
|
+
*/
|
|
11182
|
+
|
|
11183
|
+
MESSAGE_TYPES["GQL_STOP"] = "stop";
|
|
11184
|
+
/**
|
|
11185
|
+
* Server -> Client message.
|
|
11186
|
+
* This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message
|
|
11187
|
+
*/
|
|
11188
|
+
|
|
11189
|
+
MESSAGE_TYPES["GQL_COMPLETE"] = "complete";
|
|
11190
|
+
/**
|
|
11191
|
+
* Server -> Client message.
|
|
11192
|
+
* This message type is for sending error messages from AWS AppSync RealTime to the client
|
|
11193
|
+
*/
|
|
11194
|
+
|
|
11195
|
+
MESSAGE_TYPES["GQL_ERROR"] = "error";
|
|
11196
|
+
})(MESSAGE_TYPES || (MESSAGE_TYPES = {}));
|
|
11197
|
+
|
|
11198
|
+
var SUBSCRIPTION_STATUS;
|
|
11199
|
+
|
|
11200
|
+
(function (SUBSCRIPTION_STATUS) {
|
|
11201
|
+
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["PENDING"] = 0] = "PENDING";
|
|
11202
|
+
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["CONNECTED"] = 1] = "CONNECTED";
|
|
11203
|
+
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["FAILED"] = 2] = "FAILED";
|
|
11204
|
+
})(SUBSCRIPTION_STATUS || (SUBSCRIPTION_STATUS = {}));
|
|
11205
|
+
|
|
11206
|
+
var SOCKET_STATUS;
|
|
11207
|
+
|
|
11208
|
+
(function (SOCKET_STATUS) {
|
|
11209
|
+
SOCKET_STATUS[SOCKET_STATUS["CLOSED"] = 0] = "CLOSED";
|
|
11210
|
+
SOCKET_STATUS[SOCKET_STATUS["READY"] = 1] = "READY";
|
|
11211
|
+
SOCKET_STATUS[SOCKET_STATUS["CONNECTING"] = 2] = "CONNECTING";
|
|
11212
|
+
})(SOCKET_STATUS || (SOCKET_STATUS = {}));
|
|
11213
|
+
|
|
11214
|
+
var AMPLIFY_SYMBOL = typeof Symbol !== 'undefined' && typeof Symbol["for"] === 'function' ? Symbol["for"]('amplify_default') : '@@amplify_default';
|
|
11215
|
+
var AWS_APPSYNC_REALTIME_HEADERS = {
|
|
11216
|
+
accept: 'application/json, text/javascript',
|
|
11217
|
+
'content-encoding': 'amz-1.0',
|
|
11218
|
+
'content-type': 'application/json; charset=UTF-8'
|
|
11219
|
+
};
|
|
11220
|
+
/**
|
|
11221
|
+
* Time in milleseconds to wait for GQL_CONNECTION_INIT message
|
|
11222
|
+
*/
|
|
11223
|
+
|
|
11224
|
+
var CONNECTION_INIT_TIMEOUT = 15000;
|
|
11225
|
+
/**
|
|
11226
|
+
* Time in milleseconds to wait for GQL_START_ACK message
|
|
11227
|
+
*/
|
|
11228
|
+
|
|
11229
|
+
var START_ACK_TIMEOUT = 15000;
|
|
11230
|
+
/**
|
|
11231
|
+
* Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message
|
|
11232
|
+
*/
|
|
11233
|
+
|
|
11234
|
+
var DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;
|
|
11235
|
+
|
|
11236
|
+
/***/ }),
|
|
11237
|
+
|
|
11238
|
+
/***/ "../pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js":
|
|
11239
|
+
/*!***********************************************************************!*\
|
|
11240
|
+
!*** ../pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js ***!
|
|
11241
|
+
\***********************************************************************/
|
|
11117
11242
|
/*! exports provided: AWSAppSyncRealTimeProvider */
|
|
11118
11243
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
11119
11244
|
|
|
@@ -11135,8 +11260,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11135
11260
|
/* harmony import */ var _aws_amplify_cache__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_cache__WEBPACK_IMPORTED_MODULE_6__);
|
|
11136
11261
|
/* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @aws-amplify/auth */ "@aws-amplify/auth");
|
|
11137
11262
|
/* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_7__);
|
|
11138
|
-
/* harmony import */ var _PubSubProvider__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*!
|
|
11139
|
-
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*!
|
|
11263
|
+
/* harmony import */ var _PubSubProvider__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../PubSubProvider */ "../pubsub/lib-esm/Providers/PubSubProvider.js");
|
|
11264
|
+
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../index */ "../pubsub/lib-esm/index.js");
|
|
11265
|
+
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./constants */ "../pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider/constants.js");
|
|
11140
11266
|
var __extends = undefined && undefined.__extends || function () {
|
|
11141
11267
|
var _extendStatics = function extendStatics(d, b) {
|
|
11142
11268
|
_extendStatics = Object.setPrototypeOf || {
|
|
@@ -11372,119 +11498,17 @@ var __read = undefined && undefined.__read || function (o, n) {
|
|
|
11372
11498
|
|
|
11373
11499
|
|
|
11374
11500
|
|
|
11501
|
+
|
|
11375
11502
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["Logger"]('AWSAppSyncRealTimeProvider');
|
|
11376
|
-
var AMPLIFY_SYMBOL = typeof Symbol !== 'undefined' && typeof Symbol["for"] === 'function' ? Symbol["for"]('amplify_default') : '@@amplify_default';
|
|
11377
11503
|
|
|
11378
11504
|
var dispatchApiEvent = function dispatchApiEvent(event, data, message) {
|
|
11379
11505
|
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["Hub"].dispatch('api', {
|
|
11380
11506
|
event: event,
|
|
11381
11507
|
data: data,
|
|
11382
11508
|
message: message
|
|
11383
|
-
}, 'PubSub', AMPLIFY_SYMBOL);
|
|
11384
|
-
};
|
|
11385
|
-
|
|
11386
|
-
var MAX_DELAY_MS = 5000;
|
|
11387
|
-
var NON_RETRYABLE_CODES = [400, 401, 403];
|
|
11388
|
-
var MESSAGE_TYPES;
|
|
11389
|
-
|
|
11390
|
-
(function (MESSAGE_TYPES) {
|
|
11391
|
-
/**
|
|
11392
|
-
* Client -> Server message.
|
|
11393
|
-
* This message type is the first message after handshake and this will initialize AWS AppSync RealTime communication
|
|
11394
|
-
*/
|
|
11395
|
-
MESSAGE_TYPES["GQL_CONNECTION_INIT"] = "connection_init";
|
|
11396
|
-
/**
|
|
11397
|
-
* Server -> Client message
|
|
11398
|
-
* This message type is in case there is an issue with AWS AppSync RealTime when establishing connection
|
|
11399
|
-
*/
|
|
11400
|
-
|
|
11401
|
-
MESSAGE_TYPES["GQL_CONNECTION_ERROR"] = "connection_error";
|
|
11402
|
-
/**
|
|
11403
|
-
* Server -> Client message.
|
|
11404
|
-
* This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message
|
|
11405
|
-
*/
|
|
11406
|
-
|
|
11407
|
-
MESSAGE_TYPES["GQL_CONNECTION_ACK"] = "connection_ack";
|
|
11408
|
-
/**
|
|
11409
|
-
* Client -> Server message.
|
|
11410
|
-
* This message type is for register subscriptions with AWS AppSync RealTime
|
|
11411
|
-
*/
|
|
11412
|
-
|
|
11413
|
-
MESSAGE_TYPES["GQL_START"] = "start";
|
|
11414
|
-
/**
|
|
11415
|
-
* Server -> Client message.
|
|
11416
|
-
* This message type is for the ack response from AWS AppSync RealTime for GQL_START message
|
|
11417
|
-
*/
|
|
11418
|
-
|
|
11419
|
-
MESSAGE_TYPES["GQL_START_ACK"] = "start_ack";
|
|
11420
|
-
/**
|
|
11421
|
-
* Server -> Client message.
|
|
11422
|
-
* This message type is for subscription message from AWS AppSync RealTime
|
|
11423
|
-
*/
|
|
11424
|
-
|
|
11425
|
-
MESSAGE_TYPES["GQL_DATA"] = "data";
|
|
11426
|
-
/**
|
|
11427
|
-
* Server -> Client message.
|
|
11428
|
-
* This message type helps the client to know is still receiving messages from AWS AppSync RealTime
|
|
11429
|
-
*/
|
|
11430
|
-
|
|
11431
|
-
MESSAGE_TYPES["GQL_CONNECTION_KEEP_ALIVE"] = "ka";
|
|
11432
|
-
/**
|
|
11433
|
-
* Client -> Server message.
|
|
11434
|
-
* This message type is for unregister subscriptions with AWS AppSync RealTime
|
|
11435
|
-
*/
|
|
11436
|
-
|
|
11437
|
-
MESSAGE_TYPES["GQL_STOP"] = "stop";
|
|
11438
|
-
/**
|
|
11439
|
-
* Server -> Client message.
|
|
11440
|
-
* This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message
|
|
11441
|
-
*/
|
|
11442
|
-
|
|
11443
|
-
MESSAGE_TYPES["GQL_COMPLETE"] = "complete";
|
|
11444
|
-
/**
|
|
11445
|
-
* Server -> Client message.
|
|
11446
|
-
* This message type is for sending error messages from AWS AppSync RealTime to the client
|
|
11447
|
-
*/
|
|
11448
|
-
|
|
11449
|
-
MESSAGE_TYPES["GQL_ERROR"] = "error";
|
|
11450
|
-
})(MESSAGE_TYPES || (MESSAGE_TYPES = {}));
|
|
11451
|
-
|
|
11452
|
-
var SUBSCRIPTION_STATUS;
|
|
11453
|
-
|
|
11454
|
-
(function (SUBSCRIPTION_STATUS) {
|
|
11455
|
-
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["PENDING"] = 0] = "PENDING";
|
|
11456
|
-
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["CONNECTED"] = 1] = "CONNECTED";
|
|
11457
|
-
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["FAILED"] = 2] = "FAILED";
|
|
11458
|
-
})(SUBSCRIPTION_STATUS || (SUBSCRIPTION_STATUS = {}));
|
|
11459
|
-
|
|
11460
|
-
var SOCKET_STATUS;
|
|
11461
|
-
|
|
11462
|
-
(function (SOCKET_STATUS) {
|
|
11463
|
-
SOCKET_STATUS[SOCKET_STATUS["CLOSED"] = 0] = "CLOSED";
|
|
11464
|
-
SOCKET_STATUS[SOCKET_STATUS["READY"] = 1] = "READY";
|
|
11465
|
-
SOCKET_STATUS[SOCKET_STATUS["CONNECTING"] = 2] = "CONNECTING";
|
|
11466
|
-
})(SOCKET_STATUS || (SOCKET_STATUS = {}));
|
|
11467
|
-
|
|
11468
|
-
var AWS_APPSYNC_REALTIME_HEADERS = {
|
|
11469
|
-
accept: 'application/json, text/javascript',
|
|
11470
|
-
'content-encoding': 'amz-1.0',
|
|
11471
|
-
'content-type': 'application/json; charset=UTF-8'
|
|
11509
|
+
}, 'PubSub', _constants__WEBPACK_IMPORTED_MODULE_10__["AMPLIFY_SYMBOL"]);
|
|
11472
11510
|
};
|
|
11473
|
-
/**
|
|
11474
|
-
* Time in milleseconds to wait for GQL_CONNECTION_INIT message
|
|
11475
|
-
*/
|
|
11476
11511
|
|
|
11477
|
-
var CONNECTION_INIT_TIMEOUT = 15000;
|
|
11478
|
-
/**
|
|
11479
|
-
* Time in milleseconds to wait for GQL_START_ACK message
|
|
11480
|
-
*/
|
|
11481
|
-
|
|
11482
|
-
var START_ACK_TIMEOUT = 15000;
|
|
11483
|
-
/**
|
|
11484
|
-
* Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message
|
|
11485
|
-
*/
|
|
11486
|
-
|
|
11487
|
-
var DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;
|
|
11488
11512
|
var standardDomainPattern = /^https:\/\/\w{26}\.appsync\-api\.\w{2}(?:(?:\-\w{2,})+)\-\d\.amazonaws.com\/graphql$/i;
|
|
11489
11513
|
var customDomainPath = '/realtime';
|
|
11490
11514
|
|
|
@@ -11496,13 +11520,17 @@ function (_super) {
|
|
|
11496
11520
|
function AWSAppSyncRealTimeProvider() {
|
|
11497
11521
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
11498
11522
|
|
|
11499
|
-
_this.socketStatus = SOCKET_STATUS.CLOSED;
|
|
11500
|
-
_this.keepAliveTimeout = DEFAULT_KEEP_ALIVE_TIMEOUT;
|
|
11523
|
+
_this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
11524
|
+
_this.keepAliveTimeout = _constants__WEBPACK_IMPORTED_MODULE_10__["DEFAULT_KEEP_ALIVE_TIMEOUT"];
|
|
11501
11525
|
_this.subscriptionObserverMap = new Map();
|
|
11502
11526
|
_this.promiseArray = [];
|
|
11503
11527
|
return _this;
|
|
11504
11528
|
}
|
|
11505
11529
|
|
|
11530
|
+
AWSAppSyncRealTimeProvider.prototype.getNewWebSocket = function (url, protocol) {
|
|
11531
|
+
return new WebSocket(url, protocol);
|
|
11532
|
+
};
|
|
11533
|
+
|
|
11506
11534
|
AWSAppSyncRealTimeProvider.prototype.getProviderName = function () {
|
|
11507
11535
|
return 'AWSAppSyncRealTimeProvider';
|
|
11508
11536
|
};
|
|
@@ -11574,7 +11602,7 @@ function (_super) {
|
|
|
11574
11602
|
];
|
|
11575
11603
|
}
|
|
11576
11604
|
|
|
11577
|
-
if (subscriptionState === SUBSCRIPTION_STATUS.CONNECTED) {
|
|
11605
|
+
if (subscriptionState === _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].CONNECTED) {
|
|
11578
11606
|
this._sendUnsubscriptionMessage(subscriptionId_1);
|
|
11579
11607
|
} else {
|
|
11580
11608
|
throw new Error('Subscription never connected');
|
|
@@ -11638,7 +11666,7 @@ function (_super) {
|
|
|
11638
11666
|
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 () {
|
|
11639
11667
|
return {};
|
|
11640
11668
|
} : _d, _e = options.additionalHeaders, additionalHeaders = _e === void 0 ? {} : _e;
|
|
11641
|
-
subscriptionState = SUBSCRIPTION_STATUS.PENDING;
|
|
11669
|
+
subscriptionState = _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].PENDING;
|
|
11642
11670
|
data = {
|
|
11643
11671
|
query: query,
|
|
11644
11672
|
variables: variables
|
|
@@ -11681,7 +11709,7 @@ function (_super) {
|
|
|
11681
11709
|
authorization: __assign({}, headerObj)
|
|
11682
11710
|
}
|
|
11683
11711
|
},
|
|
11684
|
-
type: MESSAGE_TYPES.GQL_START
|
|
11712
|
+
type: _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_START
|
|
11685
11713
|
};
|
|
11686
11714
|
stringToAWSRealTime = JSON.stringify(subscriptionMessage);
|
|
11687
11715
|
_k.label = 3;
|
|
@@ -11738,7 +11766,7 @@ function (_super) {
|
|
|
11738
11766
|
subscriptionFailedCallback: subscriptionFailedCallback,
|
|
11739
11767
|
startAckTimeoutId: setTimeout(function () {
|
|
11740
11768
|
_this._timeoutStartSubscriptionAck.call(_this, subscriptionId);
|
|
11741
|
-
}, START_ACK_TIMEOUT)
|
|
11769
|
+
}, _constants__WEBPACK_IMPORTED_MODULE_10__["START_ACK_TIMEOUT"])
|
|
11742
11770
|
});
|
|
11743
11771
|
|
|
11744
11772
|
if (this.awsRealTimeSocket) {
|
|
@@ -11766,7 +11794,7 @@ function (_super) {
|
|
|
11766
11794
|
if (subscriptionObserver) {
|
|
11767
11795
|
subscriptionState = subscriptionObserver.subscriptionState; // This in case unsubscribe is invoked before sending start subscription message
|
|
11768
11796
|
|
|
11769
|
-
if (subscriptionState === SUBSCRIPTION_STATUS.PENDING) {
|
|
11797
|
+
if (subscriptionState === _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].PENDING) {
|
|
11770
11798
|
return [2
|
|
11771
11799
|
/*return*/
|
|
11772
11800
|
, new Promise(function (res, rej) {
|
|
@@ -11796,11 +11824,11 @@ function (_super) {
|
|
|
11796
11824
|
|
|
11797
11825
|
AWSAppSyncRealTimeProvider.prototype._sendUnsubscriptionMessage = function (subscriptionId) {
|
|
11798
11826
|
try {
|
|
11799
|
-
if (this.awsRealTimeSocket && this.awsRealTimeSocket.readyState === WebSocket.OPEN && this.socketStatus === SOCKET_STATUS.READY) {
|
|
11827
|
+
if (this.awsRealTimeSocket && this.awsRealTimeSocket.readyState === WebSocket.OPEN && this.socketStatus === _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].READY) {
|
|
11800
11828
|
// Preparing unsubscribe message to stop receiving messages for that subscription
|
|
11801
11829
|
var unsubscribeMessage = {
|
|
11802
11830
|
id: subscriptionId,
|
|
11803
|
-
type: MESSAGE_TYPES.GQL_STOP
|
|
11831
|
+
type: _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_STOP
|
|
11804
11832
|
};
|
|
11805
11833
|
var stringToAWSRealTime = JSON.stringify(unsubscribeMessage);
|
|
11806
11834
|
this.awsRealTimeSocket.send(stringToAWSRealTime);
|
|
@@ -11826,7 +11854,7 @@ function (_super) {
|
|
|
11826
11854
|
}
|
|
11827
11855
|
|
|
11828
11856
|
if (!this.awsRealTimeSocket) {
|
|
11829
|
-
this.socketStatus = SOCKET_STATUS.CLOSED;
|
|
11857
|
+
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
11830
11858
|
return;
|
|
11831
11859
|
}
|
|
11832
11860
|
|
|
@@ -11842,7 +11870,7 @@ function (_super) {
|
|
|
11842
11870
|
tempSocket.onerror = null;
|
|
11843
11871
|
tempSocket.close(1000);
|
|
11844
11872
|
this.awsRealTimeSocket = undefined;
|
|
11845
|
-
this.socketStatus = SOCKET_STATUS.CLOSED;
|
|
11873
|
+
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
11846
11874
|
}
|
|
11847
11875
|
};
|
|
11848
11876
|
|
|
@@ -11873,7 +11901,7 @@ function (_super) {
|
|
|
11873
11901
|
variables: variables
|
|
11874
11902
|
});
|
|
11875
11903
|
|
|
11876
|
-
if (type === MESSAGE_TYPES.GQL_DATA && payload && payload.data) {
|
|
11904
|
+
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_DATA && payload && payload.data) {
|
|
11877
11905
|
if (observer) {
|
|
11878
11906
|
observer.next(payload);
|
|
11879
11907
|
} else {
|
|
@@ -11883,7 +11911,7 @@ function (_super) {
|
|
|
11883
11911
|
return;
|
|
11884
11912
|
}
|
|
11885
11913
|
|
|
11886
|
-
if (type === MESSAGE_TYPES.GQL_START_ACK) {
|
|
11914
|
+
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_START_ACK) {
|
|
11887
11915
|
logger.debug("subscription ready for " + JSON.stringify({
|
|
11888
11916
|
query: query,
|
|
11889
11917
|
variables: variables
|
|
@@ -11898,7 +11926,7 @@ function (_super) {
|
|
|
11898
11926
|
query: query,
|
|
11899
11927
|
variables: variables
|
|
11900
11928
|
}, 'Connection established for subscription');
|
|
11901
|
-
var subscriptionState = SUBSCRIPTION_STATUS.CONNECTED;
|
|
11929
|
+
var subscriptionState = _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].CONNECTED;
|
|
11902
11930
|
|
|
11903
11931
|
if (observer) {
|
|
11904
11932
|
this.subscriptionObserverMap.set(id, {
|
|
@@ -11916,14 +11944,14 @@ function (_super) {
|
|
|
11916
11944
|
return;
|
|
11917
11945
|
}
|
|
11918
11946
|
|
|
11919
|
-
if (type === MESSAGE_TYPES.GQL_CONNECTION_KEEP_ALIVE) {
|
|
11947
|
+
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_CONNECTION_KEEP_ALIVE) {
|
|
11920
11948
|
if (this.keepAliveTimeoutId) clearTimeout(this.keepAliveTimeoutId);
|
|
11921
11949
|
this.keepAliveTimeoutId = setTimeout(this._errorDisconnect.bind(this, _index__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].TIMEOUT_DISCONNECT), this.keepAliveTimeout);
|
|
11922
11950
|
return;
|
|
11923
11951
|
}
|
|
11924
11952
|
|
|
11925
|
-
if (type === MESSAGE_TYPES.GQL_ERROR) {
|
|
11926
|
-
var subscriptionState = SUBSCRIPTION_STATUS.FAILED;
|
|
11953
|
+
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_ERROR) {
|
|
11954
|
+
var subscriptionState = _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].FAILED;
|
|
11927
11955
|
|
|
11928
11956
|
if (observer) {
|
|
11929
11957
|
this.subscriptionObserverMap.set(id, {
|
|
@@ -11965,7 +11993,7 @@ function (_super) {
|
|
|
11965
11993
|
this.awsRealTimeSocket.close();
|
|
11966
11994
|
}
|
|
11967
11995
|
|
|
11968
|
-
this.socketStatus = SOCKET_STATUS.CLOSED;
|
|
11996
|
+
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
11969
11997
|
};
|
|
11970
11998
|
|
|
11971
11999
|
AWSAppSyncRealTimeProvider.prototype._timeoutStartSubscriptionAck = function (subscriptionId) {
|
|
@@ -11984,7 +12012,7 @@ function (_super) {
|
|
|
11984
12012
|
observer: observer,
|
|
11985
12013
|
query: query,
|
|
11986
12014
|
variables: variables,
|
|
11987
|
-
subscriptionState: SUBSCRIPTION_STATUS.FAILED
|
|
12015
|
+
subscriptionState: _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].FAILED
|
|
11988
12016
|
});
|
|
11989
12017
|
|
|
11990
12018
|
if (observer && !observer.closed) {
|
|
@@ -12014,7 +12042,7 @@ function (_super) {
|
|
|
12014
12042
|
region = _a.region,
|
|
12015
12043
|
additionalHeaders = _a.additionalHeaders;
|
|
12016
12044
|
|
|
12017
|
-
if (this.socketStatus === SOCKET_STATUS.READY) {
|
|
12045
|
+
if (this.socketStatus === _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].READY) {
|
|
12018
12046
|
return;
|
|
12019
12047
|
}
|
|
12020
12048
|
|
|
@@ -12029,7 +12057,7 @@ function (_super) {
|
|
|
12029
12057
|
res: res,
|
|
12030
12058
|
rej: rej
|
|
12031
12059
|
});
|
|
12032
|
-
if (!(this.socketStatus === SOCKET_STATUS.CLOSED)) return [3
|
|
12060
|
+
if (!(this.socketStatus === _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED)) return [3
|
|
12033
12061
|
/*break*/
|
|
12034
12062
|
, 5];
|
|
12035
12063
|
_c.label = 1;
|
|
@@ -12037,7 +12065,7 @@ function (_super) {
|
|
|
12037
12065
|
case 1:
|
|
12038
12066
|
_c.trys.push([1, 4,, 5]);
|
|
12039
12067
|
|
|
12040
|
-
this.socketStatus = SOCKET_STATUS.CONNECTING;
|
|
12068
|
+
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CONNECTING;
|
|
12041
12069
|
payloadString = '{}';
|
|
12042
12070
|
_b = (_a = JSON).stringify;
|
|
12043
12071
|
return [4
|
|
@@ -12079,7 +12107,7 @@ function (_super) {
|
|
|
12079
12107
|
logger.debug('Notifying connection successful');
|
|
12080
12108
|
res();
|
|
12081
12109
|
});
|
|
12082
|
-
this.socketStatus = SOCKET_STATUS.READY;
|
|
12110
|
+
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].READY;
|
|
12083
12111
|
this.promiseArray = [];
|
|
12084
12112
|
return [3
|
|
12085
12113
|
/*break*/
|
|
@@ -12098,7 +12126,7 @@ function (_super) {
|
|
|
12098
12126
|
}
|
|
12099
12127
|
|
|
12100
12128
|
this.awsRealTimeSocket = undefined;
|
|
12101
|
-
this.socketStatus = SOCKET_STATUS.CLOSED;
|
|
12129
|
+
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
12102
12130
|
return [3
|
|
12103
12131
|
/*break*/
|
|
12104
12132
|
, 5];
|
|
@@ -12121,7 +12149,7 @@ function (_super) {
|
|
|
12121
12149
|
logger.debug("Initializaling retryable Handshake");
|
|
12122
12150
|
return [4
|
|
12123
12151
|
/*yield*/
|
|
12124
|
-
, Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["jitteredExponentialRetry"])(this._initializeHandshake.bind(this), [awsRealTimeUrl], MAX_DELAY_MS)];
|
|
12152
|
+
, Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["jitteredExponentialRetry"])(this._initializeHandshake.bind(this), [awsRealTimeUrl], _constants__WEBPACK_IMPORTED_MODULE_10__["MAX_DELAY_MS"])];
|
|
12125
12153
|
|
|
12126
12154
|
case 1:
|
|
12127
12155
|
_a.sent();
|
|
@@ -12153,7 +12181,7 @@ function (_super) {
|
|
|
12153
12181
|
/*yield*/
|
|
12154
12182
|
, function () {
|
|
12155
12183
|
return new Promise(function (res, rej) {
|
|
12156
|
-
var newSocket =
|
|
12184
|
+
var newSocket = _this.getNewWebSocket(awsRealTimeUrl, 'graphql-ws');
|
|
12157
12185
|
|
|
12158
12186
|
newSocket.onerror = function () {
|
|
12159
12187
|
logger.debug("WebSocket connection error");
|
|
@@ -12196,9 +12224,9 @@ function (_super) {
|
|
|
12196
12224
|
var type = data.type,
|
|
12197
12225
|
_a = data.payload,
|
|
12198
12226
|
_b = (_a === void 0 ? {} : _a).connectionTimeoutMs,
|
|
12199
|
-
connectionTimeoutMs = _b === void 0 ? DEFAULT_KEEP_ALIVE_TIMEOUT : _b;
|
|
12227
|
+
connectionTimeoutMs = _b === void 0 ? _constants__WEBPACK_IMPORTED_MODULE_10__["DEFAULT_KEEP_ALIVE_TIMEOUT"] : _b;
|
|
12200
12228
|
|
|
12201
|
-
if (type === MESSAGE_TYPES.GQL_CONNECTION_ACK) {
|
|
12229
|
+
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_CONNECTION_ACK) {
|
|
12202
12230
|
ackOk_1 = true;
|
|
12203
12231
|
|
|
12204
12232
|
if (_this.awsRealTimeSocket) {
|
|
@@ -12222,7 +12250,7 @@ function (_super) {
|
|
|
12222
12250
|
return;
|
|
12223
12251
|
}
|
|
12224
12252
|
|
|
12225
|
-
if (type === MESSAGE_TYPES.GQL_CONNECTION_ERROR) {
|
|
12253
|
+
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_CONNECTION_ERROR) {
|
|
12226
12254
|
var _c = data.payload,
|
|
12227
12255
|
_d = (_c === void 0 ? {} : _c).errors,
|
|
12228
12256
|
_e = __read(_d === void 0 ? [] : _d, 1),
|
|
@@ -12241,17 +12269,17 @@ function (_super) {
|
|
|
12241
12269
|
};
|
|
12242
12270
|
|
|
12243
12271
|
var gqlInit = {
|
|
12244
|
-
type: MESSAGE_TYPES.GQL_CONNECTION_INIT
|
|
12272
|
+
type: _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_CONNECTION_INIT
|
|
12245
12273
|
};
|
|
12246
12274
|
|
|
12247
12275
|
_this.awsRealTimeSocket.send(JSON.stringify(gqlInit));
|
|
12248
12276
|
|
|
12249
|
-
setTimeout(checkAckOk.bind(_this, ackOk_1), CONNECTION_INIT_TIMEOUT);
|
|
12277
|
+
setTimeout(checkAckOk.bind(_this, ackOk_1), _constants__WEBPACK_IMPORTED_MODULE_10__["CONNECTION_INIT_TIMEOUT"]);
|
|
12250
12278
|
}
|
|
12251
12279
|
|
|
12252
12280
|
function checkAckOk(ackOk) {
|
|
12253
12281
|
if (!ackOk) {
|
|
12254
|
-
rej(new Error("Connection timeout: ack from AWSRealTime was not received on " + CONNECTION_INIT_TIMEOUT + " ms"));
|
|
12282
|
+
rej(new Error("Connection timeout: ack from AWSRealTime was not received on " + _constants__WEBPACK_IMPORTED_MODULE_10__["CONNECTION_INIT_TIMEOUT"] + " ms"));
|
|
12255
12283
|
}
|
|
12256
12284
|
}
|
|
12257
12285
|
});
|
|
@@ -12269,7 +12297,7 @@ function (_super) {
|
|
|
12269
12297
|
err_4 = _b.sent();
|
|
12270
12298
|
_a = err_4, errorType = _a.errorType, errorCode = _a.errorCode;
|
|
12271
12299
|
|
|
12272
|
-
if (NON_RETRYABLE_CODES.includes(errorCode)) {
|
|
12300
|
+
if (_constants__WEBPACK_IMPORTED_MODULE_10__["NON_RETRYABLE_CODES"].includes(errorCode)) {
|
|
12273
12301
|
throw new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["NonRetryableError"](errorType);
|
|
12274
12302
|
} else if (errorType) {
|
|
12275
12303
|
throw new Error(errorType);
|
|
@@ -12321,6 +12349,7 @@ function (_super) {
|
|
|
12321
12349
|
case 1:
|
|
12322
12350
|
handler = headerHandler[authenticationType];
|
|
12323
12351
|
host = url__WEBPACK_IMPORTED_MODULE_2__["parse"](appSyncGraphqlEndpoint !== null && appSyncGraphqlEndpoint !== void 0 ? appSyncGraphqlEndpoint : '').host;
|
|
12352
|
+
logger.debug("Authenticating with " + authenticationType);
|
|
12324
12353
|
return [4
|
|
12325
12354
|
/*yield*/
|
|
12326
12355
|
, handler({
|
|
@@ -12482,7 +12511,7 @@ function (_super) {
|
|
|
12482
12511
|
url: "" + appSyncGraphqlEndpoint + canonicalUri,
|
|
12483
12512
|
data: payload,
|
|
12484
12513
|
method: 'POST',
|
|
12485
|
-
headers: __assign({}, AWS_APPSYNC_REALTIME_HEADERS)
|
|
12514
|
+
headers: __assign({}, _constants__WEBPACK_IMPORTED_MODULE_10__["AWS_APPSYNC_REALTIME_HEADERS"])
|
|
12486
12515
|
};
|
|
12487
12516
|
signed_params = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["Signer"].sign(request, creds, endpointInfo);
|
|
12488
12517
|
return [2
|
|
@@ -13606,7 +13635,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13606
13635
|
/* harmony import */ var _AWSAppSyncProvider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AWSAppSyncProvider */ "../pubsub/lib-esm/Providers/AWSAppSyncProvider.js");
|
|
13607
13636
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AWSAppSyncProvider", function() { return _AWSAppSyncProvider__WEBPACK_IMPORTED_MODULE_1__["AWSAppSyncProvider"]; });
|
|
13608
13637
|
|
|
13609
|
-
/* harmony import */ var _AWSAppSyncRealTimeProvider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./AWSAppSyncRealTimeProvider */ "../pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js");
|
|
13638
|
+
/* harmony import */ var _AWSAppSyncRealTimeProvider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./AWSAppSyncRealTimeProvider */ "../pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js");
|
|
13610
13639
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AWSAppSyncRealTimeProvider", function() { return _AWSAppSyncRealTimeProvider__WEBPACK_IMPORTED_MODULE_2__["AWSAppSyncRealTimeProvider"]; });
|
|
13611
13640
|
|
|
13612
13641
|
/* harmony import */ var _AWSIotProvider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./AWSIotProvider */ "../pubsub/lib-esm/Providers/AWSIotProvider.js");
|