mqtt 5.10.4 → 5.11.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 -0
- package/build/lib/client.d.ts +2 -0
- package/build/lib/client.js.map +1 -1
- package/build/lib/connect/index.js +7 -0
- package/build/lib/connect/index.js.map +1 -1
- package/build/lib/connect/socks.d.ts +8 -0
- package/build/lib/connect/socks.js +183 -0
- package/build/lib/connect/socks.js.map +1 -0
- package/build/lib/connect/tcp.js +6 -0
- package/build/lib/connect/tcp.js.map +1 -1
- package/build/lib/connect/tls.js +20 -1
- package/build/lib/connect/tls.js.map +1 -1
- package/build/lib/validations.d.ts +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/dist/mqtt.esm.js +5 -5
- package/dist/mqtt.js +45 -4
- package/dist/mqtt.min.js +5 -5
- package/package.json +4 -3
- package/src/lib/client.ts +4 -0
- package/src/lib/connect/index.ts +9 -0
- package/src/lib/connect/socks.ts +236 -0
- package/src/lib/connect/tcp.ts +7 -0
- package/src/lib/connect/tls.ts +19 -2
- package/src/lib/validations.ts +1 -1
package/dist/mqtt.js
CHANGED
|
@@ -11140,7 +11140,9 @@ var mqtt = (() => {
|
|
|
11140
11140
|
let propLength = 0;
|
|
11141
11141
|
let propValueLength = 0;
|
|
11142
11142
|
const propValue = properties[propName];
|
|
11143
|
-
if (
|
|
11143
|
+
if (propValue === void 0) {
|
|
11144
|
+
continue;
|
|
11145
|
+
} else if (Array.isArray(propValue)) {
|
|
11144
11146
|
for (let valueIndex = 0; valueIndex < propValue.length; valueIndex++) {
|
|
11145
11147
|
propValueLength = getLengthProperty(propName, propValue[valueIndex]);
|
|
11146
11148
|
if (!propValueLength) {
|
|
@@ -11246,7 +11248,7 @@ var mqtt = (() => {
|
|
|
11246
11248
|
function writeProperties(stream, properties, propertiesLength) {
|
|
11247
11249
|
writeVarByteInt(stream, propertiesLength);
|
|
11248
11250
|
for (const propName in properties) {
|
|
11249
|
-
if (Object.prototype.hasOwnProperty.call(properties, propName) && properties[propName]
|
|
11251
|
+
if (Object.prototype.hasOwnProperty.call(properties, propName) && properties[propName] != null) {
|
|
11250
11252
|
const value = properties[propName];
|
|
11251
11253
|
if (Array.isArray(value)) {
|
|
11252
11254
|
for (let valueIndex = 0; valueIndex < value.length; valueIndex++) {
|
|
@@ -11810,7 +11812,7 @@ var mqtt = (() => {
|
|
|
11810
11812
|
// package-json:../../package.json
|
|
11811
11813
|
var require_package = __commonJS({
|
|
11812
11814
|
"package-json:../../package.json"(exports5, module) {
|
|
11813
|
-
module.exports = { version: "5.
|
|
11815
|
+
module.exports = { version: "5.11.0" };
|
|
11814
11816
|
}
|
|
11815
11817
|
});
|
|
11816
11818
|
|
|
@@ -20121,6 +20123,16 @@ var mqtt = (() => {
|
|
|
20121
20123
|
}
|
|
20122
20124
|
});
|
|
20123
20125
|
|
|
20126
|
+
// socks-stub:./socks
|
|
20127
|
+
var require_socks = __commonJS({
|
|
20128
|
+
"socks-stub:./socks"(exports5, module) {
|
|
20129
|
+
init_dirname();
|
|
20130
|
+
init_buffer2();
|
|
20131
|
+
init_process2();
|
|
20132
|
+
module.exports = {};
|
|
20133
|
+
}
|
|
20134
|
+
});
|
|
20135
|
+
|
|
20124
20136
|
// build/lib/connect/tcp.js
|
|
20125
20137
|
var require_tcp = __commonJS({
|
|
20126
20138
|
"build/lib/connect/tcp.js"(exports5) {
|
|
@@ -20134,10 +20146,16 @@ var mqtt = (() => {
|
|
|
20134
20146
|
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
20135
20147
|
var net_1 = __importDefault((init_net(), __toCommonJS(net_exports)));
|
|
20136
20148
|
var debug_1 = __importDefault(require_browser4());
|
|
20149
|
+
var socks_1 = __importDefault(require_socks());
|
|
20137
20150
|
var debug = (0, debug_1.default)("mqttjs:tcp");
|
|
20138
20151
|
var buildStream = (client, opts) => {
|
|
20139
20152
|
opts.port = opts.port || 1883;
|
|
20140
20153
|
opts.hostname = opts.hostname || opts.host || "localhost";
|
|
20154
|
+
if (opts.socksProxy) {
|
|
20155
|
+
return (0, socks_1.default)(opts.hostname, opts.port, opts.socksProxy, {
|
|
20156
|
+
timeout: opts.socksTimeout
|
|
20157
|
+
});
|
|
20158
|
+
}
|
|
20141
20159
|
const { port, path: path2 } = opts;
|
|
20142
20160
|
const host = opts.hostname;
|
|
20143
20161
|
debug("port %d and host %s", port, host);
|
|
@@ -20169,6 +20187,17 @@ var mqtt = (() => {
|
|
|
20169
20187
|
init_dirname();
|
|
20170
20188
|
init_buffer2();
|
|
20171
20189
|
init_process2();
|
|
20190
|
+
var __rest = exports5 && exports5.__rest || function(s4, e6) {
|
|
20191
|
+
var t5 = {};
|
|
20192
|
+
for (var p5 in s4) if (Object.prototype.hasOwnProperty.call(s4, p5) && e6.indexOf(p5) < 0)
|
|
20193
|
+
t5[p5] = s4[p5];
|
|
20194
|
+
if (s4 != null && typeof Object.getOwnPropertySymbols === "function")
|
|
20195
|
+
for (var i5 = 0, p5 = Object.getOwnPropertySymbols(s4); i5 < p5.length; i5++) {
|
|
20196
|
+
if (e6.indexOf(p5[i5]) < 0 && Object.prototype.propertyIsEnumerable.call(s4, p5[i5]))
|
|
20197
|
+
t5[p5[i5]] = s4[p5[i5]];
|
|
20198
|
+
}
|
|
20199
|
+
return t5;
|
|
20200
|
+
};
|
|
20172
20201
|
var __importDefault = exports5 && exports5.__importDefault || function(mod) {
|
|
20173
20202
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
20174
20203
|
};
|
|
@@ -20176,7 +20205,14 @@ var mqtt = (() => {
|
|
|
20176
20205
|
var tls_1 = __importDefault((init_empty(), __toCommonJS(empty_exports)));
|
|
20177
20206
|
var net_1 = __importDefault((init_net(), __toCommonJS(net_exports)));
|
|
20178
20207
|
var debug_1 = __importDefault(require_browser4());
|
|
20208
|
+
var socks_1 = __importDefault(require_socks());
|
|
20179
20209
|
var debug = (0, debug_1.default)("mqttjs:tls");
|
|
20210
|
+
function connect(opts) {
|
|
20211
|
+
const { host, port, socksProxy } = opts, rest = __rest(opts, ["host", "port", "socksProxy"]);
|
|
20212
|
+
return tls_1.default.connect(socksProxy ? Object.assign(Object.assign({}, rest), { socket: (0, socks_1.default)(host, port, socksProxy, {
|
|
20213
|
+
timeout: opts.socksTimeout
|
|
20214
|
+
}) }) : opts);
|
|
20215
|
+
}
|
|
20180
20216
|
var buildStream = (client, opts) => {
|
|
20181
20217
|
opts.port = opts.port || 8883;
|
|
20182
20218
|
opts.host = opts.hostname || opts.host || "localhost";
|
|
@@ -20186,7 +20222,7 @@ var mqtt = (() => {
|
|
|
20186
20222
|
opts.rejectUnauthorized = opts.rejectUnauthorized !== false;
|
|
20187
20223
|
delete opts.path;
|
|
20188
20224
|
debug("port %d host %s rejectUnauthorized %b", opts.port, opts.host, opts.rejectUnauthorized);
|
|
20189
|
-
const connection =
|
|
20225
|
+
const connection = connect(opts);
|
|
20190
20226
|
connection.on("secureConnect", () => {
|
|
20191
20227
|
if (opts.rejectUnauthorized && !connection.authorized) {
|
|
20192
20228
|
connection.emit("error", new Error("TLS not authorized"));
|
|
@@ -20509,6 +20545,11 @@ var mqtt = (() => {
|
|
|
20509
20545
|
if (opts.query && typeof opts.query.clientId === "string") {
|
|
20510
20546
|
opts.clientId = opts.query.clientId;
|
|
20511
20547
|
}
|
|
20548
|
+
if (is_browser_1.default || opts.unixSocket) {
|
|
20549
|
+
opts.socksProxy = void 0;
|
|
20550
|
+
} else if (opts.socksProxy === void 0 && typeof process_exports !== "undefined") {
|
|
20551
|
+
opts.socksProxy = process_exports.env["MQTTJS_SOCKS_PROXY"];
|
|
20552
|
+
}
|
|
20512
20553
|
if (opts.cert && opts.key) {
|
|
20513
20554
|
if (opts.protocol) {
|
|
20514
20555
|
if (["mqtts", "wss", "wxs", "alis"].indexOf(opts.protocol) === -1) {
|