@5minds/node-red-contrib-processcube 0.15.0 → 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 (38) 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 +11 -11
  9. package/externaltask-input.html +12 -12
  10. package/externaltask-input.js +10 -5
  11. package/externaltask-output.html +7 -7
  12. package/message-event-trigger.html +14 -2
  13. package/message-event-trigger.js +10 -9
  14. package/nodered/node-red-contrib-processcube-flows.json +364 -20
  15. package/nodered/settings.js +2 -1
  16. package/nodered/static/ProcessCube_Logo.svg +53 -0
  17. package/package.json +2 -1
  18. package/process-start.html +16 -13
  19. package/process-start.js +13 -8
  20. package/processcube-engine-config.html +16 -0
  21. package/processcube-engine-config.js +9 -13
  22. package/processdefinition-query.html +16 -2
  23. package/processdefinition-query.js +10 -21
  24. package/processes/User-Task-Sample.bpmn +57 -0
  25. package/processinstance-query.html +13 -2
  26. package/processinstance-query.js +9 -23
  27. package/signal-event-trigger.html +14 -2
  28. package/signal-event-trigger.js +9 -8
  29. package/usertask-finished-listener.html +15 -14
  30. package/usertask-finished-listener.js +16 -22
  31. package/usertask-input.html +15 -2
  32. package/usertask-input.js +18 -41
  33. package/usertask-new-listener.html +15 -14
  34. package/usertask-new-listener.js +18 -24
  35. package/usertask-output.html +13 -2
  36. package/usertask-output.js +10 -19
  37. package/processes/GetProcessModels.bpmn +0 -58
  38. package/processes/HelloWorld.bpmn +0 -124
@@ -0,0 +1,231 @@
1
+ [
2
+ {
3
+ "id": "fd3c725340de4f74",
4
+ "type": "tab",
5
+ "label": "UserTasks",
6
+ "disabled": false,
7
+ "info": "",
8
+ "env": []
9
+ },
10
+ {
11
+ "id": "887f3fb69ad1d1fb",
12
+ "type": "group",
13
+ "z": "fd3c725340de4f74",
14
+ "style": {
15
+ "stroke": "#999999",
16
+ "stroke-opacity": "1",
17
+ "fill": "none",
18
+ "fill-opacity": "1",
19
+ "label": true,
20
+ "label-position": "nw",
21
+ "color": "#a4a4a4"
22
+ },
23
+ "nodes": [
24
+ "f7a9604a17188737",
25
+ "020d34cd4ab43900",
26
+ "1db0ae57c1b8486b",
27
+ "127bc6e092c5724e"
28
+ ],
29
+ "x": 34,
30
+ "y": 19,
31
+ "w": 452,
32
+ "h": 202
33
+ },
34
+ {
35
+ "id": "72d3db13edc2486b",
36
+ "type": "group",
37
+ "z": "fd3c725340de4f74",
38
+ "style": {
39
+ "stroke": "#999999",
40
+ "stroke-opacity": "1",
41
+ "fill": "none",
42
+ "fill-opacity": "1",
43
+ "label": true,
44
+ "label-position": "nw",
45
+ "color": "#a4a4a4"
46
+ },
47
+ "nodes": [
48
+ "ae0583e83c762956",
49
+ "f7c7682e3a6adaaa",
50
+ "a2fb6369b16c12fa",
51
+ "8ef39e83173d41e3",
52
+ "f524b8cc35d56849",
53
+ "9fb4017c1d0ac7c9"
54
+ ],
55
+ "x": 34,
56
+ "y": 259,
57
+ "w": 652,
58
+ "h": 262
59
+ },
60
+ {
61
+ "id": "f7a9604a17188737",
62
+ "type": "usertask-new-listener",
63
+ "z": "fd3c725340de4f74",
64
+ "d": true,
65
+ "g": "887f3fb69ad1d1fb",
66
+ "name": "New User Task",
67
+ "engine": "42e6796dddd9d4db",
68
+ "multisend": false,
69
+ "x": 160,
70
+ "y": 120,
71
+ "wires": [
72
+ [
73
+ "020d34cd4ab43900"
74
+ ]
75
+ ]
76
+ },
77
+ {
78
+ "id": "020d34cd4ab43900",
79
+ "type": "debug",
80
+ "z": "fd3c725340de4f74",
81
+ "g": "887f3fb69ad1d1fb",
82
+ "name": "Show User Task",
83
+ "active": true,
84
+ "tosidebar": true,
85
+ "console": false,
86
+ "tostatus": false,
87
+ "complete": "payload",
88
+ "targetType": "msg",
89
+ "statusVal": "",
90
+ "statusType": "auto",
91
+ "x": 360,
92
+ "y": 120,
93
+ "wires": []
94
+ },
95
+ {
96
+ "id": "1db0ae57c1b8486b",
97
+ "type": "usertask-finished-listener",
98
+ "z": "fd3c725340de4f74",
99
+ "g": "887f3fb69ad1d1fb",
100
+ "name": "Finished User Task",
101
+ "engine": "42e6796dddd9d4db",
102
+ "multisend": false,
103
+ "x": 150,
104
+ "y": 180,
105
+ "wires": [
106
+ [
107
+ "020d34cd4ab43900"
108
+ ]
109
+ ]
110
+ },
111
+ {
112
+ "id": "127bc6e092c5724e",
113
+ "type": "comment",
114
+ "z": "fd3c725340de4f74",
115
+ "g": "887f3fb69ad1d1fb",
116
+ "name": "User Task Events",
117
+ "info": "",
118
+ "x": 140,
119
+ "y": 60,
120
+ "wires": []
121
+ },
122
+ {
123
+ "id": "ae0583e83c762956",
124
+ "type": "usertask-new-listener",
125
+ "z": "fd3c725340de4f74",
126
+ "d": true,
127
+ "g": "72d3db13edc2486b",
128
+ "name": "",
129
+ "engine": "42e6796dddd9d4db",
130
+ "multisend": true,
131
+ "x": 160,
132
+ "y": 360,
133
+ "wires": [
134
+ [
135
+ "a2fb6369b16c12fa"
136
+ ]
137
+ ]
138
+ },
139
+ {
140
+ "id": "f7c7682e3a6adaaa",
141
+ "type": "usertask-input",
142
+ "z": "fd3c725340de4f74",
143
+ "g": "72d3db13edc2486b",
144
+ "name": "",
145
+ "engine": "42e6796dddd9d4db",
146
+ "query": "payload",
147
+ "query_type": "msg",
148
+ "force_send_array": false,
149
+ "multisend": false,
150
+ "x": 380,
151
+ "y": 420,
152
+ "wires": [
153
+ [
154
+ "8ef39e83173d41e3"
155
+ ]
156
+ ]
157
+ },
158
+ {
159
+ "id": "a2fb6369b16c12fa",
160
+ "type": "function",
161
+ "z": "fd3c725340de4f74",
162
+ "g": "72d3db13edc2486b",
163
+ "name": "query",
164
+ "func": "msg.payload = {\n flowNodeInstanceId: msg.payload.flowNodeInstanceId,\n flowNodeId: \"user_task\"\n};\n\nreturn msg;",
165
+ "outputs": 1,
166
+ "timeout": 0,
167
+ "noerr": 0,
168
+ "initialize": "",
169
+ "finalize": "",
170
+ "libs": [],
171
+ "x": 210,
172
+ "y": 420,
173
+ "wires": [
174
+ [
175
+ "f7c7682e3a6adaaa"
176
+ ]
177
+ ]
178
+ },
179
+ {
180
+ "id": "8ef39e83173d41e3",
181
+ "type": "function",
182
+ "z": "fd3c725340de4f74",
183
+ "g": "72d3db13edc2486b",
184
+ "name": "build result",
185
+ "func": "msg.payload.result = {\n \"field_01\": \"value 01\",\n \"field_02\": \"value 02\"\n}\nreturn msg;",
186
+ "outputs": 1,
187
+ "timeout": 0,
188
+ "noerr": 0,
189
+ "initialize": "",
190
+ "finalize": "",
191
+ "libs": [],
192
+ "x": 390,
193
+ "y": 480,
194
+ "wires": [
195
+ [
196
+ "f524b8cc35d56849"
197
+ ]
198
+ ]
199
+ },
200
+ {
201
+ "id": "f524b8cc35d56849",
202
+ "type": "usertask-output",
203
+ "z": "fd3c725340de4f74",
204
+ "g": "72d3db13edc2486b",
205
+ "name": "",
206
+ "engine": "42e6796dddd9d4db",
207
+ "result": "payload.result",
208
+ "result_type": "msg",
209
+ "x": 580,
210
+ "y": 480,
211
+ "wires": [
212
+ []
213
+ ]
214
+ },
215
+ {
216
+ "id": "9fb4017c1d0ac7c9",
217
+ "type": "comment",
218
+ "z": "fd3c725340de4f74",
219
+ "g": "72d3db13edc2486b",
220
+ "name": "Demo to listen on a new usertask an finish them",
221
+ "info": "",
222
+ "x": 240,
223
+ "y": 300,
224
+ "wires": []
225
+ },
226
+ {
227
+ "id": "42e6796dddd9d4db",
228
+ "type": "processcube-engine-config",
229
+ "url": "http://engine:8000"
230
+ }
231
+ ]
@@ -27,19 +27,19 @@
27
27
  </script>
28
28
 
29
29
  <script type="text/markdown" data-help-name="externaltask-error">
30
- Used for reporting errors in the processing of external tasks. The error
31
- code `Error` in the configuration is forwarded to the ProcessCube engine for
32
- handling within _Error-Boundary-Events_.
30
+ Used for reporting errors in the processing of external tasks. The error
31
+ code `Error` in the configuration is forwarded to the ProcessCube engine for
32
+ handling within _Error-Boundary-Events_.
33
33
 
34
- ## Inputs
34
+ ## Inputs
35
35
 
36
- : msg (Object) : Passed as `ErrorDetails` to the engine
37
- : Error (string) : From the configuration
38
- : Message (string) : The caught exception message
39
- : StackTrace (string) : The stack trace of the exception
36
+ : msg (Object) : Passed as `ErrorDetails` to the engine
37
+ : Error (string) : From the configuration
38
+ : Message (string) : The caught exception message
39
+ : StackTrace (string) : The stack trace of the exception
40
40
 
41
- ### References
41
+ ### References
42
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;
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
45
  </script>
@@ -32,22 +32,22 @@
32
32
  </script>
33
33
 
34
34
  <script type="text/markdown" data-help-name="externaltask-input">
35
- Waiting for external tasks that correspond to the `Topic` configured in
36
- the connected ProcessCube Engine for processing.
35
+ Waiting for external tasks that correspond to the `Topic` configured in
36
+ the connected ProcessCube Engine for processing.
37
37
 
38
- ## Outputs
38
+ ## Outputs
39
39
 
40
- : payload (string) : Defines the input of the external task token
41
- : task (object) : The external task object
42
- : flowNodeInstanceId : The Id of the external task, which is needed to complete the task
40
+ : payload (string) : Defines the input of the external task token
41
+ : task (object) : The external task object
42
+ : flowNodeInstanceId : The Id of the external task, which is needed to complete the task
43
43
 
44
- ### Details
44
+ ### Details
45
45
 
46
- - To finish the external task the `externaltask-output` node is required.
47
- - For handling a error while executing a flow as external task the `externaltask-error` node is required.
46
+ - To finish the external task the `externaltask-output` node is required.
47
+ - For handling a error while executing a flow as external task the `externaltask-error` node is required.
48
48
 
49
- ### References
49
+ ### References
50
50
 
51
- - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; Plattform
52
- - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED Integration in ProcessCube&copy;
51
+ - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; Plattform
52
+ - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED Integration in ProcessCube&copy;
53
53
  </script>
@@ -16,9 +16,14 @@ module.exports = function (RED) {
16
16
  var node = this;
17
17
  var flowContext = node.context().flow;
18
18
 
19
- this.engine = this.server = RED.nodes.getNode(config.engine);
19
+ const engine = RED.nodes.getNode(config.engine);
20
20
 
21
- const client = this.engine.getEngineClient();
21
+ const client = engine.engineClient;
22
+
23
+ if (!client) {
24
+ node.error('No engine configured.');
25
+ return;
26
+ }
22
27
 
23
28
  var eventEmitter = flowContext.get('emitter');
24
29
 
@@ -106,8 +111,8 @@ module.exports = function (RED) {
106
111
  .then(async (externalTaskWorker) => {
107
112
  node.status({ fill: 'blue', shape: 'ring', text: 'subcribed' });
108
113
 
109
- externalTaskWorker.identity = node.server.identity;
110
- node.server.registerOnIdentityChanged((identity) => {
114
+ externalTaskWorker.identity = engine.identity;
115
+ engine.registerOnIdentityChanged((identity) => {
111
116
  externalTaskWorker.identity = identity;
112
117
  });
113
118
 
@@ -118,7 +123,7 @@ module.exports = function (RED) {
118
123
  case 'finishExternalTask':
119
124
  case 'processExternalTask':
120
125
  node.error(
121
- `Worker error ${errorType} for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}': ${error.message}`,
126
+ `Worker error ${errorType} for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}': ${error.message}`
122
127
  );
123
128
 
124
129
  if (externalTask) {
@@ -22,15 +22,15 @@
22
22
  </script>
23
23
 
24
24
  <script type="text/markdown" data-help-name="externaltask-output">
25
- Used to complete the external task. The `msg.payload` is returned to the ProcessCube
26
- engine as the result of the external task.
25
+ Used to complete the external task. The `msg.payload` is returned to the ProcessCube
26
+ engine as the result of the external task.
27
27
 
28
- ## Inputs
28
+ ## Inputs
29
29
 
30
- : payload (Object) : Returned to the ProcessCube engine as the result of the external task
30
+ : payload (Object) : Returned to the ProcessCube engine as the result of the external task
31
31
 
32
- ### References
32
+ ### References
33
33
 
34
- - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
35
- - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube&copy;
34
+ - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
35
+ - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube&copy;
36
36
  </script>
@@ -36,6 +36,18 @@
36
36
  </div>
37
37
  </script>
38
38
 
39
- <script type="text/html" data-help-name="externaltask-input">
40
- <p>A node which emmits an message event to the Engine.</p>
39
+ <script type="text/markdown" data-help-name="externaltask-input">
40
+ A Message event to an intermediate message event can be triggert.
41
+
42
+ From the config the `messagename` 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,22 +1,23 @@
1
- const process = require('process');
2
-
3
- const engine_client = require('@5minds/processcube_engine_client');
4
-
5
1
  module.exports = function (RED) {
6
2
  function MessageEventTrigger(config) {
7
3
  RED.nodes.createNode(this, config);
8
4
  var node = this;
9
5
 
10
- this.engine = this.server = RED.nodes.getNode(config.engine);
6
+ node.on('input', function (msg) {
11
7
 
12
- const client = this.engine.getEngineClient();
8
+ const engine = RED.nodes.getNode(config.engine);
9
+ const client = engine.engineClient;
13
10
 
14
- node.on('input', function (msg) {
15
- client.events
11
+ if (!client) {
12
+ node.error('No engine configured.');
13
+ return;
14
+ }
15
+
16
+ engine.engineClient.events
16
17
  .triggerMessageEvent(config.messagename, {
17
18
  processInstanceId: config.processinstanceid,
18
19
  payload: msg.payload,
19
- identity: node.server.identity,
20
+ identity: engine.identity,
20
21
  })
21
22
  .then((result) => {
22
23
  msg.payload = result;