@node-red/runtime 3.1.0-beta.2 → 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/lib/flows/Flow.js CHANGED
@@ -606,10 +606,36 @@ class Flow {
606
606
  }
607
607
  handled = true;
608
608
  } else {
609
- this.statusNodes.forEach(function(targetStatusNode) {
610
- if (targetStatusNode.scope && targetStatusNode.scope.indexOf(reportingNode.id) === -1) {
609
+ const candidateNodes = [];
610
+ this.statusNodes.forEach(targetStatusNode => {
611
+ if (targetStatusNode.g && targetStatusNode.scope === 'group' && !reportingNode.g) {
612
+ // Status node inside a group, reporting node not in a group - skip it
613
+ return
614
+ }
615
+ if (Array.isArray(targetStatusNode.scope) && targetStatusNode.scope.indexOf(reportingNode.id) === -1) {
611
616
  return;
612
617
  }
618
+ let distance = 0
619
+ if (reportingNode.g) {
620
+ // Reporting node inside a group. Calculate the distance between it and the status node
621
+ let containingGroup = this.global.groups[reportingNode.g]
622
+ while (containingGroup && containingGroup.id !== targetStatusNode.g) {
623
+ distance++
624
+ containingGroup = this.global.groups[containingGroup.g]
625
+ }
626
+ if (!containingGroup && targetStatusNode.g && targetStatusNode.scope === 'group') {
627
+ // This status node is in a group, but not in the same hierachy
628
+ // the reporting node is in
629
+ return
630
+ }
631
+ }
632
+ candidateNodes.push({ d: distance, n: targetStatusNode })
633
+ })
634
+ candidateNodes.sort((A,B) => {
635
+ return A.d - B.d
636
+ })
637
+ candidateNodes.forEach(candidate => {
638
+ const targetStatusNode = candidate.n
613
639
  var message = {
614
640
  status: clone(statusMessage)
615
641
  }
@@ -667,21 +693,46 @@ class Flow {
667
693
  }
668
694
  handled = true;
669
695
  } else {
670
- var handledByUncaught = false;
671
-
672
- this.catchNodes.forEach(function(targetCatchNode) {
673
- if (targetCatchNode.scope && targetCatchNode.scope.indexOf(reportingNode.id) === -1) {
696
+ const candidateNodes = [];
697
+ this.catchNodes.forEach(targetCatchNode => {
698
+ if (targetCatchNode.g && targetCatchNode.scope === 'group' && !reportingNode.g) {
699
+ // Catch node inside a group, reporting node not in a group - skip it
700
+ return
701
+ }
702
+ if (Array.isArray(targetCatchNode.scope) && targetCatchNode.scope.indexOf(reportingNode.id) === -1) {
703
+ // Catch node has a scope set and it doesn't include the reporting node
674
704
  return;
675
705
  }
676
- if (!targetCatchNode.scope && targetCatchNode.uncaught && !handledByUncaught) {
706
+ let distance = 0
707
+ if (reportingNode.g) {
708
+ // Reporting node inside a group. Calculate the distance between it and the catch node
709
+ let containingGroup = this.global.groups[reportingNode.g]
710
+ while (containingGroup && containingGroup.id !== targetCatchNode.g) {
711
+ distance++
712
+ containingGroup = this.global.groups[containingGroup.g]
713
+ }
714
+ if (!containingGroup && targetCatchNode.g && targetCatchNode.scope === 'group') {
715
+ // This catch node is in a group, but not in the same hierachy
716
+ // the reporting node is in
717
+ return
718
+ }
719
+ }
720
+ candidateNodes.push({ d: distance, n: targetCatchNode })
721
+ })
722
+ candidateNodes.sort((A,B) => {
723
+ return A.d - B.d
724
+ })
725
+ let handledByUncaught = false
726
+ candidateNodes.forEach(candidate => {
727
+ const targetCatchNode = candidate.n
728
+ if (targetCatchNode.uncaught && !handledByUncaught) {
729
+ // This node only wants errors that haven't already been handled
677
730
  if (handled) {
678
- // This has been handled by a !uncaught catch node
679
- return;
731
+ return
680
732
  }
681
- // This is an uncaught error
682
- handledByUncaught = true;
733
+ handledByUncaught = true
683
734
  }
684
- var errorMessage;
735
+ let errorMessage;
685
736
  if (msg) {
686
737
  errorMessage = redUtil.cloneMessage(msg);
687
738
  } else {
package/lib/flows/util.js CHANGED
@@ -201,7 +201,9 @@ function parseConfig(config) {
201
201
  if (subflowDetails) {
202
202
  var subflowType = subflowDetails[1]
203
203
  n.subflow = subflowType;
204
- flow.subflows[subflowType].instances.push(n)
204
+ if (flow.subflows[subflowType]) {
205
+ flow.subflows[subflowType].instances.push(n)
206
+ }
205
207
  }
206
208
  if (container) {
207
209
  container.nodes[n.id] = n;
package/lib/index.js CHANGED
@@ -89,6 +89,15 @@ function init(userSettings,httpServer,_adminApi) {
89
89
 
90
90
  nodeApp = express();
91
91
  adminApp = express();
92
+ const defaultServerSettings = {
93
+ "x-powered-by": false
94
+ }
95
+ const serverSettings = Object.assign({},defaultServerSettings,userSettings.httpServerOptions||{});
96
+ for (let eOption in serverSettings) {
97
+ nodeApp.set(eOption, serverSettings[eOption]);
98
+ adminApp.set(eOption, serverSettings[eOption]);
99
+ }
100
+
92
101
 
93
102
  if (_adminApi) {
94
103
  adminApi = _adminApi;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-red/runtime",
3
- "version": "3.1.0-beta.2",
3
+ "version": "3.1.0-beta.3",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./lib/index.js",
6
6
  "repository": {
@@ -16,12 +16,12 @@
16
16
  }
17
17
  ],
18
18
  "dependencies": {
19
- "@node-red/registry": "3.1.0-beta.2",
20
- "@node-red/util": "3.1.0-beta.2",
19
+ "@node-red/registry": "3.1.0-beta.3",
20
+ "@node-red/util": "3.1.0-beta.3",
21
21
  "async-mutex": "0.4.0",
22
22
  "clone": "2.1.2",
23
23
  "express": "4.18.2",
24
- "fs-extra": "10.1.0",
24
+ "fs-extra": "11.1.1",
25
25
  "json-stringify-safe": "5.0.1"
26
26
  }
27
27
  }