@node-red/nodes 3.1.0-beta.1 → 3.1.0-beta.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.
- package/core/common/20-inject.js +12 -5
- package/core/common/24-complete.html +10 -1
- package/core/common/25-catch.html +5 -0
- package/core/common/25-status.html +5 -0
- package/core/common/60-link.html +11 -2
- package/core/common/60-link.js +10 -2
- package/core/function/rbe.js +5 -1
- package/core/network/10-mqtt.html +31 -6
- package/core/network/10-mqtt.js +243 -69
- package/core/network/21-httprequest.js +44 -22
- package/core/parsers/70-XML.js +1 -2
- package/core/sequence/17-split.js +1 -1
- package/core/storage/10-file.js +3 -2
- package/locales/de/messages.json +3 -0
- package/locales/en-US/messages.json +10 -3
- package/locales/en-US/network/21-httprequest.html +1 -1
- 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/messages.json +8 -3
- 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/zh-CN/messages.json +1102 -930
- package/package.json +10 -10
package/core/common/20-inject.js
CHANGED
|
@@ -117,14 +117,21 @@ module.exports = function(RED) {
|
|
|
117
117
|
if (p.v) {
|
|
118
118
|
try {
|
|
119
119
|
var exp = RED.util.prepareJSONataExpression(p.v, node);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
RED.util.evaluateJSONataExpression(exp, msg, (err, newValue) => {
|
|
121
|
+
if (err) {
|
|
122
|
+
errors.push(err.toString())
|
|
123
|
+
} else {
|
|
124
|
+
RED.util.setMessageProperty(msg,property,newValue,true);
|
|
125
|
+
}
|
|
126
|
+
evaluateProperty(doneEvaluating)
|
|
127
|
+
});
|
|
128
|
+
} catch (err) {
|
|
124
129
|
errors.push(err.message);
|
|
130
|
+
evaluateProperty(doneEvaluating)
|
|
125
131
|
}
|
|
132
|
+
} else {
|
|
133
|
+
evaluateProperty(doneEvaluating)
|
|
126
134
|
}
|
|
127
|
-
evaluateProperty(doneEvaluating)
|
|
128
135
|
} else {
|
|
129
136
|
try {
|
|
130
137
|
RED.util.evaluateNodeProperty(value, valueType, node, msg, (err, newValue) => {
|
|
@@ -18,7 +18,16 @@
|
|
|
18
18
|
color:"#c0edc0",
|
|
19
19
|
defaults: {
|
|
20
20
|
name: {value:""},
|
|
21
|
-
scope: {
|
|
21
|
+
scope: {
|
|
22
|
+
value: [],
|
|
23
|
+
type: "*[]",
|
|
24
|
+
validate: function (v, opt) {
|
|
25
|
+
if (v.length > 0) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
return RED._("node-red:complete.errors.scopeUndefined");
|
|
29
|
+
}
|
|
30
|
+
},
|
|
22
31
|
uncaught: {value:false}
|
|
23
32
|
},
|
|
24
33
|
inputs:0,
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
<label style="width: auto" for="node-input-scope" data-i18n="catch.label.source"></label>
|
|
5
5
|
<select id="node-input-scope-select">
|
|
6
6
|
<option value="all" data-i18n="catch.scope.all"></option>
|
|
7
|
+
<option value="group" data-i18n="catch.scope.group"></option>
|
|
7
8
|
<option value="target" data-i18n="catch.scope.selected"></option>
|
|
8
9
|
</select>
|
|
9
10
|
</div>
|
|
@@ -170,6 +171,8 @@
|
|
|
170
171
|
});
|
|
171
172
|
if (this.scope === null) {
|
|
172
173
|
$("#node-input-scope-select").val("all");
|
|
174
|
+
} else if(this.scope === "group"){
|
|
175
|
+
$("#node-input-scope-select").val("group");
|
|
173
176
|
} else {
|
|
174
177
|
$("#node-input-scope-select").val("target");
|
|
175
178
|
}
|
|
@@ -179,6 +182,8 @@
|
|
|
179
182
|
var scope = $("#node-input-scope-select").val();
|
|
180
183
|
if (scope === 'all') {
|
|
181
184
|
this.scope = null;
|
|
185
|
+
} else if(scope === 'group') {
|
|
186
|
+
this.scope = "group";
|
|
182
187
|
} else {
|
|
183
188
|
$("#node-input-uncaught").prop("checked",false);
|
|
184
189
|
this.scope = $("#node-input-catch-target-container-div").treeList('selected').map(function(i) { return i.node.id})
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
<label style="width: auto" for="node-input-scope" data-i18n="status.label.source"></label>
|
|
5
5
|
<select id="node-input-scope-select">
|
|
6
6
|
<option value="all" data-i18n="status.scope.all"></option>
|
|
7
|
+
<option value="group" data-i18n="status.scope.group"></option>
|
|
7
8
|
<option value="target" data-i18n="status.scope.selected"></option>
|
|
8
9
|
</select>
|
|
9
10
|
</div>
|
|
@@ -157,6 +158,8 @@
|
|
|
157
158
|
});
|
|
158
159
|
if (this.scope === null) {
|
|
159
160
|
$("#node-input-scope-select").val("all");
|
|
161
|
+
} else if(this.scope === "group"){
|
|
162
|
+
$("#node-input-scope-select").val("group");
|
|
160
163
|
} else {
|
|
161
164
|
$("#node-input-scope-select").val("target");
|
|
162
165
|
}
|
|
@@ -166,6 +169,8 @@
|
|
|
166
169
|
var scope = $("#node-input-scope-select").val();
|
|
167
170
|
if (scope === 'all') {
|
|
168
171
|
this.scope = null;
|
|
172
|
+
} else if(scope === 'group') {
|
|
173
|
+
this.scope = "group";
|
|
169
174
|
} else {
|
|
170
175
|
this.scope = $("#node-input-status-target-container-div").treeList('selected').map(function(i) { return i.node.id})
|
|
171
176
|
}
|
package/core/common/60-link.html
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
<script type="text/html" data-template-name="link in">
|
|
3
2
|
<div class="form-row">
|
|
4
3
|
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
|
@@ -272,7 +271,17 @@
|
|
|
272
271
|
color:"#ddd",//"#87D8CF",
|
|
273
272
|
defaults: {
|
|
274
273
|
name: { value: "" },
|
|
275
|
-
links: {
|
|
274
|
+
links: {
|
|
275
|
+
value: [],
|
|
276
|
+
type: "link in[]",
|
|
277
|
+
validate: function (v, opt) {
|
|
278
|
+
if ((this.linkType === "static" && v.length > 0)
|
|
279
|
+
|| this.linkType === "dynamic") {
|
|
280
|
+
return true;
|
|
281
|
+
}
|
|
282
|
+
return RED._("node-red:link.errors.linkUndefined");
|
|
283
|
+
}
|
|
284
|
+
},
|
|
276
285
|
linkType: { value:"static" },
|
|
277
286
|
timeout: {
|
|
278
287
|
value: "30",
|
package/core/common/60-link.js
CHANGED
|
@@ -164,10 +164,10 @@ module.exports = function(RED) {
|
|
|
164
164
|
if (returnNode && returnNode.returnLinkMessage) {
|
|
165
165
|
returnNode.returnLinkMessage(messageEvent.id, msg);
|
|
166
166
|
} else {
|
|
167
|
-
node.warn(RED._("link.
|
|
167
|
+
node.warn(RED._("link.errors.missingReturn"));
|
|
168
168
|
}
|
|
169
169
|
} else {
|
|
170
|
-
node.warn(RED._("link.
|
|
170
|
+
node.warn(RED._("link.errors.missingReturn"));
|
|
171
171
|
}
|
|
172
172
|
done();
|
|
173
173
|
} else if (mode === "link") {
|
|
@@ -248,6 +248,14 @@ module.exports = function(RED) {
|
|
|
248
248
|
}
|
|
249
249
|
});
|
|
250
250
|
|
|
251
|
+
this.on("close", function () {
|
|
252
|
+
for (const event of Object.values(messageEvents)) {
|
|
253
|
+
if (event.ts) {
|
|
254
|
+
clearTimeout(event.ts)
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
})
|
|
258
|
+
|
|
251
259
|
this.returnLinkMessage = function(eventId, msg) {
|
|
252
260
|
if (Array.isArray(msg._linkSource) && msg._linkSource.length === 0) {
|
|
253
261
|
delete msg._linkSource;
|
package/core/function/rbe.js
CHANGED
|
@@ -35,7 +35,11 @@ module.exports = function(RED) {
|
|
|
35
35
|
}
|
|
36
36
|
else { node.previous = {}; }
|
|
37
37
|
}
|
|
38
|
-
var value
|
|
38
|
+
var value;
|
|
39
|
+
try {
|
|
40
|
+
value = RED.util.getMessageProperty(msg,node.property);
|
|
41
|
+
}
|
|
42
|
+
catch(e) { }
|
|
39
43
|
if (value !== undefined) {
|
|
40
44
|
var t = "_no_topic";
|
|
41
45
|
if (node.septopics) { t = topic || t; }
|
|
@@ -249,6 +249,12 @@
|
|
|
249
249
|
<span id="node-config-input-cleansession-label" data-i18n="mqtt.label.cleansession"></span>
|
|
250
250
|
</label>
|
|
251
251
|
</div>
|
|
252
|
+
<div class="form-row mqtt-persistence">
|
|
253
|
+
<label for="node-config-input-autoUnsubscribe" style="width: auto;">
|
|
254
|
+
<input type="checkbox" id="node-config-input-autoUnsubscribe" style="position: relative;vertical-align: bottom; top: -2px; width: 15px;height: 15px;">
|
|
255
|
+
<span id="node-config-input-autoUnsubscribe-label" data-i18n="mqtt.label.autoUnsubscribe"></span>
|
|
256
|
+
</label>
|
|
257
|
+
</div>
|
|
252
258
|
<div class="form-row mqtt5">
|
|
253
259
|
<label style="width:auto" for="node-config-input-sessionExpiry"><span data-i18n="mqtt.label.sessionExpiry"></span></label>
|
|
254
260
|
<input type="number" min="0" id="node-config-input-sessionExpiry" style="width: 100px" >
|
|
@@ -483,17 +489,23 @@
|
|
|
483
489
|
tls: {type:"tls-config",required: false,
|
|
484
490
|
label:RED._("node-red:mqtt.label.use-tls") },
|
|
485
491
|
clientid: {value:"", validate: function(v, opt) {
|
|
486
|
-
|
|
492
|
+
let ok = true;
|
|
487
493
|
if ($("#node-config-input-clientid").length) {
|
|
488
494
|
// Currently editing the node
|
|
489
|
-
|
|
495
|
+
let needClientId = !$("#node-config-input-cleansession").is(":checked") || !$("#node-config-input-autoUnsubscribe").is(":checked")
|
|
496
|
+
if (needClientId) {
|
|
497
|
+
ok = (v||"").length > 0;
|
|
498
|
+
}
|
|
490
499
|
} else {
|
|
491
|
-
|
|
500
|
+
let needClientId = !(this.cleansession===undefined || this.cleansession) || this.autoUnsubscribe;
|
|
501
|
+
if (needClientId) {
|
|
502
|
+
ok = (v||"").length > 0;
|
|
503
|
+
}
|
|
492
504
|
}
|
|
493
|
-
if (ok) {
|
|
494
|
-
return
|
|
505
|
+
if (!ok) {
|
|
506
|
+
return RED._("node-red:mqtt.errors.invalid-client-id");
|
|
495
507
|
}
|
|
496
|
-
return
|
|
508
|
+
return true;
|
|
497
509
|
}},
|
|
498
510
|
autoConnect: {value: true},
|
|
499
511
|
usetls: {value: false},
|
|
@@ -505,6 +517,7 @@
|
|
|
505
517
|
label: RED._("node-red:mqtt.label.keepalive"),
|
|
506
518
|
validate:RED.validators.number(false)},
|
|
507
519
|
cleansession: {value: true},
|
|
520
|
+
autoUnsubscribe: {value: true},
|
|
508
521
|
birthTopic: {value:"", validate:validateMQTTPublishTopic},
|
|
509
522
|
birthQos: {value:"0"},
|
|
510
523
|
birthRetain: {value:"false"},
|
|
@@ -620,6 +633,10 @@
|
|
|
620
633
|
this.cleansession = true;
|
|
621
634
|
$("#node-config-input-cleansession").prop("checked",true);
|
|
622
635
|
}
|
|
636
|
+
if (typeof this.autoUnsubscribe === 'undefined') {
|
|
637
|
+
this.autoUnsubscribe = true;
|
|
638
|
+
$("#node-config-input-autoUnsubscribe").prop("checked",true);
|
|
639
|
+
}
|
|
623
640
|
if (typeof this.usetls === 'undefined') {
|
|
624
641
|
this.usetls = false;
|
|
625
642
|
$("#node-config-input-usetls").prop("checked",false);
|
|
@@ -635,6 +652,14 @@
|
|
|
635
652
|
if (typeof this.protocolVersion === 'undefined') {
|
|
636
653
|
this.protocolVersion = 4;
|
|
637
654
|
}
|
|
655
|
+
$("#node-config-input-cleansession").on("change", function() {
|
|
656
|
+
const useCleanSession = $("#node-config-input-cleansession").is(':checked');
|
|
657
|
+
if(useCleanSession) {
|
|
658
|
+
$("div.form-row.mqtt-persistence").hide();
|
|
659
|
+
} else {
|
|
660
|
+
$("div.form-row.mqtt-persistence").show();
|
|
661
|
+
}
|
|
662
|
+
});
|
|
638
663
|
$("#node-config-input-protocolVersion").on("change", function() {
|
|
639
664
|
var v5 = $("#node-config-input-protocolVersion").val() == "5";
|
|
640
665
|
if(v5) {
|