@node-red/runtime 4.0.0 → 4.0.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.
@@ -645,16 +645,27 @@ function getFlow(id) {
645
645
  if (id !== 'global') {
646
646
  result.nodes = [];
647
647
  }
648
+
649
+ if (flow.groups) {
650
+ var nodeIds = Object.keys(flow.groups);
651
+ if (nodeIds.length > 0) {
652
+ nodeIds.forEach(function(nodeId) {
653
+ var node = jsonClone(flow.groups[nodeId]);
654
+ delete node.credentials;
655
+ result.nodes.push(node)
656
+ })
657
+ }
658
+ }
648
659
  if (flow.nodes) {
649
660
  var nodeIds = Object.keys(flow.nodes);
650
661
  if (nodeIds.length > 0) {
651
- result.nodes = nodeIds.map(function(nodeId) {
662
+ nodeIds.forEach(function(nodeId) {
652
663
  var node = jsonClone(flow.nodes[nodeId]);
653
664
  if (node.type === 'link out') {
654
665
  delete node.wires;
655
666
  }
656
667
  delete node.credentials;
657
- return node;
668
+ result.nodes.push(node)
658
669
  })
659
670
  }
660
671
  }
@@ -680,6 +691,17 @@ function getFlow(id) {
680
691
  delete node.credentials
681
692
  return node
682
693
  });
694
+ if (subflow.groups) {
695
+ var nodeIds = Object.keys(subflow.groups);
696
+ if (nodeIds.length > 0) {
697
+ nodeIds.forEach(function(nodeId) {
698
+ var node = jsonClone(subflow.groups[nodeId]);
699
+ delete node.credentials;
700
+ subflow.nodes.push(node)
701
+ })
702
+ }
703
+ delete subflow.groups
704
+ }
683
705
  if (subflow.configs) {
684
706
  var configIds = Object.keys(subflow.configs);
685
707
  subflow.configs = configIds.map(function(id) {
@@ -23,14 +23,16 @@ module.exports = {
23
23
  if (existingSessionId) {
24
24
  connections.delete(opts.session)
25
25
  const session = sessions.get(existingSessionId)
26
- session.active = false
27
- session.idleTimeout = setTimeout(() => {
28
- sessions.delete(existingSessionId)
29
- }, 30000)
30
- runtime.events.emit('comms', {
31
- topic: "multiplayer/connection-removed",
32
- data: { session: existingSessionId }
33
- })
26
+ if (session) {
27
+ session.active = false
28
+ session.idleTimeout = setTimeout(() => {
29
+ sessions.delete(existingSessionId)
30
+ }, 30000)
31
+ runtime.events.emit('comms', {
32
+ topic: "multiplayer/connection-removed",
33
+ data: { session: existingSessionId }
34
+ })
35
+ }
34
36
  }
35
37
  })
36
38
  runtime.events.on('comms:message:multiplayer/connect', (opts) => {
@@ -91,29 +93,31 @@ module.exports = {
91
93
  const sessionId = connections.get(opts.session)
92
94
  const session = sessions.get(sessionId)
93
95
 
94
- if (opts.user) {
95
- if (session.user.anonymous !== opts.user.anonymous) {
96
- session.user = opts.user
97
- runtime.events.emit('comms', {
98
- topic: 'multiplayer/connection-added',
99
- excludeSession: opts.session,
100
- data: session
101
- })
96
+ if (session) {
97
+ if (opts.user) {
98
+ if (session.user.anonymous !== opts.user.anonymous) {
99
+ session.user = opts.user
100
+ runtime.events.emit('comms', {
101
+ topic: 'multiplayer/connection-added',
102
+ excludeSession: opts.session,
103
+ data: session
104
+ })
105
+ }
102
106
  }
103
- }
104
107
 
105
- session.location = opts.data
108
+ session.location = opts.data
106
109
 
107
- const payload = {
108
- session: sessionId,
109
- workspace: opts.data.workspace,
110
- node: opts.data.node
110
+ const payload = {
111
+ session: sessionId,
112
+ workspace: opts.data.workspace,
113
+ node: opts.data.node
114
+ }
115
+ runtime.events.emit('comms', {
116
+ topic: 'multiplayer/location',
117
+ data: payload,
118
+ excludeSession: opts.session
119
+ })
111
120
  }
112
- runtime.events.emit('comms', {
113
- topic: 'multiplayer/location',
114
- data: payload,
115
- excludeSession: opts.session
116
- })
117
121
  })
118
122
  }
119
123
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-red/runtime",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./lib/index.js",
6
6
  "repository": {
@@ -16,8 +16,8 @@
16
16
  }
17
17
  ],
18
18
  "dependencies": {
19
- "@node-red/registry": "4.0.0",
20
- "@node-red/util": "4.0.0",
19
+ "@node-red/registry": "4.0.2",
20
+ "@node-red/util": "4.0.2",
21
21
  "async-mutex": "0.5.0",
22
22
  "clone": "2.1.2",
23
23
  "express": "4.19.2",