@5minds/node-red-contrib-processcube 1.7.4-feature-6f3f78-m6l0ykww → 1.7.4
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/.processcube/nodered/.config.nodes.json +1 -1
- package/.processcube/nodered/.config.users.json +1 -1
- package/.processcube/nodered/config.js +3 -2
- package/.processcube/nodered/settings.js +1 -1
- package/README.md +2 -8
- package/doc_generator/generator.js +5 -5
- package/doc_generator/generator_with_swagger.js +78 -80
- package/endevent-finished-listener.html +16 -16
- package/externaltask-error.html +11 -11
- package/externaltask-error.js +3 -5
- package/externaltask-event-listener.html +9 -9
- package/externaltask-input.html +26 -26
- package/externaltask-input.js +8 -6
- package/externaltask-output.html +7 -7
- package/externaltask-output.js +1 -1
- package/message-event-trigger.html +8 -8
- package/message-event-trigger.js +0 -3
- package/package.json +2 -5
- package/process-event-listener.html +74 -74
- package/process-event-listener.js +2 -1
- package/process-start.html +12 -12
- package/process-start.js +3 -6
- package/process-terminate.html +9 -9
- package/process-terminate.js +1 -3
- package/processcube-engine-config.html +8 -8
- package/processcube-engine-config.js +2 -0
- package/processdefinition-deploy.html +9 -9
- package/processdefinition-deploy.js +2 -4
- package/processdefinition-query.html +140 -139
- package/processdefinition-query.js +0 -4
- package/processinstance-delete.html +46 -48
- package/processinstance-delete.js +9 -24
- package/processinstance-query.html +119 -120
- package/processinstance-query.js +1 -3
- package/signal-event-trigger.html +9 -8
- package/signal-event-trigger.js +0 -3
- package/usertask-event-listener.html +127 -126
- package/usertask-input.html +125 -126
- package/usertask-input.js +1 -3
- package/usertask-output.html +7 -7
- package/usertask-output.js +2 -5
- package/wait-for-usertask.html +164 -173
- package/wait-for-usertask.js +25 -36
@@ -61,143 +61,144 @@
|
|
61
61
|
</script>
|
62
62
|
|
63
63
|
<script type="text/markdown" data-help-name="processdefinition-query">
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
64
|
+
A node to query process definition on 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
|
+
## Outputs
|
75
|
+
|
76
|
+
: processDefinitions / models (Array) : The processDefinitions / models that matched the query.
|
77
|
+
: totalCount (number) : The number of matches.
|
78
|
+
|
79
|
+
|
80
|
+
### Query fields
|
81
|
+
|
82
|
+
**Summary**:
|
83
|
+
|
84
|
+
**Description**: Filter result for 'ProcessInstance Query'
|
85
|
+
|
86
|
+
#### Parameters:
|
87
|
+
- Name: `offset` Required: `false`
|
88
|
+
- Type: number
|
89
|
+
- Description: The index of the first ProcessInstance to include in the result set.
|
90
|
+
- Name: `limit` Required: `false`
|
91
|
+
- Type: number
|
92
|
+
- Description: The maximum number of ProcessInstances to return.
|
93
|
+
- Name: `correlationId` Required: `false`
|
94
|
+
- Type: Array<string> | string | SearchQuery
|
95
|
+
- string: myCorrelationId
|
96
|
+
- Array<string>: myCorrelationId1,myCorrelationId2
|
97
|
+
- object:
|
98
|
+
- Description: Filter by the CorrelationId of the ProcessInstances.
|
99
|
+
- Name: `processInstanceId` Required: ``
|
100
|
+
- Type: Array<string> | string | SearchQuery
|
101
|
+
- string: myProcessInstance_12345678
|
102
|
+
- Array<string>: myProcessInstance_12345678,myProcessInstance_87654321
|
103
|
+
- object:
|
104
|
+
- Description: Filter by the ID of the ProcessInstances.
|
105
|
+
- Name: `processDefinitionId` Required: ``
|
106
|
+
- Type: Array<string> | string | SearchQuery
|
107
|
+
- string: myProcess_12345678
|
108
|
+
- Array<string>: myProcess_12345678,myProcess_87654321
|
109
|
+
- object:
|
110
|
+
- Description: Filter by the ID of the ProcessDefinition that the ProcessInstances belong to.
|
111
|
+
- Name: `processModelId` Required: ``
|
112
|
+
- Type: Array<string> | string | SearchQuery
|
113
|
+
- string: myProcessModel_12345678
|
114
|
+
- Array<string>: myProcessModel_12345678,myProcessModel_87654321
|
115
|
+
- object:
|
116
|
+
- Description: Filter by the ID of the ProcessModel that the ProcessInstances belong to.
|
117
|
+
- Name: `processModelName` Required: ``
|
118
|
+
- Type: Array<string> | string | SearchQuery
|
119
|
+
- string: My Process Model
|
120
|
+
- Array<string>: My Process Model,My Other Process Model
|
121
|
+
- object:
|
122
|
+
- Description: Filter by the name of the ProcessModel that the ProcessInstances belong to.
|
123
|
+
- Name: `processModelHash` Required: ``
|
124
|
+
- Type: Array<string> | string | SearchQuery
|
125
|
+
- string: 12345678
|
126
|
+
- Array<string>: 12345678,87654321
|
127
|
+
- object:
|
128
|
+
- Description: Filter by the hash of the ProcessModel that the ProcessInstances belong to.
|
129
|
+
- Name: `ownerId` Required: ``
|
130
|
+
- Type: Array<string> | string | SearchQuery
|
131
|
+
- string: 12345678
|
132
|
+
- Array<string>: 12345678,87654321
|
133
|
+
- object:
|
134
|
+
- Description: Filter by the ID of the User that owns the ProcessInstances.
|
135
|
+
- Name: `state` Required: ``
|
136
|
+
- Type: Array<string> | string | SearchQuery
|
137
|
+
- string: running
|
138
|
+
- Array<string>: running,finished
|
139
|
+
- object:
|
140
|
+
- Description: Filter by the state of the ProcessInstances.
|
141
|
+
- Name: `parentProcessInstanceId` Required: ``
|
142
|
+
- Type: Array<string> | string | SearchQuery
|
143
|
+
- string: myParentProcessInstance_12345678
|
144
|
+
- Array<string>: myParentProcessInstance_12345678,myParentProcessInstance_87654321
|
145
|
+
- object:
|
146
|
+
- Description: Filter by the ID of the parent ProcessInstance.
|
147
|
+
- Name: `embeddedProcessModelId` Required: ``
|
148
|
+
- Type: Array<string> | string | SearchQuery
|
149
|
+
- string: myModel1
|
150
|
+
- Array<string>: myModel1,myModel2
|
151
|
+
- object:
|
152
|
+
- Description: Filter by the ID of the embedded process model.
|
153
|
+
- Name: `terminatedByUserId` Required: ``
|
154
|
+
- Type: Array<string> | string | SearchQuery
|
155
|
+
- string: 12345678
|
156
|
+
- Array<string>: 12345678,87654321
|
157
|
+
- object:
|
158
|
+
- Description: Filter by the ID of the User that terminated the ProcessInstances.
|
159
|
+
- Name: `createdBefore` Required: ``
|
160
|
+
- Type: string
|
161
|
+
- Description: The maximum created date of the ProcessInstances to include in the results.
|
162
|
+
- Name: `createdAt` Required: ``
|
163
|
+
- Type: Array<string> | string
|
164
|
+
- string: 2021-01-01T00:00:00.000Z
|
165
|
+
- array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
|
166
|
+
- Description: The minimum created date of the ProcessInstances to include in the results.
|
167
|
+
- Name: `createdAfter` Required: ``
|
168
|
+
- Type: string
|
169
|
+
- Description: The minimum created date of the ProcessInstances to include in the results.
|
170
|
+
- Name: `updatedBefore` Required: ``
|
171
|
+
- Type: string
|
172
|
+
- Description: The maximum updated date of the ProcessInstances to include in the results.
|
173
|
+
- Name: `updatedAt` Required: ``
|
174
|
+
- Type: Array<string> | string
|
175
|
+
- string: 2021-01-01T00:00:00.000Z
|
176
|
+
- array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
|
177
|
+
- Description: The exact updated date of the ProcessInstances to include in the results.
|
178
|
+
- Name: `updatedAfter` Required: ``
|
179
|
+
- Type: string
|
180
|
+
- Description: The minimum updated date of the ProcessInstances to include in the results.
|
181
|
+
- Name: `finishedBefore` Required: ``
|
182
|
+
- Type: string
|
183
|
+
- Description: The maximum finished date of the ProcessInstances to include in the results.
|
184
|
+
- Name: `finishedAt` Required: ``
|
185
|
+
- Type: Array<string> | string
|
186
|
+
- string: 2021-01-01T00:00:00.000Z
|
187
|
+
- array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
|
188
|
+
- Description: The exact finished date of the ProcessInstances to include in the results.
|
189
|
+
- Name: `finishedAfter` Required: ``
|
190
|
+
- Type: string
|
191
|
+
- Description: The minimum finished date of the ProcessInstances to include in the results.
|
192
|
+
- Name: `triggeredByFlowNodeInstance` Required: ``
|
193
|
+
- Type: Array<string> | string | SearchQuery
|
194
|
+
- string: myFlowNodeInstance_12345678
|
195
|
+
- array: myFlowNodeInstance_12345678,myFlowNodeInstance_87654321
|
196
|
+
- object:
|
197
|
+
- Description: Filter by the ID of the FlowNodeInstance that triggered the ProcessInstance.
|
198
|
+
|
199
|
+
|
200
|
+
### References
|
201
|
+
|
202
|
+
- [The ProcessCube© Developer Network](https://processcube.io) - All documentation for the ProcessCube© platform
|
203
|
+
- [ProcessCube© LowCode Integration](https://processcube.io/docs/node-red) - LowCode integration in ProcessCube©
|
203
204
|
</script>
|
@@ -16,10 +16,6 @@ module.exports = function (RED) {
|
|
16
16
|
|
17
17
|
node.log(`Querying process definitions with query: ${JSON.stringify(query)}`);
|
18
18
|
|
19
|
-
const isUser = !!msg._client?.user;
|
20
|
-
const identity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
|
21
|
-
query.identity = identity;
|
22
|
-
|
23
19
|
client.processDefinitions
|
24
20
|
.getAll(query)
|
25
21
|
.then((matchingProcessDefinitions) => {
|
@@ -50,63 +50,61 @@
|
|
50
50
|
</script>
|
51
51
|
|
52
52
|
<script type="text/markdown" data-help-name="processinstance-delete">
|
53
|
-
|
53
|
+
Delete old instances of a process model in the ProcessCube.
|
54
54
|
|
55
|
-
|
55
|
+
## Inputs
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
: payload.duration (number): The number of given time periods.
|
58
|
+
: payload.time_type ('hours' | 'days'): The type of time period to use.
|
59
|
+
: payload.batch_size (number): The number of instances to be deleted simultaneously. (default 100)
|
60
60
|
|
61
|
-
|
61
|
+
## Outputs
|
62
62
|
|
63
|
-
|
63
|
+
: Explanation of the payload:
|
64
64
|
|
65
|
-
|
66
|
-
|
65
|
+
Object
|
66
|
+
{
|
67
67
|
successfulDeletions: [Array of strings],
|
68
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
|
+
]
|
69
100
|
}
|
70
101
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
- Content: A list of successfully deleted process instance IDs.
|
75
|
-
|
76
|
-
- excample:
|
77
|
-
successfulDeletions: [
|
78
|
-
"instanceId1",
|
79
|
-
"instanceId2",
|
80
|
-
"instanceId3"
|
81
|
-
]
|
82
|
-
|
83
|
-
- failedDeletions:
|
84
|
-
|
85
|
-
- Type: Array<Object>
|
86
|
-
- Content: A list of objects containing details of the failed deletions.
|
87
|
-
- Each object has the following fields:
|
88
|
-
- id: The ID of the process instance that could not be deleted.
|
89
|
-
- error: The error message or the reason for the error.
|
90
|
-
|
91
|
-
- Example of a complete output:
|
92
|
-
{
|
93
|
-
successfulDeletions: [
|
94
|
-
"instanceId1",
|
95
|
-
"instanceId2",
|
96
|
-
"instanceId3"
|
97
|
-
],
|
98
|
-
failedDeletions: [
|
99
|
-
{ id: "instanceId4", error: "Permission denied" },
|
100
|
-
{ id: "instanceId5", error: "Instance not found" }
|
101
|
-
]
|
102
|
-
}
|
103
|
-
|
104
|
-
The node processes the IDs in configurable batches (default value: 100) and inserts successfully deleted or failed instances into the arrays accordingly.
|
105
|
-
As processing is currently forced to batch, a detailed error output is not possible.
|
106
|
-
If an error occurs during the processing of a batch, all Id's of this batch are marked as faulty.
|
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.
|
107
105
|
|
108
|
-
|
106
|
+
### References
|
109
107
|
|
110
|
-
|
111
|
-
|
108
|
+
- [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube© platform
|
109
|
+
- [Node-RED Integration in ProcessCube©](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube©
|
112
110
|
</script>
|
@@ -7,9 +7,6 @@ module.exports = function (RED) {
|
|
7
7
|
node.engine = RED.nodes.getNode(config.engine);
|
8
8
|
const client = node.engine ? node.engine.engineClient : null;
|
9
9
|
|
10
|
-
const isUser = !!msg._client?.user;
|
11
|
-
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
|
12
|
-
|
13
10
|
if (!client || !client.processInstances) {
|
14
11
|
node.error('No engine or processInstances API configured.', msg);
|
15
12
|
return;
|
@@ -37,7 +34,7 @@ module.exports = function (RED) {
|
|
37
34
|
const multiplier = timeType === 'hours' ? 1 : 24;
|
38
35
|
node.log(`Time type: ${timeType}`);
|
39
36
|
|
40
|
-
const deletionDate = new Date(Date.now() - timeToUse * multiplier * 60 * 60 * 1000);
|
37
|
+
const deletionDate = new Date(Date.now() - timeToUse * multiplier * 60 * 60 * 1000);
|
41
38
|
|
42
39
|
const modelId = msg.payload.processModelId?.trim() || config.modelid?.trim();
|
43
40
|
if (!modelId) {
|
@@ -67,18 +64,12 @@ module.exports = function (RED) {
|
|
67
64
|
state: ['finished', 'error', 'terminated'],
|
68
65
|
limit: batchSize,
|
69
66
|
},
|
70
|
-
{
|
71
|
-
includeXml: false,
|
72
|
-
identity: userIdentity,
|
73
|
-
},
|
67
|
+
{ includeXml: false }
|
74
68
|
);
|
75
69
|
|
76
70
|
const processInstances = result.processInstances || [];
|
77
71
|
if (processInstances.length === 0) {
|
78
|
-
node.log(
|
79
|
-
`No more process instances to delete for Model-ID: ${modelId} with Date: ${deletionDate.toISOString()}`,
|
80
|
-
msg,
|
81
|
-
);
|
72
|
+
node.log(`No more process instances to delete for Model-ID: ${modelId} with Date: ${deletionDate.toISOString()}`, msg);
|
82
73
|
hasMoreResults = false;
|
83
74
|
continue;
|
84
75
|
}
|
@@ -86,30 +77,24 @@ module.exports = function (RED) {
|
|
86
77
|
const ids = processInstances.map((obj) => obj.processInstanceId);
|
87
78
|
|
88
79
|
try {
|
89
|
-
await client.processInstances.deleteProcessInstances(ids, true
|
80
|
+
await client.processInstances.deleteProcessInstances(ids, true);
|
90
81
|
msg.payload.successfulDeletions.push(...ids);
|
91
|
-
sumSuccessful += ids.length;
|
82
|
+
sumSuccessful += ids.length;
|
92
83
|
} catch (deleteError) {
|
93
84
|
var message = JSON.stringify(deleteError);
|
94
85
|
sumFailed += ids.length;
|
95
86
|
ids.forEach((id) => {
|
96
87
|
msg.payload.failedDeletions.push({ id, error: message });
|
97
88
|
});
|
98
|
-
node.warn(
|
99
|
-
`Failed to delete some process instances for Model-ID: ${modelId}. Error: ${message}`,
|
100
|
-
);
|
89
|
+
node.warn(`Failed to delete some process instances for Model-ID: ${modelId}. Error: ${message}`);
|
101
90
|
}
|
102
91
|
}
|
103
|
-
node.log(
|
104
|
-
|
105
|
-
);
|
92
|
+
node.log(`Successfully deleted ${sumSuccessful} process instances and ${sumFailed} failed to delete process instances for Model-ID: ${modelId}.`);
|
93
|
+
|
106
94
|
|
107
95
|
node.send(msg);
|
108
96
|
} catch (queryError) {
|
109
|
-
node.error(
|
110
|
-
`Failed to query process instances for Model-ID: ${modelId}. Error: ${queryError.message}`,
|
111
|
-
msg,
|
112
|
-
);
|
97
|
+
node.error(`Failed to query process instances for Model-ID: ${modelId}. Error: ${queryError.message}`, msg);
|
113
98
|
}
|
114
99
|
});
|
115
100
|
}
|