mqtt 5.3.1 → 5.3.3
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/build/lib/PingTimer.d.ts +11 -0
- package/build/lib/PingTimer.js +56 -0
- package/build/lib/PingTimer.js.map +1 -0
- package/build/lib/client.d.ts +3 -2
- package/build/lib/client.js +10 -21
- package/build/lib/client.js.map +1 -1
- package/build/lib/is-browser.d.ts +1 -0
- package/build/lib/is-browser.js +2 -0
- package/build/lib/is-browser.js.map +1 -1
- package/build/lib/shared.d.ts +1 -0
- package/build/lib/shared.js +6 -1
- package/build/lib/shared.js.map +1 -1
- package/build/mqtt.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/dist/mqtt.esm.js +5 -5
- package/dist/mqtt.js +380 -99
- package/dist/mqtt.min.js +5 -5
- package/package.json +2 -1
- package/src/lib/PingTimer.ts +45 -0
- package/src/lib/client.ts +13 -24
- package/src/lib/is-browser.ts +2 -0
- package/src/lib/shared.ts +5 -0
- package/src/mqtt.ts +0 -1
package/dist/mqtt.js
CHANGED
|
@@ -2399,9 +2399,9 @@ var mqtt = (() => {
|
|
|
2399
2399
|
var bufferModule = (init_buffer(), __toCommonJS(buffer_exports));
|
|
2400
2400
|
var AsyncFunction = Object.getPrototypeOf(async function() {
|
|
2401
2401
|
}).constructor;
|
|
2402
|
-
var
|
|
2403
|
-
var isBlob = typeof
|
|
2404
|
-
return b3 instanceof
|
|
2402
|
+
var Blob2 = globalThis.Blob || bufferModule.Blob;
|
|
2403
|
+
var isBlob = typeof Blob2 !== "undefined" ? function isBlob2(b3) {
|
|
2404
|
+
return b3 instanceof Blob2;
|
|
2405
2405
|
} : function isBlob2(b3) {
|
|
2406
2406
|
return false;
|
|
2407
2407
|
};
|
|
@@ -7416,9 +7416,9 @@ var mqtt = (() => {
|
|
|
7416
7416
|
var Readable = require_readable();
|
|
7417
7417
|
var { createDeferredPromise } = require_util();
|
|
7418
7418
|
var from = require_from();
|
|
7419
|
-
var
|
|
7420
|
-
var isBlob = typeof
|
|
7421
|
-
return b3 instanceof
|
|
7419
|
+
var Blob2 = globalThis.Blob || bufferModule.Blob;
|
|
7420
|
+
var isBlob = typeof Blob2 !== "undefined" ? function isBlob2(b3) {
|
|
7421
|
+
return b3 instanceof Blob2;
|
|
7422
7422
|
} : function isBlob2(b3) {
|
|
7423
7423
|
return false;
|
|
7424
7424
|
};
|
|
@@ -12166,58 +12166,6 @@ var mqtt = (() => {
|
|
|
12166
12166
|
}
|
|
12167
12167
|
});
|
|
12168
12168
|
|
|
12169
|
-
// node_modules/reinterval/index.js
|
|
12170
|
-
var require_reinterval = __commonJS({
|
|
12171
|
-
"node_modules/reinterval/index.js"(exports5, module) {
|
|
12172
|
-
"use strict";
|
|
12173
|
-
init_dirname();
|
|
12174
|
-
init_buffer2();
|
|
12175
|
-
init_process2();
|
|
12176
|
-
function ReInterval(callback, interval, args) {
|
|
12177
|
-
var self2 = this;
|
|
12178
|
-
this._callback = callback;
|
|
12179
|
-
this._args = args;
|
|
12180
|
-
this._interval = setInterval(callback, interval, this._args);
|
|
12181
|
-
this.reschedule = function(interval2) {
|
|
12182
|
-
if (!interval2)
|
|
12183
|
-
interval2 = self2._interval;
|
|
12184
|
-
if (self2._interval)
|
|
12185
|
-
clearInterval(self2._interval);
|
|
12186
|
-
self2._interval = setInterval(self2._callback, interval2, self2._args);
|
|
12187
|
-
};
|
|
12188
|
-
this.clear = function() {
|
|
12189
|
-
if (self2._interval) {
|
|
12190
|
-
clearInterval(self2._interval);
|
|
12191
|
-
self2._interval = void 0;
|
|
12192
|
-
}
|
|
12193
|
-
};
|
|
12194
|
-
this.destroy = function() {
|
|
12195
|
-
if (self2._interval) {
|
|
12196
|
-
clearInterval(self2._interval);
|
|
12197
|
-
}
|
|
12198
|
-
self2._callback = void 0;
|
|
12199
|
-
self2._interval = void 0;
|
|
12200
|
-
self2._args = void 0;
|
|
12201
|
-
};
|
|
12202
|
-
}
|
|
12203
|
-
function reInterval() {
|
|
12204
|
-
if (typeof arguments[0] !== "function")
|
|
12205
|
-
throw new Error("callback needed");
|
|
12206
|
-
if (typeof arguments[1] !== "number")
|
|
12207
|
-
throw new Error("interval needed");
|
|
12208
|
-
var args;
|
|
12209
|
-
if (arguments.length > 0) {
|
|
12210
|
-
args = new Array(arguments.length - 2);
|
|
12211
|
-
for (var i6 = 0; i6 < args.length; i6++) {
|
|
12212
|
-
args[i6] = arguments[i6 + 2];
|
|
12213
|
-
}
|
|
12214
|
-
}
|
|
12215
|
-
return new ReInterval(arguments[0], arguments[1], args);
|
|
12216
|
-
}
|
|
12217
|
-
module.exports = reInterval;
|
|
12218
|
-
}
|
|
12219
|
-
});
|
|
12220
|
-
|
|
12221
12169
|
// node_modules/rfdc/index.js
|
|
12222
12170
|
var require_rfdc = __commonJS({
|
|
12223
12171
|
"node_modules/rfdc/index.js"(exports5, module) {
|
|
@@ -12682,7 +12630,7 @@ var mqtt = (() => {
|
|
|
12682
12630
|
init_buffer2();
|
|
12683
12631
|
init_process2();
|
|
12684
12632
|
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
12685
|
-
exports5.applyMixin = exports5.ErrorWithReasonCode = void 0;
|
|
12633
|
+
exports5.nextTick = exports5.applyMixin = exports5.ErrorWithReasonCode = void 0;
|
|
12686
12634
|
var ErrorWithReasonCode = class _ErrorWithReasonCode extends Error {
|
|
12687
12635
|
constructor(message, code) {
|
|
12688
12636
|
super(message);
|
|
@@ -12713,6 +12661,9 @@ var mqtt = (() => {
|
|
|
12713
12661
|
}
|
|
12714
12662
|
}
|
|
12715
12663
|
exports5.applyMixin = applyMixin;
|
|
12664
|
+
exports5.nextTick = process_exports ? process_exports.nextTick : (callback) => {
|
|
12665
|
+
setTimeout(callback, 0);
|
|
12666
|
+
};
|
|
12716
12667
|
}
|
|
12717
12668
|
});
|
|
12718
12669
|
|
|
@@ -17287,6 +17238,364 @@ var mqtt = (() => {
|
|
|
17287
17238
|
}
|
|
17288
17239
|
});
|
|
17289
17240
|
|
|
17241
|
+
// node_modules/fast-unique-numbers/build/es5/bundle.js
|
|
17242
|
+
var require_bundle = __commonJS({
|
|
17243
|
+
"node_modules/fast-unique-numbers/build/es5/bundle.js"(exports5, module) {
|
|
17244
|
+
init_dirname();
|
|
17245
|
+
init_buffer2();
|
|
17246
|
+
init_process2();
|
|
17247
|
+
(function(global2, factory) {
|
|
17248
|
+
typeof exports5 === "object" && typeof module !== "undefined" ? factory(exports5) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.fastUniqueNumbers = {}));
|
|
17249
|
+
})(exports5, function(exports6) {
|
|
17250
|
+
"use strict";
|
|
17251
|
+
var createAddUniqueNumber = function createAddUniqueNumber2(generateUniqueNumber2) {
|
|
17252
|
+
return function(set) {
|
|
17253
|
+
var number = generateUniqueNumber2(set);
|
|
17254
|
+
set.add(number);
|
|
17255
|
+
return number;
|
|
17256
|
+
};
|
|
17257
|
+
};
|
|
17258
|
+
var createCache = function createCache2(lastNumberWeakMap) {
|
|
17259
|
+
return function(collection, nextNumber) {
|
|
17260
|
+
lastNumberWeakMap.set(collection, nextNumber);
|
|
17261
|
+
return nextNumber;
|
|
17262
|
+
};
|
|
17263
|
+
};
|
|
17264
|
+
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER === void 0 ? 9007199254740991 : Number.MAX_SAFE_INTEGER;
|
|
17265
|
+
var TWO_TO_THE_POWER_OF_TWENTY_NINE = 536870912;
|
|
17266
|
+
var TWO_TO_THE_POWER_OF_THIRTY = TWO_TO_THE_POWER_OF_TWENTY_NINE * 2;
|
|
17267
|
+
var createGenerateUniqueNumber = function createGenerateUniqueNumber2(cache2, lastNumberWeakMap) {
|
|
17268
|
+
return function(collection) {
|
|
17269
|
+
var lastNumber = lastNumberWeakMap.get(collection);
|
|
17270
|
+
var nextNumber = lastNumber === void 0 ? collection.size : lastNumber < TWO_TO_THE_POWER_OF_THIRTY ? lastNumber + 1 : 0;
|
|
17271
|
+
if (!collection.has(nextNumber)) {
|
|
17272
|
+
return cache2(collection, nextNumber);
|
|
17273
|
+
}
|
|
17274
|
+
if (collection.size < TWO_TO_THE_POWER_OF_TWENTY_NINE) {
|
|
17275
|
+
while (collection.has(nextNumber)) {
|
|
17276
|
+
nextNumber = Math.floor(Math.random() * TWO_TO_THE_POWER_OF_THIRTY);
|
|
17277
|
+
}
|
|
17278
|
+
return cache2(collection, nextNumber);
|
|
17279
|
+
}
|
|
17280
|
+
if (collection.size > MAX_SAFE_INTEGER) {
|
|
17281
|
+
throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");
|
|
17282
|
+
}
|
|
17283
|
+
while (collection.has(nextNumber)) {
|
|
17284
|
+
nextNumber = Math.floor(Math.random() * MAX_SAFE_INTEGER);
|
|
17285
|
+
}
|
|
17286
|
+
return cache2(collection, nextNumber);
|
|
17287
|
+
};
|
|
17288
|
+
};
|
|
17289
|
+
var LAST_NUMBER_WEAK_MAP = /* @__PURE__ */ new WeakMap();
|
|
17290
|
+
var cache = createCache(LAST_NUMBER_WEAK_MAP);
|
|
17291
|
+
var generateUniqueNumber = createGenerateUniqueNumber(cache, LAST_NUMBER_WEAK_MAP);
|
|
17292
|
+
var addUniqueNumber = createAddUniqueNumber(generateUniqueNumber);
|
|
17293
|
+
exports6.addUniqueNumber = addUniqueNumber;
|
|
17294
|
+
exports6.generateUniqueNumber = generateUniqueNumber;
|
|
17295
|
+
});
|
|
17296
|
+
}
|
|
17297
|
+
});
|
|
17298
|
+
|
|
17299
|
+
// node_modules/worker-timers-broker/build/es5/bundle.js
|
|
17300
|
+
var require_bundle2 = __commonJS({
|
|
17301
|
+
"node_modules/worker-timers-broker/build/es5/bundle.js"(exports5, module) {
|
|
17302
|
+
init_dirname();
|
|
17303
|
+
init_buffer2();
|
|
17304
|
+
init_process2();
|
|
17305
|
+
(function(global2, factory) {
|
|
17306
|
+
typeof exports5 === "object" && typeof module !== "undefined" ? factory(exports5, require_bundle()) : typeof define === "function" && define.amd ? define(["exports", "fast-unique-numbers"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.workerTimersBroker = {}, global2.fastUniqueNumbers));
|
|
17307
|
+
})(exports5, function(exports6, fastUniqueNumbers) {
|
|
17308
|
+
"use strict";
|
|
17309
|
+
var isCallNotification = function isCallNotification2(message) {
|
|
17310
|
+
return message.method !== void 0 && message.method === "call";
|
|
17311
|
+
};
|
|
17312
|
+
var isClearResponse = function isClearResponse2(message) {
|
|
17313
|
+
return message.error === null && typeof message.id === "number";
|
|
17314
|
+
};
|
|
17315
|
+
var load = function load2(url) {
|
|
17316
|
+
var scheduledIntervalFunctions = /* @__PURE__ */ new Map([[0, function() {
|
|
17317
|
+
}]]);
|
|
17318
|
+
var scheduledTimeoutFunctions = /* @__PURE__ */ new Map([[0, function() {
|
|
17319
|
+
}]]);
|
|
17320
|
+
var unrespondedRequests = /* @__PURE__ */ new Map();
|
|
17321
|
+
var worker = new Worker(url);
|
|
17322
|
+
worker.addEventListener("message", function(_ref) {
|
|
17323
|
+
var data = _ref.data;
|
|
17324
|
+
if (isCallNotification(data)) {
|
|
17325
|
+
var _data$params = data.params, timerId = _data$params.timerId, timerType = _data$params.timerType;
|
|
17326
|
+
if (timerType === "interval") {
|
|
17327
|
+
var idOrFunc = scheduledIntervalFunctions.get(timerId);
|
|
17328
|
+
if (typeof idOrFunc === "number") {
|
|
17329
|
+
var timerIdAndTimerType = unrespondedRequests.get(idOrFunc);
|
|
17330
|
+
if (timerIdAndTimerType === void 0 || timerIdAndTimerType.timerId !== timerId || timerIdAndTimerType.timerType !== timerType) {
|
|
17331
|
+
throw new Error("The timer is in an undefined state.");
|
|
17332
|
+
}
|
|
17333
|
+
} else if (typeof idOrFunc !== "undefined") {
|
|
17334
|
+
idOrFunc();
|
|
17335
|
+
} else {
|
|
17336
|
+
throw new Error("The timer is in an undefined state.");
|
|
17337
|
+
}
|
|
17338
|
+
} else if (timerType === "timeout") {
|
|
17339
|
+
var _idOrFunc = scheduledTimeoutFunctions.get(timerId);
|
|
17340
|
+
if (typeof _idOrFunc === "number") {
|
|
17341
|
+
var _timerIdAndTimerType = unrespondedRequests.get(_idOrFunc);
|
|
17342
|
+
if (_timerIdAndTimerType === void 0 || _timerIdAndTimerType.timerId !== timerId || _timerIdAndTimerType.timerType !== timerType) {
|
|
17343
|
+
throw new Error("The timer is in an undefined state.");
|
|
17344
|
+
}
|
|
17345
|
+
} else if (typeof _idOrFunc !== "undefined") {
|
|
17346
|
+
_idOrFunc();
|
|
17347
|
+
scheduledTimeoutFunctions["delete"](timerId);
|
|
17348
|
+
} else {
|
|
17349
|
+
throw new Error("The timer is in an undefined state.");
|
|
17350
|
+
}
|
|
17351
|
+
}
|
|
17352
|
+
} else if (isClearResponse(data)) {
|
|
17353
|
+
var id = data.id;
|
|
17354
|
+
var _timerIdAndTimerType2 = unrespondedRequests.get(id);
|
|
17355
|
+
if (_timerIdAndTimerType2 === void 0) {
|
|
17356
|
+
throw new Error("The timer is in an undefined state.");
|
|
17357
|
+
}
|
|
17358
|
+
var _timerId = _timerIdAndTimerType2.timerId, _timerType = _timerIdAndTimerType2.timerType;
|
|
17359
|
+
unrespondedRequests["delete"](id);
|
|
17360
|
+
if (_timerType === "interval") {
|
|
17361
|
+
scheduledIntervalFunctions["delete"](_timerId);
|
|
17362
|
+
} else {
|
|
17363
|
+
scheduledTimeoutFunctions["delete"](_timerId);
|
|
17364
|
+
}
|
|
17365
|
+
} else {
|
|
17366
|
+
var message = data.error.message;
|
|
17367
|
+
throw new Error(message);
|
|
17368
|
+
}
|
|
17369
|
+
});
|
|
17370
|
+
var clearInterval2 = function clearInterval3(timerId) {
|
|
17371
|
+
var id = fastUniqueNumbers.generateUniqueNumber(unrespondedRequests);
|
|
17372
|
+
unrespondedRequests.set(id, {
|
|
17373
|
+
timerId,
|
|
17374
|
+
timerType: "interval"
|
|
17375
|
+
});
|
|
17376
|
+
scheduledIntervalFunctions.set(timerId, id);
|
|
17377
|
+
worker.postMessage({
|
|
17378
|
+
id,
|
|
17379
|
+
method: "clear",
|
|
17380
|
+
params: {
|
|
17381
|
+
timerId,
|
|
17382
|
+
timerType: "interval"
|
|
17383
|
+
}
|
|
17384
|
+
});
|
|
17385
|
+
};
|
|
17386
|
+
var clearTimeout2 = function clearTimeout3(timerId) {
|
|
17387
|
+
var id = fastUniqueNumbers.generateUniqueNumber(unrespondedRequests);
|
|
17388
|
+
unrespondedRequests.set(id, {
|
|
17389
|
+
timerId,
|
|
17390
|
+
timerType: "timeout"
|
|
17391
|
+
});
|
|
17392
|
+
scheduledTimeoutFunctions.set(timerId, id);
|
|
17393
|
+
worker.postMessage({
|
|
17394
|
+
id,
|
|
17395
|
+
method: "clear",
|
|
17396
|
+
params: {
|
|
17397
|
+
timerId,
|
|
17398
|
+
timerType: "timeout"
|
|
17399
|
+
}
|
|
17400
|
+
});
|
|
17401
|
+
};
|
|
17402
|
+
var setInterval2 = function setInterval3(func, delay) {
|
|
17403
|
+
var timerId = fastUniqueNumbers.generateUniqueNumber(scheduledIntervalFunctions);
|
|
17404
|
+
scheduledIntervalFunctions.set(timerId, function() {
|
|
17405
|
+
func();
|
|
17406
|
+
if (typeof scheduledIntervalFunctions.get(timerId) === "function") {
|
|
17407
|
+
worker.postMessage({
|
|
17408
|
+
id: null,
|
|
17409
|
+
method: "set",
|
|
17410
|
+
params: {
|
|
17411
|
+
delay,
|
|
17412
|
+
now: performance.now(),
|
|
17413
|
+
timerId,
|
|
17414
|
+
timerType: "interval"
|
|
17415
|
+
}
|
|
17416
|
+
});
|
|
17417
|
+
}
|
|
17418
|
+
});
|
|
17419
|
+
worker.postMessage({
|
|
17420
|
+
id: null,
|
|
17421
|
+
method: "set",
|
|
17422
|
+
params: {
|
|
17423
|
+
delay,
|
|
17424
|
+
now: performance.now(),
|
|
17425
|
+
timerId,
|
|
17426
|
+
timerType: "interval"
|
|
17427
|
+
}
|
|
17428
|
+
});
|
|
17429
|
+
return timerId;
|
|
17430
|
+
};
|
|
17431
|
+
var setTimeout2 = function setTimeout3(func, delay) {
|
|
17432
|
+
var timerId = fastUniqueNumbers.generateUniqueNumber(scheduledTimeoutFunctions);
|
|
17433
|
+
scheduledTimeoutFunctions.set(timerId, func);
|
|
17434
|
+
worker.postMessage({
|
|
17435
|
+
id: null,
|
|
17436
|
+
method: "set",
|
|
17437
|
+
params: {
|
|
17438
|
+
delay,
|
|
17439
|
+
now: performance.now(),
|
|
17440
|
+
timerId,
|
|
17441
|
+
timerType: "timeout"
|
|
17442
|
+
}
|
|
17443
|
+
});
|
|
17444
|
+
return timerId;
|
|
17445
|
+
};
|
|
17446
|
+
return {
|
|
17447
|
+
clearInterval: clearInterval2,
|
|
17448
|
+
clearTimeout: clearTimeout2,
|
|
17449
|
+
setInterval: setInterval2,
|
|
17450
|
+
setTimeout: setTimeout2
|
|
17451
|
+
};
|
|
17452
|
+
};
|
|
17453
|
+
exports6.load = load;
|
|
17454
|
+
});
|
|
17455
|
+
}
|
|
17456
|
+
});
|
|
17457
|
+
|
|
17458
|
+
// node_modules/worker-timers/build/es5/bundle.js
|
|
17459
|
+
var require_bundle3 = __commonJS({
|
|
17460
|
+
"node_modules/worker-timers/build/es5/bundle.js"(exports5, module) {
|
|
17461
|
+
init_dirname();
|
|
17462
|
+
init_buffer2();
|
|
17463
|
+
init_process2();
|
|
17464
|
+
(function(global2, factory) {
|
|
17465
|
+
typeof exports5 === "object" && typeof module !== "undefined" ? factory(exports5, require_bundle2()) : typeof define === "function" && define.amd ? define(["exports", "worker-timers-broker"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.workerTimers = {}, global2.workerTimersBroker));
|
|
17466
|
+
})(exports5, function(exports6, workerTimersBroker) {
|
|
17467
|
+
"use strict";
|
|
17468
|
+
var createLoadOrReturnBroker = function createLoadOrReturnBroker2(loadBroker, worker2) {
|
|
17469
|
+
var broker = null;
|
|
17470
|
+
return function() {
|
|
17471
|
+
if (broker !== null) {
|
|
17472
|
+
return broker;
|
|
17473
|
+
}
|
|
17474
|
+
var blob = new Blob([worker2], {
|
|
17475
|
+
type: "application/javascript; charset=utf-8"
|
|
17476
|
+
});
|
|
17477
|
+
var url = URL.createObjectURL(blob);
|
|
17478
|
+
broker = loadBroker(url);
|
|
17479
|
+
setTimeout(function() {
|
|
17480
|
+
return URL.revokeObjectURL(url);
|
|
17481
|
+
});
|
|
17482
|
+
return broker;
|
|
17483
|
+
};
|
|
17484
|
+
};
|
|
17485
|
+
var worker = `(()=>{var e={67:(e,t,r)=>{var o,i;void 0===(i="function"==typeof(o=function(){"use strict";var e=new Map,t=new Map,r=function(t){var r=e.get(t);if(void 0===r)throw new Error('There is no interval scheduled with the given id "'.concat(t,'".'));clearTimeout(r),e.delete(t)},o=function(e){var r=t.get(e);if(void 0===r)throw new Error('There is no timeout scheduled with the given id "'.concat(e,'".'));clearTimeout(r),t.delete(e)},i=function(e,t){var r,o=performance.now();return{expected:o+(r=e-Math.max(0,o-t)),remainingDelay:r}},n=function e(t,r,o,i){var n=performance.now();n>o?postMessage({id:null,method:"call",params:{timerId:r,timerType:i}}):t.set(r,setTimeout(e,o-n,t,r,o,i))},a=function(t,r,o){var a=i(t,o),s=a.expected,d=a.remainingDelay;e.set(r,setTimeout(n,d,e,r,s,"interval"))},s=function(e,r,o){var a=i(e,o),s=a.expected,d=a.remainingDelay;t.set(r,setTimeout(n,d,t,r,s,"timeout"))};addEventListener("message",(function(e){var t=e.data;try{if("clear"===t.method){var i=t.id,n=t.params,d=n.timerId,c=n.timerType;if("interval"===c)r(d),postMessage({error:null,id:i});else{if("timeout"!==c)throw new Error('The given type "'.concat(c,'" is not supported'));o(d),postMessage({error:null,id:i})}}else{if("set"!==t.method)throw new Error('The given method "'.concat(t.method,'" is not supported'));var u=t.params,l=u.delay,p=u.now,m=u.timerId,v=u.timerType;if("interval"===v)a(l,m,p);else{if("timeout"!==v)throw new Error('The given type "'.concat(v,'" is not supported'));s(l,m,p)}}}catch(e){postMessage({error:{message:e.message},id:t.id,result:null})}}))})?o.call(t,r,t,e):o)||(e.exports=i)}},t={};function r(o){var i=t[o];if(void 0!==i)return i.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";r(67)})()})();`;
|
|
17486
|
+
var loadOrReturnBroker = createLoadOrReturnBroker(workerTimersBroker.load, worker);
|
|
17487
|
+
var clearInterval2 = function clearInterval3(timerId) {
|
|
17488
|
+
return loadOrReturnBroker().clearInterval(timerId);
|
|
17489
|
+
};
|
|
17490
|
+
var clearTimeout2 = function clearTimeout3(timerId) {
|
|
17491
|
+
return loadOrReturnBroker().clearTimeout(timerId);
|
|
17492
|
+
};
|
|
17493
|
+
var setInterval2 = function setInterval3(func, delay) {
|
|
17494
|
+
return loadOrReturnBroker().setInterval(func, delay);
|
|
17495
|
+
};
|
|
17496
|
+
var setTimeout$1 = function setTimeout2(func, delay) {
|
|
17497
|
+
return loadOrReturnBroker().setTimeout(func, delay);
|
|
17498
|
+
};
|
|
17499
|
+
exports6.clearInterval = clearInterval2;
|
|
17500
|
+
exports6.clearTimeout = clearTimeout2;
|
|
17501
|
+
exports6.setInterval = setInterval2;
|
|
17502
|
+
exports6.setTimeout = setTimeout$1;
|
|
17503
|
+
});
|
|
17504
|
+
}
|
|
17505
|
+
});
|
|
17506
|
+
|
|
17507
|
+
// build/lib/is-browser.js
|
|
17508
|
+
var require_is_browser = __commonJS({
|
|
17509
|
+
"build/lib/is-browser.js"(exports5) {
|
|
17510
|
+
"use strict";
|
|
17511
|
+
init_dirname();
|
|
17512
|
+
init_buffer2();
|
|
17513
|
+
init_process2();
|
|
17514
|
+
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
17515
|
+
exports5.isWebWorker = void 0;
|
|
17516
|
+
var isStandardBrowserEnv = () => typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
17517
|
+
var isWebWorkerEnv = () => {
|
|
17518
|
+
var _a, _b;
|
|
17519
|
+
return Boolean(typeof self === "object" && ((_b = (_a = self === null || self === void 0 ? void 0 : self.constructor) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.includes("WorkerGlobalScope")));
|
|
17520
|
+
};
|
|
17521
|
+
var isReactNativeEnv = () => typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
17522
|
+
var isBrowser = isStandardBrowserEnv() || isWebWorkerEnv() || isReactNativeEnv();
|
|
17523
|
+
exports5.isWebWorker = isWebWorkerEnv();
|
|
17524
|
+
exports5.default = isBrowser;
|
|
17525
|
+
}
|
|
17526
|
+
});
|
|
17527
|
+
|
|
17528
|
+
// build/lib/PingTimer.js
|
|
17529
|
+
var require_PingTimer = __commonJS({
|
|
17530
|
+
"build/lib/PingTimer.js"(exports5) {
|
|
17531
|
+
"use strict";
|
|
17532
|
+
init_dirname();
|
|
17533
|
+
init_buffer2();
|
|
17534
|
+
init_process2();
|
|
17535
|
+
var __createBinding = exports5 && exports5.__createBinding || (Object.create ? function(o7, m4, k2, k22) {
|
|
17536
|
+
if (k22 === void 0)
|
|
17537
|
+
k22 = k2;
|
|
17538
|
+
var desc = Object.getOwnPropertyDescriptor(m4, k2);
|
|
17539
|
+
if (!desc || ("get" in desc ? !m4.__esModule : desc.writable || desc.configurable)) {
|
|
17540
|
+
desc = { enumerable: true, get: function() {
|
|
17541
|
+
return m4[k2];
|
|
17542
|
+
} };
|
|
17543
|
+
}
|
|
17544
|
+
Object.defineProperty(o7, k22, desc);
|
|
17545
|
+
} : function(o7, m4, k2, k22) {
|
|
17546
|
+
if (k22 === void 0)
|
|
17547
|
+
k22 = k2;
|
|
17548
|
+
o7[k22] = m4[k2];
|
|
17549
|
+
});
|
|
17550
|
+
var __setModuleDefault = exports5 && exports5.__setModuleDefault || (Object.create ? function(o7, v4) {
|
|
17551
|
+
Object.defineProperty(o7, "default", { enumerable: true, value: v4 });
|
|
17552
|
+
} : function(o7, v4) {
|
|
17553
|
+
o7["default"] = v4;
|
|
17554
|
+
});
|
|
17555
|
+
var __importStar = exports5 && exports5.__importStar || function(mod) {
|
|
17556
|
+
if (mod && mod.__esModule)
|
|
17557
|
+
return mod;
|
|
17558
|
+
var result = {};
|
|
17559
|
+
if (mod != null) {
|
|
17560
|
+
for (var k2 in mod)
|
|
17561
|
+
if (k2 !== "default" && Object.prototype.hasOwnProperty.call(mod, k2))
|
|
17562
|
+
__createBinding(result, mod, k2);
|
|
17563
|
+
}
|
|
17564
|
+
__setModuleDefault(result, mod);
|
|
17565
|
+
return result;
|
|
17566
|
+
};
|
|
17567
|
+
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
17568
|
+
var worker_timers_1 = require_bundle3();
|
|
17569
|
+
var is_browser_1 = __importStar(require_is_browser());
|
|
17570
|
+
var PingTimer = class {
|
|
17571
|
+
constructor(keepalive, checkPing) {
|
|
17572
|
+
this._setTimeout = is_browser_1.default && !is_browser_1.isWebWorker ? worker_timers_1.setTimeout : (func, time) => setTimeout(func, time);
|
|
17573
|
+
this._clearTimeout = is_browser_1.default && !is_browser_1.isWebWorker ? worker_timers_1.clearTimeout : (timer) => clearTimeout(timer);
|
|
17574
|
+
this.keepalive = keepalive * 1e3;
|
|
17575
|
+
this.checkPing = checkPing;
|
|
17576
|
+
this.setup();
|
|
17577
|
+
}
|
|
17578
|
+
setup() {
|
|
17579
|
+
this.timer = this._setTimeout(() => {
|
|
17580
|
+
this.checkPing();
|
|
17581
|
+
this.reschedule();
|
|
17582
|
+
}, this.keepalive);
|
|
17583
|
+
}
|
|
17584
|
+
clear() {
|
|
17585
|
+
if (this.timer) {
|
|
17586
|
+
this._clearTimeout(this.timer);
|
|
17587
|
+
this.timer = null;
|
|
17588
|
+
}
|
|
17589
|
+
}
|
|
17590
|
+
reschedule() {
|
|
17591
|
+
this.clear();
|
|
17592
|
+
this.setup();
|
|
17593
|
+
}
|
|
17594
|
+
};
|
|
17595
|
+
exports5.default = PingTimer;
|
|
17596
|
+
}
|
|
17597
|
+
});
|
|
17598
|
+
|
|
17290
17599
|
// build/lib/client.js
|
|
17291
17600
|
var require_client = __commonJS({
|
|
17292
17601
|
"build/lib/client.js"(exports5) {
|
|
@@ -17334,19 +17643,17 @@ var mqtt = (() => {
|
|
|
17334
17643
|
var mqtt_packet_1 = __importDefault(require_mqtt());
|
|
17335
17644
|
var default_message_id_provider_1 = __importDefault(require_default_message_id_provider());
|
|
17336
17645
|
var readable_stream_1 = require_browser3();
|
|
17337
|
-
var reinterval_1 = __importDefault(require_reinterval());
|
|
17338
17646
|
var default_1 = __importDefault(require_default());
|
|
17339
17647
|
var validations = __importStar(require_validations());
|
|
17340
17648
|
var debug_1 = __importDefault(require_browser4());
|
|
17341
17649
|
var store_1 = __importDefault(require_store());
|
|
17342
17650
|
var handlers_1 = __importDefault(require_handlers());
|
|
17651
|
+
var shared_1 = require_shared();
|
|
17343
17652
|
var TypedEmitter_1 = require_TypedEmitter();
|
|
17344
|
-
var
|
|
17345
|
-
|
|
17346
|
-
};
|
|
17347
|
-
var setImmediate = window.setImmediate || ((...args) => {
|
|
17653
|
+
var PingTimer_1 = __importDefault(require_PingTimer());
|
|
17654
|
+
var setImmediate = globalThis.setImmediate || ((...args) => {
|
|
17348
17655
|
const callback = args.shift();
|
|
17349
|
-
|
|
17656
|
+
(0, shared_1.nextTick)(() => {
|
|
17350
17657
|
callback(...args);
|
|
17351
17658
|
});
|
|
17352
17659
|
});
|
|
@@ -17361,13 +17668,6 @@ var mqtt = (() => {
|
|
|
17361
17668
|
resubscribe: true,
|
|
17362
17669
|
writeCache: true
|
|
17363
17670
|
};
|
|
17364
|
-
var socketErrors = [
|
|
17365
|
-
"ECONNREFUSED",
|
|
17366
|
-
"EADDRINUSE",
|
|
17367
|
-
"ECONNRESET",
|
|
17368
|
-
"ENOTFOUND",
|
|
17369
|
-
"ETIMEDOUT"
|
|
17370
|
-
];
|
|
17371
17671
|
var MqttClient = class _MqttClient extends TypedEmitter_1.TypedEventEmitter {
|
|
17372
17672
|
static defaultId() {
|
|
17373
17673
|
return `mqttjs_${Math.random().toString(16).substr(2, 8)}`;
|
|
@@ -17522,7 +17822,7 @@ var mqtt = (() => {
|
|
|
17522
17822
|
};
|
|
17523
17823
|
const nextTickWork = () => {
|
|
17524
17824
|
if (packets.length) {
|
|
17525
|
-
|
|
17825
|
+
(0, shared_1.nextTick)(work);
|
|
17526
17826
|
} else {
|
|
17527
17827
|
const done = completeParse;
|
|
17528
17828
|
completeParse = null;
|
|
@@ -17537,7 +17837,7 @@ var mqtt = (() => {
|
|
|
17537
17837
|
};
|
|
17538
17838
|
const streamErrorHandler = (error) => {
|
|
17539
17839
|
this.log("streamErrorHandler :: error", error.message);
|
|
17540
|
-
if (
|
|
17840
|
+
if (error.code) {
|
|
17541
17841
|
this.log("streamErrorHandler :: emitting error");
|
|
17542
17842
|
this.emit("error", error);
|
|
17543
17843
|
} else {
|
|
@@ -17914,7 +18214,7 @@ var mqtt = (() => {
|
|
|
17914
18214
|
this.log("end :: (%s) :: finish :: calling _cleanUp with force %s", this.options.clientId, force);
|
|
17915
18215
|
this._cleanUp(force, () => {
|
|
17916
18216
|
this.log("end :: finish :: calling process.nextTick on closeStores");
|
|
17917
|
-
|
|
18217
|
+
(0, shared_1.nextTick)(closeStores);
|
|
17918
18218
|
}, opts);
|
|
17919
18219
|
};
|
|
17920
18220
|
if (this.disconnecting) {
|
|
@@ -18265,14 +18565,14 @@ var mqtt = (() => {
|
|
|
18265
18565
|
this.log("_setupPingTimer :: keepalive %d (seconds)", this.options.keepalive);
|
|
18266
18566
|
if (!this.pingTimer && this.options.keepalive) {
|
|
18267
18567
|
this.pingResp = true;
|
|
18268
|
-
this.pingTimer =
|
|
18568
|
+
this.pingTimer = new PingTimer_1.default(this.options.keepalive, () => {
|
|
18269
18569
|
this._checkPing();
|
|
18270
|
-
}
|
|
18570
|
+
});
|
|
18271
18571
|
}
|
|
18272
18572
|
}
|
|
18273
18573
|
_shiftPingInterval() {
|
|
18274
18574
|
if (this.pingTimer && this.options.keepalive && this.options.reschedulePings) {
|
|
18275
|
-
this.pingTimer.reschedule(
|
|
18575
|
+
this.pingTimer.reschedule();
|
|
18276
18576
|
}
|
|
18277
18577
|
}
|
|
18278
18578
|
_checkPing() {
|
|
@@ -18707,7 +19007,7 @@ var mqtt = (() => {
|
|
|
18707
19007
|
init_dirname();
|
|
18708
19008
|
init_buffer2();
|
|
18709
19009
|
init_process2();
|
|
18710
|
-
r5 = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self :
|
|
19010
|
+
r5 = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : global;
|
|
18711
19011
|
o5 = e5 = {};
|
|
18712
19012
|
!function() {
|
|
18713
19013
|
try {
|
|
@@ -18939,7 +19239,7 @@ var mqtt = (() => {
|
|
|
18939
19239
|
init_process2();
|
|
18940
19240
|
exports2 = {};
|
|
18941
19241
|
_dewExec2 = false;
|
|
18942
|
-
_global = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self :
|
|
19242
|
+
_global = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : global;
|
|
18943
19243
|
process2 = dew2();
|
|
18944
19244
|
process2.platform = "browser";
|
|
18945
19245
|
process2.addListener;
|
|
@@ -20266,25 +20566,6 @@ var mqtt = (() => {
|
|
|
20266
20566
|
}
|
|
20267
20567
|
});
|
|
20268
20568
|
|
|
20269
|
-
// build/lib/is-browser.js
|
|
20270
|
-
var require_is_browser = __commonJS({
|
|
20271
|
-
"build/lib/is-browser.js"(exports5) {
|
|
20272
|
-
"use strict";
|
|
20273
|
-
init_dirname();
|
|
20274
|
-
init_buffer2();
|
|
20275
|
-
init_process2();
|
|
20276
|
-
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
20277
|
-
var isStandardBrowserEnv = () => typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
20278
|
-
var isWebWorkerEnv = () => {
|
|
20279
|
-
var _a, _b;
|
|
20280
|
-
return Boolean(typeof self === "object" && ((_b = (_a = self === null || self === void 0 ? void 0 : self.constructor) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.includes("WorkerGlobalScope")));
|
|
20281
|
-
};
|
|
20282
|
-
var isReactNativeEnv = () => typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
20283
|
-
var isBrowser = isStandardBrowserEnv() || isWebWorkerEnv() || isReactNativeEnv();
|
|
20284
|
-
exports5.default = isBrowser;
|
|
20285
|
-
}
|
|
20286
|
-
});
|
|
20287
|
-
|
|
20288
20569
|
// node_modules/@jspm/core/nodelibs/browser/net.js
|
|
20289
20570
|
var net_exports = {};
|
|
20290
20571
|
__export(net_exports, {
|