mqtt 5.13.2 → 5.13.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/bin/mqtt.js +1 -1
- package/build/bin/mqtt.js.map +1 -1
- package/build/bin/pub.js +3 -4
- package/build/bin/pub.js.map +1 -1
- package/build/bin/sub.js.map +1 -1
- package/build/lib/BufferedDuplex.js +4 -0
- package/build/lib/BufferedDuplex.js.map +1 -1
- package/build/lib/KeepaliveManager.js +8 -1
- package/build/lib/KeepaliveManager.js.map +1 -1
- package/build/lib/client.d.ts +2 -2
- package/build/lib/client.js +59 -16
- package/build/lib/client.js.map +1 -1
- package/build/lib/connect/ali.js +5 -6
- package/build/lib/connect/ali.js.map +1 -1
- package/build/lib/connect/index.js +8 -8
- package/build/lib/connect/index.js.map +1 -1
- package/build/lib/connect/socks.js +25 -27
- package/build/lib/connect/socks.js.map +1 -1
- package/build/lib/connect/tcp.js.map +1 -1
- package/build/lib/connect/tls.js +12 -17
- package/build/lib/connect/tls.js.map +1 -1
- package/build/lib/connect/ws.js.map +1 -1
- package/build/lib/connect/wx.js.map +1 -1
- package/build/lib/default-message-id-provider.js +1 -0
- package/build/lib/default-message-id-provider.js.map +1 -1
- package/build/lib/get-timer.js +1 -1
- package/build/lib/get-timer.js.map +1 -1
- package/build/lib/handlers/connack.js.map +1 -1
- package/build/lib/is-browser.js +4 -8
- package/build/lib/is-browser.js.map +1 -1
- package/build/lib/shared.d.ts +3 -2
- package/build/lib/shared.js +6 -4
- package/build/lib/shared.js.map +1 -1
- package/build/lib/store.js +3 -1
- package/build/lib/store.js.map +1 -1
- package/build/lib/topic-alias-recv.js +3 -0
- package/build/lib/topic-alias-recv.js.map +1 -1
- package/build/lib/topic-alias-send.js +5 -0
- package/build/lib/topic-alias-send.js.map +1 -1
- package/build/lib/unique-message-id-provider.js +2 -0
- package/build/lib/unique-message-id-provider.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/dist/mqtt.esm.js +5 -5
- package/dist/mqtt.js +211 -152
- package/dist/mqtt.min.js +5 -5
- package/package.json +2 -1
package/dist/mqtt.js
CHANGED
|
@@ -2147,38 +2147,6 @@ var mqtt = (() => {
|
|
|
2147
2147
|
}
|
|
2148
2148
|
});
|
|
2149
2149
|
|
|
2150
|
-
// build/lib/topic-alias-recv.js
|
|
2151
|
-
var require_topic_alias_recv = __commonJS({
|
|
2152
|
-
"build/lib/topic-alias-recv.js"(exports5) {
|
|
2153
|
-
"use strict";
|
|
2154
|
-
init_dirname();
|
|
2155
|
-
init_buffer2();
|
|
2156
|
-
init_process2();
|
|
2157
|
-
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
2158
|
-
var TopicAliasRecv = class {
|
|
2159
|
-
constructor(max) {
|
|
2160
|
-
this.aliasToTopic = {};
|
|
2161
|
-
this.max = max;
|
|
2162
|
-
}
|
|
2163
|
-
put(topic, alias) {
|
|
2164
|
-
if (alias === 0 || alias > this.max) {
|
|
2165
|
-
return false;
|
|
2166
|
-
}
|
|
2167
|
-
this.aliasToTopic[alias] = topic;
|
|
2168
|
-
this.length = Object.keys(this.aliasToTopic).length;
|
|
2169
|
-
return true;
|
|
2170
|
-
}
|
|
2171
|
-
getTopicByAlias(alias) {
|
|
2172
|
-
return this.aliasToTopic[alias];
|
|
2173
|
-
}
|
|
2174
|
-
clear() {
|
|
2175
|
-
this.aliasToTopic = {};
|
|
2176
|
-
}
|
|
2177
|
-
};
|
|
2178
|
-
exports5.default = TopicAliasRecv;
|
|
2179
|
-
}
|
|
2180
|
-
});
|
|
2181
|
-
|
|
2182
2150
|
// node_modules/readable-stream/lib/ours/primordials.js
|
|
2183
2151
|
var require_primordials = __commonJS({
|
|
2184
2152
|
"node_modules/readable-stream/lib/ours/primordials.js"(exports5, module) {
|
|
@@ -11339,40 +11307,6 @@ var mqtt = (() => {
|
|
|
11339
11307
|
}
|
|
11340
11308
|
});
|
|
11341
11309
|
|
|
11342
|
-
// build/lib/default-message-id-provider.js
|
|
11343
|
-
var require_default_message_id_provider = __commonJS({
|
|
11344
|
-
"build/lib/default-message-id-provider.js"(exports5) {
|
|
11345
|
-
"use strict";
|
|
11346
|
-
init_dirname();
|
|
11347
|
-
init_buffer2();
|
|
11348
|
-
init_process2();
|
|
11349
|
-
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
11350
|
-
var DefaultMessageIdProvider = class {
|
|
11351
|
-
constructor() {
|
|
11352
|
-
this.nextId = Math.max(1, Math.floor(Math.random() * 65535));
|
|
11353
|
-
}
|
|
11354
|
-
allocate() {
|
|
11355
|
-
const id = this.nextId++;
|
|
11356
|
-
if (this.nextId === 65536) {
|
|
11357
|
-
this.nextId = 1;
|
|
11358
|
-
}
|
|
11359
|
-
return id;
|
|
11360
|
-
}
|
|
11361
|
-
getLastAllocated() {
|
|
11362
|
-
return this.nextId === 1 ? 65535 : this.nextId - 1;
|
|
11363
|
-
}
|
|
11364
|
-
register(messageId) {
|
|
11365
|
-
return true;
|
|
11366
|
-
}
|
|
11367
|
-
deallocate(messageId) {
|
|
11368
|
-
}
|
|
11369
|
-
clear() {
|
|
11370
|
-
}
|
|
11371
|
-
};
|
|
11372
|
-
exports5.default = DefaultMessageIdProvider;
|
|
11373
|
-
}
|
|
11374
|
-
});
|
|
11375
|
-
|
|
11376
11310
|
// node_modules/rfdc/index.js
|
|
11377
11311
|
var require_rfdc = __commonJS({
|
|
11378
11312
|
"node_modules/rfdc/index.js"(exports5, module) {
|
|
@@ -11629,9 +11563,11 @@ var mqtt = (() => {
|
|
|
11629
11563
|
clean: true
|
|
11630
11564
|
};
|
|
11631
11565
|
var Store = class {
|
|
11566
|
+
options;
|
|
11567
|
+
_inflights;
|
|
11632
11568
|
constructor(options) {
|
|
11633
11569
|
this.options = options || {};
|
|
11634
|
-
this.options =
|
|
11570
|
+
this.options = { ...defaultStoreOptions, ...options };
|
|
11635
11571
|
this._inflights = /* @__PURE__ */ new Map();
|
|
11636
11572
|
}
|
|
11637
11573
|
put(packet, cb) {
|
|
@@ -11812,7 +11748,7 @@ var mqtt = (() => {
|
|
|
11812
11748
|
// package-json:../../package.json
|
|
11813
11749
|
var require_package = __commonJS({
|
|
11814
11750
|
"package-json:../../package.json"(exports5, module) {
|
|
11815
|
-
module.exports = { version: "5.13.
|
|
11751
|
+
module.exports = { version: "5.13.3" };
|
|
11816
11752
|
}
|
|
11817
11753
|
});
|
|
11818
11754
|
|
|
@@ -11827,6 +11763,7 @@ var mqtt = (() => {
|
|
|
11827
11763
|
exports5.MQTTJS_VERSION = exports5.nextTick = exports5.ErrorWithSubackPacket = exports5.ErrorWithReasonCode = void 0;
|
|
11828
11764
|
exports5.applyMixin = applyMixin;
|
|
11829
11765
|
var ErrorWithReasonCode = class _ErrorWithReasonCode extends Error {
|
|
11766
|
+
code;
|
|
11830
11767
|
constructor(message, code) {
|
|
11831
11768
|
super(message);
|
|
11832
11769
|
this.code = code;
|
|
@@ -11836,6 +11773,7 @@ var mqtt = (() => {
|
|
|
11836
11773
|
};
|
|
11837
11774
|
exports5.ErrorWithReasonCode = ErrorWithReasonCode;
|
|
11838
11775
|
var ErrorWithSubackPacket = class _ErrorWithSubackPacket extends Error {
|
|
11776
|
+
packet;
|
|
11839
11777
|
constructor(message, packet) {
|
|
11840
11778
|
super(message);
|
|
11841
11779
|
this.packet = packet;
|
|
@@ -11845,12 +11783,11 @@ var mqtt = (() => {
|
|
|
11845
11783
|
};
|
|
11846
11784
|
exports5.ErrorWithSubackPacket = ErrorWithSubackPacket;
|
|
11847
11785
|
function applyMixin(target, mixin, includeConstructor = false) {
|
|
11848
|
-
var _a;
|
|
11849
11786
|
const inheritanceChain = [mixin];
|
|
11850
11787
|
while (true) {
|
|
11851
11788
|
const current = inheritanceChain[0];
|
|
11852
11789
|
const base = Object.getPrototypeOf(current);
|
|
11853
|
-
if (base
|
|
11790
|
+
if (base?.prototype) {
|
|
11854
11791
|
inheritanceChain.unshift(base);
|
|
11855
11792
|
} else {
|
|
11856
11793
|
break;
|
|
@@ -11859,12 +11796,12 @@ var mqtt = (() => {
|
|
|
11859
11796
|
for (const ctor of inheritanceChain) {
|
|
11860
11797
|
for (const prop of Object.getOwnPropertyNames(ctor.prototype)) {
|
|
11861
11798
|
if (includeConstructor || prop !== "constructor") {
|
|
11862
|
-
Object.defineProperty(target.prototype, prop,
|
|
11799
|
+
Object.defineProperty(target.prototype, prop, Object.getOwnPropertyDescriptor(ctor.prototype, prop) ?? /* @__PURE__ */ Object.create(null));
|
|
11863
11800
|
}
|
|
11864
11801
|
}
|
|
11865
11802
|
}
|
|
11866
11803
|
}
|
|
11867
|
-
exports5.nextTick = typeof
|
|
11804
|
+
exports5.nextTick = typeof process_exports?.nextTick === "function" ? process_exports.nextTick : (callback) => {
|
|
11868
11805
|
setTimeout(callback, 0);
|
|
11869
11806
|
};
|
|
11870
11807
|
exports5.MQTTJS_VERSION = require_package().version;
|
|
@@ -16242,6 +16179,11 @@ var mqtt = (() => {
|
|
|
16242
16179
|
var lru_cache_1 = require_commonjs();
|
|
16243
16180
|
var number_allocator_1 = require_number_allocator2();
|
|
16244
16181
|
var TopicAliasSend = class {
|
|
16182
|
+
aliasToTopic;
|
|
16183
|
+
topicToAlias;
|
|
16184
|
+
max;
|
|
16185
|
+
numberAllocator;
|
|
16186
|
+
length;
|
|
16245
16187
|
constructor(max) {
|
|
16246
16188
|
if (max > 0) {
|
|
16247
16189
|
this.aliasToTopic = new lru_cache_1.LRUCache({ max });
|
|
@@ -16453,57 +16395,94 @@ var mqtt = (() => {
|
|
|
16453
16395
|
}
|
|
16454
16396
|
});
|
|
16455
16397
|
|
|
16456
|
-
// build/lib/
|
|
16457
|
-
var
|
|
16458
|
-
"build/lib/
|
|
16398
|
+
// build/lib/default-message-id-provider.js
|
|
16399
|
+
var require_default_message_id_provider = __commonJS({
|
|
16400
|
+
"build/lib/default-message-id-provider.js"(exports5) {
|
|
16459
16401
|
"use strict";
|
|
16460
16402
|
init_dirname();
|
|
16461
16403
|
init_buffer2();
|
|
16462
16404
|
init_process2();
|
|
16463
|
-
var __importDefault = exports5 && exports5.__importDefault || function(mod) {
|
|
16464
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
16465
|
-
};
|
|
16466
16405
|
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
16467
|
-
|
|
16468
|
-
|
|
16469
|
-
|
|
16470
|
-
|
|
16406
|
+
var DefaultMessageIdProvider = class {
|
|
16407
|
+
nextId;
|
|
16408
|
+
constructor() {
|
|
16409
|
+
this.nextId = Math.max(1, Math.floor(Math.random() * 65535));
|
|
16410
|
+
}
|
|
16411
|
+
allocate() {
|
|
16412
|
+
const id = this.nextId++;
|
|
16413
|
+
if (this.nextId === 65536) {
|
|
16414
|
+
this.nextId = 1;
|
|
16415
|
+
}
|
|
16416
|
+
return id;
|
|
16417
|
+
}
|
|
16418
|
+
getLastAllocated() {
|
|
16419
|
+
return this.nextId === 1 ? 65535 : this.nextId - 1;
|
|
16420
|
+
}
|
|
16421
|
+
register(messageId) {
|
|
16422
|
+
return true;
|
|
16423
|
+
}
|
|
16424
|
+
deallocate(messageId) {
|
|
16425
|
+
}
|
|
16426
|
+
clear() {
|
|
16427
|
+
}
|
|
16471
16428
|
};
|
|
16472
|
-
exports5.
|
|
16473
|
-
(0, shared_1.applyMixin)(TypedEventEmitter, events_1.default);
|
|
16429
|
+
exports5.default = DefaultMessageIdProvider;
|
|
16474
16430
|
}
|
|
16475
16431
|
});
|
|
16476
16432
|
|
|
16477
|
-
// build/lib/
|
|
16478
|
-
var
|
|
16479
|
-
"build/lib/
|
|
16433
|
+
// build/lib/topic-alias-recv.js
|
|
16434
|
+
var require_topic_alias_recv = __commonJS({
|
|
16435
|
+
"build/lib/topic-alias-recv.js"(exports5) {
|
|
16480
16436
|
"use strict";
|
|
16481
16437
|
init_dirname();
|
|
16482
16438
|
init_buffer2();
|
|
16483
16439
|
init_process2();
|
|
16484
16440
|
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
16485
|
-
|
|
16486
|
-
|
|
16487
|
-
|
|
16488
|
-
|
|
16489
|
-
|
|
16490
|
-
|
|
16491
|
-
|
|
16492
|
-
|
|
16441
|
+
var TopicAliasRecv = class {
|
|
16442
|
+
aliasToTopic;
|
|
16443
|
+
max;
|
|
16444
|
+
length;
|
|
16445
|
+
constructor(max) {
|
|
16446
|
+
this.aliasToTopic = {};
|
|
16447
|
+
this.max = max;
|
|
16448
|
+
}
|
|
16449
|
+
put(topic, alias) {
|
|
16450
|
+
if (alias === 0 || alias > this.max) {
|
|
16451
|
+
return false;
|
|
16493
16452
|
}
|
|
16494
|
-
|
|
16453
|
+
this.aliasToTopic[alias] = topic;
|
|
16454
|
+
this.length = Object.keys(this.aliasToTopic).length;
|
|
16455
|
+
return true;
|
|
16456
|
+
}
|
|
16457
|
+
getTopicByAlias(alias) {
|
|
16458
|
+
return this.aliasToTopic[alias];
|
|
16459
|
+
}
|
|
16460
|
+
clear() {
|
|
16461
|
+
this.aliasToTopic = {};
|
|
16495
16462
|
}
|
|
16496
|
-
return false;
|
|
16497
16463
|
};
|
|
16498
|
-
|
|
16499
|
-
|
|
16500
|
-
|
|
16464
|
+
exports5.default = TopicAliasRecv;
|
|
16465
|
+
}
|
|
16466
|
+
});
|
|
16467
|
+
|
|
16468
|
+
// build/lib/TypedEmitter.js
|
|
16469
|
+
var require_TypedEmitter = __commonJS({
|
|
16470
|
+
"build/lib/TypedEmitter.js"(exports5) {
|
|
16471
|
+
"use strict";
|
|
16472
|
+
init_dirname();
|
|
16473
|
+
init_buffer2();
|
|
16474
|
+
init_process2();
|
|
16475
|
+
var __importDefault = exports5 && exports5.__importDefault || function(mod) {
|
|
16476
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
16501
16477
|
};
|
|
16502
|
-
|
|
16503
|
-
|
|
16504
|
-
|
|
16505
|
-
|
|
16506
|
-
|
|
16478
|
+
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
16479
|
+
exports5.TypedEventEmitter = void 0;
|
|
16480
|
+
var events_1 = __importDefault((init_events(), __toCommonJS(events_exports)));
|
|
16481
|
+
var shared_1 = require_shared();
|
|
16482
|
+
var TypedEventEmitter = class {
|
|
16483
|
+
};
|
|
16484
|
+
exports5.TypedEventEmitter = TypedEventEmitter;
|
|
16485
|
+
(0, shared_1.applyMixin)(TypedEventEmitter, events_1.default);
|
|
16507
16486
|
}
|
|
16508
16487
|
});
|
|
16509
16488
|
|
|
@@ -16777,6 +16756,35 @@ var mqtt = (() => {
|
|
|
16777
16756
|
}
|
|
16778
16757
|
});
|
|
16779
16758
|
|
|
16759
|
+
// build/lib/is-browser.js
|
|
16760
|
+
var require_is_browser = __commonJS({
|
|
16761
|
+
"build/lib/is-browser.js"(exports5) {
|
|
16762
|
+
"use strict";
|
|
16763
|
+
init_dirname();
|
|
16764
|
+
init_buffer2();
|
|
16765
|
+
init_process2();
|
|
16766
|
+
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
16767
|
+
exports5.isReactNativeBrowser = exports5.isWebWorker = void 0;
|
|
16768
|
+
var isStandardBrowserEnv = () => {
|
|
16769
|
+
if (typeof window !== "undefined") {
|
|
16770
|
+
const electronRenderCheck = typeof navigator !== "undefined" && navigator.userAgent?.toLowerCase().indexOf(" electron/") > -1;
|
|
16771
|
+
if (electronRenderCheck && process_exports?.versions) {
|
|
16772
|
+
const electronMainCheck = Object.prototype.hasOwnProperty.call(process_exports.versions, "electron");
|
|
16773
|
+
return !electronMainCheck;
|
|
16774
|
+
}
|
|
16775
|
+
return typeof window.document !== "undefined";
|
|
16776
|
+
}
|
|
16777
|
+
return false;
|
|
16778
|
+
};
|
|
16779
|
+
var isWebWorkerEnv = () => Boolean(typeof self === "object" && self?.constructor?.name?.includes("WorkerGlobalScope"));
|
|
16780
|
+
var isReactNativeEnv = () => typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
16781
|
+
var isBrowser = isStandardBrowserEnv() || isWebWorkerEnv() || isReactNativeEnv();
|
|
16782
|
+
exports5.isWebWorker = isWebWorkerEnv();
|
|
16783
|
+
exports5.isReactNativeBrowser = isReactNativeEnv();
|
|
16784
|
+
exports5.default = isBrowser;
|
|
16785
|
+
}
|
|
16786
|
+
});
|
|
16787
|
+
|
|
16780
16788
|
// build/lib/get-timer.js
|
|
16781
16789
|
var require_get_timer = __commonJS({
|
|
16782
16790
|
"build/lib/get-timer.js"(exports5) {
|
|
@@ -16822,8 +16830,8 @@ var mqtt = (() => {
|
|
|
16822
16830
|
};
|
|
16823
16831
|
}();
|
|
16824
16832
|
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
16825
|
-
var is_browser_1 = __importStar(require_is_browser());
|
|
16826
16833
|
var worker_timers_1 = require_bundle3();
|
|
16834
|
+
var is_browser_1 = __importStar(require_is_browser());
|
|
16827
16835
|
var workerTimer = {
|
|
16828
16836
|
set: worker_timers_1.setInterval,
|
|
16829
16837
|
clear: worker_timers_1.clearInterval
|
|
@@ -16863,6 +16871,14 @@ var mqtt = (() => {
|
|
|
16863
16871
|
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
16864
16872
|
var get_timer_1 = __importDefault(require_get_timer());
|
|
16865
16873
|
var KeepaliveManager = class {
|
|
16874
|
+
_keepalive;
|
|
16875
|
+
timerId;
|
|
16876
|
+
timer;
|
|
16877
|
+
destroyed = false;
|
|
16878
|
+
counter;
|
|
16879
|
+
client;
|
|
16880
|
+
_keepaliveTimeoutTimestamp;
|
|
16881
|
+
_intervalEvery;
|
|
16866
16882
|
get keepaliveTimeoutTimestamp() {
|
|
16867
16883
|
return this._keepaliveTimeoutTimestamp;
|
|
16868
16884
|
}
|
|
@@ -16873,7 +16889,6 @@ var mqtt = (() => {
|
|
|
16873
16889
|
return this._keepalive;
|
|
16874
16890
|
}
|
|
16875
16891
|
constructor(client, variant) {
|
|
16876
|
-
this.destroyed = false;
|
|
16877
16892
|
this.client = client;
|
|
16878
16893
|
this.timer = typeof variant === "object" && "set" in variant && "clear" in variant ? variant : (0, get_timer_1.default)(variant);
|
|
16879
16894
|
this.setKeepalive(client.options.keepalive);
|
|
@@ -16971,15 +16986,15 @@ var mqtt = (() => {
|
|
|
16971
16986
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
16972
16987
|
};
|
|
16973
16988
|
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
16974
|
-
var topic_alias_recv_1 = __importDefault(require_topic_alias_recv());
|
|
16975
16989
|
var mqtt_packet_1 = __importDefault(require_mqtt());
|
|
16976
|
-
var default_message_id_provider_1 = __importDefault(require_default_message_id_provider());
|
|
16977
16990
|
var readable_stream_1 = require_browser3();
|
|
16978
16991
|
var default_1 = __importDefault(require_default());
|
|
16979
|
-
var validations = __importStar(require_validations());
|
|
16980
16992
|
var debug_1 = __importDefault(require_browser4());
|
|
16993
|
+
var validations = __importStar(require_validations());
|
|
16981
16994
|
var store_1 = __importDefault(require_store());
|
|
16982
16995
|
var handlers_1 = __importDefault(require_handlers());
|
|
16996
|
+
var default_message_id_provider_1 = __importDefault(require_default_message_id_provider());
|
|
16997
|
+
var topic_alias_recv_1 = __importDefault(require_topic_alias_recv());
|
|
16983
16998
|
var shared_1 = require_shared();
|
|
16984
16999
|
var TypedEmitter_1 = require_TypedEmitter();
|
|
16985
17000
|
var KeepaliveManager_1 = __importDefault(require_KeepaliveManager());
|
|
@@ -17004,6 +17019,36 @@ var mqtt = (() => {
|
|
|
17004
17019
|
timerVariant: "auto"
|
|
17005
17020
|
};
|
|
17006
17021
|
var MqttClient = class _MqttClient extends TypedEmitter_1.TypedEventEmitter {
|
|
17022
|
+
static VERSION = shared_1.MQTTJS_VERSION;
|
|
17023
|
+
connected;
|
|
17024
|
+
disconnecting;
|
|
17025
|
+
disconnected;
|
|
17026
|
+
reconnecting;
|
|
17027
|
+
incomingStore;
|
|
17028
|
+
outgoingStore;
|
|
17029
|
+
options;
|
|
17030
|
+
queueQoSZero;
|
|
17031
|
+
_reconnectCount;
|
|
17032
|
+
log;
|
|
17033
|
+
messageIdProvider;
|
|
17034
|
+
outgoing;
|
|
17035
|
+
messageIdToTopic;
|
|
17036
|
+
noop;
|
|
17037
|
+
keepaliveManager;
|
|
17038
|
+
stream;
|
|
17039
|
+
queue;
|
|
17040
|
+
streamBuilder;
|
|
17041
|
+
_resubscribeTopics;
|
|
17042
|
+
connackTimer;
|
|
17043
|
+
reconnectTimer;
|
|
17044
|
+
_storeProcessing;
|
|
17045
|
+
_packetIdsDuringStoreProcessing;
|
|
17046
|
+
_storeProcessingQueue;
|
|
17047
|
+
_firstConnection;
|
|
17048
|
+
topicAliasRecv;
|
|
17049
|
+
topicAliasSend;
|
|
17050
|
+
_deferredReconnect;
|
|
17051
|
+
connackPacket;
|
|
17007
17052
|
static defaultId() {
|
|
17008
17053
|
return `mqttjs_${Math.random().toString(16).substr(2, 8)}`;
|
|
17009
17054
|
}
|
|
@@ -17129,7 +17174,6 @@ var mqtt = (() => {
|
|
|
17129
17174
|
return this.messageIdProvider.getLastAllocated();
|
|
17130
17175
|
}
|
|
17131
17176
|
connect() {
|
|
17132
|
-
var _a;
|
|
17133
17177
|
const writable = new readable_stream_1.Writable();
|
|
17134
17178
|
const parser = mqtt_packet_1.default.parser(this.options);
|
|
17135
17179
|
let completeParse = null;
|
|
@@ -17209,7 +17253,10 @@ var mqtt = (() => {
|
|
|
17209
17253
|
properties: this.options.properties
|
|
17210
17254
|
};
|
|
17211
17255
|
if (this.options.will) {
|
|
17212
|
-
connectPacket.will =
|
|
17256
|
+
connectPacket.will = {
|
|
17257
|
+
...this.options.will,
|
|
17258
|
+
payload: this.options.will?.payload
|
|
17259
|
+
};
|
|
17213
17260
|
}
|
|
17214
17261
|
if (this.topicAliasRecv) {
|
|
17215
17262
|
if (!connectPacket.properties) {
|
|
@@ -17227,7 +17274,11 @@ var mqtt = (() => {
|
|
|
17227
17274
|
return this;
|
|
17228
17275
|
}
|
|
17229
17276
|
if (this.options.properties.authenticationMethod && this.options.authPacket && typeof this.options.authPacket === "object") {
|
|
17230
|
-
const authPacket =
|
|
17277
|
+
const authPacket = {
|
|
17278
|
+
cmd: "auth",
|
|
17279
|
+
reasonCode: 0,
|
|
17280
|
+
...this.options.authPacket
|
|
17281
|
+
};
|
|
17231
17282
|
this._writePacket(authPacket);
|
|
17232
17283
|
}
|
|
17233
17284
|
}
|
|
@@ -17253,7 +17304,7 @@ var mqtt = (() => {
|
|
|
17253
17304
|
retain: false,
|
|
17254
17305
|
dup: false
|
|
17255
17306
|
};
|
|
17256
|
-
opts =
|
|
17307
|
+
opts = { ...defaultOpts, ...opts };
|
|
17257
17308
|
const { qos, retain, dup, properties, cbStorePut } = opts;
|
|
17258
17309
|
if (this._checkDisconnecting(callback)) {
|
|
17259
17310
|
return this;
|
|
@@ -17352,8 +17403,8 @@ var mqtt = (() => {
|
|
|
17352
17403
|
defaultOpts.rap = false;
|
|
17353
17404
|
defaultOpts.rh = 0;
|
|
17354
17405
|
}
|
|
17355
|
-
opts =
|
|
17356
|
-
const properties = opts
|
|
17406
|
+
opts = { ...defaultOpts, ...opts };
|
|
17407
|
+
const { properties } = opts;
|
|
17357
17408
|
const subs = [];
|
|
17358
17409
|
const parseSub = (topic, subOptions) => {
|
|
17359
17410
|
subOptions = subOptions || opts;
|
|
@@ -17437,8 +17488,7 @@ var mqtt = (() => {
|
|
|
17437
17488
|
return promise;
|
|
17438
17489
|
};
|
|
17439
17490
|
const subscribeProc = () => {
|
|
17440
|
-
|
|
17441
|
-
const batchSize = (_a = this.options.subscribeBatchSize) !== null && _a !== void 0 ? _a : subs.length;
|
|
17491
|
+
const batchSize = this.options.subscribeBatchSize ?? subs.length;
|
|
17442
17492
|
const subscribePromises = [];
|
|
17443
17493
|
for (let i5 = 0; i5 < subs.length; i5 += batchSize) {
|
|
17444
17494
|
const chunkedSubs = subs.slice(i5, i5 + batchSize);
|
|
@@ -17746,7 +17796,7 @@ var mqtt = (() => {
|
|
|
17746
17796
|
this.log("_cleanUp :: (%s) :: destroying stream", this.options.clientId);
|
|
17747
17797
|
this.stream.destroy();
|
|
17748
17798
|
} else {
|
|
17749
|
-
const packet =
|
|
17799
|
+
const packet = { cmd: "disconnect", ...opts };
|
|
17750
17800
|
this.log("_cleanUp :: (%s) :: call _sendPacket with disconnect packet", this.options.clientId);
|
|
17751
17801
|
this._sendPacket(packet, () => {
|
|
17752
17802
|
this.log("_cleanUp :: (%s) :: destroying stream", this.options.clientId);
|
|
@@ -17810,19 +17860,28 @@ var mqtt = (() => {
|
|
|
17810
17860
|
alias = this.topicAliasSend.getAliasByTopic(topic);
|
|
17811
17861
|
if (alias) {
|
|
17812
17862
|
packet.topic = "";
|
|
17813
|
-
packet.properties =
|
|
17863
|
+
packet.properties = {
|
|
17864
|
+
...packet.properties,
|
|
17865
|
+
topicAlias: alias
|
|
17866
|
+
};
|
|
17814
17867
|
this.log("applyTopicAlias :: auto assign(use) topic: %s - alias: %d", topic, alias);
|
|
17815
17868
|
} else {
|
|
17816
17869
|
alias = this.topicAliasSend.getLruAlias();
|
|
17817
17870
|
this.topicAliasSend.put(topic, alias);
|
|
17818
|
-
packet.properties =
|
|
17871
|
+
packet.properties = {
|
|
17872
|
+
...packet.properties,
|
|
17873
|
+
topicAlias: alias
|
|
17874
|
+
};
|
|
17819
17875
|
this.log("applyTopicAlias :: auto assign topic: %s - alias: %d", topic, alias);
|
|
17820
17876
|
}
|
|
17821
17877
|
} else if (this.options.autoUseTopicAlias) {
|
|
17822
17878
|
alias = this.topicAliasSend.getAliasByTopic(topic);
|
|
17823
17879
|
if (alias) {
|
|
17824
17880
|
packet.topic = "";
|
|
17825
|
-
packet.properties =
|
|
17881
|
+
packet.properties = {
|
|
17882
|
+
...packet.properties,
|
|
17883
|
+
topicAlias: alias
|
|
17884
|
+
};
|
|
17826
17885
|
this.log("applyTopicAlias :: auto use topic: %s - alias: %d", topic, alias);
|
|
17827
17886
|
}
|
|
17828
17887
|
}
|
|
@@ -18096,7 +18155,6 @@ var mqtt = (() => {
|
|
|
18096
18155
|
});
|
|
18097
18156
|
}
|
|
18098
18157
|
};
|
|
18099
|
-
MqttClient.VERSION = shared_1.MQTTJS_VERSION;
|
|
18100
18158
|
exports5.default = MqttClient;
|
|
18101
18159
|
}
|
|
18102
18160
|
});
|
|
@@ -18111,6 +18169,8 @@ var mqtt = (() => {
|
|
|
18111
18169
|
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
18112
18170
|
var number_allocator_1 = require_number_allocator2();
|
|
18113
18171
|
var UniqueMessageIdProvider = class {
|
|
18172
|
+
numberAllocator;
|
|
18173
|
+
lastId;
|
|
18114
18174
|
constructor() {
|
|
18115
18175
|
this.numberAllocator = new number_allocator_1.NumberAllocator(1, 65535);
|
|
18116
18176
|
}
|
|
@@ -19836,6 +19896,10 @@ var mqtt = (() => {
|
|
|
19836
19896
|
this._write(buffer_1.Buffer.concat(buffers), "binary", cb);
|
|
19837
19897
|
}
|
|
19838
19898
|
var BufferedDuplex = class extends readable_stream_1.Duplex {
|
|
19899
|
+
socket;
|
|
19900
|
+
proxy;
|
|
19901
|
+
isSocketOpen;
|
|
19902
|
+
writeQueue;
|
|
19839
19903
|
constructor(opts, proxy, socket) {
|
|
19840
19904
|
super({
|
|
19841
19905
|
objectMode: true
|
|
@@ -20218,31 +20282,27 @@ var mqtt = (() => {
|
|
|
20218
20282
|
init_dirname();
|
|
20219
20283
|
init_buffer2();
|
|
20220
20284
|
init_process2();
|
|
20221
|
-
var __rest = exports5 && exports5.__rest || function(s4, e6) {
|
|
20222
|
-
var t5 = {};
|
|
20223
|
-
for (var p5 in s4) if (Object.prototype.hasOwnProperty.call(s4, p5) && e6.indexOf(p5) < 0)
|
|
20224
|
-
t5[p5] = s4[p5];
|
|
20225
|
-
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
|
|
20226
|
-
for (var i5 = 0, p5 = Object.getOwnPropertySymbols(s4); i5 < p5.length; i5++) {
|
|
20227
|
-
if (e6.indexOf(p5[i5]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p5[i5]))
|
|
20228
|
-
t5[p5[i5]] = s4[p5[i5]];
|
|
20229
|
-
}
|
|
20230
|
-
return t5;
|
|
20231
|
-
};
|
|
20232
20285
|
var __importDefault = exports5 && exports5.__importDefault || function(mod) {
|
|
20233
20286
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
20234
20287
|
};
|
|
20235
20288
|
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
20236
|
-
var tls_1 =
|
|
20289
|
+
var tls_1 = (init_empty(), __toCommonJS(empty_exports));
|
|
20237
20290
|
var net_1 = __importDefault((init_net(), __toCommonJS(net_exports)));
|
|
20238
20291
|
var debug_1 = __importDefault(require_browser4());
|
|
20239
20292
|
var socks_1 = __importDefault(require_socks());
|
|
20240
20293
|
var debug = (0, debug_1.default)("mqttjs:tls");
|
|
20241
20294
|
function connect(opts) {
|
|
20242
|
-
const { host, port, socksProxy
|
|
20243
|
-
|
|
20244
|
-
|
|
20245
|
-
|
|
20295
|
+
const { host, port, socksProxy, ...rest } = opts;
|
|
20296
|
+
if (socksProxy !== void 0) {
|
|
20297
|
+
const socket = (0, socks_1.default)(host, port, socksProxy, {
|
|
20298
|
+
timeout: opts.socksTimeout
|
|
20299
|
+
});
|
|
20300
|
+
return (0, tls_1.connect)({
|
|
20301
|
+
...rest,
|
|
20302
|
+
socket
|
|
20303
|
+
});
|
|
20304
|
+
}
|
|
20305
|
+
return (0, tls_1.connect)(opts);
|
|
20246
20306
|
}
|
|
20247
20307
|
var buildStream = (client, opts) => {
|
|
20248
20308
|
opts.port = opts.port || 8883;
|
|
@@ -20468,12 +20528,11 @@ var mqtt = (() => {
|
|
|
20468
20528
|
} else {
|
|
20469
20529
|
const reader = new FileReader();
|
|
20470
20530
|
reader.addEventListener("load", () => {
|
|
20471
|
-
|
|
20472
|
-
|
|
20473
|
-
|
|
20474
|
-
|
|
20475
|
-
|
|
20476
|
-
proxy.push(data);
|
|
20531
|
+
if (reader.result instanceof ArrayBuffer) {
|
|
20532
|
+
proxy.push(buffer_1.Buffer.from(reader.result));
|
|
20533
|
+
return;
|
|
20534
|
+
}
|
|
20535
|
+
proxy.push(buffer_1.Buffer.from(reader.result, "utf-8"));
|
|
20477
20536
|
});
|
|
20478
20537
|
reader.readAsArrayBuffer(res.data);
|
|
20479
20538
|
}
|
|
@@ -20524,7 +20583,7 @@ var mqtt = (() => {
|
|
|
20524
20583
|
var url_1 = __importDefault((init_url(), __toCommonJS(url_exports)));
|
|
20525
20584
|
var client_1 = __importDefault(require_client());
|
|
20526
20585
|
var is_browser_1 = __importDefault(require_is_browser());
|
|
20527
|
-
if (typeof
|
|
20586
|
+
if (typeof process_exports?.nextTick !== "function") {
|
|
20528
20587
|
process_exports.nextTick = setImmediate;
|
|
20529
20588
|
}
|
|
20530
20589
|
var debug = (0, debug_1.default)("mqttjs");
|
|
@@ -20534,15 +20593,15 @@ var mqtt = (() => {
|
|
|
20534
20593
|
if (opts.auth) {
|
|
20535
20594
|
matches = opts.auth.match(/^(.+):(.+)$/);
|
|
20536
20595
|
if (matches) {
|
|
20537
|
-
|
|
20538
|
-
opts.
|
|
20596
|
+
const [, username, password] = matches;
|
|
20597
|
+
opts.username = username;
|
|
20598
|
+
opts.password = password;
|
|
20539
20599
|
} else {
|
|
20540
20600
|
opts.username = opts.auth;
|
|
20541
20601
|
}
|
|
20542
20602
|
}
|
|
20543
20603
|
}
|
|
20544
20604
|
function connect(brokerUrl, opts) {
|
|
20545
|
-
var _a, _b, _c;
|
|
20546
20605
|
debug("connecting to an MQTT broker...");
|
|
20547
20606
|
if (typeof brokerUrl === "object" && !opts) {
|
|
20548
20607
|
opts = brokerUrl;
|
|
@@ -20560,16 +20619,16 @@ var mqtt = (() => {
|
|
|
20560
20619
|
parsedOptions.auth = parsedUrl.auth;
|
|
20561
20620
|
parsedOptions.protocol = parsedUrl.protocol;
|
|
20562
20621
|
parsedOptions.path = parsedUrl.path;
|
|
20563
|
-
opts =
|
|
20622
|
+
opts = { ...parsedOptions, ...opts };
|
|
20564
20623
|
if (!opts.protocol) {
|
|
20565
20624
|
throw new Error("Missing protocol");
|
|
20566
20625
|
}
|
|
20567
20626
|
opts.protocol = opts.protocol.replace(/:$/, "");
|
|
20568
20627
|
}
|
|
20569
|
-
opts.unixSocket = opts.unixSocket ||
|
|
20628
|
+
opts.unixSocket = opts.unixSocket || opts.protocol?.includes("+unix");
|
|
20570
20629
|
if (opts.unixSocket) {
|
|
20571
20630
|
opts.protocol = opts.protocol.replace("+unix", "");
|
|
20572
|
-
} else if (!
|
|
20631
|
+
} else if (!opts.protocol?.startsWith("ws") && !opts.protocol?.startsWith("wx")) {
|
|
20573
20632
|
delete opts.path;
|
|
20574
20633
|
}
|
|
20575
20634
|
parseAuthOptions(opts);
|