@5minds/node-red-contrib-processcube 1.1.4-develop-9a2b44-m0m8kbzf → 1.1.4-develop-b953ba-m17jglme

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,6 +16,7 @@ services:
16
16
 
17
17
  engine:
18
18
  image: 5minds/processcube_engine:2024-1
19
+ #image: 5minds/processcube_engine:17.1.2
19
20
  ports:
20
21
  - 8000:8000
21
22
  volumes:
@@ -202,14 +202,14 @@
202
202
  "color": "#a4a4a4"
203
203
  },
204
204
  "nodes": [
205
- "f7a9604a17188737",
206
205
  "020d34cd4ab43900",
207
- "1db0ae57c1b8486b",
208
- "127bc6e092c5724e"
206
+ "127bc6e092c5724e",
207
+ "394bf2c574d29c0d",
208
+ "30354355d2a0eeb8"
209
209
  ],
210
210
  "x": 34,
211
211
  "y": 19,
212
- "w": 452,
212
+ "w": 532,
213
213
  "h": 202
214
214
  },
215
215
  {
@@ -226,17 +226,16 @@
226
226
  "color": "#a4a4a4"
227
227
  },
228
228
  "nodes": [
229
- "ae0583e83c762956",
230
229
  "f7c7682e3a6adaaa",
231
- "a2fb6369b16c12fa",
232
230
  "8ef39e83173d41e3",
233
231
  "f524b8cc35d56849",
234
- "9fb4017c1d0ac7c9"
232
+ "9fb4017c1d0ac7c9",
233
+ "fc23f271b106648f"
235
234
  ],
236
235
  "x": 34,
237
236
  "y": 259,
238
237
  "w": 652,
239
- "h": 262
238
+ "h": 202
240
239
  },
241
240
  {
242
241
  "id": "a71a168415778e2c",
@@ -353,14 +352,14 @@
353
352
  "color": "#a4a4a4"
354
353
  },
355
354
  "nodes": [
356
- "81a5b763cddfa482",
357
- "9bfd3131d8d4529e",
358
- "fcfec4ae86b4aec2",
359
- "c4f20aefe585bdad"
355
+ "c4f20aefe585bdad",
356
+ "451fc49b81cfe869",
357
+ "07e2258a732baddb",
358
+ "58202f3750a9762b"
360
359
  ],
361
360
  "x": 54,
362
361
  "y": 39,
363
- "w": 452,
362
+ "w": 432,
364
363
  "h": 202
365
364
  },
366
365
  {
@@ -377,17 +376,16 @@
377
376
  "color": "#a4a4a4"
378
377
  },
379
378
  "nodes": [
380
- "59f3d5ea3d920f94",
381
379
  "682a3e6e49c407c0",
382
- "30ac2bbbc0d63b17",
383
380
  "5c9668cbe4b31919",
384
381
  "693e6d63e82ee961",
385
- "c63cac30d2627c52"
382
+ "c63cac30d2627c52",
383
+ "771e1802a60ea5cc"
386
384
  ],
387
385
  "x": 54,
388
386
  "y": 279,
389
- "w": 652,
390
- "h": 262
387
+ "w": 632,
388
+ "h": 202
391
389
  },
392
390
  {
393
391
  "id": "e17f65347110575e",
@@ -1075,29 +1073,13 @@
1075
1073
  "y": 540,
1076
1074
  "wires": []
1077
1075
  },
1078
- {
1079
- "id": "f7a9604a17188737",
1080
- "type": "usertask-new-listener",
1081
- "z": "fd3c725340de4f74",
1082
- "g": "887f3fb69ad1d1fb",
1083
- "name": "New User Task",
1084
- "engine": "42e6796dddd9d4db",
1085
- "multisend": false,
1086
- "x": 160,
1087
- "y": 120,
1088
- "wires": [
1089
- [
1090
- "020d34cd4ab43900"
1091
- ]
1092
- ]
1093
- },
1094
1076
  {
1095
1077
  "id": "020d34cd4ab43900",
1096
1078
  "type": "debug",
1097
1079
  "z": "fd3c725340de4f74",
1098
1080
  "g": "887f3fb69ad1d1fb",
1099
1081
  "name": "Show User Task",
1100
- "active": true,
1082
+ "active": false,
1101
1083
  "tosidebar": true,
1102
1084
  "console": false,
1103
1085
  "tostatus": false,
@@ -1105,26 +1087,10 @@
1105
1087
  "targetType": "msg",
1106
1088
  "statusVal": "",
1107
1089
  "statusType": "auto",
1108
- "x": 360,
1090
+ "x": 440,
1109
1091
  "y": 120,
1110
1092
  "wires": []
1111
1093
  },
1112
- {
1113
- "id": "1db0ae57c1b8486b",
1114
- "type": "usertask-finished-listener",
1115
- "z": "fd3c725340de4f74",
1116
- "g": "887f3fb69ad1d1fb",
1117
- "name": "Finished User Task",
1118
- "engine": "42e6796dddd9d4db",
1119
- "multisend": false,
1120
- "x": 150,
1121
- "y": 180,
1122
- "wires": [
1123
- [
1124
- "020d34cd4ab43900"
1125
- ]
1126
- ]
1127
- },
1128
1094
  {
1129
1095
  "id": "127bc6e092c5724e",
1130
1096
  "type": "comment",
@@ -1136,22 +1102,6 @@
1136
1102
  "y": 60,
1137
1103
  "wires": []
1138
1104
  },
1139
- {
1140
- "id": "ae0583e83c762956",
1141
- "type": "usertask-new-listener",
1142
- "z": "fd3c725340de4f74",
1143
- "g": "72d3db13edc2486b",
1144
- "name": "",
1145
- "engine": "42e6796dddd9d4db",
1146
- "multisend": true,
1147
- "x": 160,
1148
- "y": 360,
1149
- "wires": [
1150
- [
1151
- "a2fb6369b16c12fa"
1152
- ]
1153
- ]
1154
- },
1155
1105
  {
1156
1106
  "id": "f7c7682e3a6adaaa",
1157
1107
  "type": "usertask-input",
@@ -1163,7 +1113,7 @@
1163
1113
  "query_type": "msg",
1164
1114
  "force_send_array": false,
1165
1115
  "multisend": false,
1166
- "x": 380,
1116
+ "x": 180,
1167
1117
  "y": 420,
1168
1118
  "wires": [
1169
1119
  [
@@ -1171,27 +1121,6 @@
1171
1121
  ]
1172
1122
  ]
1173
1123
  },
1174
- {
1175
- "id": "a2fb6369b16c12fa",
1176
- "type": "function",
1177
- "z": "fd3c725340de4f74",
1178
- "g": "72d3db13edc2486b",
1179
- "name": "query",
1180
- "func": "msg.payload = {\n flowNodeInstanceId: msg.payload.flowNodeInstanceId,\n flowNodeId: \"user_task\"\n};\n\nreturn msg;",
1181
- "outputs": 1,
1182
- "timeout": 0,
1183
- "noerr": 0,
1184
- "initialize": "",
1185
- "finalize": "",
1186
- "libs": [],
1187
- "x": 210,
1188
- "y": 420,
1189
- "wires": [
1190
- [
1191
- "f7c7682e3a6adaaa"
1192
- ]
1193
- ]
1194
- },
1195
1124
  {
1196
1125
  "id": "8ef39e83173d41e3",
1197
1126
  "type": "function",
@@ -1206,7 +1135,7 @@
1206
1135
  "finalize": "",
1207
1136
  "libs": [],
1208
1137
  "x": 390,
1209
- "y": 480,
1138
+ "y": 420,
1210
1139
  "wires": [
1211
1140
  [
1212
1141
  "f524b8cc35d56849"
@@ -1223,7 +1152,7 @@
1223
1152
  "result": "payload.result",
1224
1153
  "result_type": "msg",
1225
1154
  "x": 580,
1226
- "y": 480,
1155
+ "y": 420,
1227
1156
  "wires": [
1228
1157
  []
1229
1158
  ]
@@ -1240,52 +1169,59 @@
1240
1169
  "wires": []
1241
1170
  },
1242
1171
  {
1243
- "id": "81a5b763cddfa482",
1244
- "type": "usertask-new-listener",
1245
- "z": "90fa3991405c6248",
1246
- "g": "4f03c1eb4784b442",
1247
- "name": "New User Task",
1248
- "engine": "b78932d162d8d468",
1249
- "multisend": false,
1250
- "x": 180,
1251
- "y": 140,
1172
+ "id": "fc23f271b106648f",
1173
+ "type": "usertask-event-listener",
1174
+ "z": "fd3c725340de4f74",
1175
+ "g": "72d3db13edc2486b",
1176
+ "name": "",
1177
+ "engine": "42e6796dddd9d4db",
1178
+ "usertask": "user_task",
1179
+ "eventtype": "new",
1180
+ "query": "{}",
1181
+ "query_type": "json",
1182
+ "x": 160,
1183
+ "y": 360,
1252
1184
  "wires": [
1253
1185
  [
1254
- "9bfd3131d8d4529e"
1186
+ "f7c7682e3a6adaaa"
1255
1187
  ]
1256
1188
  ]
1257
1189
  },
1258
1190
  {
1259
- "id": "9bfd3131d8d4529e",
1260
- "type": "debug",
1261
- "z": "90fa3991405c6248",
1262
- "g": "4f03c1eb4784b442",
1263
- "name": "Show User Task",
1264
- "active": true,
1265
- "tosidebar": true,
1266
- "console": false,
1267
- "tostatus": false,
1268
- "complete": "payload",
1269
- "targetType": "msg",
1270
- "statusVal": "",
1271
- "statusType": "auto",
1272
- "x": 380,
1273
- "y": 140,
1274
- "wires": []
1191
+ "id": "394bf2c574d29c0d",
1192
+ "type": "usertask-event-listener",
1193
+ "z": "fd3c725340de4f74",
1194
+ "g": "887f3fb69ad1d1fb",
1195
+ "name": "",
1196
+ "engine": "42e6796dddd9d4db",
1197
+ "usertask": "user_task",
1198
+ "eventtype": "new",
1199
+ "query": "{}",
1200
+ "query_type": "json",
1201
+ "x": 160,
1202
+ "y": 120,
1203
+ "wires": [
1204
+ [
1205
+ "020d34cd4ab43900"
1206
+ ]
1207
+ ]
1275
1208
  },
1276
1209
  {
1277
- "id": "fcfec4ae86b4aec2",
1278
- "type": "usertask-finished-listener",
1279
- "z": "90fa3991405c6248",
1280
- "g": "4f03c1eb4784b442",
1281
- "name": "Finished User Task",
1282
- "engine": "b78932d162d8d468",
1283
- "multisend": false,
1284
- "x": 170,
1285
- "y": 200,
1210
+ "id": "30354355d2a0eeb8",
1211
+ "type": "usertask-event-listener",
1212
+ "z": "fd3c725340de4f74",
1213
+ "g": "887f3fb69ad1d1fb",
1214
+ "name": "",
1215
+ "engine": "42e6796dddd9d4db",
1216
+ "usertask": "user_task",
1217
+ "eventtype": "finished",
1218
+ "query": "{}",
1219
+ "query_type": "json",
1220
+ "x": 160,
1221
+ "y": 180,
1286
1222
  "wires": [
1287
1223
  [
1288
- "9bfd3131d8d4529e"
1224
+ "020d34cd4ab43900"
1289
1225
  ]
1290
1226
  ]
1291
1227
  },
@@ -1300,22 +1236,6 @@
1300
1236
  "y": 80,
1301
1237
  "wires": []
1302
1238
  },
1303
- {
1304
- "id": "59f3d5ea3d920f94",
1305
- "type": "usertask-new-listener",
1306
- "z": "90fa3991405c6248",
1307
- "g": "a135da7e3b76f6dd",
1308
- "name": "",
1309
- "engine": "b78932d162d8d468",
1310
- "multisend": true,
1311
- "x": 180,
1312
- "y": 380,
1313
- "wires": [
1314
- [
1315
- "30ac2bbbc0d63b17"
1316
- ]
1317
- ]
1318
- },
1319
1239
  {
1320
1240
  "id": "682a3e6e49c407c0",
1321
1241
  "type": "usertask-input",
@@ -1327,7 +1247,7 @@
1327
1247
  "query_type": "msg",
1328
1248
  "force_send_array": false,
1329
1249
  "multisend": false,
1330
- "x": 400,
1250
+ "x": 200,
1331
1251
  "y": 440,
1332
1252
  "wires": [
1333
1253
  [
@@ -1335,27 +1255,6 @@
1335
1255
  ]
1336
1256
  ]
1337
1257
  },
1338
- {
1339
- "id": "30ac2bbbc0d63b17",
1340
- "type": "function",
1341
- "z": "90fa3991405c6248",
1342
- "g": "a135da7e3b76f6dd",
1343
- "name": "query",
1344
- "func": "msg.payload = {\n flowNodeInstanceId: msg.payload.flowNodeInstanceId,\n flowNodeId: \"user_task_auth\"\n};\n\nreturn msg;",
1345
- "outputs": 1,
1346
- "timeout": 0,
1347
- "noerr": 0,
1348
- "initialize": "",
1349
- "finalize": "",
1350
- "libs": [],
1351
- "x": 230,
1352
- "y": 440,
1353
- "wires": [
1354
- [
1355
- "682a3e6e49c407c0"
1356
- ]
1357
- ]
1358
- },
1359
1258
  {
1360
1259
  "id": "5c9668cbe4b31919",
1361
1260
  "type": "function",
@@ -1369,8 +1268,8 @@
1369
1268
  "initialize": "",
1370
1269
  "finalize": "",
1371
1270
  "libs": [],
1372
- "x": 410,
1373
- "y": 500,
1271
+ "x": 390,
1272
+ "y": 440,
1374
1273
  "wires": [
1375
1274
  [
1376
1275
  "693e6d63e82ee961"
@@ -1386,8 +1285,8 @@
1386
1285
  "engine": "b78932d162d8d468",
1387
1286
  "result": "payload.result",
1388
1287
  "result_type": "msg",
1389
- "x": 600,
1390
- "y": 500,
1288
+ "x": 580,
1289
+ "y": 440,
1391
1290
  "wires": [
1392
1291
  []
1393
1292
  ]
@@ -1403,6 +1302,80 @@
1403
1302
  "y": 320,
1404
1303
  "wires": []
1405
1304
  },
1305
+ {
1306
+ "id": "771e1802a60ea5cc",
1307
+ "type": "usertask-event-listener",
1308
+ "z": "90fa3991405c6248",
1309
+ "g": "a135da7e3b76f6dd",
1310
+ "name": "",
1311
+ "engine": "b78932d162d8d468",
1312
+ "usertask": "user_task_auth",
1313
+ "eventtype": "new",
1314
+ "query": "{}",
1315
+ "query_type": "json",
1316
+ "x": 180,
1317
+ "y": 380,
1318
+ "wires": [
1319
+ [
1320
+ "682a3e6e49c407c0"
1321
+ ]
1322
+ ]
1323
+ },
1324
+ {
1325
+ "id": "451fc49b81cfe869",
1326
+ "type": "usertask-event-listener",
1327
+ "z": "90fa3991405c6248",
1328
+ "g": "4f03c1eb4784b442",
1329
+ "name": "",
1330
+ "engine": "b78932d162d8d468",
1331
+ "usertask": "user_task_auth",
1332
+ "eventtype": "new",
1333
+ "query": "{}",
1334
+ "query_type": "json",
1335
+ "x": 180,
1336
+ "y": 140,
1337
+ "wires": [
1338
+ [
1339
+ "58202f3750a9762b"
1340
+ ]
1341
+ ]
1342
+ },
1343
+ {
1344
+ "id": "07e2258a732baddb",
1345
+ "type": "usertask-event-listener",
1346
+ "z": "90fa3991405c6248",
1347
+ "g": "4f03c1eb4784b442",
1348
+ "name": "",
1349
+ "engine": "b78932d162d8d468",
1350
+ "usertask": "user_task_auth",
1351
+ "eventtype": "finished",
1352
+ "query": "{}",
1353
+ "query_type": "json",
1354
+ "x": 180,
1355
+ "y": 200,
1356
+ "wires": [
1357
+ [
1358
+ "58202f3750a9762b"
1359
+ ]
1360
+ ]
1361
+ },
1362
+ {
1363
+ "id": "58202f3750a9762b",
1364
+ "type": "debug",
1365
+ "z": "90fa3991405c6248",
1366
+ "g": "4f03c1eb4784b442",
1367
+ "name": "debug 31",
1368
+ "active": false,
1369
+ "tosidebar": true,
1370
+ "console": false,
1371
+ "tostatus": false,
1372
+ "complete": "false",
1373
+ "statusVal": "",
1374
+ "statusType": "auto",
1375
+ "x": 380,
1376
+ "y": 140,
1377
+ "wires": []
1378
+ },
1406
1379
  {
1407
1380
  "id": "baa5d814f2e1f1d8",
1408
1381
  "type": "processinstance-query",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.1.4-develop-9a2b44-m0m8kbzf",
3
+ "version": "1.1.4-develop-b953ba-m17jglme",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -45,6 +45,7 @@
45
45
  "processEventListener": "process-event-listener.js",
46
46
  "processcubeEngineConfig": "processcube-engine-config.js",
47
47
  "ProcessinstanceQuery": "processinstance-query.js",
48
+ "ProcessinstanceDelete": "processinstance-delete.js",
48
49
  "ProcessdefinitionQuery": "processdefinition-query.js",
49
50
  "messageEventTrigger": "message-event-trigger.js",
50
51
  "signalEventTrigger": "signal-event-trigger.js",
@@ -0,0 +1,88 @@
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="Call-Activity-Sample_Definition" targetNamespace="http://bpmn.io/schema/bpmn" exporter="5Minds Studio" exporterVersion="1">
3
+ <bpmn:collaboration id="Collaboration_1cidyxu" name="">
4
+ <bpmn:participant id="Participant_0px403d" name="Call-Activity-Sample" processRef="Call-Activity-Sample_Process" />
5
+ </bpmn:collaboration>
6
+ <bpmn:process id="Call-Activity-Sample_Process" name="Call-Activity-Sample" isExecutable="true">
7
+ <bpmn:laneSet>
8
+ <bpmn:lane id="Lane_1xzf0d3" name="Lane">
9
+ <bpmn:flowNodeRef>StartEvent_1</bpmn:flowNodeRef>
10
+ <bpmn:flowNodeRef>Activity_1483lxt</bpmn:flowNodeRef>
11
+ <bpmn:flowNodeRef>Event_051opo1</bpmn:flowNodeRef>
12
+ <bpmn:flowNodeRef>Activity_1m883u3</bpmn:flowNodeRef>
13
+ </bpmn:lane>
14
+ </bpmn:laneSet>
15
+ <bpmn:startEvent id="StartEvent_1" name="Start">
16
+ <bpmn:outgoing>Flow_0jchwpf</bpmn:outgoing>
17
+ </bpmn:startEvent>
18
+ <bpmn:sequenceFlow id="Flow_0jchwpf" sourceRef="StartEvent_1" targetRef="Activity_1483lxt" />
19
+ <bpmn:scriptTask id="Activity_1483lxt" name="make multi">
20
+ <bpmn:incoming>Flow_0jchwpf</bpmn:incoming>
21
+ <bpmn:outgoing>Flow_1kbc11o</bpmn:outgoing>
22
+ <bpmn:script>const data = [
23
+ {
24
+ "uid": 14200
25
+ },
26
+ {
27
+ "uid": 14201
28
+ }
29
+ ];
30
+
31
+ return data;</bpmn:script>
32
+ </bpmn:scriptTask>
33
+ <bpmn:sequenceFlow id="Flow_1kbc11o" sourceRef="Activity_1483lxt" targetRef="Activity_1m883u3" />
34
+ <bpmn:endEvent id="Event_051opo1">
35
+ <bpmn:incoming>Flow_0pjaqpi</bpmn:incoming>
36
+ </bpmn:endEvent>
37
+ <bpmn:sequenceFlow id="Flow_0pjaqpi" sourceRef="Activity_1m883u3" targetRef="Event_051opo1" />
38
+ <bpmn:callActivity id="Activity_1m883u3" name="call sub" calledElement="External-Task-Sample_Process">
39
+ <bpmn:extensionElements>
40
+ <camunda:properties>
41
+ <camunda:property name="startEventId" value="StartEvent_1" />
42
+ </camunda:properties>
43
+ </bpmn:extensionElements>
44
+ <bpmn:incoming>Flow_1kbc11o</bpmn:incoming>
45
+ <bpmn:outgoing>Flow_0pjaqpi</bpmn:outgoing>
46
+ <bpmn:multiInstanceLoopCharacteristics />
47
+ </bpmn:callActivity>
48
+ </bpmn:process>
49
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
50
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1cidyxu">
51
+ <bpmndi:BPMNShape id="Participant_0px403d_di" bpmnElement="Participant_0px403d" isHorizontal="true">
52
+ <dc:Bounds x="5" y="4" width="885" height="346" />
53
+ </bpmndi:BPMNShape>
54
+ <bpmndi:BPMNShape id="Lane_1xzf0d3_di" bpmnElement="Lane_1xzf0d3" isHorizontal="true">
55
+ <dc:Bounds x="35" y="4" width="855" height="346" />
56
+ </bpmndi:BPMNShape>
57
+ <bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
58
+ <dc:Bounds x="92" y="152" width="36" height="36" />
59
+ <bpmndi:BPMNLabel>
60
+ <dc:Bounds x="98" y="195" width="24" height="14" />
61
+ </bpmndi:BPMNLabel>
62
+ </bpmndi:BPMNShape>
63
+ <bpmndi:BPMNShape id="Activity_0uc2tzt_di" bpmnElement="Activity_1483lxt">
64
+ <dc:Bounds x="180" y="130" width="100" height="80" />
65
+ <bpmndi:BPMNLabel />
66
+ </bpmndi:BPMNShape>
67
+ <bpmndi:BPMNShape id="Event_051opo1_di" bpmnElement="Event_051opo1">
68
+ <dc:Bounds x="502" y="152" width="36" height="36" />
69
+ </bpmndi:BPMNShape>
70
+ <bpmndi:BPMNShape id="Activity_0t5p0pc_di" bpmnElement="Activity_1m883u3">
71
+ <dc:Bounds x="340" y="130" width="100" height="80" />
72
+ <bpmndi:BPMNLabel />
73
+ </bpmndi:BPMNShape>
74
+ <bpmndi:BPMNEdge id="Flow_0jchwpf_di" bpmnElement="Flow_0jchwpf">
75
+ <di:waypoint x="128" y="170" />
76
+ <di:waypoint x="180" y="170" />
77
+ </bpmndi:BPMNEdge>
78
+ <bpmndi:BPMNEdge id="Flow_1kbc11o_di" bpmnElement="Flow_1kbc11o">
79
+ <di:waypoint x="280" y="170" />
80
+ <di:waypoint x="340" y="170" />
81
+ </bpmndi:BPMNEdge>
82
+ <bpmndi:BPMNEdge id="Flow_0pjaqpi_di" bpmnElement="Flow_0pjaqpi">
83
+ <di:waypoint x="440" y="170" />
84
+ <di:waypoint x="502" y="170" />
85
+ </bpmndi:BPMNEdge>
86
+ </bpmndi:BPMNPlane>
87
+ </bpmndi:BPMNDiagram>
88
+ </bpmn:definitions>
@@ -0,0 +1,58 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType('processinstance-delete', {
3
+ category: 'ProcessCube DevOps',
4
+ color: '#02AFD6',
5
+ defaults: {
6
+ name: { value: '' },
7
+ engine: { value: '', type: 'processcube-engine-config' },
8
+ time: { value: '', type: 'number' },
9
+ time_type: { value: 'hours' },
10
+ },
11
+ inputs: 1,
12
+ outputs: 1,
13
+ icon: 'font-awesome/fa-sign-in',
14
+ label: function () {
15
+ return this.name || 'processinstance-delete';
16
+ },
17
+ });
18
+ </script>
19
+
20
+ <script type="text/html" data-template-name="processinstance-delete">
21
+ <div class="form-row">
22
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
23
+ <input type="text" id="node-input-name" placeholder="Name" />
24
+ </div>
25
+ <div class="form-row">
26
+ <label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
27
+ <input type="text" id="node-input-engine" placeholder="Engine-URL" />
28
+ </div>
29
+ <div class="form-row">
30
+ <label for="node-input-time"><i class="fa fa-tag"></i> Time</label>
31
+ <input type="text" id="node-input-time" />
32
+ </div>
33
+ <div class="form-row">
34
+ <label for="node-input-time_type"><i class="fa fa-sliders"></i> Period</label>
35
+ <select id="node-input-time_type" style="width: 70%;">
36
+ <option value="hours">Hours</option>
37
+ <option value="days">Days</option>
38
+ </select>
39
+ </div>
40
+ </script>
41
+
42
+ <script type="text/markdown" data-help-name="processinstance-delete">
43
+ Delete old instances of a process model in the ProcessCube.
44
+
45
+ ## Inputs
46
+
47
+ : payload.time (number): The number of given time periods.
48
+ : payload.time_type ('hours' | 'days'): The type of time period to use.
49
+
50
+ ## Outputs
51
+
52
+ : payload (string[]): The ids of the processinstances that were deleted.
53
+
54
+ ### References
55
+
56
+ - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
57
+ - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube&copy;
58
+ </script>
@@ -0,0 +1,55 @@
1
+ module.exports = function (RED) {
2
+ function ProcessInstanceDelete(config) {
3
+ RED.nodes.createNode(this, config);
4
+ var node = this;
5
+
6
+ node.on('input', async function (msg) {
7
+ const engine = RED.nodes.getNode(config.engine);
8
+ const client = engine.engineClient;
9
+
10
+ if (!client) {
11
+ node.error('No engine configured.');
12
+ return;
13
+ }
14
+ let timeMultiplier;
15
+ if (msg.payload.time_type) {
16
+ timeMultiplier = msg.payload.time_type == 'hours' ? 1 : 24;
17
+ } else {
18
+ timeMultiplier = config.time_type == 'hours' ? 1 : 24;
19
+ }
20
+
21
+ const timeToUse = msg.payload.time ? msg.payload.time : config.time;
22
+
23
+ try {
24
+ const fetchInstancesByState = async (state) => {
25
+ const result = await client.processInstances.query({ state });
26
+ return result.processInstances;
27
+ };
28
+
29
+ const finishedInstances = await fetchInstancesByState('finished');
30
+ const terminatedInstances = await fetchInstancesByState('terminated');
31
+ const errorInstances = await fetchInstancesByState('error');
32
+
33
+ let allInstances = [...finishedInstances, ...terminatedInstances, ...errorInstances];
34
+
35
+ const today = new Date();
36
+
37
+ const oldTasks = allInstances.filter((instance) => {
38
+ const finishedDate = new Date(instance.finishedAt);
39
+ const diffInHours = (today - finishedDate) / (1000 * 60 * 60);
40
+ return diffInHours > Number(timeToUse) * timeMultiplier;
41
+ });
42
+
43
+ const ids = oldTasks.map((obj) => obj.processInstanceId);
44
+ msg.payload = ids;
45
+
46
+ await client.processInstances.deleteProcessInstances(ids, engine.identity);
47
+ node.send(msg);
48
+ } catch (error) {
49
+ node.error(error);
50
+ }
51
+ });
52
+ }
53
+
54
+ RED.nodes.registerType('processinstance-delete', ProcessInstanceDelete);
55
+ };