@5minds/node-red-contrib-processcube 1.5.10-feature-c578ab-m4jpoj9a → 1.5.10-feature-70f7fe-m4jq28wc

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.
@@ -6,6 +6,17 @@ module.exports = function (RED) {
6
6
 
7
7
  let subscription = null;
8
8
 
9
+ const eventEmitter = node.engine.eventEmitter;
10
+
11
+ eventEmitter.on('engine-client-dispose', () => {
12
+ node.engine.engineClient.events.removeSubscription(subscription, node.engine.identity);
13
+ });
14
+
15
+ eventEmitter.on('engine-client-changed', () => {
16
+ node.log('new engineClient received');
17
+ register();
18
+ });
19
+
9
20
  const register = async () => {
10
21
  const client = node.engine.engineClient;
11
22
 
@@ -6,6 +6,17 @@ module.exports = function (RED) {
6
6
 
7
7
  let subscription;
8
8
 
9
+ const eventEmitter = node.engine.eventEmitter;
10
+
11
+ eventEmitter.on('engine-client-dispose', () => {
12
+ node.engine.engineClient.notification.removeSubscription(subscription, node.engine.identity);
13
+ });
14
+
15
+ eventEmitter.on('engine-client-changed', () => {
16
+ node.log('new engineClient received');
17
+ register();
18
+ });
19
+
9
20
  const register = async () => {
10
21
  let currentIdentity = node.engine.identity;
11
22
 
@@ -16,7 +16,7 @@ module.exports = function (RED) {
16
16
  var node = this;
17
17
  var flowContext = node.context().flow;
18
18
 
19
- node.engine = RED.nodes.getNode(config.engine);
19
+ const engine = RED.nodes.getNode(config.engine);
20
20
 
21
21
  var eventEmitter = flowContext.get('emitter');
22
22
 
@@ -25,6 +25,13 @@ module.exports = function (RED) {
25
25
  eventEmitter = flowContext.get('emitter');
26
26
  }
27
27
 
28
+ const engineEventEmitter = engine.eventEmitter;
29
+
30
+ engineEventEmitter.on('engine-client-changed', () => {
31
+ node.log('new engineClient received');
32
+ register();
33
+ });
34
+
28
35
  const register = async () => {
29
36
  if (node.etw) {
30
37
  try {
@@ -34,7 +41,7 @@ module.exports = function (RED) {
34
41
  node.log(`cant close etw: ${JSON.stringify(node.etw)}`);
35
42
  }
36
43
  }
37
- const client = node.engine.engineClient;
44
+ const client = engine.engineClient;
38
45
 
39
46
  if (!client) {
40
47
  node.error('No engine configured.');
@@ -126,8 +133,8 @@ module.exports = function (RED) {
126
133
 
127
134
  node.etw = externalTaskWorker;
128
135
 
129
- externalTaskWorker.identity = node.engine.identity;
130
- node.engine.registerOnIdentityChanged((identity) => {
136
+ externalTaskWorker.identity = engine.identity;
137
+ engine.registerOnIdentityChanged((identity) => {
131
138
  externalTaskWorker.identity = identity;
132
139
  });
133
140
 
@@ -178,7 +185,7 @@ module.exports = function (RED) {
178
185
  });
179
186
  };
180
187
 
181
- if (node.engine) {
188
+ if (engine) {
182
189
  register();
183
190
  }
184
191
  }
@@ -5,19 +5,19 @@ module.exports = function (RED) {
5
5
 
6
6
  node.on('input', function (msg) {
7
7
 
8
- node.engine = RED.nodes.getNode(config.engine);
9
- const client = node.engine.engineClient;
8
+ const engine = RED.nodes.getNode(config.engine);
9
+ const client = engine.engineClient;
10
10
 
11
11
  if (!client) {
12
12
  node.error('No engine configured.');
13
13
  return;
14
14
  }
15
15
 
16
- node.engine.engineClient.events
16
+ engine.engineClient.events
17
17
  .triggerMessageEvent(config.messagename, {
18
18
  processInstanceId: msg.processinstanceid,
19
19
  payload: msg.payload,
20
- identity: node.engine.identity,
20
+ identity: engine.identity,
21
21
  })
22
22
  .then((result) => {
23
23
  msg.payload = result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.5.10-feature-c578ab-m4jpoj9a",
3
+ "version": "1.5.10-feature-70f7fe-m4jq28wc",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -6,6 +6,17 @@ module.exports = function (RED) {
6
6
 
7
7
  let subscription;
8
8
 
9
+ const engineEventEmitter = node.engine.eventEmitter;
10
+
11
+ engineEventEmitter.on('engine-client-dispose', () => {
12
+ node.engine.engineClient.notification.removeSubscription(subscription, node.engine.identity);
13
+ });
14
+
15
+ engineEventEmitter.on('engine-client-changed', () => {
16
+ node.log('new engineClient received');
17
+ register();
18
+ });
19
+
9
20
  const register = async () => {
10
21
  const client = node.engine.engineClient;
11
22
 
package/process-start.js CHANGED
@@ -22,8 +22,8 @@ module.exports = function (RED) {
22
22
  return;
23
23
  }
24
24
 
25
- node.engine = RED.nodes.getNode(config.engine);
26
- const client = node.engine.engineClient;
25
+ const engine = RED.nodes.getNode(config.engine);
26
+ const client = engine.engineClient;
27
27
 
28
28
  if (!client) {
29
29
  node.error('No engine configured.');
@@ -31,7 +31,7 @@ module.exports = function (RED) {
31
31
  }
32
32
 
33
33
  client.processDefinitions
34
- .startProcessInstance(startParameters, node.engine.identity)
34
+ .startProcessInstance(startParameters, engine.identity)
35
35
  .then((result) => {
36
36
  msg.payload = result;
37
37
 
@@ -4,8 +4,8 @@ module.exports = function (RED) {
4
4
  var node = this;
5
5
 
6
6
  node.on('input', function (msg) {
7
- node.engine = RED.nodes.getNode(config.engine);
8
- const client = node.engine.engineClient;
7
+ const engine = RED.nodes.getNode(config.engine);
8
+ const client = engine.engineClient;
9
9
 
10
10
  if (!client) {
11
11
  node.error('No engine configured.');
@@ -13,7 +13,7 @@ module.exports = function (RED) {
13
13
  }
14
14
 
15
15
  client.processInstances
16
- .terminateProcessInstance(msg.payload, node.engine.identity)
16
+ .terminateProcessInstance(msg.payload, engine.identity)
17
17
  .then(() => {
18
18
  node.send(msg);
19
19
  })
@@ -4,7 +4,7 @@
4
4
  defaults: {
5
5
  name: { value: '' },
6
6
  url: { value: 'http://engine:8000', required: true },
7
- urlType: { type: 'str' },
7
+ urlType: { type: 'str'},
8
8
  clientId: { value: '' },
9
9
  clientIdType: { type: 'str' },
10
10
  clientSecret: { value: '' },
@@ -16,17 +16,17 @@
16
16
  oneditprepare: function () {
17
17
  $('#node-config-input-url').typedInput({
18
18
  default: 'str',
19
- types: ['str', 'env', 'cred'],
19
+ types: ['str', 'global', 'flow', 'env', 'msg', 'cred'],
20
20
  });
21
21
 
22
22
  $('#node-config-input-clientId').typedInput({
23
23
  default: 'str',
24
- types: ['str', 'env', 'cred'],
24
+ types: ['str', 'global', 'flow', 'env', 'msg', 'cred'],
25
25
  });
26
26
 
27
27
  $('#node-config-input-clientSecret').typedInput({
28
28
  default: 'str',
29
- types: ['str', 'env', 'cred'],
29
+ types: ['str', 'global', 'flow', 'env', 'msg', 'cred'],
30
30
  });
31
31
 
32
32
  $('#node-config-input-url').typedInput('value', this.url);
@@ -66,21 +66,21 @@
66
66
  </div>
67
67
  <div class="form-row">
68
68
  <label for="node-config-input-clientSecret"><i class="fa fa-bookmark"></i> Client secret</label>
69
- <input type="text" id="node-config-input-clientSecret" />
69
+ <input type="password" id="node-config-input-clientSecret" />
70
70
  </div>
71
71
  </script>
72
72
 
73
73
  <script type="text/markdown" data-help-name="processcube-engine-config">
74
- The configuration for the ProcessCube engine.
74
+ The configuration for the ProcessCube engine.
75
75
 
76
- ## Inputs
76
+ ## Inputs
77
77
 
78
- : url (String) : The URL of the ProcessCube engine.
79
- : clientId (String) : The client id for the ProcessCube engine.
80
- : clientSecret (String) : The client secret for the ProcessCube engine.
78
+ : url (String) : The URL of the ProcessCube engine.
79
+ : clientId (String) : The client id for the ProcessCube engine.
80
+ : clientSecret (String) : The client secret for the ProcessCube engine.
81
81
 
82
- ### References
82
+ ### References
83
83
 
84
- - [The ProcessCube&copy; Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
85
- - [ProcessCube&copy; LowCode Integration](https://processcube.io/docs/node-red) - LowCode integration in ProcessCube&copy;
84
+ - [The ProcessCube&copy; Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
85
+ - [ProcessCube&copy; LowCode Integration](https://processcube.io/docs/node-red) - LowCode integration in ProcessCube&copy;
86
86
  </script>
@@ -1,3 +1,4 @@
1
+ const EventEmitter = require('node:events');
1
2
  const engine_client = require('@5minds/processcube_engine_client');
2
3
  const jwt = require('jwt-decode');
3
4
  const oidc = require('openid-client');
@@ -7,92 +8,134 @@ module.exports = function (RED) {
7
8
  RED.nodes.createNode(this, n);
8
9
  const node = this;
9
10
  const identityChangedCallbacks = [];
10
- node.identity = null;
11
+ this.identity = null;
11
12
 
12
- node.credentials.clientId = RED.util.evaluateNodeProperty(n.clientId, n.clientIdType, node);
13
- node.credentials.clientSecret = RED.util.evaluateNodeProperty(n.clientSecret, n.clientSecretType, node);
13
+ this.credentials.clientId = RED.util.evaluateNodeProperty(n.clientId, n.clientIdType, node);
14
+ this.credentials.clientSecret = RED.util.evaluateNodeProperty(n.clientSecret, n.clientSecretType, node);
14
15
 
15
- node.registerOnIdentityChanged = function (callback) {
16
+ node.eventEmitter = new EventEmitter();
17
+
18
+ // set the engine url
19
+ const stopRefreshing = periodicallyRefreshEngineClient(this, n, 10000);
20
+
21
+ this.registerOnIdentityChanged = function (callback) {
16
22
  identityChangedCallbacks.push(callback);
17
23
  };
18
24
 
19
- node.isIdentityReady = function () {
20
- if (node.credentials.clientId && node.credentials.clientSecret) {
21
- return node.identity != null;
25
+ this.isIdentityReady = function () {
26
+ if (this.credentials.clientId && this.credentials.clientSecret) {
27
+ return this.identity != null;
22
28
  } else {
23
29
  return true;
24
30
  }
25
31
  };
26
32
 
27
- node.setIdentity = (identity) => {
33
+ this.setIdentity = (identity) => {
28
34
  node.log(`setIdentity: ${JSON.stringify(identity)}`);
29
- node.identity = identity;
35
+ this.identity = identity;
30
36
 
31
37
  for (const callback of identityChangedCallbacks) {
32
38
  callback(identity);
33
39
  }
34
40
  };
35
41
 
36
- if (node.credentials.clientId && node.credentials.clientSecret) {
37
- node.engineClient = new engine_client.EngineClient(node.url, {
38
- clientId: node.credentials.clientId,
39
- clientSecret: node.credentials.clientSecret,
40
- });
41
- } else {
42
- node.engineClient = new engine_client.EngineClient(node.url);
42
+ function periodicallyRefreshEngineClient(node, n, intervalMs) {
43
+ function refreshUrl() {
44
+ const newUrl = RED.util.evaluateNodeProperty(n.url, n.urlType, node);
45
+ const newClientId = RED.util.evaluateNodeProperty(n.clientId, n.clientIdType, node);
46
+ const newClientSecret = RED.util.evaluateNodeProperty(n.clientSecret, n.clientSecretType, node);
47
+
48
+ if (
49
+ node.url === newUrl &&
50
+ node.credentials.clientId === newClientId &&
51
+ node.credentials.clientSecret === newClientSecret
52
+ ) {
53
+ return;
54
+ }
55
+
56
+ node.url = newUrl;
57
+ node.credentials.clientId = newClientId;
58
+ node.credentials.clientSecret = newClientSecret;
59
+
60
+ if (node.credentials.clientId && node.credentials.clientSecret) {
61
+ if (node.engineClient) {
62
+ node.eventEmitter.emit('engine-client-dispose');
63
+ node.engineClient.dispose();
64
+ }
65
+ node.engineClient = new engine_client.EngineClient(node.url, () =>
66
+ getFreshIdentity(node.url, node)
67
+ );
68
+
69
+ node.eventEmitter.emit('engine-client-changed');
70
+ } else {
71
+ if (node.engineClient) {
72
+ node.eventEmitter.emit('engine-client-dispose');
73
+ node.engineClient.dispose();
74
+ }
75
+ node.engineClient = new engine_client.EngineClient(node.url);
76
+
77
+ node.eventEmitter.emit('engine-client-changed');
78
+ }
79
+ }
80
+
81
+ refreshUrl();
82
+ const intervalId = setInterval(refreshUrl, intervalMs);
83
+
84
+ return () => clearInterval(intervalId);
43
85
  }
44
86
 
45
- // async function getFreshIdentity(url, node) {
46
- // try {
47
- // if (
48
- // !RED.util.evaluateNodeProperty(n.clientId, n.clientIdType, node) ||
49
- // !RED.util.evaluateNodeProperty(n.clientSecret, n.clientSecretType, node)
50
- // ) {
51
- // return null;
52
- // }
53
-
54
- // const res = await fetch(url + '/atlas_engine/api/v1/authority', {
55
- // method: 'GET',
56
- // headers: {
57
- // Authorization: `Bearer ZHVtbXlfdG9rZW4=`,
58
- // 'Content-Type': 'application/json',
59
- // },
60
- // });
61
-
62
- // const body = await res.json();
63
-
64
- // const issuer = await oidc.Issuer.discover(body);
65
-
66
- // const client = new issuer.Client({
67
- // client_id: RED.util.evaluateNodeProperty(n.clientId, n.clientIdType, node),
68
- // client_secret: RED.util.evaluateNodeProperty(n.clientSecret, n.clientSecretType, node),
69
- // });
70
-
71
- // const tokenSet = await client.grant({
72
- // grant_type: 'client_credentials',
73
- // scope: 'engine_etw engine_read engine_write',
74
- // });
75
-
76
- // const accessToken = tokenSet.access_token;
77
- // const decodedToken = jwt.jwtDecode(accessToken);
78
-
79
- // const freshIdentity = {
80
- // token: tokenSet.access_token,
81
- // userId: decodedToken.sub,
82
- // };
83
-
84
- // node.setIdentity(freshIdentity);
85
-
86
- // return freshIdentity;
87
- // } catch (e) {
88
- // node.error(`Could not get fresh identity: ${e}`);
89
- // }
90
- // }
87
+ async function getFreshIdentity(url, node) {
88
+ try {
89
+ if (
90
+ !RED.util.evaluateNodeProperty(n.clientId, n.clientIdType, node) ||
91
+ !RED.util.evaluateNodeProperty(n.clientSecret, n.clientSecretType, node)
92
+ ) {
93
+ return null;
94
+ }
95
+
96
+ const res = await fetch(url + '/atlas_engine/api/v1/authority', {
97
+ method: 'GET',
98
+ headers: {
99
+ Authorization: `Bearer ZHVtbXlfdG9rZW4=`,
100
+ 'Content-Type': 'application/json',
101
+ },
102
+ });
103
+
104
+ const body = await res.json();
105
+
106
+ const issuer = await oidc.Issuer.discover(body);
107
+
108
+ const client = new issuer.Client({
109
+ client_id: RED.util.evaluateNodeProperty(n.clientId, n.clientIdType, node),
110
+ client_secret: RED.util.evaluateNodeProperty(n.clientSecret, n.clientSecretType, node),
111
+ });
112
+
113
+ const tokenSet = await client.grant({
114
+ grant_type: 'client_credentials',
115
+ scope: 'engine_etw engine_read engine_write',
116
+ });
117
+
118
+ const accessToken = tokenSet.access_token;
119
+ const decodedToken = jwt.jwtDecode(accessToken);
120
+
121
+ const freshIdentity = {
122
+ token: tokenSet.access_token,
123
+ userId: decodedToken.sub,
124
+ };
125
+
126
+ node.setIdentity(freshIdentity);
127
+
128
+ return freshIdentity;
129
+ } catch (e) {
130
+ node.error(`Could not get fresh identity: ${e}`);
131
+ }
132
+ }
91
133
 
92
134
  node.on('close', async () => {
93
- if (node.engineClient) {
94
- node.engineClient.dispose();
95
- node.engineClient = null;
135
+ if (this.engineClient) {
136
+ stopRefreshing();
137
+ this.engineClient.dispose();
138
+ this.engineClient = null;
96
139
  }
97
140
  });
98
141
  }
@@ -5,7 +5,7 @@ module.exports = function (RED) {
5
5
 
6
6
  node.on('input', function (msg) {
7
7
 
8
- node.engine = RED.nodes.getNode(config.engine);
8
+ const engine = RED.nodes.getNode(config.engine);
9
9
  const client = engine.engineClient;
10
10
 
11
11
  if (!client) {
@@ -17,7 +17,7 @@ module.exports = function (RED) {
17
17
 
18
18
  query = {
19
19
  ...query,
20
- identity: node.engine.identity,
20
+ identity: engine.identity,
21
21
  };
22
22
 
23
23
  node.log(`Querying process definitions with query: ${JSON.stringify(query)}`);
@@ -6,8 +6,8 @@
6
6
  name: { value: '' },
7
7
  engine: { value: '', type: 'processcube-engine-config' },
8
8
  modelid: { value: '' },
9
- time: { value: '', type: 'number' },
10
- time_type: { value: 'hours' },
9
+ duration: { value: '', type: 'number' },
10
+ time_unit: { value: 'hours' },
11
11
  },
12
12
  inputs: 1,
13
13
  outputs: 1,
@@ -32,12 +32,12 @@
32
32
  <input type="text" id="node-input-modelid" />
33
33
  </div>
34
34
  <div class="form-row">
35
- <label for="node-input-time"><i class="fa fa-tag"></i> Duration</label>
35
+ <label for="node-input-duration"><i class="fa fa-tag"></i> Duration</label>
36
36
  <input type="text" id="node-input-time" />
37
37
  </div>
38
38
  <div class="form-row">
39
- <label for="node-input-time_type"><i class="fa fa-sliders"></i> Time Unit</label>
40
- <select id="node-input-time_type" style="width: 70%;">
39
+ <label for="node-input-time_unit"><i class="fa fa-sliders"></i> Time Unit</label>
40
+ <select id="node-input-time_unit" style="width: 70%;">
41
41
  <option value="hours">Hours</option>
42
42
  <option value="days">Days</option>
43
43
  </select>
@@ -4,21 +4,21 @@ module.exports = function (RED) {
4
4
  var node = this;
5
5
 
6
6
  node.on('input', async function (msg) {
7
- node.engine = RED.nodes.getNode(config.engine);
8
- const client = node.engine.engineClient;
7
+ const engine = RED.nodes.getNode(config.engine);
8
+ const client = engine.engineClient;
9
9
 
10
10
  if (!client) {
11
11
  node.error('No engine configured.');
12
12
  return;
13
13
  }
14
14
  let timeMultiplier;
15
- if (msg.payload.time_type) {
16
- timeMultiplier = msg.payload.time_type == 'hours' ? 1 : 24;
15
+ if (msg.payload.time_unit) {
16
+ timeMultiplier = msg.payload.time_unit == 'hours' ? 1 : 24;
17
17
  } else {
18
- timeMultiplier = config.time_type == 'hours' ? 1 : 24;
18
+ timeMultiplier = config.time_unit == 'hours' ? 1 : 24;
19
19
  }
20
20
 
21
- const timeToUse = msg.payload.time ? msg.payload.time : config.time;
21
+ const timeToUse = msg.payload.duration ? msg.payload.duration : config.duration;
22
22
  const modelId = msg.payload.processModelId
23
23
  ? msg.payload.processModelId != ''
24
24
  ? msg.payload.processModelId
@@ -30,7 +30,7 @@ module.exports = function (RED) {
30
30
  try {
31
31
  const result = await client.processInstances.query({
32
32
  processModelId: modelId
33
- }, { identity: node.engine.identity });
33
+ }, { identity: engine.identity });
34
34
 
35
35
  let allInstances = result.processInstances.filter((instance) => instance.state != 'suspended');
36
36
 
@@ -45,7 +45,7 @@ module.exports = function (RED) {
45
45
  const ids = oldTasks.map((obj) => obj.processInstanceId);
46
46
  msg.payload = ids;
47
47
 
48
- await client.processInstances.deleteProcessInstances(ids, true, node.engine.identity);
48
+ await client.processInstances.deleteProcessInstances(ids, true, engine.identity);
49
49
  node.send(msg);
50
50
  } catch (error) {
51
51
  node.error(error);
@@ -6,8 +6,8 @@ module.exports = function (RED) {
6
6
  node.on('input', function (msg) {
7
7
  let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
8
8
 
9
- node.engine = RED.nodes.getNode(config.engine);
10
- const client = node.engine.engineClient;
9
+ const engine = RED.nodes.getNode(config.engine);
10
+ const client = engine.engineClient;
11
11
 
12
12
  if (!client) {
13
13
  node.error('No engine configured.');
@@ -15,7 +15,7 @@ module.exports = function (RED) {
15
15
  }
16
16
 
17
17
  client.processInstances
18
- .query(query, { identity: node.engine.identity })
18
+ .query(query, { identity: engine.identity })
19
19
  .then((matchingInstances) => {
20
20
  msg.payload = matchingInstances;
21
21
 
@@ -4,9 +4,9 @@ module.exports = function (RED) {
4
4
  var node = this;
5
5
 
6
6
  node.on('input', function (msg) {
7
- node.engine = RED.nodes.getNode(config.engine);
7
+ const engine = RED.nodes.getNode(config.engine);
8
8
 
9
- const client = node.engine.engineClient;
9
+ const client = engine.engineClient;
10
10
 
11
11
  if (!client) {
12
12
  node.error('No engine configured.');
@@ -17,7 +17,7 @@ module.exports = function (RED) {
17
17
  .triggerSignalEvent(config.signalname, {
18
18
  processInstanceId: msg.processinstanceid,
19
19
  payload: msg.payload,
20
- identity: node.engine.identity,
20
+ identity: engine.identity,
21
21
  })
22
22
  .then((result) => {
23
23
  msg.payload = result;
@@ -6,6 +6,17 @@ module.exports = function (RED) {
6
6
 
7
7
  let subscription;
8
8
 
9
+ const eventEmitter = node.engine.eventEmitter;
10
+
11
+ eventEmitter.on('engine-client-dispose', () => {
12
+ node.engine.engineClient.userTasks.removeSubscription(subscription, node.engine.identity);
13
+ });
14
+
15
+ eventEmitter.on('engine-client-changed', () => {
16
+ node.log('new engineClient received');
17
+ register();
18
+ });
19
+
9
20
  const register = async () => {
10
21
  let currentIdentity = node.engine.identity;
11
22
 
package/usertask-input.js CHANGED
@@ -4,9 +4,9 @@ module.exports = function (RED) {
4
4
  var node = this;
5
5
 
6
6
  node.on('input', function (msg) {
7
- node.engine = RED.nodes.getNode(config.engine);
7
+ const engine = RED.nodes.getNode(config.engine);
8
8
 
9
- const client = node.engine.engineClient;
9
+ const client = engine.engineClient;
10
10
 
11
11
  if (!client) {
12
12
  node.error('No engine configured.');
@@ -20,7 +20,7 @@ module.exports = function (RED) {
20
20
  };
21
21
 
22
22
  client.userTasks
23
- .query(query, { identity: node.engine.identity })
23
+ .query(query, { identity: engine.identity })
24
24
  .then((matchingFlowNodes) => {
25
25
  if (config.sendtype === 'array') {
26
26
  msg.payload = { userTasks: matchingFlowNodes.userTasks || [] };
@@ -9,9 +9,9 @@ module.exports = function (RED) {
9
9
 
10
10
  const userTaskResult = RED.util.evaluateNodeProperty(config.result, config.result_type, node, msg);
11
11
 
12
- node.engine = RED.nodes.getNode(config.engine);
12
+ const engine = RED.nodes.getNode(config.engine);
13
13
 
14
- const client = node.engine.engineClient;
14
+ const client = engine.engineClient;
15
15
 
16
16
  if (!client) {
17
17
  node.error('No engine configured.');
@@ -19,7 +19,7 @@ module.exports = function (RED) {
19
19
  }
20
20
 
21
21
  client.userTasks
22
- .finishUserTask(flowNodeInstanceId, userTaskResult, node.engine.identity)
22
+ .finishUserTask(flowNodeInstanceId, userTaskResult, engine.identity)
23
23
  .then(() => {
24
24
  node.send(msg);
25
25
  })