@5minds/node-red-contrib-processcube 1.5.10-feature-b16106-m4lchkp4 → 1.5.10-feature-5a32ec-m4mhinya
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.
- package/endevent-finished-listener.js +0 -11
- package/externaltask-event-listener.js +0 -11
- package/externaltask-input.js +5 -12
- package/message-event-trigger.js +4 -4
- package/package.json +2 -2
- package/process-event-listener.js +0 -11
- package/process-start.js +5 -4
- package/process-terminate.js +3 -3
- package/processcube-engine-config.html +7 -7
- package/processcube-engine-config.js +22 -109
- package/processdefinition-query.js +2 -2
- package/processinstance-delete.html +9 -56
- package/processinstance-delete.js +12 -31
- package/processinstance-query.js +3 -3
- package/signal-event-trigger.js +3 -3
- package/usertask-event-listener.js +0 -11
- package/usertask-input.js +3 -3
- package/usertask-output.js +3 -3
@@ -6,17 +6,6 @@ module.exports = function (RED) {
|
|
6
6
|
|
7
7
|
let subscription = null;
|
8
8
|
|
9
|
-
const eventEmitter = node.engine.eventEmitter;
|
10
|
-
|
11
|
-
eventEmitter.on('engine-client-dispose', () => {
|
12
|
-
node.engine.engineClient.events.removeSubscription(subscription, node.engine.identity);
|
13
|
-
});
|
14
|
-
|
15
|
-
eventEmitter.on('engine-client-changed', () => {
|
16
|
-
node.log('new engineClient received');
|
17
|
-
register();
|
18
|
-
});
|
19
|
-
|
20
9
|
const register = async () => {
|
21
10
|
const client = node.engine.engineClient;
|
22
11
|
|
@@ -6,17 +6,6 @@ module.exports = function (RED) {
|
|
6
6
|
|
7
7
|
let subscription;
|
8
8
|
|
9
|
-
const eventEmitter = node.engine.eventEmitter;
|
10
|
-
|
11
|
-
eventEmitter.on('engine-client-dispose', () => {
|
12
|
-
node.engine.engineClient.notification.removeSubscription(subscription, node.engine.identity);
|
13
|
-
});
|
14
|
-
|
15
|
-
eventEmitter.on('engine-client-changed', () => {
|
16
|
-
node.log('new engineClient received');
|
17
|
-
register();
|
18
|
-
});
|
19
|
-
|
20
9
|
const register = async () => {
|
21
10
|
let currentIdentity = node.engine.identity;
|
22
11
|
|
package/externaltask-input.js
CHANGED
@@ -16,7 +16,7 @@ module.exports = function (RED) {
|
|
16
16
|
var node = this;
|
17
17
|
var flowContext = node.context().flow;
|
18
18
|
|
19
|
-
|
19
|
+
node.engine = RED.nodes.getNode(config.engine);
|
20
20
|
|
21
21
|
var eventEmitter = flowContext.get('emitter');
|
22
22
|
|
@@ -25,13 +25,6 @@ module.exports = function (RED) {
|
|
25
25
|
eventEmitter = flowContext.get('emitter');
|
26
26
|
}
|
27
27
|
|
28
|
-
const engineEventEmitter = engine.eventEmitter;
|
29
|
-
|
30
|
-
engineEventEmitter.on('engine-client-changed', () => {
|
31
|
-
node.log('new engineClient received');
|
32
|
-
register();
|
33
|
-
});
|
34
|
-
|
35
28
|
const register = async () => {
|
36
29
|
if (node.etw) {
|
37
30
|
try {
|
@@ -41,7 +34,7 @@ module.exports = function (RED) {
|
|
41
34
|
node.log(`cant close etw: ${JSON.stringify(node.etw)}`);
|
42
35
|
}
|
43
36
|
}
|
44
|
-
const client = engine.engineClient;
|
37
|
+
const client = node.engine.engineClient;
|
45
38
|
|
46
39
|
if (!client) {
|
47
40
|
node.error('No engine configured.');
|
@@ -133,8 +126,8 @@ module.exports = function (RED) {
|
|
133
126
|
|
134
127
|
node.etw = externalTaskWorker;
|
135
128
|
|
136
|
-
externalTaskWorker.identity = engine.identity;
|
137
|
-
engine.registerOnIdentityChanged((identity) => {
|
129
|
+
externalTaskWorker.identity = node.engine.identity;
|
130
|
+
node.engine.registerOnIdentityChanged((identity) => {
|
138
131
|
externalTaskWorker.identity = identity;
|
139
132
|
});
|
140
133
|
|
@@ -185,7 +178,7 @@ module.exports = function (RED) {
|
|
185
178
|
});
|
186
179
|
};
|
187
180
|
|
188
|
-
if (engine) {
|
181
|
+
if (node.engine) {
|
189
182
|
register();
|
190
183
|
}
|
191
184
|
}
|
package/message-event-trigger.js
CHANGED
@@ -5,19 +5,19 @@ module.exports = function (RED) {
|
|
5
5
|
|
6
6
|
node.on('input', function (msg) {
|
7
7
|
|
8
|
-
|
9
|
-
const client = engine.engineClient;
|
8
|
+
node.engine = RED.nodes.getNode(config.engine);
|
9
|
+
const client = node.engine.engineClient;
|
10
10
|
|
11
11
|
if (!client) {
|
12
12
|
node.error('No engine configured.');
|
13
13
|
return;
|
14
14
|
}
|
15
15
|
|
16
|
-
engine.engineClient.events
|
16
|
+
node.engine.engineClient.events
|
17
17
|
.triggerMessageEvent(config.messagename, {
|
18
18
|
processInstanceId: msg.processinstanceid,
|
19
19
|
payload: msg.payload,
|
20
|
-
identity: engine.identity,
|
20
|
+
identity: node.engine.identity,
|
21
21
|
})
|
22
22
|
.then((result) => {
|
23
23
|
msg.payload = result;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@5minds/node-red-contrib-processcube",
|
3
|
-
"version": "1.5.10-feature-
|
3
|
+
"version": "1.5.10-feature-5a32ec-m4mhinya",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "Node-RED nodes for ProcessCube",
|
6
6
|
"scripts": {
|
@@ -57,7 +57,7 @@
|
|
57
57
|
"examples": "examples"
|
58
58
|
},
|
59
59
|
"dependencies": {
|
60
|
-
"@5minds/processcube_engine_client": "5.1.
|
60
|
+
"@5minds/processcube_engine_client": "5.1.1",
|
61
61
|
"jwt-decode": "^4.0.0",
|
62
62
|
"openid-client": "^5.5.0"
|
63
63
|
},
|
@@ -6,17 +6,6 @@ module.exports = function (RED) {
|
|
6
6
|
|
7
7
|
let subscription;
|
8
8
|
|
9
|
-
const engineEventEmitter = node.engine.eventEmitter;
|
10
|
-
|
11
|
-
engineEventEmitter.on('engine-client-dispose', () => {
|
12
|
-
node.engine.engineClient.notification.removeSubscription(subscription, node.engine.identity);
|
13
|
-
});
|
14
|
-
|
15
|
-
engineEventEmitter.on('engine-client-changed', () => {
|
16
|
-
node.log('new engineClient received');
|
17
|
-
register();
|
18
|
-
});
|
19
|
-
|
20
9
|
const register = async () => {
|
21
10
|
const client = node.engine.engineClient;
|
22
11
|
|
package/process-start.js
CHANGED
@@ -22,8 +22,8 @@ module.exports = function (RED) {
|
|
22
22
|
return;
|
23
23
|
}
|
24
24
|
|
25
|
-
|
26
|
-
const client = engine.engineClient;
|
25
|
+
node.engine = RED.nodes.getNode(config.engine);
|
26
|
+
const client = node.engine.engineClient;
|
27
27
|
|
28
28
|
if (!client) {
|
29
29
|
node.error('No engine configured.');
|
@@ -31,7 +31,7 @@ module.exports = function (RED) {
|
|
31
31
|
}
|
32
32
|
|
33
33
|
client.processDefinitions
|
34
|
-
.startProcessInstance(startParameters
|
34
|
+
.startProcessInstance(startParameters)
|
35
35
|
.then((result) => {
|
36
36
|
msg.payload = result;
|
37
37
|
|
@@ -43,7 +43,8 @@ module.exports = function (RED) {
|
|
43
43
|
});
|
44
44
|
})
|
45
45
|
.catch((error) => {
|
46
|
-
node.
|
46
|
+
node.log("luis888")
|
47
|
+
node.error(JSON.stringify(error));
|
47
48
|
});
|
48
49
|
});
|
49
50
|
}
|
package/process-terminate.js
CHANGED
@@ -4,8 +4,8 @@ module.exports = function (RED) {
|
|
4
4
|
var node = this;
|
5
5
|
|
6
6
|
node.on('input', function (msg) {
|
7
|
-
|
8
|
-
const client = engine.engineClient;
|
7
|
+
node.engine = RED.nodes.getNode(config.engine);
|
8
|
+
const client = node.engine.engineClient;
|
9
9
|
|
10
10
|
if (!client) {
|
11
11
|
node.error('No engine configured.');
|
@@ -13,7 +13,7 @@ module.exports = function (RED) {
|
|
13
13
|
}
|
14
14
|
|
15
15
|
client.processInstances
|
16
|
-
.terminateProcessInstance(msg.payload, engine.identity)
|
16
|
+
.terminateProcessInstance(msg.payload, node.engine.identity)
|
17
17
|
.then(() => {
|
18
18
|
node.send(msg);
|
19
19
|
})
|
@@ -4,7 +4,7 @@
|
|
4
4
|
defaults: {
|
5
5
|
name: { value: '' },
|
6
6
|
url: { value: 'http://engine:8000', required: true },
|
7
|
-
urlType: { type: 'str'},
|
7
|
+
urlType: { type: 'str' },
|
8
8
|
clientId: { value: '' },
|
9
9
|
clientIdType: { type: 'str' },
|
10
10
|
clientSecret: { value: '' },
|
@@ -16,17 +16,17 @@
|
|
16
16
|
oneditprepare: function () {
|
17
17
|
$('#node-config-input-url').typedInput({
|
18
18
|
default: 'str',
|
19
|
-
types: ['str', '
|
19
|
+
types: ['str', 'env', 'cred'],
|
20
20
|
});
|
21
21
|
|
22
22
|
$('#node-config-input-clientId').typedInput({
|
23
23
|
default: 'str',
|
24
|
-
types: ['str', '
|
24
|
+
types: ['str', 'env', 'cred'],
|
25
25
|
});
|
26
26
|
|
27
27
|
$('#node-config-input-clientSecret').typedInput({
|
28
28
|
default: 'str',
|
29
|
-
types: ['str', '
|
29
|
+
types: ['str', 'env', 'cred'],
|
30
30
|
});
|
31
31
|
|
32
32
|
$('#node-config-input-url').typedInput('value', this.url);
|
@@ -66,7 +66,7 @@
|
|
66
66
|
</div>
|
67
67
|
<div class="form-row">
|
68
68
|
<label for="node-config-input-clientSecret"><i class="fa fa-bookmark"></i> Client secret</label>
|
69
|
-
<input type="
|
69
|
+
<input type="text" id="node-config-input-clientSecret" />
|
70
70
|
</div>
|
71
71
|
</script>
|
72
72
|
|
@@ -81,6 +81,6 @@ The configuration for the ProcessCube engine.
|
|
81
81
|
|
82
82
|
### References
|
83
83
|
|
84
|
-
-
|
85
|
-
-
|
84
|
+
- [The ProcessCube© Developer Network](https://processcube.io) - All documentation for the ProcessCube© platform
|
85
|
+
- [ProcessCube© LowCode Integration](https://processcube.io/docs/node-red) - LowCode integration in ProcessCube©
|
86
86
|
</script>
|
@@ -1,4 +1,3 @@
|
|
1
|
-
const EventEmitter = require('node:events');
|
2
1
|
const engine_client = require('@5minds/processcube_engine_client');
|
3
2
|
const jwt = require('jwt-decode');
|
4
3
|
const oidc = require('openid-client');
|
@@ -8,137 +7,51 @@ module.exports = function (RED) {
|
|
8
7
|
RED.nodes.createNode(this, n);
|
9
8
|
const node = this;
|
10
9
|
const identityChangedCallbacks = [];
|
11
|
-
|
10
|
+
node.identity = null;
|
12
11
|
|
13
|
-
|
14
|
-
|
12
|
+
node.credentials.clientId = RED.util.evaluateNodeProperty(n.clientId, n.clientIdType, node);
|
13
|
+
node.credentials.clientSecret = RED.util.evaluateNodeProperty(n.clientSecret, n.clientSecretType, node);
|
15
14
|
|
16
|
-
node.
|
17
|
-
|
18
|
-
// set the engine url
|
19
|
-
const stopRefreshing = periodicallyRefreshEngineClient(this, n, 10000);
|
20
|
-
|
21
|
-
this.registerOnIdentityChanged = function (callback) {
|
15
|
+
node.registerOnIdentityChanged = function (callback) {
|
22
16
|
identityChangedCallbacks.push(callback);
|
23
17
|
};
|
24
18
|
|
25
|
-
|
26
|
-
if (
|
27
|
-
return
|
19
|
+
node.isIdentityReady = function () {
|
20
|
+
if (node.credentials.clientId && node.credentials.clientSecret) {
|
21
|
+
return node.identity != null;
|
28
22
|
} else {
|
29
23
|
return true;
|
30
24
|
}
|
31
25
|
};
|
32
26
|
|
33
|
-
|
27
|
+
node.setIdentity = (identity) => {
|
34
28
|
node.log(`setIdentity: ${JSON.stringify(identity)}`);
|
35
|
-
|
29
|
+
node.identity = identity;
|
36
30
|
|
37
31
|
for (const callback of identityChangedCallbacks) {
|
38
32
|
callback(identity);
|
39
33
|
}
|
40
34
|
};
|
41
35
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
node.credentials.clientSecret === newClientSecret
|
52
|
-
) {
|
53
|
-
return;
|
54
|
-
}
|
55
|
-
|
56
|
-
node.url = newUrl;
|
57
|
-
node.credentials.clientId = newClientId;
|
58
|
-
node.credentials.clientSecret = newClientSecret;
|
59
|
-
|
60
|
-
if (node.credentials.clientId && node.credentials.clientSecret) {
|
61
|
-
if (node.engineClient) {
|
62
|
-
node.eventEmitter.emit('engine-client-dispose');
|
63
|
-
node.engineClient.dispose();
|
64
|
-
}
|
65
|
-
node.engineClient = new engine_client.EngineClient(node.url, () =>
|
66
|
-
getFreshIdentity(node.url, node)
|
67
|
-
);
|
68
|
-
|
69
|
-
node.eventEmitter.emit('engine-client-changed');
|
70
|
-
} else {
|
71
|
-
if (node.engineClient) {
|
72
|
-
node.eventEmitter.emit('engine-client-dispose');
|
73
|
-
node.engineClient.dispose();
|
74
|
-
}
|
75
|
-
node.engineClient = new engine_client.EngineClient(node.url);
|
76
|
-
|
77
|
-
node.eventEmitter.emit('engine-client-changed');
|
78
|
-
}
|
79
|
-
}
|
80
|
-
|
81
|
-
refreshUrl();
|
82
|
-
const intervalId = setInterval(refreshUrl, intervalMs);
|
83
|
-
|
84
|
-
return () => clearInterval(intervalId);
|
85
|
-
}
|
86
|
-
|
87
|
-
async function getFreshIdentity(url, node) {
|
88
|
-
try {
|
89
|
-
if (
|
90
|
-
!RED.util.evaluateNodeProperty(n.clientId, n.clientIdType, node) ||
|
91
|
-
!RED.util.evaluateNodeProperty(n.clientSecret, n.clientSecretType, node)
|
92
|
-
) {
|
93
|
-
return null;
|
94
|
-
}
|
95
|
-
|
96
|
-
const res = await fetch(url + '/atlas_engine/api/v1/authority', {
|
97
|
-
method: 'GET',
|
98
|
-
headers: {
|
99
|
-
Authorization: `Bearer ZHVtbXlfdG9rZW4=`,
|
100
|
-
'Content-Type': 'application/json',
|
101
|
-
},
|
102
|
-
});
|
103
|
-
|
104
|
-
const body = await res.json();
|
105
|
-
|
106
|
-
const issuer = await oidc.Issuer.discover(body);
|
107
|
-
|
108
|
-
const client = new issuer.Client({
|
109
|
-
client_id: RED.util.evaluateNodeProperty(n.clientId, n.clientIdType, node),
|
110
|
-
client_secret: RED.util.evaluateNodeProperty(n.clientSecret, n.clientSecretType, node),
|
111
|
-
});
|
112
|
-
|
113
|
-
const tokenSet = await client.grant({
|
114
|
-
grant_type: 'client_credentials',
|
115
|
-
scope: 'engine_etw engine_read engine_write',
|
116
|
-
});
|
117
|
-
|
118
|
-
const accessToken = tokenSet.access_token;
|
119
|
-
const decodedToken = jwt.jwtDecode(accessToken);
|
120
|
-
|
121
|
-
const freshIdentity = {
|
122
|
-
token: tokenSet.access_token,
|
123
|
-
userId: decodedToken.sub,
|
124
|
-
};
|
125
|
-
|
126
|
-
node.setIdentity(freshIdentity);
|
127
|
-
|
128
|
-
return freshIdentity;
|
129
|
-
} catch (e) {
|
130
|
-
node.error(`Could not get fresh identity: ${e}`);
|
131
|
-
}
|
36
|
+
if (node.credentials.clientId && node.credentials.clientSecret) {
|
37
|
+
node.engineClient = new engine_client.EngineClient(node.url, {
|
38
|
+
clientId: node.credentials.clientId,
|
39
|
+
clientSecret: node.credentials.clientSecret,
|
40
|
+
scope: 'engine_etw engine_read engine_write'
|
41
|
+
});
|
42
|
+
node.log("luis777")
|
43
|
+
} else {
|
44
|
+
node.engineClient = new engine_client.EngineClient(node.url);
|
132
45
|
}
|
133
46
|
|
134
47
|
node.on('close', async () => {
|
135
|
-
if (
|
136
|
-
|
137
|
-
|
138
|
-
this.engineClient = null;
|
48
|
+
if (node.engineClient) {
|
49
|
+
node.engineClient.dispose();
|
50
|
+
node.engineClient = null;
|
139
51
|
}
|
140
52
|
});
|
141
53
|
}
|
54
|
+
|
142
55
|
RED.nodes.registerType('processcube-engine-config', ProcessCubeEngineNode, {
|
143
56
|
credentials: {
|
144
57
|
clientId: { type: 'text' },
|
@@ -5,7 +5,7 @@ module.exports = function (RED) {
|
|
5
5
|
|
6
6
|
node.on('input', function (msg) {
|
7
7
|
|
8
|
-
|
8
|
+
node.engine = RED.nodes.getNode(config.engine);
|
9
9
|
const client = engine.engineClient;
|
10
10
|
|
11
11
|
if (!client) {
|
@@ -17,7 +17,7 @@ module.exports = function (RED) {
|
|
17
17
|
|
18
18
|
query = {
|
19
19
|
...query,
|
20
|
-
identity: engine.identity,
|
20
|
+
identity: node.engine.identity,
|
21
21
|
};
|
22
22
|
|
23
23
|
node.log(`Querying process definitions with query: ${JSON.stringify(query)}`);
|
@@ -6,9 +6,8 @@
|
|
6
6
|
name: { value: '' },
|
7
7
|
engine: { value: '', type: 'processcube-engine-config' },
|
8
8
|
modelid: { value: '' },
|
9
|
-
|
10
|
-
|
11
|
-
batch_size: { value: '100', type: 'number' },
|
9
|
+
time: { value: '', type: 'number' },
|
10
|
+
time_type: { value: 'hours' },
|
12
11
|
},
|
13
12
|
inputs: 1,
|
14
13
|
outputs: 1,
|
@@ -33,20 +32,16 @@
|
|
33
32
|
<input type="text" id="node-input-modelid" />
|
34
33
|
</div>
|
35
34
|
<div class="form-row">
|
36
|
-
<label for="node-input-
|
37
|
-
<input type="text" id="node-input-
|
35
|
+
<label for="node-input-time"><i class="fa fa-tag"></i> Duration</label>
|
36
|
+
<input type="text" id="node-input-time" />
|
38
37
|
</div>
|
39
38
|
<div class="form-row">
|
40
|
-
<label for="node-input-
|
41
|
-
<select id="node-input-
|
39
|
+
<label for="node-input-time_type"><i class="fa fa-sliders"></i> Time Unit</label>
|
40
|
+
<select id="node-input-time_type" style="width: 70%;">
|
42
41
|
<option value="hours">Hours</option>
|
43
42
|
<option value="days">Days</option>
|
44
43
|
</select>
|
45
44
|
</div>
|
46
|
-
<div class="form-row">
|
47
|
-
<label for="node-input-batch-size"><i class="fa fa-tag"></i> Batch Size</label>
|
48
|
-
<input type="text" id="node-input-batch_size" />
|
49
|
-
</div>
|
50
45
|
</script>
|
51
46
|
|
52
47
|
<script type="text/markdown" data-help-name="processinstance-delete">
|
@@ -54,54 +49,12 @@ Delete old instances of a process model in the ProcessCube.
|
|
54
49
|
|
55
50
|
## Inputs
|
56
51
|
|
57
|
-
: payload.
|
58
|
-
: payload.
|
59
|
-
: payload.batch_size (number): The number of instances to be deleted simultaneously. (default 100)
|
52
|
+
: payload.time (number): The number of given time periods.
|
53
|
+
: payload.time_type ('hours' | 'days'): The type of time period to use.
|
60
54
|
|
61
55
|
## Outputs
|
62
56
|
|
63
|
-
:
|
64
|
-
|
65
|
-
Object
|
66
|
-
{
|
67
|
-
successfulDeletions: [Array of strings],
|
68
|
-
failedDeletions: [Array of objects]
|
69
|
-
}
|
70
|
-
|
71
|
-
- successfulDeletions:
|
72
|
-
- Type: Array<String>
|
73
|
-
- Content: A list of successfully deleted process instance IDs.
|
74
|
-
|
75
|
-
- excample:
|
76
|
-
successfulDeletions: [
|
77
|
-
"instanceId1",
|
78
|
-
"instanceId2",
|
79
|
-
"instanceId3"
|
80
|
-
]
|
81
|
-
|
82
|
-
- failedDeletions:
|
83
|
-
- Type: Array<Object>
|
84
|
-
- Content: A list of objects containing details of the failed deletions.
|
85
|
-
- Each object has the following fields:
|
86
|
-
- id: The ID of the process instance that could not be deleted.
|
87
|
-
- error: The error message or the reason for the error.
|
88
|
-
|
89
|
-
- Example of a complete output:
|
90
|
-
{
|
91
|
-
successfulDeletions: [
|
92
|
-
"instanceId1",
|
93
|
-
"instanceId2",
|
94
|
-
"instanceId3"
|
95
|
-
],
|
96
|
-
failedDeletions: [
|
97
|
-
{ id: "instanceId4", error: "Permission denied" },
|
98
|
-
{ id: "instanceId5", error: "Instance not found" }
|
99
|
-
]
|
100
|
-
}
|
101
|
-
|
102
|
-
The node processes the IDs in configurable batches (default value: 100) and inserts successfully deleted or failed instances into the arrays accordingly.
|
103
|
-
As processing is currently forced to batch, a detailed error output is not possible.
|
104
|
-
If an error occurs during the processing of a batch, all Id's of this batch are marked as faulty.
|
57
|
+
: payload (string[]): The ids of the processinstances that were deleted.
|
105
58
|
|
106
59
|
### References
|
107
60
|
|
@@ -4,22 +4,21 @@ module.exports = function (RED) {
|
|
4
4
|
var node = this;
|
5
5
|
|
6
6
|
node.on('input', async function (msg) {
|
7
|
-
|
8
|
-
const client = engine.engineClient;
|
7
|
+
node.engine = RED.nodes.getNode(config.engine);
|
8
|
+
const client = node.engine.engineClient;
|
9
9
|
|
10
10
|
if (!client) {
|
11
11
|
node.error('No engine configured.');
|
12
12
|
return;
|
13
13
|
}
|
14
|
-
|
15
14
|
let timeMultiplier;
|
16
|
-
if (msg.payload.
|
17
|
-
timeMultiplier = msg.payload.
|
15
|
+
if (msg.payload.time_type) {
|
16
|
+
timeMultiplier = msg.payload.time_type == 'hours' ? 1 : 24;
|
18
17
|
} else {
|
19
|
-
timeMultiplier = config.
|
18
|
+
timeMultiplier = config.time_type == 'hours' ? 1 : 24;
|
20
19
|
}
|
21
20
|
|
22
|
-
const timeToUse = msg.payload.
|
21
|
+
const timeToUse = msg.payload.time ? msg.payload.time : config.time;
|
23
22
|
const modelId = msg.payload.processModelId
|
24
23
|
? msg.payload.processModelId != ''
|
25
24
|
? msg.payload.processModelId
|
@@ -28,14 +27,12 @@ module.exports = function (RED) {
|
|
28
27
|
? config.modelid
|
29
28
|
: undefined;
|
30
29
|
|
31
|
-
const batchSize = config.batch_size || 100; // Konfigurierbare Batchgröße, Standardwert 100
|
32
|
-
|
33
30
|
try {
|
34
31
|
const result = await client.processInstances.query({
|
35
32
|
processModelId: modelId
|
36
|
-
}, { identity: engine.identity });
|
33
|
+
}, { identity: node.engine.identity });
|
37
34
|
|
38
|
-
let allInstances = result.processInstances.filter((instance) => instance.state != 'suspended'
|
35
|
+
let allInstances = result.processInstances.filter((instance) => instance.state != 'suspended');
|
39
36
|
|
40
37
|
const today = new Date();
|
41
38
|
|
@@ -46,28 +43,12 @@ module.exports = function (RED) {
|
|
46
43
|
});
|
47
44
|
|
48
45
|
const ids = oldTasks.map((obj) => obj.processInstanceId);
|
46
|
+
msg.payload = ids;
|
49
47
|
|
50
|
-
|
51
|
-
successfulDeletions: [],
|
52
|
-
failedDeletions: []
|
53
|
-
};
|
54
|
-
|
55
|
-
for (let i = 0; i < ids.length; i += batchSize) {
|
56
|
-
const batch = ids.slice(i, i + batchSize);
|
57
|
-
try {
|
58
|
-
await client.processInstances.deleteProcessInstances(batch, true, engine.identity);
|
59
|
-
msg.payload.successfulDeletions.push(...batch); // Erfolgreiche IDs hinzufügen
|
60
|
-
} catch (deleteError) {
|
61
|
-
batch.forEach(id => {
|
62
|
-
msg.payload.failedDeletions.push({ id, error: deleteError.message }); // Fehler protokollieren
|
63
|
-
});
|
64
|
-
node.warn(`Failed to delete process instances in batch: ${batch.join(', ')}. Error: ${deleteError.message}`);
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
48
|
+
await client.processInstances.deleteProcessInstances(ids, true, node.engine.identity);
|
68
49
|
node.send(msg);
|
69
|
-
} catch (
|
70
|
-
node.error(
|
50
|
+
} catch (error) {
|
51
|
+
node.error(error);
|
71
52
|
}
|
72
53
|
});
|
73
54
|
}
|
package/processinstance-query.js
CHANGED
@@ -6,8 +6,8 @@ module.exports = function (RED) {
|
|
6
6
|
node.on('input', function (msg) {
|
7
7
|
let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
|
8
8
|
|
9
|
-
|
10
|
-
const client = engine.engineClient;
|
9
|
+
node.engine = RED.nodes.getNode(config.engine);
|
10
|
+
const client = node.engine.engineClient;
|
11
11
|
|
12
12
|
if (!client) {
|
13
13
|
node.error('No engine configured.');
|
@@ -15,7 +15,7 @@ module.exports = function (RED) {
|
|
15
15
|
}
|
16
16
|
|
17
17
|
client.processInstances
|
18
|
-
.query(query, { identity: engine.identity })
|
18
|
+
.query(query, { identity: node.engine.identity })
|
19
19
|
.then((matchingInstances) => {
|
20
20
|
msg.payload = matchingInstances;
|
21
21
|
|
package/signal-event-trigger.js
CHANGED
@@ -4,9 +4,9 @@ module.exports = function (RED) {
|
|
4
4
|
var node = this;
|
5
5
|
|
6
6
|
node.on('input', function (msg) {
|
7
|
-
|
7
|
+
node.engine = RED.nodes.getNode(config.engine);
|
8
8
|
|
9
|
-
const client = engine.engineClient;
|
9
|
+
const client = node.engine.engineClient;
|
10
10
|
|
11
11
|
if (!client) {
|
12
12
|
node.error('No engine configured.');
|
@@ -17,7 +17,7 @@ module.exports = function (RED) {
|
|
17
17
|
.triggerSignalEvent(config.signalname, {
|
18
18
|
processInstanceId: msg.processinstanceid,
|
19
19
|
payload: msg.payload,
|
20
|
-
identity: engine.identity,
|
20
|
+
identity: node.engine.identity,
|
21
21
|
})
|
22
22
|
.then((result) => {
|
23
23
|
msg.payload = result;
|
@@ -6,17 +6,6 @@ module.exports = function (RED) {
|
|
6
6
|
|
7
7
|
let subscription;
|
8
8
|
|
9
|
-
const eventEmitter = node.engine.eventEmitter;
|
10
|
-
|
11
|
-
eventEmitter.on('engine-client-dispose', () => {
|
12
|
-
node.engine.engineClient.userTasks.removeSubscription(subscription, node.engine.identity);
|
13
|
-
});
|
14
|
-
|
15
|
-
eventEmitter.on('engine-client-changed', () => {
|
16
|
-
node.log('new engineClient received');
|
17
|
-
register();
|
18
|
-
});
|
19
|
-
|
20
9
|
const register = async () => {
|
21
10
|
let currentIdentity = node.engine.identity;
|
22
11
|
|
package/usertask-input.js
CHANGED
@@ -4,9 +4,9 @@ module.exports = function (RED) {
|
|
4
4
|
var node = this;
|
5
5
|
|
6
6
|
node.on('input', function (msg) {
|
7
|
-
|
7
|
+
node.engine = RED.nodes.getNode(config.engine);
|
8
8
|
|
9
|
-
const client = engine.engineClient;
|
9
|
+
const client = node.engine.engineClient;
|
10
10
|
|
11
11
|
if (!client) {
|
12
12
|
node.error('No engine configured.');
|
@@ -20,7 +20,7 @@ module.exports = function (RED) {
|
|
20
20
|
};
|
21
21
|
|
22
22
|
client.userTasks
|
23
|
-
.query(query, { identity: engine.identity })
|
23
|
+
.query(query, { identity: node.engine.identity })
|
24
24
|
.then((matchingFlowNodes) => {
|
25
25
|
if (config.sendtype === 'array') {
|
26
26
|
msg.payload = { userTasks: matchingFlowNodes.userTasks || [] };
|
package/usertask-output.js
CHANGED
@@ -9,9 +9,9 @@ module.exports = function (RED) {
|
|
9
9
|
|
10
10
|
const userTaskResult = RED.util.evaluateNodeProperty(config.result, config.result_type, node, msg);
|
11
11
|
|
12
|
-
|
12
|
+
node.engine = RED.nodes.getNode(config.engine);
|
13
13
|
|
14
|
-
const client = engine.engineClient;
|
14
|
+
const client = node.engine.engineClient;
|
15
15
|
|
16
16
|
if (!client) {
|
17
17
|
node.error('No engine configured.');
|
@@ -19,7 +19,7 @@ module.exports = function (RED) {
|
|
19
19
|
}
|
20
20
|
|
21
21
|
client.userTasks
|
22
|
-
.finishUserTask(flowNodeInstanceId, userTaskResult, engine.identity)
|
22
|
+
.finishUserTask(flowNodeInstanceId, userTaskResult, node.engine.identity)
|
23
23
|
.then(() => {
|
24
24
|
node.send(msg);
|
25
25
|
})
|