@5minds/node-red-contrib-processcube 1.1.4-feature-db7b89-m14muv3d → 1.1.4-feature-b3c80b-m14rvpwu

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.
@@ -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:
@@ -6,7 +6,6 @@
6
6
  name: { value: '' },
7
7
  engine: { value: '', type: 'processcube-engine-config' },
8
8
  topic: { value: '' },
9
- workerConfig: { value: '', type: 'json' },
10
9
  },
11
10
  inputs: 0,
12
11
  outputs: 1,
@@ -14,15 +13,6 @@
14
13
  label: function () {
15
14
  return this.name || 'externaltask-input';
16
15
  },
17
- oneditprepare: function () {
18
- $('#node-input-workerConfig').typedInput({
19
- default: 'json',
20
- types: ['json'],
21
- });
22
- },
23
- oneditsave: function () {
24
- this.workerConfig = $('#node-input-workerConfig').typedInput('value');
25
- },
26
16
  });
27
17
  </script>
28
18
 
@@ -39,10 +29,6 @@
39
29
  <label for="node-input-topic"><i class="fa fa-tag"></i> Topic</label>
40
30
  <input type="text" id="node-input-topic" placeholder="Topic of ExternalTask" />
41
31
  </div>
42
- <div class="form-row"></div>
43
- <label for="node-input-workerConfig"><i class="fa fa-tag"></i> Worker Config</label>
44
- <input type="text" id="node-input-workerConfig" />
45
- </div>
46
32
  </script>
47
33
 
48
34
  <script type="text/markdown" data-help-name="externaltask-input">
@@ -16,7 +16,7 @@ module.exports = function (RED) {
16
16
  var node = this;
17
17
  var flowContext = node.context().flow;
18
18
 
19
- const engine = RED.nodes.getNode(config.engine);
19
+ const engine = RED.nodes.getNode(config.engine);
20
20
 
21
21
  const client = engine.engineClient;
22
22
 
@@ -32,84 +32,82 @@ module.exports = function (RED) {
32
32
  eventEmitter = flowContext.get('emitter');
33
33
  }
34
34
 
35
- const etwCallback = async (payload, externalTask) => {
36
- const saveHandleCallback = (data, callback) => {
37
- try {
38
- callback(data);
39
- } catch (error) {
40
- node.error(`Error in callback 'saveHandleCallback': ${error.message}`);
41
- }
42
- };
35
+ client.externalTasks
36
+ .subscribeToExternalTaskTopic(config.topic, async (payload, externalTask) => {
37
+ const saveHandleCallback = (data, callback) => {
38
+ try {
39
+ callback(data);
40
+ } catch (error) {
41
+ node.error(`Error in callback 'saveHandleCallback': ${error.message}`);
42
+ }
43
+ };
43
44
 
44
- return await new Promise((resolve, reject) => {
45
- const handleFinishTask = (msg) => {
46
- let result = RED.util.encodeObject(msg.payload);
45
+ return await new Promise((resolve, reject) => {
46
+ const handleFinishTask = (msg) => {
47
+ let result = RED.util.encodeObject(msg.payload);
47
48
 
48
- node.log(
49
- `handle event for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* ${externalTask.processInstanceId} with result ${result} on msg._msgid ${msg._msgid}.`
50
- );
49
+ node.log(
50
+ `handle event for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* ${externalTask.processInstanceId} with result ${result} on msg._msgid ${msg._msgid}.`,
51
+ );
51
52
 
52
- if (externalTask.flowNodeInstanceId) {
53
- delete started_external_tasks[externalTask.flowNodeInstanceId];
54
- }
53
+ if (externalTask.flowNodeInstanceId) {
54
+ delete started_external_tasks[externalTask.flowNodeInstanceId];
55
+ }
55
56
 
56
- showStatus(node, Object.keys(started_external_tasks).length);
57
+ showStatus(node, Object.keys(started_external_tasks).length);
57
58
 
58
- //resolve(result);
59
- saveHandleCallback(result, resolve);
60
- };
61
-
62
- const handleErrorTask = (msg) => {
63
- node.log(
64
- `handle error event for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' on *msg._msgid* '${msg._msgid}'.`
65
- );
59
+ //resolve(result);
60
+ saveHandleCallback(result, resolve);
61
+ };
66
62
 
67
- if (externalTask.flowNodeInstanceId) {
68
- delete started_external_tasks[externalTask.flowNodeInstanceId];
69
- }
63
+ const handleErrorTask = (msg) => {
64
+ node.log(
65
+ `handle error event for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' on *msg._msgid* '${msg._msgid}'.`,
66
+ );
70
67
 
71
- showStatus(node, Object.keys(started_external_tasks).length);
68
+ if (externalTask.flowNodeInstanceId) {
69
+ delete started_external_tasks[externalTask.flowNodeInstanceId];
70
+ }
72
71
 
73
- // TODO: with reject, the default error handling is proceed
74
- // SEE: https://github.com/5minds/ProcessCube.Engine.Client.ts/blob/develop/src/ExternalTaskWorker.ts#L180
75
- // reject(result);
76
- //resolve(msg);
77
- saveHandleCallback(msg, resolve);
78
- };
72
+ showStatus(node, Object.keys(started_external_tasks).length);
79
73
 
80
- eventEmitter.once(`handle-${externalTask.flowNodeInstanceId}`, (msg, isError = false) => {
81
- node.log(
82
- `handle event for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' with *msg._msgid* '${msg._msgid}' and *isError* '${isError}'`
83
- );
74
+ // TODO: with reject, the default error handling is proceed
75
+ // SEE: https://github.com/5minds/ProcessCube.Engine.Client.ts/blob/develop/src/ExternalTaskWorker.ts#L180
76
+ // reject(result);
77
+ //resolve(msg);
78
+ saveHandleCallback(msg, resolve);
79
+ };
84
80
 
85
- if (isError) {
86
- handleErrorTask(msg);
87
- } else {
88
- handleFinishTask(msg);
89
- }
90
- });
81
+ eventEmitter.once(`handle-${externalTask.flowNodeInstanceId}`, (msg, isError = false) => {
82
+ node.log(
83
+ `handle event for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' with *msg._msgid* '${msg._msgid}' and *isError* '${isError}'`,
84
+ );
91
85
 
92
- started_external_tasks[externalTask.flowNodeInstanceId] = externalTask;
86
+ if (isError) {
87
+ handleErrorTask(msg);
88
+ } else {
89
+ handleFinishTask(msg);
90
+ }
91
+ });
93
92
 
94
- showStatus(node, Object.keys(started_external_tasks).length);
93
+ started_external_tasks[externalTask.flowNodeInstanceId] = externalTask;
95
94
 
96
- let msg = {
97
- _msgid: RED.util.generateId(),
98
- task: RED.util.encodeObject(externalTask),
99
- payload: payload,
100
- flowNodeInstanceId: externalTask.flowNodeInstanceId,
101
- };
95
+ showStatus(node, Object.keys(started_external_tasks).length);
102
96
 
103
- node.log(
104
- `Received *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' with *msg._msgid* '${msg._msgid}'`
105
- );
97
+ let msg = {
98
+ _msgid: RED.util.generateId(),
99
+ task: RED.util.encodeObject(externalTask),
100
+ payload: payload,
101
+ flowNodeInstanceId: externalTask.flowNodeInstanceId,
102
+ };
106
103
 
107
- node.send(msg);
108
- });
109
- };
104
+ node.log(
105
+ `Received *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' with *msg._msgid* '${msg._msgid}'`,
106
+ );
110
107
 
111
- client.externalTasks
112
- .subscribeToExternalTaskTopic(config.topic, etwCallback, config.workerConfig)
108
+ node.send(msg);
109
+ });
110
+ })
113
111
  .then(async (externalTaskWorker) => {
114
112
  node.status({ fill: 'blue', shape: 'ring', text: 'subcribed' });
115
113
 
@@ -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-feature-db7b89-m14muv3d",
3
+ "version": "1.1.4-feature-b3c80b-m14rvpwu",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -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>
@@ -7,8 +7,7 @@
7
7
  engine: { value: '', type: 'processcube-engine-config' },
8
8
  query: { value: 'payload' },
9
9
  query_type: { value: 'msg' },
10
- force_send_array: { value: false },
11
- multisend: { value: false },
10
+ sendtype: { value: 'array', required: true },
12
11
  },
13
12
  inputs: 1,
14
13
  outputs: 1,
@@ -45,33 +44,13 @@
45
44
  <label for="node-input-query"><i class="fa fa-tag"></i> Query</label>
46
45
  <input type="text" id="node-input-query" />
47
46
  </div>
48
- <div class="form-row" style="display:flex; margin-bottom: 3px;">
49
- <label for="node-input-force_send_array" style="vertical-align:top"
50
- ><i class="fa fa-list-alt"></i> Force send payload as array</label
51
- >
52
- <div>
53
- <input
54
- type="checkbox"
55
- checked
56
- id="node-input-force_send_array"
57
- style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;"
58
- />
59
- <label style="width:auto" for="node-input-force_send_array"
60
- >Alway send an array? Only works if <i>Send multi</i> is false.</label
61
- >
62
- </div>
63
- </div>
64
- <div class="form-row" style="display:flex; margin-bottom: 3px;">
65
- <label for="node-input-multisend" style="vertical-align:top"><i class="fa fa-list-alt"></i> Send multi</label>
66
- <div>
67
- <input
68
- type="checkbox"
69
- checked
70
- id="node-input-multisend"
71
- style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;"
72
- />
73
- <label style="width:auto" for="node-input-multisend">Send one output of each usertask input?</label>
74
- </div>
47
+ <div class="form-row">
48
+ <label for="node-input-sendtype"><i class="fa fa-sliders"></i> Result</label>
49
+ <select id="node-input-sendtype" style="width: 70%;">
50
+ <option value="array">Send as Array</option>
51
+ <option value="multi">Send Separately</option>
52
+ <option value="first">Send First Task</option>
53
+ </select>
75
54
  </div>
76
55
  </script>
77
56
 
@@ -88,6 +67,6 @@ A node which sends a payload to a usertask in the ProcessCube.
88
67
 
89
68
  ### References
90
69
 
91
- - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
92
- - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube&copy;
70
+ - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
71
+ - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube&copy;
93
72
  </script>
package/usertask-input.js CHANGED
@@ -4,7 +4,6 @@ module.exports = function (RED) {
4
4
  var node = this;
5
5
 
6
6
  node.on('input', function (msg) {
7
-
8
7
  const engine = RED.nodes.getNode(config.engine);
9
8
 
10
9
  const client = engine.engineClient;
@@ -17,46 +16,26 @@ module.exports = function (RED) {
17
16
  let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
18
17
 
19
18
  query = {
20
- ...query
19
+ ...query,
21
20
  };
22
21
 
23
- client.userTasks.query(query, { identity: engine.identity} )
22
+ client.userTasks
23
+ .query(query, { identity: engine.identity })
24
24
  .then((matchingFlowNodes) => {
25
- if (
26
- !config.force_send_array &&
27
- matchingFlowNodes &&
28
- matchingFlowNodes.userTasks &&
29
- matchingFlowNodes.userTasks.length == 1
30
- ) {
31
- userTask = matchingFlowNodes.userTasks[0];
32
-
33
- msg.payload = { userTask: userTask };
25
+ if (config.sendtype === 'array') {
26
+ msg.payload = { userTasks: matchingFlowNodes.userTasks || [] };
34
27
  node.send(msg);
35
- } else {
36
- if (!config.force_send_array) {
37
- if (config.multisend && matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length > 1) {
38
- matchingFlowNodes.userTasks.forEach((userTask) => {
39
- msg.payload = { userTask: userTask };
40
- node.send(msg);
41
- });
42
- } else {
43
- if (matchingFlowNodes.userTasks == 1) {
44
- msg.payload = {
45
- userTasks: matchingFlowNodes.userTasks,
46
- };
47
- node.send(msg);
48
- } else {
49
- node.log(`No user tasks found for query: ${JSON.stringify(query)}`);
50
- }
51
- }
52
- } else {
53
- msg.payload = {
54
- userTasks: matchingFlowNodes.userTasks || [],
55
- };
28
+ } else if (config.sendtype === 'multi' && matchingFlowNodes?.userTasks?.length > 1) {
29
+ matchingFlowNodes.userTasks.forEach((userTask) => {
30
+ msg.payload = { userTask };
56
31
  node.send(msg);
57
- }
58
- }
59
- }).catch((error) => {
32
+ });
33
+ } else if (matchingFlowNodes?.userTasks?.length >= 1) {
34
+ msg.payload = { userTask: matchingFlowNodes.userTasks[0] };
35
+ node.send(msg);
36
+ } else node.log(`No user tasks found for query: ${JSON.stringify(query)}`);
37
+ })
38
+ .catch((error) => {
60
39
  node.error(error);
61
40
  });
62
41
  });