@node-red/runtime 4.0.0-beta.2 → 4.0.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/lib/flows/Flow.js +3 -0
- package/lib/flows/Subflow.js +8 -7
- package/lib/flows/index.js +13 -13
- package/lib/flows/util.js +6 -6
- package/lib/multiplayer/index.js +1 -1
- package/lib/nodes/index.js +3 -4
- package/lib/storage/localfilesystem/projects/index.js +3 -1
- package/locales/de/runtime.json +0 -1
- package/locales/en-US/runtime.json +0 -1
- package/locales/es-ES/runtime.json +0 -1
- package/locales/fr/runtime.json +4 -2
- package/locales/ja/runtime.json +1 -1
- package/locales/pt-BR/runtime.json +0 -1
- package/locales/ru/runtime.json +0 -1
- package/package.json +5 -4
package/lib/flows/Flow.js
CHANGED
|
@@ -678,6 +678,9 @@ class Flow {
|
|
|
678
678
|
if (logMessage.hasOwnProperty('stack')) {
|
|
679
679
|
errorMessage.error.stack = logMessage.stack;
|
|
680
680
|
}
|
|
681
|
+
if (logMessage.hasOwnProperty('cause')) {
|
|
682
|
+
errorMessage.error.cause = logMessage.cause;
|
|
683
|
+
}
|
|
681
684
|
targetCatchNode.receive(errorMessage);
|
|
682
685
|
handled = true;
|
|
683
686
|
});
|
package/lib/flows/Subflow.js
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
**/
|
|
16
16
|
|
|
17
17
|
const clone = require("clone");
|
|
18
|
+
const jsonClone = require("rfdc")();
|
|
18
19
|
const Flow = require('./Flow').Flow;
|
|
19
20
|
const context = require('../nodes/context');
|
|
20
21
|
const util = require("util");
|
|
@@ -108,7 +109,7 @@ class Subflow extends Flow {
|
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
|
|
111
|
-
subflowInternalFlowConfig.subflows =
|
|
112
|
+
subflowInternalFlowConfig.subflows = jsonClone(subflowDef.subflows || {});
|
|
112
113
|
|
|
113
114
|
remapSubflowNodes(subflowInternalFlowConfig.configs,node_map);
|
|
114
115
|
remapSubflowNodes(subflowInternalFlowConfig.nodes,node_map);
|
|
@@ -220,7 +221,7 @@ class Subflow extends Flow {
|
|
|
220
221
|
}
|
|
221
222
|
if (this.subflowDef.in) {
|
|
222
223
|
subflowInstanceConfig.wires = this.subflowDef.in.map(function(n) { return n.wires.map(function(w) { return self.node_map[w.id].id;})})
|
|
223
|
-
subflowInstanceConfig._originalWires =
|
|
224
|
+
subflowInstanceConfig._originalWires = jsonClone(subflowInstanceConfig.wires);
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
this.node = new Node(subflowInstanceConfig);
|
|
@@ -244,14 +245,14 @@ class Subflow extends Flow {
|
|
|
244
245
|
if (self.subflowDef.out) {
|
|
245
246
|
var node,wires,i,j;
|
|
246
247
|
// Restore the original wiring to the internal nodes
|
|
247
|
-
subflowInstanceConfig.wires =
|
|
248
|
+
subflowInstanceConfig.wires = jsonClone(subflowInstanceConfig._originalWires);
|
|
248
249
|
for (i=0;i<self.subflowDef.out.length;i++) {
|
|
249
250
|
wires = self.subflowDef.out[i].wires;
|
|
250
251
|
for (j=0;j<wires.length;j++) {
|
|
251
252
|
if (wires[j].id != self.subflowDef.id) {
|
|
252
253
|
node = self.node_map[wires[j].id];
|
|
253
254
|
if (node && node._originalWires) {
|
|
254
|
-
node.wires =
|
|
255
|
+
node.wires = jsonClone(node._originalWires);
|
|
255
256
|
}
|
|
256
257
|
}
|
|
257
258
|
}
|
|
@@ -300,7 +301,7 @@ class Subflow extends Flow {
|
|
|
300
301
|
var node = self.node_map[wires[j].id];
|
|
301
302
|
if (node) {
|
|
302
303
|
if (!node._originalWires) {
|
|
303
|
-
node._originalWires =
|
|
304
|
+
node._originalWires = jsonClone(node.wires);
|
|
304
305
|
}
|
|
305
306
|
node.wires[wires[j].port] = (node.wires[wires[j].port]||[]).concat(this.subflowInstance.wires[i]);
|
|
306
307
|
} else {
|
|
@@ -323,7 +324,7 @@ class Subflow extends Flow {
|
|
|
323
324
|
var node = self.node_map[wires[j].id];
|
|
324
325
|
if (node) {
|
|
325
326
|
if (!node._originalWires) {
|
|
326
|
-
node._originalWires =
|
|
327
|
+
node._originalWires = jsonClone(node.wires);
|
|
327
328
|
}
|
|
328
329
|
node.wires[wires[j].port] = (node.wires[wires[j].port]||[]);
|
|
329
330
|
node.wires[wires[j].port].push(subflowStatusId);
|
|
@@ -463,7 +464,7 @@ class Subflow extends Flow {
|
|
|
463
464
|
* @return {[type]} [description]
|
|
464
465
|
*/
|
|
465
466
|
function createNodeInSubflow(subflowInstanceId, def) {
|
|
466
|
-
let node =
|
|
467
|
+
let node = jsonClone(def);
|
|
467
468
|
let nid = `${subflowInstanceId}-${node.id}` //redUtil.generateId();
|
|
468
469
|
// console.log("Create Node In subflow",node._alias, "--->",nid, "(",node.type,")")
|
|
469
470
|
// node_map[node.id] = node;
|
package/lib/flows/index.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
**/
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const jsonClone = require("rfdc")();
|
|
18
18
|
|
|
19
19
|
var Flow = require('./Flow');
|
|
20
20
|
|
|
@@ -140,16 +140,16 @@ function setFlows(_config,_credentials,type,muteLog,forceStart,user) {
|
|
|
140
140
|
if (type === "load") {
|
|
141
141
|
isLoad = true;
|
|
142
142
|
configSavePromise = loadFlows().then(function(_config) {
|
|
143
|
-
config =
|
|
144
|
-
newFlowConfig = flowUtil.parseConfig(
|
|
143
|
+
config = jsonClone(_config.flows);
|
|
144
|
+
newFlowConfig = flowUtil.parseConfig(jsonClone(config));
|
|
145
145
|
type = "full";
|
|
146
146
|
return _config.rev;
|
|
147
147
|
});
|
|
148
148
|
} else {
|
|
149
149
|
// Clone the provided config so it can be manipulated
|
|
150
|
-
config =
|
|
150
|
+
config = jsonClone(_config);
|
|
151
151
|
// Parse the configuration
|
|
152
|
-
newFlowConfig = flowUtil.parseConfig(
|
|
152
|
+
newFlowConfig = flowUtil.parseConfig(jsonClone(config));
|
|
153
153
|
// Generate a diff to identify what has changed
|
|
154
154
|
diff = flowUtil.diffConfigs(activeFlowConfig,newFlowConfig);
|
|
155
155
|
|
|
@@ -609,7 +609,7 @@ async function addFlow(flow, user) {
|
|
|
609
609
|
nodes.push(node);
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
|
-
var newConfig =
|
|
612
|
+
var newConfig = jsonClone(activeConfig.flows);
|
|
613
613
|
newConfig = newConfig.concat(nodes);
|
|
614
614
|
|
|
615
615
|
return setFlows(newConfig, null, 'flows', true, null, user).then(function() {
|
|
@@ -650,7 +650,7 @@ function getFlow(id) {
|
|
|
650
650
|
var nodeIds = Object.keys(flow.nodes);
|
|
651
651
|
if (nodeIds.length > 0) {
|
|
652
652
|
result.nodes = nodeIds.map(function(nodeId) {
|
|
653
|
-
var node =
|
|
653
|
+
var node = jsonClone(flow.nodes[nodeId]);
|
|
654
654
|
if (node.type === 'link out') {
|
|
655
655
|
delete node.wires;
|
|
656
656
|
}
|
|
@@ -662,7 +662,7 @@ function getFlow(id) {
|
|
|
662
662
|
if (flow.configs) {
|
|
663
663
|
var configIds = Object.keys(flow.configs);
|
|
664
664
|
result.configs = configIds.map(function(configId) {
|
|
665
|
-
const node =
|
|
665
|
+
const node = jsonClone(flow.configs[configId]);
|
|
666
666
|
delete node.credentials;
|
|
667
667
|
return node
|
|
668
668
|
|
|
@@ -674,17 +674,17 @@ function getFlow(id) {
|
|
|
674
674
|
if (flow.subflows) {
|
|
675
675
|
var subflowIds = Object.keys(flow.subflows);
|
|
676
676
|
result.subflows = subflowIds.map(function(subflowId) {
|
|
677
|
-
var subflow =
|
|
677
|
+
var subflow = jsonClone(flow.subflows[subflowId]);
|
|
678
678
|
var nodeIds = Object.keys(subflow.nodes);
|
|
679
679
|
subflow.nodes = nodeIds.map(function(id) {
|
|
680
|
-
const node =
|
|
680
|
+
const node = jsonClone(subflow.nodes[id])
|
|
681
681
|
delete node.credentials
|
|
682
682
|
return node
|
|
683
683
|
});
|
|
684
684
|
if (subflow.configs) {
|
|
685
685
|
var configIds = Object.keys(subflow.configs);
|
|
686
686
|
subflow.configs = configIds.map(function(id) {
|
|
687
|
-
const node =
|
|
687
|
+
const node = jsonClone(subflow.configs[id])
|
|
688
688
|
delete node.credentials
|
|
689
689
|
return node
|
|
690
690
|
})
|
|
@@ -709,7 +709,7 @@ async function updateFlow(id,newFlow, user) {
|
|
|
709
709
|
}
|
|
710
710
|
label = activeFlowConfig.flows[id].label;
|
|
711
711
|
}
|
|
712
|
-
var newConfig =
|
|
712
|
+
var newConfig = jsonClone(activeConfig.flows);
|
|
713
713
|
var nodes;
|
|
714
714
|
|
|
715
715
|
if (id === 'global') {
|
|
@@ -779,7 +779,7 @@ async function removeFlow(id, user) {
|
|
|
779
779
|
throw e;
|
|
780
780
|
}
|
|
781
781
|
|
|
782
|
-
var newConfig =
|
|
782
|
+
var newConfig = jsonClone(activeConfig.flows);
|
|
783
783
|
newConfig = newConfig.filter(function(node) {
|
|
784
784
|
return node.z !== id && node.id !== id;
|
|
785
785
|
});
|
package/lib/flows/util.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
**/
|
|
16
|
-
const
|
|
16
|
+
const jsonClone = require("rfdc")();
|
|
17
17
|
const redUtil = require("@node-red/util").util;
|
|
18
18
|
const Log = require("@node-red/util").log;
|
|
19
19
|
const typeRegistry = require("@node-red/registry");
|
|
@@ -68,7 +68,7 @@ function mapEnvVarProperties(obj,prop,flow,config) {
|
|
|
68
68
|
if (obj[prop][0] === "$" && (EnvVarPropertyRE_old.test(v) || EnvVarPropertyRE.test(v)) ) {
|
|
69
69
|
const envVar = v.substring(2,v.length-1);
|
|
70
70
|
const r = redUtil.getSetting(config, envVar, flow);
|
|
71
|
-
if (r !== undefined
|
|
71
|
+
if (r !== undefined) {
|
|
72
72
|
obj[prop] = r
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -175,7 +175,7 @@ async function createNode(flow,config) {
|
|
|
175
175
|
try {
|
|
176
176
|
var nodeTypeConstructor = typeRegistry.get(type);
|
|
177
177
|
if (typeof nodeTypeConstructor === "function") {
|
|
178
|
-
var conf =
|
|
178
|
+
var conf = jsonClone(config);
|
|
179
179
|
delete conf.credentials;
|
|
180
180
|
try {
|
|
181
181
|
Object.defineProperty(conf,'_module', {value: typeRegistry.getNodeInfo(type), enumerable: false, writable: true })
|
|
@@ -202,8 +202,8 @@ async function createNode(flow,config) {
|
|
|
202
202
|
var subflowInstanceConfig = subflowConfig.subflows[nodeTypeConstructor.subflow.id];
|
|
203
203
|
delete subflowConfig.subflows[nodeTypeConstructor.subflow.id];
|
|
204
204
|
subflowInstanceConfig.subflows = subflowConfig.subflows;
|
|
205
|
-
var instanceConfig =
|
|
206
|
-
instanceConfig.env =
|
|
205
|
+
var instanceConfig = jsonClone(config);
|
|
206
|
+
instanceConfig.env = jsonClone(nodeTypeConstructor.subflow.env);
|
|
207
207
|
|
|
208
208
|
instanceConfig.env = nodeTypeConstructor.subflow.env.map(nodeProp => {
|
|
209
209
|
var nodePropType;
|
|
@@ -256,7 +256,7 @@ function parseConfig(config) {
|
|
|
256
256
|
flow.missingTypes = [];
|
|
257
257
|
|
|
258
258
|
config.forEach(function (n) {
|
|
259
|
-
flow.allNodes[n.id] =
|
|
259
|
+
flow.allNodes[n.id] = jsonClone(n);
|
|
260
260
|
if (n.type === 'tab') {
|
|
261
261
|
flow.flows[n.id] = n;
|
|
262
262
|
flow.flows[n.id].subflows = {};
|
package/lib/multiplayer/index.js
CHANGED
package/lib/nodes/index.js
CHANGED
|
@@ -14,9 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
**/
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var clone = require("clone");
|
|
17
|
+
|
|
18
|
+
const jsonClone = require("rfdc")();
|
|
20
19
|
var util = require("util");
|
|
21
20
|
|
|
22
21
|
var registry = require("@node-red/registry");
|
|
@@ -98,7 +97,7 @@ function createNode(node,def) {
|
|
|
98
97
|
}
|
|
99
98
|
var creds = credentials.get(id);
|
|
100
99
|
if (creds) {
|
|
101
|
-
creds =
|
|
100
|
+
creds = jsonClone(creds);
|
|
102
101
|
//console.log("Attaching credentials to ",node.id);
|
|
103
102
|
// allow $(foo) syntax to substitute env variables for credentials also...
|
|
104
103
|
for (var p in creds) {
|
|
@@ -242,7 +242,9 @@ function loadProject(name) {
|
|
|
242
242
|
|
|
243
243
|
function getProject(user, name) {
|
|
244
244
|
checkActiveProject(name);
|
|
245
|
-
return
|
|
245
|
+
return loadProject(name).then(function () {
|
|
246
|
+
return Promise.resolve(activeProject.export());
|
|
247
|
+
});
|
|
246
248
|
}
|
|
247
249
|
|
|
248
250
|
function deleteProject(user, name) {
|
package/locales/de/runtime.json
CHANGED
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
"refresh-interval": "Erneuerung der https-Einstellungen erfolgt alle __interval__ Stunden",
|
|
57
57
|
"settings-refreshed": "https-Einstellungen wurden erneuert",
|
|
58
58
|
"refresh-failed": "Erneuerung der https-Einstellungen fehlgeschlagen: __message__",
|
|
59
|
-
"nodejs-version": "httpsRefreshInterval erfordert Node.js 11 oder höher",
|
|
60
59
|
"function-required": "httpsRefreshInterval erfordert die https-Eigenschaft in Form einer Funktion"
|
|
61
60
|
}
|
|
62
61
|
},
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
"refresh-interval": "Refreshing https settings every __interval__ hours",
|
|
59
59
|
"settings-refreshed": "Server https settings have been refreshed",
|
|
60
60
|
"refresh-failed": "Failed to refresh https settings: __message__",
|
|
61
|
-
"nodejs-version": "httpsRefreshInterval requires Node.js 11 or later",
|
|
62
61
|
"function-required": "httpsRefreshInterval requires https property to be a function"
|
|
63
62
|
}
|
|
64
63
|
},
|
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
"refresh-interval": "Actualizando la configuración HTTPS cada __interval__ horas",
|
|
58
58
|
"settings-refreshed": "La configuración HTTPS del servidor se ha actualizado",
|
|
59
59
|
"refresh-failed": "No se pudo actualizar la configuración HTTPS: __message__",
|
|
60
|
-
"nodejs-version": "httpsRefreshInterval requiere Node.js 11 o superior",
|
|
61
60
|
"function-required": "httpsRefreshInterval requiere que la propiedad HTTPS sea una función"
|
|
62
61
|
}
|
|
63
62
|
},
|
package/locales/fr/runtime.json
CHANGED
|
@@ -20,10 +20,12 @@
|
|
|
20
20
|
"errors-help": "Exécuter avec -v pour plus de détails",
|
|
21
21
|
"missing-modules": "Modules de noeud manquants :",
|
|
22
22
|
"node-version-mismatch": "Le module de noeud ne peut pas être chargé sur cette version. Nécessite : __version__ ",
|
|
23
|
+
"set-has-no-types": "L'ensemble n'a aucun type. Nom : '__name__', module : '__module__', fichier : '__file__'",
|
|
23
24
|
"type-already-registered": "'__type__' déjà enregistré par le module __module__",
|
|
24
25
|
"removing-modules": "Suppression de modules de la configuration",
|
|
25
26
|
"added-types": "Types de noeuds ajoutés :",
|
|
26
27
|
"removed-types": "Types de noeuds supprimés :",
|
|
28
|
+
"removed-plugins": "Plugins supprimés :",
|
|
27
29
|
"install": {
|
|
28
30
|
"invalid": "Nom de module invalide",
|
|
29
31
|
"installing": "Installation du module : __name__, version : __version__",
|
|
@@ -56,7 +58,6 @@
|
|
|
56
58
|
"refresh-interval": "Actualisation des paramètres https toutes les __interval__ heures",
|
|
57
59
|
"settings-refreshed": "Les paramètres https du serveur ont été actualisés",
|
|
58
60
|
"refresh-failed": "Échec de l'actualisation des paramètres https : __message__",
|
|
59
|
-
"nodejs-version": "httpsRefreshInterval nécessite Node.js 11 ou version ultérieure",
|
|
60
61
|
"function-required": "httpsRefreshInterval nécessite que la propriété https soit une fonction"
|
|
61
62
|
}
|
|
62
63
|
},
|
|
@@ -134,7 +135,8 @@
|
|
|
134
135
|
"flow": {
|
|
135
136
|
"unknown-type": "Type inconnu : __type__",
|
|
136
137
|
"missing-types": "Types manquants",
|
|
137
|
-
"error-loop": "Le message a dépassé le nombre maximum de captures (catches)"
|
|
138
|
+
"error-loop": "Le message a dépassé le nombre maximum de captures (catches)",
|
|
139
|
+
"non-message-returned": "Le noeud a tenté d'envoyer un message du type __type__"
|
|
138
140
|
},
|
|
139
141
|
"index": {
|
|
140
142
|
"unrecognised-id": "Identifiant non reconnu : __id__",
|
package/locales/ja/runtime.json
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"removing-modules": "設定からモジュールを削除します",
|
|
26
26
|
"added-types": "追加したノード:",
|
|
27
27
|
"removed-types": "削除したノード:",
|
|
28
|
+
"removed-plugins": "削除したプラグイン:",
|
|
28
29
|
"install": {
|
|
29
30
|
"invalid": "不正なモジュール名",
|
|
30
31
|
"installing": "モジュール __name__, バージョン: __version__ をインストールします",
|
|
@@ -57,7 +58,6 @@
|
|
|
57
58
|
"refresh-interval": "__interval__ 時間毎にhttps設定を更新します",
|
|
58
59
|
"settings-refreshed": "サーバのhttps設定が更新されました",
|
|
59
60
|
"refresh-failed": "https設定の更新で失敗しました: __message__",
|
|
60
|
-
"nodejs-version": "httpsRefreshIntervalにはNode.js 11以降が必要です",
|
|
61
61
|
"function-required": "httpsRefreshIntervalでは、httpsプロパティはfunctionである必要があります"
|
|
62
62
|
}
|
|
63
63
|
},
|
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
"refresh-interval": "Atualizando as configurações de https a cada __interval__ hora(s)",
|
|
58
58
|
"settings-refreshed": "As configurações https do servidor foram atualizadas",
|
|
59
59
|
"refresh-failed": "Falha ao atualizar as configurações https: __message__",
|
|
60
|
-
"nodejs-version": "httpsRefreshInterval requer Node.js 11 ou posterior",
|
|
61
60
|
"function-required": "httpsRefreshInterval requer que a propriedade https seja uma função"
|
|
62
61
|
}
|
|
63
62
|
},
|
package/locales/ru/runtime.json
CHANGED
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
"refresh-interval": "Обновление настроек https каждые __interval__ часов",
|
|
56
56
|
"settings-refreshed": "Настройки сервера https обновлены",
|
|
57
57
|
"refresh-failed": "Не удалось обновить настройки https: __message__",
|
|
58
|
-
"nodejs-version": "httpsRefreshInterval требует Node.js 11 или выше",
|
|
59
58
|
"function-required": "httpsRefreshInterval требует, чтобы свойство https было функцией"
|
|
60
59
|
}
|
|
61
60
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-red/runtime",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -16,12 +16,13 @@
|
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@node-red/registry": "4.0.0-beta.
|
|
20
|
-
"@node-red/util": "4.0.0-beta.
|
|
19
|
+
"@node-red/registry": "4.0.0-beta.3",
|
|
20
|
+
"@node-red/util": "4.0.0-beta.3",
|
|
21
21
|
"async-mutex": "0.4.0",
|
|
22
22
|
"clone": "2.1.2",
|
|
23
23
|
"express": "4.19.2",
|
|
24
24
|
"fs-extra": "11.1.1",
|
|
25
|
-
"json-stringify-safe": "5.0.1"
|
|
25
|
+
"json-stringify-safe": "5.0.1",
|
|
26
|
+
"rfdc": "^1.3.1"
|
|
26
27
|
}
|
|
27
28
|
}
|