@5minds/node-red-contrib-processcube 2.0.0-feature-629c78-m2dq1ygt → 7.6.0-develop-51b534-mjy4rzoh
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 +3 -58
- package/check-authorization.html +138 -0
- package/check-authorization.js +27 -0
- package/dataobject-instance-query.html +141 -0
- package/dataobject-instance-query.js +45 -0
- package/endevent-finished-listener.js +14 -25
- package/examples/Check-Authorization-Sample.json +109 -0
- package/examples/Dataobject-Instance-Query-Sample.json +109 -0
- package/externaltask-error.html +8 -3
- package/externaltask-error.js +43 -29
- package/externaltask-event-listener.js +11 -28
- package/externaltask-input.html +48 -3
- package/externaltask-input.js +581 -114
- package/externaltask-output.js +20 -16
- package/icons/data-object-query.svg +5 -0
- package/message-event-trigger.html +1 -1
- package/message-event-trigger.js +8 -7
- package/package.json +74 -67
- package/process-event-listener.js +166 -225
- package/process-start.html +6 -0
- package/process-start.js +29 -6
- package/process-terminate.html +1 -1
- package/process-terminate.js +7 -5
- package/processcube-engine-config.html +25 -7
- package/processcube-engine-config.js +25 -135
- package/processcube-google-docs-mail-template.html +150 -0
- package/processcube-google-docs-mail-template.js +158 -0
- package/processdefinition-deploy.html +44 -0
- package/processdefinition-deploy.js +28 -0
- package/processdefinition-query.html +18 -13
- package/processdefinition-query.js +33 -31
- package/processinstance-delete-advanced.html +82 -0
- package/processinstance-delete-advanced.js +33 -0
- package/processinstance-delete.html +60 -8
- package/processinstance-delete.js +84 -30
- package/processinstance-query.html +116 -109
- package/processinstance-query.js +28 -5
- package/signal-event-trigger.js +8 -6
- package/usertask-event-listener.html +123 -1
- package/usertask-event-listener.js +30 -45
- package/usertask-input.html +119 -0
- package/usertask-input.js +7 -9
- package/usertask-output.js +15 -8
- package/wait-for-usertask.html +122 -6
- package/wait-for-usertask.js +44 -47
- package/.github/workflows/build-and-publish.yml +0 -72
- package/.processcube/authority/config/config.json +0 -36
- package/.processcube/authority/config/upeSeedingData.json +0 -12
- package/Dockerfile +0 -9
- package/doc_generator/_process_instances_query.md +0 -115
- package/doc_generator/generator.js +0 -41
- package/doc_generator/generator_with_swagger.js +0 -72
- package/doc_generator/package-lock.json +0 -176
- package/doc_generator/package.json +0 -15
- package/doc_generator/query_template.mustache +0 -20
- package/doc_generator/swagger.json +0 -4110
- package/docker-compose.yml +0 -44
- package/nodered/flows.json +0 -2156
- package/nodered/flows_cred.json +0 -3
- package/nodered/settings.js +0 -562
- package/nodered/static/ProcessCube_Logo.svg +0 -53
- package/processes/Call-Activity-Sample.bpmn +0 -88
- package/processes/External-Task-Auth-Sample.bpmn +0 -82
- package/processes/External-Task-Sample.bpmn +0 -94
- package/processes/SampleEvent.bpmn +0 -73
- package/processes/User-Task-Auth-Sample.bpmn +0 -63
- package/processes/User-Task-Sample.bpmn +0 -76
- package/processes/Wait-For-Usertask.bpmn +0 -74
|
@@ -4,44 +4,42 @@ module.exports = function (RED) {
|
|
|
4
4
|
var node = this;
|
|
5
5
|
node.engine = RED.nodes.getNode(config.engine);
|
|
6
6
|
|
|
7
|
+
let subscription;
|
|
8
|
+
|
|
7
9
|
const register = async () => {
|
|
8
10
|
const client = node.engine.engineClient;
|
|
9
11
|
|
|
10
12
|
if (!client) {
|
|
11
|
-
node.error('No engine configured.');
|
|
13
|
+
node.error('No engine configured.', {});
|
|
12
14
|
return;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
let currentIdentity = node.engine.identity;
|
|
16
|
-
|
|
17
|
-
let subscription;
|
|
18
17
|
const query = RED.util.evaluateNodeProperty(config.query, config.query_type, node);
|
|
19
18
|
|
|
20
19
|
async function subscribe(eventType) {
|
|
21
20
|
switch (eventType) {
|
|
22
21
|
case 'starting':
|
|
23
|
-
return await client.notification.onProcessStarting(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
return await client.notification.onProcessStarting(async (processNotification) => {
|
|
23
|
+
if (
|
|
24
|
+
config.processmodel != '' &&
|
|
25
|
+
config.processmodel != processNotification.processModelId
|
|
26
|
+
) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const newQuery = {
|
|
31
|
+
processInstanceId: processNotification.processInstanceId,
|
|
32
|
+
...query,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
const matchingInstances = await client.processInstances.query(newQuery);
|
|
38
37
|
|
|
39
38
|
if (
|
|
40
39
|
matchingInstances.processInstances &&
|
|
41
40
|
matchingInstances.processInstances.length == 1
|
|
42
41
|
) {
|
|
43
42
|
const processInstance = matchingInstances.processInstances[0];
|
|
44
|
-
|
|
45
43
|
node.send({
|
|
46
44
|
payload: {
|
|
47
45
|
processInstanceId: processNotification.processInstanceId,
|
|
@@ -52,25 +50,27 @@ module.exports = function (RED) {
|
|
|
52
50
|
},
|
|
53
51
|
});
|
|
54
52
|
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
} catch (error) {
|
|
54
|
+
node.error(error, {});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
});
|
|
58
58
|
case 'started':
|
|
59
|
-
return await client.notification.onProcessStarted(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
return await client.notification.onProcessStarted(async (processNotification) => {
|
|
60
|
+
if (
|
|
61
|
+
config.processmodel != '' &&
|
|
62
|
+
config.processmodel != processNotification.processModelId
|
|
63
|
+
) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const newQuery = {
|
|
68
|
+
processInstanceId: processNotification.processInstanceId,
|
|
69
|
+
...query,
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
try {
|
|
73
|
+
const matchingInstances = await client.processInstances.query(newQuery);
|
|
74
74
|
|
|
75
75
|
if (
|
|
76
76
|
matchingInstances.processInstances &&
|
|
@@ -89,26 +89,22 @@ module.exports = function (RED) {
|
|
|
89
89
|
},
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
} catch (error) {
|
|
93
|
+
node.error(error, {});
|
|
94
|
+
}
|
|
95
|
+
});
|
|
95
96
|
case 'resumed':
|
|
96
|
-
return await client.notification.onProcessResumed(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
config.processmodel != '' &&
|
|
100
|
-
config.processmodel != processNotification.processModelId
|
|
101
|
-
)
|
|
102
|
-
return;
|
|
97
|
+
return await client.notification.onProcessResumed(async (processNotification) => {
|
|
98
|
+
if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
|
|
99
|
+
return;
|
|
103
100
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
101
|
+
const newQuery = {
|
|
102
|
+
processInstanceId: processNotification.processInstanceId,
|
|
103
|
+
...query,
|
|
104
|
+
};
|
|
108
105
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
});
|
|
106
|
+
try {
|
|
107
|
+
const matchingInstances = await client.processInstances.query(newQuery);
|
|
112
108
|
|
|
113
109
|
if (
|
|
114
110
|
matchingInstances.processInstances &&
|
|
@@ -126,26 +122,22 @@ module.exports = function (RED) {
|
|
|
126
122
|
},
|
|
127
123
|
});
|
|
128
124
|
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
125
|
+
} catch (error) {
|
|
126
|
+
node.error(error, {});
|
|
127
|
+
}
|
|
128
|
+
});
|
|
132
129
|
case 'finished':
|
|
133
|
-
return await client.notification.onProcessEnded(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
config.processmodel != '' &&
|
|
137
|
-
config.processmodel != processNotification.processModelId
|
|
138
|
-
)
|
|
139
|
-
return;
|
|
130
|
+
return await client.notification.onProcessEnded(async (processNotification) => {
|
|
131
|
+
if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
|
|
132
|
+
return;
|
|
140
133
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
134
|
+
const newQuery = {
|
|
135
|
+
processInstanceId: processNotification.processInstanceId,
|
|
136
|
+
...query,
|
|
137
|
+
};
|
|
145
138
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
});
|
|
139
|
+
try {
|
|
140
|
+
const matchingInstances = await client.processInstances.query(newQuery);
|
|
149
141
|
|
|
150
142
|
if (
|
|
151
143
|
matchingInstances.processInstances &&
|
|
@@ -164,27 +156,22 @@ module.exports = function (RED) {
|
|
|
164
156
|
},
|
|
165
157
|
});
|
|
166
158
|
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
159
|
+
} catch (error) {
|
|
160
|
+
node.error(error, {});
|
|
161
|
+
}
|
|
162
|
+
});
|
|
170
163
|
case 'terminated':
|
|
171
|
-
return await client.notification.onProcessTerminated(
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
config.processmodel != '' &&
|
|
175
|
-
config.processmodel != processNotification.processModelId
|
|
176
|
-
)
|
|
177
|
-
return;
|
|
164
|
+
return await client.notification.onProcessTerminated(async (processNotification) => {
|
|
165
|
+
if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
|
|
166
|
+
return;
|
|
178
167
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const matchingInstances = await client.processInstances.query(newQuery, {
|
|
185
|
-
identity: currentIdentity,
|
|
186
|
-
});
|
|
168
|
+
const newQuery = {
|
|
169
|
+
processInstanceId: processNotification.processInstanceId,
|
|
170
|
+
...query,
|
|
171
|
+
};
|
|
187
172
|
|
|
173
|
+
try {
|
|
174
|
+
const matchingInstances = await client.processInstances.query(newQuery);
|
|
188
175
|
if (
|
|
189
176
|
matchingInstances.processInstances &&
|
|
190
177
|
matchingInstances.processInstances.length == 1
|
|
@@ -201,26 +188,22 @@ module.exports = function (RED) {
|
|
|
201
188
|
},
|
|
202
189
|
});
|
|
203
190
|
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
191
|
+
} catch (error) {
|
|
192
|
+
node.error(error, {});
|
|
193
|
+
}
|
|
194
|
+
});
|
|
207
195
|
case 'error':
|
|
208
|
-
return await client.notification.onProcessError(
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
config.processmodel != '' &&
|
|
212
|
-
config.processmodel != processNotification.processModelId
|
|
213
|
-
)
|
|
214
|
-
return;
|
|
196
|
+
return await client.notification.onProcessError(async (processNotification) => {
|
|
197
|
+
if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
|
|
198
|
+
return;
|
|
215
199
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
200
|
+
const newQuery = {
|
|
201
|
+
processInstanceId: processNotification.processInstanceId,
|
|
202
|
+
...query,
|
|
203
|
+
};
|
|
220
204
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
});
|
|
205
|
+
try {
|
|
206
|
+
const matchingInstances = await client.processInstances.query(newQuery);
|
|
224
207
|
|
|
225
208
|
if (
|
|
226
209
|
matchingInstances.processInstances &&
|
|
@@ -238,26 +221,22 @@ module.exports = function (RED) {
|
|
|
238
221
|
},
|
|
239
222
|
});
|
|
240
223
|
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
|
|
224
|
+
} catch (error) {
|
|
225
|
+
node.error(error, {});
|
|
226
|
+
}
|
|
227
|
+
});
|
|
244
228
|
case 'owner-changed':
|
|
245
|
-
return await client.notification.onProcessOwnerChanged(
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
config.processmodel != '' &&
|
|
249
|
-
config.processmodel != processNotification.processModelId
|
|
250
|
-
)
|
|
251
|
-
return;
|
|
229
|
+
return await client.notification.onProcessOwnerChanged(async (processNotification) => {
|
|
230
|
+
if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
|
|
231
|
+
return;
|
|
252
232
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
233
|
+
const newQuery = {
|
|
234
|
+
processInstanceId: processNotification.processInstanceId,
|
|
235
|
+
...query,
|
|
236
|
+
};
|
|
257
237
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
});
|
|
238
|
+
try {
|
|
239
|
+
const matchingInstances = await client.processInstances.query(newQuery);
|
|
261
240
|
|
|
262
241
|
if (
|
|
263
242
|
matchingInstances.processInstances &&
|
|
@@ -274,26 +253,22 @@ module.exports = function (RED) {
|
|
|
274
253
|
},
|
|
275
254
|
});
|
|
276
255
|
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
256
|
+
} catch (error) {
|
|
257
|
+
node.error(error, {});
|
|
258
|
+
}
|
|
259
|
+
});
|
|
280
260
|
case 'instances-deleted':
|
|
281
|
-
return await client.notification.onProcessInstancesDeleted(
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
config.processmodel != '' &&
|
|
285
|
-
config.processmodel != processNotification.processModelId
|
|
286
|
-
)
|
|
287
|
-
return;
|
|
261
|
+
return await client.notification.onProcessInstancesDeleted(async (processNotification) => {
|
|
262
|
+
if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
|
|
263
|
+
return;
|
|
288
264
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
265
|
+
const newQuery = {
|
|
266
|
+
processInstanceId: processNotification.processInstanceId,
|
|
267
|
+
...query,
|
|
268
|
+
};
|
|
293
269
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
});
|
|
270
|
+
try {
|
|
271
|
+
const matchingInstances = await client.processInstances.query(newQuery);
|
|
297
272
|
|
|
298
273
|
if (
|
|
299
274
|
matchingInstances.processInstances &&
|
|
@@ -310,107 +285,73 @@ module.exports = function (RED) {
|
|
|
310
285
|
},
|
|
311
286
|
});
|
|
312
287
|
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
|
|
288
|
+
} catch (error) {
|
|
289
|
+
node.error(error, {});
|
|
290
|
+
}
|
|
291
|
+
});
|
|
316
292
|
case 'is-executable-changed':
|
|
317
|
-
return await client.notification.onProcessIsExecutableChanged(
|
|
318
|
-
(
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
{ identity: currentIdentity }
|
|
333
|
-
);
|
|
293
|
+
return await client.notification.onProcessIsExecutableChanged((processNotification) => {
|
|
294
|
+
node.log(
|
|
295
|
+
'processNotification (is-executable-changed): ' + JSON.stringify(processNotification)
|
|
296
|
+
);
|
|
297
|
+
|
|
298
|
+
if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
|
|
299
|
+
return;
|
|
300
|
+
node.send({
|
|
301
|
+
payload: {
|
|
302
|
+
processModelId: processNotification.processModelId,
|
|
303
|
+
action: 'is-executable-changed',
|
|
304
|
+
type: 'processModel',
|
|
305
|
+
},
|
|
306
|
+
});
|
|
307
|
+
});
|
|
334
308
|
case 'deployed':
|
|
335
|
-
return await client.notification.onProcessDeployed(
|
|
336
|
-
(processNotification)
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
});
|
|
349
|
-
},
|
|
350
|
-
{ identity: currentIdentity }
|
|
351
|
-
);
|
|
309
|
+
return await client.notification.onProcessDeployed((processNotification) => {
|
|
310
|
+
node.log('processNotification (deployed): ' + JSON.stringify(processNotification));
|
|
311
|
+
|
|
312
|
+
if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
|
|
313
|
+
return;
|
|
314
|
+
node.send({
|
|
315
|
+
payload: {
|
|
316
|
+
processModelId: processNotification.processModelId,
|
|
317
|
+
action: 'deployed',
|
|
318
|
+
type: 'processModel',
|
|
319
|
+
},
|
|
320
|
+
});
|
|
321
|
+
});
|
|
352
322
|
case 'undeployed':
|
|
353
|
-
return await client.notification.onProcessUndeployed(
|
|
354
|
-
(processNotification)
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
});
|
|
367
|
-
},
|
|
368
|
-
{ identity: currentIdentity }
|
|
369
|
-
);
|
|
323
|
+
return await client.notification.onProcessUndeployed((processNotification) => {
|
|
324
|
+
node.log('processNotification (undeployed): ' + JSON.stringify(processNotification));
|
|
325
|
+
|
|
326
|
+
if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
|
|
327
|
+
return;
|
|
328
|
+
node.send({
|
|
329
|
+
payload: {
|
|
330
|
+
processModelId: processNotification.processModelId,
|
|
331
|
+
action: 'undeployed',
|
|
332
|
+
type: 'processModel',
|
|
333
|
+
},
|
|
334
|
+
});
|
|
335
|
+
});
|
|
370
336
|
default:
|
|
371
337
|
console.error('no such event: ' + eventType);
|
|
372
338
|
break;
|
|
373
339
|
}
|
|
374
340
|
}
|
|
375
341
|
|
|
376
|
-
|
|
377
|
-
subscription = await subscribe(config.eventtype);
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
node.engine.registerOnIdentityChanged(async (identity) => {
|
|
381
|
-
if (subscription) {
|
|
382
|
-
client.notification.removeSubscription(subscription, currentIdentity);
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
currentIdentity = identity;
|
|
386
|
-
|
|
387
|
-
subscription = await client.notification.onProcessResumed(
|
|
388
|
-
(processNotification) => {
|
|
389
|
-
if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
|
|
390
|
-
return;
|
|
391
|
-
node.send({
|
|
392
|
-
payload: {
|
|
393
|
-
processInstanceId: processNotification.processInstanceId,
|
|
394
|
-
processModelId: processNotification.processModelId,
|
|
395
|
-
token: processNotification.currentToken,
|
|
396
|
-
action: 'resumed',
|
|
397
|
-
type: 'processInstance',
|
|
398
|
-
},
|
|
399
|
-
});
|
|
400
|
-
},
|
|
401
|
-
{ identity: currentIdentity }
|
|
402
|
-
);
|
|
403
|
-
});
|
|
342
|
+
subscription = await subscribe(config.eventtype);
|
|
404
343
|
|
|
405
344
|
node.on('close', () => {
|
|
406
345
|
if (node.engine && node.engine.engineClient && client) {
|
|
407
|
-
client.notification.removeSubscription(subscription
|
|
346
|
+
client.notification.removeSubscription(subscription);
|
|
408
347
|
}
|
|
409
348
|
});
|
|
410
349
|
};
|
|
411
350
|
|
|
412
351
|
if (node.engine) {
|
|
413
|
-
register()
|
|
352
|
+
register().catch((error) => {
|
|
353
|
+
node.error(error, {});
|
|
354
|
+
});
|
|
414
355
|
}
|
|
415
356
|
}
|
|
416
357
|
RED.nodes.registerType('process-event-listener', ProcessEventListener);
|
package/process-start.html
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
engine: { value: '', type: 'processcube-engine-config' },
|
|
8
8
|
processmodel: { value: '', required: false },
|
|
9
9
|
startevent: { value: '', required: false },
|
|
10
|
+
correlationId: { value: '', required: false },
|
|
10
11
|
},
|
|
11
12
|
inputs: 1,
|
|
12
13
|
outputs: 1,
|
|
@@ -34,6 +35,10 @@
|
|
|
34
35
|
<label for="node-input-startevent"><i class="fa fa-tag"></i> Startevent</label>
|
|
35
36
|
<input type="text" id="node-input-startevent" placeholder="ID of Startevent" />
|
|
36
37
|
</div>
|
|
38
|
+
<div class="form-row">
|
|
39
|
+
<label for="node-input-correlationId"><i class="fa fa-tag"></i> CorrelationId</label>
|
|
40
|
+
<input type="text" id="node-input-correlationId" placeholder="ID of Correlation" />
|
|
41
|
+
</div>
|
|
37
42
|
</script>
|
|
38
43
|
|
|
39
44
|
<script type="text/markdown" data-help-name="process-start">
|
|
@@ -46,6 +51,7 @@ The `processModelId` and `startEventId` can be set in the message object to over
|
|
|
46
51
|
: payload (Object) : Will be used as the start token for the process.
|
|
47
52
|
: processModelId (String) : Will be used as the process model and override the configured `Processmodel`.
|
|
48
53
|
: startEventId (String) : Will be used as the start event and override the configured `Startevent`.
|
|
54
|
+
: correlationId (String) : Will be used as the correlation identifier and override the configured `CorrelationId`.
|
|
49
55
|
|
|
50
56
|
## Outputs
|
|
51
57
|
|
package/process-start.js
CHANGED
|
@@ -4,25 +4,48 @@ module.exports = function (RED) {
|
|
|
4
4
|
var node = this;
|
|
5
5
|
|
|
6
6
|
node.on('input', function (msg) {
|
|
7
|
+
let initialToken = {};
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
if (msg.payload) {
|
|
10
|
+
initialToken = RED.util.encodeObject(msg.payload);
|
|
11
|
+
|
|
12
|
+
// remote msg and format from result
|
|
13
|
+
if (initialToken) {
|
|
14
|
+
delete initialToken.msg;
|
|
15
|
+
delete initialToken.format;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
9
18
|
|
|
10
19
|
const startParameters = {
|
|
11
20
|
processModelId: msg.processModelId || config.processmodel,
|
|
12
21
|
startEventId: msg.startEventId || config.startevent,
|
|
22
|
+
correlationId: msg.correlationId || config.correlationId,
|
|
13
23
|
initialToken: initialToken,
|
|
14
24
|
};
|
|
15
25
|
|
|
16
|
-
|
|
17
|
-
|
|
26
|
+
if (!startParameters.processModelId) {
|
|
27
|
+
node.error('No processModelId configured.', msg);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!startParameters.startEventId) {
|
|
32
|
+
node.error('No startEventId configured.', msg);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
node.engine = RED.nodes.getNode(config.engine);
|
|
37
|
+
const client = node.engine.engineClient;
|
|
18
38
|
|
|
19
39
|
if (!client) {
|
|
20
|
-
node.error('No engine configured.');
|
|
40
|
+
node.error('No engine configured.', msg);
|
|
21
41
|
return;
|
|
22
42
|
}
|
|
23
43
|
|
|
44
|
+
const isUser = !!msg._client?.user && !!msg._client.user.accessToken;
|
|
45
|
+
const identity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
|
|
46
|
+
|
|
24
47
|
client.processDefinitions
|
|
25
|
-
.startProcessInstance(startParameters,
|
|
48
|
+
.startProcessInstance(startParameters, identity)
|
|
26
49
|
.then((result) => {
|
|
27
50
|
msg.payload = result;
|
|
28
51
|
|
|
@@ -34,7 +57,7 @@ module.exports = function (RED) {
|
|
|
34
57
|
});
|
|
35
58
|
})
|
|
36
59
|
.catch((error) => {
|
|
37
|
-
node.error(error);
|
|
60
|
+
node.error(error, msg);
|
|
38
61
|
});
|
|
39
62
|
});
|
|
40
63
|
}
|
package/process-terminate.html
CHANGED
package/process-terminate.js
CHANGED
|
@@ -4,21 +4,23 @@ module.exports = function (RED) {
|
|
|
4
4
|
var node = this;
|
|
5
5
|
|
|
6
6
|
node.on('input', function (msg) {
|
|
7
|
-
|
|
8
|
-
const client = engine.engineClient;
|
|
7
|
+
node.engine = RED.nodes.getNode(config.engine);
|
|
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;
|
|
9
11
|
|
|
10
12
|
if (!client) {
|
|
11
|
-
node.error('No engine configured.');
|
|
13
|
+
node.error('No engine configured.', msg);
|
|
12
14
|
return;
|
|
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
|
})
|
|
20
22
|
.catch((error) => {
|
|
21
|
-
node.error(error);
|
|
23
|
+
node.error(error, msg);
|
|
22
24
|
});
|
|
23
25
|
});
|
|
24
26
|
}
|