@aws-amplify/api-graphql 2.2.10-in-app-messaging.62 → 2.2.10-in-app-messaging.70
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 +130 -0
- package/dist/aws-amplify-api-graphql.js +1030 -484
- package/dist/aws-amplify-api-graphql.js.map +1 -1
- package/dist/aws-amplify-api-graphql.min.js +3 -3
- package/dist/aws-amplify-api-graphql.min.js.map +1 -1
- package/lib/GraphQLAPI.d.ts +16 -8
- package/lib/GraphQLAPI.js +19 -9
- package/lib/GraphQLAPI.js.map +1 -1
- package/lib/types/index.d.ts +10 -9
- package/lib/types/index.js +2 -8
- package/lib/types/index.js.map +1 -1
- package/lib-esm/GraphQLAPI.d.ts +16 -8
- package/lib-esm/GraphQLAPI.js +21 -11
- package/lib-esm/GraphQLAPI.js.map +1 -1
- package/lib-esm/types/index.d.ts +10 -9
- package/lib-esm/types/index.js +2 -8
- package/lib-esm/types/index.js.map +1 -1
- package/package.json +7 -7
- package/src/GraphQLAPI.ts +47 -28
- package/src/types/index.ts +11 -11
|
@@ -125,12 +125,24 @@ var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "../../node
|
|
|
125
125
|
var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "../../node_modules/axios/lib/helpers/parseHeaders.js");
|
|
126
126
|
var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "../../node_modules/axios/lib/helpers/isURLSameOrigin.js");
|
|
127
127
|
var createError = __webpack_require__(/*! ../core/createError */ "../../node_modules/axios/lib/core/createError.js");
|
|
128
|
+
var defaults = __webpack_require__(/*! ../defaults */ "../../node_modules/axios/lib/defaults.js");
|
|
129
|
+
var Cancel = __webpack_require__(/*! ../cancel/Cancel */ "../../node_modules/axios/lib/cancel/Cancel.js");
|
|
128
130
|
|
|
129
131
|
module.exports = function xhrAdapter(config) {
|
|
130
132
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
131
133
|
var requestData = config.data;
|
|
132
134
|
var requestHeaders = config.headers;
|
|
133
135
|
var responseType = config.responseType;
|
|
136
|
+
var onCanceled;
|
|
137
|
+
function done() {
|
|
138
|
+
if (config.cancelToken) {
|
|
139
|
+
config.cancelToken.unsubscribe(onCanceled);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (config.signal) {
|
|
143
|
+
config.signal.removeEventListener('abort', onCanceled);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
134
146
|
|
|
135
147
|
if (utils.isFormData(requestData)) {
|
|
136
148
|
delete requestHeaders['Content-Type']; // Let the browser set it
|
|
@@ -168,7 +180,13 @@ module.exports = function xhrAdapter(config) {
|
|
|
168
180
|
request: request
|
|
169
181
|
};
|
|
170
182
|
|
|
171
|
-
settle(
|
|
183
|
+
settle(function _resolve(value) {
|
|
184
|
+
resolve(value);
|
|
185
|
+
done();
|
|
186
|
+
}, function _reject(err) {
|
|
187
|
+
reject(err);
|
|
188
|
+
done();
|
|
189
|
+
}, response);
|
|
172
190
|
|
|
173
191
|
// Clean up request
|
|
174
192
|
request = null;
|
|
@@ -221,14 +239,15 @@ module.exports = function xhrAdapter(config) {
|
|
|
221
239
|
|
|
222
240
|
// Handle timeout
|
|
223
241
|
request.ontimeout = function handleTimeout() {
|
|
224
|
-
var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
|
|
242
|
+
var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
243
|
+
var transitional = config.transitional || defaults.transitional;
|
|
225
244
|
if (config.timeoutErrorMessage) {
|
|
226
245
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
227
246
|
}
|
|
228
247
|
reject(createError(
|
|
229
248
|
timeoutErrorMessage,
|
|
230
249
|
config,
|
|
231
|
-
|
|
250
|
+
transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
|
|
232
251
|
request));
|
|
233
252
|
|
|
234
253
|
// Clean up request
|
|
@@ -282,18 +301,22 @@ module.exports = function xhrAdapter(config) {
|
|
|
282
301
|
request.upload.addEventListener('progress', config.onUploadProgress);
|
|
283
302
|
}
|
|
284
303
|
|
|
285
|
-
if (config.cancelToken) {
|
|
304
|
+
if (config.cancelToken || config.signal) {
|
|
286
305
|
// Handle cancellation
|
|
287
|
-
|
|
306
|
+
// eslint-disable-next-line func-names
|
|
307
|
+
onCanceled = function(cancel) {
|
|
288
308
|
if (!request) {
|
|
289
309
|
return;
|
|
290
310
|
}
|
|
291
|
-
|
|
311
|
+
reject(!cancel || (cancel && cancel.type) ? new Cancel('canceled') : cancel);
|
|
292
312
|
request.abort();
|
|
293
|
-
reject(cancel);
|
|
294
|
-
// Clean up request
|
|
295
313
|
request = null;
|
|
296
|
-
}
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
|
317
|
+
if (config.signal) {
|
|
318
|
+
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
|
319
|
+
}
|
|
297
320
|
}
|
|
298
321
|
|
|
299
322
|
if (!requestData) {
|
|
@@ -340,6 +363,11 @@ function createInstance(defaultConfig) {
|
|
|
340
363
|
// Copy context to instance
|
|
341
364
|
utils.extend(instance, context);
|
|
342
365
|
|
|
366
|
+
// Factory for creating new instances
|
|
367
|
+
instance.create = function create(instanceConfig) {
|
|
368
|
+
return createInstance(mergeConfig(defaultConfig, instanceConfig));
|
|
369
|
+
};
|
|
370
|
+
|
|
343
371
|
return instance;
|
|
344
372
|
}
|
|
345
373
|
|
|
@@ -349,15 +377,11 @@ var axios = createInstance(defaults);
|
|
|
349
377
|
// Expose Axios class to allow class inheritance
|
|
350
378
|
axios.Axios = Axios;
|
|
351
379
|
|
|
352
|
-
// Factory for creating new instances
|
|
353
|
-
axios.create = function create(instanceConfig) {
|
|
354
|
-
return createInstance(mergeConfig(axios.defaults, instanceConfig));
|
|
355
|
-
};
|
|
356
|
-
|
|
357
380
|
// Expose Cancel & CancelToken
|
|
358
381
|
axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "../../node_modules/axios/lib/cancel/Cancel.js");
|
|
359
382
|
axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "../../node_modules/axios/lib/cancel/CancelToken.js");
|
|
360
383
|
axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "../../node_modules/axios/lib/cancel/isCancel.js");
|
|
384
|
+
axios.VERSION = __webpack_require__(/*! ./env/data */ "../../node_modules/axios/lib/env/data.js").version;
|
|
361
385
|
|
|
362
386
|
// Expose all/spread
|
|
363
387
|
axios.all = function all(promises) {
|
|
@@ -431,11 +455,42 @@ function CancelToken(executor) {
|
|
|
431
455
|
}
|
|
432
456
|
|
|
433
457
|
var resolvePromise;
|
|
458
|
+
|
|
434
459
|
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
435
460
|
resolvePromise = resolve;
|
|
436
461
|
});
|
|
437
462
|
|
|
438
463
|
var token = this;
|
|
464
|
+
|
|
465
|
+
// eslint-disable-next-line func-names
|
|
466
|
+
this.promise.then(function(cancel) {
|
|
467
|
+
if (!token._listeners) return;
|
|
468
|
+
|
|
469
|
+
var i;
|
|
470
|
+
var l = token._listeners.length;
|
|
471
|
+
|
|
472
|
+
for (i = 0; i < l; i++) {
|
|
473
|
+
token._listeners[i](cancel);
|
|
474
|
+
}
|
|
475
|
+
token._listeners = null;
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
// eslint-disable-next-line func-names
|
|
479
|
+
this.promise.then = function(onfulfilled) {
|
|
480
|
+
var _resolve;
|
|
481
|
+
// eslint-disable-next-line func-names
|
|
482
|
+
var promise = new Promise(function(resolve) {
|
|
483
|
+
token.subscribe(resolve);
|
|
484
|
+
_resolve = resolve;
|
|
485
|
+
}).then(onfulfilled);
|
|
486
|
+
|
|
487
|
+
promise.cancel = function reject() {
|
|
488
|
+
token.unsubscribe(_resolve);
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
return promise;
|
|
492
|
+
};
|
|
493
|
+
|
|
439
494
|
executor(function cancel(message) {
|
|
440
495
|
if (token.reason) {
|
|
441
496
|
// Cancellation has already been requested
|
|
@@ -456,6 +511,37 @@ CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
|
|
456
511
|
}
|
|
457
512
|
};
|
|
458
513
|
|
|
514
|
+
/**
|
|
515
|
+
* Subscribe to the cancel signal
|
|
516
|
+
*/
|
|
517
|
+
|
|
518
|
+
CancelToken.prototype.subscribe = function subscribe(listener) {
|
|
519
|
+
if (this.reason) {
|
|
520
|
+
listener(this.reason);
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
if (this._listeners) {
|
|
525
|
+
this._listeners.push(listener);
|
|
526
|
+
} else {
|
|
527
|
+
this._listeners = [listener];
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Unsubscribe from the cancel signal
|
|
533
|
+
*/
|
|
534
|
+
|
|
535
|
+
CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
|
|
536
|
+
if (!this._listeners) {
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
var index = this._listeners.indexOf(listener);
|
|
540
|
+
if (index !== -1) {
|
|
541
|
+
this._listeners.splice(index, 1);
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
|
|
459
545
|
/**
|
|
460
546
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
461
547
|
* cancels the `CancelToken`.
|
|
@@ -529,14 +615,14 @@ function Axios(instanceConfig) {
|
|
|
529
615
|
*
|
|
530
616
|
* @param {Object} config The config specific for this request (merged with this.defaults)
|
|
531
617
|
*/
|
|
532
|
-
Axios.prototype.request = function request(config) {
|
|
618
|
+
Axios.prototype.request = function request(configOrUrl, config) {
|
|
533
619
|
/*eslint no-param-reassign:0*/
|
|
534
620
|
// Allow for axios('example/url'[, config]) a la fetch API
|
|
535
|
-
if (typeof
|
|
536
|
-
config = arguments[1] || {};
|
|
537
|
-
config.url = arguments[0];
|
|
538
|
-
} else {
|
|
621
|
+
if (typeof configOrUrl === 'string') {
|
|
539
622
|
config = config || {};
|
|
623
|
+
config.url = configOrUrl;
|
|
624
|
+
} else {
|
|
625
|
+
config = configOrUrl || {};
|
|
540
626
|
}
|
|
541
627
|
|
|
542
628
|
config = mergeConfig(this.defaults, config);
|
|
@@ -554,9 +640,9 @@ Axios.prototype.request = function request(config) {
|
|
|
554
640
|
|
|
555
641
|
if (transitional !== undefined) {
|
|
556
642
|
validator.assertOptions(transitional, {
|
|
557
|
-
silentJSONParsing: validators.transitional(validators.boolean
|
|
558
|
-
forcedJSONParsing: validators.transitional(validators.boolean
|
|
559
|
-
clarifyTimeoutError: validators.transitional(validators.boolean
|
|
643
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
644
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
645
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
560
646
|
}, false);
|
|
561
647
|
}
|
|
562
648
|
|
|
@@ -795,6 +881,7 @@ var utils = __webpack_require__(/*! ./../utils */ "../../node_modules/axios/lib/
|
|
|
795
881
|
var transformData = __webpack_require__(/*! ./transformData */ "../../node_modules/axios/lib/core/transformData.js");
|
|
796
882
|
var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "../../node_modules/axios/lib/cancel/isCancel.js");
|
|
797
883
|
var defaults = __webpack_require__(/*! ../defaults */ "../../node_modules/axios/lib/defaults.js");
|
|
884
|
+
var Cancel = __webpack_require__(/*! ../cancel/Cancel */ "../../node_modules/axios/lib/cancel/Cancel.js");
|
|
798
885
|
|
|
799
886
|
/**
|
|
800
887
|
* Throws a `Cancel` if cancellation has been requested.
|
|
@@ -803,6 +890,10 @@ function throwIfCancellationRequested(config) {
|
|
|
803
890
|
if (config.cancelToken) {
|
|
804
891
|
config.cancelToken.throwIfRequested();
|
|
805
892
|
}
|
|
893
|
+
|
|
894
|
+
if (config.signal && config.signal.aborted) {
|
|
895
|
+
throw new Cancel('canceled');
|
|
896
|
+
}
|
|
806
897
|
}
|
|
807
898
|
|
|
808
899
|
/**
|
|
@@ -920,7 +1011,8 @@ module.exports = function enhanceError(error, config, code, request, response) {
|
|
|
920
1011
|
stack: this.stack,
|
|
921
1012
|
// Axios
|
|
922
1013
|
config: this.config,
|
|
923
|
-
code: this.code
|
|
1014
|
+
code: this.code,
|
|
1015
|
+
status: this.response && this.response.status ? this.response.status : null
|
|
924
1016
|
};
|
|
925
1017
|
};
|
|
926
1018
|
return error;
|
|
@@ -954,17 +1046,6 @@ module.exports = function mergeConfig(config1, config2) {
|
|
|
954
1046
|
config2 = config2 || {};
|
|
955
1047
|
var config = {};
|
|
956
1048
|
|
|
957
|
-
var valueFromConfig2Keys = ['url', 'method', 'data'];
|
|
958
|
-
var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
|
|
959
|
-
var defaultToConfig2Keys = [
|
|
960
|
-
'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
|
961
|
-
'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
|
962
|
-
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
|
|
963
|
-
'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
|
|
964
|
-
'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
|
|
965
|
-
];
|
|
966
|
-
var directMergeKeys = ['validateStatus'];
|
|
967
|
-
|
|
968
1049
|
function getMergedValue(target, source) {
|
|
969
1050
|
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
970
1051
|
return utils.merge(target, source);
|
|
@@ -976,51 +1057,74 @@ module.exports = function mergeConfig(config1, config2) {
|
|
|
976
1057
|
return source;
|
|
977
1058
|
}
|
|
978
1059
|
|
|
1060
|
+
// eslint-disable-next-line consistent-return
|
|
979
1061
|
function mergeDeepProperties(prop) {
|
|
980
1062
|
if (!utils.isUndefined(config2[prop])) {
|
|
981
|
-
|
|
1063
|
+
return getMergedValue(config1[prop], config2[prop]);
|
|
982
1064
|
} else if (!utils.isUndefined(config1[prop])) {
|
|
983
|
-
|
|
1065
|
+
return getMergedValue(undefined, config1[prop]);
|
|
984
1066
|
}
|
|
985
1067
|
}
|
|
986
1068
|
|
|
987
|
-
|
|
1069
|
+
// eslint-disable-next-line consistent-return
|
|
1070
|
+
function valueFromConfig2(prop) {
|
|
988
1071
|
if (!utils.isUndefined(config2[prop])) {
|
|
989
|
-
|
|
1072
|
+
return getMergedValue(undefined, config2[prop]);
|
|
990
1073
|
}
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
|
|
1074
|
+
}
|
|
994
1075
|
|
|
995
|
-
|
|
1076
|
+
// eslint-disable-next-line consistent-return
|
|
1077
|
+
function defaultToConfig2(prop) {
|
|
996
1078
|
if (!utils.isUndefined(config2[prop])) {
|
|
997
|
-
|
|
1079
|
+
return getMergedValue(undefined, config2[prop]);
|
|
998
1080
|
} else if (!utils.isUndefined(config1[prop])) {
|
|
999
|
-
|
|
1081
|
+
return getMergedValue(undefined, config1[prop]);
|
|
1000
1082
|
}
|
|
1001
|
-
}
|
|
1083
|
+
}
|
|
1002
1084
|
|
|
1003
|
-
|
|
1085
|
+
// eslint-disable-next-line consistent-return
|
|
1086
|
+
function mergeDirectKeys(prop) {
|
|
1004
1087
|
if (prop in config2) {
|
|
1005
|
-
|
|
1088
|
+
return getMergedValue(config1[prop], config2[prop]);
|
|
1006
1089
|
} else if (prop in config1) {
|
|
1007
|
-
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
var
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1090
|
+
return getMergedValue(undefined, config1[prop]);
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
var mergeMap = {
|
|
1095
|
+
'url': valueFromConfig2,
|
|
1096
|
+
'method': valueFromConfig2,
|
|
1097
|
+
'data': valueFromConfig2,
|
|
1098
|
+
'baseURL': defaultToConfig2,
|
|
1099
|
+
'transformRequest': defaultToConfig2,
|
|
1100
|
+
'transformResponse': defaultToConfig2,
|
|
1101
|
+
'paramsSerializer': defaultToConfig2,
|
|
1102
|
+
'timeout': defaultToConfig2,
|
|
1103
|
+
'timeoutMessage': defaultToConfig2,
|
|
1104
|
+
'withCredentials': defaultToConfig2,
|
|
1105
|
+
'adapter': defaultToConfig2,
|
|
1106
|
+
'responseType': defaultToConfig2,
|
|
1107
|
+
'xsrfCookieName': defaultToConfig2,
|
|
1108
|
+
'xsrfHeaderName': defaultToConfig2,
|
|
1109
|
+
'onUploadProgress': defaultToConfig2,
|
|
1110
|
+
'onDownloadProgress': defaultToConfig2,
|
|
1111
|
+
'decompress': defaultToConfig2,
|
|
1112
|
+
'maxContentLength': defaultToConfig2,
|
|
1113
|
+
'maxBodyLength': defaultToConfig2,
|
|
1114
|
+
'transport': defaultToConfig2,
|
|
1115
|
+
'httpAgent': defaultToConfig2,
|
|
1116
|
+
'httpsAgent': defaultToConfig2,
|
|
1117
|
+
'cancelToken': defaultToConfig2,
|
|
1118
|
+
'socketPath': defaultToConfig2,
|
|
1119
|
+
'responseEncoding': defaultToConfig2,
|
|
1120
|
+
'validateStatus': mergeDirectKeys
|
|
1121
|
+
};
|
|
1022
1122
|
|
|
1023
|
-
utils.forEach(
|
|
1123
|
+
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
|
1124
|
+
var merge = mergeMap[prop] || mergeDeepProperties;
|
|
1125
|
+
var configValue = merge(prop);
|
|
1126
|
+
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
1127
|
+
});
|
|
1024
1128
|
|
|
1025
1129
|
return config;
|
|
1026
1130
|
};
|
|
@@ -1188,7 +1292,7 @@ var defaults = {
|
|
|
1188
1292
|
}],
|
|
1189
1293
|
|
|
1190
1294
|
transformResponse: [function transformResponse(data) {
|
|
1191
|
-
var transitional = this.transitional;
|
|
1295
|
+
var transitional = this.transitional || defaults.transitional;
|
|
1192
1296
|
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
1193
1297
|
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
1194
1298
|
var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
|
|
@@ -1223,12 +1327,12 @@ var defaults = {
|
|
|
1223
1327
|
|
|
1224
1328
|
validateStatus: function validateStatus(status) {
|
|
1225
1329
|
return status >= 200 && status < 300;
|
|
1226
|
-
}
|
|
1227
|
-
};
|
|
1330
|
+
},
|
|
1228
1331
|
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1332
|
+
headers: {
|
|
1333
|
+
common: {
|
|
1334
|
+
'Accept': 'application/json, text/plain, */*'
|
|
1335
|
+
}
|
|
1232
1336
|
}
|
|
1233
1337
|
};
|
|
1234
1338
|
|
|
@@ -1246,6 +1350,19 @@ module.exports = defaults;
|
|
|
1246
1350
|
|
|
1247
1351
|
/***/ }),
|
|
1248
1352
|
|
|
1353
|
+
/***/ "../../node_modules/axios/lib/env/data.js":
|
|
1354
|
+
/*!***********************************************************!*\
|
|
1355
|
+
!*** /root/amplify-js/node_modules/axios/lib/env/data.js ***!
|
|
1356
|
+
\***********************************************************/
|
|
1357
|
+
/*! no static exports found */
|
|
1358
|
+
/***/ (function(module, exports) {
|
|
1359
|
+
|
|
1360
|
+
module.exports = {
|
|
1361
|
+
"version": "0.26.0"
|
|
1362
|
+
};
|
|
1363
|
+
|
|
1364
|
+
/***/ }),
|
|
1365
|
+
|
|
1249
1366
|
/***/ "../../node_modules/axios/lib/helpers/bind.js":
|
|
1250
1367
|
/*!***************************************************************!*\
|
|
1251
1368
|
!*** /root/amplify-js/node_modules/axios/lib/helpers/bind.js ***!
|
|
@@ -1462,7 +1579,7 @@ module.exports = function isAbsoluteURL(url) {
|
|
|
1462
1579
|
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
1463
1580
|
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
1464
1581
|
// by any combination of letters, digits, plus, period, or hyphen.
|
|
1465
|
-
return /^([a-z][a-z\d
|
|
1582
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
1466
1583
|
};
|
|
1467
1584
|
|
|
1468
1585
|
|
|
@@ -1478,6 +1595,8 @@ module.exports = function isAbsoluteURL(url) {
|
|
|
1478
1595
|
"use strict";
|
|
1479
1596
|
|
|
1480
1597
|
|
|
1598
|
+
var utils = __webpack_require__(/*! ./../utils */ "../../node_modules/axios/lib/utils.js");
|
|
1599
|
+
|
|
1481
1600
|
/**
|
|
1482
1601
|
* Determines whether the payload is an error thrown by Axios
|
|
1483
1602
|
*
|
|
@@ -1485,7 +1604,7 @@ module.exports = function isAbsoluteURL(url) {
|
|
|
1485
1604
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
1486
1605
|
*/
|
|
1487
1606
|
module.exports = function isAxiosError(payload) {
|
|
1488
|
-
return (
|
|
1607
|
+
return utils.isObject(payload) && (payload.isAxiosError === true);
|
|
1489
1608
|
};
|
|
1490
1609
|
|
|
1491
1610
|
|
|
@@ -1709,7 +1828,7 @@ module.exports = function spread(callback) {
|
|
|
1709
1828
|
"use strict";
|
|
1710
1829
|
|
|
1711
1830
|
|
|
1712
|
-
var
|
|
1831
|
+
var VERSION = __webpack_require__(/*! ../env/data */ "../../node_modules/axios/lib/env/data.js").version;
|
|
1713
1832
|
|
|
1714
1833
|
var validators = {};
|
|
1715
1834
|
|
|
@@ -1721,48 +1840,26 @@ var validators = {};
|
|
|
1721
1840
|
});
|
|
1722
1841
|
|
|
1723
1842
|
var deprecatedWarnings = {};
|
|
1724
|
-
var currentVerArr = pkg.version.split('.');
|
|
1725
|
-
|
|
1726
|
-
/**
|
|
1727
|
-
* Compare package versions
|
|
1728
|
-
* @param {string} version
|
|
1729
|
-
* @param {string?} thanVersion
|
|
1730
|
-
* @returns {boolean}
|
|
1731
|
-
*/
|
|
1732
|
-
function isOlderVersion(version, thanVersion) {
|
|
1733
|
-
var pkgVersionArr = thanVersion ? thanVersion.split('.') : currentVerArr;
|
|
1734
|
-
var destVer = version.split('.');
|
|
1735
|
-
for (var i = 0; i < 3; i++) {
|
|
1736
|
-
if (pkgVersionArr[i] > destVer[i]) {
|
|
1737
|
-
return true;
|
|
1738
|
-
} else if (pkgVersionArr[i] < destVer[i]) {
|
|
1739
|
-
return false;
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
return false;
|
|
1743
|
-
}
|
|
1744
1843
|
|
|
1745
1844
|
/**
|
|
1746
1845
|
* Transitional option validator
|
|
1747
|
-
* @param {function|boolean?} validator
|
|
1748
|
-
* @param {string?} version
|
|
1749
|
-
* @param {string} message
|
|
1846
|
+
* @param {function|boolean?} validator - set to false if the transitional option has been removed
|
|
1847
|
+
* @param {string?} version - deprecated version / removed since version
|
|
1848
|
+
* @param {string?} message - some message with additional info
|
|
1750
1849
|
* @returns {function}
|
|
1751
1850
|
*/
|
|
1752
1851
|
validators.transitional = function transitional(validator, version, message) {
|
|
1753
|
-
var isDeprecated = version && isOlderVersion(version);
|
|
1754
|
-
|
|
1755
1852
|
function formatMessage(opt, desc) {
|
|
1756
|
-
return '[Axios v' +
|
|
1853
|
+
return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
|
1757
1854
|
}
|
|
1758
1855
|
|
|
1759
1856
|
// eslint-disable-next-line func-names
|
|
1760
1857
|
return function(value, opt, opts) {
|
|
1761
1858
|
if (validator === false) {
|
|
1762
|
-
throw new Error(formatMessage(opt, ' has been removed in ' + version));
|
|
1859
|
+
throw new Error(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')));
|
|
1763
1860
|
}
|
|
1764
1861
|
|
|
1765
|
-
if (
|
|
1862
|
+
if (version && !deprecatedWarnings[opt]) {
|
|
1766
1863
|
deprecatedWarnings[opt] = true;
|
|
1767
1864
|
// eslint-disable-next-line no-console
|
|
1768
1865
|
console.warn(
|
|
@@ -1808,7 +1905,6 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
1808
1905
|
}
|
|
1809
1906
|
|
|
1810
1907
|
module.exports = {
|
|
1811
|
-
isOlderVersion: isOlderVersion,
|
|
1812
1908
|
assertOptions: assertOptions,
|
|
1813
1909
|
validators: validators
|
|
1814
1910
|
};
|
|
@@ -1839,7 +1935,7 @@ var toString = Object.prototype.toString;
|
|
|
1839
1935
|
* @returns {boolean} True if value is an Array, otherwise false
|
|
1840
1936
|
*/
|
|
1841
1937
|
function isArray(val) {
|
|
1842
|
-
return
|
|
1938
|
+
return Array.isArray(val);
|
|
1843
1939
|
}
|
|
1844
1940
|
|
|
1845
1941
|
/**
|
|
@@ -1880,7 +1976,7 @@ function isArrayBuffer(val) {
|
|
|
1880
1976
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
1881
1977
|
*/
|
|
1882
1978
|
function isFormData(val) {
|
|
1883
|
-
return (
|
|
1979
|
+
return toString.call(val) === '[object FormData]';
|
|
1884
1980
|
}
|
|
1885
1981
|
|
|
1886
1982
|
/**
|
|
@@ -1894,7 +1990,7 @@ function isArrayBufferView(val) {
|
|
|
1894
1990
|
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
|
1895
1991
|
result = ArrayBuffer.isView(val);
|
|
1896
1992
|
} else {
|
|
1897
|
-
result = (val) && (val.buffer) && (val.buffer
|
|
1993
|
+
result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
|
|
1898
1994
|
}
|
|
1899
1995
|
return result;
|
|
1900
1996
|
}
|
|
@@ -2001,7 +2097,7 @@ function isStream(val) {
|
|
|
2001
2097
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
2002
2098
|
*/
|
|
2003
2099
|
function isURLSearchParams(val) {
|
|
2004
|
-
return
|
|
2100
|
+
return toString.call(val) === '[object URLSearchParams]';
|
|
2005
2101
|
}
|
|
2006
2102
|
|
|
2007
2103
|
/**
|
|
@@ -2175,17 +2271,6 @@ module.exports = {
|
|
|
2175
2271
|
};
|
|
2176
2272
|
|
|
2177
2273
|
|
|
2178
|
-
/***/ }),
|
|
2179
|
-
|
|
2180
|
-
/***/ "../../node_modules/axios/package.json":
|
|
2181
|
-
/*!********************************************************!*\
|
|
2182
|
-
!*** /root/amplify-js/node_modules/axios/package.json ***!
|
|
2183
|
-
\********************************************************/
|
|
2184
|
-
/*! exports provided: name, version, description, main, scripts, repository, keywords, author, license, bugs, homepage, devDependencies, browser, jsdelivr, unpkg, typings, dependencies, bundlesize, default */
|
|
2185
|
-
/***/ (function(module) {
|
|
2186
|
-
|
|
2187
|
-
module.exports = JSON.parse("{\"name\":\"axios\",\"version\":\"0.21.4\",\"description\":\"Promise based HTTP client for the browser and node.js\",\"main\":\"index.js\",\"scripts\":{\"test\":\"grunt test\",\"start\":\"node ./sandbox/server.js\",\"build\":\"NODE_ENV=production grunt build\",\"preversion\":\"npm test\",\"version\":\"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json\",\"postversion\":\"git push && git push --tags\",\"examples\":\"node ./examples/server.js\",\"coveralls\":\"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js\",\"fix\":\"eslint --fix lib/**/*.js\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/axios/axios.git\"},\"keywords\":[\"xhr\",\"http\",\"ajax\",\"promise\",\"node\"],\"author\":\"Matt Zabriskie\",\"license\":\"MIT\",\"bugs\":{\"url\":\"https://github.com/axios/axios/issues\"},\"homepage\":\"https://axios-http.com\",\"devDependencies\":{\"coveralls\":\"^3.0.0\",\"es6-promise\":\"^4.2.4\",\"grunt\":\"^1.3.0\",\"grunt-banner\":\"^0.6.0\",\"grunt-cli\":\"^1.2.0\",\"grunt-contrib-clean\":\"^1.1.0\",\"grunt-contrib-watch\":\"^1.0.0\",\"grunt-eslint\":\"^23.0.0\",\"grunt-karma\":\"^4.0.0\",\"grunt-mocha-test\":\"^0.13.3\",\"grunt-ts\":\"^6.0.0-beta.19\",\"grunt-webpack\":\"^4.0.2\",\"istanbul-instrumenter-loader\":\"^1.0.0\",\"jasmine-core\":\"^2.4.1\",\"karma\":\"^6.3.2\",\"karma-chrome-launcher\":\"^3.1.0\",\"karma-firefox-launcher\":\"^2.1.0\",\"karma-jasmine\":\"^1.1.1\",\"karma-jasmine-ajax\":\"^0.1.13\",\"karma-safari-launcher\":\"^1.0.0\",\"karma-sauce-launcher\":\"^4.3.6\",\"karma-sinon\":\"^1.0.5\",\"karma-sourcemap-loader\":\"^0.3.8\",\"karma-webpack\":\"^4.0.2\",\"load-grunt-tasks\":\"^3.5.2\",\"minimist\":\"^1.2.0\",\"mocha\":\"^8.2.1\",\"sinon\":\"^4.5.0\",\"terser-webpack-plugin\":\"^4.2.3\",\"typescript\":\"^4.0.5\",\"url-search-params\":\"^0.10.0\",\"webpack\":\"^4.44.2\",\"webpack-dev-server\":\"^3.11.0\"},\"browser\":{\"./lib/adapters/http.js\":\"./lib/adapters/xhr.js\"},\"jsdelivr\":\"dist/axios.min.js\",\"unpkg\":\"dist/axios.min.js\",\"typings\":\"./index.d.ts\",\"dependencies\":{\"follow-redirects\":\"^1.14.0\"},\"bundlesize\":[{\"path\":\"./dist/axios.min.js\",\"threshold\":\"5kB\"}]}");
|
|
2188
|
-
|
|
2189
2274
|
/***/ }),
|
|
2190
2275
|
|
|
2191
2276
|
/***/ "../../node_modules/base64-js/index.js":
|
|
@@ -9824,6 +9909,16 @@ function () {
|
|
|
9824
9909
|
RestAPIClass.prototype.cancel = function (request, message) {
|
|
9825
9910
|
return this._api.cancel(request, message);
|
|
9826
9911
|
};
|
|
9912
|
+
/**
|
|
9913
|
+
* Check if the request has a corresponding cancel token in the WeakMap.
|
|
9914
|
+
* @params request - The request promise
|
|
9915
|
+
* @return if the request has a corresponding cancel token.
|
|
9916
|
+
*/
|
|
9917
|
+
|
|
9918
|
+
|
|
9919
|
+
RestAPIClass.prototype.hasCancelToken = function (request) {
|
|
9920
|
+
return this._api.hasCancelToken(request);
|
|
9921
|
+
};
|
|
9827
9922
|
/**
|
|
9828
9923
|
* Getting endpoint for API
|
|
9829
9924
|
* @param {string} apiName - The name of the api
|
|
@@ -10389,9 +10484,20 @@ function () {
|
|
|
10389
10484
|
|
|
10390
10485
|
if (source) {
|
|
10391
10486
|
source.cancel(message);
|
|
10487
|
+
return true;
|
|
10392
10488
|
}
|
|
10393
10489
|
|
|
10394
|
-
return
|
|
10490
|
+
return false;
|
|
10491
|
+
};
|
|
10492
|
+
/**
|
|
10493
|
+
* Check if the request has a corresponding cancel token in the WeakMap.
|
|
10494
|
+
* @params request - The request promise
|
|
10495
|
+
* @return if the request has a corresponding cancel token.
|
|
10496
|
+
*/
|
|
10497
|
+
|
|
10498
|
+
|
|
10499
|
+
RestClient.prototype.hasCancelToken = function (request) {
|
|
10500
|
+
return this._cancelTokenMap.has(request);
|
|
10395
10501
|
};
|
|
10396
10502
|
/**
|
|
10397
10503
|
* Checks to see if an error thrown is from an api request cancellation
|
|
@@ -10801,6 +10907,9 @@ var __spread = undefined && undefined.__spread || function () {
|
|
|
10801
10907
|
|
|
10802
10908
|
|
|
10803
10909
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('AWSAppSyncProvider');
|
|
10910
|
+
/**
|
|
10911
|
+
* @deprecated Unused, all usecases have migrated to AWSAppSyncRealtimeProvider
|
|
10912
|
+
*/
|
|
10804
10913
|
|
|
10805
10914
|
var AWSAppSyncProvider =
|
|
10806
10915
|
/** @class */
|
|
@@ -11107,10 +11216,10 @@ function (_super) {
|
|
|
11107
11216
|
|
|
11108
11217
|
/***/ }),
|
|
11109
11218
|
|
|
11110
|
-
/***/ "../pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js":
|
|
11111
|
-
|
|
11112
|
-
!*** ../pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js ***!
|
|
11113
|
-
|
|
11219
|
+
/***/ "../pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js":
|
|
11220
|
+
/*!***********************************************************************!*\
|
|
11221
|
+
!*** ../pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js ***!
|
|
11222
|
+
\***********************************************************************/
|
|
11114
11223
|
/*! exports provided: AWSAppSyncRealTimeProvider */
|
|
11115
11224
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
11116
11225
|
|
|
@@ -11132,8 +11241,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11132
11241
|
/* harmony import */ var _aws_amplify_cache__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_cache__WEBPACK_IMPORTED_MODULE_6__);
|
|
11133
11242
|
/* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @aws-amplify/auth */ "@aws-amplify/auth");
|
|
11134
11243
|
/* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_7__);
|
|
11135
|
-
/* harmony import */ var _PubSubProvider__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*!
|
|
11136
|
-
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*!
|
|
11244
|
+
/* harmony import */ var _PubSubProvider__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../PubSubProvider */ "../pubsub/lib-esm/Providers/PubSubProvider.js");
|
|
11245
|
+
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../index */ "../pubsub/lib-esm/index.js");
|
|
11246
|
+
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../constants */ "../pubsub/lib-esm/Providers/constants.js");
|
|
11247
|
+
/* harmony import */ var _utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../utils/ConnectionStateMonitor */ "../pubsub/lib-esm/utils/ConnectionStateMonitor.js");
|
|
11137
11248
|
var __extends = undefined && undefined.__extends || function () {
|
|
11138
11249
|
var _extendStatics = function extendStatics(d, b) {
|
|
11139
11250
|
_extendStatics = Object.setPrototypeOf || {
|
|
@@ -11369,119 +11480,18 @@ var __read = undefined && undefined.__read || function (o, n) {
|
|
|
11369
11480
|
|
|
11370
11481
|
|
|
11371
11482
|
|
|
11483
|
+
|
|
11484
|
+
|
|
11372
11485
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["Logger"]('AWSAppSyncRealTimeProvider');
|
|
11373
|
-
var AMPLIFY_SYMBOL = typeof Symbol !== 'undefined' && typeof Symbol["for"] === 'function' ? Symbol["for"]('amplify_default') : '@@amplify_default';
|
|
11374
11486
|
|
|
11375
11487
|
var dispatchApiEvent = function dispatchApiEvent(event, data, message) {
|
|
11376
11488
|
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["Hub"].dispatch('api', {
|
|
11377
11489
|
event: event,
|
|
11378
11490
|
data: data,
|
|
11379
11491
|
message: message
|
|
11380
|
-
}, 'PubSub', AMPLIFY_SYMBOL);
|
|
11381
|
-
};
|
|
11382
|
-
|
|
11383
|
-
var MAX_DELAY_MS = 5000;
|
|
11384
|
-
var NON_RETRYABLE_CODES = [400, 401, 403];
|
|
11385
|
-
var MESSAGE_TYPES;
|
|
11386
|
-
|
|
11387
|
-
(function (MESSAGE_TYPES) {
|
|
11388
|
-
/**
|
|
11389
|
-
* Client -> Server message.
|
|
11390
|
-
* This message type is the first message after handshake and this will initialize AWS AppSync RealTime communication
|
|
11391
|
-
*/
|
|
11392
|
-
MESSAGE_TYPES["GQL_CONNECTION_INIT"] = "connection_init";
|
|
11393
|
-
/**
|
|
11394
|
-
* Server -> Client message
|
|
11395
|
-
* This message type is in case there is an issue with AWS AppSync RealTime when establishing connection
|
|
11396
|
-
*/
|
|
11397
|
-
|
|
11398
|
-
MESSAGE_TYPES["GQL_CONNECTION_ERROR"] = "connection_error";
|
|
11399
|
-
/**
|
|
11400
|
-
* Server -> Client message.
|
|
11401
|
-
* This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message
|
|
11402
|
-
*/
|
|
11403
|
-
|
|
11404
|
-
MESSAGE_TYPES["GQL_CONNECTION_ACK"] = "connection_ack";
|
|
11405
|
-
/**
|
|
11406
|
-
* Client -> Server message.
|
|
11407
|
-
* This message type is for register subscriptions with AWS AppSync RealTime
|
|
11408
|
-
*/
|
|
11409
|
-
|
|
11410
|
-
MESSAGE_TYPES["GQL_START"] = "start";
|
|
11411
|
-
/**
|
|
11412
|
-
* Server -> Client message.
|
|
11413
|
-
* This message type is for the ack response from AWS AppSync RealTime for GQL_START message
|
|
11414
|
-
*/
|
|
11415
|
-
|
|
11416
|
-
MESSAGE_TYPES["GQL_START_ACK"] = "start_ack";
|
|
11417
|
-
/**
|
|
11418
|
-
* Server -> Client message.
|
|
11419
|
-
* This message type is for subscription message from AWS AppSync RealTime
|
|
11420
|
-
*/
|
|
11421
|
-
|
|
11422
|
-
MESSAGE_TYPES["GQL_DATA"] = "data";
|
|
11423
|
-
/**
|
|
11424
|
-
* Server -> Client message.
|
|
11425
|
-
* This message type helps the client to know is still receiving messages from AWS AppSync RealTime
|
|
11426
|
-
*/
|
|
11427
|
-
|
|
11428
|
-
MESSAGE_TYPES["GQL_CONNECTION_KEEP_ALIVE"] = "ka";
|
|
11429
|
-
/**
|
|
11430
|
-
* Client -> Server message.
|
|
11431
|
-
* This message type is for unregister subscriptions with AWS AppSync RealTime
|
|
11432
|
-
*/
|
|
11433
|
-
|
|
11434
|
-
MESSAGE_TYPES["GQL_STOP"] = "stop";
|
|
11435
|
-
/**
|
|
11436
|
-
* Server -> Client message.
|
|
11437
|
-
* This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message
|
|
11438
|
-
*/
|
|
11439
|
-
|
|
11440
|
-
MESSAGE_TYPES["GQL_COMPLETE"] = "complete";
|
|
11441
|
-
/**
|
|
11442
|
-
* Server -> Client message.
|
|
11443
|
-
* This message type is for sending error messages from AWS AppSync RealTime to the client
|
|
11444
|
-
*/
|
|
11445
|
-
|
|
11446
|
-
MESSAGE_TYPES["GQL_ERROR"] = "error";
|
|
11447
|
-
})(MESSAGE_TYPES || (MESSAGE_TYPES = {}));
|
|
11448
|
-
|
|
11449
|
-
var SUBSCRIPTION_STATUS;
|
|
11450
|
-
|
|
11451
|
-
(function (SUBSCRIPTION_STATUS) {
|
|
11452
|
-
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["PENDING"] = 0] = "PENDING";
|
|
11453
|
-
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["CONNECTED"] = 1] = "CONNECTED";
|
|
11454
|
-
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["FAILED"] = 2] = "FAILED";
|
|
11455
|
-
})(SUBSCRIPTION_STATUS || (SUBSCRIPTION_STATUS = {}));
|
|
11456
|
-
|
|
11457
|
-
var SOCKET_STATUS;
|
|
11458
|
-
|
|
11459
|
-
(function (SOCKET_STATUS) {
|
|
11460
|
-
SOCKET_STATUS[SOCKET_STATUS["CLOSED"] = 0] = "CLOSED";
|
|
11461
|
-
SOCKET_STATUS[SOCKET_STATUS["READY"] = 1] = "READY";
|
|
11462
|
-
SOCKET_STATUS[SOCKET_STATUS["CONNECTING"] = 2] = "CONNECTING";
|
|
11463
|
-
})(SOCKET_STATUS || (SOCKET_STATUS = {}));
|
|
11464
|
-
|
|
11465
|
-
var AWS_APPSYNC_REALTIME_HEADERS = {
|
|
11466
|
-
accept: 'application/json, text/javascript',
|
|
11467
|
-
'content-encoding': 'amz-1.0',
|
|
11468
|
-
'content-type': 'application/json; charset=UTF-8'
|
|
11492
|
+
}, 'PubSub', _constants__WEBPACK_IMPORTED_MODULE_10__["AMPLIFY_SYMBOL"]);
|
|
11469
11493
|
};
|
|
11470
|
-
/**
|
|
11471
|
-
* Time in milleseconds to wait for GQL_CONNECTION_INIT message
|
|
11472
|
-
*/
|
|
11473
11494
|
|
|
11474
|
-
var CONNECTION_INIT_TIMEOUT = 15000;
|
|
11475
|
-
/**
|
|
11476
|
-
* Time in milleseconds to wait for GQL_START_ACK message
|
|
11477
|
-
*/
|
|
11478
|
-
|
|
11479
|
-
var START_ACK_TIMEOUT = 15000;
|
|
11480
|
-
/**
|
|
11481
|
-
* Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message
|
|
11482
|
-
*/
|
|
11483
|
-
|
|
11484
|
-
var DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;
|
|
11485
11495
|
var standardDomainPattern = /^https:\/\/\w{26}\.appsync\-api\.\w{2}(?:(?:\-\w{2,})+)\-\d\.amazonaws.com\/graphql$/i;
|
|
11486
11496
|
var customDomainPath = '/realtime';
|
|
11487
11497
|
|
|
@@ -11490,16 +11500,33 @@ var AWSAppSyncRealTimeProvider =
|
|
|
11490
11500
|
function (_super) {
|
|
11491
11501
|
__extends(AWSAppSyncRealTimeProvider, _super);
|
|
11492
11502
|
|
|
11493
|
-
function AWSAppSyncRealTimeProvider() {
|
|
11494
|
-
|
|
11503
|
+
function AWSAppSyncRealTimeProvider(options) {
|
|
11504
|
+
if (options === void 0) {
|
|
11505
|
+
options = {};
|
|
11506
|
+
}
|
|
11507
|
+
|
|
11508
|
+
var _this = _super.call(this, options) || this;
|
|
11495
11509
|
|
|
11496
|
-
_this.socketStatus = SOCKET_STATUS.CLOSED;
|
|
11497
|
-
_this.keepAliveTimeout = DEFAULT_KEEP_ALIVE_TIMEOUT;
|
|
11510
|
+
_this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
11511
|
+
_this.keepAliveTimeout = _constants__WEBPACK_IMPORTED_MODULE_10__["DEFAULT_KEEP_ALIVE_TIMEOUT"];
|
|
11498
11512
|
_this.subscriptionObserverMap = new Map();
|
|
11499
11513
|
_this.promiseArray = [];
|
|
11514
|
+
_this.connectionStateMonitor = new _utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["ConnectionStateMonitor"](); // Monitor the connection state and pass changes along to Hub
|
|
11515
|
+
|
|
11516
|
+
_this.connectionStateMonitor.connectionStateObservable.subscribe(function (ConnectionState) {
|
|
11517
|
+
dispatchApiEvent(_index__WEBPACK_IMPORTED_MODULE_9__["CONNECTION_STATE_CHANGE"], {
|
|
11518
|
+
provider: _this,
|
|
11519
|
+
connectionState: ConnectionState
|
|
11520
|
+
}, "Connection state is " + ConnectionState);
|
|
11521
|
+
});
|
|
11522
|
+
|
|
11500
11523
|
return _this;
|
|
11501
11524
|
}
|
|
11502
11525
|
|
|
11526
|
+
AWSAppSyncRealTimeProvider.prototype.getNewWebSocket = function (url, protocol) {
|
|
11527
|
+
return new WebSocket(url, protocol);
|
|
11528
|
+
};
|
|
11529
|
+
|
|
11503
11530
|
AWSAppSyncRealTimeProvider.prototype.getProviderName = function () {
|
|
11504
11531
|
return 'AWSAppSyncRealTimeProvider';
|
|
11505
11532
|
};
|
|
@@ -11524,9 +11551,9 @@ function (_super) {
|
|
|
11524
11551
|
AWSAppSyncRealTimeProvider.prototype.subscribe = function (_topics, options) {
|
|
11525
11552
|
var _this = this;
|
|
11526
11553
|
|
|
11527
|
-
var appSyncGraphqlEndpoint = options.appSyncGraphqlEndpoint;
|
|
11554
|
+
var appSyncGraphqlEndpoint = options === null || options === void 0 ? void 0 : options.appSyncGraphqlEndpoint;
|
|
11528
11555
|
return new zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"](function (observer) {
|
|
11529
|
-
if (!appSyncGraphqlEndpoint) {
|
|
11556
|
+
if (!options || !appSyncGraphqlEndpoint) {
|
|
11530
11557
|
observer.error({
|
|
11531
11558
|
errors: [__assign({}, new graphql__WEBPACK_IMPORTED_MODULE_1__["GraphQLError"]("Subscribe only available for AWS AppSync endpoint"))]
|
|
11532
11559
|
});
|
|
@@ -11542,6 +11569,9 @@ function (_super) {
|
|
|
11542
11569
|
observer.error({
|
|
11543
11570
|
errors: [__assign({}, new graphql__WEBPACK_IMPORTED_MODULE_1__["GraphQLError"](_index__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].REALTIME_SUBSCRIPTION_INIT_ERROR + ": " + err))]
|
|
11544
11571
|
});
|
|
11572
|
+
|
|
11573
|
+
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CLOSED);
|
|
11574
|
+
|
|
11545
11575
|
observer.complete();
|
|
11546
11576
|
});
|
|
11547
11577
|
|
|
@@ -11571,7 +11601,7 @@ function (_super) {
|
|
|
11571
11601
|
];
|
|
11572
11602
|
}
|
|
11573
11603
|
|
|
11574
|
-
if (subscriptionState === SUBSCRIPTION_STATUS.CONNECTED) {
|
|
11604
|
+
if (subscriptionState === _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].CONNECTED) {
|
|
11575
11605
|
this._sendUnsubscriptionMessage(subscriptionId_1);
|
|
11576
11606
|
} else {
|
|
11577
11607
|
throw new Error('Subscription never connected');
|
|
@@ -11619,20 +11649,23 @@ function (_super) {
|
|
|
11619
11649
|
var options = _a.options,
|
|
11620
11650
|
observer = _a.observer,
|
|
11621
11651
|
subscriptionId = _a.subscriptionId;
|
|
11652
|
+
|
|
11653
|
+
var _b, _c;
|
|
11654
|
+
|
|
11622
11655
|
return __awaiter(this, void 0, void 0, function () {
|
|
11623
|
-
var appSyncGraphqlEndpoint, authenticationType, query, variables, apiKey, region,
|
|
11656
|
+
var appSyncGraphqlEndpoint, authenticationType, query, variables, apiKey, region, _d, graphql_headers, _e, additionalHeaders, subscriptionState, data, dataString, headerObj, _f, _g, subscriptionMessage, stringToAWSRealTime, err_2, message, subscriptionFailedCallback_1, _h, subscriptionFailedCallback, subscriptionReadyCallback;
|
|
11624
11657
|
|
|
11625
|
-
var
|
|
11658
|
+
var _j;
|
|
11626
11659
|
|
|
11627
11660
|
var _this = this;
|
|
11628
11661
|
|
|
11629
|
-
return __generator(this, function (
|
|
11630
|
-
switch (
|
|
11662
|
+
return __generator(this, function (_k) {
|
|
11663
|
+
switch (_k.label) {
|
|
11631
11664
|
case 0:
|
|
11632
|
-
appSyncGraphqlEndpoint = options.appSyncGraphqlEndpoint, authenticationType = options.authenticationType, query = options.query, variables = options.variables, apiKey = options.apiKey, region = options.region,
|
|
11665
|
+
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 () {
|
|
11633
11666
|
return {};
|
|
11634
|
-
} :
|
|
11635
|
-
subscriptionState = SUBSCRIPTION_STATUS.PENDING;
|
|
11667
|
+
} : _d, _e = options.additionalHeaders, additionalHeaders = _e === void 0 ? {} : _e;
|
|
11668
|
+
subscriptionState = _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].PENDING;
|
|
11636
11669
|
data = {
|
|
11637
11670
|
query: query,
|
|
11638
11671
|
variables: variables
|
|
@@ -11640,13 +11673,13 @@ function (_super) {
|
|
|
11640
11673
|
|
|
11641
11674
|
this.subscriptionObserverMap.set(subscriptionId, {
|
|
11642
11675
|
observer: observer,
|
|
11643
|
-
query: query,
|
|
11644
|
-
variables: variables,
|
|
11676
|
+
query: query !== null && query !== void 0 ? query : '',
|
|
11677
|
+
variables: variables !== null && variables !== void 0 ? variables : {},
|
|
11645
11678
|
subscriptionState: subscriptionState,
|
|
11646
|
-
startAckTimeoutId:
|
|
11679
|
+
startAckTimeoutId: undefined
|
|
11647
11680
|
});
|
|
11648
11681
|
dataString = JSON.stringify(data);
|
|
11649
|
-
|
|
11682
|
+
_f = [{}];
|
|
11650
11683
|
return [4
|
|
11651
11684
|
/*yield*/
|
|
11652
11685
|
, this._awsRealTimeHeaderBasedAuth({
|
|
@@ -11660,13 +11693,13 @@ function (_super) {
|
|
|
11660
11693
|
})];
|
|
11661
11694
|
|
|
11662
11695
|
case 1:
|
|
11663
|
-
|
|
11696
|
+
_g = [__assign.apply(void 0, _f.concat([_k.sent()]))];
|
|
11664
11697
|
return [4
|
|
11665
11698
|
/*yield*/
|
|
11666
11699
|
, graphql_headers()];
|
|
11667
11700
|
|
|
11668
11701
|
case 2:
|
|
11669
|
-
headerObj = __assign.apply(void 0, [__assign.apply(void 0, [__assign.apply(void 0,
|
|
11702
|
+
headerObj = __assign.apply(void 0, [__assign.apply(void 0, [__assign.apply(void 0, _g.concat([_k.sent()])), additionalHeaders]), (_j = {}, _j[_aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["USER_AGENT_HEADER"]] = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["Constants"].userAgent, _j)]);
|
|
11670
11703
|
subscriptionMessage = {
|
|
11671
11704
|
id: subscriptionId,
|
|
11672
11705
|
payload: {
|
|
@@ -11675,14 +11708,15 @@ function (_super) {
|
|
|
11675
11708
|
authorization: __assign({}, headerObj)
|
|
11676
11709
|
}
|
|
11677
11710
|
},
|
|
11678
|
-
type: MESSAGE_TYPES.GQL_START
|
|
11711
|
+
type: _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_START
|
|
11679
11712
|
};
|
|
11680
11713
|
stringToAWSRealTime = JSON.stringify(subscriptionMessage);
|
|
11681
|
-
|
|
11714
|
+
_k.label = 3;
|
|
11682
11715
|
|
|
11683
11716
|
case 3:
|
|
11684
|
-
|
|
11717
|
+
_k.trys.push([3, 5,, 6]);
|
|
11685
11718
|
|
|
11719
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].OPENING_CONNECTION);
|
|
11686
11720
|
return [4
|
|
11687
11721
|
/*yield*/
|
|
11688
11722
|
, this._initializeWebSocketConnection({
|
|
@@ -11694,18 +11728,19 @@ function (_super) {
|
|
|
11694
11728
|
})];
|
|
11695
11729
|
|
|
11696
11730
|
case 4:
|
|
11697
|
-
|
|
11731
|
+
_k.sent();
|
|
11698
11732
|
|
|
11699
11733
|
return [3
|
|
11700
11734
|
/*break*/
|
|
11701
11735
|
, 6];
|
|
11702
11736
|
|
|
11703
11737
|
case 5:
|
|
11704
|
-
err_2 =
|
|
11738
|
+
err_2 = _k.sent();
|
|
11705
11739
|
logger.debug({
|
|
11706
11740
|
err: err_2
|
|
11707
11741
|
});
|
|
11708
|
-
|
|
11742
|
+
message = (_b = err_2['message']) !== null && _b !== void 0 ? _b : '';
|
|
11743
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CLOSED);
|
|
11709
11744
|
observer.error({
|
|
11710
11745
|
errors: [__assign({}, new graphql__WEBPACK_IMPORTED_MODULE_1__["GraphQLError"](_index__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].CONNECTION_FAILED + ": " + message))]
|
|
11711
11746
|
});
|
|
@@ -11721,18 +11756,18 @@ function (_super) {
|
|
|
11721
11756
|
];
|
|
11722
11757
|
|
|
11723
11758
|
case 6:
|
|
11724
|
-
|
|
11759
|
+
_h = (_c = this.subscriptionObserverMap.get(subscriptionId)) !== null && _c !== void 0 ? _c : {}, subscriptionFailedCallback = _h.subscriptionFailedCallback, subscriptionReadyCallback = _h.subscriptionReadyCallback; // This must be done before sending the message in order to be listening immediately
|
|
11725
11760
|
|
|
11726
11761
|
this.subscriptionObserverMap.set(subscriptionId, {
|
|
11727
11762
|
observer: observer,
|
|
11728
11763
|
subscriptionState: subscriptionState,
|
|
11729
|
-
|
|
11730
|
-
|
|
11764
|
+
query: query !== null && query !== void 0 ? query : '',
|
|
11765
|
+
variables: variables !== null && variables !== void 0 ? variables : {},
|
|
11731
11766
|
subscriptionReadyCallback: subscriptionReadyCallback,
|
|
11732
11767
|
subscriptionFailedCallback: subscriptionFailedCallback,
|
|
11733
11768
|
startAckTimeoutId: setTimeout(function () {
|
|
11734
11769
|
_this._timeoutStartSubscriptionAck.call(_this, subscriptionId);
|
|
11735
|
-
}, START_ACK_TIMEOUT)
|
|
11770
|
+
}, _constants__WEBPACK_IMPORTED_MODULE_10__["START_ACK_TIMEOUT"])
|
|
11736
11771
|
});
|
|
11737
11772
|
|
|
11738
11773
|
if (this.awsRealTimeSocket) {
|
|
@@ -11750,32 +11785,35 @@ function (_super) {
|
|
|
11750
11785
|
|
|
11751
11786
|
AWSAppSyncRealTimeProvider.prototype._waitForSubscriptionToBeConnected = function (subscriptionId) {
|
|
11752
11787
|
return __awaiter(this, void 0, void 0, function () {
|
|
11753
|
-
var subscriptionState;
|
|
11788
|
+
var subscriptionObserver, subscriptionState;
|
|
11754
11789
|
|
|
11755
11790
|
var _this = this;
|
|
11756
11791
|
|
|
11757
11792
|
return __generator(this, function (_a) {
|
|
11758
|
-
|
|
11793
|
+
subscriptionObserver = this.subscriptionObserverMap.get(subscriptionId);
|
|
11759
11794
|
|
|
11760
|
-
if (
|
|
11761
|
-
|
|
11762
|
-
|
|
11763
|
-
|
|
11764
|
-
|
|
11765
|
-
|
|
11766
|
-
|
|
11767
|
-
|
|
11768
|
-
|
|
11769
|
-
|
|
11770
|
-
|
|
11771
|
-
|
|
11772
|
-
|
|
11773
|
-
|
|
11774
|
-
|
|
11775
|
-
|
|
11776
|
-
|
|
11777
|
-
|
|
11778
|
-
|
|
11795
|
+
if (subscriptionObserver) {
|
|
11796
|
+
subscriptionState = subscriptionObserver.subscriptionState; // This in case unsubscribe is invoked before sending start subscription message
|
|
11797
|
+
|
|
11798
|
+
if (subscriptionState === _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].PENDING) {
|
|
11799
|
+
return [2
|
|
11800
|
+
/*return*/
|
|
11801
|
+
, new Promise(function (res, rej) {
|
|
11802
|
+
var observer = subscriptionObserver.observer,
|
|
11803
|
+
subscriptionState = subscriptionObserver.subscriptionState,
|
|
11804
|
+
variables = subscriptionObserver.variables,
|
|
11805
|
+
query = subscriptionObserver.query;
|
|
11806
|
+
|
|
11807
|
+
_this.subscriptionObserverMap.set(subscriptionId, {
|
|
11808
|
+
observer: observer,
|
|
11809
|
+
subscriptionState: subscriptionState,
|
|
11810
|
+
variables: variables,
|
|
11811
|
+
query: query,
|
|
11812
|
+
subscriptionReadyCallback: res,
|
|
11813
|
+
subscriptionFailedCallback: rej
|
|
11814
|
+
});
|
|
11815
|
+
})];
|
|
11816
|
+
}
|
|
11779
11817
|
}
|
|
11780
11818
|
|
|
11781
11819
|
return [2
|
|
@@ -11787,11 +11825,11 @@ function (_super) {
|
|
|
11787
11825
|
|
|
11788
11826
|
AWSAppSyncRealTimeProvider.prototype._sendUnsubscriptionMessage = function (subscriptionId) {
|
|
11789
11827
|
try {
|
|
11790
|
-
if (this.awsRealTimeSocket && this.awsRealTimeSocket.readyState === WebSocket.OPEN && this.socketStatus === SOCKET_STATUS.READY) {
|
|
11828
|
+
if (this.awsRealTimeSocket && this.awsRealTimeSocket.readyState === WebSocket.OPEN && this.socketStatus === _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].READY) {
|
|
11791
11829
|
// Preparing unsubscribe message to stop receiving messages for that subscription
|
|
11792
11830
|
var unsubscribeMessage = {
|
|
11793
11831
|
id: subscriptionId,
|
|
11794
|
-
type: MESSAGE_TYPES.GQL_STOP
|
|
11832
|
+
type: _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_STOP
|
|
11795
11833
|
};
|
|
11796
11834
|
var stringToAWSRealTime = JSON.stringify(unsubscribeMessage);
|
|
11797
11835
|
this.awsRealTimeSocket.send(stringToAWSRealTime);
|
|
@@ -11817,27 +11855,40 @@ function (_super) {
|
|
|
11817
11855
|
}
|
|
11818
11856
|
|
|
11819
11857
|
if (!this.awsRealTimeSocket) {
|
|
11820
|
-
this.socketStatus = SOCKET_STATUS.CLOSED;
|
|
11858
|
+
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
11821
11859
|
return;
|
|
11822
11860
|
}
|
|
11823
11861
|
|
|
11862
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CLOSING_CONNECTION);
|
|
11863
|
+
|
|
11824
11864
|
if (this.awsRealTimeSocket.bufferedAmount > 0) {
|
|
11825
11865
|
// Still data on the WebSocket
|
|
11826
11866
|
setTimeout(this._closeSocketIfRequired.bind(this), 1000);
|
|
11827
11867
|
} else {
|
|
11828
11868
|
logger.debug('closing WebSocket...');
|
|
11829
|
-
|
|
11869
|
+
|
|
11870
|
+
if (this.keepAliveTimeoutId) {
|
|
11871
|
+
clearTimeout(this.keepAliveTimeoutId);
|
|
11872
|
+
}
|
|
11873
|
+
|
|
11874
|
+
if (this.keepAliveAlertTimeoutId) {
|
|
11875
|
+
clearTimeout(this.keepAliveAlertTimeoutId);
|
|
11876
|
+
}
|
|
11877
|
+
|
|
11830
11878
|
var tempSocket = this.awsRealTimeSocket; // Cleaning callbacks to avoid race condition, socket still exists
|
|
11831
11879
|
|
|
11832
|
-
tempSocket.onclose =
|
|
11833
|
-
tempSocket.onerror =
|
|
11880
|
+
tempSocket.onclose = null;
|
|
11881
|
+
tempSocket.onerror = null;
|
|
11834
11882
|
tempSocket.close(1000);
|
|
11835
|
-
this.awsRealTimeSocket =
|
|
11836
|
-
this.socketStatus = SOCKET_STATUS.CLOSED;
|
|
11883
|
+
this.awsRealTimeSocket = undefined;
|
|
11884
|
+
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
11885
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CLOSED);
|
|
11837
11886
|
}
|
|
11838
11887
|
};
|
|
11839
11888
|
|
|
11840
11889
|
AWSAppSyncRealTimeProvider.prototype._handleIncomingSubscriptionMessage = function (message) {
|
|
11890
|
+
var _this = this;
|
|
11891
|
+
|
|
11841
11892
|
logger.debug("subscription message from AWS AppSync RealTime: " + message.data);
|
|
11842
11893
|
|
|
11843
11894
|
var _a = JSON.parse(message.data),
|
|
@@ -11864,7 +11915,7 @@ function (_super) {
|
|
|
11864
11915
|
variables: variables
|
|
11865
11916
|
});
|
|
11866
11917
|
|
|
11867
|
-
if (type === MESSAGE_TYPES.GQL_DATA && payload && payload.data) {
|
|
11918
|
+
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_DATA && payload && payload.data) {
|
|
11868
11919
|
if (observer) {
|
|
11869
11920
|
observer.next(payload);
|
|
11870
11921
|
} else {
|
|
@@ -11874,7 +11925,7 @@ function (_super) {
|
|
|
11874
11925
|
return;
|
|
11875
11926
|
}
|
|
11876
11927
|
|
|
11877
|
-
if (type === MESSAGE_TYPES.GQL_START_ACK) {
|
|
11928
|
+
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_START_ACK) {
|
|
11878
11929
|
logger.debug("subscription ready for " + JSON.stringify({
|
|
11879
11930
|
query: query,
|
|
11880
11931
|
variables: variables
|
|
@@ -11884,50 +11935,64 @@ function (_super) {
|
|
|
11884
11935
|
subscriptionReadyCallback();
|
|
11885
11936
|
}
|
|
11886
11937
|
|
|
11887
|
-
clearTimeout(startAckTimeoutId);
|
|
11938
|
+
if (startAckTimeoutId) clearTimeout(startAckTimeoutId);
|
|
11888
11939
|
dispatchApiEvent(_index__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].SUBSCRIPTION_ACK, {
|
|
11889
11940
|
query: query,
|
|
11890
11941
|
variables: variables
|
|
11891
11942
|
}, 'Connection established for subscription');
|
|
11892
|
-
var subscriptionState = SUBSCRIPTION_STATUS.CONNECTED;
|
|
11893
|
-
this.subscriptionObserverMap.set(id, {
|
|
11894
|
-
observer: observer,
|
|
11895
|
-
query: query,
|
|
11896
|
-
variables: variables,
|
|
11897
|
-
startAckTimeoutId: null,
|
|
11898
|
-
subscriptionState: subscriptionState,
|
|
11899
|
-
subscriptionReadyCallback: subscriptionReadyCallback,
|
|
11900
|
-
subscriptionFailedCallback: subscriptionFailedCallback
|
|
11901
|
-
}); // TODO: emit event on hub but it requires to store the id first
|
|
11943
|
+
var subscriptionState = _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].CONNECTED;
|
|
11902
11944
|
|
|
11945
|
+
if (observer) {
|
|
11946
|
+
this.subscriptionObserverMap.set(id, {
|
|
11947
|
+
observer: observer,
|
|
11948
|
+
query: query,
|
|
11949
|
+
variables: variables,
|
|
11950
|
+
startAckTimeoutId: undefined,
|
|
11951
|
+
subscriptionState: subscriptionState,
|
|
11952
|
+
subscriptionReadyCallback: subscriptionReadyCallback,
|
|
11953
|
+
subscriptionFailedCallback: subscriptionFailedCallback
|
|
11954
|
+
});
|
|
11955
|
+
}
|
|
11956
|
+
|
|
11957
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CONNECTION_ESTABLISHED);
|
|
11903
11958
|
return;
|
|
11904
11959
|
}
|
|
11905
11960
|
|
|
11906
|
-
if (type === MESSAGE_TYPES.GQL_CONNECTION_KEEP_ALIVE) {
|
|
11907
|
-
clearTimeout(this.keepAliveTimeoutId);
|
|
11908
|
-
|
|
11961
|
+
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_CONNECTION_KEEP_ALIVE) {
|
|
11962
|
+
if (this.keepAliveTimeoutId) clearTimeout(this.keepAliveTimeoutId);
|
|
11963
|
+
if (this.keepAliveAlertTimeoutId) clearTimeout(this.keepAliveAlertTimeoutId);
|
|
11964
|
+
this.keepAliveTimeoutId = setTimeout(function () {
|
|
11965
|
+
return _this._errorDisconnect(_index__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].TIMEOUT_DISCONNECT);
|
|
11966
|
+
}, this.keepAliveTimeout);
|
|
11967
|
+
this.keepAliveAlertTimeoutId = setTimeout(function () {
|
|
11968
|
+
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].KEEP_ALIVE_MISSED);
|
|
11969
|
+
}, _constants__WEBPACK_IMPORTED_MODULE_10__["DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT"]);
|
|
11970
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].KEEP_ALIVE);
|
|
11909
11971
|
return;
|
|
11910
11972
|
}
|
|
11911
11973
|
|
|
11912
|
-
if (type === MESSAGE_TYPES.GQL_ERROR) {
|
|
11913
|
-
var subscriptionState = SUBSCRIPTION_STATUS.FAILED;
|
|
11914
|
-
|
|
11915
|
-
|
|
11916
|
-
|
|
11917
|
-
|
|
11918
|
-
|
|
11919
|
-
|
|
11920
|
-
|
|
11921
|
-
|
|
11922
|
-
|
|
11923
|
-
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
11974
|
+
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_ERROR) {
|
|
11975
|
+
var subscriptionState = _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].FAILED;
|
|
11976
|
+
|
|
11977
|
+
if (observer) {
|
|
11978
|
+
this.subscriptionObserverMap.set(id, {
|
|
11979
|
+
observer: observer,
|
|
11980
|
+
query: query,
|
|
11981
|
+
variables: variables,
|
|
11982
|
+
startAckTimeoutId: startAckTimeoutId,
|
|
11983
|
+
subscriptionReadyCallback: subscriptionReadyCallback,
|
|
11984
|
+
subscriptionFailedCallback: subscriptionFailedCallback,
|
|
11985
|
+
subscriptionState: subscriptionState
|
|
11986
|
+
});
|
|
11987
|
+
observer.error({
|
|
11988
|
+
errors: [__assign({}, new graphql__WEBPACK_IMPORTED_MODULE_1__["GraphQLError"](_index__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].CONNECTION_FAILED + ": " + JSON.stringify(payload)))]
|
|
11989
|
+
});
|
|
11990
|
+
if (startAckTimeoutId) clearTimeout(startAckTimeoutId);
|
|
11991
|
+
observer.complete();
|
|
11928
11992
|
|
|
11929
|
-
|
|
11930
|
-
|
|
11993
|
+
if (typeof subscriptionFailedCallback === 'function') {
|
|
11994
|
+
subscriptionFailedCallback();
|
|
11995
|
+
}
|
|
11931
11996
|
}
|
|
11932
11997
|
}
|
|
11933
11998
|
};
|
|
@@ -11946,44 +12011,48 @@ function (_super) {
|
|
|
11946
12011
|
this.subscriptionObserverMap.clear();
|
|
11947
12012
|
|
|
11948
12013
|
if (this.awsRealTimeSocket) {
|
|
12014
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CLOSED);
|
|
11949
12015
|
this.awsRealTimeSocket.close();
|
|
11950
12016
|
}
|
|
11951
12017
|
|
|
11952
|
-
this.socketStatus = SOCKET_STATUS.CLOSED;
|
|
12018
|
+
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
11953
12019
|
};
|
|
11954
12020
|
|
|
11955
12021
|
AWSAppSyncRealTimeProvider.prototype._timeoutStartSubscriptionAck = function (subscriptionId) {
|
|
11956
|
-
var
|
|
11957
|
-
observer = _a.observer,
|
|
11958
|
-
query = _a.query,
|
|
11959
|
-
variables = _a.variables;
|
|
12022
|
+
var subscriptionObserver = this.subscriptionObserverMap.get(subscriptionId);
|
|
11960
12023
|
|
|
11961
|
-
if (
|
|
11962
|
-
|
|
11963
|
-
|
|
12024
|
+
if (subscriptionObserver) {
|
|
12025
|
+
var observer = subscriptionObserver.observer,
|
|
12026
|
+
query = subscriptionObserver.query,
|
|
12027
|
+
variables = subscriptionObserver.variables;
|
|
11964
12028
|
|
|
11965
|
-
|
|
11966
|
-
|
|
11967
|
-
|
|
11968
|
-
variables: variables,
|
|
11969
|
-
subscriptionState: SUBSCRIPTION_STATUS.FAILED
|
|
11970
|
-
});
|
|
12029
|
+
if (!observer) {
|
|
12030
|
+
return;
|
|
12031
|
+
}
|
|
11971
12032
|
|
|
11972
|
-
|
|
11973
|
-
|
|
11974
|
-
|
|
11975
|
-
|
|
11976
|
-
|
|
11977
|
-
|
|
11978
|
-
}); // Cleanup will be automatically executed
|
|
12033
|
+
this.subscriptionObserverMap.set(subscriptionId, {
|
|
12034
|
+
observer: observer,
|
|
12035
|
+
query: query,
|
|
12036
|
+
variables: variables,
|
|
12037
|
+
subscriptionState: _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].FAILED
|
|
12038
|
+
});
|
|
11979
12039
|
|
|
11980
|
-
observer.
|
|
11981
|
-
|
|
12040
|
+
if (observer && !observer.closed) {
|
|
12041
|
+
observer.error({
|
|
12042
|
+
errors: [__assign({}, new graphql__WEBPACK_IMPORTED_MODULE_1__["GraphQLError"]("Subscription timeout " + JSON.stringify({
|
|
12043
|
+
query: query,
|
|
12044
|
+
variables: variables
|
|
12045
|
+
})))]
|
|
12046
|
+
}); // Cleanup will be automatically executed
|
|
11982
12047
|
|
|
11983
|
-
|
|
11984
|
-
|
|
11985
|
-
|
|
11986
|
-
|
|
12048
|
+
observer.complete();
|
|
12049
|
+
}
|
|
12050
|
+
|
|
12051
|
+
logger.debug('timeoutStartSubscription', JSON.stringify({
|
|
12052
|
+
query: query,
|
|
12053
|
+
variables: variables
|
|
12054
|
+
}));
|
|
12055
|
+
}
|
|
11987
12056
|
};
|
|
11988
12057
|
|
|
11989
12058
|
AWSAppSyncRealTimeProvider.prototype._initializeWebSocketConnection = function (_a) {
|
|
@@ -11995,7 +12064,7 @@ function (_super) {
|
|
|
11995
12064
|
region = _a.region,
|
|
11996
12065
|
additionalHeaders = _a.additionalHeaders;
|
|
11997
12066
|
|
|
11998
|
-
if (this.socketStatus === SOCKET_STATUS.READY) {
|
|
12067
|
+
if (this.socketStatus === _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].READY) {
|
|
11999
12068
|
return;
|
|
12000
12069
|
}
|
|
12001
12070
|
|
|
@@ -12010,7 +12079,7 @@ function (_super) {
|
|
|
12010
12079
|
res: res,
|
|
12011
12080
|
rej: rej
|
|
12012
12081
|
});
|
|
12013
|
-
if (!(this.socketStatus === SOCKET_STATUS.CLOSED)) return [3
|
|
12082
|
+
if (!(this.socketStatus === _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED)) return [3
|
|
12014
12083
|
/*break*/
|
|
12015
12084
|
, 5];
|
|
12016
12085
|
_c.label = 1;
|
|
@@ -12018,7 +12087,7 @@ function (_super) {
|
|
|
12018
12087
|
case 1:
|
|
12019
12088
|
_c.trys.push([1, 4,, 5]);
|
|
12020
12089
|
|
|
12021
|
-
this.socketStatus = SOCKET_STATUS.CONNECTING;
|
|
12090
|
+
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CONNECTING;
|
|
12022
12091
|
payloadString = '{}';
|
|
12023
12092
|
_b = (_a = JSON).stringify;
|
|
12024
12093
|
return [4
|
|
@@ -12037,7 +12106,7 @@ function (_super) {
|
|
|
12037
12106
|
headerString = _b.apply(_a, [_c.sent()]);
|
|
12038
12107
|
headerQs = buffer__WEBPACK_IMPORTED_MODULE_4__["Buffer"].from(headerString).toString('base64');
|
|
12039
12108
|
payloadQs = buffer__WEBPACK_IMPORTED_MODULE_4__["Buffer"].from(payloadString).toString('base64');
|
|
12040
|
-
discoverableEndpoint = appSyncGraphqlEndpoint;
|
|
12109
|
+
discoverableEndpoint = appSyncGraphqlEndpoint !== null && appSyncGraphqlEndpoint !== void 0 ? appSyncGraphqlEndpoint : '';
|
|
12041
12110
|
|
|
12042
12111
|
if (this.isCustomDomain(discoverableEndpoint)) {
|
|
12043
12112
|
discoverableEndpoint = discoverableEndpoint.concat(customDomainPath);
|
|
@@ -12050,9 +12119,7 @@ function (_super) {
|
|
|
12050
12119
|
awsRealTimeUrl = discoverableEndpoint + "?header=" + headerQs + "&payload=" + payloadQs;
|
|
12051
12120
|
return [4
|
|
12052
12121
|
/*yield*/
|
|
12053
|
-
, this._initializeRetryableHandshake(
|
|
12054
|
-
awsRealTimeUrl: awsRealTimeUrl
|
|
12055
|
-
})];
|
|
12122
|
+
, this._initializeRetryableHandshake(awsRealTimeUrl)];
|
|
12056
12123
|
|
|
12057
12124
|
case 3:
|
|
12058
12125
|
_c.sent();
|
|
@@ -12062,7 +12129,7 @@ function (_super) {
|
|
|
12062
12129
|
logger.debug('Notifying connection successful');
|
|
12063
12130
|
res();
|
|
12064
12131
|
});
|
|
12065
|
-
this.socketStatus = SOCKET_STATUS.READY;
|
|
12132
|
+
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].READY;
|
|
12066
12133
|
this.promiseArray = [];
|
|
12067
12134
|
return [3
|
|
12068
12135
|
/*break*/
|
|
@@ -12080,8 +12147,8 @@ function (_super) {
|
|
|
12080
12147
|
this.awsRealTimeSocket.close(3001);
|
|
12081
12148
|
}
|
|
12082
12149
|
|
|
12083
|
-
this.awsRealTimeSocket =
|
|
12084
|
-
this.socketStatus = SOCKET_STATUS.CLOSED;
|
|
12150
|
+
this.awsRealTimeSocket = undefined;
|
|
12151
|
+
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
12085
12152
|
return [3
|
|
12086
12153
|
/*break*/
|
|
12087
12154
|
, 5];
|
|
@@ -12096,21 +12163,18 @@ function (_super) {
|
|
|
12096
12163
|
});
|
|
12097
12164
|
};
|
|
12098
12165
|
|
|
12099
|
-
AWSAppSyncRealTimeProvider.prototype._initializeRetryableHandshake = function (
|
|
12100
|
-
var awsRealTimeUrl = _a.awsRealTimeUrl;
|
|
12166
|
+
AWSAppSyncRealTimeProvider.prototype._initializeRetryableHandshake = function (awsRealTimeUrl) {
|
|
12101
12167
|
return __awaiter(this, void 0, void 0, function () {
|
|
12102
|
-
return __generator(this, function (
|
|
12103
|
-
switch (
|
|
12168
|
+
return __generator(this, function (_a) {
|
|
12169
|
+
switch (_a.label) {
|
|
12104
12170
|
case 0:
|
|
12105
12171
|
logger.debug("Initializaling retryable Handshake");
|
|
12106
12172
|
return [4
|
|
12107
12173
|
/*yield*/
|
|
12108
|
-
, Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["jitteredExponentialRetry"])(this._initializeHandshake.bind(this), [
|
|
12109
|
-
awsRealTimeUrl: awsRealTimeUrl
|
|
12110
|
-
}], MAX_DELAY_MS)];
|
|
12174
|
+
, Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["jitteredExponentialRetry"])(this._initializeHandshake.bind(this), [awsRealTimeUrl], _constants__WEBPACK_IMPORTED_MODULE_10__["MAX_DELAY_MS"])];
|
|
12111
12175
|
|
|
12112
12176
|
case 1:
|
|
12113
|
-
|
|
12177
|
+
_a.sent();
|
|
12114
12178
|
|
|
12115
12179
|
return [2
|
|
12116
12180
|
/*return*/
|
|
@@ -12120,10 +12184,9 @@ function (_super) {
|
|
|
12120
12184
|
});
|
|
12121
12185
|
};
|
|
12122
12186
|
|
|
12123
|
-
AWSAppSyncRealTimeProvider.prototype._initializeHandshake = function (
|
|
12124
|
-
var awsRealTimeUrl = _a.awsRealTimeUrl;
|
|
12187
|
+
AWSAppSyncRealTimeProvider.prototype._initializeHandshake = function (awsRealTimeUrl) {
|
|
12125
12188
|
return __awaiter(this, void 0, void 0, function () {
|
|
12126
|
-
var err_4, errorType, errorCode;
|
|
12189
|
+
var err_4, _a, errorType, errorCode;
|
|
12127
12190
|
|
|
12128
12191
|
var _this = this;
|
|
12129
12192
|
|
|
@@ -12140,13 +12203,15 @@ function (_super) {
|
|
|
12140
12203
|
/*yield*/
|
|
12141
12204
|
, function () {
|
|
12142
12205
|
return new Promise(function (res, rej) {
|
|
12143
|
-
var newSocket =
|
|
12206
|
+
var newSocket = _this.getNewWebSocket(awsRealTimeUrl, 'graphql-ws');
|
|
12144
12207
|
|
|
12145
12208
|
newSocket.onerror = function () {
|
|
12146
12209
|
logger.debug("WebSocket connection error");
|
|
12147
12210
|
};
|
|
12148
12211
|
|
|
12149
12212
|
newSocket.onclose = function () {
|
|
12213
|
+
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CONNECTION_FAILED);
|
|
12214
|
+
|
|
12150
12215
|
rej(new Error('Connection handshake error'));
|
|
12151
12216
|
};
|
|
12152
12217
|
|
|
@@ -12165,77 +12230,86 @@ function (_super) {
|
|
|
12165
12230
|
/*yield*/
|
|
12166
12231
|
, function () {
|
|
12167
12232
|
return new Promise(function (res, rej) {
|
|
12168
|
-
|
|
12233
|
+
if (_this.awsRealTimeSocket) {
|
|
12234
|
+
var ackOk_1 = false;
|
|
12169
12235
|
|
|
12170
|
-
|
|
12171
|
-
|
|
12172
|
-
|
|
12236
|
+
_this.awsRealTimeSocket.onerror = function (error) {
|
|
12237
|
+
logger.debug("WebSocket error " + JSON.stringify(error));
|
|
12238
|
+
};
|
|
12173
12239
|
|
|
12174
|
-
|
|
12175
|
-
|
|
12176
|
-
|
|
12177
|
-
|
|
12240
|
+
_this.awsRealTimeSocket.onclose = function (event) {
|
|
12241
|
+
logger.debug("WebSocket closed " + event.reason);
|
|
12242
|
+
rej(new Error(JSON.stringify(event)));
|
|
12243
|
+
};
|
|
12178
12244
|
|
|
12179
|
-
|
|
12180
|
-
|
|
12181
|
-
|
|
12182
|
-
|
|
12183
|
-
|
|
12184
|
-
|
|
12185
|
-
|
|
12245
|
+
_this.awsRealTimeSocket.onmessage = function (message) {
|
|
12246
|
+
logger.debug("subscription message from AWS AppSyncRealTime: " + message.data + " ");
|
|
12247
|
+
var data = JSON.parse(message.data);
|
|
12248
|
+
var type = data.type,
|
|
12249
|
+
_a = data.payload,
|
|
12250
|
+
_b = (_a === void 0 ? {} : _a).connectionTimeoutMs,
|
|
12251
|
+
connectionTimeoutMs = _b === void 0 ? _constants__WEBPACK_IMPORTED_MODULE_10__["DEFAULT_KEEP_ALIVE_TIMEOUT"] : _b;
|
|
12186
12252
|
|
|
12187
|
-
|
|
12188
|
-
|
|
12189
|
-
_this.keepAliveTimeout = connectionTimeoutMs;
|
|
12190
|
-
_this.awsRealTimeSocket.onmessage = _this._handleIncomingSubscriptionMessage.bind(_this);
|
|
12253
|
+
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_CONNECTION_ACK) {
|
|
12254
|
+
ackOk_1 = true;
|
|
12191
12255
|
|
|
12192
|
-
|
|
12193
|
-
|
|
12256
|
+
if (_this.awsRealTimeSocket) {
|
|
12257
|
+
_this.keepAliveTimeout = connectionTimeoutMs;
|
|
12258
|
+
_this.awsRealTimeSocket.onmessage = _this._handleIncomingSubscriptionMessage.bind(_this);
|
|
12194
12259
|
|
|
12195
|
-
|
|
12196
|
-
|
|
12260
|
+
_this.awsRealTimeSocket.onerror = function (err) {
|
|
12261
|
+
logger.debug(err);
|
|
12197
12262
|
|
|
12198
|
-
|
|
12199
|
-
|
|
12263
|
+
_this._errorDisconnect(_index__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].CONNECTION_CLOSED);
|
|
12264
|
+
};
|
|
12200
12265
|
|
|
12201
|
-
|
|
12202
|
-
|
|
12266
|
+
_this.awsRealTimeSocket.onclose = function (event) {
|
|
12267
|
+
logger.debug("WebSocket closed " + event.reason);
|
|
12203
12268
|
|
|
12204
|
-
|
|
12205
|
-
|
|
12206
|
-
|
|
12269
|
+
_this._errorDisconnect(_index__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].CONNECTION_CLOSED);
|
|
12270
|
+
};
|
|
12271
|
+
}
|
|
12207
12272
|
|
|
12208
|
-
|
|
12209
|
-
|
|
12210
|
-
|
|
12211
|
-
_e = __read(_d === void 0 ? [] : _d, 1),
|
|
12212
|
-
_f = _e[0],
|
|
12213
|
-
_g = _f === void 0 ? {} : _f,
|
|
12214
|
-
_h = _g.errorType,
|
|
12215
|
-
errorType = _h === void 0 ? '' : _h,
|
|
12216
|
-
_j = _g.errorCode,
|
|
12217
|
-
errorCode = _j === void 0 ? 0 : _j;
|
|
12218
|
-
|
|
12219
|
-
rej({
|
|
12220
|
-
errorType: errorType,
|
|
12221
|
-
errorCode: errorCode
|
|
12222
|
-
});
|
|
12223
|
-
}
|
|
12224
|
-
};
|
|
12273
|
+
res('Cool, connected to AWS AppSyncRealTime');
|
|
12274
|
+
return;
|
|
12275
|
+
}
|
|
12225
12276
|
|
|
12226
|
-
|
|
12227
|
-
|
|
12228
|
-
|
|
12277
|
+
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_CONNECTION_ERROR) {
|
|
12278
|
+
var _c = data.payload,
|
|
12279
|
+
_d = (_c === void 0 ? {} : _c).errors,
|
|
12280
|
+
_e = __read(_d === void 0 ? [] : _d, 1),
|
|
12281
|
+
_f = _e[0],
|
|
12282
|
+
_g = _f === void 0 ? {} : _f,
|
|
12283
|
+
_h = _g.errorType,
|
|
12284
|
+
errorType = _h === void 0 ? '' : _h,
|
|
12285
|
+
_j = _g.errorCode,
|
|
12286
|
+
errorCode = _j === void 0 ? 0 : _j;
|
|
12287
|
+
|
|
12288
|
+
rej({
|
|
12289
|
+
errorType: errorType,
|
|
12290
|
+
errorCode: errorCode
|
|
12291
|
+
});
|
|
12292
|
+
}
|
|
12293
|
+
};
|
|
12229
12294
|
|
|
12230
|
-
|
|
12295
|
+
var gqlInit = {
|
|
12296
|
+
type: _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_CONNECTION_INIT
|
|
12297
|
+
};
|
|
12231
12298
|
|
|
12232
|
-
|
|
12233
|
-
|
|
12234
|
-
|
|
12235
|
-
|
|
12236
|
-
|
|
12299
|
+
_this.awsRealTimeSocket.send(JSON.stringify(gqlInit));
|
|
12300
|
+
|
|
12301
|
+
var checkAckOk_1 = function checkAckOk_1(ackOk) {
|
|
12302
|
+
if (!ackOk) {
|
|
12303
|
+
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CONNECTION_FAILED);
|
|
12304
|
+
|
|
12305
|
+
rej(new Error("Connection timeout: ack from AWSAppSyncRealTime was not received after " + _constants__WEBPACK_IMPORTED_MODULE_10__["CONNECTION_INIT_TIMEOUT"] + " ms"));
|
|
12306
|
+
}
|
|
12307
|
+
};
|
|
12237
12308
|
|
|
12238
|
-
|
|
12309
|
+
setTimeout(function () {
|
|
12310
|
+
return checkAckOk_1(ackOk_1);
|
|
12311
|
+
}, _constants__WEBPACK_IMPORTED_MODULE_10__["CONNECTION_INIT_TIMEOUT"]);
|
|
12312
|
+
}
|
|
12239
12313
|
});
|
|
12240
12314
|
}()];
|
|
12241
12315
|
|
|
@@ -12249,9 +12323,9 @@ function (_super) {
|
|
|
12249
12323
|
|
|
12250
12324
|
case 4:
|
|
12251
12325
|
err_4 = _b.sent();
|
|
12252
|
-
errorType =
|
|
12326
|
+
_a = err_4, errorType = _a.errorType, errorCode = _a.errorCode;
|
|
12253
12327
|
|
|
12254
|
-
if (NON_RETRYABLE_CODES.includes(errorCode)) {
|
|
12328
|
+
if (_constants__WEBPACK_IMPORTED_MODULE_10__["NON_RETRYABLE_CODES"].includes(errorCode)) {
|
|
12255
12329
|
throw new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["NonRetryableError"](errorType);
|
|
12256
12330
|
} else if (errorType) {
|
|
12257
12331
|
throw new Error(errorType);
|
|
@@ -12292,16 +12366,18 @@ function (_super) {
|
|
|
12292
12366
|
AMAZON_COGNITO_USER_POOLS: this._awsRealTimeCUPHeader.bind(this),
|
|
12293
12367
|
AWS_LAMBDA: this._customAuthHeader
|
|
12294
12368
|
};
|
|
12295
|
-
|
|
12296
|
-
|
|
12297
|
-
|
|
12298
|
-
|
|
12299
|
-
|
|
12300
|
-
|
|
12301
|
-
|
|
12302
|
-
}
|
|
12369
|
+
if (!(!authenticationType || !headerHandler[authenticationType])) return [3
|
|
12370
|
+
/*break*/
|
|
12371
|
+
, 1];
|
|
12372
|
+
logger.debug("Authentication type " + authenticationType + " not supported");
|
|
12373
|
+
return [2
|
|
12374
|
+
/*return*/
|
|
12375
|
+
, ''];
|
|
12303
12376
|
|
|
12304
|
-
|
|
12377
|
+
case 1:
|
|
12378
|
+
handler = headerHandler[authenticationType];
|
|
12379
|
+
host = url__WEBPACK_IMPORTED_MODULE_2__["parse"](appSyncGraphqlEndpoint !== null && appSyncGraphqlEndpoint !== void 0 ? appSyncGraphqlEndpoint : '').host;
|
|
12380
|
+
logger.debug("Authenticating with " + authenticationType);
|
|
12305
12381
|
return [4
|
|
12306
12382
|
/*yield*/
|
|
12307
12383
|
, handler({
|
|
@@ -12314,7 +12390,7 @@ function (_super) {
|
|
|
12314
12390
|
additionalHeaders: additionalHeaders
|
|
12315
12391
|
})];
|
|
12316
12392
|
|
|
12317
|
-
case
|
|
12393
|
+
case 2:
|
|
12318
12394
|
result = _b.sent();
|
|
12319
12395
|
return [2
|
|
12320
12396
|
/*return*/
|
|
@@ -12446,10 +12522,14 @@ function (_super) {
|
|
|
12446
12522
|
return [4
|
|
12447
12523
|
/*yield*/
|
|
12448
12524
|
, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["Credentials"].get().then(function (credentials) {
|
|
12525
|
+
var _a = credentials,
|
|
12526
|
+
secretAccessKey = _a.secretAccessKey,
|
|
12527
|
+
accessKeyId = _a.accessKeyId,
|
|
12528
|
+
sessionToken = _a.sessionToken;
|
|
12449
12529
|
return {
|
|
12450
|
-
secret_key:
|
|
12451
|
-
access_key:
|
|
12452
|
-
session_token:
|
|
12530
|
+
secret_key: secretAccessKey,
|
|
12531
|
+
access_key: accessKeyId,
|
|
12532
|
+
session_token: sessionToken
|
|
12453
12533
|
};
|
|
12454
12534
|
})];
|
|
12455
12535
|
|
|
@@ -12459,7 +12539,7 @@ function (_super) {
|
|
|
12459
12539
|
url: "" + appSyncGraphqlEndpoint + canonicalUri,
|
|
12460
12540
|
data: payload,
|
|
12461
12541
|
method: 'POST',
|
|
12462
|
-
headers: __assign({}, AWS_APPSYNC_REALTIME_HEADERS)
|
|
12542
|
+
headers: __assign({}, _constants__WEBPACK_IMPORTED_MODULE_10__["AWS_APPSYNC_REALTIME_HEADERS"])
|
|
12463
12543
|
};
|
|
12464
12544
|
signed_params = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["Signer"].sign(request, creds, endpointInfo);
|
|
12465
12545
|
return [2
|
|
@@ -12474,7 +12554,7 @@ function (_super) {
|
|
|
12474
12554
|
var host = _a.host,
|
|
12475
12555
|
additionalHeaders = _a.additionalHeaders;
|
|
12476
12556
|
|
|
12477
|
-
if (!additionalHeaders
|
|
12557
|
+
if (!additionalHeaders || !additionalHeaders['Authorization']) {
|
|
12478
12558
|
throw new Error('No auth token specified');
|
|
12479
12559
|
}
|
|
12480
12560
|
|
|
@@ -12711,8 +12791,12 @@ var AWSIoTProvider =
|
|
|
12711
12791
|
function (_super) {
|
|
12712
12792
|
__extends(AWSIoTProvider, _super);
|
|
12713
12793
|
|
|
12714
|
-
function AWSIoTProvider() {
|
|
12715
|
-
|
|
12794
|
+
function AWSIoTProvider(options) {
|
|
12795
|
+
if (options === void 0) {
|
|
12796
|
+
options = {};
|
|
12797
|
+
}
|
|
12798
|
+
|
|
12799
|
+
return _super.call(this, options) || this;
|
|
12716
12800
|
}
|
|
12717
12801
|
|
|
12718
12802
|
Object.defineProperty(AWSIoTProvider.prototype, "region", {
|
|
@@ -12791,6 +12875,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
12791
12875
|
/* harmony import */ var _PubSubProvider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./PubSubProvider */ "../pubsub/lib-esm/Providers/PubSubProvider.js");
|
|
12792
12876
|
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
|
|
12793
12877
|
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_4__);
|
|
12878
|
+
/* harmony import */ var _utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/ConnectionStateMonitor */ "../pubsub/lib-esm/utils/ConnectionStateMonitor.js");
|
|
12879
|
+
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./constants */ "../pubsub/lib-esm/Providers/constants.js");
|
|
12880
|
+
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! .. */ "../pubsub/lib-esm/index.js");
|
|
12794
12881
|
function _typeof(obj) {
|
|
12795
12882
|
"@babel/helpers - typeof";
|
|
12796
12883
|
|
|
@@ -13017,6 +13104,9 @@ var __rest = undefined && undefined.__rest || function (s, e) {
|
|
|
13017
13104
|
|
|
13018
13105
|
|
|
13019
13106
|
|
|
13107
|
+
|
|
13108
|
+
|
|
13109
|
+
|
|
13020
13110
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_4__["ConsoleLogger"]('MqttOverWSProvider');
|
|
13021
13111
|
function mqttTopicMatch(filter, topic) {
|
|
13022
13112
|
var filterArray = filter.split('/');
|
|
@@ -13042,21 +13132,27 @@ function () {
|
|
|
13042
13132
|
|
|
13043
13133
|
ClientsQueue.prototype.get = function (clientId, clientFactory) {
|
|
13044
13134
|
return __awaiter(this, void 0, void 0, function () {
|
|
13045
|
-
var
|
|
13135
|
+
var cachedPromise, newPromise;
|
|
13046
13136
|
return __generator(this, function (_a) {
|
|
13047
|
-
|
|
13137
|
+
cachedPromise = this.promises.get(clientId);
|
|
13048
13138
|
|
|
13049
|
-
if (
|
|
13139
|
+
if (cachedPromise) {
|
|
13050
13140
|
return [2
|
|
13051
13141
|
/*return*/
|
|
13052
|
-
,
|
|
13142
|
+
, cachedPromise];
|
|
13143
|
+
}
|
|
13144
|
+
|
|
13145
|
+
if (clientFactory) {
|
|
13146
|
+
newPromise = clientFactory(clientId);
|
|
13147
|
+
this.promises.set(clientId, newPromise);
|
|
13148
|
+
return [2
|
|
13149
|
+
/*return*/
|
|
13150
|
+
, newPromise];
|
|
13053
13151
|
}
|
|
13054
13152
|
|
|
13055
|
-
promise = clientFactory(clientId);
|
|
13056
|
-
this.promises.set(clientId, promise);
|
|
13057
13153
|
return [2
|
|
13058
13154
|
/*return*/
|
|
13059
|
-
,
|
|
13155
|
+
, undefined];
|
|
13060
13156
|
});
|
|
13061
13157
|
});
|
|
13062
13158
|
};
|
|
@@ -13076,6 +13172,14 @@ function () {
|
|
|
13076
13172
|
return ClientsQueue;
|
|
13077
13173
|
}();
|
|
13078
13174
|
|
|
13175
|
+
var dispatchPubSubEvent = function dispatchPubSubEvent(event, data, message) {
|
|
13176
|
+
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_4__["Hub"].dispatch('pubsub', {
|
|
13177
|
+
event: event,
|
|
13178
|
+
data: data,
|
|
13179
|
+
message: message
|
|
13180
|
+
}, 'PubSub', _constants__WEBPACK_IMPORTED_MODULE_6__["AMPLIFY_SYMBOL"]);
|
|
13181
|
+
};
|
|
13182
|
+
|
|
13079
13183
|
var topicSymbol = typeof Symbol !== 'undefined' ? Symbol('topic') : '@@topic';
|
|
13080
13184
|
|
|
13081
13185
|
var MqttOverWSProvider =
|
|
@@ -13093,8 +13197,17 @@ function (_super) {
|
|
|
13093
13197
|
})) || this;
|
|
13094
13198
|
|
|
13095
13199
|
_this._clientsQueue = new ClientsQueue();
|
|
13200
|
+
_this.connectionStateMonitor = new _utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["ConnectionStateMonitor"]();
|
|
13096
13201
|
_this._topicObservers = new Map();
|
|
13097
|
-
_this._clientIdObservers = new Map();
|
|
13202
|
+
_this._clientIdObservers = new Map(); // Monitor the connection health state and pass changes along to Hub
|
|
13203
|
+
|
|
13204
|
+
_this.connectionStateMonitor.connectionStateObservable.subscribe(function (connectionStateChange) {
|
|
13205
|
+
dispatchPubSubEvent(___WEBPACK_IMPORTED_MODULE_7__["CONNECTION_STATE_CHANGE"], {
|
|
13206
|
+
provider: _this,
|
|
13207
|
+
connectionState: connectionStateChange
|
|
13208
|
+
}, "Connection state is " + connectionStateChange);
|
|
13209
|
+
});
|
|
13210
|
+
|
|
13098
13211
|
return _this;
|
|
13099
13212
|
}
|
|
13100
13213
|
|
|
@@ -13148,6 +13261,10 @@ function (_super) {
|
|
|
13148
13261
|
}, args), null, 2));
|
|
13149
13262
|
var topicsToDelete_1 = [];
|
|
13150
13263
|
|
|
13264
|
+
if (!clientId) {
|
|
13265
|
+
return;
|
|
13266
|
+
}
|
|
13267
|
+
|
|
13151
13268
|
var clientIdObservers = this._clientIdObservers.get(clientId);
|
|
13152
13269
|
|
|
13153
13270
|
if (!clientIdObservers) {
|
|
@@ -13187,6 +13304,7 @@ function (_super) {
|
|
|
13187
13304
|
switch (_b.label) {
|
|
13188
13305
|
case 0:
|
|
13189
13306
|
logger.debug('Creating new MQTT client', clientId);
|
|
13307
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].OPENING_CONNECTION);
|
|
13190
13308
|
client = new paho_mqtt__WEBPACK_IMPORTED_MODULE_0__["Client"](url, clientId); // client.trace = (args) => logger.debug(clientId, JSON.stringify(args, null, 2));
|
|
13191
13309
|
|
|
13192
13310
|
client.onMessageArrived = function (_a) {
|
|
@@ -13204,6 +13322,8 @@ function (_super) {
|
|
|
13204
13322
|
clientId: clientId,
|
|
13205
13323
|
errorCode: errorCode
|
|
13206
13324
|
}, args));
|
|
13325
|
+
|
|
13326
|
+
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CLOSED);
|
|
13207
13327
|
};
|
|
13208
13328
|
|
|
13209
13329
|
return [4
|
|
@@ -13215,13 +13335,18 @@ function (_super) {
|
|
|
13215
13335
|
onSuccess: function onSuccess() {
|
|
13216
13336
|
return resolve(client);
|
|
13217
13337
|
},
|
|
13218
|
-
onFailure:
|
|
13338
|
+
onFailure: function onFailure() {
|
|
13339
|
+
reject();
|
|
13340
|
+
|
|
13341
|
+
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CONNECTION_FAILED);
|
|
13342
|
+
}
|
|
13219
13343
|
});
|
|
13220
13344
|
})];
|
|
13221
13345
|
|
|
13222
13346
|
case 1:
|
|
13223
13347
|
_b.sent();
|
|
13224
13348
|
|
|
13349
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CONNECTION_ESTABLISHED);
|
|
13225
13350
|
return [2
|
|
13226
13351
|
/*return*/
|
|
13227
13352
|
, client];
|
|
@@ -13266,15 +13391,14 @@ function (_super) {
|
|
|
13266
13391
|
case 0:
|
|
13267
13392
|
return [4
|
|
13268
13393
|
/*yield*/
|
|
13269
|
-
, this.clientsQueue.get(clientId
|
|
13270
|
-
return null;
|
|
13271
|
-
})];
|
|
13394
|
+
, this.clientsQueue.get(clientId)];
|
|
13272
13395
|
|
|
13273
13396
|
case 1:
|
|
13274
13397
|
client = _a.sent();
|
|
13275
13398
|
|
|
13276
13399
|
if (client && client.isConnected()) {
|
|
13277
13400
|
client.disconnect();
|
|
13401
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CLOSED);
|
|
13278
13402
|
}
|
|
13279
13403
|
|
|
13280
13404
|
this.clientsQueue.remove(clientId);
|
|
@@ -13447,13 +13571,16 @@ function (_super) {
|
|
|
13447
13571
|
})();
|
|
13448
13572
|
|
|
13449
13573
|
return function () {
|
|
13574
|
+
var _a, _b;
|
|
13575
|
+
|
|
13450
13576
|
logger.debug('Unsubscribing from topic(s)', targetTopics.join(','));
|
|
13451
13577
|
|
|
13452
13578
|
if (client) {
|
|
13453
|
-
_this._clientIdObservers.get(clientId)["delete"](observer); // No more observers per client => client not needed anymore
|
|
13579
|
+
(_a = _this._clientIdObservers.get(clientId)) === null || _a === void 0 ? void 0 : _a["delete"](observer); // No more observers per client => client not needed anymore
|
|
13454
13580
|
|
|
13581
|
+
if (((_b = _this._clientIdObservers.get(clientId)) === null || _b === void 0 ? void 0 : _b.size) === 0) {
|
|
13582
|
+
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CLOSING_CONNECTION);
|
|
13455
13583
|
|
|
13456
|
-
if (_this._clientIdObservers.get(clientId).size === 0) {
|
|
13457
13584
|
_this.disconnect(clientId);
|
|
13458
13585
|
|
|
13459
13586
|
_this._clientIdObservers["delete"](clientId);
|
|
@@ -13553,6 +13680,137 @@ function () {
|
|
|
13553
13680
|
|
|
13554
13681
|
|
|
13555
13682
|
|
|
13683
|
+
/***/ }),
|
|
13684
|
+
|
|
13685
|
+
/***/ "../pubsub/lib-esm/Providers/constants.js":
|
|
13686
|
+
/*!************************************************!*\
|
|
13687
|
+
!*** ../pubsub/lib-esm/Providers/constants.js ***!
|
|
13688
|
+
\************************************************/
|
|
13689
|
+
/*! 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, DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT */
|
|
13690
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
13691
|
+
|
|
13692
|
+
"use strict";
|
|
13693
|
+
__webpack_require__.r(__webpack_exports__);
|
|
13694
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MAX_DELAY_MS", function() { return MAX_DELAY_MS; });
|
|
13695
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NON_RETRYABLE_CODES", function() { return NON_RETRYABLE_CODES; });
|
|
13696
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MESSAGE_TYPES", function() { return MESSAGE_TYPES; });
|
|
13697
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SUBSCRIPTION_STATUS", function() { return SUBSCRIPTION_STATUS; });
|
|
13698
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SOCKET_STATUS", function() { return SOCKET_STATUS; });
|
|
13699
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AMPLIFY_SYMBOL", function() { return AMPLIFY_SYMBOL; });
|
|
13700
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AWS_APPSYNC_REALTIME_HEADERS", function() { return AWS_APPSYNC_REALTIME_HEADERS; });
|
|
13701
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CONNECTION_INIT_TIMEOUT", function() { return CONNECTION_INIT_TIMEOUT; });
|
|
13702
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "START_ACK_TIMEOUT", function() { return START_ACK_TIMEOUT; });
|
|
13703
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_KEEP_ALIVE_TIMEOUT", function() { return DEFAULT_KEEP_ALIVE_TIMEOUT; });
|
|
13704
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT", function() { return DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT; });
|
|
13705
|
+
var MAX_DELAY_MS = 5000;
|
|
13706
|
+
var NON_RETRYABLE_CODES = [400, 401, 403];
|
|
13707
|
+
var MESSAGE_TYPES;
|
|
13708
|
+
|
|
13709
|
+
(function (MESSAGE_TYPES) {
|
|
13710
|
+
/**
|
|
13711
|
+
* Client -> Server message.
|
|
13712
|
+
* This message type is the first message after handshake and this will initialize AWS AppSync RealTime communication
|
|
13713
|
+
*/
|
|
13714
|
+
MESSAGE_TYPES["GQL_CONNECTION_INIT"] = "connection_init";
|
|
13715
|
+
/**
|
|
13716
|
+
* Server -> Client message
|
|
13717
|
+
* This message type is in case there is an issue with AWS AppSync RealTime when establishing connection
|
|
13718
|
+
*/
|
|
13719
|
+
|
|
13720
|
+
MESSAGE_TYPES["GQL_CONNECTION_ERROR"] = "connection_error";
|
|
13721
|
+
/**
|
|
13722
|
+
* Server -> Client message.
|
|
13723
|
+
* This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message
|
|
13724
|
+
*/
|
|
13725
|
+
|
|
13726
|
+
MESSAGE_TYPES["GQL_CONNECTION_ACK"] = "connection_ack";
|
|
13727
|
+
/**
|
|
13728
|
+
* Client -> Server message.
|
|
13729
|
+
* This message type is for register subscriptions with AWS AppSync RealTime
|
|
13730
|
+
*/
|
|
13731
|
+
|
|
13732
|
+
MESSAGE_TYPES["GQL_START"] = "start";
|
|
13733
|
+
/**
|
|
13734
|
+
* Server -> Client message.
|
|
13735
|
+
* This message type is for the ack response from AWS AppSync RealTime for GQL_START message
|
|
13736
|
+
*/
|
|
13737
|
+
|
|
13738
|
+
MESSAGE_TYPES["GQL_START_ACK"] = "start_ack";
|
|
13739
|
+
/**
|
|
13740
|
+
* Server -> Client message.
|
|
13741
|
+
* This message type is for subscription message from AWS AppSync RealTime
|
|
13742
|
+
*/
|
|
13743
|
+
|
|
13744
|
+
MESSAGE_TYPES["GQL_DATA"] = "data";
|
|
13745
|
+
/**
|
|
13746
|
+
* Server -> Client message.
|
|
13747
|
+
* This message type helps the client to know is still receiving messages from AWS AppSync RealTime
|
|
13748
|
+
*/
|
|
13749
|
+
|
|
13750
|
+
MESSAGE_TYPES["GQL_CONNECTION_KEEP_ALIVE"] = "ka";
|
|
13751
|
+
/**
|
|
13752
|
+
* Client -> Server message.
|
|
13753
|
+
* This message type is for unregister subscriptions with AWS AppSync RealTime
|
|
13754
|
+
*/
|
|
13755
|
+
|
|
13756
|
+
MESSAGE_TYPES["GQL_STOP"] = "stop";
|
|
13757
|
+
/**
|
|
13758
|
+
* Server -> Client message.
|
|
13759
|
+
* This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message
|
|
13760
|
+
*/
|
|
13761
|
+
|
|
13762
|
+
MESSAGE_TYPES["GQL_COMPLETE"] = "complete";
|
|
13763
|
+
/**
|
|
13764
|
+
* Server -> Client message.
|
|
13765
|
+
* This message type is for sending error messages from AWS AppSync RealTime to the client
|
|
13766
|
+
*/
|
|
13767
|
+
|
|
13768
|
+
MESSAGE_TYPES["GQL_ERROR"] = "error";
|
|
13769
|
+
})(MESSAGE_TYPES || (MESSAGE_TYPES = {}));
|
|
13770
|
+
|
|
13771
|
+
var SUBSCRIPTION_STATUS;
|
|
13772
|
+
|
|
13773
|
+
(function (SUBSCRIPTION_STATUS) {
|
|
13774
|
+
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["PENDING"] = 0] = "PENDING";
|
|
13775
|
+
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["CONNECTED"] = 1] = "CONNECTED";
|
|
13776
|
+
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["FAILED"] = 2] = "FAILED";
|
|
13777
|
+
})(SUBSCRIPTION_STATUS || (SUBSCRIPTION_STATUS = {}));
|
|
13778
|
+
|
|
13779
|
+
var SOCKET_STATUS;
|
|
13780
|
+
|
|
13781
|
+
(function (SOCKET_STATUS) {
|
|
13782
|
+
SOCKET_STATUS[SOCKET_STATUS["CLOSED"] = 0] = "CLOSED";
|
|
13783
|
+
SOCKET_STATUS[SOCKET_STATUS["READY"] = 1] = "READY";
|
|
13784
|
+
SOCKET_STATUS[SOCKET_STATUS["CONNECTING"] = 2] = "CONNECTING";
|
|
13785
|
+
})(SOCKET_STATUS || (SOCKET_STATUS = {}));
|
|
13786
|
+
|
|
13787
|
+
var AMPLIFY_SYMBOL = typeof Symbol !== 'undefined' && typeof Symbol["for"] === 'function' ? Symbol["for"]('amplify_default') : '@@amplify_default';
|
|
13788
|
+
var AWS_APPSYNC_REALTIME_HEADERS = {
|
|
13789
|
+
accept: 'application/json, text/javascript',
|
|
13790
|
+
'content-encoding': 'amz-1.0',
|
|
13791
|
+
'content-type': 'application/json; charset=UTF-8'
|
|
13792
|
+
};
|
|
13793
|
+
/**
|
|
13794
|
+
* Time in milleseconds to wait for GQL_CONNECTION_INIT message
|
|
13795
|
+
*/
|
|
13796
|
+
|
|
13797
|
+
var CONNECTION_INIT_TIMEOUT = 15000;
|
|
13798
|
+
/**
|
|
13799
|
+
* Time in milleseconds to wait for GQL_START_ACK message
|
|
13800
|
+
*/
|
|
13801
|
+
|
|
13802
|
+
var START_ACK_TIMEOUT = 15000;
|
|
13803
|
+
/**
|
|
13804
|
+
* Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message
|
|
13805
|
+
*/
|
|
13806
|
+
|
|
13807
|
+
var DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;
|
|
13808
|
+
/**
|
|
13809
|
+
* Default Time in milleseconds to alert for missed GQL_CONNECTION_KEEP_ALIVE message
|
|
13810
|
+
*/
|
|
13811
|
+
|
|
13812
|
+
var DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT = 65 * 1000;
|
|
13813
|
+
|
|
13556
13814
|
/***/ }),
|
|
13557
13815
|
|
|
13558
13816
|
/***/ "../pubsub/lib-esm/Providers/index.js":
|
|
@@ -13570,7 +13828,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13570
13828
|
/* harmony import */ var _AWSAppSyncProvider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AWSAppSyncProvider */ "../pubsub/lib-esm/Providers/AWSAppSyncProvider.js");
|
|
13571
13829
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AWSAppSyncProvider", function() { return _AWSAppSyncProvider__WEBPACK_IMPORTED_MODULE_1__["AWSAppSyncProvider"]; });
|
|
13572
13830
|
|
|
13573
|
-
/* harmony import */ var _AWSAppSyncRealTimeProvider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./AWSAppSyncRealTimeProvider */ "../pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js");
|
|
13831
|
+
/* harmony import */ var _AWSAppSyncRealTimeProvider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./AWSAppSyncRealTimeProvider */ "../pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js");
|
|
13574
13832
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AWSAppSyncRealTimeProvider", function() { return _AWSAppSyncRealTimeProvider__WEBPACK_IMPORTED_MODULE_2__["AWSAppSyncRealTimeProvider"]; });
|
|
13575
13833
|
|
|
13576
13834
|
/* harmony import */ var _AWSIotProvider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./AWSIotProvider */ "../pubsub/lib-esm/Providers/AWSIotProvider.js");
|
|
@@ -13788,7 +14046,7 @@ function () {
|
|
|
13788
14046
|
* @param {PubSubOptions} options - Configuration object for PubSub
|
|
13789
14047
|
*/
|
|
13790
14048
|
function PubSubClass(options) {
|
|
13791
|
-
this._options = options;
|
|
14049
|
+
this._options = options !== null && options !== void 0 ? options : {};
|
|
13792
14050
|
logger.debug('PubSub Options', this._options);
|
|
13793
14051
|
this._pluggables = [];
|
|
13794
14052
|
this.subscribe = this.subscribe.bind(this);
|
|
@@ -13977,7 +14235,7 @@ function () {
|
|
|
13977
14235
|
}();
|
|
13978
14236
|
|
|
13979
14237
|
|
|
13980
|
-
var PubSub = new PubSubClass(
|
|
14238
|
+
var PubSub = new PubSubClass();
|
|
13981
14239
|
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Amplify"].register(PubSub);
|
|
13982
14240
|
|
|
13983
14241
|
/***/ }),
|
|
@@ -13986,11 +14244,12 @@ _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Amplify"].register(PubSub);
|
|
|
13986
14244
|
/*!**********************************!*\
|
|
13987
14245
|
!*** ../pubsub/lib-esm/index.js ***!
|
|
13988
14246
|
\**********************************/
|
|
13989
|
-
/*! exports provided: AbstractPubSubProvider, AWSAppSyncProvider, AWSAppSyncRealTimeProvider, AWSIoTProvider, mqttTopicMatch, MqttOverWSProvider, PubSub, CONTROL_MSG, default */
|
|
14247
|
+
/*! exports provided: AbstractPubSubProvider, AWSAppSyncProvider, AWSAppSyncRealTimeProvider, AWSIoTProvider, mqttTopicMatch, MqttOverWSProvider, CONNECTION_STATE_CHANGE, ConnectionState, PubSub, CONTROL_MSG, default */
|
|
13990
14248
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
13991
14249
|
|
|
13992
14250
|
"use strict";
|
|
13993
14251
|
__webpack_require__.r(__webpack_exports__);
|
|
14252
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CONNECTION_STATE_CHANGE", function() { return CONNECTION_STATE_CHANGE; });
|
|
13994
14253
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CONTROL_MSG", function() { return CONTROL_MSG; });
|
|
13995
14254
|
/* harmony import */ var _PubSub__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PubSub */ "../pubsub/lib-esm/PubSub.js");
|
|
13996
14255
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PubSub", function() { return _PubSub__WEBPACK_IMPORTED_MODULE_0__["PubSub"]; });
|
|
@@ -14008,6 +14267,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
14008
14267
|
|
|
14009
14268
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MqttOverWSProvider", function() { return _Providers__WEBPACK_IMPORTED_MODULE_1__["MqttOverWSProvider"]; });
|
|
14010
14269
|
|
|
14270
|
+
/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./types */ "../pubsub/lib-esm/types/index.js");
|
|
14271
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ConnectionState", function() { return _types__WEBPACK_IMPORTED_MODULE_2__["ConnectionState"]; });
|
|
14272
|
+
|
|
14011
14273
|
/*
|
|
14012
14274
|
* Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
14013
14275
|
*
|
|
@@ -14032,6 +14294,8 @@ var CONTROL_MSG;
|
|
|
14032
14294
|
CONTROL_MSG["TIMEOUT_DISCONNECT"] = "Timeout disconnect";
|
|
14033
14295
|
})(CONTROL_MSG || (CONTROL_MSG = {}));
|
|
14034
14296
|
|
|
14297
|
+
var CONNECTION_STATE_CHANGE = 'ConnectionStateChange';
|
|
14298
|
+
|
|
14035
14299
|
|
|
14036
14300
|
/**
|
|
14037
14301
|
* @deprecated use named import
|
|
@@ -14041,6 +14305,278 @@ var CONTROL_MSG;
|
|
|
14041
14305
|
|
|
14042
14306
|
/***/ }),
|
|
14043
14307
|
|
|
14308
|
+
/***/ "../pubsub/lib-esm/types/index.js":
|
|
14309
|
+
/*!****************************************!*\
|
|
14310
|
+
!*** ../pubsub/lib-esm/types/index.js ***!
|
|
14311
|
+
\****************************************/
|
|
14312
|
+
/*! exports provided: ConnectionState */
|
|
14313
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
14314
|
+
|
|
14315
|
+
"use strict";
|
|
14316
|
+
__webpack_require__.r(__webpack_exports__);
|
|
14317
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConnectionState", function() { return ConnectionState; });
|
|
14318
|
+
/** @enum {string} */
|
|
14319
|
+
var ConnectionState;
|
|
14320
|
+
|
|
14321
|
+
(function (ConnectionState) {
|
|
14322
|
+
/*
|
|
14323
|
+
* The connection is alive and healthy
|
|
14324
|
+
*/
|
|
14325
|
+
ConnectionState["Connected"] = "Connected";
|
|
14326
|
+
/*
|
|
14327
|
+
* The connection is alive, but the connection is offline
|
|
14328
|
+
*/
|
|
14329
|
+
|
|
14330
|
+
ConnectionState["ConnectedPendingNetwork"] = "ConnectedPendingNetwork";
|
|
14331
|
+
/*
|
|
14332
|
+
* The connection has been disconnected while in use
|
|
14333
|
+
*/
|
|
14334
|
+
|
|
14335
|
+
ConnectionState["ConnectionDisrupted"] = "ConnectionDisrupted";
|
|
14336
|
+
/*
|
|
14337
|
+
* The connection has been disconnected and the network is offline
|
|
14338
|
+
*/
|
|
14339
|
+
|
|
14340
|
+
ConnectionState["ConnectionDisruptedPendingNetwork"] = "ConnectionDisruptedPendingNetwork";
|
|
14341
|
+
/*
|
|
14342
|
+
* The connection is in the process of connecting
|
|
14343
|
+
*/
|
|
14344
|
+
|
|
14345
|
+
ConnectionState["Connecting"] = "Connecting";
|
|
14346
|
+
/*
|
|
14347
|
+
* The connection is not in use and is being disconnected
|
|
14348
|
+
*/
|
|
14349
|
+
|
|
14350
|
+
ConnectionState["ConnectedPendingDisconnect"] = "ConnectedPendingDisconnect";
|
|
14351
|
+
/*
|
|
14352
|
+
* The connection is not in use and has been disconnected
|
|
14353
|
+
*/
|
|
14354
|
+
|
|
14355
|
+
ConnectionState["Disconnected"] = "Disconnected";
|
|
14356
|
+
/*
|
|
14357
|
+
* The connection is alive, but a keep alive message has been missed
|
|
14358
|
+
*/
|
|
14359
|
+
|
|
14360
|
+
ConnectionState["ConnectedPendingKeepAlive"] = "ConnectedPendingKeepAlive";
|
|
14361
|
+
})(ConnectionState || (ConnectionState = {}));
|
|
14362
|
+
|
|
14363
|
+
/***/ }),
|
|
14364
|
+
|
|
14365
|
+
/***/ "../pubsub/lib-esm/utils/ConnectionStateMonitor.js":
|
|
14366
|
+
/*!*********************************************************!*\
|
|
14367
|
+
!*** ../pubsub/lib-esm/utils/ConnectionStateMonitor.js ***!
|
|
14368
|
+
\*********************************************************/
|
|
14369
|
+
/*! exports provided: CONNECTION_CHANGE, ConnectionStateMonitor */
|
|
14370
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
14371
|
+
|
|
14372
|
+
"use strict";
|
|
14373
|
+
__webpack_require__.r(__webpack_exports__);
|
|
14374
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CONNECTION_CHANGE", function() { return CONNECTION_CHANGE; });
|
|
14375
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConnectionStateMonitor", function() { return ConnectionStateMonitor; });
|
|
14376
|
+
/* harmony import */ var zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! zen-observable-ts */ "../../node_modules/zen-observable-ts/lib/bundle.esm.js");
|
|
14377
|
+
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../index */ "../pubsub/lib-esm/index.js");
|
|
14378
|
+
/* harmony import */ var _ReachabilityMonitor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ReachabilityMonitor */ "../pubsub/lib-esm/utils/ReachabilityMonitor/index.js");
|
|
14379
|
+
/*
|
|
14380
|
+
* Copyright 2017-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
14381
|
+
*
|
|
14382
|
+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
14383
|
+
* the License. A copy of the License is located at
|
|
14384
|
+
*
|
|
14385
|
+
* http://aws.amazon.com/apache2.0/
|
|
14386
|
+
*
|
|
14387
|
+
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
14388
|
+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
|
|
14389
|
+
* and limitations under the License.
|
|
14390
|
+
*/
|
|
14391
|
+
var __assign = undefined && undefined.__assign || function () {
|
|
14392
|
+
__assign = Object.assign || function (t) {
|
|
14393
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
14394
|
+
s = arguments[i];
|
|
14395
|
+
|
|
14396
|
+
for (var p in s) {
|
|
14397
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
14398
|
+
}
|
|
14399
|
+
}
|
|
14400
|
+
|
|
14401
|
+
return t;
|
|
14402
|
+
};
|
|
14403
|
+
|
|
14404
|
+
return __assign.apply(this, arguments);
|
|
14405
|
+
};
|
|
14406
|
+
|
|
14407
|
+
|
|
14408
|
+
|
|
14409
|
+
|
|
14410
|
+
var CONNECTION_CHANGE = {
|
|
14411
|
+
KEEP_ALIVE_MISSED: {
|
|
14412
|
+
keepAliveState: 'unhealthy'
|
|
14413
|
+
},
|
|
14414
|
+
KEEP_ALIVE: {
|
|
14415
|
+
keepAliveState: 'healthy'
|
|
14416
|
+
},
|
|
14417
|
+
CONNECTION_ESTABLISHED: {
|
|
14418
|
+
connectionState: 'connected'
|
|
14419
|
+
},
|
|
14420
|
+
CONNECTION_FAILED: {
|
|
14421
|
+
intendedConnectionState: 'disconnected',
|
|
14422
|
+
connectionState: 'disconnected'
|
|
14423
|
+
},
|
|
14424
|
+
CLOSING_CONNECTION: {
|
|
14425
|
+
intendedConnectionState: 'disconnected'
|
|
14426
|
+
},
|
|
14427
|
+
OPENING_CONNECTION: {
|
|
14428
|
+
intendedConnectionState: 'connected',
|
|
14429
|
+
connectionState: 'connecting'
|
|
14430
|
+
},
|
|
14431
|
+
CLOSED: {
|
|
14432
|
+
connectionState: 'disconnected'
|
|
14433
|
+
},
|
|
14434
|
+
ONLINE: {
|
|
14435
|
+
networkState: 'connected'
|
|
14436
|
+
},
|
|
14437
|
+
OFFLINE: {
|
|
14438
|
+
networkState: 'disconnected'
|
|
14439
|
+
}
|
|
14440
|
+
};
|
|
14441
|
+
|
|
14442
|
+
var ConnectionStateMonitor =
|
|
14443
|
+
/** @class */
|
|
14444
|
+
function () {
|
|
14445
|
+
function ConnectionStateMonitor() {
|
|
14446
|
+
var _this = this;
|
|
14447
|
+
|
|
14448
|
+
this._networkMonitoringSubscription = undefined;
|
|
14449
|
+
this._linkedConnectionState = {
|
|
14450
|
+
networkState: 'connected',
|
|
14451
|
+
connectionState: 'disconnected',
|
|
14452
|
+
intendedConnectionState: 'disconnected',
|
|
14453
|
+
keepAliveState: 'healthy'
|
|
14454
|
+
};
|
|
14455
|
+
this._linkedConnectionStateObservable = new zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"](function (connectionStateObserver) {
|
|
14456
|
+
connectionStateObserver.next(_this._linkedConnectionState);
|
|
14457
|
+
_this._linkedConnectionStateObserver = connectionStateObserver;
|
|
14458
|
+
});
|
|
14459
|
+
}
|
|
14460
|
+
/**
|
|
14461
|
+
* Turn network state monitoring on if it isn't on already
|
|
14462
|
+
*/
|
|
14463
|
+
|
|
14464
|
+
|
|
14465
|
+
ConnectionStateMonitor.prototype.enableNetworkMonitoring = function () {
|
|
14466
|
+
var _this = this; // Maintain the network state based on the reachability monitor
|
|
14467
|
+
|
|
14468
|
+
|
|
14469
|
+
if (this._networkMonitoringSubscription === undefined) {
|
|
14470
|
+
this._networkMonitoringSubscription = Object(_ReachabilityMonitor__WEBPACK_IMPORTED_MODULE_2__["ReachabilityMonitor"])().subscribe(function (_a) {
|
|
14471
|
+
var online = _a.online;
|
|
14472
|
+
|
|
14473
|
+
_this.record(online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE);
|
|
14474
|
+
});
|
|
14475
|
+
}
|
|
14476
|
+
};
|
|
14477
|
+
/**
|
|
14478
|
+
* Turn network state monitoring off if it isn't off already
|
|
14479
|
+
*/
|
|
14480
|
+
|
|
14481
|
+
|
|
14482
|
+
ConnectionStateMonitor.prototype.disableNetworkMonitoring = function () {
|
|
14483
|
+
var _a;
|
|
14484
|
+
|
|
14485
|
+
(_a = this._networkMonitoringSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
14486
|
+
this._networkMonitoringSubscription = undefined;
|
|
14487
|
+
};
|
|
14488
|
+
|
|
14489
|
+
Object.defineProperty(ConnectionStateMonitor.prototype, "connectionStateObservable", {
|
|
14490
|
+
/**
|
|
14491
|
+
* Get the observable that allows us to monitor the connection state
|
|
14492
|
+
*
|
|
14493
|
+
* @returns {Observable<ConnectionState>} - The observable that emits ConnectionState updates
|
|
14494
|
+
*/
|
|
14495
|
+
get: function get() {
|
|
14496
|
+
var _this = this;
|
|
14497
|
+
|
|
14498
|
+
var previous; // The linked state aggregates state changes to any of the network, connection,
|
|
14499
|
+
// intendedConnection and keepAliveHealth. Some states will change these independent
|
|
14500
|
+
// states without changing the overall connection state.
|
|
14501
|
+
// After translating from linked states to ConnectionState, then remove any duplicates
|
|
14502
|
+
|
|
14503
|
+
return this._linkedConnectionStateObservable.map(function (value) {
|
|
14504
|
+
return _this.connectionStatesTranslator(value);
|
|
14505
|
+
}).filter(function (current) {
|
|
14506
|
+
var toInclude = current !== previous;
|
|
14507
|
+
previous = current;
|
|
14508
|
+
return toInclude;
|
|
14509
|
+
});
|
|
14510
|
+
},
|
|
14511
|
+
enumerable: true,
|
|
14512
|
+
configurable: true
|
|
14513
|
+
});
|
|
14514
|
+
/*
|
|
14515
|
+
* Updates local connection state and emits the full state to the observer.
|
|
14516
|
+
*/
|
|
14517
|
+
|
|
14518
|
+
ConnectionStateMonitor.prototype.record = function (statusUpdates) {
|
|
14519
|
+
// Maintain the network monitor
|
|
14520
|
+
if (statusUpdates.intendedConnectionState === 'connected') {
|
|
14521
|
+
this.enableNetworkMonitoring();
|
|
14522
|
+
} else if (statusUpdates.intendedConnectionState === 'disconnected') {
|
|
14523
|
+
this.disableNetworkMonitoring();
|
|
14524
|
+
} // Maintain the socket state
|
|
14525
|
+
|
|
14526
|
+
|
|
14527
|
+
var newSocketStatus = __assign(__assign({}, this._linkedConnectionState), statusUpdates);
|
|
14528
|
+
|
|
14529
|
+
this._linkedConnectionState = __assign({}, newSocketStatus);
|
|
14530
|
+
|
|
14531
|
+
this._linkedConnectionStateObserver.next(this._linkedConnectionState);
|
|
14532
|
+
};
|
|
14533
|
+
/*
|
|
14534
|
+
* Translate the ConnectionState structure into a specific ConnectionState string literal union
|
|
14535
|
+
*/
|
|
14536
|
+
|
|
14537
|
+
|
|
14538
|
+
ConnectionStateMonitor.prototype.connectionStatesTranslator = function (_a) {
|
|
14539
|
+
var connectionState = _a.connectionState,
|
|
14540
|
+
networkState = _a.networkState,
|
|
14541
|
+
intendedConnectionState = _a.intendedConnectionState,
|
|
14542
|
+
keepAliveState = _a.keepAliveState;
|
|
14543
|
+
if (connectionState === 'connected' && networkState === 'disconnected') return _index__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].ConnectedPendingNetwork;
|
|
14544
|
+
if (connectionState === 'connected' && intendedConnectionState === 'disconnected') return _index__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].ConnectedPendingDisconnect;
|
|
14545
|
+
if (connectionState === 'disconnected' && intendedConnectionState === 'connected' && networkState === 'disconnected') return _index__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].ConnectionDisruptedPendingNetwork;
|
|
14546
|
+
if (connectionState === 'disconnected' && intendedConnectionState === 'connected') return _index__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].ConnectionDisrupted;
|
|
14547
|
+
if (connectionState === 'connected' && keepAliveState === 'unhealthy') return _index__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].ConnectedPendingKeepAlive; // All remaining states directly correspond to the connection state
|
|
14548
|
+
|
|
14549
|
+
if (connectionState === 'connecting') return _index__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].Connecting;
|
|
14550
|
+
if (connectionState === 'disconnected') return _index__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].Disconnected;
|
|
14551
|
+
return _index__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].Connected;
|
|
14552
|
+
};
|
|
14553
|
+
|
|
14554
|
+
return ConnectionStateMonitor;
|
|
14555
|
+
}();
|
|
14556
|
+
|
|
14557
|
+
|
|
14558
|
+
|
|
14559
|
+
/***/ }),
|
|
14560
|
+
|
|
14561
|
+
/***/ "../pubsub/lib-esm/utils/ReachabilityMonitor/index.js":
|
|
14562
|
+
/*!************************************************************!*\
|
|
14563
|
+
!*** ../pubsub/lib-esm/utils/ReachabilityMonitor/index.js ***!
|
|
14564
|
+
\************************************************************/
|
|
14565
|
+
/*! exports provided: ReachabilityMonitor */
|
|
14566
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
14567
|
+
|
|
14568
|
+
"use strict";
|
|
14569
|
+
__webpack_require__.r(__webpack_exports__);
|
|
14570
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReachabilityMonitor", function() { return ReachabilityMonitor; });
|
|
14571
|
+
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
|
|
14572
|
+
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__);
|
|
14573
|
+
|
|
14574
|
+
var ReachabilityMonitor = function ReachabilityMonitor() {
|
|
14575
|
+
return new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Reachability"]().networkMonitor();
|
|
14576
|
+
};
|
|
14577
|
+
|
|
14578
|
+
/***/ }),
|
|
14579
|
+
|
|
14044
14580
|
/***/ "./lib-esm/GraphQLAPI.js":
|
|
14045
14581
|
/*!*******************************!*\
|
|
14046
14582
|
!*** ./lib-esm/GraphQLAPI.js ***!
|
|
@@ -14285,7 +14821,7 @@ var __read = undefined && undefined.__read || function (o, n) {
|
|
|
14285
14821
|
|
|
14286
14822
|
var USER_AGENT_HEADER = 'x-amz-user-agent';
|
|
14287
14823
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('GraphQLAPI');
|
|
14288
|
-
var graphqlOperation = function graphqlOperation(query, variables, authToken) {
|
|
14824
|
+
var graphqlOperation = function graphqlOperation(query, variables, authToken, userAgentSuffix) {
|
|
14289
14825
|
if (variables === void 0) {
|
|
14290
14826
|
variables = {};
|
|
14291
14827
|
}
|
|
@@ -14293,7 +14829,8 @@ var graphqlOperation = function graphqlOperation(query, variables, authToken) {
|
|
|
14293
14829
|
return {
|
|
14294
14830
|
query: query,
|
|
14295
14831
|
variables: variables,
|
|
14296
|
-
authToken: authToken
|
|
14832
|
+
authToken: authToken,
|
|
14833
|
+
userAgentSuffix: userAgentSuffix
|
|
14297
14834
|
};
|
|
14298
14835
|
};
|
|
14299
14836
|
/**
|
|
@@ -14573,9 +15110,9 @@ function () {
|
|
|
14573
15110
|
/**
|
|
14574
15111
|
* Executes a GraphQL operation
|
|
14575
15112
|
*
|
|
14576
|
-
* @param
|
|
14577
|
-
* @param
|
|
14578
|
-
* @returns
|
|
15113
|
+
* @param options - GraphQL Options
|
|
15114
|
+
* @param [additionalHeaders] - headers to merge in after any `graphql_headers` set in the config
|
|
15115
|
+
* @returns An Observable if the query is a subscription query, else a promise of the graphql result.
|
|
14579
15116
|
*/
|
|
14580
15117
|
|
|
14581
15118
|
|
|
@@ -14584,7 +15121,8 @@ function () {
|
|
|
14584
15121
|
_b = _a.variables,
|
|
14585
15122
|
variables = _b === void 0 ? {} : _b,
|
|
14586
15123
|
authMode = _a.authMode,
|
|
14587
|
-
authToken = _a.authToken
|
|
15124
|
+
authToken = _a.authToken,
|
|
15125
|
+
userAgentSuffix = _a.userAgentSuffix;
|
|
14588
15126
|
var query = typeof paramQuery === 'string' ? Object(graphql__WEBPACK_IMPORTED_MODULE_0__["parse"])(paramQuery) : Object(graphql__WEBPACK_IMPORTED_MODULE_0__["parse"])(Object(graphql__WEBPACK_IMPORTED_MODULE_0__["print"])(paramQuery));
|
|
14589
15127
|
|
|
14590
15128
|
var _c = __read(query.definitions.filter(function (def) {
|
|
@@ -14612,7 +15150,8 @@ function () {
|
|
|
14612
15150
|
var responsePromise = this._graphql({
|
|
14613
15151
|
query: query,
|
|
14614
15152
|
variables: variables,
|
|
14615
|
-
authMode: authMode
|
|
15153
|
+
authMode: authMode,
|
|
15154
|
+
userAgentSuffix: userAgentSuffix
|
|
14616
15155
|
}, headers, initParams);
|
|
14617
15156
|
|
|
14618
15157
|
this._api.updateRequestToBeCancellable(responsePromise, cancellableToken);
|
|
@@ -14625,15 +15164,17 @@ function () {
|
|
|
14625
15164
|
variables: variables,
|
|
14626
15165
|
authMode: authMode
|
|
14627
15166
|
}, headers);
|
|
14628
|
-
}
|
|
14629
15167
|
|
|
14630
|
-
|
|
15168
|
+
default:
|
|
15169
|
+
throw new Error("invalid operation type: " + operationType);
|
|
15170
|
+
}
|
|
14631
15171
|
};
|
|
14632
15172
|
|
|
14633
15173
|
GraphQLAPIClass.prototype._graphql = function (_a, additionalHeaders, initParams) {
|
|
14634
15174
|
var query = _a.query,
|
|
14635
15175
|
variables = _a.variables,
|
|
14636
|
-
authMode = _a.authMode
|
|
15176
|
+
authMode = _a.authMode,
|
|
15177
|
+
userAgentSuffix = _a.userAgentSuffix;
|
|
14637
15178
|
|
|
14638
15179
|
if (additionalHeaders === void 0) {
|
|
14639
15180
|
additionalHeaders = {};
|
|
@@ -14719,7 +15260,7 @@ function () {
|
|
|
14719
15260
|
})];
|
|
14720
15261
|
|
|
14721
15262
|
case 9:
|
|
14722
|
-
headers = __assign.apply(void 0, [__assign.apply(void 0, [__assign.apply(void 0, _j.concat([_l.sent()])), additionalHeaders]), !customGraphqlEndpoint && (_k = {}, _k[USER_AGENT_HEADER] = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["
|
|
15263
|
+
headers = __assign.apply(void 0, [__assign.apply(void 0, [__assign.apply(void 0, _j.concat([_l.sent()])), additionalHeaders]), !customGraphqlEndpoint && (_k = {}, _k[USER_AGENT_HEADER] = Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["getAmplifyUserAgent"])(userAgentSuffix), _k)]);
|
|
14723
15264
|
body = {
|
|
14724
15265
|
query: Object(graphql__WEBPACK_IMPORTED_MODULE_0__["print"])(query),
|
|
14725
15266
|
variables: variables
|
|
@@ -14808,6 +15349,16 @@ function () {
|
|
|
14808
15349
|
GraphQLAPIClass.prototype.cancel = function (request, message) {
|
|
14809
15350
|
return this._api.cancel(request, message);
|
|
14810
15351
|
};
|
|
15352
|
+
/**
|
|
15353
|
+
* Check if the request has a corresponding cancel token in the WeakMap.
|
|
15354
|
+
* @params request - The request promise
|
|
15355
|
+
* @return if the request has a corresponding cancel token.
|
|
15356
|
+
*/
|
|
15357
|
+
|
|
15358
|
+
|
|
15359
|
+
GraphQLAPIClass.prototype.hasCancelToken = function (request) {
|
|
15360
|
+
return this._api.hasCancelToken(request);
|
|
15361
|
+
};
|
|
14811
15362
|
|
|
14812
15363
|
GraphQLAPIClass.prototype._graphqlSubscribe = function (_a, additionalHeaders) {
|
|
14813
15364
|
var query = _a.query,
|
|
@@ -14928,17 +15479,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
14928
15479
|
|
|
14929
15480
|
"use strict";
|
|
14930
15481
|
__webpack_require__.r(__webpack_exports__);
|
|
14931
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GRAPHQL_AUTH_MODE", function() { return GRAPHQL_AUTH_MODE; });
|
|
14932
15482
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GraphQLAuthError", function() { return GraphQLAuthError; });
|
|
14933
|
-
var
|
|
14934
|
-
|
|
14935
|
-
(
|
|
14936
|
-
|
|
14937
|
-
|
|
14938
|
-
GRAPHQL_AUTH_MODE["OPENID_CONNECT"] = "OPENID_CONNECT";
|
|
14939
|
-
GRAPHQL_AUTH_MODE["AMAZON_COGNITO_USER_POOLS"] = "AMAZON_COGNITO_USER_POOLS";
|
|
14940
|
-
GRAPHQL_AUTH_MODE["AWS_LAMBDA"] = "AWS_LAMBDA";
|
|
14941
|
-
})(GRAPHQL_AUTH_MODE || (GRAPHQL_AUTH_MODE = {}));
|
|
15483
|
+
/* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/auth */ "@aws-amplify/auth");
|
|
15484
|
+
/* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_0__);
|
|
15485
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GRAPHQL_AUTH_MODE", function() { return _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_0__["GRAPHQL_AUTH_MODE"]; });
|
|
15486
|
+
|
|
15487
|
+
|
|
14942
15488
|
|
|
14943
15489
|
var GraphQLAuthError;
|
|
14944
15490
|
|