@5minds/node-red-contrib-processcube 1.7.4-feature-0f7992-m6kko7d1 → 1.7.4-feature-6f3b75-m6ksn7zb
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/message-event-trigger.js +3 -0
- package/package.json +1 -1
- package/process-start.js +1 -3
- package/process-terminate.js +3 -1
- package/processdefinition-deploy.js +3 -1
- package/processdefinition-query.js +4 -0
- package/processinstance-delete.js +8 -2
- package/processinstance-query.js +3 -1
- package/signal-event-trigger.js +3 -0
- package/usertask-input.js +3 -1
- package/usertask-output.js +3 -1
- package/wait-for-usertask.js +9 -5
- package/processes/TokenTest.bpmn +0 -58
package/message-event-trigger.js
CHANGED
@@ -6,6 +6,8 @@ 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
|
10
|
+
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
|
9
11
|
|
10
12
|
if (!client) {
|
11
13
|
node.error('No engine configured.', msg);
|
@@ -16,6 +18,7 @@ module.exports = function (RED) {
|
|
16
18
|
.triggerMessageEvent(config.messagename, {
|
17
19
|
processInstanceId: msg.processinstanceid,
|
18
20
|
payload: msg.payload,
|
21
|
+
identity: userIdentity
|
19
22
|
})
|
20
23
|
.then((result) => {
|
21
24
|
msg.payload = result;
|
package/package.json
CHANGED
package/process-start.js
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
const engine_client = require('@5minds/processcube_engine_client');
|
2
|
-
|
3
1
|
module.exports = function (RED) {
|
4
2
|
function ProcessStart(config) {
|
5
3
|
RED.nodes.createNode(this, config);
|
@@ -42,7 +40,7 @@ module.exports = function (RED) {
|
|
42
40
|
return;
|
43
41
|
}
|
44
42
|
|
45
|
-
const isUser = !!msg._client
|
43
|
+
const isUser = !!msg._client?.user
|
46
44
|
const identity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
|
47
45
|
|
48
46
|
client.processDefinitions
|
package/process-terminate.js
CHANGED
@@ -6,6 +6,8 @@ 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
|
10
|
+
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
|
9
11
|
|
10
12
|
if (!client) {
|
11
13
|
node.error('No engine configured.', msg);
|
@@ -13,7 +15,7 @@ module.exports = function (RED) {
|
|
13
15
|
}
|
14
16
|
|
15
17
|
client.processInstances
|
16
|
-
.terminateProcessInstance(msg.payload)
|
18
|
+
.terminateProcessInstance(msg.payload, userIdentity)
|
17
19
|
.then(() => {
|
18
20
|
node.send(msg);
|
19
21
|
})
|
@@ -6,6 +6,8 @@ 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
|
10
|
+
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
|
9
11
|
|
10
12
|
if (!client) {
|
11
13
|
node.error('No engine configured.');
|
@@ -13,7 +15,7 @@ module.exports = function (RED) {
|
|
13
15
|
}
|
14
16
|
|
15
17
|
client.processDefinitions
|
16
|
-
.persistProcessDefinitions(msg.payload, { overwriteExisting: true
|
18
|
+
.persistProcessDefinitions(msg.payload, { overwriteExisting: true, identity: userIdentity })
|
17
19
|
.then(() => {
|
18
20
|
node.send(msg);
|
19
21
|
})
|
@@ -16,6 +16,10 @@ 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
|
20
|
+
const identity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
|
21
|
+
query.identity = identity;
|
22
|
+
|
19
23
|
client.processDefinitions
|
20
24
|
.getAll(query)
|
21
25
|
.then((matchingProcessDefinitions) => {
|
@@ -7,6 +7,9 @@ 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
|
11
|
+
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
|
12
|
+
|
10
13
|
if (!client || !client.processInstances) {
|
11
14
|
node.error('No engine or processInstances API configured.', msg);
|
12
15
|
return;
|
@@ -64,7 +67,10 @@ module.exports = function (RED) {
|
|
64
67
|
state: ['finished', 'error', 'terminated'],
|
65
68
|
limit: batchSize,
|
66
69
|
},
|
67
|
-
{
|
70
|
+
{
|
71
|
+
includeXml: false,
|
72
|
+
identity: userIdentity
|
73
|
+
}
|
68
74
|
);
|
69
75
|
|
70
76
|
const processInstances = result.processInstances || [];
|
@@ -77,7 +83,7 @@ module.exports = function (RED) {
|
|
77
83
|
const ids = processInstances.map((obj) => obj.processInstanceId);
|
78
84
|
|
79
85
|
try {
|
80
|
-
await client.processInstances.deleteProcessInstances(ids, true);
|
86
|
+
await client.processInstances.deleteProcessInstances(ids, true, userIdentity);
|
81
87
|
msg.payload.successfulDeletions.push(...ids);
|
82
88
|
sumSuccessful += ids.length;
|
83
89
|
} catch (deleteError) {
|
package/processinstance-query.js
CHANGED
@@ -8,6 +8,8 @@ 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
|
12
|
+
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
|
11
13
|
|
12
14
|
if (!client) {
|
13
15
|
node.error('No engine configured.', msg);
|
@@ -15,7 +17,7 @@ module.exports = function (RED) {
|
|
15
17
|
}
|
16
18
|
|
17
19
|
client.processInstances
|
18
|
-
.query(query)
|
20
|
+
.query(query, { identity: userIdentity })
|
19
21
|
.then((matchingInstances) => {
|
20
22
|
msg.payload = matchingInstances;
|
21
23
|
|
package/signal-event-trigger.js
CHANGED
@@ -7,6 +7,8 @@ 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
|
11
|
+
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
|
10
12
|
|
11
13
|
if (!client) {
|
12
14
|
node.error('No engine configured.', msg);
|
@@ -17,6 +19,7 @@ module.exports = function (RED) {
|
|
17
19
|
.triggerSignalEvent(config.signalname, {
|
18
20
|
processInstanceId: msg.processinstanceid,
|
19
21
|
payload: msg.payload,
|
22
|
+
identity: userIdentity
|
20
23
|
})
|
21
24
|
.then((result) => {
|
22
25
|
msg.payload = result;
|
package/usertask-input.js
CHANGED
@@ -7,6 +7,8 @@ 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
|
11
|
+
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
|
10
12
|
|
11
13
|
if (!client) {
|
12
14
|
node.error('No engine configured.', msg);
|
@@ -16,7 +18,7 @@ module.exports = function (RED) {
|
|
16
18
|
let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
|
17
19
|
|
18
20
|
client.userTasks
|
19
|
-
.query(query)
|
21
|
+
.query(query, {identity: userIdentity})
|
20
22
|
.then((matchingFlowNodes) => {
|
21
23
|
if (config.sendtype === 'array') {
|
22
24
|
msg.payload = { userTasks: matchingFlowNodes.userTasks || [] };
|
package/usertask-output.js
CHANGED
@@ -17,6 +17,8 @@ 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
|
21
|
+
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
|
20
22
|
|
21
23
|
if (!client) {
|
22
24
|
node.error('No engine configured.', msg);
|
@@ -24,7 +26,7 @@ module.exports = function (RED) {
|
|
24
26
|
}
|
25
27
|
|
26
28
|
client.userTasks
|
27
|
-
.finishUserTask(flowNodeInstanceId, userTaskResult)
|
29
|
+
.finishUserTask(flowNodeInstanceId, userTaskResult, userIdentity)
|
28
30
|
.then(() => {
|
29
31
|
node.send(msg);
|
30
32
|
})
|
package/wait-for-usertask.js
CHANGED
@@ -4,6 +4,8 @@ module.exports = function (RED) {
|
|
4
4
|
var node = this;
|
5
5
|
|
6
6
|
node.engine = RED.nodes.getNode(config.engine);
|
7
|
+
const isUser = !!msg._client?.user
|
8
|
+
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
|
7
9
|
|
8
10
|
let subscription = null;
|
9
11
|
let subscribe = null;
|
@@ -25,11 +27,11 @@ module.exports = function (RED) {
|
|
25
27
|
};
|
26
28
|
|
27
29
|
try {
|
28
|
-
const matchingFlowNodes = await client.userTasks.query(newQuery);
|
30
|
+
const matchingFlowNodes = await client.userTasks.query(newQuery, {identity: userIdentity});
|
29
31
|
|
30
32
|
if (matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length == 1) {
|
31
33
|
// remove subscription
|
32
|
-
client.userTasks.removeSubscription(subscription);
|
34
|
+
client.userTasks.removeSubscription(subscription, userIdentity);
|
33
35
|
|
34
36
|
const userTask = matchingFlowNodes.userTasks[0];
|
35
37
|
|
@@ -41,6 +43,8 @@ module.exports = function (RED) {
|
|
41
43
|
} catch (error) {
|
42
44
|
node.error(error, msg);
|
43
45
|
}
|
46
|
+
},{
|
47
|
+
identity: userIdentity,
|
44
48
|
});
|
45
49
|
|
46
50
|
node.log({ 'Handling old userTasks config.only_for_new': config.only_for_new });
|
@@ -53,7 +57,7 @@ module.exports = function (RED) {
|
|
53
57
|
};
|
54
58
|
|
55
59
|
try {
|
56
|
-
const matchingFlowNodes = await client.userTasks.query(suspendedQuery);
|
60
|
+
const matchingFlowNodes = await client.userTasks.query(suspendedQuery, {identity: userIdentity});
|
57
61
|
|
58
62
|
if (matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length >= 1) {
|
59
63
|
const userTask = matchingFlowNodes.userTasks[0];
|
@@ -62,7 +66,7 @@ module.exports = function (RED) {
|
|
62
66
|
node.send(msg);
|
63
67
|
|
64
68
|
// remove subscription
|
65
|
-
client.userTasks.removeSubscription(subscription);
|
69
|
+
client.userTasks.removeSubscription(subscription, userIdentity);
|
66
70
|
} else {
|
67
71
|
// let the *currentIdentity* be active
|
68
72
|
}
|
@@ -77,7 +81,7 @@ module.exports = function (RED) {
|
|
77
81
|
|
78
82
|
node.on('close', () => {
|
79
83
|
if (client != null && subscription != null) {
|
80
|
-
client.userTasks.removeSubscription(subscription);
|
84
|
+
client.userTasks.removeSubscription(subscription, );
|
81
85
|
}
|
82
86
|
});
|
83
87
|
}
|
package/processes/TokenTest.bpmn
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="TokenTest_Definition" targetNamespace="http://bpmn.io/schema/bpmn" exporter="5Minds Studio" exporterVersion="1">
|
3
|
-
<bpmn:collaboration id="Collaboration_1cidyxu" name="">
|
4
|
-
<bpmn:participant id="Participant_0qqs1cu" name="Token-Test" processRef="Token-Test_Process" />
|
5
|
-
</bpmn:collaboration>
|
6
|
-
<bpmn:process id="Token-Test_Process" name="Token-Test" isExecutable="true">
|
7
|
-
<bpmn:laneSet id="LaneSet_1aqtpqs">
|
8
|
-
<bpmn:lane id="Lane_1mo8jcc" name="Lane">
|
9
|
-
<bpmn:flowNodeRef>Event_1ptmb8y</bpmn:flowNodeRef>
|
10
|
-
<bpmn:flowNodeRef>Event_03og9pn</bpmn:flowNodeRef>
|
11
|
-
<bpmn:flowNodeRef>Activity_1ce0pce</bpmn:flowNodeRef>
|
12
|
-
</bpmn:lane>
|
13
|
-
</bpmn:laneSet>
|
14
|
-
<bpmn:startEvent id="Event_1ptmb8y" name="Start">
|
15
|
-
<bpmn:outgoing>Flow_14x1t60</bpmn:outgoing>
|
16
|
-
</bpmn:startEvent>
|
17
|
-
<bpmn:endEvent id="Event_03og9pn">
|
18
|
-
<bpmn:incoming>Flow_09xp1ep</bpmn:incoming>
|
19
|
-
</bpmn:endEvent>
|
20
|
-
<bpmn:serviceTask id="Activity_1ce0pce" name="TriggerPCNode" camunda:type="external" camunda:topic="TriggerPCNode">
|
21
|
-
<bpmn:incoming>Flow_14x1t60</bpmn:incoming>
|
22
|
-
<bpmn:outgoing>Flow_09xp1ep</bpmn:outgoing>
|
23
|
-
</bpmn:serviceTask>
|
24
|
-
<bpmn:sequenceFlow id="Flow_14x1t60" sourceRef="Event_1ptmb8y" targetRef="Activity_1ce0pce" />
|
25
|
-
<bpmn:sequenceFlow id="Flow_09xp1ep" sourceRef="Activity_1ce0pce" targetRef="Event_03og9pn" />
|
26
|
-
</bpmn:process>
|
27
|
-
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
28
|
-
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1cidyxu">
|
29
|
-
<bpmndi:BPMNShape id="BPMNShape_0cjotgc" bpmnElement="Participant_0qqs1cu" isHorizontal="true">
|
30
|
-
<dc:Bounds x="-80" y="-310" width="885" height="346" />
|
31
|
-
</bpmndi:BPMNShape>
|
32
|
-
<bpmndi:BPMNShape id="BPMNShape_1ib40km" bpmnElement="Lane_1mo8jcc" isHorizontal="true">
|
33
|
-
<dc:Bounds x="-50" y="-310" width="855" height="346" />
|
34
|
-
</bpmndi:BPMNShape>
|
35
|
-
<bpmndi:BPMNShape id="BPMNShape_139q3mx" bpmnElement="Event_1ptmb8y">
|
36
|
-
<dc:Bounds x="7" y="-162" width="36" height="36" />
|
37
|
-
<bpmndi:BPMNLabel>
|
38
|
-
<dc:Bounds x="13" y="-119" width="25" height="14" />
|
39
|
-
</bpmndi:BPMNLabel>
|
40
|
-
</bpmndi:BPMNShape>
|
41
|
-
<bpmndi:BPMNShape id="Event_03og9pn_di" bpmnElement="Event_03og9pn">
|
42
|
-
<dc:Bounds x="247" y="-162" width="36" height="36" />
|
43
|
-
</bpmndi:BPMNShape>
|
44
|
-
<bpmndi:BPMNShape id="Activity_1rdy3md_di" bpmnElement="Activity_1ce0pce">
|
45
|
-
<dc:Bounds x="95" y="-184" width="100" height="80" />
|
46
|
-
<bpmndi:BPMNLabel />
|
47
|
-
</bpmndi:BPMNShape>
|
48
|
-
<bpmndi:BPMNEdge id="Flow_14x1t60_di" bpmnElement="Flow_14x1t60">
|
49
|
-
<di:waypoint x="43" y="-144" />
|
50
|
-
<di:waypoint x="95" y="-144" />
|
51
|
-
</bpmndi:BPMNEdge>
|
52
|
-
<bpmndi:BPMNEdge id="Flow_09xp1ep_di" bpmnElement="Flow_09xp1ep">
|
53
|
-
<di:waypoint x="195" y="-144" />
|
54
|
-
<di:waypoint x="247" y="-144" />
|
55
|
-
</bpmndi:BPMNEdge>
|
56
|
-
</bpmndi:BPMNPlane>
|
57
|
-
</bpmndi:BPMNDiagram>
|
58
|
-
</bpmn:definitions>
|