@5minds/node-red-contrib-processcube 1.5.10 → 1.5.11-develop-034baa-m4sa5pvu
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/endevent-finished-listener.js +6 -37
- package/externaltask-event-listener.js +5 -35
- package/externaltask-input.js +3 -15
- package/message-event-trigger.js +3 -5
- package/package.json +2 -2
- package/process-event-listener.js +279 -396
- package/process-start.js +14 -5
- package/process-terminate.js +4 -4
- package/processcube-engine-config.html +7 -7
- package/processcube-engine-config.js +16 -122
- package/processdefinition-query.js +24 -28
- package/processinstance-delete.html +56 -9
- package/processinstance-delete.js +30 -12
- package/processinstance-query.js +3 -3
- package/signal-event-trigger.js +4 -5
- package/usertask-event-listener.js +8 -42
- package/usertask-input.js +4 -8
- package/usertask-output.js +5 -5
- package/wait-for-usertask.js +27 -45
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
|
-
|
7
|
+
node.engine = RED.nodes.getNode(config.engine);
|
8
8
|
|
9
|
-
const client = engine.engineClient;
|
9
|
+
const client = node.engine.engineClient;
|
10
10
|
|
11
11
|
if (!client) {
|
12
12
|
node.error('No engine configured.');
|
@@ -15,12 +15,8 @@ module.exports = function (RED) {
|
|
15
15
|
|
16
16
|
let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
|
17
17
|
|
18
|
-
query = {
|
19
|
-
...query,
|
20
|
-
};
|
21
|
-
|
22
18
|
client.userTasks
|
23
|
-
.query(query
|
19
|
+
.query(query)
|
24
20
|
.then((matchingFlowNodes) => {
|
25
21
|
if (config.sendtype === 'array') {
|
26
22
|
msg.payload = { userTasks: matchingFlowNodes.userTasks || [] };
|
@@ -36,7 +32,7 @@ module.exports = function (RED) {
|
|
36
32
|
} else node.log(`No user tasks found for query: ${JSON.stringify(query)}`);
|
37
33
|
})
|
38
34
|
.catch((error) => {
|
39
|
-
node.error(error);
|
35
|
+
node.error(JSON.stringify(error));
|
40
36
|
});
|
41
37
|
});
|
42
38
|
}
|
package/usertask-output.js
CHANGED
@@ -9,22 +9,22 @@ module.exports = function (RED) {
|
|
9
9
|
|
10
10
|
const userTaskResult = RED.util.evaluateNodeProperty(config.result, config.result_type, node, msg);
|
11
11
|
|
12
|
-
|
12
|
+
node.engine = RED.nodes.getNode(config.engine);
|
13
13
|
|
14
|
-
const client = engine.engineClient;
|
14
|
+
const client = node.engine.engineClient;
|
15
15
|
|
16
16
|
if (!client) {
|
17
17
|
node.error('No engine configured.');
|
18
18
|
return;
|
19
19
|
}
|
20
|
-
|
20
|
+
|
21
21
|
client.userTasks
|
22
|
-
.finishUserTask(flowNodeInstanceId, userTaskResult
|
22
|
+
.finishUserTask(flowNodeInstanceId, userTaskResult)
|
23
23
|
.then(() => {
|
24
24
|
node.send(msg);
|
25
25
|
})
|
26
26
|
.catch((error) => {
|
27
|
-
node.error(error);
|
27
|
+
node.error(JSON.stringify(error));
|
28
28
|
});
|
29
29
|
} else {
|
30
30
|
node.error(`No UserTask found in message: ${JSON.stringify(msg.payload)}`);
|
package/wait-for-usertask.js
CHANGED
@@ -6,7 +6,6 @@ module.exports = function (RED) {
|
|
6
6
|
node.engine = RED.nodes.getNode(config.engine);
|
7
7
|
|
8
8
|
let subscription = null;
|
9
|
-
let currentIdentity = node.engine.identity;
|
10
9
|
let subscribe = null;
|
11
10
|
|
12
11
|
node.on('input', async function (msg) {
|
@@ -19,35 +18,30 @@ module.exports = function (RED) {
|
|
19
18
|
|
20
19
|
const query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
|
21
20
|
|
22
|
-
subscription = await client.userTasks.onUserTaskWaiting(
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
node.send(msg);
|
42
|
-
} else {
|
43
|
-
// nothing todo - wait for next notification
|
44
|
-
}
|
45
|
-
} catch (error) {
|
46
|
-
node.error(error);
|
21
|
+
subscription = await client.userTasks.onUserTaskWaiting(async (userTaskWaitingNotification) => {
|
22
|
+
const newQuery = {
|
23
|
+
flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
|
24
|
+
...query,
|
25
|
+
};
|
26
|
+
|
27
|
+
try {
|
28
|
+
const matchingFlowNodes = await client.userTasks.query(newQuery);
|
29
|
+
|
30
|
+
if (matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length == 1) {
|
31
|
+
// remove subscription
|
32
|
+
client.userTasks.removeSubscription(subscription);
|
33
|
+
|
34
|
+
const userTask = matchingFlowNodes.userTasks[0];
|
35
|
+
|
36
|
+
msg.payload = { userTask: userTask };
|
37
|
+
node.send(msg);
|
38
|
+
} else {
|
39
|
+
// nothing todo - wait for next notification
|
47
40
|
}
|
48
|
-
}
|
49
|
-
|
50
|
-
|
41
|
+
} catch (error) {
|
42
|
+
node.error(JSON.stringify(error));
|
43
|
+
}
|
44
|
+
});
|
51
45
|
|
52
46
|
node.log({ 'Handling old userTasks config.only_for_new': config.only_for_new });
|
53
47
|
|
@@ -59,9 +53,7 @@ module.exports = function (RED) {
|
|
59
53
|
};
|
60
54
|
|
61
55
|
try {
|
62
|
-
const matchingFlowNodes = await client.userTasks.query(suspendedQuery
|
63
|
-
identity: currentIdentity,
|
64
|
-
});
|
56
|
+
const matchingFlowNodes = await client.userTasks.query(suspendedQuery);
|
65
57
|
|
66
58
|
if (matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length >= 1) {
|
67
59
|
const userTask = matchingFlowNodes.userTasks[0];
|
@@ -70,12 +62,12 @@ module.exports = function (RED) {
|
|
70
62
|
node.send(msg);
|
71
63
|
|
72
64
|
// remove subscription
|
73
|
-
client.userTasks.removeSubscription(subscription
|
65
|
+
client.userTasks.removeSubscription(subscription);
|
74
66
|
} else {
|
75
67
|
// let the *currentIdentity* be active
|
76
68
|
}
|
77
69
|
} catch (error) {
|
78
|
-
node.error(error);
|
70
|
+
node.error(JSON.stringify(error));
|
79
71
|
}
|
80
72
|
}
|
81
73
|
};
|
@@ -83,19 +75,9 @@ module.exports = function (RED) {
|
|
83
75
|
subscribe();
|
84
76
|
});
|
85
77
|
|
86
|
-
node.engine.registerOnIdentityChanged(async (identity) => {
|
87
|
-
if (subscription) {
|
88
|
-
client.userTasks.removeSubscription(subscription, currentIdentity);
|
89
|
-
currentIdentity = identity;
|
90
|
-
subscribe();
|
91
|
-
} else {
|
92
|
-
currentIdentity = identity;
|
93
|
-
}
|
94
|
-
});
|
95
|
-
|
96
78
|
node.on('close', async () => {
|
97
79
|
if (client != null && subscription != null) {
|
98
|
-
client.userTasks.removeSubscription(subscription
|
80
|
+
client.userTasks.removeSubscription(subscription);
|
99
81
|
}
|
100
82
|
});
|
101
83
|
}
|