@5minds/node-red-contrib-processcube 0.14.0-fix-error-in-process-instance-query-9aeac9-lyzi0gix → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- package/Dockerfile +1 -1
- package/docker-compose.yml +12 -0
- package/examples/External-Task-Sample.json +252 -0
- package/externaltask-error.html +26 -12
- package/externaltask-error.js +19 -20
- package/externaltask-input.html +31 -14
- package/externaltask-input.js +107 -55
- package/externaltask-output.html +20 -10
- package/externaltask-output.js +12 -11
- package/message-event-trigger.html +14 -14
- package/message-event-trigger.js +10 -14
- package/nodered/node-red-contrib-processcube-flows.json +216 -132
- package/nodered/package.json +1 -0
- package/nodered/settings.js +92 -82
- package/package.json +3 -9
- package/process-start.html +23 -19
- package/process-start.js +10 -15
- package/processcube-engine-config.html +10 -10
- package/processcube-engine-config.js +30 -22
- package/processdefinition-query.html +23 -29
- package/processdefinition-query.js +42 -36
- package/processes/External-Task-Sample.bpmn +94 -0
- package/processinstance-query.html +20 -19
- package/processinstance-query.js +16 -23
- package/signal-event-trigger.html +14 -14
- package/signal-event-trigger.js +10 -14
- package/usertask-finished-listener.html +12 -17
- package/usertask-finished-listener.js +30 -27
- package/usertask-input.html +27 -40
- package/usertask-input.js +37 -24
- package/usertask-new-listener.html +12 -17
- package/usertask-new-listener.js +27 -27
- package/usertask-output.html +24 -23
- package/usertask-output.js +25 -21
- package/.prettierrc.json +0 -6
- package/processes/CheckError.bpmn +0 -78
- package/processes/NodeRedExternalTask.bpmn +0 -77
- package/processes/SampleUserTask.bpmn +0 -95
package/Dockerfile
CHANGED
package/docker-compose.yml
CHANGED
@@ -5,12 +5,17 @@ services:
|
|
5
5
|
context: .
|
6
6
|
ports:
|
7
7
|
- "1880:1880"
|
8
|
+
- "9229:9229"
|
8
9
|
environment:
|
9
10
|
- TZ=Europe/Berlin
|
10
11
|
- ENGINE_URL=http://engine:8000
|
11
12
|
- FLOWS=/nodered/node-red-contrib-processcube-flows.json
|
12
13
|
volumes:
|
13
14
|
- ./nodered/:/nodered/
|
15
|
+
- ./examples/:/examples/
|
16
|
+
depends_on:
|
17
|
+
- engine
|
18
|
+
- authority
|
14
19
|
|
15
20
|
engine:
|
16
21
|
image: 5minds/processcube_engine:2024-1
|
@@ -19,9 +24,16 @@ services:
|
|
19
24
|
volumes:
|
20
25
|
- ./processes:/processes:ro
|
21
26
|
environment:
|
27
|
+
application__name: Engine for Node-RED contrib
|
22
28
|
iam__baseUrl: http://authority:11560
|
23
29
|
iam__allowAnonymousRootAccess: true
|
24
30
|
command: --seed-dir=/processes --port 8000
|
31
|
+
depends_on:
|
32
|
+
- authority
|
33
|
+
healthcheck:
|
34
|
+
test: bash -c "[ -f /tmp/healthy ]"
|
35
|
+
timeout: 1s
|
36
|
+
retries: 20
|
25
37
|
|
26
38
|
authority:
|
27
39
|
image: 5minds/processcube_authority:3.0.4
|
@@ -0,0 +1,252 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": "a23d2e782beb66f4",
|
4
|
+
"type": "tab",
|
5
|
+
"label": "External Task Sample",
|
6
|
+
"disabled": false,
|
7
|
+
"info": "",
|
8
|
+
"env": []
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"id": "70d7a70e375b162a",
|
12
|
+
"type": "group",
|
13
|
+
"z": "a23d2e782beb66f4",
|
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
|
+
"2991a5e6df2b87d2",
|
25
|
+
"911fde53bcbb7e3f",
|
26
|
+
"d56bb7cd73fd220c",
|
27
|
+
"15a5f64b9e2e05fc"
|
28
|
+
],
|
29
|
+
"x": 34,
|
30
|
+
"y": 79,
|
31
|
+
"w": 512,
|
32
|
+
"h": 142
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"id": "31cb6729aac0ba46",
|
36
|
+
"type": "group",
|
37
|
+
"z": "a23d2e782beb66f4",
|
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
|
+
"18e05d562d48f32d",
|
49
|
+
"49aee03a7885fae8",
|
50
|
+
"e4555d9019cd3f47",
|
51
|
+
"bd68c4bdc53b8f80",
|
52
|
+
"fb87f79852b22e4a",
|
53
|
+
"1ba1e62c9935255f",
|
54
|
+
"b49f226ba865e164"
|
55
|
+
],
|
56
|
+
"x": 34,
|
57
|
+
"y": 259,
|
58
|
+
"w": 812,
|
59
|
+
"h": 202
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"id": "2991a5e6df2b87d2",
|
63
|
+
"type": "externaltask-input",
|
64
|
+
"z": "a23d2e782beb66f4",
|
65
|
+
"g": "70d7a70e375b162a",
|
66
|
+
"name": "Test",
|
67
|
+
"engine": "42e6796dddd9d4db",
|
68
|
+
"topic": "Test",
|
69
|
+
"x": 110,
|
70
|
+
"y": 180,
|
71
|
+
"wires": [
|
72
|
+
[
|
73
|
+
"d56bb7cd73fd220c"
|
74
|
+
]
|
75
|
+
]
|
76
|
+
},
|
77
|
+
{
|
78
|
+
"id": "911fde53bcbb7e3f",
|
79
|
+
"type": "externaltask-output",
|
80
|
+
"z": "a23d2e782beb66f4",
|
81
|
+
"g": "70d7a70e375b162a",
|
82
|
+
"name": "Test Ende",
|
83
|
+
"x": 460,
|
84
|
+
"y": 180,
|
85
|
+
"wires": []
|
86
|
+
},
|
87
|
+
{
|
88
|
+
"id": "d56bb7cd73fd220c",
|
89
|
+
"type": "delay",
|
90
|
+
"z": "a23d2e782beb66f4",
|
91
|
+
"g": "70d7a70e375b162a",
|
92
|
+
"name": "",
|
93
|
+
"pauseType": "delay",
|
94
|
+
"timeout": "1",
|
95
|
+
"timeoutUnits": "seconds",
|
96
|
+
"rate": "1",
|
97
|
+
"nbRateUnits": "1",
|
98
|
+
"rateUnits": "second",
|
99
|
+
"randomFirst": "1",
|
100
|
+
"randomLast": "5",
|
101
|
+
"randomUnits": "seconds",
|
102
|
+
"drop": false,
|
103
|
+
"allowrate": false,
|
104
|
+
"outputs": 1,
|
105
|
+
"x": 280,
|
106
|
+
"y": 180,
|
107
|
+
"wires": [
|
108
|
+
[
|
109
|
+
"911fde53bcbb7e3f"
|
110
|
+
]
|
111
|
+
]
|
112
|
+
},
|
113
|
+
{
|
114
|
+
"id": "18e05d562d48f32d",
|
115
|
+
"type": "externaltask-input",
|
116
|
+
"z": "a23d2e782beb66f4",
|
117
|
+
"g": "31cb6729aac0ba46",
|
118
|
+
"name": "SampleError",
|
119
|
+
"engine": "42e6796dddd9d4db",
|
120
|
+
"topic": "SampleError",
|
121
|
+
"x": 130,
|
122
|
+
"y": 360,
|
123
|
+
"wires": [
|
124
|
+
[
|
125
|
+
"49aee03a7885fae8"
|
126
|
+
]
|
127
|
+
]
|
128
|
+
},
|
129
|
+
{
|
130
|
+
"id": "49aee03a7885fae8",
|
131
|
+
"type": "delay",
|
132
|
+
"z": "a23d2e782beb66f4",
|
133
|
+
"g": "31cb6729aac0ba46",
|
134
|
+
"name": "",
|
135
|
+
"pauseType": "delay",
|
136
|
+
"timeout": "5",
|
137
|
+
"timeoutUnits": "seconds",
|
138
|
+
"rate": "1",
|
139
|
+
"nbRateUnits": "1",
|
140
|
+
"rateUnits": "second",
|
141
|
+
"randomFirst": "1",
|
142
|
+
"randomLast": "5",
|
143
|
+
"randomUnits": "seconds",
|
144
|
+
"drop": false,
|
145
|
+
"allowrate": false,
|
146
|
+
"outputs": 1,
|
147
|
+
"x": 320,
|
148
|
+
"y": 360,
|
149
|
+
"wires": [
|
150
|
+
[
|
151
|
+
"bd68c4bdc53b8f80"
|
152
|
+
]
|
153
|
+
]
|
154
|
+
},
|
155
|
+
{
|
156
|
+
"id": "e4555d9019cd3f47",
|
157
|
+
"type": "catch",
|
158
|
+
"z": "a23d2e782beb66f4",
|
159
|
+
"g": "31cb6729aac0ba46",
|
160
|
+
"name": "",
|
161
|
+
"scope": "group",
|
162
|
+
"uncaught": false,
|
163
|
+
"x": 510,
|
164
|
+
"y": 420,
|
165
|
+
"wires": [
|
166
|
+
[
|
167
|
+
"fb87f79852b22e4a"
|
168
|
+
]
|
169
|
+
]
|
170
|
+
},
|
171
|
+
{
|
172
|
+
"id": "bd68c4bdc53b8f80",
|
173
|
+
"type": "function",
|
174
|
+
"z": "a23d2e782beb66f4",
|
175
|
+
"g": "31cb6729aac0ba46",
|
176
|
+
"name": "raise Error",
|
177
|
+
"func": "throw Error(\"hello error\");\n\nreturn msg;",
|
178
|
+
"outputs": 1,
|
179
|
+
"timeout": 0,
|
180
|
+
"noerr": 0,
|
181
|
+
"initialize": "",
|
182
|
+
"finalize": "",
|
183
|
+
"libs": [],
|
184
|
+
"x": 510,
|
185
|
+
"y": 360,
|
186
|
+
"wires": [
|
187
|
+
[
|
188
|
+
"1ba1e62c9935255f"
|
189
|
+
]
|
190
|
+
]
|
191
|
+
},
|
192
|
+
{
|
193
|
+
"id": "fb87f79852b22e4a",
|
194
|
+
"type": "externaltask-error",
|
195
|
+
"z": "a23d2e782beb66f4",
|
196
|
+
"g": "31cb6729aac0ba46",
|
197
|
+
"name": "Send Error to Engine",
|
198
|
+
"error": "MyErrorCode",
|
199
|
+
"x": 720,
|
200
|
+
"y": 420,
|
201
|
+
"wires": [
|
202
|
+
[]
|
203
|
+
]
|
204
|
+
},
|
205
|
+
{
|
206
|
+
"id": "1ba1e62c9935255f",
|
207
|
+
"type": "externaltask-output",
|
208
|
+
"z": "a23d2e782beb66f4",
|
209
|
+
"g": "31cb6729aac0ba46",
|
210
|
+
"name": "",
|
211
|
+
"x": 710,
|
212
|
+
"y": 360,
|
213
|
+
"wires": []
|
214
|
+
},
|
215
|
+
{
|
216
|
+
"id": "15a5f64b9e2e05fc",
|
217
|
+
"type": "comment",
|
218
|
+
"z": "a23d2e782beb66f4",
|
219
|
+
"g": "70d7a70e375b162a",
|
220
|
+
"name": "Simple External Task handling",
|
221
|
+
"info": "",
|
222
|
+
"x": 180,
|
223
|
+
"y": 120,
|
224
|
+
"wires": []
|
225
|
+
},
|
226
|
+
{
|
227
|
+
"id": "b49f226ba865e164",
|
228
|
+
"type": "comment",
|
229
|
+
"z": "a23d2e782beb66f4",
|
230
|
+
"g": "31cb6729aac0ba46",
|
231
|
+
"name": "Error handling with external tasks",
|
232
|
+
"info": "",
|
233
|
+
"x": 190,
|
234
|
+
"y": 300,
|
235
|
+
"wires": []
|
236
|
+
},
|
237
|
+
{
|
238
|
+
"id": "799125e21de02f13",
|
239
|
+
"type": "comment",
|
240
|
+
"z": "a23d2e782beb66f4",
|
241
|
+
"name": "For Testing, deploy \"External-Task-Sample.bpmn\" and start the process.",
|
242
|
+
"info": "",
|
243
|
+
"x": 300,
|
244
|
+
"y": 40,
|
245
|
+
"wires": []
|
246
|
+
},
|
247
|
+
{
|
248
|
+
"id": "42e6796dddd9d4db",
|
249
|
+
"type": "processcube-engine-config",
|
250
|
+
"url": "http://engine:8000"
|
251
|
+
}
|
252
|
+
]
|
package/externaltask-error.html
CHANGED
@@ -1,31 +1,45 @@
|
|
1
1
|
<script type="text/javascript">
|
2
|
-
RED.nodes.registerType('externaltask-error',
|
2
|
+
RED.nodes.registerType('externaltask-error',{
|
3
3
|
category: 'ProcessCube',
|
4
4
|
color: '#F6A923',
|
5
5
|
defaults: {
|
6
|
-
name: {
|
7
|
-
error: {
|
6
|
+
name: {value:""},
|
7
|
+
error: {value:""}
|
8
8
|
},
|
9
9
|
inputs: 1,
|
10
10
|
outputs: 1,
|
11
|
-
icon:
|
12
|
-
label: function
|
13
|
-
return this.name ||
|
14
|
-
}
|
11
|
+
icon: "font-awesome/fa-exclamation-triangle",
|
12
|
+
label: function() {
|
13
|
+
return this.name || "externaltask-error";
|
14
|
+
}
|
15
15
|
});
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<script type="text/html" data-template-name="externaltask-error">
|
19
19
|
<div class="form-row">
|
20
20
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
21
|
-
<input type="text" id="node-input-name" placeholder="Name"
|
21
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
22
22
|
</div>
|
23
23
|
<div class="form-row">
|
24
24
|
<label for="node-input-error"><i class="fa fa-tag"></i> Error Code</label>
|
25
|
-
<input type="text" id="node-input-error" placeholder="Error Code of ExternalTask"
|
25
|
+
<input type="text" id="node-input-error" placeholder="Error Code of ExternalTask">
|
26
26
|
</div>
|
27
27
|
</script>
|
28
28
|
|
29
|
-
<script type="text/
|
30
|
-
|
31
|
-
|
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*.
|
33
|
+
|
34
|
+
## Inputs
|
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
|
40
|
+
|
41
|
+
### References
|
42
|
+
|
43
|
+
- [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube© platform
|
44
|
+
- [Node-RED Integration in ProcessCube©](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube©
|
45
|
+
</script>
|
package/externaltask-error.js
CHANGED
@@ -1,33 +1,32 @@
|
|
1
|
-
module.exports = function
|
1
|
+
module.exports = function(RED) {
|
2
2
|
function ExternalTaskError(config) {
|
3
|
-
RED.nodes.createNode(this,
|
3
|
+
RED.nodes.createNode(this,config);
|
4
4
|
var node = this;
|
5
5
|
|
6
6
|
var flowContext = node.context().flow;
|
7
|
-
var eventEmitter = flowContext.get('emitter');
|
7
|
+
var eventEmitter = flowContext.get('emitter');
|
8
8
|
|
9
|
-
node.on('input', function
|
10
|
-
const externalTaskId = msg.externalTaskId;
|
9
|
+
node.on('input', function(msg) {
|
11
10
|
|
12
|
-
|
11
|
+
const flowNodeInstanceId = msg.flowNodeInstanceId;
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
let msgError = msg.error;
|
14
|
+
|
15
|
+
if (msgError === undefined) {
|
16
|
+
msgError.message = "An error occurred";
|
17
17
|
}
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
errorMessage: error.message,
|
23
|
-
errorDetails: error.source,
|
24
|
-
},
|
25
|
-
};
|
19
|
+
const error = new Error(msgError.message);
|
20
|
+
error.errorCode = config.error;
|
21
|
+
error.errorDetails = RED.util.encodeObject(msg);
|
26
22
|
|
27
|
-
|
23
|
+
msg.errorCode = config.error;
|
24
|
+
msg.errorMessage = msgError.message;
|
28
25
|
|
26
|
+
eventEmitter.emit(`handle-${flowNodeInstanceId}`, error, true);
|
27
|
+
|
29
28
|
node.send(msg);
|
30
|
-
});
|
29
|
+
});
|
31
30
|
}
|
32
|
-
RED.nodes.registerType(
|
33
|
-
}
|
31
|
+
RED.nodes.registerType("externaltask-error", ExternalTaskError);
|
32
|
+
}
|
package/externaltask-input.html
CHANGED
@@ -1,36 +1,53 @@
|
|
1
1
|
<script type="text/javascript">
|
2
|
-
RED.nodes.registerType('externaltask-input',
|
2
|
+
RED.nodes.registerType('externaltask-input',{
|
3
3
|
category: 'ProcessCube',
|
4
4
|
color: '#02AFD6',
|
5
5
|
defaults: {
|
6
|
-
name: {
|
7
|
-
engine: {
|
8
|
-
topic: {
|
6
|
+
name: {value: ""},
|
7
|
+
engine: {value: "", type: "processcube-engine-config"},
|
8
|
+
topic: {value: ""}
|
9
9
|
},
|
10
10
|
inputs: 0,
|
11
11
|
outputs: 1,
|
12
|
-
icon:
|
13
|
-
label: function
|
14
|
-
return this.name
|
15
|
-
}
|
12
|
+
icon: "font-awesome/fa-envelope-open",
|
13
|
+
label: function() {
|
14
|
+
return this.name||"externaltask-input";
|
15
|
+
}
|
16
16
|
});
|
17
17
|
</script>
|
18
18
|
|
19
19
|
<script type="text/html" data-template-name="externaltask-input">
|
20
20
|
<div class="form-row">
|
21
21
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
22
|
-
<input type="text" id="node-input-name" placeholder="Name"
|
22
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
23
23
|
</div>
|
24
24
|
<div class="form-row">
|
25
25
|
<label for="node-input-engine"><i class="fa fa-tag"></i> Engine</label>
|
26
|
-
<input type="text" id="node-input-engine" placeholder="Engine"
|
26
|
+
<input type="text" id="node-input-engine" placeholder="Engine">
|
27
27
|
</div>
|
28
28
|
<div class="form-row">
|
29
29
|
<label for="node-input-topic"><i class="fa fa-tag"></i> Topic</label>
|
30
|
-
<input type="text" id="node-input-topic" placeholder="Topic of ExternalTask"
|
30
|
+
<input type="text" id="node-input-topic" placeholder="Topic of ExternalTask">
|
31
31
|
</div>
|
32
32
|
</script>
|
33
33
|
|
34
|
-
<script type="text/
|
35
|
-
|
36
|
-
|
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.
|
37
|
+
|
38
|
+
## Outputs
|
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
|
43
|
+
|
44
|
+
### Details
|
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.
|
48
|
+
|
49
|
+
### References
|
50
|
+
|
51
|
+
- [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube© Plattform
|
52
|
+
- [Node-RED Integration in ProcessCube©](https://processcube.io/docs/node-red) - Node-RED Integration in ProcessCube©
|
53
|
+
</script>
|