mqtt 5.6.2 → 5.7.0
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/README.md +4 -2
- package/build/lib/client.d.ts +4 -1
- package/build/lib/client.js.map +1 -1
- package/build/lib/connect/index.js +20 -12
- package/build/lib/connect/index.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/dist/mqtt.esm.js +2 -2
- package/dist/mqtt.js +21 -14
- package/dist/mqtt.min.js +2 -2
- package/package.json +1 -1
- package/src/lib/client.ts +9 -2
- package/src/lib/connect/index.ts +33 -15
package/dist/mqtt.js
CHANGED
|
@@ -12634,7 +12634,7 @@ var mqtt = (() => {
|
|
|
12634
12634
|
// package-json:../../package.json
|
|
12635
12635
|
var require_package = __commonJS({
|
|
12636
12636
|
"package-json:../../package.json"(exports5, module) {
|
|
12637
|
-
module.exports = { version: "5.
|
|
12637
|
+
module.exports = { version: "5.7.0" };
|
|
12638
12638
|
}
|
|
12639
12639
|
});
|
|
12640
12640
|
|
|
@@ -21395,6 +21395,7 @@ var mqtt = (() => {
|
|
|
21395
21395
|
}
|
|
21396
21396
|
}
|
|
21397
21397
|
function connect(brokerUrl, opts) {
|
|
21398
|
+
var _a, _b, _c;
|
|
21398
21399
|
debug("connecting to an MQTT broker...");
|
|
21399
21400
|
if (typeof brokerUrl === "object" && !opts) {
|
|
21400
21401
|
opts = brokerUrl;
|
|
@@ -21402,21 +21403,27 @@ var mqtt = (() => {
|
|
|
21402
21403
|
}
|
|
21403
21404
|
opts = opts || {};
|
|
21404
21405
|
if (brokerUrl && typeof brokerUrl === "string") {
|
|
21405
|
-
const
|
|
21406
|
-
|
|
21407
|
-
|
|
21408
|
-
|
|
21409
|
-
|
|
21410
|
-
|
|
21411
|
-
|
|
21412
|
-
|
|
21413
|
-
|
|
21414
|
-
|
|
21415
|
-
|
|
21416
|
-
|
|
21406
|
+
const parsedUrl = url_1.default.parse(brokerUrl, true);
|
|
21407
|
+
const parsedOptions = {};
|
|
21408
|
+
if (parsedUrl.port != null) {
|
|
21409
|
+
parsedOptions.port = Number(parsedUrl.port);
|
|
21410
|
+
}
|
|
21411
|
+
parsedOptions.host = parsedUrl.hostname;
|
|
21412
|
+
parsedOptions.query = parsedUrl.query;
|
|
21413
|
+
parsedOptions.auth = parsedUrl.auth;
|
|
21414
|
+
parsedOptions.protocol = parsedUrl.protocol;
|
|
21415
|
+
parsedOptions.path = parsedUrl.path;
|
|
21416
|
+
parsedOptions.protocol = (_a = parsedOptions.protocol) === null || _a === void 0 ? void 0 : _a.replace(/:$/, "");
|
|
21417
|
+
opts = Object.assign(Object.assign({}, parsedOptions), opts);
|
|
21418
|
+
if (!opts.protocol) {
|
|
21417
21419
|
throw new Error("Missing protocol");
|
|
21418
21420
|
}
|
|
21419
|
-
|
|
21421
|
+
}
|
|
21422
|
+
opts.unixSocket = opts.unixSocket || ((_b = opts.protocol) === null || _b === void 0 ? void 0 : _b.includes("+unix"));
|
|
21423
|
+
if (opts.unixSocket) {
|
|
21424
|
+
opts.protocol = opts.protocol.replace("+unix", "");
|
|
21425
|
+
} else if (!((_c = opts.protocol) === null || _c === void 0 ? void 0 : _c.startsWith("ws"))) {
|
|
21426
|
+
delete opts.path;
|
|
21420
21427
|
}
|
|
21421
21428
|
parseAuthOptions(opts);
|
|
21422
21429
|
if (opts.query && typeof opts.query.clientId === "string") {
|