@aws-amplify/pubsub 4.5.6-unstable.2 → 4.5.6
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 +8 -0
- package/dist/aws-amplify-pubsub.js +271 -1016
- package/dist/aws-amplify-pubsub.js.map +1 -1
- package/dist/aws-amplify-pubsub.min.js.map +1 -1
- package/package.json +5 -5
|
@@ -7095,28 +7095,22 @@ var __extends = undefined && undefined.__extends || function () {
|
|
|
7095
7095
|
if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
7096
7096
|
}
|
|
7097
7097
|
};
|
|
7098
|
-
|
|
7099
7098
|
return _extendStatics(d, b);
|
|
7100
7099
|
};
|
|
7101
|
-
|
|
7102
7100
|
return function (d, b) {
|
|
7103
7101
|
_extendStatics(d, b);
|
|
7104
|
-
|
|
7105
7102
|
function __() {
|
|
7106
7103
|
this.constructor = d;
|
|
7107
7104
|
}
|
|
7108
|
-
|
|
7109
7105
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
7110
7106
|
};
|
|
7111
7107
|
}();
|
|
7112
|
-
|
|
7113
7108
|
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
7114
7109
|
function adopt(value) {
|
|
7115
7110
|
return value instanceof P ? value : new P(function (resolve) {
|
|
7116
7111
|
resolve(value);
|
|
7117
7112
|
});
|
|
7118
7113
|
}
|
|
7119
|
-
|
|
7120
7114
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7121
7115
|
function fulfilled(value) {
|
|
7122
7116
|
try {
|
|
@@ -7125,7 +7119,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
7125
7119
|
reject(e);
|
|
7126
7120
|
}
|
|
7127
7121
|
}
|
|
7128
|
-
|
|
7129
7122
|
function rejected(value) {
|
|
7130
7123
|
try {
|
|
7131
7124
|
step(generator["throw"](value));
|
|
@@ -7133,29 +7126,26 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
7133
7126
|
reject(e);
|
|
7134
7127
|
}
|
|
7135
7128
|
}
|
|
7136
|
-
|
|
7137
7129
|
function step(result) {
|
|
7138
7130
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
7139
7131
|
}
|
|
7140
|
-
|
|
7141
7132
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7142
7133
|
});
|
|
7143
7134
|
};
|
|
7144
|
-
|
|
7145
7135
|
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
7146
7136
|
var _ = {
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7137
|
+
label: 0,
|
|
7138
|
+
sent: function sent() {
|
|
7139
|
+
if (t[0] & 1) throw t[1];
|
|
7140
|
+
return t[1];
|
|
7141
|
+
},
|
|
7142
|
+
trys: [],
|
|
7143
|
+
ops: []
|
|
7151
7144
|
},
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
y,
|
|
7157
|
-
t,
|
|
7158
|
-
g;
|
|
7145
|
+
f,
|
|
7146
|
+
y,
|
|
7147
|
+
t,
|
|
7148
|
+
g;
|
|
7159
7149
|
return g = {
|
|
7160
7150
|
next: verb(0),
|
|
7161
7151
|
"throw": verb(1),
|
|
@@ -7163,79 +7153,60 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
7163
7153
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
7164
7154
|
return this;
|
|
7165
7155
|
}), g;
|
|
7166
|
-
|
|
7167
7156
|
function verb(n) {
|
|
7168
7157
|
return function (v) {
|
|
7169
7158
|
return step([n, v]);
|
|
7170
7159
|
};
|
|
7171
7160
|
}
|
|
7172
|
-
|
|
7173
7161
|
function step(op) {
|
|
7174
7162
|
if (f) throw new TypeError("Generator is already executing.");
|
|
7175
|
-
|
|
7176
7163
|
while (_) {
|
|
7177
7164
|
try {
|
|
7178
7165
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
7179
7166
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
7180
|
-
|
|
7181
7167
|
switch (op[0]) {
|
|
7182
7168
|
case 0:
|
|
7183
7169
|
case 1:
|
|
7184
7170
|
t = op;
|
|
7185
7171
|
break;
|
|
7186
|
-
|
|
7187
7172
|
case 4:
|
|
7188
7173
|
_.label++;
|
|
7189
7174
|
return {
|
|
7190
7175
|
value: op[1],
|
|
7191
7176
|
done: false
|
|
7192
7177
|
};
|
|
7193
|
-
|
|
7194
7178
|
case 5:
|
|
7195
7179
|
_.label++;
|
|
7196
7180
|
y = op[1];
|
|
7197
7181
|
op = [0];
|
|
7198
7182
|
continue;
|
|
7199
|
-
|
|
7200
7183
|
case 7:
|
|
7201
7184
|
op = _.ops.pop();
|
|
7202
|
-
|
|
7203
7185
|
_.trys.pop();
|
|
7204
|
-
|
|
7205
7186
|
continue;
|
|
7206
|
-
|
|
7207
7187
|
default:
|
|
7208
7188
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
7209
7189
|
_ = 0;
|
|
7210
7190
|
continue;
|
|
7211
7191
|
}
|
|
7212
|
-
|
|
7213
7192
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
7214
7193
|
_.label = op[1];
|
|
7215
7194
|
break;
|
|
7216
7195
|
}
|
|
7217
|
-
|
|
7218
7196
|
if (op[0] === 6 && _.label < t[1]) {
|
|
7219
7197
|
_.label = t[1];
|
|
7220
7198
|
t = op;
|
|
7221
7199
|
break;
|
|
7222
7200
|
}
|
|
7223
|
-
|
|
7224
7201
|
if (t && _.label < t[2]) {
|
|
7225
7202
|
_.label = t[2];
|
|
7226
|
-
|
|
7227
7203
|
_.ops.push(op);
|
|
7228
|
-
|
|
7229
7204
|
break;
|
|
7230
7205
|
}
|
|
7231
|
-
|
|
7232
7206
|
if (t[2]) _.ops.pop();
|
|
7233
|
-
|
|
7234
7207
|
_.trys.pop();
|
|
7235
|
-
|
|
7236
7208
|
continue;
|
|
7237
7209
|
}
|
|
7238
|
-
|
|
7239
7210
|
op = body.call(thisArg, _);
|
|
7240
7211
|
} catch (e) {
|
|
7241
7212
|
op = [6, e];
|
|
@@ -7244,7 +7215,6 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
7244
7215
|
f = t = 0;
|
|
7245
7216
|
}
|
|
7246
7217
|
}
|
|
7247
|
-
|
|
7248
7218
|
if (op[0] & 5) throw op[1];
|
|
7249
7219
|
return {
|
|
7250
7220
|
value: op[0] ? op[1] : void 0,
|
|
@@ -7252,28 +7222,23 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
7252
7222
|
};
|
|
7253
7223
|
}
|
|
7254
7224
|
};
|
|
7255
|
-
|
|
7256
7225
|
var __rest = undefined && undefined.__rest || function (s, e) {
|
|
7257
7226
|
var t = {};
|
|
7258
|
-
|
|
7259
7227
|
for (var p in s) {
|
|
7260
7228
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
7261
7229
|
}
|
|
7262
|
-
|
|
7263
7230
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7264
7231
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
7265
7232
|
}
|
|
7266
7233
|
return t;
|
|
7267
7234
|
};
|
|
7268
|
-
|
|
7269
7235
|
var __read = undefined && undefined.__read || function (o, n) {
|
|
7270
7236
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
7271
7237
|
if (!m) return o;
|
|
7272
7238
|
var i = m.call(o),
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7239
|
+
r,
|
|
7240
|
+
ar = [],
|
|
7241
|
+
e;
|
|
7277
7242
|
try {
|
|
7278
7243
|
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
7279
7244
|
ar.push(r.value);
|
|
@@ -7289,39 +7254,29 @@ var __read = undefined && undefined.__read || function (o, n) {
|
|
|
7289
7254
|
if (e) throw e.error;
|
|
7290
7255
|
}
|
|
7291
7256
|
}
|
|
7292
|
-
|
|
7293
7257
|
return ar;
|
|
7294
7258
|
};
|
|
7295
|
-
|
|
7296
7259
|
var __spread = undefined && undefined.__spread || function () {
|
|
7297
7260
|
for (var ar = [], i = 0; i < arguments.length; i++) {
|
|
7298
7261
|
ar = ar.concat(__read(arguments[i]));
|
|
7299
7262
|
}
|
|
7300
|
-
|
|
7301
7263
|
return ar;
|
|
7302
7264
|
};
|
|
7303
7265
|
|
|
7304
7266
|
|
|
7305
7267
|
|
|
7306
|
-
|
|
7307
7268
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('AWSAppSyncProvider');
|
|
7308
7269
|
/**
|
|
7309
7270
|
* @deprecated Unused, all usecases have migrated to AWSAppSyncRealtimeProvider
|
|
7310
7271
|
*/
|
|
7311
|
-
|
|
7312
|
-
var AWSAppSyncProvider =
|
|
7313
|
-
/** @class */
|
|
7314
|
-
function (_super) {
|
|
7272
|
+
var AWSAppSyncProvider = /** @class */function (_super) {
|
|
7315
7273
|
__extends(AWSAppSyncProvider, _super);
|
|
7316
|
-
|
|
7317
7274
|
function AWSAppSyncProvider() {
|
|
7318
7275
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
7319
|
-
|
|
7320
7276
|
_this._topicClient = new Map();
|
|
7321
7277
|
_this._topicAlias = new Map();
|
|
7322
7278
|
return _this;
|
|
7323
7279
|
}
|
|
7324
|
-
|
|
7325
7280
|
Object.defineProperty(AWSAppSyncProvider.prototype, "endpoint", {
|
|
7326
7281
|
get: function get() {
|
|
7327
7282
|
throw new Error('Not supported');
|
|
@@ -7329,11 +7284,9 @@ function (_super) {
|
|
|
7329
7284
|
enumerable: true,
|
|
7330
7285
|
configurable: true
|
|
7331
7286
|
});
|
|
7332
|
-
|
|
7333
7287
|
AWSAppSyncProvider.prototype.getProviderName = function () {
|
|
7334
7288
|
return 'AWSAppSyncProvider';
|
|
7335
7289
|
};
|
|
7336
|
-
|
|
7337
7290
|
AWSAppSyncProvider.prototype.publish = function (topics, msg, options) {
|
|
7338
7291
|
return __awaiter(this, void 0, void 0, function () {
|
|
7339
7292
|
return __generator(this, function (_a) {
|
|
@@ -7341,49 +7294,38 @@ function (_super) {
|
|
|
7341
7294
|
});
|
|
7342
7295
|
});
|
|
7343
7296
|
};
|
|
7344
|
-
|
|
7345
7297
|
AWSAppSyncProvider.prototype._cleanUp = function (clientId) {
|
|
7346
7298
|
var _this = this;
|
|
7347
|
-
|
|
7348
7299
|
var topicsForClient = Array.from(this._topicClient.entries()).filter(function (_a) {
|
|
7349
7300
|
var _b = __read(_a, 2),
|
|
7350
|
-
|
|
7351
|
-
|
|
7301
|
+
c = _b[1];
|
|
7352
7302
|
return c.clientId === clientId;
|
|
7353
7303
|
}).map(function (_a) {
|
|
7354
7304
|
var _b = __read(_a, 1),
|
|
7355
|
-
|
|
7356
|
-
|
|
7305
|
+
t = _b[0];
|
|
7357
7306
|
return t;
|
|
7358
7307
|
});
|
|
7359
7308
|
topicsForClient.forEach(function (t) {
|
|
7360
7309
|
return _this._cleanUpForTopic(t);
|
|
7361
7310
|
});
|
|
7362
7311
|
};
|
|
7363
|
-
|
|
7364
7312
|
AWSAppSyncProvider.prototype._cleanUpForTopic = function (topic) {
|
|
7365
7313
|
this._topicClient["delete"](topic);
|
|
7366
|
-
|
|
7367
7314
|
this._topicAlias["delete"](topic);
|
|
7368
7315
|
};
|
|
7369
|
-
|
|
7370
7316
|
AWSAppSyncProvider.prototype.onDisconnect = function (_a) {
|
|
7371
7317
|
var _this = this;
|
|
7372
|
-
|
|
7373
7318
|
var clientId = _a.clientId,
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7319
|
+
errorCode = _a.errorCode,
|
|
7320
|
+
args = __rest(_a, ["clientId", "errorCode"]);
|
|
7377
7321
|
if (errorCode !== 0) {
|
|
7378
7322
|
var topicsForClient = Array.from(this._topicClient.entries()).filter(function (_a) {
|
|
7379
7323
|
var _b = __read(_a, 2),
|
|
7380
|
-
|
|
7381
|
-
|
|
7324
|
+
c = _b[1];
|
|
7382
7325
|
return c.clientId === clientId;
|
|
7383
7326
|
}).map(function (_a) {
|
|
7384
7327
|
var _b = __read(_a, 1),
|
|
7385
|
-
|
|
7386
|
-
|
|
7328
|
+
t = _b[0];
|
|
7387
7329
|
return t;
|
|
7388
7330
|
});
|
|
7389
7331
|
topicsForClient.forEach(function (topic) {
|
|
@@ -7393,41 +7335,28 @@ function (_super) {
|
|
|
7393
7335
|
obs.error(args);
|
|
7394
7336
|
}
|
|
7395
7337
|
});
|
|
7396
|
-
|
|
7397
7338
|
_this._topicObservers["delete"](topic);
|
|
7398
7339
|
}
|
|
7399
7340
|
});
|
|
7400
|
-
|
|
7401
7341
|
this._cleanUp(clientId);
|
|
7402
7342
|
}
|
|
7403
7343
|
};
|
|
7404
|
-
|
|
7405
7344
|
AWSAppSyncProvider.prototype.disconnect = function (clientId) {
|
|
7406
7345
|
return __awaiter(this, void 0, void 0, function () {
|
|
7407
7346
|
var client;
|
|
7408
7347
|
return __generator(this, function (_a) {
|
|
7409
7348
|
switch (_a.label) {
|
|
7410
7349
|
case 0:
|
|
7411
|
-
return [4
|
|
7412
|
-
/*yield*/
|
|
7413
|
-
, this.clientsQueue.get(clientId, function () {
|
|
7350
|
+
return [4 /*yield*/, this.clientsQueue.get(clientId, function () {
|
|
7414
7351
|
return null;
|
|
7415
7352
|
})];
|
|
7416
|
-
|
|
7417
7353
|
case 1:
|
|
7418
7354
|
client = _a.sent();
|
|
7419
|
-
return [4
|
|
7420
|
-
/*yield*/
|
|
7421
|
-
, _super.prototype.disconnect.call(this, clientId)];
|
|
7422
|
-
|
|
7355
|
+
return [4 /*yield*/, _super.prototype.disconnect.call(this, clientId)];
|
|
7423
7356
|
case 2:
|
|
7424
7357
|
_a.sent();
|
|
7425
|
-
|
|
7426
7358
|
this._cleanUp(clientId);
|
|
7427
|
-
|
|
7428
|
-
return [2
|
|
7429
|
-
/*return*/
|
|
7430
|
-
];
|
|
7359
|
+
return [2 /*return*/];
|
|
7431
7360
|
}
|
|
7432
7361
|
});
|
|
7433
7362
|
});
|
|
@@ -7435,21 +7364,16 @@ function (_super) {
|
|
|
7435
7364
|
|
|
7436
7365
|
AWSAppSyncProvider.prototype.subscribe = function (topics, options) {
|
|
7437
7366
|
var _this = this;
|
|
7438
|
-
|
|
7439
7367
|
if (options === void 0) {
|
|
7440
7368
|
options = {};
|
|
7441
7369
|
}
|
|
7442
|
-
|
|
7443
7370
|
var result = new zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"](function (observer) {
|
|
7444
7371
|
var targetTopics = [].concat(topics);
|
|
7445
7372
|
logger.debug('Subscribing to topic(s)', targetTopics.join(','));
|
|
7446
|
-
|
|
7447
7373
|
(function () {
|
|
7448
7374
|
return __awaiter(_this, void 0, void 0, function () {
|
|
7449
7375
|
var _a, mqttConnections, newSubscriptions, newAliases, map;
|
|
7450
|
-
|
|
7451
7376
|
var _this = this;
|
|
7452
|
-
|
|
7453
7377
|
return __generator(this, function (_b) {
|
|
7454
7378
|
switch (_b.label) {
|
|
7455
7379
|
case 0:
|
|
@@ -7458,77 +7382,58 @@ function (_super) {
|
|
|
7458
7382
|
if (!_this._topicObservers.has(t)) {
|
|
7459
7383
|
_this._topicObservers.set(t, new Set());
|
|
7460
7384
|
}
|
|
7461
|
-
|
|
7462
7385
|
_this._topicObservers.get(t).add(observer);
|
|
7463
7386
|
});
|
|
7464
7387
|
_a = options.mqttConnections, mqttConnections = _a === void 0 ? [] : _a, newSubscriptions = options.newSubscriptions;
|
|
7465
7388
|
newAliases = Object.entries(newSubscriptions).map(function (_a) {
|
|
7466
7389
|
var _b = __read(_a, 2),
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7390
|
+
alias = _b[0],
|
|
7391
|
+
v = _b[1];
|
|
7470
7392
|
return [v.topic, alias];
|
|
7471
|
-
});
|
|
7472
|
-
|
|
7393
|
+
});
|
|
7394
|
+
// Merge new aliases with old ones
|
|
7473
7395
|
this._topicAlias = new Map(__spread(Array.from(this._topicAlias.entries()), newAliases));
|
|
7474
7396
|
map = Object.entries(targetTopics.reduce(function (acc, elem) {
|
|
7475
7397
|
var connectionInfoForTopic = mqttConnections.find(function (c) {
|
|
7476
7398
|
return c.topics.indexOf(elem) > -1;
|
|
7477
7399
|
});
|
|
7478
|
-
|
|
7479
7400
|
if (connectionInfoForTopic) {
|
|
7480
7401
|
var clientId = connectionInfoForTopic.client,
|
|
7481
|
-
|
|
7482
|
-
|
|
7402
|
+
url = connectionInfoForTopic.url;
|
|
7483
7403
|
if (!acc[clientId]) {
|
|
7484
7404
|
acc[clientId] = {
|
|
7485
7405
|
url: url,
|
|
7486
7406
|
topics: new Set()
|
|
7487
7407
|
};
|
|
7488
7408
|
}
|
|
7489
|
-
|
|
7490
7409
|
acc[clientId].topics.add(elem);
|
|
7491
7410
|
}
|
|
7492
|
-
|
|
7493
7411
|
return acc;
|
|
7494
|
-
}, {}));
|
|
7495
|
-
|
|
7496
|
-
return [4
|
|
7497
|
-
/*yield*/
|
|
7498
|
-
, Promise.all(map.map(function (_a) {
|
|
7412
|
+
}, {}));
|
|
7413
|
+
// reconnect everything we have in the map
|
|
7414
|
+
return [4 /*yield*/, Promise.all(map.map(function (_a) {
|
|
7499
7415
|
var _b = __read(_a, 2),
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7416
|
+
clientId = _b[0],
|
|
7417
|
+
_c = _b[1],
|
|
7418
|
+
url = _c.url,
|
|
7419
|
+
topics = _c.topics;
|
|
7505
7420
|
return __awaiter(_this, void 0, void 0, function () {
|
|
7506
7421
|
var client, err_1;
|
|
7507
|
-
|
|
7508
7422
|
var _this = this;
|
|
7509
|
-
|
|
7510
7423
|
return __generator(this, function (_d) {
|
|
7511
7424
|
switch (_d.label) {
|
|
7512
7425
|
case 0:
|
|
7513
7426
|
client = null;
|
|
7514
7427
|
_d.label = 1;
|
|
7515
|
-
|
|
7516
7428
|
case 1:
|
|
7517
7429
|
_d.trys.push([1, 3,, 4]);
|
|
7518
|
-
|
|
7519
|
-
return [4
|
|
7520
|
-
/*yield*/
|
|
7521
|
-
, this.connect(clientId, {
|
|
7430
|
+
return [4 /*yield*/, this.connect(clientId, {
|
|
7522
7431
|
clientId: clientId,
|
|
7523
7432
|
url: url
|
|
7524
7433
|
})];
|
|
7525
|
-
|
|
7526
7434
|
case 2:
|
|
7527
7435
|
client = _d.sent();
|
|
7528
|
-
return [3
|
|
7529
|
-
/*break*/
|
|
7530
|
-
, 4];
|
|
7531
|
-
|
|
7436
|
+
return [3 /*break*/, 4];
|
|
7532
7437
|
case 3:
|
|
7533
7438
|
err_1 = _d.sent();
|
|
7534
7439
|
observer.error({
|
|
@@ -7536,35 +7441,25 @@ function (_super) {
|
|
|
7536
7441
|
error: err_1
|
|
7537
7442
|
});
|
|
7538
7443
|
observer.complete();
|
|
7539
|
-
return [2
|
|
7540
|
-
/*return*/
|
|
7541
|
-
, undefined];
|
|
7542
|
-
|
|
7444
|
+
return [2 /*return*/, undefined];
|
|
7543
7445
|
case 4:
|
|
7544
7446
|
// subscribe to all topics for this client
|
|
7545
7447
|
// store topic-client mapping
|
|
7546
7448
|
topics.forEach(function (topic) {
|
|
7547
7449
|
if (client.isConnected()) {
|
|
7548
7450
|
client.subscribe(topic);
|
|
7549
|
-
|
|
7550
7451
|
_this._topicClient.set(topic, client);
|
|
7551
7452
|
}
|
|
7552
7453
|
});
|
|
7553
|
-
return [2
|
|
7554
|
-
/*return*/
|
|
7555
|
-
, client];
|
|
7454
|
+
return [2 /*return*/, client];
|
|
7556
7455
|
}
|
|
7557
7456
|
});
|
|
7558
7457
|
});
|
|
7559
7458
|
}))];
|
|
7560
|
-
|
|
7561
7459
|
case 1:
|
|
7562
7460
|
// reconnect everything we have in the map
|
|
7563
7461
|
_b.sent();
|
|
7564
|
-
|
|
7565
|
-
return [2
|
|
7566
|
-
/*return*/
|
|
7567
|
-
];
|
|
7462
|
+
return [2 /*return*/];
|
|
7568
7463
|
}
|
|
7569
7464
|
});
|
|
7570
7465
|
});
|
|
@@ -7574,44 +7469,35 @@ function (_super) {
|
|
|
7574
7469
|
logger.debug('Unsubscribing from topic(s)', targetTopics.join(','));
|
|
7575
7470
|
targetTopics.forEach(function (t) {
|
|
7576
7471
|
var client = _this._topicClient.get(t);
|
|
7577
|
-
|
|
7578
7472
|
if (client && client.isConnected()) {
|
|
7579
7473
|
client.unsubscribe(t);
|
|
7580
|
-
|
|
7581
7474
|
_this._topicClient["delete"](t);
|
|
7582
|
-
|
|
7583
7475
|
if (!Array.from(_this._topicClient.values()).some(function (c) {
|
|
7584
7476
|
return c === client;
|
|
7585
7477
|
})) {
|
|
7586
7478
|
_this.disconnect(client.clientId);
|
|
7587
7479
|
}
|
|
7588
7480
|
}
|
|
7589
|
-
|
|
7590
7481
|
_this._topicObservers["delete"](t);
|
|
7591
7482
|
});
|
|
7592
7483
|
};
|
|
7593
7484
|
});
|
|
7594
7485
|
return zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"].from(result).map(function (value) {
|
|
7595
7486
|
var topic = _this.getTopicForValue(value);
|
|
7596
|
-
|
|
7597
7487
|
var alias = _this._topicAlias.get(topic);
|
|
7598
|
-
|
|
7599
7488
|
value.data = Object.entries(value.data).reduce(function (obj, _a) {
|
|
7600
7489
|
var _b = __read(_a, 2),
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7490
|
+
origKey = _b[0],
|
|
7491
|
+
val = _b[1];
|
|
7604
7492
|
return obj[alias || origKey] = val, obj;
|
|
7605
7493
|
}, {});
|
|
7606
7494
|
return value;
|
|
7607
7495
|
});
|
|
7608
7496
|
};
|
|
7609
|
-
|
|
7610
7497
|
return AWSAppSyncProvider;
|
|
7611
7498
|
}(_MqttOverWSProvider__WEBPACK_IMPORTED_MODULE_2__["MqttOverWSProvider"]);
|
|
7612
7499
|
|
|
7613
7500
|
|
|
7614
|
-
|
|
7615
7501
|
/***/ }),
|
|
7616
7502
|
|
|
7617
7503
|
/***/ "./lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js":
|
|
@@ -7654,44 +7540,34 @@ var __extends = undefined && undefined.__extends || function () {
|
|
|
7654
7540
|
if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
7655
7541
|
}
|
|
7656
7542
|
};
|
|
7657
|
-
|
|
7658
7543
|
return _extendStatics(d, b);
|
|
7659
7544
|
};
|
|
7660
|
-
|
|
7661
7545
|
return function (d, b) {
|
|
7662
7546
|
_extendStatics(d, b);
|
|
7663
|
-
|
|
7664
7547
|
function __() {
|
|
7665
7548
|
this.constructor = d;
|
|
7666
7549
|
}
|
|
7667
|
-
|
|
7668
7550
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
7669
7551
|
};
|
|
7670
7552
|
}();
|
|
7671
|
-
|
|
7672
7553
|
var __assign = undefined && undefined.__assign || function () {
|
|
7673
7554
|
__assign = Object.assign || function (t) {
|
|
7674
7555
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
7675
7556
|
s = arguments[i];
|
|
7676
|
-
|
|
7677
7557
|
for (var p in s) {
|
|
7678
7558
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
7679
7559
|
}
|
|
7680
7560
|
}
|
|
7681
|
-
|
|
7682
7561
|
return t;
|
|
7683
7562
|
};
|
|
7684
|
-
|
|
7685
7563
|
return __assign.apply(this, arguments);
|
|
7686
7564
|
};
|
|
7687
|
-
|
|
7688
7565
|
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
7689
7566
|
function adopt(value) {
|
|
7690
7567
|
return value instanceof P ? value : new P(function (resolve) {
|
|
7691
7568
|
resolve(value);
|
|
7692
7569
|
});
|
|
7693
7570
|
}
|
|
7694
|
-
|
|
7695
7571
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7696
7572
|
function fulfilled(value) {
|
|
7697
7573
|
try {
|
|
@@ -7700,7 +7576,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
7700
7576
|
reject(e);
|
|
7701
7577
|
}
|
|
7702
7578
|
}
|
|
7703
|
-
|
|
7704
7579
|
function rejected(value) {
|
|
7705
7580
|
try {
|
|
7706
7581
|
step(generator["throw"](value));
|
|
@@ -7708,29 +7583,26 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
7708
7583
|
reject(e);
|
|
7709
7584
|
}
|
|
7710
7585
|
}
|
|
7711
|
-
|
|
7712
7586
|
function step(result) {
|
|
7713
7587
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
7714
7588
|
}
|
|
7715
|
-
|
|
7716
7589
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7717
7590
|
});
|
|
7718
7591
|
};
|
|
7719
|
-
|
|
7720
7592
|
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
7721
7593
|
var _ = {
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7594
|
+
label: 0,
|
|
7595
|
+
sent: function sent() {
|
|
7596
|
+
if (t[0] & 1) throw t[1];
|
|
7597
|
+
return t[1];
|
|
7598
|
+
},
|
|
7599
|
+
trys: [],
|
|
7600
|
+
ops: []
|
|
7726
7601
|
},
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
y,
|
|
7732
|
-
t,
|
|
7733
|
-
g;
|
|
7602
|
+
f,
|
|
7603
|
+
y,
|
|
7604
|
+
t,
|
|
7605
|
+
g;
|
|
7734
7606
|
return g = {
|
|
7735
7607
|
next: verb(0),
|
|
7736
7608
|
"throw": verb(1),
|
|
@@ -7738,79 +7610,60 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
7738
7610
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
7739
7611
|
return this;
|
|
7740
7612
|
}), g;
|
|
7741
|
-
|
|
7742
7613
|
function verb(n) {
|
|
7743
7614
|
return function (v) {
|
|
7744
7615
|
return step([n, v]);
|
|
7745
7616
|
};
|
|
7746
7617
|
}
|
|
7747
|
-
|
|
7748
7618
|
function step(op) {
|
|
7749
7619
|
if (f) throw new TypeError("Generator is already executing.");
|
|
7750
|
-
|
|
7751
7620
|
while (_) {
|
|
7752
7621
|
try {
|
|
7753
7622
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
7754
7623
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
7755
|
-
|
|
7756
7624
|
switch (op[0]) {
|
|
7757
7625
|
case 0:
|
|
7758
7626
|
case 1:
|
|
7759
7627
|
t = op;
|
|
7760
7628
|
break;
|
|
7761
|
-
|
|
7762
7629
|
case 4:
|
|
7763
7630
|
_.label++;
|
|
7764
7631
|
return {
|
|
7765
7632
|
value: op[1],
|
|
7766
7633
|
done: false
|
|
7767
7634
|
};
|
|
7768
|
-
|
|
7769
7635
|
case 5:
|
|
7770
7636
|
_.label++;
|
|
7771
7637
|
y = op[1];
|
|
7772
7638
|
op = [0];
|
|
7773
7639
|
continue;
|
|
7774
|
-
|
|
7775
7640
|
case 7:
|
|
7776
7641
|
op = _.ops.pop();
|
|
7777
|
-
|
|
7778
7642
|
_.trys.pop();
|
|
7779
|
-
|
|
7780
7643
|
continue;
|
|
7781
|
-
|
|
7782
7644
|
default:
|
|
7783
7645
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
7784
7646
|
_ = 0;
|
|
7785
7647
|
continue;
|
|
7786
7648
|
}
|
|
7787
|
-
|
|
7788
7649
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
7789
7650
|
_.label = op[1];
|
|
7790
7651
|
break;
|
|
7791
7652
|
}
|
|
7792
|
-
|
|
7793
7653
|
if (op[0] === 6 && _.label < t[1]) {
|
|
7794
7654
|
_.label = t[1];
|
|
7795
7655
|
t = op;
|
|
7796
7656
|
break;
|
|
7797
7657
|
}
|
|
7798
|
-
|
|
7799
7658
|
if (t && _.label < t[2]) {
|
|
7800
7659
|
_.label = t[2];
|
|
7801
|
-
|
|
7802
7660
|
_.ops.push(op);
|
|
7803
|
-
|
|
7804
7661
|
break;
|
|
7805
7662
|
}
|
|
7806
|
-
|
|
7807
7663
|
if (t[2]) _.ops.pop();
|
|
7808
|
-
|
|
7809
7664
|
_.trys.pop();
|
|
7810
|
-
|
|
7811
7665
|
continue;
|
|
7812
7666
|
}
|
|
7813
|
-
|
|
7814
7667
|
op = body.call(thisArg, _);
|
|
7815
7668
|
} catch (e) {
|
|
7816
7669
|
op = [6, e];
|
|
@@ -7819,7 +7672,6 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
7819
7672
|
f = t = 0;
|
|
7820
7673
|
}
|
|
7821
7674
|
}
|
|
7822
|
-
|
|
7823
7675
|
if (op[0] & 5) throw op[1];
|
|
7824
7676
|
return {
|
|
7825
7677
|
value: op[0] ? op[1] : void 0,
|
|
@@ -7827,15 +7679,13 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
7827
7679
|
};
|
|
7828
7680
|
}
|
|
7829
7681
|
};
|
|
7830
|
-
|
|
7831
7682
|
var __read = undefined && undefined.__read || function (o, n) {
|
|
7832
7683
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
7833
7684
|
if (!m) return o;
|
|
7834
7685
|
var i = m.call(o),
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7686
|
+
r,
|
|
7687
|
+
ar = [],
|
|
7688
|
+
e;
|
|
7839
7689
|
try {
|
|
7840
7690
|
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
7841
7691
|
ar.push(r.value);
|
|
@@ -7851,7 +7701,6 @@ var __read = undefined && undefined.__read || function (o, n) {
|
|
|
7851
7701
|
if (e) throw e.error;
|
|
7852
7702
|
}
|
|
7853
7703
|
}
|
|
7854
|
-
|
|
7855
7704
|
return ar;
|
|
7856
7705
|
};
|
|
7857
7706
|
/*
|
|
@@ -7878,10 +7727,7 @@ var __read = undefined && undefined.__read || function (o, n) {
|
|
|
7878
7727
|
|
|
7879
7728
|
|
|
7880
7729
|
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
7730
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["Logger"]('AWSAppSyncRealTimeProvider');
|
|
7884
|
-
|
|
7885
7731
|
var dispatchApiEvent = function dispatchApiEvent(event, data, message) {
|
|
7886
7732
|
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["Hub"].dispatch('api', {
|
|
7887
7733
|
event: event,
|
|
@@ -7889,66 +7735,51 @@ var dispatchApiEvent = function dispatchApiEvent(event, data, message) {
|
|
|
7889
7735
|
message: message
|
|
7890
7736
|
}, 'PubSub', _constants__WEBPACK_IMPORTED_MODULE_10__["AMPLIFY_SYMBOL"]);
|
|
7891
7737
|
};
|
|
7892
|
-
|
|
7893
7738
|
var standardDomainPattern = /^https:\/\/\w{26}\.appsync\-api\.\w{2}(?:(?:\-\w{2,})+)\-\d\.amazonaws.com\/graphql$/i;
|
|
7894
7739
|
var customDomainPath = '/realtime';
|
|
7895
|
-
|
|
7896
|
-
var AWSAppSyncRealTimeProvider =
|
|
7897
|
-
/** @class */
|
|
7898
|
-
function (_super) {
|
|
7740
|
+
var AWSAppSyncRealTimeProvider = /** @class */function (_super) {
|
|
7899
7741
|
__extends(AWSAppSyncRealTimeProvider, _super);
|
|
7900
|
-
|
|
7901
7742
|
function AWSAppSyncRealTimeProvider(options) {
|
|
7902
7743
|
if (options === void 0) {
|
|
7903
7744
|
options = {};
|
|
7904
7745
|
}
|
|
7905
|
-
|
|
7906
7746
|
var _this = _super.call(this, options) || this;
|
|
7907
|
-
|
|
7908
7747
|
_this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
7909
7748
|
_this.keepAliveTimeout = _constants__WEBPACK_IMPORTED_MODULE_10__["DEFAULT_KEEP_ALIVE_TIMEOUT"];
|
|
7910
7749
|
_this.subscriptionObserverMap = new Map();
|
|
7911
7750
|
_this.promiseArray = [];
|
|
7912
|
-
_this.connectionStateMonitor = new _utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["ConnectionStateMonitor"]();
|
|
7913
|
-
|
|
7751
|
+
_this.connectionStateMonitor = new _utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["ConnectionStateMonitor"]();
|
|
7752
|
+
// Monitor the connection state and pass changes along to Hub
|
|
7914
7753
|
_this.connectionStateMonitor.connectionStateObservable.subscribe(function (ConnectionState) {
|
|
7915
7754
|
dispatchApiEvent(_constants__WEBPACK_IMPORTED_MODULE_10__["CONNECTION_STATE_CHANGE"], {
|
|
7916
7755
|
provider: _this,
|
|
7917
7756
|
connectionState: ConnectionState
|
|
7918
7757
|
}, "Connection state is " + ConnectionState);
|
|
7919
7758
|
});
|
|
7920
|
-
|
|
7921
7759
|
return _this;
|
|
7922
7760
|
}
|
|
7923
|
-
|
|
7924
7761
|
AWSAppSyncRealTimeProvider.prototype.getNewWebSocket = function (url, protocol) {
|
|
7925
7762
|
return new WebSocket(url, protocol);
|
|
7926
7763
|
};
|
|
7927
|
-
|
|
7928
7764
|
AWSAppSyncRealTimeProvider.prototype.getProviderName = function () {
|
|
7929
7765
|
return 'AWSAppSyncRealTimeProvider';
|
|
7930
7766
|
};
|
|
7931
|
-
|
|
7932
7767
|
AWSAppSyncRealTimeProvider.prototype.newClient = function () {
|
|
7933
7768
|
throw new Error('Not used here');
|
|
7934
7769
|
};
|
|
7935
|
-
|
|
7936
7770
|
AWSAppSyncRealTimeProvider.prototype.publish = function (_topics, _msg, _options) {
|
|
7937
7771
|
return __awaiter(this, void 0, void 0, function () {
|
|
7938
7772
|
return __generator(this, function (_a) {
|
|
7939
7773
|
throw new Error('Operation not supported');
|
|
7940
7774
|
});
|
|
7941
7775
|
});
|
|
7942
|
-
};
|
|
7943
|
-
|
|
7944
|
-
|
|
7776
|
+
};
|
|
7777
|
+
// Check if url matches standard domain pattern
|
|
7945
7778
|
AWSAppSyncRealTimeProvider.prototype.isCustomDomain = function (url) {
|
|
7946
7779
|
return url.match(standardDomainPattern) === null;
|
|
7947
7780
|
};
|
|
7948
|
-
|
|
7949
7781
|
AWSAppSyncRealTimeProvider.prototype.subscribe = function (_topics, options) {
|
|
7950
7782
|
var _this = this;
|
|
7951
|
-
|
|
7952
7783
|
var appSyncGraphqlEndpoint = options === null || options === void 0 ? void 0 : options.appSyncGraphqlEndpoint;
|
|
7953
7784
|
return new zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"](function (observer) {
|
|
7954
7785
|
if (!options || !appSyncGraphqlEndpoint) {
|
|
@@ -7958,7 +7789,6 @@ function (_super) {
|
|
|
7958
7789
|
observer.complete();
|
|
7959
7790
|
} else {
|
|
7960
7791
|
var subscriptionId_1 = Object(uuid__WEBPACK_IMPORTED_MODULE_3__["v4"])();
|
|
7961
|
-
|
|
7962
7792
|
_this._startSubscriptionWithAWSAppSyncRealTime({
|
|
7963
7793
|
options: options,
|
|
7964
7794
|
observer: observer,
|
|
@@ -7967,36 +7797,25 @@ function (_super) {
|
|
|
7967
7797
|
observer.error({
|
|
7968
7798
|
errors: [__assign({}, new graphql__WEBPACK_IMPORTED_MODULE_1__["GraphQLError"](_types_PubSub__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].REALTIME_SUBSCRIPTION_INIT_ERROR + ": " + err))]
|
|
7969
7799
|
});
|
|
7970
|
-
|
|
7971
7800
|
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CLOSED);
|
|
7972
|
-
|
|
7973
7801
|
observer.complete();
|
|
7974
7802
|
});
|
|
7975
|
-
|
|
7976
7803
|
return function () {
|
|
7977
7804
|
return __awaiter(_this, void 0, void 0, function () {
|
|
7978
7805
|
var subscriptionState, err_1;
|
|
7979
7806
|
return __generator(this, function (_a) {
|
|
7980
7807
|
switch (_a.label) {
|
|
7981
7808
|
case 0:
|
|
7982
|
-
_a.trys.push([0, 2, 3, 4]);
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
return [4
|
|
7986
|
-
/*yield*/
|
|
7987
|
-
, this._waitForSubscriptionToBeConnected(subscriptionId_1)];
|
|
7988
|
-
|
|
7809
|
+
_a.trys.push([0, 2, 3, 4]);
|
|
7810
|
+
// Waiting that subscription has been connected before trying to unsubscribe
|
|
7811
|
+
return [4 /*yield*/, this._waitForSubscriptionToBeConnected(subscriptionId_1)];
|
|
7989
7812
|
case 1:
|
|
7990
7813
|
// Waiting that subscription has been connected before trying to unsubscribe
|
|
7991
7814
|
_a.sent();
|
|
7992
|
-
|
|
7993
7815
|
subscriptionState = (this.subscriptionObserverMap.get(subscriptionId_1) || {}).subscriptionState;
|
|
7994
|
-
|
|
7995
7816
|
if (!subscriptionState) {
|
|
7996
7817
|
// subscription already unsubscribed
|
|
7997
|
-
return [2
|
|
7998
|
-
/*return*/
|
|
7999
|
-
];
|
|
7818
|
+
return [2 /*return*/];
|
|
8000
7819
|
}
|
|
8001
7820
|
|
|
8002
7821
|
if (subscriptionState === _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].CONNECTED) {
|
|
@@ -8004,29 +7823,16 @@ function (_super) {
|
|
|
8004
7823
|
} else {
|
|
8005
7824
|
throw new Error('Subscription never connected');
|
|
8006
7825
|
}
|
|
8007
|
-
|
|
8008
|
-
return [3
|
|
8009
|
-
/*break*/
|
|
8010
|
-
, 4];
|
|
8011
|
-
|
|
7826
|
+
return [3 /*break*/, 4];
|
|
8012
7827
|
case 2:
|
|
8013
7828
|
err_1 = _a.sent();
|
|
8014
7829
|
logger.debug("Error while unsubscribing " + err_1);
|
|
8015
|
-
return [3
|
|
8016
|
-
/*break*/
|
|
8017
|
-
, 4];
|
|
8018
|
-
|
|
7830
|
+
return [3 /*break*/, 4];
|
|
8019
7831
|
case 3:
|
|
8020
7832
|
this._removeSubscriptionObserver(subscriptionId_1);
|
|
8021
|
-
|
|
8022
|
-
return [7
|
|
8023
|
-
/*endfinally*/
|
|
8024
|
-
];
|
|
8025
|
-
|
|
7833
|
+
return [7 /*endfinally*/];
|
|
8026
7834
|
case 4:
|
|
8027
|
-
return [2
|
|
8028
|
-
/*return*/
|
|
8029
|
-
];
|
|
7835
|
+
return [2 /*return*/];
|
|
8030
7836
|
}
|
|
8031
7837
|
});
|
|
8032
7838
|
});
|
|
@@ -8042,21 +7848,15 @@ function (_super) {
|
|
|
8042
7848
|
enumerable: true,
|
|
8043
7849
|
configurable: true
|
|
8044
7850
|
});
|
|
8045
|
-
|
|
8046
7851
|
AWSAppSyncRealTimeProvider.prototype._startSubscriptionWithAWSAppSyncRealTime = function (_a) {
|
|
8047
7852
|
var options = _a.options,
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
7853
|
+
observer = _a.observer,
|
|
7854
|
+
subscriptionId = _a.subscriptionId;
|
|
8051
7855
|
var _b, _c;
|
|
8052
|
-
|
|
8053
7856
|
return __awaiter(this, void 0, void 0, function () {
|
|
8054
7857
|
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;
|
|
8055
|
-
|
|
8056
7858
|
var _j;
|
|
8057
|
-
|
|
8058
7859
|
var _this = this;
|
|
8059
|
-
|
|
8060
7860
|
return __generator(this, function (_k) {
|
|
8061
7861
|
switch (_k.label) {
|
|
8062
7862
|
case 0:
|
|
@@ -8067,8 +7867,8 @@ function (_super) {
|
|
|
8067
7867
|
data = {
|
|
8068
7868
|
query: query,
|
|
8069
7869
|
variables: variables
|
|
8070
|
-
};
|
|
8071
|
-
|
|
7870
|
+
};
|
|
7871
|
+
// Having a subscription id map will make it simple to forward messages received
|
|
8072
7872
|
this.subscriptionObserverMap.set(subscriptionId, {
|
|
8073
7873
|
observer: observer,
|
|
8074
7874
|
query: query !== null && query !== void 0 ? query : '',
|
|
@@ -8078,9 +7878,7 @@ function (_super) {
|
|
|
8078
7878
|
});
|
|
8079
7879
|
dataString = JSON.stringify(data);
|
|
8080
7880
|
_f = [{}];
|
|
8081
|
-
return [4
|
|
8082
|
-
/*yield*/
|
|
8083
|
-
, this._awsRealTimeHeaderBasedAuth({
|
|
7881
|
+
return [4 /*yield*/, this._awsRealTimeHeaderBasedAuth({
|
|
8084
7882
|
apiKey: apiKey,
|
|
8085
7883
|
appSyncGraphqlEndpoint: appSyncGraphqlEndpoint,
|
|
8086
7884
|
authenticationType: authenticationType,
|
|
@@ -8089,13 +7887,9 @@ function (_super) {
|
|
|
8089
7887
|
region: region,
|
|
8090
7888
|
additionalHeaders: additionalHeaders
|
|
8091
7889
|
})];
|
|
8092
|
-
|
|
8093
7890
|
case 1:
|
|
8094
7891
|
_g = [__assign.apply(void 0, _f.concat([_k.sent()]))];
|
|
8095
|
-
return [4
|
|
8096
|
-
/*yield*/
|
|
8097
|
-
, graphql_headers()];
|
|
8098
|
-
|
|
7892
|
+
return [4 /*yield*/, graphql_headers()];
|
|
8099
7893
|
case 2:
|
|
8100
7894
|
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)]);
|
|
8101
7895
|
subscriptionMessage = {
|
|
@@ -8110,28 +7904,19 @@ function (_super) {
|
|
|
8110
7904
|
};
|
|
8111
7905
|
stringToAWSRealTime = JSON.stringify(subscriptionMessage);
|
|
8112
7906
|
_k.label = 3;
|
|
8113
|
-
|
|
8114
7907
|
case 3:
|
|
8115
7908
|
_k.trys.push([3, 5,, 6]);
|
|
8116
|
-
|
|
8117
7909
|
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].OPENING_CONNECTION);
|
|
8118
|
-
return [4
|
|
8119
|
-
/*yield*/
|
|
8120
|
-
, this._initializeWebSocketConnection({
|
|
7910
|
+
return [4 /*yield*/, this._initializeWebSocketConnection({
|
|
8121
7911
|
apiKey: apiKey,
|
|
8122
7912
|
appSyncGraphqlEndpoint: appSyncGraphqlEndpoint,
|
|
8123
7913
|
authenticationType: authenticationType,
|
|
8124
7914
|
region: region,
|
|
8125
7915
|
additionalHeaders: additionalHeaders
|
|
8126
7916
|
})];
|
|
8127
|
-
|
|
8128
7917
|
case 4:
|
|
8129
7918
|
_k.sent();
|
|
8130
|
-
|
|
8131
|
-
return [3
|
|
8132
|
-
/*break*/
|
|
8133
|
-
, 6];
|
|
8134
|
-
|
|
7919
|
+
return [3 /*break*/, 6];
|
|
8135
7920
|
case 5:
|
|
8136
7921
|
err_2 = _k.sent();
|
|
8137
7922
|
logger.debug({
|
|
@@ -8143,19 +7928,15 @@ function (_super) {
|
|
|
8143
7928
|
errors: [__assign({}, new graphql__WEBPACK_IMPORTED_MODULE_1__["GraphQLError"](_types_PubSub__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].CONNECTION_FAILED + ": " + message))]
|
|
8144
7929
|
});
|
|
8145
7930
|
observer.complete();
|
|
8146
|
-
subscriptionFailedCallback_1 = (this.subscriptionObserverMap.get(subscriptionId) || {}).subscriptionFailedCallback;
|
|
8147
|
-
|
|
7931
|
+
subscriptionFailedCallback_1 = (this.subscriptionObserverMap.get(subscriptionId) || {}).subscriptionFailedCallback;
|
|
7932
|
+
// Notify concurrent unsubscription
|
|
8148
7933
|
if (typeof subscriptionFailedCallback_1 === 'function') {
|
|
8149
7934
|
subscriptionFailedCallback_1();
|
|
8150
7935
|
}
|
|
8151
|
-
|
|
8152
|
-
return [2
|
|
8153
|
-
/*return*/
|
|
8154
|
-
];
|
|
8155
|
-
|
|
7936
|
+
return [2 /*return*/];
|
|
8156
7937
|
case 6:
|
|
8157
|
-
_h = (_c = this.subscriptionObserverMap.get(subscriptionId)) !== null && _c !== void 0 ? _c : {}, subscriptionFailedCallback = _h.subscriptionFailedCallback, subscriptionReadyCallback = _h.subscriptionReadyCallback;
|
|
8158
|
-
|
|
7938
|
+
_h = (_c = this.subscriptionObserverMap.get(subscriptionId)) !== null && _c !== void 0 ? _c : {}, subscriptionFailedCallback = _h.subscriptionFailedCallback, subscriptionReadyCallback = _h.subscriptionReadyCallback;
|
|
7939
|
+
// This must be done before sending the message in order to be listening immediately
|
|
8159
7940
|
this.subscriptionObserverMap.set(subscriptionId, {
|
|
8160
7941
|
observer: observer,
|
|
8161
7942
|
subscriptionState: subscriptionState,
|
|
@@ -8167,41 +7948,30 @@ function (_super) {
|
|
|
8167
7948
|
_this._timeoutStartSubscriptionAck.call(_this, subscriptionId);
|
|
8168
7949
|
}, _constants__WEBPACK_IMPORTED_MODULE_10__["START_ACK_TIMEOUT"])
|
|
8169
7950
|
});
|
|
8170
|
-
|
|
8171
7951
|
if (this.awsRealTimeSocket) {
|
|
8172
7952
|
this.awsRealTimeSocket.send(stringToAWSRealTime);
|
|
8173
7953
|
}
|
|
8174
|
-
|
|
8175
|
-
return [2
|
|
8176
|
-
/*return*/
|
|
8177
|
-
];
|
|
7954
|
+
return [2 /*return*/];
|
|
8178
7955
|
}
|
|
8179
7956
|
});
|
|
8180
7957
|
});
|
|
8181
|
-
};
|
|
8182
|
-
|
|
8183
|
-
|
|
7958
|
+
};
|
|
7959
|
+
// Waiting that subscription has been connected before trying to unsubscribe
|
|
8184
7960
|
AWSAppSyncRealTimeProvider.prototype._waitForSubscriptionToBeConnected = function (subscriptionId) {
|
|
8185
7961
|
return __awaiter(this, void 0, void 0, function () {
|
|
8186
7962
|
var subscriptionObserver, subscriptionState;
|
|
8187
|
-
|
|
8188
7963
|
var _this = this;
|
|
8189
|
-
|
|
8190
7964
|
return __generator(this, function (_a) {
|
|
8191
7965
|
subscriptionObserver = this.subscriptionObserverMap.get(subscriptionId);
|
|
8192
|
-
|
|
8193
7966
|
if (subscriptionObserver) {
|
|
8194
|
-
subscriptionState = subscriptionObserver.subscriptionState;
|
|
8195
|
-
|
|
7967
|
+
subscriptionState = subscriptionObserver.subscriptionState;
|
|
7968
|
+
// This in case unsubscribe is invoked before sending start subscription message
|
|
8196
7969
|
if (subscriptionState === _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].PENDING) {
|
|
8197
|
-
return [2
|
|
8198
|
-
/*return*/
|
|
8199
|
-
, new Promise(function (res, rej) {
|
|
7970
|
+
return [2 /*return*/, new Promise(function (res, rej) {
|
|
8200
7971
|
var observer = subscriptionObserver.observer,
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
7972
|
+
subscriptionState = subscriptionObserver.subscriptionState,
|
|
7973
|
+
variables = subscriptionObserver.variables,
|
|
7974
|
+
query = subscriptionObserver.query;
|
|
8205
7975
|
_this.subscriptionObserverMap.set(subscriptionId, {
|
|
8206
7976
|
observer: observer,
|
|
8207
7977
|
subscriptionState: subscriptionState,
|
|
@@ -8213,10 +7983,7 @@ function (_super) {
|
|
|
8213
7983
|
})];
|
|
8214
7984
|
}
|
|
8215
7985
|
}
|
|
8216
|
-
|
|
8217
|
-
return [2
|
|
8218
|
-
/*return*/
|
|
8219
|
-
];
|
|
7986
|
+
return [2 /*return*/];
|
|
8220
7987
|
});
|
|
8221
7988
|
});
|
|
8222
7989
|
};
|
|
@@ -8239,42 +8006,34 @@ function (_super) {
|
|
|
8239
8006
|
});
|
|
8240
8007
|
}
|
|
8241
8008
|
};
|
|
8242
|
-
|
|
8243
8009
|
AWSAppSyncRealTimeProvider.prototype._removeSubscriptionObserver = function (subscriptionId) {
|
|
8244
|
-
this.subscriptionObserverMap["delete"](subscriptionId);
|
|
8245
|
-
|
|
8010
|
+
this.subscriptionObserverMap["delete"](subscriptionId);
|
|
8011
|
+
// Verifying 1000ms after removing subscription in case there are new subscription unmount/mount
|
|
8246
8012
|
setTimeout(this._closeSocketIfRequired.bind(this), 1000);
|
|
8247
8013
|
};
|
|
8248
|
-
|
|
8249
8014
|
AWSAppSyncRealTimeProvider.prototype._closeSocketIfRequired = function () {
|
|
8250
8015
|
if (this.subscriptionObserverMap.size > 0) {
|
|
8251
8016
|
// Active subscriptions on the WebSocket
|
|
8252
8017
|
return;
|
|
8253
8018
|
}
|
|
8254
|
-
|
|
8255
8019
|
if (!this.awsRealTimeSocket) {
|
|
8256
8020
|
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
8257
8021
|
return;
|
|
8258
8022
|
}
|
|
8259
|
-
|
|
8260
8023
|
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CLOSING_CONNECTION);
|
|
8261
|
-
|
|
8262
8024
|
if (this.awsRealTimeSocket.bufferedAmount > 0) {
|
|
8263
8025
|
// Still data on the WebSocket
|
|
8264
8026
|
setTimeout(this._closeSocketIfRequired.bind(this), 1000);
|
|
8265
8027
|
} else {
|
|
8266
8028
|
logger.debug('closing WebSocket...');
|
|
8267
|
-
|
|
8268
8029
|
if (this.keepAliveTimeoutId) {
|
|
8269
8030
|
clearTimeout(this.keepAliveTimeoutId);
|
|
8270
8031
|
}
|
|
8271
|
-
|
|
8272
8032
|
if (this.keepAliveAlertTimeoutId) {
|
|
8273
8033
|
clearTimeout(this.keepAliveAlertTimeoutId);
|
|
8274
8034
|
}
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8035
|
+
var tempSocket = this.awsRealTimeSocket;
|
|
8036
|
+
// Cleaning callbacks to avoid race condition, socket still exists
|
|
8278
8037
|
tempSocket.onclose = null;
|
|
8279
8038
|
tempSocket.onerror = null;
|
|
8280
8039
|
tempSocket.close(1000);
|
|
@@ -8283,63 +8042,52 @@ function (_super) {
|
|
|
8283
8042
|
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CLOSED);
|
|
8284
8043
|
}
|
|
8285
8044
|
};
|
|
8286
|
-
|
|
8287
8045
|
AWSAppSyncRealTimeProvider.prototype._handleIncomingSubscriptionMessage = function (message) {
|
|
8288
8046
|
var _this = this;
|
|
8289
|
-
|
|
8290
8047
|
logger.debug("subscription message from AWS AppSync RealTime: " + message.data);
|
|
8291
|
-
|
|
8292
8048
|
var _a = JSON.parse(message.data),
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
|
|
8296
|
-
|
|
8297
|
-
|
|
8049
|
+
_b = _a.id,
|
|
8050
|
+
id = _b === void 0 ? '' : _b,
|
|
8051
|
+
payload = _a.payload,
|
|
8052
|
+
type = _a.type;
|
|
8298
8053
|
var _c = this.subscriptionObserverMap.get(id) || {},
|
|
8299
|
-
|
|
8300
|
-
|
|
8301
|
-
|
|
8302
|
-
|
|
8303
|
-
|
|
8304
|
-
|
|
8305
|
-
|
|
8306
|
-
|
|
8307
|
-
|
|
8308
|
-
|
|
8054
|
+
_d = _c.observer,
|
|
8055
|
+
observer = _d === void 0 ? null : _d,
|
|
8056
|
+
_e = _c.query,
|
|
8057
|
+
query = _e === void 0 ? '' : _e,
|
|
8058
|
+
_f = _c.variables,
|
|
8059
|
+
variables = _f === void 0 ? {} : _f,
|
|
8060
|
+
startAckTimeoutId = _c.startAckTimeoutId,
|
|
8061
|
+
subscriptionReadyCallback = _c.subscriptionReadyCallback,
|
|
8062
|
+
subscriptionFailedCallback = _c.subscriptionFailedCallback;
|
|
8309
8063
|
logger.debug({
|
|
8310
8064
|
id: id,
|
|
8311
8065
|
observer: observer,
|
|
8312
8066
|
query: query,
|
|
8313
8067
|
variables: variables
|
|
8314
8068
|
});
|
|
8315
|
-
|
|
8316
8069
|
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_DATA && payload && payload.data) {
|
|
8317
8070
|
if (observer) {
|
|
8318
8071
|
observer.next(payload);
|
|
8319
8072
|
} else {
|
|
8320
8073
|
logger.debug("observer not found for id: " + id);
|
|
8321
8074
|
}
|
|
8322
|
-
|
|
8323
8075
|
return;
|
|
8324
8076
|
}
|
|
8325
|
-
|
|
8326
8077
|
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_START_ACK) {
|
|
8327
8078
|
logger.debug("subscription ready for " + JSON.stringify({
|
|
8328
8079
|
query: query,
|
|
8329
8080
|
variables: variables
|
|
8330
8081
|
}));
|
|
8331
|
-
|
|
8332
8082
|
if (typeof subscriptionReadyCallback === 'function') {
|
|
8333
8083
|
subscriptionReadyCallback();
|
|
8334
8084
|
}
|
|
8335
|
-
|
|
8336
8085
|
if (startAckTimeoutId) clearTimeout(startAckTimeoutId);
|
|
8337
8086
|
dispatchApiEvent(_types_PubSub__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].SUBSCRIPTION_ACK, {
|
|
8338
8087
|
query: query,
|
|
8339
8088
|
variables: variables
|
|
8340
8089
|
}, 'Connection established for subscription');
|
|
8341
8090
|
var subscriptionState = _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].CONNECTED;
|
|
8342
|
-
|
|
8343
8091
|
if (observer) {
|
|
8344
8092
|
this.subscriptionObserverMap.set(id, {
|
|
8345
8093
|
observer: observer,
|
|
@@ -8351,11 +8099,9 @@ function (_super) {
|
|
|
8351
8099
|
subscriptionFailedCallback: subscriptionFailedCallback
|
|
8352
8100
|
});
|
|
8353
8101
|
}
|
|
8354
|
-
|
|
8355
8102
|
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CONNECTION_ESTABLISHED);
|
|
8356
8103
|
return;
|
|
8357
8104
|
}
|
|
8358
|
-
|
|
8359
8105
|
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_CONNECTION_KEEP_ALIVE) {
|
|
8360
8106
|
if (this.keepAliveTimeoutId) clearTimeout(this.keepAliveTimeoutId);
|
|
8361
8107
|
if (this.keepAliveAlertTimeoutId) clearTimeout(this.keepAliveAlertTimeoutId);
|
|
@@ -8368,10 +8114,8 @@ function (_super) {
|
|
|
8368
8114
|
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].KEEP_ALIVE);
|
|
8369
8115
|
return;
|
|
8370
8116
|
}
|
|
8371
|
-
|
|
8372
8117
|
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_ERROR) {
|
|
8373
8118
|
var subscriptionState = _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].FAILED;
|
|
8374
|
-
|
|
8375
8119
|
if (observer) {
|
|
8376
8120
|
this.subscriptionObserverMap.set(id, {
|
|
8377
8121
|
observer: observer,
|
|
@@ -8387,19 +8131,16 @@ function (_super) {
|
|
|
8387
8131
|
});
|
|
8388
8132
|
if (startAckTimeoutId) clearTimeout(startAckTimeoutId);
|
|
8389
8133
|
observer.complete();
|
|
8390
|
-
|
|
8391
8134
|
if (typeof subscriptionFailedCallback === 'function') {
|
|
8392
8135
|
subscriptionFailedCallback();
|
|
8393
8136
|
}
|
|
8394
8137
|
}
|
|
8395
8138
|
}
|
|
8396
8139
|
};
|
|
8397
|
-
|
|
8398
8140
|
AWSAppSyncRealTimeProvider.prototype._errorDisconnect = function (msg) {
|
|
8399
8141
|
logger.debug("Disconnect error: " + msg);
|
|
8400
8142
|
this.subscriptionObserverMap.forEach(function (_a) {
|
|
8401
8143
|
var observer = _a.observer;
|
|
8402
|
-
|
|
8403
8144
|
if (observer && !observer.closed) {
|
|
8404
8145
|
observer.error({
|
|
8405
8146
|
errors: [__assign({}, new graphql__WEBPACK_IMPORTED_MODULE_1__["GraphQLError"](msg))]
|
|
@@ -8407,69 +8148,56 @@ function (_super) {
|
|
|
8407
8148
|
}
|
|
8408
8149
|
});
|
|
8409
8150
|
this.subscriptionObserverMap.clear();
|
|
8410
|
-
|
|
8411
8151
|
if (this.awsRealTimeSocket) {
|
|
8412
8152
|
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CLOSED);
|
|
8413
8153
|
this.awsRealTimeSocket.close();
|
|
8414
8154
|
}
|
|
8415
|
-
|
|
8416
8155
|
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
8417
8156
|
};
|
|
8418
|
-
|
|
8419
8157
|
AWSAppSyncRealTimeProvider.prototype._timeoutStartSubscriptionAck = function (subscriptionId) {
|
|
8420
8158
|
var subscriptionObserver = this.subscriptionObserverMap.get(subscriptionId);
|
|
8421
|
-
|
|
8422
8159
|
if (subscriptionObserver) {
|
|
8423
8160
|
var observer = subscriptionObserver.observer,
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8161
|
+
query = subscriptionObserver.query,
|
|
8162
|
+
variables = subscriptionObserver.variables;
|
|
8427
8163
|
if (!observer) {
|
|
8428
8164
|
return;
|
|
8429
8165
|
}
|
|
8430
|
-
|
|
8431
8166
|
this.subscriptionObserverMap.set(subscriptionId, {
|
|
8432
8167
|
observer: observer,
|
|
8433
8168
|
query: query,
|
|
8434
8169
|
variables: variables,
|
|
8435
8170
|
subscriptionState: _constants__WEBPACK_IMPORTED_MODULE_10__["SUBSCRIPTION_STATUS"].FAILED
|
|
8436
8171
|
});
|
|
8437
|
-
|
|
8438
8172
|
if (observer && !observer.closed) {
|
|
8439
8173
|
observer.error({
|
|
8440
8174
|
errors: [__assign({}, new graphql__WEBPACK_IMPORTED_MODULE_1__["GraphQLError"]("Subscription timeout " + JSON.stringify({
|
|
8441
8175
|
query: query,
|
|
8442
8176
|
variables: variables
|
|
8443
8177
|
})))]
|
|
8444
|
-
});
|
|
8445
|
-
|
|
8178
|
+
});
|
|
8179
|
+
// Cleanup will be automatically executed
|
|
8446
8180
|
observer.complete();
|
|
8447
8181
|
}
|
|
8448
|
-
|
|
8449
8182
|
logger.debug('timeoutStartSubscription', JSON.stringify({
|
|
8450
8183
|
query: query,
|
|
8451
8184
|
variables: variables
|
|
8452
8185
|
}));
|
|
8453
8186
|
}
|
|
8454
8187
|
};
|
|
8455
|
-
|
|
8456
8188
|
AWSAppSyncRealTimeProvider.prototype._initializeWebSocketConnection = function (_a) {
|
|
8457
8189
|
var _this = this;
|
|
8458
|
-
|
|
8459
8190
|
var appSyncGraphqlEndpoint = _a.appSyncGraphqlEndpoint,
|
|
8460
|
-
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8191
|
+
authenticationType = _a.authenticationType,
|
|
8192
|
+
apiKey = _a.apiKey,
|
|
8193
|
+
region = _a.region,
|
|
8194
|
+
additionalHeaders = _a.additionalHeaders;
|
|
8465
8195
|
if (this.socketStatus === _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].READY) {
|
|
8466
8196
|
return;
|
|
8467
8197
|
}
|
|
8468
|
-
|
|
8469
8198
|
return new Promise(function (res, rej) {
|
|
8470
8199
|
return __awaiter(_this, void 0, void 0, function () {
|
|
8471
8200
|
var payloadString, headerString, _a, _b, headerQs, payloadQs, discoverableEndpoint, protocol, awsRealTimeUrl, err_3;
|
|
8472
|
-
|
|
8473
8201
|
return __generator(this, function (_c) {
|
|
8474
8202
|
switch (_c.label) {
|
|
8475
8203
|
case 0:
|
|
@@ -8477,20 +8205,14 @@ function (_super) {
|
|
|
8477
8205
|
res: res,
|
|
8478
8206
|
rej: rej
|
|
8479
8207
|
});
|
|
8480
|
-
if (!(this.socketStatus === _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED)) return [3
|
|
8481
|
-
/*break*/
|
|
8482
|
-
, 5];
|
|
8208
|
+
if (!(this.socketStatus === _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED)) return [3 /*break*/, 5];
|
|
8483
8209
|
_c.label = 1;
|
|
8484
|
-
|
|
8485
8210
|
case 1:
|
|
8486
8211
|
_c.trys.push([1, 4,, 5]);
|
|
8487
|
-
|
|
8488
8212
|
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CONNECTING;
|
|
8489
8213
|
payloadString = '{}';
|
|
8490
8214
|
_b = (_a = JSON).stringify;
|
|
8491
|
-
return [4
|
|
8492
|
-
/*yield*/
|
|
8493
|
-
, this._awsRealTimeHeaderBasedAuth({
|
|
8215
|
+
return [4 /*yield*/, this._awsRealTimeHeaderBasedAuth({
|
|
8494
8216
|
authenticationType: authenticationType,
|
|
8495
8217
|
payload: payloadString,
|
|
8496
8218
|
canonicalUri: '/connect',
|
|
@@ -8499,29 +8221,22 @@ function (_super) {
|
|
|
8499
8221
|
region: region,
|
|
8500
8222
|
additionalHeaders: additionalHeaders
|
|
8501
8223
|
})];
|
|
8502
|
-
|
|
8503
8224
|
case 2:
|
|
8504
8225
|
headerString = _b.apply(_a, [_c.sent()]);
|
|
8505
8226
|
headerQs = buffer__WEBPACK_IMPORTED_MODULE_4__["Buffer"].from(headerString).toString('base64');
|
|
8506
8227
|
payloadQs = buffer__WEBPACK_IMPORTED_MODULE_4__["Buffer"].from(payloadString).toString('base64');
|
|
8507
8228
|
discoverableEndpoint = appSyncGraphqlEndpoint !== null && appSyncGraphqlEndpoint !== void 0 ? appSyncGraphqlEndpoint : '';
|
|
8508
|
-
|
|
8509
8229
|
if (this.isCustomDomain(discoverableEndpoint)) {
|
|
8510
8230
|
discoverableEndpoint = discoverableEndpoint.concat(customDomainPath);
|
|
8511
8231
|
} else {
|
|
8512
8232
|
discoverableEndpoint = discoverableEndpoint.replace('appsync-api', 'appsync-realtime-api').replace('gogi-beta', 'grt-beta');
|
|
8513
8233
|
}
|
|
8514
|
-
|
|
8515
8234
|
protocol = this.isSSLEnabled ? 'wss://' : 'ws://';
|
|
8516
8235
|
discoverableEndpoint = discoverableEndpoint.replace('https://', protocol).replace('http://', protocol);
|
|
8517
8236
|
awsRealTimeUrl = discoverableEndpoint + "?header=" + headerQs + "&payload=" + payloadQs;
|
|
8518
|
-
return [4
|
|
8519
|
-
/*yield*/
|
|
8520
|
-
, this._initializeRetryableHandshake(awsRealTimeUrl)];
|
|
8521
|
-
|
|
8237
|
+
return [4 /*yield*/, this._initializeRetryableHandshake(awsRealTimeUrl)];
|
|
8522
8238
|
case 3:
|
|
8523
8239
|
_c.sent();
|
|
8524
|
-
|
|
8525
8240
|
this.promiseArray.forEach(function (_a) {
|
|
8526
8241
|
var res = _a.res;
|
|
8527
8242
|
logger.debug('Notifying connection successful');
|
|
@@ -8529,10 +8244,7 @@ function (_super) {
|
|
|
8529
8244
|
});
|
|
8530
8245
|
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].READY;
|
|
8531
8246
|
this.promiseArray = [];
|
|
8532
|
-
return [3
|
|
8533
|
-
/*break*/
|
|
8534
|
-
, 5];
|
|
8535
|
-
|
|
8247
|
+
return [3 /*break*/, 5];
|
|
8536
8248
|
case 4:
|
|
8537
8249
|
err_3 = _c.sent();
|
|
8538
8250
|
this.promiseArray.forEach(function (_a) {
|
|
@@ -8540,21 +8252,14 @@ function (_super) {
|
|
|
8540
8252
|
return rej(err_3);
|
|
8541
8253
|
});
|
|
8542
8254
|
this.promiseArray = [];
|
|
8543
|
-
|
|
8544
8255
|
if (this.awsRealTimeSocket && this.awsRealTimeSocket.readyState === WebSocket.OPEN) {
|
|
8545
8256
|
this.awsRealTimeSocket.close(3001);
|
|
8546
8257
|
}
|
|
8547
|
-
|
|
8548
8258
|
this.awsRealTimeSocket = undefined;
|
|
8549
8259
|
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
8550
|
-
return [3
|
|
8551
|
-
/*break*/
|
|
8552
|
-
, 5];
|
|
8553
|
-
|
|
8260
|
+
return [3 /*break*/, 5];
|
|
8554
8261
|
case 5:
|
|
8555
|
-
return [2
|
|
8556
|
-
/*return*/
|
|
8557
|
-
];
|
|
8262
|
+
return [2 /*return*/];
|
|
8558
8263
|
}
|
|
8559
8264
|
});
|
|
8560
8265
|
});
|
|
@@ -8567,16 +8272,10 @@ function (_super) {
|
|
|
8567
8272
|
switch (_a.label) {
|
|
8568
8273
|
case 0:
|
|
8569
8274
|
logger.debug("Initializaling retryable Handshake");
|
|
8570
|
-
return [4
|
|
8571
|
-
/*yield*/
|
|
8572
|
-
, Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["jitteredExponentialRetry"])(this._initializeHandshake.bind(this), [awsRealTimeUrl], _constants__WEBPACK_IMPORTED_MODULE_10__["MAX_DELAY_MS"])];
|
|
8573
|
-
|
|
8275
|
+
return [4 /*yield*/, Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["jitteredExponentialRetry"])(this._initializeHandshake.bind(this), [awsRealTimeUrl], _constants__WEBPACK_IMPORTED_MODULE_10__["MAX_DELAY_MS"])];
|
|
8574
8276
|
case 1:
|
|
8575
8277
|
_a.sent();
|
|
8576
|
-
|
|
8577
|
-
return [2
|
|
8578
|
-
/*return*/
|
|
8579
|
-
];
|
|
8278
|
+
return [2 /*return*/];
|
|
8580
8279
|
}
|
|
8581
8280
|
});
|
|
8582
8281
|
});
|
|
@@ -8585,144 +8284,107 @@ function (_super) {
|
|
|
8585
8284
|
AWSAppSyncRealTimeProvider.prototype._initializeHandshake = function (awsRealTimeUrl) {
|
|
8586
8285
|
return __awaiter(this, void 0, void 0, function () {
|
|
8587
8286
|
var err_4, _a, errorType, errorCode;
|
|
8588
|
-
|
|
8589
8287
|
var _this = this;
|
|
8590
|
-
|
|
8591
8288
|
return __generator(this, function (_b) {
|
|
8592
8289
|
switch (_b.label) {
|
|
8593
8290
|
case 0:
|
|
8594
8291
|
logger.debug("Initializing handshake " + awsRealTimeUrl);
|
|
8595
8292
|
_b.label = 1;
|
|
8596
|
-
|
|
8597
8293
|
case 1:
|
|
8598
8294
|
_b.trys.push([1, 4,, 5]);
|
|
8599
|
-
|
|
8600
|
-
return [4
|
|
8601
|
-
/*yield*/
|
|
8602
|
-
, function () {
|
|
8295
|
+
return [4 /*yield*/, function () {
|
|
8603
8296
|
return new Promise(function (res, rej) {
|
|
8604
8297
|
var newSocket = _this.getNewWebSocket(awsRealTimeUrl, 'graphql-ws');
|
|
8605
|
-
|
|
8606
8298
|
newSocket.onerror = function () {
|
|
8607
8299
|
logger.debug("WebSocket connection error");
|
|
8608
8300
|
};
|
|
8609
|
-
|
|
8610
8301
|
newSocket.onclose = function () {
|
|
8611
8302
|
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CONNECTION_FAILED);
|
|
8612
|
-
|
|
8613
8303
|
rej(new Error('Connection handshake error'));
|
|
8614
8304
|
};
|
|
8615
|
-
|
|
8616
8305
|
newSocket.onopen = function () {
|
|
8617
8306
|
_this.awsRealTimeSocket = newSocket;
|
|
8618
8307
|
return res();
|
|
8619
8308
|
};
|
|
8620
8309
|
});
|
|
8621
8310
|
}()];
|
|
8622
|
-
|
|
8623
8311
|
case 2:
|
|
8624
|
-
_b.sent();
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
return [4
|
|
8628
|
-
/*yield*/
|
|
8629
|
-
, function () {
|
|
8312
|
+
_b.sent();
|
|
8313
|
+
// Step 2: wait for ack from AWS AppSyncReaTime after sending init
|
|
8314
|
+
return [4 /*yield*/, function () {
|
|
8630
8315
|
return new Promise(function (res, rej) {
|
|
8631
8316
|
if (_this.awsRealTimeSocket) {
|
|
8632
8317
|
var ackOk_1 = false;
|
|
8633
|
-
|
|
8634
8318
|
_this.awsRealTimeSocket.onerror = function (error) {
|
|
8635
8319
|
logger.debug("WebSocket error " + JSON.stringify(error));
|
|
8636
8320
|
};
|
|
8637
|
-
|
|
8638
8321
|
_this.awsRealTimeSocket.onclose = function (event) {
|
|
8639
8322
|
logger.debug("WebSocket closed " + event.reason);
|
|
8640
8323
|
rej(new Error(JSON.stringify(event)));
|
|
8641
8324
|
};
|
|
8642
|
-
|
|
8643
8325
|
_this.awsRealTimeSocket.onmessage = function (message) {
|
|
8644
8326
|
logger.debug("subscription message from AWS AppSyncRealTime: " + message.data + " ");
|
|
8645
8327
|
var data = JSON.parse(message.data);
|
|
8646
8328
|
var type = data.type,
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8329
|
+
_a = data.payload,
|
|
8330
|
+
_b = (_a === void 0 ? {} : _a).connectionTimeoutMs,
|
|
8331
|
+
connectionTimeoutMs = _b === void 0 ? _constants__WEBPACK_IMPORTED_MODULE_10__["DEFAULT_KEEP_ALIVE_TIMEOUT"] : _b;
|
|
8651
8332
|
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_CONNECTION_ACK) {
|
|
8652
8333
|
ackOk_1 = true;
|
|
8653
|
-
|
|
8654
8334
|
if (_this.awsRealTimeSocket) {
|
|
8655
8335
|
_this.keepAliveTimeout = connectionTimeoutMs;
|
|
8656
8336
|
_this.awsRealTimeSocket.onmessage = _this._handleIncomingSubscriptionMessage.bind(_this);
|
|
8657
|
-
|
|
8658
8337
|
_this.awsRealTimeSocket.onerror = function (err) {
|
|
8659
8338
|
logger.debug(err);
|
|
8660
|
-
|
|
8661
8339
|
_this._errorDisconnect(_types_PubSub__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].CONNECTION_CLOSED);
|
|
8662
8340
|
};
|
|
8663
|
-
|
|
8664
8341
|
_this.awsRealTimeSocket.onclose = function (event) {
|
|
8665
8342
|
logger.debug("WebSocket closed " + event.reason);
|
|
8666
|
-
|
|
8667
8343
|
_this._errorDisconnect(_types_PubSub__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].CONNECTION_CLOSED);
|
|
8668
8344
|
};
|
|
8669
8345
|
}
|
|
8670
|
-
|
|
8671
8346
|
res('Cool, connected to AWS AppSyncRealTime');
|
|
8672
8347
|
return;
|
|
8673
8348
|
}
|
|
8674
|
-
|
|
8675
8349
|
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_CONNECTION_ERROR) {
|
|
8676
8350
|
var _c = data.payload,
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8351
|
+
_d = (_c === void 0 ? {} : _c).errors,
|
|
8352
|
+
_e = __read(_d === void 0 ? [] : _d, 1),
|
|
8353
|
+
_f = _e[0],
|
|
8354
|
+
_g = _f === void 0 ? {} : _f,
|
|
8355
|
+
_h = _g.errorType,
|
|
8356
|
+
errorType = _h === void 0 ? '' : _h,
|
|
8357
|
+
_j = _g.errorCode,
|
|
8358
|
+
errorCode = _j === void 0 ? 0 : _j;
|
|
8686
8359
|
rej({
|
|
8687
8360
|
errorType: errorType,
|
|
8688
8361
|
errorCode: errorCode
|
|
8689
8362
|
});
|
|
8690
8363
|
}
|
|
8691
8364
|
};
|
|
8692
|
-
|
|
8693
8365
|
var gqlInit = {
|
|
8694
8366
|
type: _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_CONNECTION_INIT
|
|
8695
8367
|
};
|
|
8696
|
-
|
|
8697
8368
|
_this.awsRealTimeSocket.send(JSON.stringify(gqlInit));
|
|
8698
|
-
|
|
8699
8369
|
var checkAckOk_1 = function checkAckOk_1(ackOk) {
|
|
8700
8370
|
if (!ackOk) {
|
|
8701
8371
|
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CONNECTION_FAILED);
|
|
8702
|
-
|
|
8703
8372
|
rej(new Error("Connection timeout: ack from AWSAppSyncRealTime was not received after " + _constants__WEBPACK_IMPORTED_MODULE_10__["CONNECTION_INIT_TIMEOUT"] + " ms"));
|
|
8704
8373
|
}
|
|
8705
8374
|
};
|
|
8706
|
-
|
|
8707
8375
|
setTimeout(function () {
|
|
8708
8376
|
return checkAckOk_1(ackOk_1);
|
|
8709
8377
|
}, _constants__WEBPACK_IMPORTED_MODULE_10__["CONNECTION_INIT_TIMEOUT"]);
|
|
8710
8378
|
}
|
|
8711
8379
|
});
|
|
8712
8380
|
}()];
|
|
8713
|
-
|
|
8714
8381
|
case 3:
|
|
8715
8382
|
// Step 2: wait for ack from AWS AppSyncReaTime after sending init
|
|
8716
8383
|
_b.sent();
|
|
8717
|
-
|
|
8718
|
-
return [3
|
|
8719
|
-
/*break*/
|
|
8720
|
-
, 5];
|
|
8721
|
-
|
|
8384
|
+
return [3 /*break*/, 5];
|
|
8722
8385
|
case 4:
|
|
8723
8386
|
err_4 = _b.sent();
|
|
8724
8387
|
_a = err_4, errorType = _a.errorType, errorCode = _a.errorCode;
|
|
8725
|
-
|
|
8726
8388
|
if (_constants__WEBPACK_IMPORTED_MODULE_10__["NON_RETRYABLE_CODES"].includes(errorCode)) {
|
|
8727
8389
|
throw new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["NonRetryableError"](errorType);
|
|
8728
8390
|
} else if (errorType) {
|
|
@@ -8730,15 +8392,9 @@ function (_super) {
|
|
|
8730
8392
|
} else {
|
|
8731
8393
|
throw err_4;
|
|
8732
8394
|
}
|
|
8733
|
-
|
|
8734
|
-
return [3
|
|
8735
|
-
/*break*/
|
|
8736
|
-
, 5];
|
|
8737
|
-
|
|
8395
|
+
return [3 /*break*/, 5];
|
|
8738
8396
|
case 5:
|
|
8739
|
-
return [2
|
|
8740
|
-
/*return*/
|
|
8741
|
-
];
|
|
8397
|
+
return [2 /*return*/];
|
|
8742
8398
|
}
|
|
8743
8399
|
});
|
|
8744
8400
|
});
|
|
@@ -8746,12 +8402,12 @@ function (_super) {
|
|
|
8746
8402
|
|
|
8747
8403
|
AWSAppSyncRealTimeProvider.prototype._awsRealTimeHeaderBasedAuth = function (_a) {
|
|
8748
8404
|
var authenticationType = _a.authenticationType,
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8405
|
+
payload = _a.payload,
|
|
8406
|
+
canonicalUri = _a.canonicalUri,
|
|
8407
|
+
appSyncGraphqlEndpoint = _a.appSyncGraphqlEndpoint,
|
|
8408
|
+
apiKey = _a.apiKey,
|
|
8409
|
+
region = _a.region,
|
|
8410
|
+
additionalHeaders = _a.additionalHeaders;
|
|
8755
8411
|
return __awaiter(this, void 0, void 0, function () {
|
|
8756
8412
|
var headerHandler, handler, host, result;
|
|
8757
8413
|
return __generator(this, function (_b) {
|
|
@@ -8764,21 +8420,14 @@ function (_super) {
|
|
|
8764
8420
|
AMAZON_COGNITO_USER_POOLS: this._awsRealTimeCUPHeader.bind(this),
|
|
8765
8421
|
AWS_LAMBDA: this._customAuthHeader
|
|
8766
8422
|
};
|
|
8767
|
-
if (!(!authenticationType || !headerHandler[authenticationType])) return [3
|
|
8768
|
-
/*break*/
|
|
8769
|
-
, 1];
|
|
8423
|
+
if (!(!authenticationType || !headerHandler[authenticationType])) return [3 /*break*/, 1];
|
|
8770
8424
|
logger.debug("Authentication type " + authenticationType + " not supported");
|
|
8771
|
-
return [2
|
|
8772
|
-
/*return*/
|
|
8773
|
-
, ''];
|
|
8774
|
-
|
|
8425
|
+
return [2 /*return*/, ''];
|
|
8775
8426
|
case 1:
|
|
8776
8427
|
handler = headerHandler[authenticationType];
|
|
8777
8428
|
host = url__WEBPACK_IMPORTED_MODULE_2__["parse"](appSyncGraphqlEndpoint !== null && appSyncGraphqlEndpoint !== void 0 ? appSyncGraphqlEndpoint : '').host;
|
|
8778
8429
|
logger.debug("Authenticating with " + authenticationType);
|
|
8779
|
-
return [4
|
|
8780
|
-
/*yield*/
|
|
8781
|
-
, handler({
|
|
8430
|
+
return [4 /*yield*/, handler({
|
|
8782
8431
|
payload: payload,
|
|
8783
8432
|
canonicalUri: canonicalUri,
|
|
8784
8433
|
appSyncGraphqlEndpoint: appSyncGraphqlEndpoint,
|
|
@@ -8787,17 +8436,13 @@ function (_super) {
|
|
|
8787
8436
|
host: host,
|
|
8788
8437
|
additionalHeaders: additionalHeaders
|
|
8789
8438
|
})];
|
|
8790
|
-
|
|
8791
8439
|
case 2:
|
|
8792
8440
|
result = _b.sent();
|
|
8793
|
-
return [2
|
|
8794
|
-
/*return*/
|
|
8795
|
-
, result];
|
|
8441
|
+
return [2 /*return*/, result];
|
|
8796
8442
|
}
|
|
8797
8443
|
});
|
|
8798
8444
|
});
|
|
8799
8445
|
};
|
|
8800
|
-
|
|
8801
8446
|
AWSAppSyncRealTimeProvider.prototype._awsRealTimeCUPHeader = function (_a) {
|
|
8802
8447
|
var host = _a.host;
|
|
8803
8448
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -8805,15 +8450,10 @@ function (_super) {
|
|
|
8805
8450
|
return __generator(this, function (_b) {
|
|
8806
8451
|
switch (_b.label) {
|
|
8807
8452
|
case 0:
|
|
8808
|
-
return [4
|
|
8809
|
-
/*yield*/
|
|
8810
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_7___default.a.currentSession()];
|
|
8811
|
-
|
|
8453
|
+
return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_7___default.a.currentSession()];
|
|
8812
8454
|
case 1:
|
|
8813
8455
|
session = _b.sent();
|
|
8814
|
-
return [2
|
|
8815
|
-
/*return*/
|
|
8816
|
-
, {
|
|
8456
|
+
return [2 /*return*/, {
|
|
8817
8457
|
Authorization: session.getAccessToken().getJwtToken(),
|
|
8818
8458
|
host: host
|
|
8819
8459
|
}];
|
|
@@ -8821,7 +8461,6 @@ function (_super) {
|
|
|
8821
8461
|
});
|
|
8822
8462
|
});
|
|
8823
8463
|
};
|
|
8824
|
-
|
|
8825
8464
|
AWSAppSyncRealTimeProvider.prototype._awsRealTimeOPENIDHeader = function (_a) {
|
|
8826
8465
|
var host = _a.host;
|
|
8827
8466
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -8829,42 +8468,25 @@ function (_super) {
|
|
|
8829
8468
|
return __generator(this, function (_b) {
|
|
8830
8469
|
switch (_b.label) {
|
|
8831
8470
|
case 0:
|
|
8832
|
-
return [4
|
|
8833
|
-
/*yield*/
|
|
8834
|
-
, _aws_amplify_cache__WEBPACK_IMPORTED_MODULE_6___default.a.getItem('federatedInfo')];
|
|
8835
|
-
|
|
8471
|
+
return [4 /*yield*/, _aws_amplify_cache__WEBPACK_IMPORTED_MODULE_6___default.a.getItem('federatedInfo')];
|
|
8836
8472
|
case 1:
|
|
8837
8473
|
federatedInfo = _b.sent();
|
|
8838
|
-
if (!federatedInfo) return [3
|
|
8839
|
-
/*break*/
|
|
8840
|
-
, 2];
|
|
8474
|
+
if (!federatedInfo) return [3 /*break*/, 2];
|
|
8841
8475
|
token = federatedInfo.token;
|
|
8842
|
-
return [3
|
|
8843
|
-
/*break*/
|
|
8844
|
-
, 4];
|
|
8845
|
-
|
|
8476
|
+
return [3 /*break*/, 4];
|
|
8846
8477
|
case 2:
|
|
8847
|
-
return [4
|
|
8848
|
-
/*yield*/
|
|
8849
|
-
, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_7___default.a.currentAuthenticatedUser()];
|
|
8850
|
-
|
|
8478
|
+
return [4 /*yield*/, _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_7___default.a.currentAuthenticatedUser()];
|
|
8851
8479
|
case 3:
|
|
8852
8480
|
currentUser = _b.sent();
|
|
8853
|
-
|
|
8854
8481
|
if (currentUser) {
|
|
8855
8482
|
token = currentUser.token;
|
|
8856
8483
|
}
|
|
8857
|
-
|
|
8858
8484
|
_b.label = 4;
|
|
8859
|
-
|
|
8860
8485
|
case 4:
|
|
8861
8486
|
if (!token) {
|
|
8862
8487
|
throw new Error('No federated jwt');
|
|
8863
8488
|
}
|
|
8864
|
-
|
|
8865
|
-
return [2
|
|
8866
|
-
/*return*/
|
|
8867
|
-
, {
|
|
8489
|
+
return [2 /*return*/, {
|
|
8868
8490
|
Authorization: token,
|
|
8869
8491
|
host: host
|
|
8870
8492
|
}];
|
|
@@ -8872,18 +8494,15 @@ function (_super) {
|
|
|
8872
8494
|
});
|
|
8873
8495
|
});
|
|
8874
8496
|
};
|
|
8875
|
-
|
|
8876
8497
|
AWSAppSyncRealTimeProvider.prototype._awsRealTimeApiKeyHeader = function (_a) {
|
|
8877
8498
|
var apiKey = _a.apiKey,
|
|
8878
|
-
|
|
8499
|
+
host = _a.host;
|
|
8879
8500
|
return __awaiter(this, void 0, void 0, function () {
|
|
8880
8501
|
var dt, dtStr;
|
|
8881
8502
|
return __generator(this, function (_b) {
|
|
8882
8503
|
dt = new Date();
|
|
8883
8504
|
dtStr = dt.toISOString().replace(/[:\-]|\.\d{3}/g, '');
|
|
8884
|
-
return [2
|
|
8885
|
-
/*return*/
|
|
8886
|
-
, {
|
|
8505
|
+
return [2 /*return*/, {
|
|
8887
8506
|
host: host,
|
|
8888
8507
|
'x-amz-date': dtStr,
|
|
8889
8508
|
'x-api-key': apiKey
|
|
@@ -8891,12 +8510,11 @@ function (_super) {
|
|
|
8891
8510
|
});
|
|
8892
8511
|
});
|
|
8893
8512
|
};
|
|
8894
|
-
|
|
8895
8513
|
AWSAppSyncRealTimeProvider.prototype._awsRealTimeIAMHeader = function (_a) {
|
|
8896
8514
|
var payload = _a.payload,
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
8515
|
+
canonicalUri = _a.canonicalUri,
|
|
8516
|
+
appSyncGraphqlEndpoint = _a.appSyncGraphqlEndpoint,
|
|
8517
|
+
region = _a.region;
|
|
8900
8518
|
return __awaiter(this, void 0, void 0, function () {
|
|
8901
8519
|
var endpointInfo, credentialsOK, creds, request, signed_params;
|
|
8902
8520
|
return __generator(this, function (_b) {
|
|
@@ -8906,31 +8524,23 @@ function (_super) {
|
|
|
8906
8524
|
region: region,
|
|
8907
8525
|
service: 'appsync'
|
|
8908
8526
|
};
|
|
8909
|
-
return [4
|
|
8910
|
-
/*yield*/
|
|
8911
|
-
, this._ensureCredentials()];
|
|
8912
|
-
|
|
8527
|
+
return [4 /*yield*/, this._ensureCredentials()];
|
|
8913
8528
|
case 1:
|
|
8914
8529
|
credentialsOK = _b.sent();
|
|
8915
|
-
|
|
8916
8530
|
if (!credentialsOK) {
|
|
8917
8531
|
throw new Error('No credentials');
|
|
8918
8532
|
}
|
|
8919
|
-
|
|
8920
|
-
return [4
|
|
8921
|
-
/*yield*/
|
|
8922
|
-
, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["Credentials"].get().then(function (credentials) {
|
|
8533
|
+
return [4 /*yield*/, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["Credentials"].get().then(function (credentials) {
|
|
8923
8534
|
var _a = credentials,
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8535
|
+
secretAccessKey = _a.secretAccessKey,
|
|
8536
|
+
accessKeyId = _a.accessKeyId,
|
|
8537
|
+
sessionToken = _a.sessionToken;
|
|
8927
8538
|
return {
|
|
8928
8539
|
secret_key: secretAccessKey,
|
|
8929
8540
|
access_key: accessKeyId,
|
|
8930
8541
|
session_token: sessionToken
|
|
8931
8542
|
};
|
|
8932
8543
|
})];
|
|
8933
|
-
|
|
8934
8544
|
case 2:
|
|
8935
8545
|
creds = _b.sent();
|
|
8936
8546
|
request = {
|
|
@@ -8940,22 +8550,17 @@ function (_super) {
|
|
|
8940
8550
|
headers: __assign({}, _constants__WEBPACK_IMPORTED_MODULE_10__["AWS_APPSYNC_REALTIME_HEADERS"])
|
|
8941
8551
|
};
|
|
8942
8552
|
signed_params = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["Signer"].sign(request, creds, endpointInfo);
|
|
8943
|
-
return [2
|
|
8944
|
-
/*return*/
|
|
8945
|
-
, signed_params.headers];
|
|
8553
|
+
return [2 /*return*/, signed_params.headers];
|
|
8946
8554
|
}
|
|
8947
8555
|
});
|
|
8948
8556
|
});
|
|
8949
8557
|
};
|
|
8950
|
-
|
|
8951
8558
|
AWSAppSyncRealTimeProvider.prototype._customAuthHeader = function (_a) {
|
|
8952
8559
|
var host = _a.host,
|
|
8953
|
-
|
|
8954
|
-
|
|
8560
|
+
additionalHeaders = _a.additionalHeaders;
|
|
8955
8561
|
if (!additionalHeaders || !additionalHeaders['Authorization']) {
|
|
8956
8562
|
throw new Error('No auth token specified');
|
|
8957
8563
|
}
|
|
8958
|
-
|
|
8959
8564
|
return {
|
|
8960
8565
|
Authorization: additionalHeaders.Authorization,
|
|
8961
8566
|
host: host
|
|
@@ -8964,8 +8569,6 @@ function (_super) {
|
|
|
8964
8569
|
/**
|
|
8965
8570
|
* @private
|
|
8966
8571
|
*/
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
8572
|
AWSAppSyncRealTimeProvider.prototype._ensureCredentials = function () {
|
|
8970
8573
|
return _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["Credentials"].get().then(function (credentials) {
|
|
8971
8574
|
if (!credentials) return false;
|
|
@@ -8977,12 +8580,10 @@ function (_super) {
|
|
|
8977
8580
|
return false;
|
|
8978
8581
|
});
|
|
8979
8582
|
};
|
|
8980
|
-
|
|
8981
8583
|
return AWSAppSyncRealTimeProvider;
|
|
8982
8584
|
}(_PubSubProvider__WEBPACK_IMPORTED_MODULE_8__["AbstractPubSubProvider"]);
|
|
8983
8585
|
|
|
8984
8586
|
|
|
8985
|
-
|
|
8986
8587
|
/***/ }),
|
|
8987
8588
|
|
|
8988
8589
|
/***/ "./lib-esm/Providers/AWSIotProvider.js":
|
|
@@ -9009,28 +8610,22 @@ var __extends = undefined && undefined.__extends || function () {
|
|
|
9009
8610
|
if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
9010
8611
|
}
|
|
9011
8612
|
};
|
|
9012
|
-
|
|
9013
8613
|
return _extendStatics(d, b);
|
|
9014
8614
|
};
|
|
9015
|
-
|
|
9016
8615
|
return function (d, b) {
|
|
9017
8616
|
_extendStatics(d, b);
|
|
9018
|
-
|
|
9019
8617
|
function __() {
|
|
9020
8618
|
this.constructor = d;
|
|
9021
8619
|
}
|
|
9022
|
-
|
|
9023
8620
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
9024
8621
|
};
|
|
9025
8622
|
}();
|
|
9026
|
-
|
|
9027
8623
|
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
9028
8624
|
function adopt(value) {
|
|
9029
8625
|
return value instanceof P ? value : new P(function (resolve) {
|
|
9030
8626
|
resolve(value);
|
|
9031
8627
|
});
|
|
9032
8628
|
}
|
|
9033
|
-
|
|
9034
8629
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9035
8630
|
function fulfilled(value) {
|
|
9036
8631
|
try {
|
|
@@ -9039,7 +8634,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
9039
8634
|
reject(e);
|
|
9040
8635
|
}
|
|
9041
8636
|
}
|
|
9042
|
-
|
|
9043
8637
|
function rejected(value) {
|
|
9044
8638
|
try {
|
|
9045
8639
|
step(generator["throw"](value));
|
|
@@ -9047,29 +8641,26 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
9047
8641
|
reject(e);
|
|
9048
8642
|
}
|
|
9049
8643
|
}
|
|
9050
|
-
|
|
9051
8644
|
function step(result) {
|
|
9052
8645
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
9053
8646
|
}
|
|
9054
|
-
|
|
9055
8647
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9056
8648
|
});
|
|
9057
8649
|
};
|
|
9058
|
-
|
|
9059
8650
|
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
9060
8651
|
var _ = {
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
8652
|
+
label: 0,
|
|
8653
|
+
sent: function sent() {
|
|
8654
|
+
if (t[0] & 1) throw t[1];
|
|
8655
|
+
return t[1];
|
|
8656
|
+
},
|
|
8657
|
+
trys: [],
|
|
8658
|
+
ops: []
|
|
9065
8659
|
},
|
|
9066
|
-
|
|
9067
|
-
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
y,
|
|
9071
|
-
t,
|
|
9072
|
-
g;
|
|
8660
|
+
f,
|
|
8661
|
+
y,
|
|
8662
|
+
t,
|
|
8663
|
+
g;
|
|
9073
8664
|
return g = {
|
|
9074
8665
|
next: verb(0),
|
|
9075
8666
|
"throw": verb(1),
|
|
@@ -9077,79 +8668,60 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
9077
8668
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
9078
8669
|
return this;
|
|
9079
8670
|
}), g;
|
|
9080
|
-
|
|
9081
8671
|
function verb(n) {
|
|
9082
8672
|
return function (v) {
|
|
9083
8673
|
return step([n, v]);
|
|
9084
8674
|
};
|
|
9085
8675
|
}
|
|
9086
|
-
|
|
9087
8676
|
function step(op) {
|
|
9088
8677
|
if (f) throw new TypeError("Generator is already executing.");
|
|
9089
|
-
|
|
9090
8678
|
while (_) {
|
|
9091
8679
|
try {
|
|
9092
8680
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
9093
8681
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
9094
|
-
|
|
9095
8682
|
switch (op[0]) {
|
|
9096
8683
|
case 0:
|
|
9097
8684
|
case 1:
|
|
9098
8685
|
t = op;
|
|
9099
8686
|
break;
|
|
9100
|
-
|
|
9101
8687
|
case 4:
|
|
9102
8688
|
_.label++;
|
|
9103
8689
|
return {
|
|
9104
8690
|
value: op[1],
|
|
9105
8691
|
done: false
|
|
9106
8692
|
};
|
|
9107
|
-
|
|
9108
8693
|
case 5:
|
|
9109
8694
|
_.label++;
|
|
9110
8695
|
y = op[1];
|
|
9111
8696
|
op = [0];
|
|
9112
8697
|
continue;
|
|
9113
|
-
|
|
9114
8698
|
case 7:
|
|
9115
8699
|
op = _.ops.pop();
|
|
9116
|
-
|
|
9117
8700
|
_.trys.pop();
|
|
9118
|
-
|
|
9119
8701
|
continue;
|
|
9120
|
-
|
|
9121
8702
|
default:
|
|
9122
8703
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
9123
8704
|
_ = 0;
|
|
9124
8705
|
continue;
|
|
9125
8706
|
}
|
|
9126
|
-
|
|
9127
8707
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
9128
8708
|
_.label = op[1];
|
|
9129
8709
|
break;
|
|
9130
8710
|
}
|
|
9131
|
-
|
|
9132
8711
|
if (op[0] === 6 && _.label < t[1]) {
|
|
9133
8712
|
_.label = t[1];
|
|
9134
8713
|
t = op;
|
|
9135
8714
|
break;
|
|
9136
8715
|
}
|
|
9137
|
-
|
|
9138
8716
|
if (t && _.label < t[2]) {
|
|
9139
8717
|
_.label = t[2];
|
|
9140
|
-
|
|
9141
8718
|
_.ops.push(op);
|
|
9142
|
-
|
|
9143
8719
|
break;
|
|
9144
8720
|
}
|
|
9145
|
-
|
|
9146
8721
|
if (t[2]) _.ops.pop();
|
|
9147
|
-
|
|
9148
8722
|
_.trys.pop();
|
|
9149
|
-
|
|
9150
8723
|
continue;
|
|
9151
8724
|
}
|
|
9152
|
-
|
|
9153
8725
|
op = body.call(thisArg, _);
|
|
9154
8726
|
} catch (e) {
|
|
9155
8727
|
op = [6, e];
|
|
@@ -9158,7 +8730,6 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
9158
8730
|
f = t = 0;
|
|
9159
8731
|
}
|
|
9160
8732
|
}
|
|
9161
|
-
|
|
9162
8733
|
if (op[0] & 5) throw op[1];
|
|
9163
8734
|
return {
|
|
9164
8735
|
value: op[0] ? op[1] : void 0,
|
|
@@ -9180,23 +8751,15 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
9180
8751
|
*/
|
|
9181
8752
|
|
|
9182
8753
|
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
8754
|
var SERVICE_NAME = 'iotdevicegateway';
|
|
9186
|
-
|
|
9187
|
-
var AWSIoTProvider =
|
|
9188
|
-
/** @class */
|
|
9189
|
-
function (_super) {
|
|
8755
|
+
var AWSIoTProvider = /** @class */function (_super) {
|
|
9190
8756
|
__extends(AWSIoTProvider, _super);
|
|
9191
|
-
|
|
9192
8757
|
function AWSIoTProvider(options) {
|
|
9193
8758
|
if (options === void 0) {
|
|
9194
8759
|
options = {};
|
|
9195
8760
|
}
|
|
9196
|
-
|
|
9197
8761
|
return _super.call(this, options) || this;
|
|
9198
8762
|
}
|
|
9199
|
-
|
|
9200
8763
|
Object.defineProperty(AWSIoTProvider.prototype, "region", {
|
|
9201
8764
|
get: function get() {
|
|
9202
8765
|
return this.options.aws_pubsub_region;
|
|
@@ -9204,19 +8767,15 @@ function (_super) {
|
|
|
9204
8767
|
enumerable: true,
|
|
9205
8768
|
configurable: true
|
|
9206
8769
|
});
|
|
9207
|
-
|
|
9208
8770
|
AWSIoTProvider.prototype.getProviderName = function () {
|
|
9209
8771
|
return 'AWSIoTProvider';
|
|
9210
8772
|
};
|
|
9211
|
-
|
|
9212
8773
|
Object.defineProperty(AWSIoTProvider.prototype, "endpoint", {
|
|
9213
8774
|
get: function get() {
|
|
9214
8775
|
var _this = this;
|
|
9215
|
-
|
|
9216
8776
|
return function () {
|
|
9217
8777
|
return __awaiter(_this, void 0, void 0, function () {
|
|
9218
8778
|
var endpoint, serviceInfo, _a, access_key, secret_key, session_token, result;
|
|
9219
|
-
|
|
9220
8779
|
return __generator(this, function (_b) {
|
|
9221
8780
|
switch (_b.label) {
|
|
9222
8781
|
case 0:
|
|
@@ -9225,10 +8784,7 @@ function (_super) {
|
|
|
9225
8784
|
service: SERVICE_NAME,
|
|
9226
8785
|
region: this.region
|
|
9227
8786
|
};
|
|
9228
|
-
return [4
|
|
9229
|
-
/*yield*/
|
|
9230
|
-
, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Credentials"].get()];
|
|
9231
|
-
|
|
8787
|
+
return [4 /*yield*/, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Credentials"].get()];
|
|
9232
8788
|
case 1:
|
|
9233
8789
|
_a = _b.sent(), access_key = _a.accessKeyId, secret_key = _a.secretAccessKey, session_token = _a.sessionToken;
|
|
9234
8790
|
result = _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Signer"].signUrl(endpoint, {
|
|
@@ -9236,9 +8792,7 @@ function (_super) {
|
|
|
9236
8792
|
secret_key: secret_key,
|
|
9237
8793
|
session_token: session_token
|
|
9238
8794
|
}, serviceInfo);
|
|
9239
|
-
return [2
|
|
9240
|
-
/*return*/
|
|
9241
|
-
, result];
|
|
8795
|
+
return [2 /*return*/, result];
|
|
9242
8796
|
}
|
|
9243
8797
|
});
|
|
9244
8798
|
});
|
|
@@ -9251,7 +8805,6 @@ function (_super) {
|
|
|
9251
8805
|
}(_MqttOverWSProvider__WEBPACK_IMPORTED_MODULE_0__["MqttOverWSProvider"]);
|
|
9252
8806
|
|
|
9253
8807
|
|
|
9254
|
-
|
|
9255
8808
|
/***/ }),
|
|
9256
8809
|
|
|
9257
8810
|
/***/ "./lib-esm/Providers/MqttOverWSProvider.js":
|
|
@@ -9284,7 +8837,6 @@ function _typeof(obj) {
|
|
|
9284
8837
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
9285
8838
|
}, _typeof(obj);
|
|
9286
8839
|
}
|
|
9287
|
-
|
|
9288
8840
|
var __extends = undefined && undefined.__extends || function () {
|
|
9289
8841
|
var _extendStatics = function extendStatics(d, b) {
|
|
9290
8842
|
_extendStatics = Object.setPrototypeOf || {
|
|
@@ -9296,44 +8848,34 @@ var __extends = undefined && undefined.__extends || function () {
|
|
|
9296
8848
|
if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
9297
8849
|
}
|
|
9298
8850
|
};
|
|
9299
|
-
|
|
9300
8851
|
return _extendStatics(d, b);
|
|
9301
8852
|
};
|
|
9302
|
-
|
|
9303
8853
|
return function (d, b) {
|
|
9304
8854
|
_extendStatics(d, b);
|
|
9305
|
-
|
|
9306
8855
|
function __() {
|
|
9307
8856
|
this.constructor = d;
|
|
9308
8857
|
}
|
|
9309
|
-
|
|
9310
8858
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
9311
8859
|
};
|
|
9312
8860
|
}();
|
|
9313
|
-
|
|
9314
8861
|
var __assign = undefined && undefined.__assign || function () {
|
|
9315
8862
|
__assign = Object.assign || function (t) {
|
|
9316
8863
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9317
8864
|
s = arguments[i];
|
|
9318
|
-
|
|
9319
8865
|
for (var p in s) {
|
|
9320
8866
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
9321
8867
|
}
|
|
9322
8868
|
}
|
|
9323
|
-
|
|
9324
8869
|
return t;
|
|
9325
8870
|
};
|
|
9326
|
-
|
|
9327
8871
|
return __assign.apply(this, arguments);
|
|
9328
8872
|
};
|
|
9329
|
-
|
|
9330
8873
|
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
9331
8874
|
function adopt(value) {
|
|
9332
8875
|
return value instanceof P ? value : new P(function (resolve) {
|
|
9333
8876
|
resolve(value);
|
|
9334
8877
|
});
|
|
9335
8878
|
}
|
|
9336
|
-
|
|
9337
8879
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9338
8880
|
function fulfilled(value) {
|
|
9339
8881
|
try {
|
|
@@ -9342,7 +8884,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
9342
8884
|
reject(e);
|
|
9343
8885
|
}
|
|
9344
8886
|
}
|
|
9345
|
-
|
|
9346
8887
|
function rejected(value) {
|
|
9347
8888
|
try {
|
|
9348
8889
|
step(generator["throw"](value));
|
|
@@ -9350,29 +8891,26 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
9350
8891
|
reject(e);
|
|
9351
8892
|
}
|
|
9352
8893
|
}
|
|
9353
|
-
|
|
9354
8894
|
function step(result) {
|
|
9355
8895
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
9356
8896
|
}
|
|
9357
|
-
|
|
9358
8897
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9359
8898
|
});
|
|
9360
8899
|
};
|
|
9361
|
-
|
|
9362
8900
|
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
9363
8901
|
var _ = {
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
8902
|
+
label: 0,
|
|
8903
|
+
sent: function sent() {
|
|
8904
|
+
if (t[0] & 1) throw t[1];
|
|
8905
|
+
return t[1];
|
|
8906
|
+
},
|
|
8907
|
+
trys: [],
|
|
8908
|
+
ops: []
|
|
9368
8909
|
},
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
y,
|
|
9374
|
-
t,
|
|
9375
|
-
g;
|
|
8910
|
+
f,
|
|
8911
|
+
y,
|
|
8912
|
+
t,
|
|
8913
|
+
g;
|
|
9376
8914
|
return g = {
|
|
9377
8915
|
next: verb(0),
|
|
9378
8916
|
"throw": verb(1),
|
|
@@ -9380,79 +8918,60 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
9380
8918
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
9381
8919
|
return this;
|
|
9382
8920
|
}), g;
|
|
9383
|
-
|
|
9384
8921
|
function verb(n) {
|
|
9385
8922
|
return function (v) {
|
|
9386
8923
|
return step([n, v]);
|
|
9387
8924
|
};
|
|
9388
8925
|
}
|
|
9389
|
-
|
|
9390
8926
|
function step(op) {
|
|
9391
8927
|
if (f) throw new TypeError("Generator is already executing.");
|
|
9392
|
-
|
|
9393
8928
|
while (_) {
|
|
9394
8929
|
try {
|
|
9395
8930
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
9396
8931
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
9397
|
-
|
|
9398
8932
|
switch (op[0]) {
|
|
9399
8933
|
case 0:
|
|
9400
8934
|
case 1:
|
|
9401
8935
|
t = op;
|
|
9402
8936
|
break;
|
|
9403
|
-
|
|
9404
8937
|
case 4:
|
|
9405
8938
|
_.label++;
|
|
9406
8939
|
return {
|
|
9407
8940
|
value: op[1],
|
|
9408
8941
|
done: false
|
|
9409
8942
|
};
|
|
9410
|
-
|
|
9411
8943
|
case 5:
|
|
9412
8944
|
_.label++;
|
|
9413
8945
|
y = op[1];
|
|
9414
8946
|
op = [0];
|
|
9415
8947
|
continue;
|
|
9416
|
-
|
|
9417
8948
|
case 7:
|
|
9418
8949
|
op = _.ops.pop();
|
|
9419
|
-
|
|
9420
8950
|
_.trys.pop();
|
|
9421
|
-
|
|
9422
8951
|
continue;
|
|
9423
|
-
|
|
9424
8952
|
default:
|
|
9425
8953
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
9426
8954
|
_ = 0;
|
|
9427
8955
|
continue;
|
|
9428
8956
|
}
|
|
9429
|
-
|
|
9430
8957
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
9431
8958
|
_.label = op[1];
|
|
9432
8959
|
break;
|
|
9433
8960
|
}
|
|
9434
|
-
|
|
9435
8961
|
if (op[0] === 6 && _.label < t[1]) {
|
|
9436
8962
|
_.label = t[1];
|
|
9437
8963
|
t = op;
|
|
9438
8964
|
break;
|
|
9439
8965
|
}
|
|
9440
|
-
|
|
9441
8966
|
if (t && _.label < t[2]) {
|
|
9442
8967
|
_.label = t[2];
|
|
9443
|
-
|
|
9444
8968
|
_.ops.push(op);
|
|
9445
|
-
|
|
9446
8969
|
break;
|
|
9447
8970
|
}
|
|
9448
|
-
|
|
9449
8971
|
if (t[2]) _.ops.pop();
|
|
9450
|
-
|
|
9451
8972
|
_.trys.pop();
|
|
9452
|
-
|
|
9453
8973
|
continue;
|
|
9454
8974
|
}
|
|
9455
|
-
|
|
9456
8975
|
op = body.call(thisArg, _);
|
|
9457
8976
|
} catch (e) {
|
|
9458
8977
|
op = [6, e];
|
|
@@ -9461,7 +8980,6 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
9461
8980
|
f = t = 0;
|
|
9462
8981
|
}
|
|
9463
8982
|
}
|
|
9464
|
-
|
|
9465
8983
|
if (op[0] & 5) throw op[1];
|
|
9466
8984
|
return {
|
|
9467
8985
|
value: op[0] ? op[1] : void 0,
|
|
@@ -9469,14 +8987,11 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
9469
8987
|
};
|
|
9470
8988
|
}
|
|
9471
8989
|
};
|
|
9472
|
-
|
|
9473
8990
|
var __rest = undefined && undefined.__rest || function (s, e) {
|
|
9474
8991
|
var t = {};
|
|
9475
|
-
|
|
9476
8992
|
for (var p in s) {
|
|
9477
8993
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
9478
8994
|
}
|
|
9479
|
-
|
|
9480
8995
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
9481
8996
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
9482
8997
|
}
|
|
@@ -9501,58 +9016,40 @@ var __rest = undefined && undefined.__rest || function (s, e) {
|
|
|
9501
9016
|
|
|
9502
9017
|
|
|
9503
9018
|
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
9019
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_4__["ConsoleLogger"]('MqttOverWSProvider');
|
|
9507
9020
|
function mqttTopicMatch(filter, topic) {
|
|
9508
9021
|
var filterArray = filter.split('/');
|
|
9509
9022
|
var length = filterArray.length;
|
|
9510
9023
|
var topicArray = topic.split('/');
|
|
9511
|
-
|
|
9512
9024
|
for (var i = 0; i < length; ++i) {
|
|
9513
9025
|
var left = filterArray[i];
|
|
9514
9026
|
var right = topicArray[i];
|
|
9515
9027
|
if (left === '#') return topicArray.length >= length;
|
|
9516
9028
|
if (left !== '+' && left !== right) return false;
|
|
9517
9029
|
}
|
|
9518
|
-
|
|
9519
9030
|
return length === topicArray.length;
|
|
9520
9031
|
}
|
|
9521
|
-
|
|
9522
|
-
var ClientsQueue =
|
|
9523
|
-
/** @class */
|
|
9524
|
-
function () {
|
|
9032
|
+
var ClientsQueue = /** @class */function () {
|
|
9525
9033
|
function ClientsQueue() {
|
|
9526
9034
|
this.promises = new Map();
|
|
9527
9035
|
}
|
|
9528
|
-
|
|
9529
9036
|
ClientsQueue.prototype.get = function (clientId, clientFactory) {
|
|
9530
9037
|
return __awaiter(this, void 0, void 0, function () {
|
|
9531
9038
|
var cachedPromise, newPromise;
|
|
9532
9039
|
return __generator(this, function (_a) {
|
|
9533
9040
|
cachedPromise = this.promises.get(clientId);
|
|
9534
|
-
|
|
9535
9041
|
if (cachedPromise) {
|
|
9536
|
-
return [2
|
|
9537
|
-
/*return*/
|
|
9538
|
-
, cachedPromise];
|
|
9042
|
+
return [2 /*return*/, cachedPromise];
|
|
9539
9043
|
}
|
|
9540
|
-
|
|
9541
9044
|
if (clientFactory) {
|
|
9542
9045
|
newPromise = clientFactory(clientId);
|
|
9543
9046
|
this.promises.set(clientId, newPromise);
|
|
9544
|
-
return [2
|
|
9545
|
-
/*return*/
|
|
9546
|
-
, newPromise];
|
|
9047
|
+
return [2 /*return*/, newPromise];
|
|
9547
9048
|
}
|
|
9548
|
-
|
|
9549
|
-
return [2
|
|
9550
|
-
/*return*/
|
|
9551
|
-
, undefined];
|
|
9049
|
+
return [2 /*return*/, undefined];
|
|
9552
9050
|
});
|
|
9553
9051
|
});
|
|
9554
9052
|
};
|
|
9555
|
-
|
|
9556
9053
|
Object.defineProperty(ClientsQueue.prototype, "allClients", {
|
|
9557
9054
|
get: function get() {
|
|
9558
9055
|
return Array.from(this.promises.keys());
|
|
@@ -9560,14 +9057,11 @@ function () {
|
|
|
9560
9057
|
enumerable: true,
|
|
9561
9058
|
configurable: true
|
|
9562
9059
|
});
|
|
9563
|
-
|
|
9564
9060
|
ClientsQueue.prototype.remove = function (clientId) {
|
|
9565
9061
|
this.promises["delete"](clientId);
|
|
9566
9062
|
};
|
|
9567
|
-
|
|
9568
9063
|
return ClientsQueue;
|
|
9569
9064
|
}();
|
|
9570
|
-
|
|
9571
9065
|
var dispatchPubSubEvent = function dispatchPubSubEvent(event, data, message) {
|
|
9572
9066
|
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_4__["Hub"].dispatch('pubsub', {
|
|
9573
9067
|
event: event,
|
|
@@ -9575,38 +9069,29 @@ var dispatchPubSubEvent = function dispatchPubSubEvent(event, data, message) {
|
|
|
9575
9069
|
message: message
|
|
9576
9070
|
}, 'PubSub', _constants__WEBPACK_IMPORTED_MODULE_6__["AMPLIFY_SYMBOL"]);
|
|
9577
9071
|
};
|
|
9578
|
-
|
|
9579
9072
|
var topicSymbol = typeof Symbol !== 'undefined' ? Symbol('topic') : '@@topic';
|
|
9580
|
-
|
|
9581
|
-
var MqttOverWSProvider =
|
|
9582
|
-
/** @class */
|
|
9583
|
-
function (_super) {
|
|
9073
|
+
var MqttOverWSProvider = /** @class */function (_super) {
|
|
9584
9074
|
__extends(MqttOverWSProvider, _super);
|
|
9585
|
-
|
|
9586
9075
|
function MqttOverWSProvider(options) {
|
|
9587
9076
|
if (options === void 0) {
|
|
9588
9077
|
options = {};
|
|
9589
9078
|
}
|
|
9590
|
-
|
|
9591
9079
|
var _this = _super.call(this, __assign(__assign({}, options), {
|
|
9592
9080
|
clientId: options.clientId || Object(uuid__WEBPACK_IMPORTED_MODULE_1__["v4"])()
|
|
9593
9081
|
})) || this;
|
|
9594
|
-
|
|
9595
9082
|
_this._clientsQueue = new ClientsQueue();
|
|
9596
9083
|
_this.connectionStateMonitor = new _utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["ConnectionStateMonitor"]();
|
|
9597
9084
|
_this._topicObservers = new Map();
|
|
9598
|
-
_this._clientIdObservers = new Map();
|
|
9599
|
-
|
|
9085
|
+
_this._clientIdObservers = new Map();
|
|
9086
|
+
// Monitor the connection health state and pass changes along to Hub
|
|
9600
9087
|
_this.connectionStateMonitor.connectionStateObservable.subscribe(function (connectionStateChange) {
|
|
9601
9088
|
dispatchPubSubEvent(_constants__WEBPACK_IMPORTED_MODULE_6__["CONNECTION_STATE_CHANGE"], {
|
|
9602
9089
|
provider: _this,
|
|
9603
9090
|
connectionState: connectionStateChange
|
|
9604
9091
|
}, "Connection state is " + connectionStateChange);
|
|
9605
9092
|
});
|
|
9606
|
-
|
|
9607
9093
|
return _this;
|
|
9608
9094
|
}
|
|
9609
|
-
|
|
9610
9095
|
Object.defineProperty(MqttOverWSProvider.prototype, "clientId", {
|
|
9611
9096
|
get: function get() {
|
|
9612
9097
|
return this.options.clientId;
|
|
@@ -9635,96 +9120,75 @@ function (_super) {
|
|
|
9635
9120
|
enumerable: true,
|
|
9636
9121
|
configurable: true
|
|
9637
9122
|
});
|
|
9638
|
-
|
|
9639
9123
|
MqttOverWSProvider.prototype.getTopicForValue = function (value) {
|
|
9640
9124
|
return _typeof(value) === 'object' && value[topicSymbol];
|
|
9641
9125
|
};
|
|
9642
|
-
|
|
9643
9126
|
MqttOverWSProvider.prototype.getProviderName = function () {
|
|
9644
9127
|
return 'MqttOverWSProvider';
|
|
9645
9128
|
};
|
|
9646
|
-
|
|
9647
9129
|
MqttOverWSProvider.prototype.onDisconnect = function (_a) {
|
|
9648
9130
|
var _this = this;
|
|
9649
|
-
|
|
9650
9131
|
var clientId = _a.clientId,
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9132
|
+
errorCode = _a.errorCode,
|
|
9133
|
+
args = __rest(_a, ["clientId", "errorCode"]);
|
|
9654
9134
|
if (errorCode !== 0) {
|
|
9655
9135
|
logger.warn(clientId, JSON.stringify(__assign({
|
|
9656
9136
|
errorCode: errorCode
|
|
9657
9137
|
}, args), null, 2));
|
|
9658
9138
|
var topicsToDelete_1 = [];
|
|
9659
|
-
|
|
9660
9139
|
if (!clientId) {
|
|
9661
9140
|
return;
|
|
9662
9141
|
}
|
|
9663
|
-
|
|
9664
9142
|
var clientIdObservers = this._clientIdObservers.get(clientId);
|
|
9665
|
-
|
|
9666
9143
|
if (!clientIdObservers) {
|
|
9667
9144
|
return;
|
|
9668
9145
|
}
|
|
9669
|
-
|
|
9670
9146
|
clientIdObservers.forEach(function (observer) {
|
|
9671
|
-
observer.error('Disconnected, error code: ' + errorCode);
|
|
9672
|
-
|
|
9147
|
+
observer.error('Disconnected, error code: ' + errorCode);
|
|
9148
|
+
// removing observers for disconnected clientId
|
|
9673
9149
|
_this._topicObservers.forEach(function (observerForTopic, observerTopic) {
|
|
9674
9150
|
observerForTopic["delete"](observer);
|
|
9675
|
-
|
|
9676
9151
|
if (observerForTopic.size === 0) {
|
|
9677
9152
|
topicsToDelete_1.push(observerTopic);
|
|
9678
9153
|
}
|
|
9679
9154
|
});
|
|
9680
|
-
});
|
|
9681
|
-
|
|
9682
|
-
this._clientIdObservers["delete"](clientId);
|
|
9683
|
-
|
|
9684
|
-
|
|
9155
|
+
});
|
|
9156
|
+
// forgiving any trace of clientId
|
|
9157
|
+
this._clientIdObservers["delete"](clientId);
|
|
9158
|
+
// Removing topics that are not listen by an observer
|
|
9685
9159
|
topicsToDelete_1.forEach(function (topic) {
|
|
9686
9160
|
_this._topicObservers["delete"](topic);
|
|
9687
9161
|
});
|
|
9688
9162
|
}
|
|
9689
9163
|
};
|
|
9690
|
-
|
|
9691
9164
|
MqttOverWSProvider.prototype.newClient = function (_a) {
|
|
9692
9165
|
var url = _a.url,
|
|
9693
|
-
|
|
9166
|
+
clientId = _a.clientId;
|
|
9694
9167
|
return __awaiter(this, void 0, void 0, function () {
|
|
9695
9168
|
var client;
|
|
9696
|
-
|
|
9697
9169
|
var _this = this;
|
|
9698
|
-
|
|
9699
9170
|
return __generator(this, function (_b) {
|
|
9700
9171
|
switch (_b.label) {
|
|
9701
9172
|
case 0:
|
|
9702
9173
|
logger.debug('Creating new MQTT client', clientId);
|
|
9703
9174
|
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].OPENING_CONNECTION);
|
|
9704
|
-
client = new paho_mqtt__WEBPACK_IMPORTED_MODULE_0__["Client"](url, clientId);
|
|
9705
|
-
|
|
9175
|
+
client = new paho_mqtt__WEBPACK_IMPORTED_MODULE_0__["Client"](url, clientId);
|
|
9176
|
+
// client.trace = (args) => logger.debug(clientId, JSON.stringify(args, null, 2));
|
|
9706
9177
|
client.onMessageArrived = function (_a) {
|
|
9707
9178
|
var topic = _a.destinationName,
|
|
9708
|
-
|
|
9709
|
-
|
|
9179
|
+
msg = _a.payloadString;
|
|
9710
9180
|
_this._onMessage(topic, msg);
|
|
9711
9181
|
};
|
|
9712
|
-
|
|
9713
9182
|
client.onConnectionLost = function (_a) {
|
|
9714
9183
|
var errorCode = _a.errorCode,
|
|
9715
|
-
|
|
9716
|
-
|
|
9184
|
+
args = __rest(_a, ["errorCode"]);
|
|
9717
9185
|
_this.onDisconnect(__assign({
|
|
9718
9186
|
clientId: clientId,
|
|
9719
9187
|
errorCode: errorCode
|
|
9720
9188
|
}, args));
|
|
9721
|
-
|
|
9722
9189
|
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CLOSED);
|
|
9723
9190
|
};
|
|
9724
|
-
|
|
9725
|
-
return [4
|
|
9726
|
-
/*yield*/
|
|
9727
|
-
, new Promise(function (resolve, reject) {
|
|
9191
|
+
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
9728
9192
|
client.connect({
|
|
9729
9193
|
useSSL: _this.isSSLEnabled,
|
|
9730
9194
|
mqttVersion: 3,
|
|
@@ -9733,74 +9197,53 @@ function (_super) {
|
|
|
9733
9197
|
},
|
|
9734
9198
|
onFailure: function onFailure() {
|
|
9735
9199
|
reject();
|
|
9736
|
-
|
|
9737
9200
|
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CONNECTION_FAILED);
|
|
9738
9201
|
}
|
|
9739
9202
|
});
|
|
9740
9203
|
})];
|
|
9741
|
-
|
|
9742
9204
|
case 1:
|
|
9743
9205
|
_b.sent();
|
|
9744
|
-
|
|
9745
9206
|
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CONNECTION_ESTABLISHED);
|
|
9746
|
-
return [2
|
|
9747
|
-
/*return*/
|
|
9748
|
-
, client];
|
|
9207
|
+
return [2 /*return*/, client];
|
|
9749
9208
|
}
|
|
9750
9209
|
});
|
|
9751
9210
|
});
|
|
9752
9211
|
};
|
|
9753
|
-
|
|
9754
9212
|
MqttOverWSProvider.prototype.connect = function (clientId, options) {
|
|
9755
9213
|
if (options === void 0) {
|
|
9756
9214
|
options = {};
|
|
9757
9215
|
}
|
|
9758
|
-
|
|
9759
9216
|
return __awaiter(this, void 0, void 0, function () {
|
|
9760
9217
|
var _this = this;
|
|
9761
|
-
|
|
9762
9218
|
return __generator(this, function (_a) {
|
|
9763
9219
|
switch (_a.label) {
|
|
9764
9220
|
case 0:
|
|
9765
|
-
return [4
|
|
9766
|
-
/*yield*/
|
|
9767
|
-
, this.clientsQueue.get(clientId, function (clientId) {
|
|
9221
|
+
return [4 /*yield*/, this.clientsQueue.get(clientId, function (clientId) {
|
|
9768
9222
|
return _this.newClient(__assign(__assign({}, options), {
|
|
9769
9223
|
clientId: clientId
|
|
9770
9224
|
}));
|
|
9771
9225
|
})];
|
|
9772
|
-
|
|
9773
9226
|
case 1:
|
|
9774
|
-
return [2
|
|
9775
|
-
/*return*/
|
|
9776
|
-
, _a.sent()];
|
|
9227
|
+
return [2 /*return*/, _a.sent()];
|
|
9777
9228
|
}
|
|
9778
9229
|
});
|
|
9779
9230
|
});
|
|
9780
9231
|
};
|
|
9781
|
-
|
|
9782
9232
|
MqttOverWSProvider.prototype.disconnect = function (clientId) {
|
|
9783
9233
|
return __awaiter(this, void 0, void 0, function () {
|
|
9784
9234
|
var client;
|
|
9785
9235
|
return __generator(this, function (_a) {
|
|
9786
9236
|
switch (_a.label) {
|
|
9787
9237
|
case 0:
|
|
9788
|
-
return [4
|
|
9789
|
-
/*yield*/
|
|
9790
|
-
, this.clientsQueue.get(clientId)];
|
|
9791
|
-
|
|
9238
|
+
return [4 /*yield*/, this.clientsQueue.get(clientId)];
|
|
9792
9239
|
case 1:
|
|
9793
9240
|
client = _a.sent();
|
|
9794
|
-
|
|
9795
9241
|
if (client && client.isConnected()) {
|
|
9796
9242
|
client.disconnect();
|
|
9797
9243
|
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CLOSED);
|
|
9798
9244
|
}
|
|
9799
|
-
|
|
9800
9245
|
this.clientsQueue.remove(clientId);
|
|
9801
|
-
return [2
|
|
9802
|
-
/*return*/
|
|
9803
|
-
];
|
|
9246
|
+
return [2 /*return*/];
|
|
9804
9247
|
}
|
|
9805
9248
|
});
|
|
9806
9249
|
});
|
|
@@ -9814,27 +9257,19 @@ function (_super) {
|
|
|
9814
9257
|
case 0:
|
|
9815
9258
|
targetTopics = [].concat(topics);
|
|
9816
9259
|
message = JSON.stringify(msg);
|
|
9817
|
-
return [4
|
|
9818
|
-
/*yield*/
|
|
9819
|
-
, this.endpoint];
|
|
9820
|
-
|
|
9260
|
+
return [4 /*yield*/, this.endpoint];
|
|
9821
9261
|
case 1:
|
|
9822
9262
|
url = _a.sent();
|
|
9823
|
-
return [4
|
|
9824
|
-
/*yield*/
|
|
9825
|
-
, this.connect(this.clientId, {
|
|
9263
|
+
return [4 /*yield*/, this.connect(this.clientId, {
|
|
9826
9264
|
url: url
|
|
9827
9265
|
})];
|
|
9828
|
-
|
|
9829
9266
|
case 2:
|
|
9830
9267
|
client = _a.sent();
|
|
9831
9268
|
logger.debug('Publishing to topic(s)', targetTopics.join(','), message);
|
|
9832
9269
|
targetTopics.forEach(function (topic) {
|
|
9833
9270
|
return client.send(topic, message);
|
|
9834
9271
|
});
|
|
9835
|
-
return [2
|
|
9836
|
-
/*return*/
|
|
9837
|
-
];
|
|
9272
|
+
return [2 /*return*/];
|
|
9838
9273
|
}
|
|
9839
9274
|
});
|
|
9840
9275
|
});
|
|
@@ -9843,19 +9278,15 @@ function (_super) {
|
|
|
9843
9278
|
MqttOverWSProvider.prototype._onMessage = function (topic, msg) {
|
|
9844
9279
|
try {
|
|
9845
9280
|
var matchedTopicObservers_1 = [];
|
|
9846
|
-
|
|
9847
9281
|
this._topicObservers.forEach(function (observerForTopic, observerTopic) {
|
|
9848
9282
|
if (mqttTopicMatch(observerTopic, topic)) {
|
|
9849
9283
|
matchedTopicObservers_1.push(observerForTopic);
|
|
9850
9284
|
}
|
|
9851
9285
|
});
|
|
9852
|
-
|
|
9853
9286
|
var parsedMessage_1 = JSON.parse(msg);
|
|
9854
|
-
|
|
9855
9287
|
if (_typeof(parsedMessage_1) === 'object') {
|
|
9856
9288
|
parsedMessage_1[topicSymbol] = topic;
|
|
9857
9289
|
}
|
|
9858
|
-
|
|
9859
9290
|
matchedTopicObservers_1.forEach(function (observersForTopic) {
|
|
9860
9291
|
observersForTopic.forEach(function (observer) {
|
|
9861
9292
|
return observer.next(parsedMessage_1);
|
|
@@ -9865,102 +9296,69 @@ function (_super) {
|
|
|
9865
9296
|
logger.warn('Error handling message', error, msg);
|
|
9866
9297
|
}
|
|
9867
9298
|
};
|
|
9868
|
-
|
|
9869
9299
|
MqttOverWSProvider.prototype.subscribe = function (topics, options) {
|
|
9870
9300
|
var _this = this;
|
|
9871
|
-
|
|
9872
9301
|
if (options === void 0) {
|
|
9873
9302
|
options = {};
|
|
9874
9303
|
}
|
|
9875
|
-
|
|
9876
9304
|
var targetTopics = [].concat(topics);
|
|
9877
9305
|
logger.debug('Subscribing to topic(s)', targetTopics.join(','));
|
|
9878
9306
|
return new zen_observable_ts__WEBPACK_IMPORTED_MODULE_2__["default"](function (observer) {
|
|
9879
9307
|
targetTopics.forEach(function (topic) {
|
|
9880
9308
|
// this._topicObservers is used to notify the observers according to the topic received on the message
|
|
9881
9309
|
var observersForTopic = _this._topicObservers.get(topic);
|
|
9882
|
-
|
|
9883
9310
|
if (!observersForTopic) {
|
|
9884
9311
|
observersForTopic = new Set();
|
|
9885
|
-
|
|
9886
9312
|
_this._topicObservers.set(topic, observersForTopic);
|
|
9887
9313
|
}
|
|
9888
|
-
|
|
9889
9314
|
observersForTopic.add(observer);
|
|
9890
|
-
});
|
|
9891
|
-
|
|
9315
|
+
});
|
|
9316
|
+
// @ts-ignore
|
|
9892
9317
|
var client;
|
|
9893
9318
|
var _a = options.clientId,
|
|
9894
|
-
|
|
9895
|
-
|
|
9319
|
+
clientId = _a === void 0 ? _this.clientId : _a;
|
|
9320
|
+
// this._clientIdObservers is used to close observers when client gets disconnected
|
|
9896
9321
|
var observersForClientId = _this._clientIdObservers.get(clientId);
|
|
9897
|
-
|
|
9898
9322
|
if (!observersForClientId) {
|
|
9899
9323
|
observersForClientId = new Set();
|
|
9900
9324
|
}
|
|
9901
|
-
|
|
9902
9325
|
observersForClientId.add(observer);
|
|
9903
|
-
|
|
9904
9326
|
_this._clientIdObservers.set(clientId, observersForClientId);
|
|
9905
|
-
|
|
9906
9327
|
(function () {
|
|
9907
9328
|
return __awaiter(_this, void 0, void 0, function () {
|
|
9908
9329
|
var _a, url, _b, e_1;
|
|
9909
|
-
|
|
9910
9330
|
return __generator(this, function (_c) {
|
|
9911
9331
|
switch (_c.label) {
|
|
9912
9332
|
case 0:
|
|
9913
9333
|
_a = options.url;
|
|
9914
|
-
if (!(_a === void 0)) return [3
|
|
9915
|
-
/*
|
|
9916
|
-
, 2];
|
|
9917
|
-
return [4
|
|
9918
|
-
/*yield*/
|
|
9919
|
-
, this.endpoint];
|
|
9920
|
-
|
|
9334
|
+
if (!(_a === void 0)) return [3 /*break*/, 2];
|
|
9335
|
+
return [4 /*yield*/, this.endpoint];
|
|
9921
9336
|
case 1:
|
|
9922
9337
|
_b = _c.sent();
|
|
9923
|
-
return [3
|
|
9924
|
-
/*break*/
|
|
9925
|
-
, 3];
|
|
9926
|
-
|
|
9338
|
+
return [3 /*break*/, 3];
|
|
9927
9339
|
case 2:
|
|
9928
9340
|
_b = _a;
|
|
9929
9341
|
_c.label = 3;
|
|
9930
|
-
|
|
9931
9342
|
case 3:
|
|
9932
9343
|
url = _b;
|
|
9933
9344
|
_c.label = 4;
|
|
9934
|
-
|
|
9935
9345
|
case 4:
|
|
9936
9346
|
_c.trys.push([4, 6,, 7]);
|
|
9937
|
-
|
|
9938
|
-
return [4
|
|
9939
|
-
/*yield*/
|
|
9940
|
-
, this.connect(clientId, {
|
|
9347
|
+
return [4 /*yield*/, this.connect(clientId, {
|
|
9941
9348
|
url: url
|
|
9942
9349
|
})];
|
|
9943
|
-
|
|
9944
9350
|
case 5:
|
|
9945
9351
|
client = _c.sent();
|
|
9946
9352
|
targetTopics.forEach(function (topic) {
|
|
9947
9353
|
client.subscribe(topic);
|
|
9948
9354
|
});
|
|
9949
|
-
return [3
|
|
9950
|
-
/*break*/
|
|
9951
|
-
, 7];
|
|
9952
|
-
|
|
9355
|
+
return [3 /*break*/, 7];
|
|
9953
9356
|
case 6:
|
|
9954
9357
|
e_1 = _c.sent();
|
|
9955
9358
|
observer.error(e_1);
|
|
9956
|
-
return [3
|
|
9957
|
-
/*break*/
|
|
9958
|
-
, 7];
|
|
9959
|
-
|
|
9359
|
+
return [3 /*break*/, 7];
|
|
9960
9360
|
case 7:
|
|
9961
|
-
return [2
|
|
9962
|
-
/*return*/
|
|
9963
|
-
];
|
|
9361
|
+
return [2 /*return*/];
|
|
9964
9362
|
}
|
|
9965
9363
|
});
|
|
9966
9364
|
});
|
|
@@ -9968,44 +9366,35 @@ function (_super) {
|
|
|
9968
9366
|
|
|
9969
9367
|
return function () {
|
|
9970
9368
|
var _a, _b;
|
|
9971
|
-
|
|
9972
9369
|
logger.debug('Unsubscribing from topic(s)', targetTopics.join(','));
|
|
9973
|
-
|
|
9974
9370
|
if (client) {
|
|
9975
|
-
(_a = _this._clientIdObservers.get(clientId)) === null || _a === void 0 ? void 0 : _a["delete"](observer);
|
|
9976
|
-
|
|
9371
|
+
(_a = _this._clientIdObservers.get(clientId)) === null || _a === void 0 ? void 0 : _a["delete"](observer);
|
|
9372
|
+
// No more observers per client => client not needed anymore
|
|
9977
9373
|
if (((_b = _this._clientIdObservers.get(clientId)) === null || _b === void 0 ? void 0 : _b.size) === 0) {
|
|
9978
9374
|
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CLOSING_CONNECTION);
|
|
9979
|
-
|
|
9980
9375
|
_this.disconnect(clientId);
|
|
9981
|
-
|
|
9982
9376
|
_this._clientIdObservers["delete"](clientId);
|
|
9983
9377
|
}
|
|
9984
|
-
|
|
9985
9378
|
targetTopics.forEach(function (topic) {
|
|
9986
9379
|
var observersForTopic = _this._topicObservers.get(topic) || new Set();
|
|
9987
|
-
observersForTopic["delete"](observer);
|
|
9988
|
-
|
|
9380
|
+
observersForTopic["delete"](observer);
|
|
9381
|
+
// if no observers exists for the topic, topic should be removed
|
|
9989
9382
|
if (observersForTopic.size === 0) {
|
|
9990
9383
|
_this._topicObservers["delete"](topic);
|
|
9991
|
-
|
|
9992
9384
|
if (client.isConnected()) {
|
|
9993
9385
|
client.unsubscribe(topic);
|
|
9994
9386
|
}
|
|
9995
9387
|
}
|
|
9996
9388
|
});
|
|
9997
9389
|
}
|
|
9998
|
-
|
|
9999
9390
|
return null;
|
|
10000
9391
|
};
|
|
10001
9392
|
});
|
|
10002
9393
|
};
|
|
10003
|
-
|
|
10004
9394
|
return MqttOverWSProvider;
|
|
10005
9395
|
}(_PubSubProvider__WEBPACK_IMPORTED_MODULE_3__["AbstractPubSubProvider"]);
|
|
10006
9396
|
|
|
10007
9397
|
|
|
10008
|
-
|
|
10009
9398
|
/***/ }),
|
|
10010
9399
|
|
|
10011
9400
|
/***/ "./lib-esm/Providers/PubSubProvider.js":
|
|
@@ -10024,46 +9413,34 @@ var __assign = undefined && undefined.__assign || function () {
|
|
|
10024
9413
|
__assign = Object.assign || function (t) {
|
|
10025
9414
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
10026
9415
|
s = arguments[i];
|
|
10027
|
-
|
|
10028
9416
|
for (var p in s) {
|
|
10029
9417
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
10030
9418
|
}
|
|
10031
9419
|
}
|
|
10032
|
-
|
|
10033
9420
|
return t;
|
|
10034
9421
|
};
|
|
10035
|
-
|
|
10036
9422
|
return __assign.apply(this, arguments);
|
|
10037
9423
|
};
|
|
10038
9424
|
|
|
10039
|
-
|
|
10040
9425
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["ConsoleLogger"]('AbstractPubSubProvider');
|
|
10041
|
-
|
|
10042
|
-
var AbstractPubSubProvider =
|
|
10043
|
-
/** @class */
|
|
10044
|
-
function () {
|
|
9426
|
+
var AbstractPubSubProvider = /** @class */function () {
|
|
10045
9427
|
function AbstractPubSubProvider(options) {
|
|
10046
9428
|
if (options === void 0) {
|
|
10047
9429
|
options = {};
|
|
10048
9430
|
}
|
|
10049
|
-
|
|
10050
9431
|
this._config = options;
|
|
10051
9432
|
}
|
|
10052
|
-
|
|
10053
9433
|
AbstractPubSubProvider.prototype.configure = function (config) {
|
|
10054
9434
|
if (config === void 0) {
|
|
10055
9435
|
config = {};
|
|
10056
9436
|
}
|
|
10057
|
-
|
|
10058
9437
|
this._config = __assign(__assign({}, config), this._config);
|
|
10059
9438
|
logger.debug("configure " + this.getProviderName(), this._config);
|
|
10060
9439
|
return this.options;
|
|
10061
9440
|
};
|
|
10062
|
-
|
|
10063
9441
|
AbstractPubSubProvider.prototype.getCategory = function () {
|
|
10064
9442
|
return 'PubSub';
|
|
10065
9443
|
};
|
|
10066
|
-
|
|
10067
9444
|
Object.defineProperty(AbstractPubSubProvider.prototype, "options", {
|
|
10068
9445
|
get: function get() {
|
|
10069
9446
|
return __assign({}, this._config);
|
|
@@ -10075,7 +9452,6 @@ function () {
|
|
|
10075
9452
|
}();
|
|
10076
9453
|
|
|
10077
9454
|
|
|
10078
|
-
|
|
10079
9455
|
/***/ }),
|
|
10080
9456
|
|
|
10081
9457
|
/***/ "./lib-esm/Providers/constants.js":
|
|
@@ -10103,7 +9479,6 @@ var MAX_DELAY_MS = 5000;
|
|
|
10103
9479
|
var NON_RETRYABLE_CODES = [400, 401, 403];
|
|
10104
9480
|
var CONNECTION_STATE_CHANGE = 'ConnectionStateChange';
|
|
10105
9481
|
var MESSAGE_TYPES;
|
|
10106
|
-
|
|
10107
9482
|
(function (MESSAGE_TYPES) {
|
|
10108
9483
|
/**
|
|
10109
9484
|
* Client -> Server message.
|
|
@@ -10114,74 +9489,60 @@ var MESSAGE_TYPES;
|
|
|
10114
9489
|
* Server -> Client message
|
|
10115
9490
|
* This message type is in case there is an issue with AWS AppSync RealTime when establishing connection
|
|
10116
9491
|
*/
|
|
10117
|
-
|
|
10118
9492
|
MESSAGE_TYPES["GQL_CONNECTION_ERROR"] = "connection_error";
|
|
10119
9493
|
/**
|
|
10120
9494
|
* Server -> Client message.
|
|
10121
9495
|
* This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message
|
|
10122
9496
|
*/
|
|
10123
|
-
|
|
10124
9497
|
MESSAGE_TYPES["GQL_CONNECTION_ACK"] = "connection_ack";
|
|
10125
9498
|
/**
|
|
10126
9499
|
* Client -> Server message.
|
|
10127
9500
|
* This message type is for register subscriptions with AWS AppSync RealTime
|
|
10128
9501
|
*/
|
|
10129
|
-
|
|
10130
9502
|
MESSAGE_TYPES["GQL_START"] = "start";
|
|
10131
9503
|
/**
|
|
10132
9504
|
* Server -> Client message.
|
|
10133
9505
|
* This message type is for the ack response from AWS AppSync RealTime for GQL_START message
|
|
10134
9506
|
*/
|
|
10135
|
-
|
|
10136
9507
|
MESSAGE_TYPES["GQL_START_ACK"] = "start_ack";
|
|
10137
9508
|
/**
|
|
10138
9509
|
* Server -> Client message.
|
|
10139
9510
|
* This message type is for subscription message from AWS AppSync RealTime
|
|
10140
9511
|
*/
|
|
10141
|
-
|
|
10142
9512
|
MESSAGE_TYPES["GQL_DATA"] = "data";
|
|
10143
9513
|
/**
|
|
10144
9514
|
* Server -> Client message.
|
|
10145
9515
|
* This message type helps the client to know is still receiving messages from AWS AppSync RealTime
|
|
10146
9516
|
*/
|
|
10147
|
-
|
|
10148
9517
|
MESSAGE_TYPES["GQL_CONNECTION_KEEP_ALIVE"] = "ka";
|
|
10149
9518
|
/**
|
|
10150
9519
|
* Client -> Server message.
|
|
10151
9520
|
* This message type is for unregister subscriptions with AWS AppSync RealTime
|
|
10152
9521
|
*/
|
|
10153
|
-
|
|
10154
9522
|
MESSAGE_TYPES["GQL_STOP"] = "stop";
|
|
10155
9523
|
/**
|
|
10156
9524
|
* Server -> Client message.
|
|
10157
9525
|
* This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message
|
|
10158
9526
|
*/
|
|
10159
|
-
|
|
10160
9527
|
MESSAGE_TYPES["GQL_COMPLETE"] = "complete";
|
|
10161
9528
|
/**
|
|
10162
9529
|
* Server -> Client message.
|
|
10163
9530
|
* This message type is for sending error messages from AWS AppSync RealTime to the client
|
|
10164
9531
|
*/
|
|
10165
|
-
|
|
10166
9532
|
MESSAGE_TYPES["GQL_ERROR"] = "error";
|
|
10167
9533
|
})(MESSAGE_TYPES || (MESSAGE_TYPES = {}));
|
|
10168
|
-
|
|
10169
9534
|
var SUBSCRIPTION_STATUS;
|
|
10170
|
-
|
|
10171
9535
|
(function (SUBSCRIPTION_STATUS) {
|
|
10172
9536
|
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["PENDING"] = 0] = "PENDING";
|
|
10173
9537
|
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["CONNECTED"] = 1] = "CONNECTED";
|
|
10174
9538
|
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["FAILED"] = 2] = "FAILED";
|
|
10175
9539
|
})(SUBSCRIPTION_STATUS || (SUBSCRIPTION_STATUS = {}));
|
|
10176
|
-
|
|
10177
9540
|
var SOCKET_STATUS;
|
|
10178
|
-
|
|
10179
9541
|
(function (SOCKET_STATUS) {
|
|
10180
9542
|
SOCKET_STATUS[SOCKET_STATUS["CLOSED"] = 0] = "CLOSED";
|
|
10181
9543
|
SOCKET_STATUS[SOCKET_STATUS["READY"] = 1] = "READY";
|
|
10182
9544
|
SOCKET_STATUS[SOCKET_STATUS["CONNECTING"] = 2] = "CONNECTING";
|
|
10183
9545
|
})(SOCKET_STATUS || (SOCKET_STATUS = {}));
|
|
10184
|
-
|
|
10185
9546
|
var AMPLIFY_SYMBOL = typeof Symbol !== 'undefined' && typeof Symbol["for"] === 'function' ? Symbol["for"]('amplify_default') : '@@amplify_default';
|
|
10186
9547
|
var AWS_APPSYNC_REALTIME_HEADERS = {
|
|
10187
9548
|
accept: 'application/json, text/javascript',
|
|
@@ -10191,22 +9552,18 @@ var AWS_APPSYNC_REALTIME_HEADERS = {
|
|
|
10191
9552
|
/**
|
|
10192
9553
|
* Time in milleseconds to wait for GQL_CONNECTION_INIT message
|
|
10193
9554
|
*/
|
|
10194
|
-
|
|
10195
9555
|
var CONNECTION_INIT_TIMEOUT = 15000;
|
|
10196
9556
|
/**
|
|
10197
9557
|
* Time in milleseconds to wait for GQL_START_ACK message
|
|
10198
9558
|
*/
|
|
10199
|
-
|
|
10200
9559
|
var START_ACK_TIMEOUT = 15000;
|
|
10201
9560
|
/**
|
|
10202
9561
|
* Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message
|
|
10203
9562
|
*/
|
|
10204
|
-
|
|
10205
9563
|
var DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;
|
|
10206
9564
|
/**
|
|
10207
9565
|
* Default Time in milleseconds to alert for missed GQL_CONNECTION_KEEP_ALIVE message
|
|
10208
9566
|
*/
|
|
10209
|
-
|
|
10210
9567
|
var DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT = 65 * 1000;
|
|
10211
9568
|
|
|
10212
9569
|
/***/ }),
|
|
@@ -10278,7 +9635,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
10278
9635
|
resolve(value);
|
|
10279
9636
|
});
|
|
10280
9637
|
}
|
|
10281
|
-
|
|
10282
9638
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10283
9639
|
function fulfilled(value) {
|
|
10284
9640
|
try {
|
|
@@ -10287,7 +9643,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
10287
9643
|
reject(e);
|
|
10288
9644
|
}
|
|
10289
9645
|
}
|
|
10290
|
-
|
|
10291
9646
|
function rejected(value) {
|
|
10292
9647
|
try {
|
|
10293
9648
|
step(generator["throw"](value));
|
|
@@ -10295,29 +9650,26 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
|
|
|
10295
9650
|
reject(e);
|
|
10296
9651
|
}
|
|
10297
9652
|
}
|
|
10298
|
-
|
|
10299
9653
|
function step(result) {
|
|
10300
9654
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
10301
9655
|
}
|
|
10302
|
-
|
|
10303
9656
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10304
9657
|
});
|
|
10305
9658
|
};
|
|
10306
|
-
|
|
10307
9659
|
var __generator = undefined && undefined.__generator || function (thisArg, body) {
|
|
10308
9660
|
var _ = {
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
9661
|
+
label: 0,
|
|
9662
|
+
sent: function sent() {
|
|
9663
|
+
if (t[0] & 1) throw t[1];
|
|
9664
|
+
return t[1];
|
|
9665
|
+
},
|
|
9666
|
+
trys: [],
|
|
9667
|
+
ops: []
|
|
10313
9668
|
},
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
y,
|
|
10319
|
-
t,
|
|
10320
|
-
g;
|
|
9669
|
+
f,
|
|
9670
|
+
y,
|
|
9671
|
+
t,
|
|
9672
|
+
g;
|
|
10321
9673
|
return g = {
|
|
10322
9674
|
next: verb(0),
|
|
10323
9675
|
"throw": verb(1),
|
|
@@ -10325,79 +9677,60 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
10325
9677
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
10326
9678
|
return this;
|
|
10327
9679
|
}), g;
|
|
10328
|
-
|
|
10329
9680
|
function verb(n) {
|
|
10330
9681
|
return function (v) {
|
|
10331
9682
|
return step([n, v]);
|
|
10332
9683
|
};
|
|
10333
9684
|
}
|
|
10334
|
-
|
|
10335
9685
|
function step(op) {
|
|
10336
9686
|
if (f) throw new TypeError("Generator is already executing.");
|
|
10337
|
-
|
|
10338
9687
|
while (_) {
|
|
10339
9688
|
try {
|
|
10340
9689
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
10341
9690
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
10342
|
-
|
|
10343
9691
|
switch (op[0]) {
|
|
10344
9692
|
case 0:
|
|
10345
9693
|
case 1:
|
|
10346
9694
|
t = op;
|
|
10347
9695
|
break;
|
|
10348
|
-
|
|
10349
9696
|
case 4:
|
|
10350
9697
|
_.label++;
|
|
10351
9698
|
return {
|
|
10352
9699
|
value: op[1],
|
|
10353
9700
|
done: false
|
|
10354
9701
|
};
|
|
10355
|
-
|
|
10356
9702
|
case 5:
|
|
10357
9703
|
_.label++;
|
|
10358
9704
|
y = op[1];
|
|
10359
9705
|
op = [0];
|
|
10360
9706
|
continue;
|
|
10361
|
-
|
|
10362
9707
|
case 7:
|
|
10363
9708
|
op = _.ops.pop();
|
|
10364
|
-
|
|
10365
9709
|
_.trys.pop();
|
|
10366
|
-
|
|
10367
9710
|
continue;
|
|
10368
|
-
|
|
10369
9711
|
default:
|
|
10370
9712
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
10371
9713
|
_ = 0;
|
|
10372
9714
|
continue;
|
|
10373
9715
|
}
|
|
10374
|
-
|
|
10375
9716
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
10376
9717
|
_.label = op[1];
|
|
10377
9718
|
break;
|
|
10378
9719
|
}
|
|
10379
|
-
|
|
10380
9720
|
if (op[0] === 6 && _.label < t[1]) {
|
|
10381
9721
|
_.label = t[1];
|
|
10382
9722
|
t = op;
|
|
10383
9723
|
break;
|
|
10384
9724
|
}
|
|
10385
|
-
|
|
10386
9725
|
if (t && _.label < t[2]) {
|
|
10387
9726
|
_.label = t[2];
|
|
10388
|
-
|
|
10389
9727
|
_.ops.push(op);
|
|
10390
|
-
|
|
10391
9728
|
break;
|
|
10392
9729
|
}
|
|
10393
|
-
|
|
10394
9730
|
if (t[2]) _.ops.pop();
|
|
10395
|
-
|
|
10396
9731
|
_.trys.pop();
|
|
10397
|
-
|
|
10398
9732
|
continue;
|
|
10399
9733
|
}
|
|
10400
|
-
|
|
10401
9734
|
op = body.call(thisArg, _);
|
|
10402
9735
|
} catch (e) {
|
|
10403
9736
|
op = [6, e];
|
|
@@ -10406,7 +9739,6 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
10406
9739
|
f = t = 0;
|
|
10407
9740
|
}
|
|
10408
9741
|
}
|
|
10409
|
-
|
|
10410
9742
|
if (op[0] & 5) throw op[1];
|
|
10411
9743
|
return {
|
|
10412
9744
|
value: op[0] ? op[1] : void 0,
|
|
@@ -10430,14 +9762,9 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
|
|
|
10430
9762
|
|
|
10431
9763
|
|
|
10432
9764
|
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
9765
|
var isNode = Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["browserOrNode"])().isNode;
|
|
10436
9766
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["ConsoleLogger"]('PubSub');
|
|
10437
|
-
|
|
10438
|
-
var PubSubClass =
|
|
10439
|
-
/** @class */
|
|
10440
|
-
function () {
|
|
9767
|
+
var PubSubClass = /** @class */function () {
|
|
10441
9768
|
/**
|
|
10442
9769
|
* Initialize PubSub with AWS configurations
|
|
10443
9770
|
*
|
|
@@ -10449,7 +9776,6 @@ function () {
|
|
|
10449
9776
|
this._pluggables = [];
|
|
10450
9777
|
this.subscribe = this.subscribe.bind(this);
|
|
10451
9778
|
}
|
|
10452
|
-
|
|
10453
9779
|
Object.defineProperty(PubSubClass.prototype, "awsAppSyncProvider", {
|
|
10454
9780
|
/**
|
|
10455
9781
|
* Lazy instantiate AWSAppSyncProvider when it is required by the API category
|
|
@@ -10458,7 +9784,6 @@ function () {
|
|
|
10458
9784
|
if (!this._awsAppSyncProvider) {
|
|
10459
9785
|
this._awsAppSyncProvider = new _Providers__WEBPACK_IMPORTED_MODULE_2__["AWSAppSyncProvider"](this._options);
|
|
10460
9786
|
}
|
|
10461
|
-
|
|
10462
9787
|
return this._awsAppSyncProvider;
|
|
10463
9788
|
},
|
|
10464
9789
|
enumerable: true,
|
|
@@ -10472,13 +9797,11 @@ function () {
|
|
|
10472
9797
|
if (!this._awsAppSyncRealTimeProvider) {
|
|
10473
9798
|
this._awsAppSyncRealTimeProvider = new _Providers__WEBPACK_IMPORTED_MODULE_2__["AWSAppSyncRealTimeProvider"](this._options);
|
|
10474
9799
|
}
|
|
10475
|
-
|
|
10476
9800
|
return this._awsAppSyncRealTimeProvider;
|
|
10477
9801
|
},
|
|
10478
9802
|
enumerable: true,
|
|
10479
9803
|
configurable: true
|
|
10480
9804
|
});
|
|
10481
|
-
|
|
10482
9805
|
PubSubClass.prototype.getModuleName = function () {
|
|
10483
9806
|
return 'PubSub';
|
|
10484
9807
|
};
|
|
@@ -10488,45 +9811,32 @@ function () {
|
|
|
10488
9811
|
* @param {PubSubOptions} config - Configuration for PubSub
|
|
10489
9812
|
* @return {Object} - The current configuration
|
|
10490
9813
|
*/
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
9814
|
PubSubClass.prototype.configure = function (options) {
|
|
10494
9815
|
var _this = this;
|
|
10495
|
-
|
|
10496
9816
|
var opt = options ? options.PubSub || options : {};
|
|
10497
9817
|
logger.debug('configure PubSub', {
|
|
10498
9818
|
opt: opt
|
|
10499
9819
|
});
|
|
10500
9820
|
this._options = Object.assign({}, this._options, opt);
|
|
10501
|
-
|
|
10502
9821
|
this._pluggables.map(function (pluggable) {
|
|
10503
9822
|
return pluggable.configure(_this._options);
|
|
10504
9823
|
});
|
|
10505
|
-
|
|
10506
9824
|
return this._options;
|
|
10507
9825
|
};
|
|
10508
9826
|
/**
|
|
10509
9827
|
* add plugin into Analytics category
|
|
10510
9828
|
* @param {Object} pluggable - an instance of the plugin
|
|
10511
9829
|
*/
|
|
10512
|
-
|
|
10513
|
-
|
|
10514
9830
|
PubSubClass.prototype.addPluggable = function (pluggable) {
|
|
10515
9831
|
return __awaiter(this, void 0, void 0, function () {
|
|
10516
9832
|
var config;
|
|
10517
9833
|
return __generator(this, function (_a) {
|
|
10518
9834
|
if (pluggable && pluggable.getCategory() === 'PubSub') {
|
|
10519
9835
|
this._pluggables.push(pluggable);
|
|
10520
|
-
|
|
10521
9836
|
config = pluggable.configure(this._options);
|
|
10522
|
-
return [2
|
|
10523
|
-
/*return*/
|
|
10524
|
-
, config];
|
|
9837
|
+
return [2 /*return*/, config];
|
|
10525
9838
|
}
|
|
10526
|
-
|
|
10527
|
-
return [2
|
|
10528
|
-
/*return*/
|
|
10529
|
-
];
|
|
9839
|
+
return [2 /*return*/];
|
|
10530
9840
|
});
|
|
10531
9841
|
});
|
|
10532
9842
|
};
|
|
@@ -10534,65 +9844,49 @@ function () {
|
|
|
10534
9844
|
* remove plugin from PubSub category
|
|
10535
9845
|
* @param providerName - the name of the plugin
|
|
10536
9846
|
*/
|
|
10537
|
-
|
|
10538
|
-
|
|
10539
9847
|
PubSubClass.prototype.removePluggable = function (providerName) {
|
|
10540
9848
|
this._pluggables = this._pluggables.filter(function (pluggable) {
|
|
10541
9849
|
return pluggable.getProviderName() !== providerName;
|
|
10542
9850
|
});
|
|
10543
9851
|
};
|
|
10544
|
-
|
|
10545
9852
|
PubSubClass.prototype.getProviderByName = function (providerName) {
|
|
10546
9853
|
if (providerName === _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER"]) {
|
|
10547
9854
|
return this.awsAppSyncProvider;
|
|
10548
9855
|
}
|
|
10549
|
-
|
|
10550
9856
|
if (providerName === _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER"]) {
|
|
10551
9857
|
return this.awsAppSyncRealTimeProvider;
|
|
10552
9858
|
}
|
|
10553
|
-
|
|
10554
9859
|
return this._pluggables.find(function (pluggable) {
|
|
10555
9860
|
return pluggable.getProviderName() === providerName;
|
|
10556
9861
|
});
|
|
10557
9862
|
};
|
|
10558
|
-
|
|
10559
9863
|
PubSubClass.prototype.getProviders = function (options) {
|
|
10560
9864
|
if (options === void 0) {
|
|
10561
9865
|
options = {};
|
|
10562
9866
|
}
|
|
10563
|
-
|
|
10564
9867
|
var providerName = options.provider;
|
|
10565
|
-
|
|
10566
9868
|
if (!providerName) {
|
|
10567
9869
|
return this._pluggables;
|
|
10568
9870
|
}
|
|
10569
|
-
|
|
10570
9871
|
var provider = this.getProviderByName(providerName);
|
|
10571
|
-
|
|
10572
9872
|
if (!provider) {
|
|
10573
9873
|
throw new Error("Could not find provider named " + providerName);
|
|
10574
9874
|
}
|
|
10575
|
-
|
|
10576
9875
|
return [provider];
|
|
10577
9876
|
};
|
|
10578
|
-
|
|
10579
9877
|
PubSubClass.prototype.publish = function (topics, msg, options) {
|
|
10580
9878
|
return __awaiter(this, void 0, void 0, function () {
|
|
10581
9879
|
return __generator(this, function (_a) {
|
|
10582
|
-
return [2
|
|
10583
|
-
/*return*/
|
|
10584
|
-
, Promise.all(this.getProviders(options).map(function (provider) {
|
|
9880
|
+
return [2 /*return*/, Promise.all(this.getProviders(options).map(function (provider) {
|
|
10585
9881
|
return provider.publish(topics, msg, options);
|
|
10586
9882
|
}))];
|
|
10587
9883
|
});
|
|
10588
9884
|
});
|
|
10589
9885
|
};
|
|
10590
|
-
|
|
10591
9886
|
PubSubClass.prototype.subscribe = function (topics, options) {
|
|
10592
9887
|
if (isNode && this._options && this._options.ssr) {
|
|
10593
9888
|
throw new Error('Subscriptions are not supported for Server-Side Rendering (SSR)');
|
|
10594
9889
|
}
|
|
10595
|
-
|
|
10596
9890
|
logger.debug('subscribe options', options);
|
|
10597
9891
|
var providers = this.getProviders(options);
|
|
10598
9892
|
return new zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"](function (observer) {
|
|
@@ -10604,7 +9898,7 @@ function () {
|
|
|
10604
9898
|
});
|
|
10605
9899
|
var subscriptions = observables.map(function (_a) {
|
|
10606
9900
|
var provider = _a.provider,
|
|
10607
|
-
|
|
9901
|
+
observable = _a.observable;
|
|
10608
9902
|
return observable.subscribe({
|
|
10609
9903
|
start: console.error,
|
|
10610
9904
|
next: function next(value) {
|
|
@@ -10628,11 +9922,9 @@ function () {
|
|
|
10628
9922
|
};
|
|
10629
9923
|
});
|
|
10630
9924
|
};
|
|
10631
|
-
|
|
10632
9925
|
return PubSubClass;
|
|
10633
9926
|
}();
|
|
10634
9927
|
|
|
10635
|
-
|
|
10636
9928
|
var PubSub = new PubSubClass();
|
|
10637
9929
|
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Amplify"].register(PubSub);
|
|
10638
9930
|
|
|
@@ -10691,7 +9983,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10691
9983
|
/**
|
|
10692
9984
|
* @deprecated use named import
|
|
10693
9985
|
*/
|
|
10694
|
-
|
|
10695
9986
|
/* harmony default export */ __webpack_exports__["default"] = (_PubSub__WEBPACK_IMPORTED_MODULE_0__["PubSub"]);
|
|
10696
9987
|
|
|
10697
9988
|
/***/ }),
|
|
@@ -10720,7 +10011,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10720
10011
|
* and limitations under the License.
|
|
10721
10012
|
*/
|
|
10722
10013
|
var CONTROL_MSG;
|
|
10723
|
-
|
|
10724
10014
|
(function (CONTROL_MSG) {
|
|
10725
10015
|
CONTROL_MSG["CONNECTION_CLOSED"] = "Connection closed";
|
|
10726
10016
|
CONTROL_MSG["CONNECTION_FAILED"] = "Connection failed";
|
|
@@ -10729,10 +10019,7 @@ var CONTROL_MSG;
|
|
|
10729
10019
|
CONTROL_MSG["TIMEOUT_DISCONNECT"] = "Timeout disconnect";
|
|
10730
10020
|
})(CONTROL_MSG || (CONTROL_MSG = {}));
|
|
10731
10021
|
/** @enum {string} */
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
10022
|
var ConnectionState;
|
|
10735
|
-
|
|
10736
10023
|
(function (ConnectionState) {
|
|
10737
10024
|
/*
|
|
10738
10025
|
* The connection is alive and healthy
|
|
@@ -10741,37 +10028,30 @@ var ConnectionState;
|
|
|
10741
10028
|
/*
|
|
10742
10029
|
* The connection is alive, but the connection is offline
|
|
10743
10030
|
*/
|
|
10744
|
-
|
|
10745
10031
|
ConnectionState["ConnectedPendingNetwork"] = "ConnectedPendingNetwork";
|
|
10746
10032
|
/*
|
|
10747
10033
|
* The connection has been disconnected while in use
|
|
10748
10034
|
*/
|
|
10749
|
-
|
|
10750
10035
|
ConnectionState["ConnectionDisrupted"] = "ConnectionDisrupted";
|
|
10751
10036
|
/*
|
|
10752
10037
|
* The connection has been disconnected and the network is offline
|
|
10753
10038
|
*/
|
|
10754
|
-
|
|
10755
10039
|
ConnectionState["ConnectionDisruptedPendingNetwork"] = "ConnectionDisruptedPendingNetwork";
|
|
10756
10040
|
/*
|
|
10757
10041
|
* The connection is in the process of connecting
|
|
10758
10042
|
*/
|
|
10759
|
-
|
|
10760
10043
|
ConnectionState["Connecting"] = "Connecting";
|
|
10761
10044
|
/*
|
|
10762
10045
|
* The connection is not in use and is being disconnected
|
|
10763
10046
|
*/
|
|
10764
|
-
|
|
10765
10047
|
ConnectionState["ConnectedPendingDisconnect"] = "ConnectedPendingDisconnect";
|
|
10766
10048
|
/*
|
|
10767
10049
|
* The connection is not in use and has been disconnected
|
|
10768
10050
|
*/
|
|
10769
|
-
|
|
10770
10051
|
ConnectionState["Disconnected"] = "Disconnected";
|
|
10771
10052
|
/*
|
|
10772
10053
|
* The connection is alive, but a keep alive message has been missed
|
|
10773
10054
|
*/
|
|
10774
|
-
|
|
10775
10055
|
ConnectionState["ConnectedPendingKeepAlive"] = "ConnectedPendingKeepAlive";
|
|
10776
10056
|
})(ConnectionState || (ConnectionState = {}));
|
|
10777
10057
|
|
|
@@ -10825,21 +10105,17 @@ var __assign = undefined && undefined.__assign || function () {
|
|
|
10825
10105
|
__assign = Object.assign || function (t) {
|
|
10826
10106
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
10827
10107
|
s = arguments[i];
|
|
10828
|
-
|
|
10829
10108
|
for (var p in s) {
|
|
10830
10109
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
10831
10110
|
}
|
|
10832
10111
|
}
|
|
10833
|
-
|
|
10834
10112
|
return t;
|
|
10835
10113
|
};
|
|
10836
|
-
|
|
10837
10114
|
return __assign.apply(this, arguments);
|
|
10838
10115
|
};
|
|
10839
10116
|
|
|
10840
10117
|
|
|
10841
10118
|
|
|
10842
|
-
|
|
10843
10119
|
var CONNECTION_CHANGE = {
|
|
10844
10120
|
KEEP_ALIVE_MISSED: {
|
|
10845
10121
|
keepAliveState: 'unhealthy'
|
|
@@ -10871,13 +10147,9 @@ var CONNECTION_CHANGE = {
|
|
|
10871
10147
|
networkState: 'disconnected'
|
|
10872
10148
|
}
|
|
10873
10149
|
};
|
|
10874
|
-
|
|
10875
|
-
var ConnectionStateMonitor =
|
|
10876
|
-
/** @class */
|
|
10877
|
-
function () {
|
|
10150
|
+
var ConnectionStateMonitor = /** @class */function () {
|
|
10878
10151
|
function ConnectionStateMonitor() {
|
|
10879
10152
|
var _this = this;
|
|
10880
|
-
|
|
10881
10153
|
this._networkMonitoringSubscription = undefined;
|
|
10882
10154
|
this._linkedConnectionState = {
|
|
10883
10155
|
networkState: 'connected',
|
|
@@ -10893,16 +10165,12 @@ function () {
|
|
|
10893
10165
|
/**
|
|
10894
10166
|
* Turn network state monitoring on if it isn't on already
|
|
10895
10167
|
*/
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
10168
|
ConnectionStateMonitor.prototype.enableNetworkMonitoring = function () {
|
|
10899
|
-
var _this = this;
|
|
10900
|
-
|
|
10901
|
-
|
|
10169
|
+
var _this = this;
|
|
10170
|
+
// Maintain the network state based on the reachability monitor
|
|
10902
10171
|
if (this._networkMonitoringSubscription === undefined) {
|
|
10903
10172
|
this._networkMonitoringSubscription = Object(_ReachabilityMonitor__WEBPACK_IMPORTED_MODULE_2__["ReachabilityMonitor"])().subscribe(function (_a) {
|
|
10904
10173
|
var online = _a.online;
|
|
10905
|
-
|
|
10906
10174
|
_this.record(online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE);
|
|
10907
10175
|
});
|
|
10908
10176
|
}
|
|
@@ -10910,15 +10178,11 @@ function () {
|
|
|
10910
10178
|
/**
|
|
10911
10179
|
* Turn network state monitoring off if it isn't off already
|
|
10912
10180
|
*/
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
10181
|
ConnectionStateMonitor.prototype.disableNetworkMonitoring = function () {
|
|
10916
10182
|
var _a;
|
|
10917
|
-
|
|
10918
10183
|
(_a = this._networkMonitoringSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
10919
10184
|
this._networkMonitoringSubscription = undefined;
|
|
10920
10185
|
};
|
|
10921
|
-
|
|
10922
10186
|
Object.defineProperty(ConnectionStateMonitor.prototype, "connectionStateObservable", {
|
|
10923
10187
|
/**
|
|
10924
10188
|
* Get the observable that allows us to monitor the connection state
|
|
@@ -10927,12 +10191,11 @@ function () {
|
|
|
10927
10191
|
*/
|
|
10928
10192
|
get: function get() {
|
|
10929
10193
|
var _this = this;
|
|
10930
|
-
|
|
10931
|
-
|
|
10194
|
+
var previous;
|
|
10195
|
+
// The linked state aggregates state changes to any of the network, connection,
|
|
10932
10196
|
// intendedConnection and keepAliveHealth. Some states will change these independent
|
|
10933
10197
|
// states without changing the overall connection state.
|
|
10934
10198
|
// After translating from linked states to ConnectionState, then remove any duplicates
|
|
10935
|
-
|
|
10936
10199
|
return this._linkedConnectionStateObservable.map(function (value) {
|
|
10937
10200
|
return _this.connectionStatesTranslator(value);
|
|
10938
10201
|
}).filter(function (current) {
|
|
@@ -10947,48 +10210,40 @@ function () {
|
|
|
10947
10210
|
/*
|
|
10948
10211
|
* Updates local connection state and emits the full state to the observer.
|
|
10949
10212
|
*/
|
|
10950
|
-
|
|
10951
10213
|
ConnectionStateMonitor.prototype.record = function (statusUpdates) {
|
|
10952
10214
|
// Maintain the network monitor
|
|
10953
10215
|
if (statusUpdates.intendedConnectionState === 'connected') {
|
|
10954
10216
|
this.enableNetworkMonitoring();
|
|
10955
10217
|
} else if (statusUpdates.intendedConnectionState === 'disconnected') {
|
|
10956
10218
|
this.disableNetworkMonitoring();
|
|
10957
|
-
}
|
|
10958
|
-
|
|
10959
|
-
|
|
10219
|
+
}
|
|
10220
|
+
// Maintain the socket state
|
|
10960
10221
|
var newSocketStatus = __assign(__assign({}, this._linkedConnectionState), statusUpdates);
|
|
10961
|
-
|
|
10962
10222
|
this._linkedConnectionState = __assign({}, newSocketStatus);
|
|
10963
|
-
|
|
10964
10223
|
this._linkedConnectionStateObserver.next(this._linkedConnectionState);
|
|
10965
10224
|
};
|
|
10966
10225
|
/*
|
|
10967
10226
|
* Translate the ConnectionState structure into a specific ConnectionState string literal union
|
|
10968
10227
|
*/
|
|
10969
|
-
|
|
10970
|
-
|
|
10971
10228
|
ConnectionStateMonitor.prototype.connectionStatesTranslator = function (_a) {
|
|
10972
10229
|
var connectionState = _a.connectionState,
|
|
10973
|
-
|
|
10974
|
-
|
|
10975
|
-
|
|
10230
|
+
networkState = _a.networkState,
|
|
10231
|
+
intendedConnectionState = _a.intendedConnectionState,
|
|
10232
|
+
keepAliveState = _a.keepAliveState;
|
|
10976
10233
|
if (connectionState === 'connected' && networkState === 'disconnected') return _types_PubSub__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].ConnectedPendingNetwork;
|
|
10977
10234
|
if (connectionState === 'connected' && intendedConnectionState === 'disconnected') return _types_PubSub__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].ConnectedPendingDisconnect;
|
|
10978
10235
|
if (connectionState === 'disconnected' && intendedConnectionState === 'connected' && networkState === 'disconnected') return _types_PubSub__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].ConnectionDisruptedPendingNetwork;
|
|
10979
10236
|
if (connectionState === 'disconnected' && intendedConnectionState === 'connected') return _types_PubSub__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].ConnectionDisrupted;
|
|
10980
|
-
if (connectionState === 'connected' && keepAliveState === 'unhealthy') return _types_PubSub__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].ConnectedPendingKeepAlive;
|
|
10981
|
-
|
|
10237
|
+
if (connectionState === 'connected' && keepAliveState === 'unhealthy') return _types_PubSub__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].ConnectedPendingKeepAlive;
|
|
10238
|
+
// All remaining states directly correspond to the connection state
|
|
10982
10239
|
if (connectionState === 'connecting') return _types_PubSub__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].Connecting;
|
|
10983
10240
|
if (connectionState === 'disconnected') return _types_PubSub__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].Disconnected;
|
|
10984
10241
|
return _types_PubSub__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].Connected;
|
|
10985
10242
|
};
|
|
10986
|
-
|
|
10987
10243
|
return ConnectionStateMonitor;
|
|
10988
10244
|
}();
|
|
10989
10245
|
|
|
10990
10246
|
|
|
10991
|
-
|
|
10992
10247
|
/***/ }),
|
|
10993
10248
|
|
|
10994
10249
|
/***/ "./lib-esm/utils/ReachabilityMonitor/index.js":
|