@5minds/node-red-contrib-processcube 1.5.6 → 1.5.7-develop-10cfa5-m3qdjs6o
Sign up to get free protection for your applications and to get access to all the features.
- package/doc_generator/README.md +6 -0
- package/doc_generator/_process_instances_query.md +121 -0
- package/doc_generator/generator.js +41 -0
- package/doc_generator/generator_with_swagger.js +89 -0
- package/doc_generator/outputs/.gitkeep +0 -0
- package/doc_generator/package-lock.json +176 -0
- package/doc_generator/package.json +15 -0
- package/doc_generator/query_template.mustache +20 -0
- package/doc_generator/swagger.json +4110 -0
- package/endevent-finished-listener.js +18 -8
- package/externaltask-event-listener.js +13 -2
- package/externaltask-input.html +16 -1
- package/externaltask-input.js +120 -100
- package/nodered/flows.json +108 -1
- package/package.json +1 -1
- package/process-event-listener.js +17 -4
- package/process-terminate.html +3 -2
- package/processcube-engine-config.js +14 -6
- package/processdefinition-query.html +121 -0
- package/processinstance-delete.html +9 -9
- package/processinstance-query.html +115 -1
- package/usertask-event-listener.html +121 -0
- package/usertask-event-listener.js +15 -3
- package/usertask-input.html +119 -0
- package/wait-for-usertask.html +119 -0
- package/wait-for-usertask.js +38 -35
package/wait-for-usertask.html
CHANGED
@@ -70,6 +70,125 @@ Waiting for Usertasks of the connected ProcessCube Engine.
|
|
70
70
|
- `msg.payload` or a constant json to filter the UserTasks for Waiting for
|
71
71
|
- `Only for new` will trigger only for new UserTasks if checked and also for old ones if not checked.
|
72
72
|
|
73
|
+
### Query fields
|
74
|
+
|
75
|
+
**Summary**:
|
76
|
+
|
77
|
+
**Description**: Filter result for 'Wait for UserTask'
|
78
|
+
|
79
|
+
#### Parameters:
|
80
|
+
- Name: `offset` Required: `false`
|
81
|
+
- Type: number
|
82
|
+
- Description: The index of the first ProcessInstance to include in the result set.
|
83
|
+
- Name: `limit` Required: `false`
|
84
|
+
- Type: number
|
85
|
+
- Description: The maximum number of ProcessInstances to return.
|
86
|
+
- Name: `correlationId` Required: `false`
|
87
|
+
- Type: Array<string> | string | SearchQuery
|
88
|
+
- string: myCorrelationId
|
89
|
+
- Array<string>: myCorrelationId1,myCorrelationId2
|
90
|
+
- object:
|
91
|
+
- Description: Filter by the CorrelationId of the ProcessInstances.
|
92
|
+
- Name: `processInstanceId` Required: ``
|
93
|
+
- Type: Array<string> | string | SearchQuery
|
94
|
+
- string: myProcessInstance_12345678
|
95
|
+
- Array<string>: myProcessInstance_12345678,myProcessInstance_87654321
|
96
|
+
- object:
|
97
|
+
- Description: Filter by the ID of the ProcessInstances.
|
98
|
+
- Name: `processDefinitionId` Required: ``
|
99
|
+
- Type: Array<string> | string | SearchQuery
|
100
|
+
- string: myProcess_12345678
|
101
|
+
- Array<string>: myProcess_12345678,myProcess_87654321
|
102
|
+
- object:
|
103
|
+
- Description: Filter by the ID of the ProcessDefinition that the ProcessInstances belong to.
|
104
|
+
- Name: `processModelId` Required: ``
|
105
|
+
- Type: Array<string> | string | SearchQuery
|
106
|
+
- string: myProcessModel_12345678
|
107
|
+
- Array<string>: myProcessModel_12345678,myProcessModel_87654321
|
108
|
+
- object:
|
109
|
+
- Description: Filter by the ID of the ProcessModel that the ProcessInstances belong to.
|
110
|
+
- Name: `processModelName` Required: ``
|
111
|
+
- Type: Array<string> | string | SearchQuery
|
112
|
+
- string: My Process Model
|
113
|
+
- Array<string>: My Process Model,My Other Process Model
|
114
|
+
- object:
|
115
|
+
- Description: Filter by the name of the ProcessModel that the ProcessInstances belong to.
|
116
|
+
- Name: `processModelHash` Required: ``
|
117
|
+
- Type: Array<string> | string | SearchQuery
|
118
|
+
- string: 12345678
|
119
|
+
- Array<string>: 12345678,87654321
|
120
|
+
- object:
|
121
|
+
- Description: Filter by the hash of the ProcessModel that the ProcessInstances belong to.
|
122
|
+
- Name: `ownerId` Required: ``
|
123
|
+
- Type: Array<string> | string | SearchQuery
|
124
|
+
- string: 12345678
|
125
|
+
- Array<string>: 12345678,87654321
|
126
|
+
- object:
|
127
|
+
- Description: Filter by the ID of the User that owns the ProcessInstances.
|
128
|
+
- Name: `state` Required: ``
|
129
|
+
- Type: Array<string> | string | SearchQuery
|
130
|
+
- string: running
|
131
|
+
- Array<string>: running,finished
|
132
|
+
- object:
|
133
|
+
- Description: Filter by the state of the ProcessInstances.
|
134
|
+
- Name: `parentProcessInstanceId` Required: ``
|
135
|
+
- Type: Array<string> | string | SearchQuery
|
136
|
+
- string: myParentProcessInstance_12345678
|
137
|
+
- Array<string>: myParentProcessInstance_12345678,myParentProcessInstance_87654321
|
138
|
+
- object:
|
139
|
+
- Description: Filter by the ID of the parent ProcessInstance.
|
140
|
+
- Name: `embeddedProcessModelId` Required: ``
|
141
|
+
- Type: Array<string> | string | SearchQuery
|
142
|
+
- string: myModel1
|
143
|
+
- Array<string>: myModel1,myModel2
|
144
|
+
- object:
|
145
|
+
- Description: Filter by the ID of the embedded process model.
|
146
|
+
- Name: `terminatedByUserId` Required: ``
|
147
|
+
- Type: Array<string> | string | SearchQuery
|
148
|
+
- string: 12345678
|
149
|
+
- Array<string>: 12345678,87654321
|
150
|
+
- object:
|
151
|
+
- Description: Filter by the ID of the User that terminated the ProcessInstances.
|
152
|
+
- Name: `createdBefore` Required: ``
|
153
|
+
- Type: string
|
154
|
+
- Description: The maximum created date of the ProcessInstances to include in the results.
|
155
|
+
- Name: `createdAt` Required: ``
|
156
|
+
- Type: Array<string> | string
|
157
|
+
- string: 2021-01-01T00:00:00.000Z
|
158
|
+
- array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
|
159
|
+
- Description: The minimum created date of the ProcessInstances to include in the results.
|
160
|
+
- Name: `createdAfter` Required: ``
|
161
|
+
- Type: string
|
162
|
+
- Description: The minimum created date of the ProcessInstances to include in the results.
|
163
|
+
- Name: `updatedBefore` Required: ``
|
164
|
+
- Type: string
|
165
|
+
- Description: The maximum updated date of the ProcessInstances to include in the results.
|
166
|
+
- Name: `updatedAt` Required: ``
|
167
|
+
- Type: Array<string> | string
|
168
|
+
- string: 2021-01-01T00:00:00.000Z
|
169
|
+
- array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
|
170
|
+
- Description: The exact updated date of the ProcessInstances to include in the results.
|
171
|
+
- Name: `updatedAfter` Required: ``
|
172
|
+
- Type: string
|
173
|
+
- Description: The minimum updated date of the ProcessInstances to include in the results.
|
174
|
+
- Name: `finishedBefore` Required: ``
|
175
|
+
- Type: string
|
176
|
+
- Description: The maximum finished date of the ProcessInstances to include in the results.
|
177
|
+
- Name: `finishedAt` Required: ``
|
178
|
+
- Type: Array<string> | string
|
179
|
+
- string: 2021-01-01T00:00:00.000Z
|
180
|
+
- array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
|
181
|
+
- Description: The exact finished date of the ProcessInstances to include in the results.
|
182
|
+
- Name: `finishedAfter` Required: ``
|
183
|
+
- Type: string
|
184
|
+
- Description: The minimum finished date of the ProcessInstances to include in the results.
|
185
|
+
- Name: `triggeredByFlowNodeInstance` Required: ``
|
186
|
+
- Type: Array<string> | string | SearchQuery
|
187
|
+
- string: myFlowNodeInstance_12345678
|
188
|
+
- array: myFlowNodeInstance_12345678,myFlowNodeInstance_87654321
|
189
|
+
- object:
|
190
|
+
- Description: Filter by the ID of the FlowNodeInstance that triggered the ProcessInstance.
|
191
|
+
|
73
192
|
### References
|
74
193
|
|
75
194
|
- [The ProcessCube© Developer Network](https://processcube.io) - All documentation for the ProcessCube© platform
|
package/wait-for-usertask.js
CHANGED
@@ -5,13 +5,12 @@ module.exports = function (RED) {
|
|
5
5
|
|
6
6
|
node.engine = RED.nodes.getNode(config.engine);
|
7
7
|
|
8
|
-
const client = node.engine.engineClient;
|
9
|
-
|
10
8
|
let subscription = null;
|
11
9
|
let currentIdentity = node.engine.identity;
|
12
10
|
let subscribe = null;
|
13
11
|
|
14
12
|
node.on('input', async function (msg) {
|
13
|
+
const client = node.engine.engineClient;
|
15
14
|
subscribe = async () => {
|
16
15
|
if (!client) {
|
17
16
|
node.error('No engine configured.');
|
@@ -20,44 +19,49 @@ module.exports = function (RED) {
|
|
20
19
|
|
21
20
|
const query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
|
22
21
|
|
23
|
-
subscription = await client.userTasks.onUserTaskWaiting(
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
22
|
+
subscription = await client.userTasks.onUserTaskWaiting(
|
23
|
+
async (userTaskWaitingNotification) => {
|
24
|
+
const newQuery = {
|
25
|
+
flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
|
26
|
+
...query,
|
27
|
+
};
|
28
|
+
|
29
|
+
try {
|
30
|
+
const matchingFlowNodes = await client.userTasks.query(newQuery, {
|
31
|
+
identity: currentIdentity,
|
32
|
+
});
|
33
|
+
|
34
|
+
if (matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length == 1) {
|
35
|
+
// remove subscription
|
36
|
+
client.userTasks.removeSubscription(subscription, currentIdentity);
|
37
|
+
|
38
|
+
const userTask = matchingFlowNodes.userTasks[0];
|
39
|
+
|
40
|
+
msg.payload = { userTask: userTask };
|
41
|
+
node.send(msg);
|
42
|
+
} else {
|
43
|
+
// nothing todo - wait for next notification
|
44
|
+
}
|
45
|
+
} catch (error) {
|
46
|
+
node.error(error);
|
43
47
|
}
|
44
|
-
}
|
45
|
-
|
46
|
-
|
48
|
+
},
|
49
|
+
{ identity: currentIdentity }
|
50
|
+
);
|
47
51
|
|
48
|
-
|
49
|
-
|
50
|
-
node.log({ "Handling old userTasks config.only_for_new": config.only_for_new });
|
52
|
+
node.log({ 'Handling old userTasks config.only_for_new': config.only_for_new });
|
51
53
|
|
52
54
|
if (config.only_for_new === false) {
|
53
55
|
// only check suspended user tasks
|
54
56
|
const suspendedQuery = {
|
55
|
-
|
56
|
-
...query
|
57
|
+
state: 'suspended',
|
58
|
+
...query,
|
57
59
|
};
|
58
60
|
|
59
61
|
try {
|
60
|
-
const matchingFlowNodes = await client.userTasks.query(suspendedQuery, {
|
62
|
+
const matchingFlowNodes = await client.userTasks.query(suspendedQuery, {
|
63
|
+
identity: currentIdentity,
|
64
|
+
});
|
61
65
|
|
62
66
|
if (matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length >= 1) {
|
63
67
|
const userTask = matchingFlowNodes.userTasks[0];
|
@@ -80,7 +84,6 @@ module.exports = function (RED) {
|
|
80
84
|
});
|
81
85
|
|
82
86
|
node.engine.registerOnIdentityChanged(async (identity) => {
|
83
|
-
|
84
87
|
if (subscription) {
|
85
88
|
client.userTasks.removeSubscription(subscription, currentIdentity);
|
86
89
|
currentIdentity = identity;
|
@@ -90,11 +93,11 @@ module.exports = function (RED) {
|
|
90
93
|
}
|
91
94
|
});
|
92
95
|
|
93
|
-
node.on(
|
96
|
+
node.on('close', async () => {
|
94
97
|
if (client != null && subscription != null) {
|
95
98
|
client.userTasks.removeSubscription(subscription, currentIdentity);
|
96
99
|
}
|
97
100
|
});
|
98
101
|
}
|
99
|
-
RED.nodes.registerType(
|
100
|
-
}
|
102
|
+
RED.nodes.registerType('wait-for-usertask', WaitForUsertask);
|
103
|
+
};
|