@node-red/nodes 4.1.0 → 4.1.1

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.
@@ -118,7 +118,7 @@ module.exports = function(RED) {
118
118
  var exp = RED.util.prepareJSONataExpression(p.v, node);
119
119
  RED.util.evaluateJSONataExpression(exp, msg, (err, newValue) => {
120
120
  if (err) {
121
- errors.push(err.toString())
121
+ errors.push(RED._("inject.errors.invalid-expr",{error:err.message}))
122
122
  } else {
123
123
  RED.util.setMessageProperty(msg,property,newValue,true);
124
124
  }
@@ -437,6 +437,11 @@ RED.debug = (function() {
437
437
  var property = sanitize(o.property?o.property:'');
438
438
  var payload = o.msg;
439
439
  var format = sanitize((o.format||"").toString());
440
+ var baseFormat = format
441
+ // If format is "array[12]"/"Float32Array[12]" then strip off the size portion [12] for the decodeObject
442
+ if (/\w+\[\d+\]$/.test(baseFormat)) {
443
+ baseFormat = format.replace(/\[\d+\]$/,'');
444
+ }
440
445
  msg.attr("class", 'red-ui-debug-msg'+(o.level?(' red-ui-debug-msg-level-'+o.level):'')+
441
446
  (sourceNode?(
442
447
  " red-ui-debug-msg-node-"+sourceNode.id.replace(/\./g,"_")+
@@ -502,7 +507,7 @@ RED.debug = (function() {
502
507
  $('<span class="red-ui-debug-msg-name">'+name+'</span>').appendTo(metaRow);
503
508
  }
504
509
 
505
- payload = RED.utils.decodeObject(payload,format);
510
+ payload = RED.utils.decodeObject(payload, baseFormat);
506
511
 
507
512
  var el = $('<span class="red-ui-debug-msg-payload"></span>').appendTo(msg);
508
513
  var path = o.property||'';
@@ -64,6 +64,14 @@
64
64
  },
65
65
  inputs: 1,
66
66
  outputs: 1,
67
+ inputLabels: function() { return this.minin + " - " + this.maxin },
68
+ outputLabels: function(i) {
69
+ var outie = this.minout + " - " + this.maxout
70
+ if (this.action === "clamp") { outie = "[" + outie + "]" }
71
+ if (this.action === "drop") { outie = "x" + outie + "x" }
72
+ if (this.action === "roll") { outie = ">" + outie + ">" }
73
+ return outie;
74
+ },
67
75
  icon: "range.svg",
68
76
  label: function() {
69
77
  if (this.minout !== "" && this.maxout !== "") { return this.name||this.minout + " - " + this.maxout; }
@@ -24,6 +24,18 @@ module.exports = function(RED) {
24
24
  this.maxin = Number(n.maxin);
25
25
  this.minout = Number(n.minout);
26
26
  this.maxout = Number(n.maxout);
27
+ if (this.minin > this.maxin) {
28
+ let tmp = this.minin;
29
+ this.minin = this.maxin;
30
+ this.maxin = tmp;
31
+ tmp = this.minout;
32
+ this.minout = this.maxout;
33
+ this.maxout = tmp;
34
+ }
35
+ if (this.round) {
36
+ this.maxout = Math.floor(this.maxout);
37
+ this.minout = Math.ceil(this.minout);
38
+ }
27
39
  this.property = n.property||"payload";
28
40
  var node = this;
29
41
 
@@ -129,8 +129,17 @@ module.exports = function(RED) {
129
129
  if(typeof RED.httpNode === 'function' && (rootApp = getRootApp(RED.httpNode))) {
130
130
  // Add middleware to the stack
131
131
  rootApp.use(rawBodyCapture);
132
- // Move the middleware to top of the stack
133
- rootApp._router.stack.unshift(rootApp._router.stack.pop());
132
+ // Find the newly added middleware and move it to the top of the stack
133
+ // Do not assume its the last entry in the stack as some frameworks (eg loopback)
134
+ // add middleware in particular orders
135
+ for (let i = 0; i < rootApp._router.stack.length; i++) {
136
+ const layer = rootApp._router.stack[i];
137
+ if (layer && layer.handle === rawBodyCapture) {
138
+ // Move the middleware to top of the stack
139
+ rootApp._router.stack.unshift(rootApp._router.stack.splice(i, 1)[0]);
140
+ break;
141
+ }
142
+ }
134
143
  }
135
144
 
136
145
  function createRequestWrapper(node,req) {
@@ -152,7 +152,9 @@ in your Node-RED user directory (${RED.settings.userDir}).
152
152
  const asLowercase = name.toLowercase();
153
153
  return headersObject[Object.keys(headersObject).find(k => k.toLowerCase() === asLowercase)];
154
154
  }
155
+ this.count = 0;
155
156
  this.on("input",function(msg,nodeSend,nodeDone) {
157
+ node.count++;
156
158
  checkNodeAgentPatch();
157
159
  //reset redirectList on each request
158
160
  redirectList = [];
@@ -658,7 +660,10 @@ in your Node-RED user directory (${RED.settings.userDir}).
658
660
  catch(e) { node.warn(RED._("httpin.errors.json-error")); }
659
661
  }
660
662
  }
661
- node.status({});
663
+ node.count--;
664
+ if (node.count === 0) {
665
+ node.status({});
666
+ }
662
667
  nodeSend(msg);
663
668
  nodeDone();
664
669
  }).catch(err => {
@@ -146,16 +146,16 @@ module.exports = function(RED) {
146
146
  var pos = 0;
147
147
  var data = value;
148
148
  msg.parts.len = node.arraySplt;
149
+ const newmsg = RED.util.cloneMessage(msg)
149
150
  for (var i=0; i<count; i++) {
150
151
  var m = data.slice(pos,pos+node.arraySplt);
151
152
  if (node.arraySplt === 1) {
152
153
  m = m[0];
153
154
  }
154
- const newmsg = RED.util.cloneMessage(msg)
155
155
  RED.util.setMessageProperty(newmsg,node.property,m);
156
156
  newmsg.parts.index = i;
157
157
  pos += node.arraySplt;
158
- send(newmsg);
158
+ send(RED.util.cloneMessage(newmsg));
159
159
  }
160
160
  done();
161
161
  }
@@ -406,6 +406,7 @@
406
406
  "label": {
407
407
  "unknown": "desconocido"
408
408
  },
409
+ "manageModules": "Administrar módulos",
409
410
  "tip": "<p>Este nodo es de un tipo desconocido para tu instalación de Node-RED.</p><p><i>Si instancia con el nodo en este estado, tu configuración se conservará, pero el flujo no comenzará hasta el tipo que falta esté instalado.</i></p><p>Consulta la barra lateral de información para obtener más ayuda</p>"
410
411
  },
411
412
  "mqtt": {
@@ -514,7 +515,8 @@
514
515
  "url": "URL",
515
516
  "doc": "Docs",
516
517
  "return": "Devolver",
517
- "upload": "¿Aceptar cargas de archivos?",
518
+ "upload": "Permitir cargas de archivos",
519
+ "parsing": "No analizar el cuerpo de la solicitud",
518
520
  "status": "Código de estado",
519
521
  "headers": "Encabezados",
520
522
  "other": "otro",
@@ -562,7 +564,8 @@
562
564
  "timeout-isnan": "El valor de tiempo de espera no es un número válido, se ignora",
563
565
  "timeout-isnegative": "El valor de tiempo de espera es negativo, se ignora",
564
566
  "invalid-payload": "payload Invalido",
565
- "invalid-url": "URL Inválida"
567
+ "invalid-url": "URL Inválida",
568
+ "rejectunauthorized-invalid": "msg.rejectUnauthorized debe ser un booleano"
566
569
  },
567
570
  "status": {
568
571
  "requesting": "solicitando"
@@ -1017,7 +1020,7 @@
1017
1020
  "objectSend": "Enviar un mensaje para cada par clave/valor",
1018
1021
  "strBuff": "<b>Texto</b> / <b>Buffer</b>",
1019
1022
  "array": "<b>Array</b>",
1020
- "splitThe": "Dividir el",
1023
+ "splitThe": "Dividir la propiedad",
1021
1024
  "splitUsing": "Dividir usando",
1022
1025
  "splitLength": "Longitud fija de",
1023
1026
  "stream": "Manejar como un flujo de mensajes",
@@ -45,7 +45,7 @@
45
45
  <p>Estos solo se aplican cuando el nodo ha sido configurado para suscripciones dinámicas.</p>
46
46
  <dl class="message-properties">
47
47
  <dt>action <span class="property-type">texto</span></dt>
48
- <dd>el nombre de la acción que debe realizar el nodo. Las acciones disponibles son: <code>"connect"</code>, <code>"disconnect"</code>, <code>"subscribe"</code> y <code>"unsubscribe"</code>.</dd>
48
+ <dd>el nombre de la acción que debe realizar el nodo. Las acciones disponibles son: <code>"connect"</code>, <code>"disconnect"</code>, <code>"getSubscriptions"</code>, <code>"subscribe"</code> y <code>"unsubscribe"</code>.</dd>
49
49
  <dt class="optional">topic <span class="property-type">texto|objeto|matriz</span></dt>
50
50
  <dd>Para las acciones <code>"subscribe"</code> y <code>"unsubscribe"</code>, esta propiedad proporciona el tema. Se puede configurar como:<ul>
51
51
  <li>una cadena que contiene el filtro de tema</li>
@@ -40,6 +40,7 @@
40
40
  <p>El nodo escuchará en la ruta configurada solicitudes de un tipo particular. La ruta se puede especificar completamente, como <code>/user</code>, o incluir parámetros con nombre que acepten cualquier valor, como <code>/user/:name</code>. Cuando se utilizan parámetros con nombre, se puede acceder a su valor real en una solicitud en <code>msg.req.params</code>.</p>
41
41
  <p>Para solicitudes que incluyen un cuerpo, como POST o PUT, el contenido de la solicitud está disponible como <code>msg.payload</code>.</p>
42
42
  <p>Si se puede determinar el tipo de contenido de la solicitud, el cuerpo se analizará a cualquier tipo apropiado. Por ejemplo, <code>application/json</code> se analizará según su representación de objeto JavaScript.</p>
43
+ <p>El nodo se puede configurar para no analizar el cuerpo, en cuyo caso se proporcionará como un objeto Buffer.</p>
43
44
  <p><b>Nota:</b> este nodo no envía ninguna respuesta a la solicitud. El flujo debe incluir un nodo de respuesta HTTP para completar la solicitud.</p>
44
45
  </script>
45
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-red/nodes",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",