@node-red/nodes 4.0.2 → 4.0.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.
@@ -104,14 +104,14 @@ module.exports = function(RED) {
104
104
  if (this.credentials && this.credentials.passphrase) {
105
105
  opts.passphrase = this.credentials.passphrase;
106
106
  }
107
- if (this.servername) {
108
- opts.servername = this.servername;
109
- }
110
- if (this.alpnprotocol) {
111
- opts.ALPNProtocols = [this.alpnprotocol];
112
- }
113
- opts.rejectUnauthorized = this.verifyservercert;
114
107
  }
108
+ if (this.servername) {
109
+ opts.servername = this.servername;
110
+ }
111
+ if (this.alpnprotocol) {
112
+ opts.ALPNProtocols = [this.alpnprotocol];
113
+ }
114
+ opts.rejectUnauthorized = this.verifyservercert;
115
115
  return opts;
116
116
  }
117
117
 
@@ -673,6 +673,8 @@ module.exports = function(RED) {
673
673
  delete node.options.protocolId; //V4+ default
674
674
  delete node.options.protocolVersion; //V4 default
675
675
  delete node.options.properties;//V5 only
676
+
677
+
676
678
  if (node.compatmode == "true" || node.compatmode === true || node.protocolVersion == 3) {
677
679
  node.options.protocolId = 'MQIsdp';//V3 compat only
678
680
  node.options.protocolVersion = 3;
@@ -691,6 +693,21 @@ module.exports = function(RED) {
691
693
  setIntProp(node,node.options.properties,"sessionExpiryInterval");
692
694
  }
693
695
  }
696
+ // Ensure will payload, if set, is a string
697
+ if (node.options.will && Object.hasOwn(node.options.will, 'payload')) {
698
+ let payload = node.options.will.payload
699
+ if (payload === null || typeof payload === 'undefined') {
700
+ payload = "";
701
+ } else if (!Buffer.isBuffer(payload)) {
702
+ if (typeof payload === "object") {
703
+ payload = JSON.stringify(payload);
704
+ } else if (typeof payload !== "string") {
705
+ payload = "" + payload;
706
+ }
707
+ }
708
+ node.options.will.payload = payload
709
+ }
710
+
694
711
  if (node.usetls && n.tls) {
695
712
  var tlsNode = RED.nodes.getNode(n.tls);
696
713
  if (tlsNode) {
@@ -725,6 +742,7 @@ module.exports = function(RED) {
725
742
  };
726
743
 
727
744
  node.deregister = function(mqttNode, done, autoDisconnect) {
745
+ setStatusDisconnected(mqttNode, false);
728
746
  delete node.users[mqttNode.id];
729
747
  if (autoDisconnect && !node.closing && node.connected && Object.keys(node.users).length === 0) {
730
748
  node.disconnect(done);
@@ -21,7 +21,7 @@
21
21
  <input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
22
22
  </div>
23
23
  <div class="form-row">
24
- <label for="node-input-property"><i class="fa fa-forward"></i> <span data-i18n="split.split"></span></label>
24
+ <label for="node-input-property"><i class="fa fa-forward"></i> <span data-i18n="split.splitThe"></span></label>
25
25
  <input type="text" id="node-input-property" style="width:70%;"/>
26
26
  </div>
27
27
  <div class="form-row"><span data-i18n="[html]split.strBuff"></span></div>
@@ -36,6 +36,10 @@
36
36
  <label style="margin-left: 10px; width: 175px;" for="node-input-overlap" data-i18n="batch.count.overlap"></label>
37
37
  <input type="text" id="node-input-overlap" style="width: 50px;">
38
38
  </div>
39
+ <div class="form-row">
40
+ <input type="checkbox" id="node-input-honourParts" style="margin-left: 10px; margin-right:10px; vertical-align:top; width:auto;">
41
+ <label for="node-input-honourParts" style="width:auto;" data-i18n="batch.honourParts"></label>
42
+ </div>
39
43
  </div>
40
44
 
41
45
  <div class="node-row-msg-interval">
@@ -45,7 +49,7 @@
45
49
  <span data-i18n="batch.interval.seconds"></span>
46
50
  </div>
47
51
  <div class="form-row">
48
- <input type="checkbox" id="node-input-allowEmptySequence" style="margin-left:20px; margin-right: 10px; vertical-align:top; width:auto;">
52
+ <input type="checkbox" id="node-input-allowEmptySequence" style="margin-left:20px; margin-right:10px; vertical-align:top; width:auto;">
49
53
  <label for="node-input-allowEmptySequence" style="width:auto;" data-i18n="batch.interval.empty"></label>
50
54
  </div>
51
55
  </div>
@@ -101,6 +105,7 @@
101
105
  }
102
106
  },
103
107
  allowEmptySequence: {value:false},
108
+ honourParts: {value:false},
104
109
  topics: {value:[{topic:""}]}
105
110
  },
106
111
  inputs:1,
@@ -181,6 +181,8 @@ module.exports = function(RED) {
181
181
  RED.nodes.createNode(this,n);
182
182
  var node = this;
183
183
  var mode = n.mode || "count";
184
+ var eof = false;
185
+ node.honourParts = n.honourParts || false;
184
186
 
185
187
  node.pending_count = 0;
186
188
  if (mode === "count") {
@@ -201,9 +203,12 @@ module.exports = function(RED) {
201
203
  return;
202
204
  }
203
205
  var queue = node.pending;
206
+ if (node.honourParts && msg.hasOwnProperty("parts")) {
207
+ if (msg.parts.index + 1 === msg.parts.count) { eof = true; }
208
+ }
204
209
  queue.push({msg, send, done});
205
210
  node.pending_count++;
206
- if (queue.length === count) {
211
+ if (queue.length === count || eof === true) {
207
212
  send_msgs(node, queue, is_overlap);
208
213
  for (let i = 0; i < queue.length-overlap; i++) {
209
214
  queue[i].done();
@@ -211,6 +216,7 @@ module.exports = function(RED) {
211
216
  node.pending =
212
217
  (overlap === 0) ? [] : queue.slice(-overlap);
213
218
  node.pending_count = 0;
219
+ eof = false;
214
220
  }
215
221
  var max_msgs = max_kept_msgs_count(node);
216
222
  if ((max_msgs > 0) && (node.pending_count > max_msgs)) {
@@ -1 +1 @@
1
- [{"id":"827a48c0.912d88","type":"comment","z":"ff17dfa9.8fa6d","name":"Map property between different numeric ranges","info":"Range node can scale a number from one numeric range to another.\n\nSee Node-RED cookbook [item](https://cookbook.nodered.org/basic/map-between-different-number-ranges).","x":240,"y":60,"wires":[]},{"id":"bb23bd77.ce725","type":"inject","z":"ff17dfa9.8fa6d","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"0","payloadType":"num","x":170,"y":120,"wires":[["42ed281c.790b38"]]},{"id":"42ed281c.790b38","type":"range","z":"ff17dfa9.8fa6d","minin":"0","maxin":"1023","minout":"0","maxout":"5","action":"clamp","round":false,"name":"","x":390,"y":160,"wires":[["56e6dd0f.436c24"]]},{"id":"54659d5c.0283e4","type":"inject","z":"ff17dfa9.8fa6d","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"512","payloadType":"num","x":170,"y":160,"wires":[["42ed281c.790b38"]]},{"id":"85ce0127.07b06","type":"inject","z":"ff17dfa9.8fa6d","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"1023","payloadType":"num","x":170,"y":200,"wires":[["42ed281c.790b38"]]},{"id":"56e6dd0f.436c24","type":"debug","z":"ff17dfa9.8fa6d","name":"","active":true,"console":"false","complete":"false","x":590,"y":160,"wires":[]}]
1
+ [{"id":"827a48c0.912d88","type":"comment","z":"ff17dfa9.8fa6d","name":"Map property between different numeric ranges","info":"Range node can scale a number from one numeric range to another.\n\nSee Node-RED cookbook [item](https://cookbook.nodered.org/basic/map-between-different-number-ranges).","x":240,"y":60,"wires":[]},{"id":"bb23bd77.ce725","type":"inject","z":"ff17dfa9.8fa6d","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"0","payloadType":"num","x":170,"y":120,"wires":[["42ed281c.790b38"]]},{"id":"42ed281c.790b38","type":"range","z":"ff17dfa9.8fa6d","minin":"0","maxin":"1023","minout":"0","maxout":"5","action":"clamp","round":false,"property":"payload","name":"","x":390,"y":160,"wires":[["56e6dd0f.436c24"]]},{"id":"54659d5c.0283e4","type":"inject","z":"ff17dfa9.8fa6d","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"512","payloadType":"num","x":170,"y":160,"wires":[["42ed281c.790b38"]]},{"id":"85ce0127.07b06","type":"inject","z":"ff17dfa9.8fa6d","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"1023","payloadType":"num","x":170,"y":200,"wires":[["42ed281c.790b38"]]},{"id":"56e6dd0f.436c24","type":"debug","z":"ff17dfa9.8fa6d","name":"","active":true,"console":"false","complete":"false","x":590,"y":160,"wires":[]}]
@@ -912,6 +912,7 @@
912
912
  "objectSend": "Sende eine Nachricht für jedes Schlüssel/Wert-Paar",
913
913
  "strBuff": "<b>string</b> / <b>buffer</b>",
914
914
  "array": "<b>array</b>",
915
+ "splitThe": "Split",
915
916
  "splitUsing": "Aufteilung",
916
917
  "splitLength": "feste Längen von",
917
918
  "stream": "Als Nachrichtenstrom behandeln (Streaming-Modus)",
@@ -1011,12 +1011,13 @@
1011
1011
  "tip": "Tip: The filename should be an absolute path, otherwise it will be relative to the working directory of the Node-RED process."
1012
1012
  },
1013
1013
  "split": {
1014
- "split": "Split",
1014
+ "split": "split",
1015
1015
  "intro": "Split <code>msg.payload</code> based on type:",
1016
1016
  "object": "<b>Object</b>",
1017
1017
  "objectSend": "Send a message for each key/value pair",
1018
1018
  "strBuff": "<b>String</b> / <b>Buffer</b>",
1019
1019
  "array": "<b>Array</b>",
1020
+ "splitThe": "Split the",
1020
1021
  "splitUsing": "Split using",
1021
1022
  "splitLength": "Fixed length of",
1022
1023
  "stream": "Handle as a stream of messages",
@@ -1113,6 +1114,7 @@
1113
1114
  "too-many": "too many pending messages in batch node",
1114
1115
  "unexpected": "unexpected mode",
1115
1116
  "no-parts": "no parts property in message",
1117
+ "honourParts": "Allow msg.parts to also complete batch operation.",
1116
1118
  "error": {
1117
1119
  "invalid-count": "Invalid count",
1118
1120
  "invalid-overlap": "Invalid overlap",
@@ -1017,6 +1017,7 @@
1017
1017
  "objectSend": "Envoie un message pour chaque paire clé/valeur",
1018
1018
  "strBuff": "<b>Chaîne</b> / <b>Tampon</b>",
1019
1019
  "array": "<b>Tableau</b>",
1020
+ "splitThe": "Diviser le",
1020
1021
  "splitUsing": "Diviser en utilisant",
1021
1022
  "splitLength": "Longueur fixe de",
1022
1023
  "stream": "Gérer comme un flux de messages",
@@ -1046,6 +1047,7 @@
1046
1047
  "joinedUsing": "joint en utilisant",
1047
1048
  "send": "Envoyer le message :",
1048
1049
  "afterCount": "Après un nombre de parties du message",
1050
+ "useparts": "Utiliser la propriété msg.parts existante",
1049
1051
  "count": "nombre",
1050
1052
  "subsequent": "Et tous les messages suivants.",
1051
1053
  "afterTimeout": "Après un délai d'attente après le premier message",
@@ -1112,6 +1114,7 @@
1112
1114
  "too-many": "Trop de messages en attente dans le noeud batch",
1113
1115
  "unexpected": "Mode inattendu",
1114
1116
  "no-parts": "Aucune propriété de pièces dans le message",
1117
+ "honourParts": "Autoriser msg.parts à compléter les opération par lots",
1115
1118
  "error": {
1116
1119
  "invalid-count": "Compte invalide",
1117
1120
  "invalid-overlap": "Recouvrement invalide",
@@ -1017,6 +1017,7 @@
1017
1017
  "objectSend": "各key/valueペアのメッセージを送信",
1018
1018
  "strBuff": "<b>文字列</b> / <b>バッファ</b>",
1019
1019
  "array": "<b>配列</b>",
1020
+ "splitThe": "に基づく",
1020
1021
  "splitUsing": "分割",
1021
1022
  "splitLength": "固定長",
1022
1023
  "stream": "メッセージのストリームとして処理",
@@ -1046,6 +1047,7 @@
1046
1047
  "joinedUsing": "連結文字",
1047
1048
  "send": "メッセージ送信:",
1048
1049
  "afterCount": "指定数のメッセージパーツを受信後",
1050
+ "useparts": "既存のmsg.partsプロパティを使用",
1049
1051
  "count": "合計値",
1050
1052
  "subsequent": "後続のメッセージ毎",
1051
1053
  "afterTimeout": "最初のメッセージ受信からのタイムアウト後",
@@ -1112,6 +1114,7 @@
1112
1114
  "too-many": "batchノード内で保持しているメッセージが多すぎます",
1113
1115
  "unexpected": "想定外のモード",
1114
1116
  "no-parts": "メッセージにpartsプロパティがありません",
1117
+ "honourParts": "msg.partsを用いたbatch操作を許可",
1115
1118
  "error": {
1116
1119
  "invalid-count": "メッセージ数が不正",
1117
1120
  "invalid-overlap": "オーバラップが不正",
@@ -44,7 +44,7 @@
44
44
  "global": "contexto global",
45
45
  "str": "Cadeia de caracteres",
46
46
  "num": "número",
47
- "bool": "booliano",
47
+ "bool": "booliano",
48
48
  "json": "objeto",
49
49
  "bin": "Armazenamento temporário",
50
50
  "date": "Carimbo de data/hora",
@@ -352,8 +352,8 @@
352
352
  }
353
353
  },
354
354
  "trigger": {
355
- "send": "Enviar",
356
- "then": "então",
355
+ "send": "Enviar",
356
+ "then": "então",
357
357
  "then-send": "então enviem",
358
358
  "output": {
359
359
  "string": "a cadeia de caracteres",
@@ -446,7 +446,7 @@
446
446
  "staticTopic": "Assinar um tópico único",
447
447
  "dynamicTopic": "Assinatura dinâmica",
448
448
  "auto-connect": "Conectar automaticamente",
449
- "auto-mode-depreciated": "Esta opção está deprecada. Favor utilizar o novo modo de auto-detecção."
449
+ "auto-mode-depreciated": "Esta opção está deprecada. Favor utilizar o novo modo de auto-detecção."
450
450
  },
451
451
  "sections-label": {
452
452
  "birth-message": "Mensagem enviada na conexão (mensagem de nascimento)",
@@ -466,8 +466,8 @@
466
466
  "close-topic": "Deixe em branco para desativar a mensagem de fechamento"
467
467
  },
468
468
  "state": {
469
- "connected": "Conectado ao negociante: _ broker _",
470
- "disconnected": "Desconectado do negociante: _ broker _",
469
+ "connected": "Conectado ao negociante: _ broker _",
470
+ "disconnected": "Desconectado do negociante: _ broker _",
471
471
  "connect-failed": "Falha na conexão com o negociante: __broker__",
472
472
  "broker-disconnected": "Cliente de negociante __broker__ desconectado: __reasonCode__ __reasonString__"
473
473
  },
@@ -898,7 +898,7 @@
898
898
  "o2j": "Objeto para opções JSON",
899
899
  "pretty": "Formatar cadeia de caracteres JSON",
900
900
  "action": "Ação",
901
- "property": "Propriedade",
901
+ "property": "Propriedade",
902
902
  "actions": {
903
903
  "toggle": "Converter entre cadeia de caracteres JSON e Objeto",
904
904
  "str": "Sempre converter em cadeia de caracteres JSON",
@@ -929,7 +929,7 @@
929
929
  "write": "escrever arquivo",
930
930
  "read": "ler arquivo",
931
931
  "filename": "Nome do arquivo",
932
- "path": "caminho",
932
+ "path": "caminho",
933
933
  "action": "Ação",
934
934
  "addnewline": "Adicionar nova linha (\\n) a cada carga útil?",
935
935
  "createdir": "Criar diretório se não existir?",
@@ -994,6 +994,7 @@
994
994
  "objectSend": "Envia uma mensagem para cada par chave/valor",
995
995
  "strBuff": "<b>Cadeia de caracteres</b> / <b>Armazenamento Temporário</b>",
996
996
  "array": "<b>Matriz</b>",
997
+ "splitThe": "Dividir",
997
998
  "splitUsing": "Dividir usando",
998
999
  "splitLength": "Comprimento fixo de",
999
1000
  "stream": "Tratar como uma transmissão de mensagens",
@@ -1066,9 +1067,9 @@
1066
1067
  "batch" : {
1067
1068
  "batch": "lote",
1068
1069
  "mode": {
1069
- "label": "Modo",
1070
- "num-msgs": "Agrupar por número de mensagens",
1071
- "interval": "Agrupar por intervalo de tempo",
1070
+ "label": "Modo",
1071
+ "num-msgs": "Agrupar por número de mensagens",
1072
+ "interval": "Agrupar por intervalo de tempo",
1072
1073
  "concat": "Concatenar sequências"
1073
1074
  },
1074
1075
  "count": {
@@ -874,6 +874,7 @@
874
874
  "objectSend":"Отправлять сообщение для каждой пары ключ/значение",
875
875
  "strBuff":"<b>Строка</b> / <b>Буфер</b>",
876
876
  "array":"<b>Массив</b>",
877
+ "splitThe": "Pазделить",
877
878
  "splitUsing":"С помощью",
878
879
  "splitLength":"Фикс. длина",
879
880
  "stream":"Обрабатывать как поток сообщений",
@@ -997,6 +997,7 @@
997
997
  "objectSend": "每个键值对作为单个消息发送",
998
998
  "strBuff": "<b>字符串</b> / <b>Buffer</b>",
999
999
  "array": "<b>数组</b>",
1000
+ "splitThe": "Split",
1000
1001
  "splitUsing": "拆分使用",
1001
1002
  "splitLength": "固定长度",
1002
1003
  "stream": "作为消息流处理",
@@ -866,6 +866,7 @@
866
866
  "objectSend": "每個鍵值對作為單個消息發送",
867
867
  "strBuff": "<b>字串</b> / <b>Buffer</b>",
868
868
  "array": "<b>陣列</b>",
869
+ "splitThe": "Split",
869
870
  "splitUsing": "拆分使用",
870
871
  "splitLength": "固定長度",
871
872
  "stream": "作為消息流處理",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-red/nodes",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,10 +15,10 @@
15
15
  }
16
16
  ],
17
17
  "dependencies": {
18
- "acorn": "8.11.3",
19
- "acorn-walk": "8.3.2",
20
- "ajv": "8.14.0",
21
- "body-parser": "1.20.2",
18
+ "acorn": "8.12.1",
19
+ "acorn-walk": "8.3.4",
20
+ "ajv": "8.17.1",
21
+ "body-parser": "1.20.3",
22
22
  "cheerio": "1.0.0-rc.10",
23
23
  "content-type": "1.0.5",
24
24
  "cookie-parser": "1.4.6",
@@ -41,7 +41,7 @@
41
41
  "node-watch": "0.7.4",
42
42
  "on-headers": "1.0.2",
43
43
  "raw-body": "2.5.2",
44
- "tough-cookie": "4.1.4",
44
+ "tough-cookie": "^5.0.0",
45
45
  "uuid": "9.0.1",
46
46
  "ws": "7.5.10",
47
47
  "xml2js": "0.6.2",