@node-red/nodes 3.0.2 → 3.1.0-beta.2
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/core/common/20-inject.js +55 -29
- package/core/common/24-complete.html +11 -2
- package/core/common/25-catch.html +2 -2
- package/core/common/25-status.html +2 -2
- package/core/common/60-link.html +11 -2
- package/core/common/60-link.js +10 -2
- package/core/common/91-global-config.html +27 -0
- package/core/common/91-global-config.js +7 -0
- package/core/function/10-function.html +12 -8
- package/core/function/15-change.js +1 -1
- package/core/function/16-range.html +1 -0
- package/core/function/16-range.js +6 -2
- package/core/function/80-template.html +2 -1
- package/core/function/89-delay.js +34 -30
- package/core/function/89-trigger.html +8 -1
- package/core/network/05-tls.html +3 -3
- package/core/network/06-httpproxy.html +1 -0
- package/core/network/10-mqtt.html +13 -5
- package/core/network/10-mqtt.js +51 -28
- package/core/network/21-httpin.html +1 -0
- package/core/network/21-httpin.js +12 -3
- package/core/network/21-httprequest.html +1 -0
- package/core/network/21-httprequest.js +5 -0
- package/core/network/31-tcpin.js +1 -1
- package/core/parsers/70-CSV.js +16 -5
- package/core/sequence/17-split.html +6 -1
- package/core/sequence/17-split.js +4 -2
- package/core/sequence/19-batch.html +8 -1
- package/core/storage/10-file.html +0 -0
- package/core/storage/10-file.js +3 -2
- package/locales/de/common/20-inject.html +0 -0
- package/locales/de/common/21-debug.html +0 -0
- package/locales/de/common/25-catch.html +0 -0
- package/locales/de/common/25-status.html +0 -0
- package/locales/de/common/60-link.html +0 -0
- package/locales/de/common/90-comment.html +0 -0
- package/locales/de/common/98-unknown.html +0 -0
- package/locales/de/function/10-function.html +0 -0
- package/locales/de/function/10-switch.html +0 -0
- package/locales/de/function/15-change.html +0 -0
- package/locales/de/function/16-range.html +0 -0
- package/locales/de/function/80-template.html +0 -0
- package/locales/de/function/89-delay.html +0 -0
- package/locales/de/function/89-trigger.html +0 -0
- package/locales/de/function/90-exec.html +0 -0
- package/locales/de/messages.json +0 -0
- package/locales/de/network/05-tls.html +0 -0
- package/locales/de/network/06-httpproxy.html +0 -0
- package/locales/de/network/10-mqtt.html +0 -0
- package/locales/de/network/21-httpin.html +0 -0
- package/locales/de/network/21-httprequest.html +0 -0
- package/locales/de/network/22-websocket.html +0 -0
- package/locales/de/network/31-tcpin.html +0 -0
- package/locales/de/network/32-udp.html +0 -0
- package/locales/de/parsers/70-CSV.html +0 -0
- package/locales/de/parsers/70-HTML.html +0 -0
- package/locales/de/parsers/70-JSON.html +0 -0
- package/locales/de/parsers/70-XML.html +0 -0
- package/locales/de/parsers/70-YAML.html +0 -0
- package/locales/de/sequence/17-split.html +0 -0
- package/locales/de/sequence/18-sort.html +0 -0
- package/locales/de/sequence/19-batch.html +0 -0
- package/locales/de/storage/10-file.html +0 -0
- package/locales/de/storage/23-watch.html +0 -0
- package/locales/en-US/common/90-comment.html +1 -1
- package/locales/en-US/common/91-global-config.html +3 -0
- package/locales/en-US/function/16-range.html +3 -0
- package/locales/en-US/function/80-template.html +3 -0
- package/locales/en-US/messages.json +17 -5
- package/locales/en-US/network/21-httprequest.html +1 -1
- package/locales/en-US/parsers/70-CSV.html +1 -0
- package/locales/fr/common/20-inject.html +40 -0
- package/locales/fr/common/21-debug.html +26 -0
- package/locales/fr/common/24-complete.html +29 -0
- package/locales/fr/common/25-catch.html +42 -0
- package/locales/fr/common/25-status.html +34 -0
- package/locales/fr/common/60-link.html +66 -0
- package/locales/fr/common/90-comment.html +22 -0
- package/locales/fr/common/98-unknown.html +28 -0
- package/locales/fr/function/10-function.html +64 -0
- package/locales/fr/function/10-switch.html +49 -0
- package/locales/fr/function/15-change.html +37 -0
- package/locales/fr/function/16-range.html +44 -0
- package/locales/fr/function/80-template.html +58 -0
- package/locales/fr/function/89-delay.html +64 -0
- package/locales/fr/function/89-trigger.html +50 -0
- package/locales/fr/function/90-exec.html +84 -0
- package/locales/fr/function/rbe.html +41 -0
- package/locales/fr/messages.json +1140 -0
- package/locales/fr/network/05-tls.html +19 -0
- package/locales/fr/network/06-httpproxy.html +22 -0
- package/locales/fr/network/10-mqtt.html +160 -0
- package/locales/fr/network/21-httpin.html +100 -0
- package/locales/fr/network/21-httprequest.html +96 -0
- package/locales/fr/network/22-websocket.html +43 -0
- package/locales/fr/network/31-tcpin.html +45 -0
- package/locales/fr/network/32-udp.html +31 -0
- package/locales/fr/parsers/70-CSV.html +52 -0
- package/locales/fr/parsers/70-HTML.html +36 -0
- package/locales/fr/parsers/70-JSON.html +54 -0
- package/locales/fr/parsers/70-XML.html +51 -0
- package/locales/fr/parsers/70-YAML.html +34 -0
- package/locales/fr/sequence/17-split.html +172 -0
- package/locales/fr/sequence/18-sort.html +41 -0
- package/locales/fr/sequence/19-batch.html +43 -0
- package/locales/fr/storage/10-file.html +69 -0
- package/locales/fr/storage/23-watch.html +30 -0
- package/locales/ja/common/91-global-config.html +3 -0
- package/locales/ja/function/80-template.html +3 -0
- package/locales/ja/messages.json +21 -8
- package/locales/ja/parsers/70-CSV.html +1 -0
- package/locales/ko/messages.json +9 -4
- package/locales/pt-BR/common/20-inject.html +40 -0
- package/locales/pt-BR/common/21-debug.html +26 -0
- package/locales/pt-BR/common/24-complete.html +29 -0
- package/locales/pt-BR/common/25-catch.html +42 -0
- package/locales/pt-BR/common/25-status.html +34 -0
- package/locales/pt-BR/common/60-link.html +66 -0
- package/locales/pt-BR/common/90-comment.html +22 -0
- package/locales/pt-BR/common/98-unknown.html +28 -0
- package/locales/pt-BR/function/10-function.html +64 -0
- package/locales/pt-BR/function/10-switch.html +50 -0
- package/locales/pt-BR/function/15-change.html +39 -0
- package/locales/pt-BR/function/16-range.html +44 -0
- package/locales/pt-BR/function/80-template.html +55 -0
- package/locales/pt-BR/function/89-delay.html +64 -0
- package/locales/pt-BR/function/89-trigger.html +50 -0
- package/locales/pt-BR/function/90-exec.html +83 -0
- package/locales/pt-BR/function/rbe.html +41 -0
- package/locales/pt-BR/messages.json +1127 -0
- package/locales/pt-BR/network/05-tls.html +19 -0
- package/locales/pt-BR/network/06-httpproxy.html +22 -0
- package/locales/pt-BR/network/10-mqtt.html +158 -0
- package/locales/pt-BR/network/21-httpin.html +100 -0
- package/locales/pt-BR/network/21-httprequest.html +95 -0
- package/locales/pt-BR/network/22-websocket.html +43 -0
- package/locales/pt-BR/network/31-tcpin.html +45 -0
- package/locales/pt-BR/network/32-udp.html +31 -0
- package/locales/pt-BR/parsers/70-CSV.html +49 -0
- package/locales/pt-BR/parsers/70-HTML.html +36 -0
- package/locales/pt-BR/parsers/70-JSON.html +53 -0
- package/locales/pt-BR/parsers/70-XML.html +50 -0
- package/locales/pt-BR/parsers/70-YAML.html +34 -0
- package/locales/pt-BR/sequence/17-split.html +170 -0
- package/locales/pt-BR/sequence/18-sort.html +41 -0
- package/locales/pt-BR/sequence/19-batch.html +43 -0
- package/locales/pt-BR/storage/10-file.html +67 -0
- package/locales/pt-BR/storage/23-watch.html +30 -0
- package/locales/ru/messages.json +0 -0
- package/locales/zh-CN/messages.json +1102 -930
- package/package.json +10 -10
package/core/network/10-mqtt.js
CHANGED
|
@@ -295,7 +295,7 @@ module.exports = function(RED) {
|
|
|
295
295
|
/* mute error - it simply isnt JSON, just leave payload as a string */
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
|
-
} //else {
|
|
298
|
+
} //else {
|
|
299
299
|
//leave as buffer
|
|
300
300
|
//}
|
|
301
301
|
}
|
|
@@ -357,7 +357,7 @@ module.exports = function(RED) {
|
|
|
357
357
|
return;
|
|
358
358
|
}
|
|
359
359
|
done(err);
|
|
360
|
-
});
|
|
360
|
+
});
|
|
361
361
|
} else {
|
|
362
362
|
done();
|
|
363
363
|
}
|
|
@@ -366,6 +366,16 @@ module.exports = function(RED) {
|
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
+
function updateStatus(node, allNodes) {
|
|
370
|
+
let setStatus = setStatusDisconnected
|
|
371
|
+
if(node.connecting) {
|
|
372
|
+
setStatus = setStatusConnecting
|
|
373
|
+
} else if(node.connected) {
|
|
374
|
+
setStatus = setStatusConnected
|
|
375
|
+
}
|
|
376
|
+
setStatus(node, allNodes)
|
|
377
|
+
}
|
|
378
|
+
|
|
369
379
|
function setStatusDisconnected(node, allNodes) {
|
|
370
380
|
if(allNodes) {
|
|
371
381
|
for (var id in node.users) {
|
|
@@ -459,7 +469,6 @@ module.exports = function(RED) {
|
|
|
459
469
|
if(!opts || typeof opts !== "object") {
|
|
460
470
|
return; //nothing to change, simply return
|
|
461
471
|
}
|
|
462
|
-
const originalBrokerURL = node.brokerurl;
|
|
463
472
|
|
|
464
473
|
//apply property changes (only if the property exists in the opts object)
|
|
465
474
|
setIfHasProperty(opts, node, "url", init);
|
|
@@ -468,13 +477,11 @@ module.exports = function(RED) {
|
|
|
468
477
|
setIfHasProperty(opts, node, "clientid", init);
|
|
469
478
|
setIfHasProperty(opts, node, "autoConnect", init);
|
|
470
479
|
setIfHasProperty(opts, node, "usetls", init);
|
|
471
|
-
setIfHasProperty(opts, node, "usews", init);
|
|
472
480
|
setIfHasProperty(opts, node, "verifyservercert", init);
|
|
473
481
|
setIfHasProperty(opts, node, "compatmode", init);
|
|
474
482
|
setIfHasProperty(opts, node, "protocolVersion", init);
|
|
475
483
|
setIfHasProperty(opts, node, "keepalive", init);
|
|
476
484
|
setIfHasProperty(opts, node, "cleansession", init);
|
|
477
|
-
setIfHasProperty(opts, node, "sessionExpiry", init);
|
|
478
485
|
setIfHasProperty(opts, node, "topicAliasMaximum", init);
|
|
479
486
|
setIfHasProperty(opts, node, "maximumPacketSize", init);
|
|
480
487
|
setIfHasProperty(opts, node, "receiveMaximum", init);
|
|
@@ -484,6 +491,11 @@ module.exports = function(RED) {
|
|
|
484
491
|
} else if (hasProperty(opts, "userProps")) {
|
|
485
492
|
node.userProperties = opts.userProps;
|
|
486
493
|
}
|
|
494
|
+
if (hasProperty(opts, "sessionExpiry")) {
|
|
495
|
+
node.sessionExpiryInterval = opts.sessionExpiry;
|
|
496
|
+
} else if (hasProperty(opts, "sessionExpiryInterval")) {
|
|
497
|
+
node.sessionExpiryInterval = opts.sessionExpiryInterval
|
|
498
|
+
}
|
|
487
499
|
|
|
488
500
|
function createLWT(topic, payload, qos, retain, v5opts, v5SubPropName) {
|
|
489
501
|
let message = undefined;
|
|
@@ -567,9 +579,6 @@ module.exports = function(RED) {
|
|
|
567
579
|
if (typeof node.usetls === 'undefined') {
|
|
568
580
|
node.usetls = false;
|
|
569
581
|
}
|
|
570
|
-
if (typeof node.usews === 'undefined') {
|
|
571
|
-
node.usews = false;
|
|
572
|
-
}
|
|
573
582
|
if (typeof node.verifyservercert === 'undefined') {
|
|
574
583
|
node.verifyservercert = false;
|
|
575
584
|
}
|
|
@@ -698,16 +707,21 @@ module.exports = function(RED) {
|
|
|
698
707
|
if (Object.keys(node.users).length === 1) {
|
|
699
708
|
if(node.autoConnect) {
|
|
700
709
|
node.connect();
|
|
710
|
+
//update nodes status
|
|
711
|
+
setTimeout(function() {
|
|
712
|
+
updateStatus(node, true)
|
|
713
|
+
}, 1)
|
|
701
714
|
}
|
|
702
715
|
}
|
|
703
716
|
};
|
|
704
717
|
|
|
705
|
-
node.deregister = function(mqttNode,done) {
|
|
718
|
+
node.deregister = function(mqttNode, done, autoDisconnect) {
|
|
706
719
|
delete node.users[mqttNode.id];
|
|
707
|
-
if (!node.closing && node.connected && Object.keys(node.users).length === 0) {
|
|
708
|
-
node.disconnect();
|
|
720
|
+
if (autoDisconnect && !node.closing && node.connected && Object.keys(node.users).length === 0) {
|
|
721
|
+
node.disconnect(done);
|
|
722
|
+
} else {
|
|
723
|
+
done();
|
|
709
724
|
}
|
|
710
|
-
done();
|
|
711
725
|
};
|
|
712
726
|
node.canConnect = function() {
|
|
713
727
|
return !node.connected && !node.connecting;
|
|
@@ -782,7 +796,9 @@ module.exports = function(RED) {
|
|
|
782
796
|
|
|
783
797
|
// Send any birth message
|
|
784
798
|
if (node.birthMessage) {
|
|
785
|
-
|
|
799
|
+
setTimeout(() => {
|
|
800
|
+
node.publish(node.birthMessage);
|
|
801
|
+
}, 1);
|
|
786
802
|
}
|
|
787
803
|
});
|
|
788
804
|
node._clientOn("reconnect", function() {
|
|
@@ -839,7 +855,7 @@ module.exports = function(RED) {
|
|
|
839
855
|
let waitEnd = (client, ms) => {
|
|
840
856
|
return new Promise( (resolve, reject) => {
|
|
841
857
|
node.closing = true;
|
|
842
|
-
if(!client) {
|
|
858
|
+
if(!client) {
|
|
843
859
|
resolve();
|
|
844
860
|
} else {
|
|
845
861
|
const t = setTimeout(() => {
|
|
@@ -991,14 +1007,21 @@ module.exports = function(RED) {
|
|
|
991
1007
|
}
|
|
992
1008
|
|
|
993
1009
|
if (topicOK) {
|
|
994
|
-
node.client.publish(msg.topic, msg.payload, options, function(err) {
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1010
|
+
node.client.publish(msg.topic, msg.payload, options, function (err) {
|
|
1011
|
+
if (done) {
|
|
1012
|
+
done(err)
|
|
1013
|
+
} else if(err) {
|
|
1014
|
+
node.error(err, msg)
|
|
1015
|
+
}
|
|
1016
|
+
})
|
|
998
1017
|
} else {
|
|
999
|
-
const error = new Error(RED._("mqtt.errors.invalid-topic"))
|
|
1000
|
-
error.warn = true
|
|
1001
|
-
done
|
|
1018
|
+
const error = new Error(RED._("mqtt.errors.invalid-topic"))
|
|
1019
|
+
error.warn = true
|
|
1020
|
+
if (done) {
|
|
1021
|
+
done(error)
|
|
1022
|
+
} else {
|
|
1023
|
+
node.warn(error, msg)
|
|
1024
|
+
}
|
|
1002
1025
|
}
|
|
1003
1026
|
}
|
|
1004
1027
|
};
|
|
@@ -1011,7 +1034,7 @@ module.exports = function(RED) {
|
|
|
1011
1034
|
|
|
1012
1035
|
/**
|
|
1013
1036
|
* Add event handlers to the MQTT.js client and track them so that
|
|
1014
|
-
* we do not remove any handlers that the MQTT client uses internally.
|
|
1037
|
+
* we do not remove any handlers that the MQTT client uses internally.
|
|
1015
1038
|
* Use {@link node._clientRemoveListeners `node._clientRemoveListeners`} to remove handlers
|
|
1016
1039
|
* @param {string} event The name of the event
|
|
1017
1040
|
* @param {function} handler The handler for this event
|
|
@@ -1019,11 +1042,11 @@ module.exports = function(RED) {
|
|
|
1019
1042
|
node._clientOn = function(event, handler) {
|
|
1020
1043
|
node.clientListeners.push({event, handler})
|
|
1021
1044
|
node.client.on(event, handler)
|
|
1022
|
-
}
|
|
1045
|
+
}
|
|
1023
1046
|
|
|
1024
1047
|
/**
|
|
1025
|
-
* Remove event handlers from the MQTT.js client & only the events
|
|
1026
|
-
* that we attached in {@link node._clientOn `node._clientOn`}.
|
|
1048
|
+
* Remove event handlers from the MQTT.js client & only the events
|
|
1049
|
+
* that we attached in {@link node._clientOn `node._clientOn`}.
|
|
1027
1050
|
* * If `event` is omitted, then all events matching `handler` are removed
|
|
1028
1051
|
* * If `handler` is omitted, then all events named `event` are removed
|
|
1029
1052
|
* * If both parameters are omitted, then all events are removed
|
|
@@ -1212,7 +1235,7 @@ module.exports = function(RED) {
|
|
|
1212
1235
|
} else {
|
|
1213
1236
|
node.brokerConn.unsubscribe(node.topic,node.id, removed);
|
|
1214
1237
|
}
|
|
1215
|
-
node.brokerConn.deregister(node, done);
|
|
1238
|
+
node.brokerConn.deregister(node, done, removed);
|
|
1216
1239
|
node.brokerConn = null;
|
|
1217
1240
|
} else {
|
|
1218
1241
|
done();
|
|
@@ -1275,9 +1298,9 @@ module.exports = function(RED) {
|
|
|
1275
1298
|
node.status({fill:"green",shape:"dot",text:"node-red:common.status.connected"});
|
|
1276
1299
|
}
|
|
1277
1300
|
node.brokerConn.register(node);
|
|
1278
|
-
node.on('close', function(done) {
|
|
1301
|
+
node.on('close', function(removed, done) {
|
|
1279
1302
|
if (node.brokerConn) {
|
|
1280
|
-
node.brokerConn.deregister(node,done)
|
|
1303
|
+
node.brokerConn.deregister(node, done, removed)
|
|
1281
1304
|
node.brokerConn = null;
|
|
1282
1305
|
} else {
|
|
1283
1306
|
done();
|
|
@@ -46,7 +46,7 @@ module.exports = function(RED) {
|
|
|
46
46
|
isText = true;
|
|
47
47
|
} else if (parsedType.type !== "application") {
|
|
48
48
|
isText = false;
|
|
49
|
-
} else if ((parsedType.subtype !== "octet-stream")
|
|
49
|
+
} else if ((parsedType.subtype !== "octet-stream")
|
|
50
50
|
&& (parsedType.subtype !== "cbor")
|
|
51
51
|
&& (parsedType.subtype !== "x-protobuf")) {
|
|
52
52
|
checkUTF = true;
|
|
@@ -200,6 +200,15 @@ module.exports = function(RED) {
|
|
|
200
200
|
this.callback = function(req,res) {
|
|
201
201
|
var msgid = RED.util.generateId();
|
|
202
202
|
res._msgid = msgid;
|
|
203
|
+
// Since Node 15, req.headers are lazily computed and the property
|
|
204
|
+
// marked as non-enumerable.
|
|
205
|
+
// That means it doesn't show up in the Debug sidebar.
|
|
206
|
+
// This redefines the property causing it to be evaluated *and*
|
|
207
|
+
// marked as enumerable again.
|
|
208
|
+
Object.defineProperty(req, 'headers', {
|
|
209
|
+
value: req.headers,
|
|
210
|
+
enumerable: true
|
|
211
|
+
})
|
|
203
212
|
if (node.method.match(/^(post|delete|put|options|patch)$/)) {
|
|
204
213
|
node.send({_msgid:msgid,req:req,res:createResponseWrapper(node,res),payload:req.body});
|
|
205
214
|
} else if (node.method == "get") {
|
|
@@ -282,7 +291,7 @@ module.exports = function(RED) {
|
|
|
282
291
|
RED.nodes.createNode(this,n);
|
|
283
292
|
var node = this;
|
|
284
293
|
this.headers = n.headers||{};
|
|
285
|
-
this.statusCode = n.statusCode;
|
|
294
|
+
this.statusCode = parseInt(n.statusCode);
|
|
286
295
|
this.on("input",function(msg,_send,done) {
|
|
287
296
|
if (msg.res) {
|
|
288
297
|
var headers = RED.util.cloneMessage(node.headers);
|
|
@@ -323,7 +332,7 @@ module.exports = function(RED) {
|
|
|
323
332
|
}
|
|
324
333
|
}
|
|
325
334
|
}
|
|
326
|
-
var statusCode = node.statusCode || msg.statusCode || 200;
|
|
335
|
+
var statusCode = node.statusCode || parseInt(msg.statusCode) || 200;
|
|
327
336
|
if (typeof msg.payload == "object" && !Buffer.isBuffer(msg.payload)) {
|
|
328
337
|
msg.res._res.status(statusCode).jsonp(msg.payload);
|
|
329
338
|
} else {
|
|
@@ -86,6 +86,7 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
|
|
86
86
|
if (n.paytoqs === true || n.paytoqs === "query") { paytoqs = true; }
|
|
87
87
|
else if (n.paytoqs === "body") { paytobody = true; }
|
|
88
88
|
|
|
89
|
+
node.insecureHTTPParser = n.insecureHTTPParser
|
|
89
90
|
|
|
90
91
|
var prox, noprox;
|
|
91
92
|
if (process.env.http_proxy) { prox = process.env.http_proxy; }
|
|
@@ -434,6 +435,10 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
|
|
434
435
|
formData.append(opt, val);
|
|
435
436
|
} else if (typeof val === 'object' && val.hasOwnProperty('value')) {
|
|
436
437
|
formData.append(opt,val.value,val.options || {});
|
|
438
|
+
} else if (Array.isArray(val)) {
|
|
439
|
+
for (var i=0; i<val.length; i++) {
|
|
440
|
+
formData.append(opt, val[i])
|
|
441
|
+
}
|
|
437
442
|
} else {
|
|
438
443
|
formData.append(opt,JSON.stringify(val));
|
|
439
444
|
}
|
package/core/network/31-tcpin.js
CHANGED
|
@@ -86,7 +86,7 @@ module.exports = function(RED) {
|
|
|
86
86
|
this.topic = n.topic;
|
|
87
87
|
this.stream = (!n.datamode||n.datamode=='stream'); /* stream,single*/
|
|
88
88
|
this.datatype = n.datatype||'buffer'; /* buffer,utf8,base64 */
|
|
89
|
-
this.newline = (n.newline||"").replace(
|
|
89
|
+
this.newline = (n.newline||"").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t");
|
|
90
90
|
this.base64 = n.base64;
|
|
91
91
|
this.trim = n.trim || false;
|
|
92
92
|
this.server = (typeof n.server == 'boolean')?n.server:(n.server == "server");
|
package/core/parsers/70-CSV.js
CHANGED
|
@@ -19,9 +19,9 @@ module.exports = function(RED) {
|
|
|
19
19
|
function CSVNode(n) {
|
|
20
20
|
RED.nodes.createNode(this,n);
|
|
21
21
|
this.template = (n.temp || "");
|
|
22
|
-
this.sep = (n.sep || ',').replace(
|
|
22
|
+
this.sep = (n.sep || ',').replace(/\\t/g,"\t").replace(/\\n/g,"\n").replace(/\\r/g,"\r");
|
|
23
23
|
this.quo = '"';
|
|
24
|
-
this.ret = (n.ret || "\n").replace(
|
|
24
|
+
this.ret = (n.ret || "\n").replace(/\\n/g,"\n").replace(/\\r/g,"\r");
|
|
25
25
|
this.winflag = (this.ret === "\r\n");
|
|
26
26
|
this.lineend = "\n";
|
|
27
27
|
this.multi = n.multi || "one";
|
|
@@ -110,7 +110,12 @@ module.exports = function(RED) {
|
|
|
110
110
|
if (msg.payload[s].hasOwnProperty(p)) {
|
|
111
111
|
/* istanbul ignore else */
|
|
112
112
|
if (typeof msg.payload[s][p] !== "object") {
|
|
113
|
-
|
|
113
|
+
// Fix to honour include null values flag
|
|
114
|
+
//if (typeof msg.payload[s][p] !== "object" || (node.include_null_values === true && msg.payload[s][p] === null)) {
|
|
115
|
+
var q = "";
|
|
116
|
+
if (msg.payload[s][p] !== undefined) {
|
|
117
|
+
q += msg.payload[s][p];
|
|
118
|
+
}
|
|
114
119
|
if (q.indexOf(node.quo) !== -1) { // add double quotes if any quotes
|
|
115
120
|
q = q.replace(/"/g, '""');
|
|
116
121
|
ou += node.quo + q + node.quo + node.sep;
|
|
@@ -130,9 +135,15 @@ module.exports = function(RED) {
|
|
|
130
135
|
ou += node.sep;
|
|
131
136
|
}
|
|
132
137
|
else {
|
|
133
|
-
var
|
|
138
|
+
var tt = template[t];
|
|
139
|
+
if (template[t].indexOf('"') >=0 ) { tt = "'"+tt+"'"; }
|
|
140
|
+
else { tt = '"'+tt+'"'; }
|
|
141
|
+
var p = RED.util.getMessageProperty(msg,'payload["'+s+'"]['+tt+']');
|
|
134
142
|
/* istanbul ignore else */
|
|
135
|
-
if (p ===
|
|
143
|
+
if (p === undefined) { p = ""; }
|
|
144
|
+
// fix to honour include null values flag
|
|
145
|
+
//if (p === null && node.include_null_values !== true) { p = "";}
|
|
146
|
+
p = RED.util.ensureString(p);
|
|
136
147
|
if (p.indexOf(node.quo) !== -1) { // add double quotes if any quotes
|
|
137
148
|
p = p.replace(/"/g, '""');
|
|
138
149
|
ou += node.quo + p + node.quo + node.sep;
|
|
@@ -224,7 +224,12 @@
|
|
|
224
224
|
outputs:1,
|
|
225
225
|
icon: "join.svg",
|
|
226
226
|
label: function() {
|
|
227
|
-
|
|
227
|
+
var nam = this.name||this._("join.join");
|
|
228
|
+
if (this.mode === "custom" && !isNaN(Number(this.count))) {
|
|
229
|
+
nam += " "+this.count;
|
|
230
|
+
if (this.accumulate === true) { nam+= "+"; }
|
|
231
|
+
}
|
|
232
|
+
return nam;
|
|
228
233
|
},
|
|
229
234
|
labelStyle: function() {
|
|
230
235
|
return this.name?"node_label_italic":"";
|
|
@@ -251,7 +251,9 @@ module.exports = function(RED) {
|
|
|
251
251
|
}
|
|
252
252
|
else {
|
|
253
253
|
node.buffer = buff.slice(p,buff.length);
|
|
254
|
-
node.
|
|
254
|
+
if (node.buffer.length > 0) {
|
|
255
|
+
node.pendingDones.push(done);
|
|
256
|
+
}
|
|
255
257
|
}
|
|
256
258
|
if (node.buffer.length == 0) {
|
|
257
259
|
done();
|
|
@@ -476,7 +478,7 @@ module.exports = function(RED) {
|
|
|
476
478
|
var completeSend = function(partId) {
|
|
477
479
|
var group = inflight[partId];
|
|
478
480
|
if (group.timeout) { clearTimeout(group.timeout); }
|
|
479
|
-
if (
|
|
481
|
+
if (node.mode === 'auto' || node.accumulate !== true || group.msg.hasOwnProperty("complete")) { delete inflight[partId]; }
|
|
480
482
|
if (group.type === 'array' && group.arrayLen > 1) {
|
|
481
483
|
var newArray = [];
|
|
482
484
|
group.payload.forEach(function(n) {
|
|
@@ -107,7 +107,14 @@
|
|
|
107
107
|
outputs:1,
|
|
108
108
|
icon: "batch.svg",
|
|
109
109
|
label: function() {
|
|
110
|
-
|
|
110
|
+
var nam = this.name||this._("batch.batch");
|
|
111
|
+
if (this.mode === "count" && !isNaN(Number(this.count))) {
|
|
112
|
+
nam += " "+this.count;
|
|
113
|
+
}
|
|
114
|
+
if (this.mode === "interval" && !isNaN(Number(this.interval))) {
|
|
115
|
+
nam += " "+this.interval+"s";
|
|
116
|
+
}
|
|
117
|
+
return nam;
|
|
111
118
|
},
|
|
112
119
|
labelStyle: function() {
|
|
113
120
|
return this.name ? "node_label_italic" : "";
|
|
File without changes
|
package/core/storage/10-file.js
CHANGED
|
@@ -117,7 +117,9 @@ module.exports = function(RED) {
|
|
|
117
117
|
}
|
|
118
118
|
if (typeof data === "boolean") { data = data.toString(); }
|
|
119
119
|
if (typeof data === "number") { data = data.toString(); }
|
|
120
|
-
|
|
120
|
+
var aflg = true;
|
|
121
|
+
if (msg.hasOwnProperty("parts") && msg.parts.type === "string" && (msg.parts.count === msg.parts.index + 1)) { aflg = false; }
|
|
122
|
+
if ((node.appendNewline) && (!Buffer.isBuffer(data)) && aflg) { data += os.EOL; }
|
|
121
123
|
var buf;
|
|
122
124
|
if (node.encoding === "setbymsg") {
|
|
123
125
|
buf = encode(data, msg.encoding || "none");
|
|
@@ -314,7 +316,6 @@ module.exports = function(RED) {
|
|
|
314
316
|
});
|
|
315
317
|
filename = filename || "";
|
|
316
318
|
var fullFilename = filename;
|
|
317
|
-
var filePath = "";
|
|
318
319
|
if (filename && RED.settings.fileWorkingDirectory && !path.isAbsolute(filename)) {
|
|
319
320
|
fullFilename = path.resolve(path.join(RED.settings.fileWorkingDirectory,filename));
|
|
320
321
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/locales/de/messages.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -34,11 +34,14 @@
|
|
|
34
34
|
the range specified within the target range.</p>
|
|
35
35
|
<p><i>Scale and wrap within the target range</i> means that the result will
|
|
36
36
|
be wrapped within the target range.</p>
|
|
37
|
+
<p><i>Scale, but drop if outside input range</i> means that the result will
|
|
38
|
+
be scaled, but any inputs outside of the inout range will be dropped.</p>
|
|
37
39
|
<p>For example an input 0 - 10 mapped to 0 - 100.</p>
|
|
38
40
|
<table style="outline-width:#888 solid thin">
|
|
39
41
|
<tr><th width="80px">mode</th><th width="80px">input</th><th width="80px">output</th></tr>
|
|
40
42
|
<tr><td><center>scale</center></td><td><center>12</center></td><td><center>120</center></td></tr>
|
|
41
43
|
<tr><td><center>limit</center></td><td><center>12</center></td><td><center>100</center></td></tr>
|
|
42
44
|
<tr><td><center>wrap</center></td><td><center>12</center></td><td><center>20</center></td></tr>
|
|
45
|
+
<tr><td><center>drop</center></td><td><center>12</center></td><td><center><i>(no output)</i></center></td></tr>
|
|
43
46
|
</table>
|
|
44
47
|
</script>
|
|
@@ -52,4 +52,7 @@
|
|
|
52
52
|
used to mark the templated sections. For example, to use <code>[[ ]]</code>
|
|
53
53
|
instead, add the following line to the top of the template:</p>
|
|
54
54
|
<pre>{{=[[ ]]=}}</pre>
|
|
55
|
+
<h4>Using environment variables</h4>
|
|
56
|
+
<p>The template node can access environment variables using the syntax:</p>
|
|
57
|
+
<pre>My favourite colour is {{env.COLOUR}}.</pre>
|
|
55
58
|
</script>
|
|
@@ -119,7 +119,10 @@
|
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
121
|
"complete": {
|
|
122
|
-
"completeNodes": "complete: __number__"
|
|
122
|
+
"completeNodes": "complete: __number__",
|
|
123
|
+
"errors": {
|
|
124
|
+
"scopeUndefined": "scope undefined"
|
|
125
|
+
}
|
|
123
126
|
},
|
|
124
127
|
"debug": {
|
|
125
128
|
"output": "Output",
|
|
@@ -181,8 +184,9 @@
|
|
|
181
184
|
"staticLinkCall": "Fixed target",
|
|
182
185
|
"dynamicLinkCall": "Dynamic target (msg.target)",
|
|
183
186
|
"dynamicLinkLabel": "Dynamic",
|
|
184
|
-
"
|
|
185
|
-
"missingReturn": "Missing return node information"
|
|
187
|
+
"errors": {
|
|
188
|
+
"missingReturn": "Missing return node information",
|
|
189
|
+
"linkUndefined": "link undefined"
|
|
186
190
|
}
|
|
187
191
|
},
|
|
188
192
|
"tls": {
|
|
@@ -446,7 +450,9 @@
|
|
|
446
450
|
"staticTopic": "Subscribe to single topic",
|
|
447
451
|
"dynamicTopic": "Dynamic subscription",
|
|
448
452
|
"auto-connect": "Connect automatically",
|
|
449
|
-
"auto-mode-depreciated": "This option is depreciated. Please use the new auto-detect mode."
|
|
453
|
+
"auto-mode-depreciated": "This option is depreciated. Please use the new auto-detect mode.",
|
|
454
|
+
"none": "none",
|
|
455
|
+
"other": "other"
|
|
450
456
|
},
|
|
451
457
|
"sections-label": {
|
|
452
458
|
"birth-message": "Message sent on connection (birth message)",
|
|
@@ -814,7 +820,8 @@
|
|
|
814
820
|
"scale": {
|
|
815
821
|
"payload": "Scale the message property",
|
|
816
822
|
"limit": "Scale and limit to the target range",
|
|
817
|
-
"wrap": "Scale and wrap within the target range"
|
|
823
|
+
"wrap": "Scale and wrap within the target range",
|
|
824
|
+
"drop": "Scale, but drop msg if outside input range"
|
|
818
825
|
},
|
|
819
826
|
"tip": "Tip: This node ONLY works with numbers.",
|
|
820
827
|
"errors": {
|
|
@@ -1124,5 +1131,10 @@
|
|
|
1124
1131
|
"warn": {
|
|
1125
1132
|
"nonumber": "no number found in payload"
|
|
1126
1133
|
}
|
|
1134
|
+
},
|
|
1135
|
+
"global-config": {
|
|
1136
|
+
"label": {
|
|
1137
|
+
"open-conf": "Open Configuration"
|
|
1138
|
+
}
|
|
1127
1139
|
}
|
|
1128
1140
|
}
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
<h4>Cookie handling</h4>
|
|
74
74
|
<p>The <code>cookies</code> property passed to the node must be an object of name/value pairs.
|
|
75
75
|
The value can be either a string to set the value of the cookie or it can be an
|
|
76
|
-
object with a single <code>value</code> property
|
|
76
|
+
object with a single <code>value</code> property.</p>
|
|
77
77
|
<p>Any cookies returned by the request are passed back under the <code>responseCookies</code> property.</p>
|
|
78
78
|
<h4>Content type handling</h4>
|
|
79
79
|
<p>If <code>msg.payload</code> is an Object, the node will automatically set the content type
|
|
@@ -47,5 +47,6 @@
|
|
|
47
47
|
<p>If 'include null values' option is checked, null values will be returned in result, ie. middle value '"1",,3'.</p>
|
|
48
48
|
<p>The node can accept a multi-part input as long as the <code>parts</code> property is set correctly, for example from a file-in node or split node.</p>
|
|
49
49
|
<p>If outputting multiple messages they will have their <code>parts</code> property set and form a complete message sequence.</p>
|
|
50
|
+
<p>If the node is set to only send column headers once, then setting <code>msg.reset</code> to any value will cause the node to resend the headers.</p>
|
|
50
51
|
<p><b>Note:</b> the column template must be comma separated - even if a different separator is chosen for the data.</p>
|
|
51
52
|
</script>
|