mqtt 5.3.0 → 5.3.2
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 +34 -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.js +8 -5
- package/build/lib/is-browser.js.map +1 -1
- package/build/lib/shared.d.ts +2 -1
- 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 +349 -93
- package/dist/mqtt.min.js +5 -5
- package/package.json +2 -1
- package/src/lib/PingTimer.ts +39 -0
- package/src/lib/client.ts +13 -24
- package/src/lib/is-browser.ts +15 -8
- package/src/lib/shared.ts +7 -1
- 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,333 @@ 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
|
+
var isStandardBrowserEnv = () => typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
17516
|
+
var isWebWorkerEnv = () => {
|
|
17517
|
+
var _a, _b;
|
|
17518
|
+
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")));
|
|
17519
|
+
};
|
|
17520
|
+
var isReactNativeEnv = () => typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
17521
|
+
var isBrowser = isStandardBrowserEnv() || isWebWorkerEnv() || isReactNativeEnv();
|
|
17522
|
+
exports5.default = isBrowser;
|
|
17523
|
+
}
|
|
17524
|
+
});
|
|
17525
|
+
|
|
17526
|
+
// build/lib/PingTimer.js
|
|
17527
|
+
var require_PingTimer = __commonJS({
|
|
17528
|
+
"build/lib/PingTimer.js"(exports5) {
|
|
17529
|
+
"use strict";
|
|
17530
|
+
init_dirname();
|
|
17531
|
+
init_buffer2();
|
|
17532
|
+
init_process2();
|
|
17533
|
+
var __importDefault = exports5 && exports5.__importDefault || function(mod) {
|
|
17534
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
17535
|
+
};
|
|
17536
|
+
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
17537
|
+
var worker_timers_1 = require_bundle3();
|
|
17538
|
+
var is_browser_1 = __importDefault(require_is_browser());
|
|
17539
|
+
var PingTimer = class {
|
|
17540
|
+
constructor(keepalive, checkPing) {
|
|
17541
|
+
this.setTimeout = is_browser_1.default ? worker_timers_1.setTimeout : setTimeout;
|
|
17542
|
+
this.clearTimeout = is_browser_1.default ? worker_timers_1.clearTimeout : clearTimeout;
|
|
17543
|
+
this.keepalive = keepalive * 1e3;
|
|
17544
|
+
this.checkPing = checkPing;
|
|
17545
|
+
this.setup();
|
|
17546
|
+
}
|
|
17547
|
+
setup() {
|
|
17548
|
+
this.timer = this.setTimeout(() => {
|
|
17549
|
+
this.checkPing();
|
|
17550
|
+
this.reschedule();
|
|
17551
|
+
}, this.keepalive);
|
|
17552
|
+
}
|
|
17553
|
+
clear() {
|
|
17554
|
+
if (this.timer) {
|
|
17555
|
+
this.clearTimeout(this.timer);
|
|
17556
|
+
this.timer = null;
|
|
17557
|
+
}
|
|
17558
|
+
}
|
|
17559
|
+
reschedule() {
|
|
17560
|
+
this.clear();
|
|
17561
|
+
this.setup();
|
|
17562
|
+
}
|
|
17563
|
+
};
|
|
17564
|
+
exports5.default = PingTimer;
|
|
17565
|
+
}
|
|
17566
|
+
});
|
|
17567
|
+
|
|
17290
17568
|
// build/lib/client.js
|
|
17291
17569
|
var require_client = __commonJS({
|
|
17292
17570
|
"build/lib/client.js"(exports5) {
|
|
@@ -17334,19 +17612,17 @@ var mqtt = (() => {
|
|
|
17334
17612
|
var mqtt_packet_1 = __importDefault(require_mqtt());
|
|
17335
17613
|
var default_message_id_provider_1 = __importDefault(require_default_message_id_provider());
|
|
17336
17614
|
var readable_stream_1 = require_browser3();
|
|
17337
|
-
var reinterval_1 = __importDefault(require_reinterval());
|
|
17338
17615
|
var default_1 = __importDefault(require_default());
|
|
17339
17616
|
var validations = __importStar(require_validations());
|
|
17340
17617
|
var debug_1 = __importDefault(require_browser4());
|
|
17341
17618
|
var store_1 = __importDefault(require_store());
|
|
17342
17619
|
var handlers_1 = __importDefault(require_handlers());
|
|
17620
|
+
var shared_1 = require_shared();
|
|
17343
17621
|
var TypedEmitter_1 = require_TypedEmitter();
|
|
17344
|
-
var
|
|
17345
|
-
|
|
17346
|
-
};
|
|
17347
|
-
var setImmediate = window.setImmediate || ((...args) => {
|
|
17622
|
+
var PingTimer_1 = __importDefault(require_PingTimer());
|
|
17623
|
+
var setImmediate = globalThis.setImmediate || ((...args) => {
|
|
17348
17624
|
const callback = args.shift();
|
|
17349
|
-
|
|
17625
|
+
(0, shared_1.nextTick)(() => {
|
|
17350
17626
|
callback(...args);
|
|
17351
17627
|
});
|
|
17352
17628
|
});
|
|
@@ -17361,13 +17637,6 @@ var mqtt = (() => {
|
|
|
17361
17637
|
resubscribe: true,
|
|
17362
17638
|
writeCache: true
|
|
17363
17639
|
};
|
|
17364
|
-
var socketErrors = [
|
|
17365
|
-
"ECONNREFUSED",
|
|
17366
|
-
"EADDRINUSE",
|
|
17367
|
-
"ECONNRESET",
|
|
17368
|
-
"ENOTFOUND",
|
|
17369
|
-
"ETIMEDOUT"
|
|
17370
|
-
];
|
|
17371
17640
|
var MqttClient = class _MqttClient extends TypedEmitter_1.TypedEventEmitter {
|
|
17372
17641
|
static defaultId() {
|
|
17373
17642
|
return `mqttjs_${Math.random().toString(16).substr(2, 8)}`;
|
|
@@ -17522,7 +17791,7 @@ var mqtt = (() => {
|
|
|
17522
17791
|
};
|
|
17523
17792
|
const nextTickWork = () => {
|
|
17524
17793
|
if (packets.length) {
|
|
17525
|
-
|
|
17794
|
+
(0, shared_1.nextTick)(work);
|
|
17526
17795
|
} else {
|
|
17527
17796
|
const done = completeParse;
|
|
17528
17797
|
completeParse = null;
|
|
@@ -17537,7 +17806,7 @@ var mqtt = (() => {
|
|
|
17537
17806
|
};
|
|
17538
17807
|
const streamErrorHandler = (error) => {
|
|
17539
17808
|
this.log("streamErrorHandler :: error", error.message);
|
|
17540
|
-
if (
|
|
17809
|
+
if (error.code) {
|
|
17541
17810
|
this.log("streamErrorHandler :: emitting error");
|
|
17542
17811
|
this.emit("error", error);
|
|
17543
17812
|
} else {
|
|
@@ -17914,7 +18183,7 @@ var mqtt = (() => {
|
|
|
17914
18183
|
this.log("end :: (%s) :: finish :: calling _cleanUp with force %s", this.options.clientId, force);
|
|
17915
18184
|
this._cleanUp(force, () => {
|
|
17916
18185
|
this.log("end :: finish :: calling process.nextTick on closeStores");
|
|
17917
|
-
|
|
18186
|
+
(0, shared_1.nextTick)(closeStores);
|
|
17918
18187
|
}, opts);
|
|
17919
18188
|
};
|
|
17920
18189
|
if (this.disconnecting) {
|
|
@@ -18265,14 +18534,14 @@ var mqtt = (() => {
|
|
|
18265
18534
|
this.log("_setupPingTimer :: keepalive %d (seconds)", this.options.keepalive);
|
|
18266
18535
|
if (!this.pingTimer && this.options.keepalive) {
|
|
18267
18536
|
this.pingResp = true;
|
|
18268
|
-
this.pingTimer =
|
|
18537
|
+
this.pingTimer = new PingTimer_1.default(this.options.keepalive, () => {
|
|
18269
18538
|
this._checkPing();
|
|
18270
|
-
}
|
|
18539
|
+
});
|
|
18271
18540
|
}
|
|
18272
18541
|
}
|
|
18273
18542
|
_shiftPingInterval() {
|
|
18274
18543
|
if (this.pingTimer && this.options.keepalive && this.options.reschedulePings) {
|
|
18275
|
-
this.pingTimer.reschedule(
|
|
18544
|
+
this.pingTimer.reschedule();
|
|
18276
18545
|
}
|
|
18277
18546
|
}
|
|
18278
18547
|
_checkPing() {
|
|
@@ -18707,7 +18976,7 @@ var mqtt = (() => {
|
|
|
18707
18976
|
init_dirname();
|
|
18708
18977
|
init_buffer2();
|
|
18709
18978
|
init_process2();
|
|
18710
|
-
r5 = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self :
|
|
18979
|
+
r5 = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : global;
|
|
18711
18980
|
o5 = e5 = {};
|
|
18712
18981
|
!function() {
|
|
18713
18982
|
try {
|
|
@@ -18939,7 +19208,7 @@ var mqtt = (() => {
|
|
|
18939
19208
|
init_process2();
|
|
18940
19209
|
exports2 = {};
|
|
18941
19210
|
_dewExec2 = false;
|
|
18942
|
-
_global = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self :
|
|
19211
|
+
_global = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : global;
|
|
18943
19212
|
process2 = dew2();
|
|
18944
19213
|
process2.platform = "browser";
|
|
18945
19214
|
process2.addListener;
|
|
@@ -20266,19 +20535,6 @@ var mqtt = (() => {
|
|
|
20266
20535
|
}
|
|
20267
20536
|
});
|
|
20268
20537
|
|
|
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 isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" || typeof self === "object" && self.constructor && self.constructor.name === "DedicatedWorkerGlobalScope" || typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
20278
|
-
exports5.default = isBrowser;
|
|
20279
|
-
}
|
|
20280
|
-
});
|
|
20281
|
-
|
|
20282
20538
|
// node_modules/@jspm/core/nodelibs/browser/net.js
|
|
20283
20539
|
var net_exports = {};
|
|
20284
20540
|
__export(net_exports, {
|