@5minds/node-red-contrib-processcube 0.15.0-fix-error-in-process-instance-query-8fa811-lz054xqa → 1.0.0-develop-243715-lz1qpiwj

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/Dockerfile +2 -0
  2. package/endevent-finished-listener.html +50 -0
  3. package/endevent-finished-listener.js +52 -0
  4. package/examples/Definition-Query-Sample.json +215 -0
  5. package/examples/External-Task-Sample.json +142 -1
  6. package/examples/Instance-Query-Sample.json +110 -0
  7. package/examples/User-Task-Sample.json +231 -0
  8. package/externaltask-error.html +8 -8
  9. package/externaltask-error.js +2 -2
  10. package/externaltask-input.html +7 -7
  11. package/externaltask-input.js +112 -98
  12. package/externaltask-output.html +3 -3
  13. package/externaltask-output.js +4 -5
  14. package/message-event-trigger.html +14 -2
  15. package/message-event-trigger.js +10 -5
  16. package/nodered/node-red-contrib-processcube-flows.json +364 -20
  17. package/nodered/settings.js +2 -1
  18. package/nodered/static/ProcessCube_Logo.svg +53 -0
  19. package/package.json +3 -5
  20. package/process-start.html +16 -13
  21. package/process-start.js +18 -6
  22. package/processcube-engine-config.html +16 -0
  23. package/processcube-engine-config.js +11 -14
  24. package/processdefinition-query.html +16 -2
  25. package/processdefinition-query.js +10 -19
  26. package/processes/User-Task-Sample.bpmn +57 -0
  27. package/processinstance-query.html +13 -2
  28. package/processinstance-query.js +9 -21
  29. package/signal-event-trigger.html +14 -2
  30. package/signal-event-trigger.js +14 -7
  31. package/usertask-finished-listener.html +15 -14
  32. package/usertask-finished-listener.js +26 -37
  33. package/usertask-input.html +15 -2
  34. package/usertask-input.js +20 -25
  35. package/usertask-new-listener.html +15 -14
  36. package/usertask-new-listener.js +18 -21
  37. package/usertask-output.html +13 -2
  38. package/usertask-output.js +11 -19
  39. package/processes/GetProcessModels.bpmn +0 -58
  40. package/processes/HelloWorld.bpmn +0 -124
@@ -28,3 +28,19 @@
28
28
  <input type="password" id="node-config-input-clientSecret" />
29
29
  </div>
30
30
  </script>
31
+
32
+ <script type="text/markdown" data-help-name="processcube-engine-config">
33
+ The configuration for the ProcessCube engine.
34
+
35
+ ## Inputs
36
+
37
+ : url (String) : The URL of the ProcessCube engine.
38
+ : clientId (String) : The client id for the ProcessCube engine.
39
+ : clientSecret (String) : The client secret for the ProcessCube engine.
40
+
41
+ ### References
42
+
43
+ - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
44
+ - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube&copy;
45
+
46
+ </script>
@@ -11,9 +11,11 @@ module.exports = function (RED) {
11
11
  const identityChangedCallbacks = [];
12
12
  this.url = n.url;
13
13
  this.identity = null;
14
+
14
15
  this.registerOnIdentityChanged = function (callback) {
15
16
  identityChangedCallbacks.push(callback);
16
17
  };
18
+
17
19
  this.setIdentity = (identity) => {
18
20
  this.identity = identity;
19
21
 
@@ -22,22 +24,15 @@ module.exports = function (RED) {
22
24
  }
23
25
  };
24
26
 
25
- var nodeContext = node.context();
26
-
27
- this.getEngineClient = () => {
28
- const engineUrl = this.url || process.env.ENGINE_URL || 'http://engine:8000';
29
- let client = nodeContext.get('client');
30
-
31
- if (!client) {
32
- nodeContext.set('client', new engine_client.EngineClient(engineUrl));
33
- client = nodeContext.get('client');
34
- }
35
-
36
- return client;
37
- };
27
+ node.on('close', async () => {
28
+ if (this.engineClient) {
29
+ this.engineClient.dispose();
30
+ this.engineClient = null;
31
+ }
32
+ });
38
33
 
39
34
  if (this.credentials.clientId && this.credentials.clientSecret) {
40
- const engineClient = new engine_client.EngineClient(this.url);
35
+ this.engineClient = new engine_client.EngineClient(this.url);
41
36
 
42
37
  engineClient.applicationInfo
43
38
  .getAuthorityAddress()
@@ -56,6 +51,8 @@ module.exports = function (RED) {
56
51
  console.error(reason);
57
52
  node.error(reason);
58
53
  });
54
+ } else {
55
+ this.engineClient = new engine_client.EngineClient(this.url);
59
56
  }
60
57
  }
61
58
  RED.nodes.registerType('processcube-engine-config', ProcessCubeEngineNode, {
@@ -60,6 +60,20 @@
60
60
  </div>
61
61
  </script>
62
62
 
63
- <script type="text/html" data-help-name="processdefinition-query">
64
- <p>A node which queries to Process Definitions of https://processcube.io</p>
63
+ <script type="text/markdown" data-help-name="processdefinition-query">
64
+ Query process definitions or process models from the ProcessCube engine.
65
+
66
+ The `query` can be given a direkt query field from the configutation or a message property.
67
+
68
+ Only models can be queried by setting the `models_only` flag.
69
+
70
+ ## Inputs
71
+
72
+ : payload (Object | JSON) : Will be used as the input for the query or can be directly set as JSON.
73
+
74
+ ### References
75
+
76
+ - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
77
+ - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube&copy;
78
+
65
79
  </script>
@@ -1,35 +1,27 @@
1
- const EventEmitter = require("node:events");
2
-
3
1
  module.exports = function (RED) {
4
2
  function ProcessdefinitionQuery(config) {
5
3
  RED.nodes.createNode(this, config);
6
4
  var node = this;
7
- var flowContext = node.context().flow;
8
-
9
- this.engine = this.server = RED.nodes.getNode(config.engine);
10
5
 
11
- const client = this.engine.getEngineClient();
12
-
13
- var eventEmitter = flowContext.get("emitter");
6
+ node.on('input', function (msg) {
14
7
 
15
- if (!eventEmitter) {
16
- flowContext.set("emitter", new EventEmitter());
17
- eventEmitter = flowContext.get("emitter");
18
- }
8
+ const engine = RED.nodes.getNode(config.engine);
9
+ const client = engine.engineClient;
19
10
 
20
- node.on('close', async () => {
21
- client.dispose();
22
- client = null;
23
- });
11
+ if (!client) {
12
+ node.error('No engine configured.');
13
+ return;
14
+ }
24
15
 
25
- node.on('input', function (msg) {
26
16
  let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
17
+
27
18
  query = {
28
19
  ...query,
29
- identity: node.server.identity,
20
+ identity: engine.identity,
30
21
  };
31
22
 
32
23
  client.processDefinitions.getAll(query).then((matchingProcessDefinitions) => {
24
+
33
25
  if (config.models_only && matchingProcessDefinitions.totalCount > 0) {
34
26
  let models = [];
35
27
 
@@ -51,6 +43,5 @@ module.exports = function (RED) {
51
43
  });
52
44
  });
53
45
  }
54
-
55
46
  RED.nodes.registerType('processdefinition-query', ProcessdefinitionQuery);
56
47
  };
@@ -0,0 +1,57 @@
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="User-Task-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="User-Task-Sample" processRef="User-Task-Sample_Process" />
5
+ </bpmn:collaboration>
6
+ <bpmn:process id="User-Task-Sample_Process" name="User-Task-Sample" isExecutable="true">
7
+ <bpmn:laneSet />
8
+ <bpmn:startEvent id="StartEvent_1" name="Start">
9
+ <bpmn:outgoing>Flow_142awo6</bpmn:outgoing>
10
+ </bpmn:startEvent>
11
+ <bpmn:sequenceFlow id="Flow_142awo6" sourceRef="StartEvent_1" targetRef="user_task" />
12
+ <bpmn:endEvent id="Event_07hak5r" name="End">
13
+ <bpmn:incoming>Flow_0i7xqvi</bpmn:incoming>
14
+ </bpmn:endEvent>
15
+ <bpmn:sequenceFlow id="Flow_0i7xqvi" sourceRef="user_task" targetRef="Event_07hak5r" />
16
+ <bpmn:userTask id="user_task" name="User Task">
17
+ <bpmn:extensionElements>
18
+ <camunda:formData>
19
+ <camunda:formField id="field_01" label="Field 01" type="string" />
20
+ <camunda:formField id="field_02" label="Field 02" type="string" />
21
+ </camunda:formData>
22
+ </bpmn:extensionElements>
23
+ <bpmn:incoming>Flow_142awo6</bpmn:incoming>
24
+ <bpmn:outgoing>Flow_0i7xqvi</bpmn:outgoing>
25
+ </bpmn:userTask>
26
+ </bpmn:process>
27
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
28
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1cidyxu">
29
+ <bpmndi:BPMNShape id="Participant_0px403d_di" bpmnElement="Participant_0px403d" isHorizontal="true">
30
+ <dc:Bounds x="5" y="30" width="415" height="260" />
31
+ </bpmndi:BPMNShape>
32
+ <bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
33
+ <dc:Bounds x="92" y="152" width="36" height="36" />
34
+ <bpmndi:BPMNLabel>
35
+ <dc:Bounds x="98" y="195" width="24" height="14" />
36
+ </bpmndi:BPMNLabel>
37
+ </bpmndi:BPMNShape>
38
+ <bpmndi:BPMNShape id="Event_07hak5r_di" bpmnElement="Event_07hak5r">
39
+ <dc:Bounds x="332" y="152" width="36" height="36" />
40
+ <bpmndi:BPMNLabel>
41
+ <dc:Bounds x="340" y="195" width="20" height="14" />
42
+ </bpmndi:BPMNLabel>
43
+ </bpmndi:BPMNShape>
44
+ <bpmndi:BPMNShape id="Activity_0c7im8g_di" bpmnElement="user_task">
45
+ <dc:Bounds x="180" y="130" width="100" height="80" />
46
+ </bpmndi:BPMNShape>
47
+ <bpmndi:BPMNEdge id="Flow_142awo6_di" bpmnElement="Flow_142awo6">
48
+ <di:waypoint x="128" y="170" />
49
+ <di:waypoint x="180" y="170" />
50
+ </bpmndi:BPMNEdge>
51
+ <bpmndi:BPMNEdge id="Flow_0i7xqvi_di" bpmnElement="Flow_0i7xqvi">
52
+ <di:waypoint x="280" y="170" />
53
+ <di:waypoint x="332" y="170" />
54
+ </bpmndi:BPMNEdge>
55
+ </bpmndi:BPMNPlane>
56
+ </bpmndi:BPMNDiagram>
57
+ </bpmn:definitions>
@@ -45,6 +45,17 @@
45
45
  </div>
46
46
  </script>
47
47
 
48
- <script type="text/html" data-help-name="processinstance-query">
49
- <p>A node which queries to Process Instances of https://processcube.io</p>
48
+ <script type="text/markdown" data-help-name="processinstance-query">
49
+ Query a process instance in the ProcessCube.
50
+
51
+ ## Inputs
52
+
53
+ : payload (Object | JSON) : Will be used as the input for the query or can be directly set as JSON.
54
+
55
+ ### References
56
+
57
+ - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
58
+ - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube&copy;
59
+
60
+
50
61
  </script>
@@ -1,32 +1,21 @@
1
- const EventEmitter = require("node:events");
2
-
3
1
  module.exports = function (RED) {
4
2
  function ProcessinstanceQuery(config) {
5
3
  RED.nodes.createNode(this, config);
6
4
  var node = this;
7
- var flowContext = node.context().flow;
8
-
9
- this.engine = this.server = RED.nodes.getNode(config.engine);
10
-
11
- const client = this.engine.getEngineClient();
12
-
13
- var eventEmitter = flowContext.get("emitter");
14
-
15
- if (!eventEmitter) {
16
- flowContext.set("emitter", new EventEmitter());
17
- eventEmitter = flowContext.get("emitter");
18
- }
19
-
20
- node.on('close', async () => {
21
- client.dispose();
22
- client = null;
23
- });
24
5
 
25
6
  node.on('input', function (msg) {
26
7
  let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
27
8
 
9
+ const engine = RED.nodes.getNode(config.engine);
10
+ const client = engine.engineClient;
11
+
12
+ if (!client) {
13
+ node.error('No engine configured.');
14
+ return;
15
+ }
16
+
28
17
  client.processInstances
29
- .query(query, { identity: node.server.identity })
18
+ .query(query, { identity: engine.identity })
30
19
  .then((matchingInstances) => {
31
20
  msg.payload = matchingInstances;
32
21
 
@@ -37,6 +26,5 @@ module.exports = function (RED) {
37
26
  });
38
27
  });
39
28
  }
40
-
41
29
  RED.nodes.registerType('processinstance-query', ProcessinstanceQuery);
42
30
  };
@@ -36,6 +36,18 @@
36
36
  </div>
37
37
  </script>
38
38
 
39
- <script type="text/html" data-help-name="signal-event-trigger">
40
- <p>A node which emmits a signal event to the Engine.</p>
39
+ <script type="text/markdown" data-help-name="signal-event-trigger">
40
+ A node which emmits a signal event to the Engine.
41
+
42
+ From the config the `signalname` and the `processInstanceId` must be set.
43
+
44
+ ## Inputs
45
+
46
+ : payload (Object) : Will sent to the event and used an new token payload.
47
+
48
+ ### References
49
+
50
+ - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
51
+ - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube&copy;
52
+
41
53
  </script>
@@ -1,31 +1,38 @@
1
-
2
1
  module.exports = function (RED) {
3
2
  function SignalEventTrigger(config) {
4
3
  RED.nodes.createNode(this, config);
5
4
  var node = this;
6
5
 
7
- this.engine = this.server = RED.nodes.getNode(config.engine);
6
+ node.on('input', function (msg) {
7
+ const engine = RED.nodes.getNode(config.engine);
8
8
 
9
- const client = this.engine.getEngineClient();
9
+ const client = engine.engineClient;
10
10
 
11
- node.on('input', function (msg) {
11
+ if (!client) {
12
+ node.error('No engine configured.');
13
+ return;
14
+ }
15
+
12
16
  client.events
13
17
  .triggerSignalEvent(config.signalname, {
14
18
  processInstanceId: config.processinstanceid,
15
19
  payload: msg.payload,
16
- identity: node.server.identity,
20
+ identity: engine.identity,
17
21
  })
18
22
  .then((result) => {
19
23
  msg.payload = result;
20
24
 
21
25
  node.send(msg);
22
- node.status({ fill: 'blue', shape: 'dot', text: `signal event triggered` });
26
+ node.status({
27
+ fill: 'blue',
28
+ shape: 'dot',
29
+ text: `signal event triggered`,
30
+ });
23
31
  })
24
32
  .catch((error) => {
25
33
  node.error(error);
26
34
  });
27
35
  });
28
36
  }
29
-
30
37
  RED.nodes.registerType('signal-event-trigger', SignalEventTrigger);
31
38
  };
@@ -25,20 +25,21 @@
25
25
  <label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
26
26
  <input type="text" id="node-input-engine" placeholder="http://engine:8000" />
27
27
  </div>
28
- <div class="form-row" style="display:flex; margin-bottom: 3px;">
29
- <label for="node-input-multisend" style="vertical-align:top"><i class="fa fa-list-alt"></i> Send multi</label>
30
- <div>
31
- <input
32
- type="checkbox"
33
- checked
34
- id="node-input-multisend"
35
- style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;"
36
- />
37
- <label style="width:auto" for="node-input-multisend">Send one output of each usertask input?</label>
38
- </div>
39
- </div>
40
28
  </script>
41
29
 
42
- <script type="text/html" data-help-name="usertask-finished-listener">
43
- <p>A node which subscribes to an User Task of https://processcube.io</p>
30
+ <script type="text/markdown" data-help-name="usertask-finished-listener">
31
+ A node which listens for finished usertasks in the ProcessCube.
32
+
33
+ ## Outputs
34
+
35
+ : flowNodeInstanceId (string): The flow node instance id of the finished usertask.
36
+ : userTaskEvent (object): The user task event object.
37
+ : action (string): The action of the event.
38
+ : type (string): The type of the event.
39
+
40
+ ### References
41
+
42
+ - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
43
+ - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube&copy;
44
+
44
45
  </script>
@@ -1,71 +1,60 @@
1
- const EventEmitter = require("node:events");
2
-
3
1
  module.exports = function (RED) {
4
2
  function UserTaskFinishedListener(config) {
5
3
  RED.nodes.createNode(this, config);
6
4
  var node = this;
7
- var flowContext = node.context().flow;
8
-
9
- this.engine = this.server = RED.nodes.getNode(config.engine);
5
+ node.engine = RED.nodes.getNode(config.engine);
10
6
 
11
- const client = this.engine.getEngineClient();
12
-
13
- var eventEmitter = flowContext.get("emitter");
7
+ const register = async () => {
8
+ let currentIdentity = node.engine.identity;
14
9
 
15
- if (!eventEmitter) {
16
- flowContext.set("emitter", new EventEmitter());
17
- eventEmitter = flowContext.get("emitter");
18
- }
10
+ const client = node.engine.engineClient;
11
+
12
+ if (!client) {
13
+ node.error('No engine configured.');
14
+ return;
15
+ }
19
16
 
20
- const register = async () => {
21
- let currentIdentity = node.server.identity;
22
17
  let subscription = await client.userTasks.onUserTaskFinished(
23
18
  (userTaskFinishedNotification) => {
24
19
  node.send({
25
20
  payload: {
26
- flowNodeInstanceId:
27
- userTaskFinishedNotification.flowNodeInstanceId,
28
- action: "finished",
29
- type: "usertask",
21
+ flowNodeInstanceId: userTaskFinishedNotification.flowNodeInstanceId,
22
+ userTaskEvent: userTaskFinishedNotification,
23
+ action: 'finished',
24
+ type: 'usertask',
30
25
  },
31
26
  });
32
27
  },
33
- { identity: currentIdentity }
28
+ { identity: currentIdentity },
34
29
  );
35
30
 
36
- node.server.registerOnIdentityChanged(async (identity) => {
37
- client.userTasks.removeSubscription(
38
- subscription,
39
- currentIdentity
40
- );
31
+ node.engine.registerOnIdentityChanged(async (identity) => {
32
+ client.userTasks.removeSubscription(subscription, currentIdentity);
41
33
  currentIdentity = identity;
42
34
 
43
35
  subscription = await client.userTasks.onUserTaskFinished(
44
36
  (userTaskFinishedNotification) => {
45
37
  node.send({
46
38
  payload: {
47
- flowNodeInstanceId:
48
- userTaskFinishedNotification.flowNodeInstanceId,
49
- action: "finished",
50
- type: "usertask",
39
+ flowNodeInstanceId: userTaskFinishedNotification.flowNodeInstanceId,
40
+ userTaskEvent: userTaskFinishedNotification,
41
+ action: 'finished',
42
+ type: 'usertask',
51
43
  },
52
44
  });
53
45
  },
54
- { identity: currentIdentity }
46
+ { identity: currentIdentity },
55
47
  );
56
48
  });
57
49
 
58
- node.on("close", async () => {
59
- client.userTasks.removeSubscription(
60
- subscription,
61
- currentIdentity
62
- );
63
- client.dispose();
64
- client = null;
50
+ node.on('close', async () => {
51
+ if (node.engine && node.engine.engineClient && client) {
52
+ client.userTasks.removeSubscription(subscription, currentIdentity);
53
+ }
65
54
  });
66
55
  };
67
56
 
68
- if (node.server) {
57
+ if (node.engine) {
69
58
  register();
70
59
  }
71
60
  }
@@ -75,6 +75,19 @@
75
75
  </div>
76
76
  </script>
77
77
 
78
- <script type="text/html" data-help-name="usertask-input">
79
- <p>A node which subscribes to an User Task of https://processcube.io</p>
78
+ <script type="text/markdown" data-help-name="usertask-input">
79
+ A node which sends a payload to a usertask in the ProcessCube.
80
+
81
+ ## Inputs
82
+
83
+ : payload (Object) : Will be used as the input for the usertask.
84
+ : query (String) : Will be used as the query for the usertask.
85
+ : query_type (String) : Will be used as the type of the query for the usertask.
86
+ : force_send_array (Boolean) : Will be used to force the payload to be sent as an array.
87
+ : multisend (Boolean) : Will be used to send one output of each usertask input.
88
+
89
+ ### References
90
+
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;
80
93
  </script>
package/usertask-input.js CHANGED
@@ -1,33 +1,24 @@
1
- const EventEmitter = require("node:events");
2
-
3
1
  module.exports = function (RED) {
4
2
  function UserTaskInput(config) {
5
3
  RED.nodes.createNode(this, config);
6
4
  var node = this;
7
- var flowContext = node.context().flow;
8
5
 
9
- this.engine = this.server = RED.nodes.getNode(config.engine);
6
+ node.on('input', function (msg) {
10
7
 
11
- const client = this.engine.getEngineClient();
8
+ const engine = RED.nodes.getNode(config.engine);
12
9
 
13
- var eventEmitter = flowContext.get("emitter");
10
+ const client = engine.engineClient;
14
11
 
15
- if (!eventEmitter) {
16
- flowContext.set("emitter", new EventEmitter());
17
- eventEmitter = flowContext.get("emitter");
18
- }
12
+ if (!client) {
13
+ node.error('No engine configured.');
14
+ return;
15
+ }
19
16
 
20
- node.on('close', async () => {
21
- client.dispose();
22
- client = null;
23
- });
24
-
25
- node.on('input', function (msg) {
26
17
  let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
27
18
 
28
19
  query = {
29
20
  ...query,
30
- identity: node.server.identity,
21
+ identity: engine.identity,
31
22
  };
32
23
 
33
24
  client.userTasks.query(query).then((matchingFlowNodes) => {
@@ -43,21 +34,25 @@ module.exports = function (RED) {
43
34
  node.send(msg);
44
35
  } else {
45
36
  if (!config.force_send_array) {
46
- if (
47
- config.multisend &&
48
- matchingFlowNodes.userTasks &&
49
- matchingFlowNodes.userTasks.length > 1
50
- ) {
37
+ if (config.multisend && matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length > 1) {
51
38
  matchingFlowNodes.userTasks.forEach((userTask) => {
52
39
  msg.payload = { userTask: userTask };
53
40
  node.send(msg);
54
41
  });
55
42
  } else {
56
- msg.payload = { userTasks: matchingFlowNodes.userTasks };
57
- node.send(msg);
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
+ }
58
51
  }
59
52
  } else {
60
- msg.payload = { userTasks: matchingFlowNodes.userTasks || [] };
53
+ msg.payload = {
54
+ userTasks: matchingFlowNodes.userTasks || [],
55
+ };
61
56
  node.send(msg);
62
57
  }
63
58
  }
@@ -25,20 +25,21 @@
25
25
  <label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
26
26
  <input type="text" id="node-input-engine" placeholder="http://engine:8000" />
27
27
  </div>
28
- <div class="form-row" style="display:flex; margin-bottom: 3px;">
29
- <label for="node-input-multisend" style="vertical-align:top"><i class="fa fa-list-alt"></i> Send multi</label>
30
- <div>
31
- <input
32
- type="checkbox"
33
- checked
34
- id="node-input-multisend"
35
- style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;"
36
- />
37
- <label style="width:auto" for="node-input-multisend">Send one output of each usertask input?</label>
38
- </div>
39
- </div>
40
28
  </script>
41
29
 
42
- <script type="text/html" data-help-name="usertask-new-listener">
43
- <p>A node which subscribes to an User Task of https://processcube.io</p>
30
+ <script type="text/markdown" data-help-name="usertask-new-listener">
31
+ A node which listens for new usertasks in the ProcessCube.
32
+
33
+ ## Outputs
34
+
35
+ : flowNodeInstanceId (string): The flow node instance id of the new usertask.
36
+ : userTaskEvent (string) : The user task event object.
37
+ : action (string) : The action of the event.
38
+ : type (string) : The type of the event.
39
+
40
+ ### References
41
+
42
+ - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
43
+ - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube&copy;
44
+
44
45
  </script>