@node-red/nodes 2.2.0-beta.1 → 2.2.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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright JS Foundation and other contributors, http://js.foundation
1
+ Copyright OpenJS Foundation and other contributors, https://openjsf.org/
2
2
 
3
3
  Apache License
4
4
  Version 2.0, January 2004
@@ -234,7 +234,7 @@
234
234
  }
235
235
  } else if (v[i].vt === "jsonata") {
236
236
  try{jsonata(v[i].v);}catch(e){return false;}
237
- } else if ([i].vt === "json") {
237
+ } else if (v[i].vt === "json") {
238
238
  try{JSON.parse(v[i].v);}catch(e){return false;}
239
239
  }
240
240
  }
@@ -112,6 +112,7 @@ module.exports = function(RED) {
112
112
  "var node = {"+
113
113
  "id:__node__.id,"+
114
114
  "name:__node__.name,"+
115
+ "path:__node__.path,"+
115
116
  "outputCount:__node__.outputCount,"+
116
117
  "log:__node__.log,"+
117
118
  "error:__node__.error,"+
@@ -163,6 +164,7 @@ module.exports = function(RED) {
163
164
  __node__: {
164
165
  id: node.id,
165
166
  name: node.name,
167
+ path: node._path,
166
168
  outputCount: node.outputs,
167
169
  log: function() {
168
170
  node.log.apply(node, arguments);
@@ -344,6 +346,7 @@ module.exports = function(RED) {
344
346
  var node = {
345
347
  id:__node__.id,
346
348
  name:__node__.name,
349
+ path:__node__.path,
347
350
  outputCount:__node__.outputCount,
348
351
  log:__node__.log,
349
352
  error:__node__.error,
@@ -366,6 +369,7 @@ module.exports = function(RED) {
366
369
  var node = {
367
370
  id:__node__.id,
368
371
  name:__node__.name,
372
+ path:__node__.path,
369
373
  outputCount:__node__.outputCount,
370
374
  log:__node__.log,
371
375
  error:__node__.error,
@@ -114,7 +114,8 @@
114
114
  timeout: {value:"5", required:true, validate:function(v) { return RED.validators.number(v) && (v >= 0); }},
115
115
  timeoutUnits: {value:"seconds"},
116
116
  rate: {value:"1", required:true, validate:function(v) { return RED.validators.number(v) && (v >= 0); }},
117
- nbRateUnits: {value:"1", required:false, validate:RED.validators.regex(/\d+|/)},
117
+ nbRateUnits: {value:"1", required:false,
118
+ validate:function(v) { return RED.validators.number(v) && (v >= 0); }},
118
119
  rateUnits: {value: "second"},
119
120
  randomFirst: {value:"1", required:true, validate:function(v) { return RED.validators.number(v) && (v >= 0); }},
120
121
  randomLast: {value:"5", required:true, validate:function(v) { return RED.validators.number(v) && (v >= 0); }},
@@ -288,7 +288,7 @@ module.exports = function(RED) {
288
288
  //TODO: delete msg.responseTopic - to prevent it being resent?
289
289
  }
290
290
  }
291
- topicOK = topicOK && !/[\+#]/.test(msg.topic);
291
+ topicOK = topicOK && !/[\+#\b\f\n\r\t\v\0]/.test(msg.topic);
292
292
 
293
293
  if (topicOK) {
294
294
  node.brokerConn.publish(msg, done); // send the message
@@ -730,12 +730,18 @@ module.exports = function(RED) {
730
730
  node.client.on("reconnect", function() {
731
731
  setStatusConnecting(node, true);
732
732
  });
733
- //TODO: what to do with this event? Anything? Necessary?
733
+ //Broker Disconnect - V5 event
734
734
  node.client.on("disconnect", function(packet) {
735
735
  //Emitted after receiving disconnect packet from broker. MQTT 5.0 feature.
736
- var rc = packet && packet.properties && packet.properties.reasonString;
737
- var rc = packet && packet.properties && packet.reasonCode;
738
- //TODO: If keeping this event, do we use these? log these?
736
+ const rc = (packet && packet.properties && packet.reasonCode) || packet.reasonCode;
737
+ const rs = packet && packet.properties && packet.properties.reasonString || "";
738
+ const details = {
739
+ broker: (node.clientid?node.clientid+"@":"")+node.brokerurl,
740
+ reasonCode: rc,
741
+ reasonString: rs
742
+ }
743
+ node.log(RED._("mqtt.state.broker-disconnected", details));
744
+ setStatusDisconnected(node, true);
739
745
  });
740
746
  // Register disconnect handlers
741
747
  node.client.on('close', function () {
@@ -264,7 +264,7 @@ in your Node-RED user directory (${RED.settings.userDir}).
264
264
  if (opts.headers.hasOwnProperty('cookie')) {
265
265
  var cookies = cookie.parse(opts.headers.cookie, {decode:String});
266
266
  for (var name in cookies) {
267
- opts.cookieJar.setCookie(cookie.serialize(name, cookies[name], {encode:String}), url, {ignoreError: true});
267
+ opts.cookieJar.setCookieSync(cookie.serialize(name, cookies[name], {encode:String}), url, {ignoreError: true});
268
268
  }
269
269
  delete opts.headers.cookie;
270
270
  }
@@ -277,13 +277,13 @@ in your Node-RED user directory (${RED.settings.userDir}).
277
277
  } else if (typeof msg.cookies[name] === 'object') {
278
278
  if(msg.cookies[name].encode === false){
279
279
  // If the encode option is false, the value is not encoded.
280
- opts.cookieJar.setCookie(cookie.serialize(name, msg.cookies[name].value, {encode: String}), url, {ignoreError: true});
280
+ opts.cookieJar.setCookieSync(cookie.serialize(name, msg.cookies[name].value, {encode: String}), url, {ignoreError: true});
281
281
  } else {
282
282
  // The value is encoded by encodeURIComponent().
283
- opts.cookieJar.setCookie(cookie.serialize(name, msg.cookies[name].value), url, {ignoreError: true});
283
+ opts.cookieJar.setCookieSync(cookie.serialize(name, msg.cookies[name].value), url, {ignoreError: true});
284
284
  }
285
285
  } else {
286
- opts.cookieJar.setCookie(cookie.serialize(name, msg.cookies[name]), url, {ignoreError: true});
286
+ opts.cookieJar.setCookieSync(cookie.serialize(name, msg.cookies[name]), url, {ignoreError: true});
287
287
  }
288
288
  }
289
289
  }
@@ -442,7 +442,8 @@
442
442
  "state": {
443
443
  "connected": "Connected to broker: __broker__",
444
444
  "disconnected": "Disconnected from broker: __broker__",
445
- "connect-failed": "Connection failed to broker: __broker__"
445
+ "connect-failed": "Connection failed to broker: __broker__",
446
+ "broker-disconnected": "Broker __broker__ disconnected client: __reasonCode__ __reasonString__"
446
447
  },
447
448
  "retain": "Retain",
448
449
  "output": {
@@ -442,7 +442,8 @@
442
442
  "state": {
443
443
  "connected": "ブローカへ接続しました: __broker__",
444
444
  "disconnected": "ブローカから切断されました: __broker__",
445
- "connect-failed": "ブローカへの接続に失敗しました: __broker__"
445
+ "connect-failed": "ブローカへの接続に失敗しました: __broker__",
446
+ "broker-disconnected": "ブローカ __broker__ がクライアントを切断しました: __reasonCode__ __reasonString__"
446
447
  },
447
448
  "retain": "保持",
448
449
  "output": {
@@ -580,7 +581,9 @@
580
581
  "server": "サーバ",
581
582
  "return": "戻り値",
582
583
  "ms": "ミリ秒",
583
- "chars": "文字"
584
+ "chars": "文字",
585
+ "close": "終了",
586
+ "optional": "(任意)"
584
587
  },
585
588
  "type": {
586
589
  "listen": "待ち受け",
@@ -619,7 +622,8 @@
619
622
  "socket-error": "__host__:__port__ にてソケットのエラーが生じました",
620
623
  "no-host": "ホスト名またはポートが設定されていません",
621
624
  "connect-timeout": "接続がタイムアウトしました",
622
- "connect-fail": "接続に失敗しました"
625
+ "connect-fail": "接続に失敗しました",
626
+ "bad-string": "文字列への変換に失敗しました"
623
627
  }
624
628
  },
625
629
  "udp": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-red/nodes",
3
- "version": "2.2.0-beta.1",
3
+ "version": "2.2.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,7 +17,7 @@
17
17
  "dependencies": {
18
18
  "acorn": "8.7.0",
19
19
  "acorn-walk": "8.2.0",
20
- "ajv": "8.8.2",
20
+ "ajv": "8.9.0",
21
21
  "body-parser": "1.19.1",
22
22
  "cheerio": "1.0.0-rc.10",
23
23
  "content-type": "1.0.4",
@@ -37,13 +37,13 @@
37
37
  "js-yaml": "3.14.1",
38
38
  "media-typer": "1.1.0",
39
39
  "mqtt": "4.3.4",
40
- "multer": "1.4.3",
40
+ "multer": "1.4.4",
41
41
  "mustache": "4.2.0",
42
42
  "on-headers": "1.0.2",
43
43
  "raw-body": "2.4.2",
44
44
  "tough-cookie": "4.0.0",
45
45
  "uuid": "8.3.2",
46
- "ws": "7.5.1",
46
+ "ws": "7.5.6",
47
47
  "xml2js": "0.4.23",
48
48
  "iconv-lite": "0.6.3"
49
49
  }