@5minds/node-red-contrib-processcube 1.7.5-feature-aee9ae-m6q8beg5 → 1.7.5

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/README.md CHANGED
@@ -25,19 +25,13 @@ To install and run the Node-RED flows, follow these steps:
25
25
  cd processcube_nodered
26
26
  ```
27
27
 
28
- 3. Install the dependencies of the package `@5minds/node-red-contrib-processcube`:
29
-
30
- ```bash
31
- npm install
32
- ```
33
-
34
- 4. Build the Docker containers:
28
+ 3. Build the Docker containers:
35
29
 
36
30
  ```bash
37
31
  docker-compose build
38
32
  ```
39
33
 
40
- 5. Start the Docker containers:
34
+ 4. Start the Docker containers:
41
35
 
42
36
  ```bash
43
37
  docker-compose up -d
@@ -6,8 +6,6 @@ module.exports = function (RED) {
6
6
  node.on('input', function (msg) {
7
7
  node.engine = RED.nodes.getNode(config.engine);
8
8
  const client = node.engine.engineClient;
9
- const isUser = !!msg._client?.user && !!msg._client.user.accessToken;
10
- const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
11
9
 
12
10
  if (!client) {
13
11
  node.error('No engine configured.', msg);
@@ -18,7 +16,6 @@ module.exports = function (RED) {
18
16
  .triggerMessageEvent(config.messagename, {
19
17
  processInstanceId: msg.processinstanceid,
20
18
  payload: msg.payload,
21
- identity: userIdentity
22
19
  })
23
20
  .then((result) => {
24
21
  msg.payload = result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.7.5-feature-aee9ae-m6q8beg5",
3
+ "version": "1.7.5",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
package/process-start.js CHANGED
@@ -40,11 +40,8 @@ module.exports = function (RED) {
40
40
  return;
41
41
  }
42
42
 
43
- const isUser = !!msg._client?.user && !!msg._client.user.accessToken;
44
- const identity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
45
-
46
43
  client.processDefinitions
47
- .startProcessInstance(startParameters, identity)
44
+ .startProcessInstance(startParameters)
48
45
  .then((result) => {
49
46
  msg.payload = result;
50
47
 
@@ -6,8 +6,6 @@ module.exports = function (RED) {
6
6
  node.on('input', function (msg) {
7
7
  node.engine = RED.nodes.getNode(config.engine);
8
8
  const client = node.engine.engineClient;
9
- const isUser = !!msg._client?.user && !!msg._client.user.accessToken;
10
- const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
11
9
 
12
10
  if (!client) {
13
11
  node.error('No engine configured.', msg);
@@ -15,7 +13,7 @@ module.exports = function (RED) {
15
13
  }
16
14
 
17
15
  client.processInstances
18
- .terminateProcessInstance(msg.payload, userIdentity)
16
+ .terminateProcessInstance(msg.payload)
19
17
  .then(() => {
20
18
  node.send(msg);
21
19
  })
@@ -1,4 +1,6 @@
1
1
  const engine_client = require('@5minds/processcube_engine_client');
2
+ const jwt = require('jwt-decode');
3
+ const oidc = require('openid-client');
2
4
 
3
5
  module.exports = function (RED) {
4
6
  function ProcessCubeEngineNode(n) {
@@ -6,8 +6,6 @@ module.exports = function (RED) {
6
6
  node.on('input', function (msg) {
7
7
  node.engine = RED.nodes.getNode(config.engine);
8
8
  const client = node.engine.engineClient;
9
- const isUser = !!msg._client?.user && !!msg._client.user.accessToken;
10
- const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
11
9
 
12
10
  if (!client) {
13
11
  node.error('No engine configured.');
@@ -15,7 +13,7 @@ module.exports = function (RED) {
15
13
  }
16
14
 
17
15
  client.processDefinitions
18
- .persistProcessDefinitions(msg.payload, { overwriteExisting: true, identity: userIdentity })
16
+ .persistProcessDefinitions(msg.payload, { overwriteExisting: true })
19
17
  .then(() => {
20
18
  node.send(msg);
21
19
  })
@@ -16,10 +16,6 @@ module.exports = function (RED) {
16
16
 
17
17
  node.log(`Querying process definitions with query: ${JSON.stringify(query)}`);
18
18
 
19
- const isUser = !!msg._client?.user && !!msg._client.user.accessToken;
20
- const identity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
21
- query.identity = identity;
22
-
23
19
  client.processDefinitions
24
20
  .getAll(query)
25
21
  .then((matchingProcessDefinitions) => {
@@ -7,9 +7,6 @@ module.exports = function (RED) {
7
7
  node.engine = RED.nodes.getNode(config.engine);
8
8
  const client = node.engine ? node.engine.engineClient : null;
9
9
 
10
- const isUser = !!msg._client?.user && !!msg._client.user.accessToken;
11
- const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
12
-
13
10
  if (!client || !client.processInstances) {
14
11
  node.error('No engine or processInstances API configured.', msg);
15
12
  return;
@@ -67,10 +64,7 @@ module.exports = function (RED) {
67
64
  state: ['finished', 'error', 'terminated'],
68
65
  limit: batchSize,
69
66
  },
70
- {
71
- includeXml: false,
72
- identity: userIdentity
73
- }
67
+ { includeXml: false }
74
68
  );
75
69
 
76
70
  const processInstances = result.processInstances || [];
@@ -83,7 +77,7 @@ module.exports = function (RED) {
83
77
  const ids = processInstances.map((obj) => obj.processInstanceId);
84
78
 
85
79
  try {
86
- await client.processInstances.deleteProcessInstances(ids, true, userIdentity);
80
+ await client.processInstances.deleteProcessInstances(ids, true);
87
81
  msg.payload.successfulDeletions.push(...ids);
88
82
  sumSuccessful += ids.length;
89
83
  } catch (deleteError) {
@@ -8,8 +8,6 @@ module.exports = function (RED) {
8
8
 
9
9
  node.engine = RED.nodes.getNode(config.engine);
10
10
  const client = node.engine.engineClient;
11
- const isUser = !!msg._client?.user && !!msg._client.user.accessToken;
12
- const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
13
11
 
14
12
  if (!client) {
15
13
  node.error('No engine configured.', msg);
@@ -17,7 +15,7 @@ module.exports = function (RED) {
17
15
  }
18
16
 
19
17
  client.processInstances
20
- .query(query, { identity: userIdentity })
18
+ .query(query)
21
19
  .then((matchingInstances) => {
22
20
  msg.payload = matchingInstances;
23
21
 
@@ -7,8 +7,6 @@ module.exports = function (RED) {
7
7
  node.engine = RED.nodes.getNode(config.engine);
8
8
 
9
9
  const client = node.engine.engineClient;
10
- const isUser = !!msg._client?.user && !!msg._client.user.accessToken;
11
- const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
12
10
 
13
11
  if (!client) {
14
12
  node.error('No engine configured.', msg);
@@ -19,7 +17,6 @@ module.exports = function (RED) {
19
17
  .triggerSignalEvent(config.signalname, {
20
18
  processInstanceId: msg.processinstanceid,
21
19
  payload: msg.payload,
22
- identity: userIdentity
23
20
  })
24
21
  .then((result) => {
25
22
  msg.payload = result;
package/usertask-input.js CHANGED
@@ -7,8 +7,6 @@ module.exports = function (RED) {
7
7
  node.engine = RED.nodes.getNode(config.engine);
8
8
 
9
9
  const client = node.engine.engineClient;
10
- const isUser = !!msg._client?.user && !!msg._client.user.accessToken;
11
- const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
12
10
 
13
11
  if (!client) {
14
12
  node.error('No engine configured.', msg);
@@ -18,7 +16,7 @@ module.exports = function (RED) {
18
16
  let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
19
17
 
20
18
  client.userTasks
21
- .query(query, {identity: userIdentity})
19
+ .query(query)
22
20
  .then((matchingFlowNodes) => {
23
21
  if (config.sendtype === 'array') {
24
22
  msg.payload = { userTasks: matchingFlowNodes.userTasks || [] };
@@ -17,8 +17,6 @@ module.exports = function (RED) {
17
17
  node.engine = RED.nodes.getNode(config.engine);
18
18
 
19
19
  const client = node.engine.engineClient;
20
- const isUser = !!msg._client?.user && !!msg._client.user.accessToken;
21
- const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
22
20
 
23
21
  if (!client) {
24
22
  node.error('No engine configured.', msg);
@@ -26,7 +24,7 @@ module.exports = function (RED) {
26
24
  }
27
25
 
28
26
  client.userTasks
29
- .finishUserTask(flowNodeInstanceId, userTaskResult, userIdentity)
27
+ .finishUserTask(flowNodeInstanceId, userTaskResult)
30
28
  .then(() => {
31
29
  node.send(msg);
32
30
  })
@@ -10,8 +10,6 @@ module.exports = function (RED) {
10
10
 
11
11
  node.on('input', async function (msg) {
12
12
  const client = node.engine.engineClient;
13
- const isUser = !!msg._client?.user && !!msg._client.user.accessToken;
14
- const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
15
13
  subscribe = async () => {
16
14
  if (!client) {
17
15
  node.error('No engine configured.', msg);
@@ -27,11 +25,11 @@ module.exports = function (RED) {
27
25
  };
28
26
 
29
27
  try {
30
- const matchingFlowNodes = await client.userTasks.query(newQuery, {identity: userIdentity});
28
+ const matchingFlowNodes = await client.userTasks.query(newQuery);
31
29
 
32
30
  if (matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length == 1) {
33
31
  // remove subscription
34
- client.userTasks.removeSubscription(subscription, userIdentity);
32
+ client.userTasks.removeSubscription(subscription);
35
33
 
36
34
  const userTask = matchingFlowNodes.userTasks[0];
37
35
 
@@ -43,8 +41,6 @@ module.exports = function (RED) {
43
41
  } catch (error) {
44
42
  node.error(error, msg);
45
43
  }
46
- },{
47
- identity: userIdentity,
48
44
  });
49
45
 
50
46
  node.log({ 'Handling old userTasks config.only_for_new': config.only_for_new });
@@ -57,7 +53,7 @@ module.exports = function (RED) {
57
53
  };
58
54
 
59
55
  try {
60
- const matchingFlowNodes = await client.userTasks.query(suspendedQuery, {identity: userIdentity});
56
+ const matchingFlowNodes = await client.userTasks.query(suspendedQuery);
61
57
 
62
58
  if (matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length >= 1) {
63
59
  const userTask = matchingFlowNodes.userTasks[0];
@@ -66,7 +62,7 @@ module.exports = function (RED) {
66
62
  node.send(msg);
67
63
 
68
64
  // remove subscription
69
- client.userTasks.removeSubscription(subscription, userIdentity);
65
+ client.userTasks.removeSubscription(subscription);
70
66
  } else {
71
67
  // let the *currentIdentity* be active
72
68
  }