@node-red/runtime 3.1.0-beta.2 → 3.1.0-beta.4
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 +140 -164
- package/lib/flows/Group.js +55 -0
- package/lib/flows/Subflow.js +19 -52
- package/lib/flows/index.js +14 -20
- package/lib/flows/util.js +478 -414
- package/lib/index.js +9 -0
- package/lib/nodes/index.js +0 -1
- package/package.json +4 -4
package/lib/flows/index.js
CHANGED
|
@@ -271,6 +271,10 @@ function getFlows() {
|
|
|
271
271
|
|
|
272
272
|
async function start(type,diff,muteLog,isDeploy) {
|
|
273
273
|
type = type || "full";
|
|
274
|
+
if (diff && diff.globalConfigChanged) {
|
|
275
|
+
type = 'full'
|
|
276
|
+
}
|
|
277
|
+
|
|
274
278
|
started = true;
|
|
275
279
|
state = 'start'
|
|
276
280
|
var i;
|
|
@@ -359,7 +363,7 @@ async function start(type,diff,muteLog,isDeploy) {
|
|
|
359
363
|
if (activeFlowConfig.flows.hasOwnProperty(id)) {
|
|
360
364
|
if (!activeFlowConfig.flows[id].disabled && !activeFlows[id]) {
|
|
361
365
|
// This flow is not disabled, nor is it currently active, so create it
|
|
362
|
-
activeFlows[id] = Flow.create(
|
|
366
|
+
activeFlows[id] = Flow.create(activeFlows['global'],activeFlowConfig,activeFlowConfig.flows[id]);
|
|
363
367
|
log.debug("red/nodes/flows.start : starting flow : "+id);
|
|
364
368
|
} else {
|
|
365
369
|
log.debug("red/nodes/flows.start : not starting disabled flow : "+id);
|
|
@@ -379,7 +383,7 @@ async function start(type,diff,muteLog,isDeploy) {
|
|
|
379
383
|
activeFlows[id].update(activeFlowConfig,activeFlowConfig.flows[id]);
|
|
380
384
|
} else {
|
|
381
385
|
// This flow didn't previously exist, so create it
|
|
382
|
-
activeFlows[id] = Flow.create(
|
|
386
|
+
activeFlows[id] = Flow.create(activeFlows['global'],activeFlowConfig,activeFlowConfig.flows[id]);
|
|
383
387
|
log.debug("red/nodes/flows.start : starting flow : "+id);
|
|
384
388
|
}
|
|
385
389
|
} else {
|
|
@@ -391,7 +395,7 @@ async function start(type,diff,muteLog,isDeploy) {
|
|
|
391
395
|
for (id in activeFlows) {
|
|
392
396
|
if (activeFlows.hasOwnProperty(id)) {
|
|
393
397
|
try {
|
|
394
|
-
activeFlows[id].start(diff);
|
|
398
|
+
await activeFlows[id].start(diff);
|
|
395
399
|
// Create a map of node id to flow id and also a subflowInstance lookup map
|
|
396
400
|
var activeNodes = activeFlows[id].getActiveNodes();
|
|
397
401
|
Object.keys(activeNodes).forEach(function(nid) {
|
|
@@ -432,7 +436,8 @@ function stop(type,diff,muteLog,isDeploy) {
|
|
|
432
436
|
changed:[],
|
|
433
437
|
removed:[],
|
|
434
438
|
rewired:[],
|
|
435
|
-
linked:[]
|
|
439
|
+
linked:[],
|
|
440
|
+
flowChanged:[]
|
|
436
441
|
};
|
|
437
442
|
if (!muteLog) {
|
|
438
443
|
if (type !== "full") {
|
|
@@ -441,6 +446,9 @@ function stop(type,diff,muteLog,isDeploy) {
|
|
|
441
446
|
log.info(log._("nodes.flows.stopping-flows"));
|
|
442
447
|
}
|
|
443
448
|
}
|
|
449
|
+
if (diff.globalConfigChanged) {
|
|
450
|
+
type = 'full'
|
|
451
|
+
}
|
|
444
452
|
started = false;
|
|
445
453
|
state = 'stop'
|
|
446
454
|
var promises = [];
|
|
@@ -464,7 +472,7 @@ function stop(type,diff,muteLog,isDeploy) {
|
|
|
464
472
|
|
|
465
473
|
activeFlowIds.forEach(id => {
|
|
466
474
|
if (activeFlows.hasOwnProperty(id)) {
|
|
467
|
-
var flowStateChanged = diff && (diff.added.indexOf(id) !== -1 || diff.removed.indexOf(id) !== -1);
|
|
475
|
+
var flowStateChanged = diff && (diff.flowChanged.indexOf(id) !== -1 || diff.added.indexOf(id) !== -1 || diff.removed.indexOf(id) !== -1);
|
|
468
476
|
log.debug("red/nodes/flows.stop : stopping flow : "+id);
|
|
469
477
|
promises.push(activeFlows[id].stop(flowStateChanged?null:stopList,removedList));
|
|
470
478
|
if (type === "full" || flowStateChanged || diff.removed.indexOf(id)!==-1) {
|
|
@@ -784,17 +792,6 @@ const flowAPI = {
|
|
|
784
792
|
log: m => log.log(m)
|
|
785
793
|
}
|
|
786
794
|
|
|
787
|
-
|
|
788
|
-
function getGlobalConfig() {
|
|
789
|
-
let gconf = null;
|
|
790
|
-
eachNode((n) => {
|
|
791
|
-
if (n.type === "global-config") {
|
|
792
|
-
gconf = n;
|
|
793
|
-
}
|
|
794
|
-
});
|
|
795
|
-
return gconf;
|
|
796
|
-
}
|
|
797
|
-
|
|
798
795
|
module.exports = {
|
|
799
796
|
init: init,
|
|
800
797
|
|
|
@@ -807,10 +804,7 @@ module.exports = {
|
|
|
807
804
|
|
|
808
805
|
get:getNode,
|
|
809
806
|
eachNode: eachNode,
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
getGlobalConfig: getGlobalConfig,
|
|
813
|
-
|
|
807
|
+
|
|
814
808
|
/**
|
|
815
809
|
* Gets the current flow configuration
|
|
816
810
|
*/
|