@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
@@ -1,30 +1,26 @@
1
- const EventEmitter = require("node:events");
2
-
3
1
  module.exports = function (RED) {
4
2
  function UserTaskNewListener(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();
7
+ const register = async () => {
8
+ const client = node.engine.engineClient;
12
9
 
13
- var eventEmitter = flowContext.get("emitter");
10
+ if (!client) {
11
+ node.error('No engine configured.');
12
+ return;
13
+ }
14
+
15
+ let currentIdentity = node.engine.identity;
14
16
 
15
- if (!eventEmitter) {
16
- flowContext.set("emitter", new EventEmitter());
17
- eventEmitter = flowContext.get("emitter");
18
- }
19
-
20
- const register = async () => {
21
- let currentIdentity = node.server.identity;
22
17
  let subscription = await client.userTasks.onUserTaskWaiting(
23
18
  (userTaskWaitingNotification) => {
24
19
  node.send({
25
20
  payload: {
26
21
  flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
27
- action: 'new',
22
+ userTaskEvent: userTaskWaitingNotification,
23
+ action: 'new',
28
24
  type: 'usertask',
29
25
  },
30
26
  });
@@ -32,7 +28,7 @@ module.exports = function (RED) {
32
28
  { identity: currentIdentity },
33
29
  );
34
30
 
35
- node.server.registerOnIdentityChanged(async (identity) => {
31
+ node.engine.registerOnIdentityChanged(async (identity) => {
36
32
  client.userTasks.removeSubscription(subscription, currentIdentity);
37
33
  currentIdentity = identity;
38
34
 
@@ -41,6 +37,7 @@ module.exports = function (RED) {
41
37
  node.send({
42
38
  payload: {
43
39
  flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
40
+ userTaskEvent: userTaskWaitingNotification,
44
41
  action: 'new',
45
42
  type: 'usertask',
46
43
  },
@@ -50,14 +47,14 @@ module.exports = function (RED) {
50
47
  );
51
48
  });
52
49
 
53
- node.on('close', async () => {
54
- client.userTasks.removeSubscription(subscription, currentIdentity);
55
- client.dispose();
56
- client = null;
50
+ node.on('close', () => {
51
+ if (node.engine && node.engine.engineClient && client) {
52
+ client.userTasks.removeSubscription(subscription, currentIdentity);
53
+ }
57
54
  });
58
55
  };
59
56
 
60
- if (node.server) {
57
+ if (node.engine) {
61
58
  register();
62
59
  }
63
60
  }
@@ -45,6 +45,17 @@
45
45
  </div>
46
46
  </script>
47
47
 
48
- <script type="text/html" data-help-name="usertask-output">
49
- <p>A node which send the result to an User Task of https://processcube.io</p>
48
+ <script type="text/markdown" data-help-name="usertask-output">
49
+ A node which sends the result of a usertask to the ProcessCube.
50
+
51
+ ## Inputs
52
+
53
+ : payload (Object | JSON) : Will be used as the result for the usertask or can be directly set as JSON.
54
+ : payload.usertask.flowNodeInstanceId (String) : The flowNodeInstanceId of the usertask that will be finished.
55
+
56
+ ### References
57
+
58
+ - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
59
+ - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube&copy;
60
+
50
61
  </script>
@@ -1,22 +1,7 @@
1
- const EventEmitter = require("node:events");
2
-
3
1
  module.exports = function (RED) {
4
2
  function UserTaskOutput(config) {
5
3
  RED.nodes.createNode(this, config);
6
-
7
4
  var node = this;
8
- var flowContext = node.context().flow;
9
-
10
- this.engine = this.server = RED.nodes.getNode(config.engine);
11
-
12
- const client = this.engine.getEngineClient();
13
-
14
- var eventEmitter = flowContext.get("emitter");
15
-
16
- if (!eventEmitter) {
17
- flowContext.set("emitter", new EventEmitter());
18
- eventEmitter = flowContext.get("emitter");
19
- }
20
5
 
21
6
  node.on('input', function (msg) {
22
7
  if (msg.payload.userTask) {
@@ -24,8 +9,17 @@ module.exports = function (RED) {
24
9
 
25
10
  const userTaskResult = RED.util.evaluateNodeProperty(config.result, config.result_type, node, msg);
26
11
 
12
+ const engine = RED.nodes.getNode(config.engine);
13
+
14
+ const client = engine.engineClient;
15
+
16
+ if (!client) {
17
+ node.error('No engine configured.');
18
+ return;
19
+ }
20
+
27
21
  client.userTasks
28
- .finishUserTask(flowNodeInstanceId, userTaskResult, node.server.identity)
22
+ .finishUserTask(flowNodeInstanceId, userTaskResult, engine.identity)
29
23
  .then(() => {
30
24
  node.send(msg);
31
25
  })
@@ -33,9 +27,7 @@ module.exports = function (RED) {
33
27
  node.error(error);
34
28
  });
35
29
  } else {
36
- node.error(
37
- `No UserTask found in message: ${JSON.stringify(msg.payload)}`
38
- );
30
+ node.error(`No UserTask found in message: ${JSON.stringify(msg.payload)}`);
39
31
  }
40
32
  });
41
33
  }
@@ -1,58 +0,0 @@
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="GetProcessModels_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="GetProcessModels" processRef="GetProcessModels_Process" />
5
- </bpmn:collaboration>
6
- <bpmn:process id="GetProcessModels_Process" name="GetProcessModels" isExecutable="true">
7
- <bpmn:laneSet>
8
- <bpmn:lane id="Lane_1xzf0d3" name="Lane">
9
- <bpmn:flowNodeRef>StartEvent_1</bpmn:flowNodeRef>
10
- <bpmn:flowNodeRef>Event_1g0ul5l</bpmn:flowNodeRef>
11
- <bpmn:flowNodeRef>Activity_1p86o1j</bpmn:flowNodeRef>
12
- </bpmn:lane>
13
- </bpmn:laneSet>
14
- <bpmn:startEvent id="StartEvent_1" name="Start">
15
- <bpmn:outgoing>Flow_19aohpj</bpmn:outgoing>
16
- </bpmn:startEvent>
17
- <bpmn:sequenceFlow id="Flow_19aohpj" sourceRef="StartEvent_1" targetRef="Activity_1p86o1j" />
18
- <bpmn:sequenceFlow id="Flow_1in3mpt" sourceRef="Activity_1p86o1j" targetRef="Event_1g0ul5l" />
19
- <bpmn:endEvent id="Event_1g0ul5l">
20
- <bpmn:incoming>Flow_1in3mpt</bpmn:incoming>
21
- </bpmn:endEvent>
22
- <bpmn:serviceTask id="Activity_1p86o1j" name="get processmodels" camunda:type="external" camunda:topic="processmodels">
23
- <bpmn:incoming>Flow_19aohpj</bpmn:incoming>
24
- <bpmn:outgoing>Flow_1in3mpt</bpmn:outgoing>
25
- </bpmn:serviceTask>
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="4" width="885" height="346" />
31
- </bpmndi:BPMNShape>
32
- <bpmndi:BPMNShape id="Lane_1xzf0d3_di" bpmnElement="Lane_1xzf0d3" isHorizontal="true">
33
- <dc:Bounds x="35" y="4" width="855" height="346" />
34
- </bpmndi:BPMNShape>
35
- <bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
36
- <dc:Bounds x="92" y="152" width="36" height="36" />
37
- <bpmndi:BPMNLabel>
38
- <dc:Bounds x="98" y="195" width="24" height="14" />
39
- </bpmndi:BPMNLabel>
40
- </bpmndi:BPMNShape>
41
- <bpmndi:BPMNShape id="Event_1g0ul5l_di" bpmnElement="Event_1g0ul5l">
42
- <dc:Bounds x="672" y="152" width="36" height="36" />
43
- </bpmndi:BPMNShape>
44
- <bpmndi:BPMNShape id="Activity_0o89lb3_di" bpmnElement="Activity_1p86o1j">
45
- <dc:Bounds x="360" y="130" width="100" height="80" />
46
- <bpmndi:BPMNLabel />
47
- </bpmndi:BPMNShape>
48
- <bpmndi:BPMNEdge id="Flow_19aohpj_di" bpmnElement="Flow_19aohpj">
49
- <di:waypoint x="128" y="170" />
50
- <di:waypoint x="360" y="170" />
51
- </bpmndi:BPMNEdge>
52
- <bpmndi:BPMNEdge id="Flow_1in3mpt_di" bpmnElement="Flow_1in3mpt">
53
- <di:waypoint x="460" y="170" />
54
- <di:waypoint x="672" y="170" />
55
- </bpmndi:BPMNEdge>
56
- </bpmndi:BPMNPlane>
57
- </bpmndi:BPMNDiagram>
58
- </bpmn:definitions>
@@ -1,124 +0,0 @@
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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="HelloWorld_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="HelloWorld" processRef="HelloWorld_Process" />
5
- </bpmn:collaboration>
6
- <bpmn:process id="HelloWorld_Process" name="HelloWorld" isExecutable="true">
7
- <bpmn:laneSet>
8
- <bpmn:lane id="Lane_1xzf0d3" name="Lane">
9
- <bpmn:extensionElements>
10
- <camunda:properties>
11
- <camunda:property name="datastore" value="localDB" />
12
- </camunda:properties>
13
- </bpmn:extensionElements>
14
- <bpmn:flowNodeRef>StartEvent_1</bpmn:flowNodeRef>
15
- <bpmn:flowNodeRef>StartEvent_2</bpmn:flowNodeRef>
16
- <bpmn:flowNodeRef>Event_098kcno</bpmn:flowNodeRef>
17
- <bpmn:flowNodeRef>Event_1dke00u</bpmn:flowNodeRef>
18
- <bpmn:flowNodeRef>Activity_0qfd2qf</bpmn:flowNodeRef>
19
- </bpmn:lane>
20
- </bpmn:laneSet>
21
- <bpmn:sequenceFlow id="Flow_0gyaiob" sourceRef="StartEvent_1" targetRef="Activity_0qfd2qf" />
22
- <bpmn:sequenceFlow id="Flow_1vz3m6d" sourceRef="Activity_0qfd2qf" targetRef="Event_1dke00u" />
23
- <bpmn:startEvent id="StartEvent_1" name="StartEvent_1">
24
- <bpmn:outgoing>Flow_0gyaiob</bpmn:outgoing>
25
- </bpmn:startEvent>
26
- <bpmn:startEvent id="StartEvent_2" name="StartEvent_2">
27
- <bpmn:outgoing>Flow_02bhdfx</bpmn:outgoing>
28
- </bpmn:startEvent>
29
- <bpmn:sequenceFlow id="Flow_02bhdfx" sourceRef="StartEvent_2" targetRef="Activity_0qfd2qf" />
30
- <bpmn:endEvent id="Event_098kcno">
31
- <bpmn:incoming>Flow_020xdqk</bpmn:incoming>
32
- </bpmn:endEvent>
33
- <bpmn:sequenceFlow id="Flow_020xdqk" sourceRef="Event_1dke00u" targetRef="Event_098kcno" />
34
- <bpmn:intermediateThrowEvent id="Event_1dke00u">
35
- <bpmn:incoming>Flow_1vz3m6d</bpmn:incoming>
36
- <bpmn:outgoing>Flow_020xdqk</bpmn:outgoing>
37
- <bpmn:messageEventDefinition id="MessageEventDefinition_02r4uyb" messageRef="Message_2MNRTsHm" />
38
- </bpmn:intermediateThrowEvent>
39
- <bpmn:userTask id="Activity_0qfd2qf">
40
- <bpmn:extensionElements>
41
- <camunda:formData>
42
- <camunda:formField id="FormField_c61nPzPh" type="string" />
43
- </camunda:formData>
44
- </bpmn:extensionElements>
45
- <bpmn:incoming>Flow_0gyaiob</bpmn:incoming>
46
- <bpmn:incoming>Flow_02bhdfx</bpmn:incoming>
47
- <bpmn:outgoing>Flow_1vz3m6d</bpmn:outgoing>
48
- <bpmn:property id="Property_0eew054" name="__targetRef_placeholder" />
49
- <bpmn:dataInputAssociation id="DataInputAssociation_05huqd1">
50
- <bpmn:sourceRef>DataStoreReference_12d82du</bpmn:sourceRef>
51
- <bpmn:targetRef>Property_0eew054</bpmn:targetRef>
52
- </bpmn:dataInputAssociation>
53
- <bpmn:dataOutputAssociation id="DataOutputAssociation_0q4exvn">
54
- <bpmn:targetRef>DataStoreReference_12d82du</bpmn:targetRef>
55
- </bpmn:dataOutputAssociation>
56
- </bpmn:userTask>
57
- <bpmn:dataStoreReference id="DataStoreReference_12d82du" />
58
- </bpmn:process>
59
- <bpmn:message id="Message_2MNRTsHm" name="HelloWorld" />
60
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
61
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1cidyxu">
62
- <bpmndi:BPMNShape id="Participant_0px403d_di" bpmnElement="Participant_0px403d" isHorizontal="true">
63
- <dc:Bounds x="5" y="4" width="885" height="346" />
64
- </bpmndi:BPMNShape>
65
- <bpmndi:BPMNShape id="Lane_1xzf0d3_di" bpmnElement="Lane_1xzf0d3" isHorizontal="true">
66
- <dc:Bounds x="35" y="4" width="855" height="346" />
67
- </bpmndi:BPMNShape>
68
- <bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
69
- <dc:Bounds x="92" y="82" width="36" height="36" />
70
- <bpmndi:BPMNLabel>
71
- <dc:Bounds x="78" y="125" width="64" height="14" />
72
- </bpmndi:BPMNLabel>
73
- </bpmndi:BPMNShape>
74
- <bpmndi:BPMNShape id="Event_0okqf1m_di" bpmnElement="StartEvent_2">
75
- <dc:Bounds x="92" y="222" width="36" height="36" />
76
- <bpmndi:BPMNLabel>
77
- <dc:Bounds x="79" y="265" width="64" height="14" />
78
- </bpmndi:BPMNLabel>
79
- </bpmndi:BPMNShape>
80
- <bpmndi:BPMNShape id="Event_098kcno_di" bpmnElement="Event_098kcno">
81
- <dc:Bounds x="472" y="152" width="36" height="36" />
82
- </bpmndi:BPMNShape>
83
- <bpmndi:BPMNShape id="Event_00n3l3p_di" bpmnElement="Event_1dke00u">
84
- <dc:Bounds x="352" y="152" width="36" height="36" />
85
- </bpmndi:BPMNShape>
86
- <bpmndi:BPMNShape id="Activity_0jhqvza_di" bpmnElement="Activity_0qfd2qf">
87
- <dc:Bounds x="180" y="130" width="100" height="80" />
88
- </bpmndi:BPMNShape>
89
- <bpmndi:BPMNShape id="DataStoreReference_12d82du_di" bpmnElement="DataStoreReference_12d82du">
90
- <dc:Bounds x="215" y="265" width="50" height="50" />
91
- </bpmndi:BPMNShape>
92
- <bpmndi:BPMNEdge id="Flow_0gyaiob_di" bpmnElement="Flow_0gyaiob">
93
- <di:waypoint x="128" y="100" />
94
- <di:waypoint x="154" y="100" />
95
- <di:waypoint x="154" y="170" />
96
- <di:waypoint x="180" y="170" />
97
- </bpmndi:BPMNEdge>
98
- <bpmndi:BPMNEdge id="Flow_1vz3m6d_di" bpmnElement="Flow_1vz3m6d">
99
- <di:waypoint x="280" y="170" />
100
- <di:waypoint x="352" y="170" />
101
- </bpmndi:BPMNEdge>
102
- <bpmndi:BPMNEdge id="Flow_02bhdfx_di" bpmnElement="Flow_02bhdfx">
103
- <di:waypoint x="128" y="240" />
104
- <di:waypoint x="154" y="240" />
105
- <di:waypoint x="154" y="170" />
106
- <di:waypoint x="180" y="170" />
107
- </bpmndi:BPMNEdge>
108
- <bpmndi:BPMNEdge id="Flow_020xdqk_di" bpmnElement="Flow_020xdqk">
109
- <di:waypoint x="388" y="170" />
110
- <di:waypoint x="472" y="170" />
111
- </bpmndi:BPMNEdge>
112
- <bpmndi:BPMNEdge id="DataInputAssociation_05huqd1_di" bpmnElement="DataInputAssociation_05huqd1">
113
- <di:waypoint x="225" y="265" />
114
- <di:waypoint x="210" y="240" />
115
- <di:waypoint x="219" y="210" />
116
- </bpmndi:BPMNEdge>
117
- <bpmndi:BPMNEdge id="DataOutputAssociation_0q4exvn_di" bpmnElement="DataOutputAssociation_0q4exvn">
118
- <di:waypoint x="250" y="210" />
119
- <di:waypoint x="260" y="230" />
120
- <di:waypoint x="250" y="265" />
121
- </bpmndi:BPMNEdge>
122
- </bpmndi:BPMNPlane>
123
- </bpmndi:BPMNDiagram>
124
- </bpmn:definitions>