@5minds/node-red-contrib-processcube 2.0.0-feature-629c78-m2dq1ygt → 7.6.0-develop-51b534-mjy4rzoh
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/README.md +3 -58
- package/check-authorization.html +138 -0
- package/check-authorization.js +27 -0
- package/dataobject-instance-query.html +141 -0
- package/dataobject-instance-query.js +45 -0
- package/endevent-finished-listener.js +14 -25
- package/examples/Check-Authorization-Sample.json +109 -0
- package/examples/Dataobject-Instance-Query-Sample.json +109 -0
- package/externaltask-error.html +8 -3
- package/externaltask-error.js +43 -29
- package/externaltask-event-listener.js +11 -28
- package/externaltask-input.html +48 -3
- package/externaltask-input.js +581 -114
- package/externaltask-output.js +20 -16
- package/icons/data-object-query.svg +5 -0
- package/message-event-trigger.html +1 -1
- package/message-event-trigger.js +8 -7
- package/package.json +74 -67
- package/process-event-listener.js +166 -225
- package/process-start.html +6 -0
- package/process-start.js +29 -6
- package/process-terminate.html +1 -1
- package/process-terminate.js +7 -5
- package/processcube-engine-config.html +25 -7
- package/processcube-engine-config.js +25 -135
- package/processcube-google-docs-mail-template.html +150 -0
- package/processcube-google-docs-mail-template.js +158 -0
- package/processdefinition-deploy.html +44 -0
- package/processdefinition-deploy.js +28 -0
- package/processdefinition-query.html +18 -13
- package/processdefinition-query.js +33 -31
- package/processinstance-delete-advanced.html +82 -0
- package/processinstance-delete-advanced.js +33 -0
- package/processinstance-delete.html +60 -8
- package/processinstance-delete.js +84 -30
- package/processinstance-query.html +116 -109
- package/processinstance-query.js +28 -5
- package/signal-event-trigger.js +8 -6
- package/usertask-event-listener.html +123 -1
- package/usertask-event-listener.js +30 -45
- package/usertask-input.html +119 -0
- package/usertask-input.js +7 -9
- package/usertask-output.js +15 -8
- package/wait-for-usertask.html +122 -6
- package/wait-for-usertask.js +44 -47
- package/.github/workflows/build-and-publish.yml +0 -72
- package/.processcube/authority/config/config.json +0 -36
- package/.processcube/authority/config/upeSeedingData.json +0 -12
- package/Dockerfile +0 -9
- package/doc_generator/_process_instances_query.md +0 -115
- package/doc_generator/generator.js +0 -41
- package/doc_generator/generator_with_swagger.js +0 -72
- package/doc_generator/package-lock.json +0 -176
- package/doc_generator/package.json +0 -15
- package/doc_generator/query_template.mustache +0 -20
- package/doc_generator/swagger.json +0 -4110
- package/docker-compose.yml +0 -44
- package/nodered/flows.json +0 -2156
- package/nodered/flows_cred.json +0 -3
- package/nodered/settings.js +0 -562
- package/nodered/static/ProcessCube_Logo.svg +0 -53
- package/processes/Call-Activity-Sample.bpmn +0 -88
- package/processes/External-Task-Auth-Sample.bpmn +0 -82
- package/processes/External-Task-Sample.bpmn +0 -94
- package/processes/SampleEvent.bpmn +0 -73
- package/processes/User-Task-Auth-Sample.bpmn +0 -63
- package/processes/User-Task-Sample.bpmn +0 -76
- package/processes/Wait-For-Usertask.bpmn +0 -74
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
engine: { value: '', type: 'processcube-engine-config' },
|
|
8
8
|
query: { value: 'payload' },
|
|
9
9
|
query_type: { value: 'msg' },
|
|
10
|
+
limit: { value: '' },
|
|
11
|
+
offset: { value: '' },
|
|
10
12
|
},
|
|
11
13
|
inputs: 1,
|
|
12
14
|
outputs: 1,
|
|
@@ -43,6 +45,14 @@
|
|
|
43
45
|
<label for="node-input-query"><i class="fa fa-tag"></i> Query</label>
|
|
44
46
|
<input type="text" id="node-input-query" />
|
|
45
47
|
</div>
|
|
48
|
+
<div class="form-row">
|
|
49
|
+
<label for="node-input-limit"><i class="fa fa-tag"></i> Limit</label>
|
|
50
|
+
<input type="text" id="node-input-limit" />
|
|
51
|
+
</div>
|
|
52
|
+
<div class="form-row">
|
|
53
|
+
<label for="node-input-offset"><i class="fa fa-tag"></i> Offset</label>
|
|
54
|
+
<input type="text" id="node-input-offset" />
|
|
55
|
+
</div>
|
|
46
56
|
</script>
|
|
47
57
|
|
|
48
58
|
<script type="text/markdown" data-help-name="processinstance-query">
|
|
@@ -50,8 +60,10 @@ A node to query process instances on the ProcessCube Engine.
|
|
|
50
60
|
|
|
51
61
|
## Inputs
|
|
52
62
|
|
|
53
|
-
: msg (Object | JSON) : The selected field of the
|
|
63
|
+
: msg (Object | JSON) : The selected field of the _msg_, eg _payload_, will be used as the input for the query or can be directly set as JSON.
|
|
54
64
|
: query (Object) : The query that was used.
|
|
65
|
+
: limit (number) : The maximum number of ProcessInstances to return, can be overridden by the _msg.limit_.
|
|
66
|
+
: offset (number) : The index of the first ProcessInstance to include in the result set, can be overridden by the _msg.offset_.
|
|
55
67
|
|
|
56
68
|
## Outputs
|
|
57
69
|
|
|
@@ -60,119 +72,114 @@ A node to query process instances on the ProcessCube Engine.
|
|
|
60
72
|
|
|
61
73
|
### Query fields
|
|
62
74
|
|
|
63
|
-
**Summary**:
|
|
75
|
+
**Summary**:
|
|
64
76
|
|
|
65
77
|
**Description**: Gets all ProcessInstances that match the given query.
|
|
66
78
|
|
|
67
79
|
#### Parameters:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
-
|
|
75
|
-
|
|
76
|
-
- string
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
-
|
|
81
|
-
|
|
82
|
-
- string
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
-
|
|
87
|
-
|
|
88
|
-
- string
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
-
|
|
93
|
-
|
|
94
|
-
- string
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
- string
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
-
|
|
105
|
-
|
|
106
|
-
- string
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
-
|
|
111
|
-
|
|
112
|
-
- string
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
-
|
|
117
|
-
|
|
118
|
-
- string
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
-
|
|
123
|
-
|
|
124
|
-
- string
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
-
|
|
129
|
-
|
|
130
|
-
- string
|
|
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
|
-
- Type: Array<string> | string | SearchQuery
|
|
169
|
-
- string: myFlowNodeInstance_12345678
|
|
170
|
-
- array: myFlowNodeInstance_12345678,myFlowNodeInstance_87654321
|
|
171
|
-
- object:
|
|
172
|
-
- Description: Filter by the ID of the FlowNodeInstance that triggered the ProcessInstance.
|
|
80
|
+
|
|
81
|
+
- Name: `correlationId` Required: `false`
|
|
82
|
+
- Type: Array<string> | string | SearchQuery
|
|
83
|
+
- string: myCorrelationId
|
|
84
|
+
- Array<string>: myCorrelationId1,myCorrelationId2
|
|
85
|
+
- object:
|
|
86
|
+
- Description: Filter by the CorrelationId of the ProcessInstances.
|
|
87
|
+
- Name: `processInstanceId` Required: ``
|
|
88
|
+
- Type: Array<string> | string | SearchQuery
|
|
89
|
+
- string: myProcessInstance_12345678
|
|
90
|
+
- Array<string>: myProcessInstance_12345678,myProcessInstance_87654321
|
|
91
|
+
- object:
|
|
92
|
+
- Description: Filter by the ID of the ProcessInstances.
|
|
93
|
+
- Name: `processDefinitionId` Required: ``
|
|
94
|
+
- Type: Array<string> | string | SearchQuery
|
|
95
|
+
- string: myProcess_12345678
|
|
96
|
+
- Array<string>: myProcess_12345678,myProcess_87654321
|
|
97
|
+
- object:
|
|
98
|
+
- Description: Filter by the ID of the ProcessDefinition that the ProcessInstances belong to.
|
|
99
|
+
- Name: `processModelId` Required: ``
|
|
100
|
+
- Type: Array<string> | string | SearchQuery
|
|
101
|
+
- string: myProcessModel_12345678
|
|
102
|
+
- Array<string>: myProcessModel_12345678,myProcessModel_87654321
|
|
103
|
+
- object:
|
|
104
|
+
- Description: Filter by the ID of the ProcessModel that the ProcessInstances belong to.
|
|
105
|
+
- Name: `processModelName` Required: ``
|
|
106
|
+
- Type: Array<string> | string | SearchQuery
|
|
107
|
+
- string: My Process Model
|
|
108
|
+
- Array<string>: My Process Model,My Other Process Model
|
|
109
|
+
- object:
|
|
110
|
+
- Description: Filter by the name of the ProcessModel that the ProcessInstances belong to.
|
|
111
|
+
- Name: `processModelHash` Required: ``
|
|
112
|
+
- Type: Array<string> | string | SearchQuery
|
|
113
|
+
- string: 12345678
|
|
114
|
+
- Array<string>: 12345678,87654321
|
|
115
|
+
- object:
|
|
116
|
+
- Description: Filter by the hash of the ProcessModel that the ProcessInstances belong to.
|
|
117
|
+
- Name: `ownerId` Required: ``
|
|
118
|
+
- Type: Array<string> | string | SearchQuery
|
|
119
|
+
- string: 12345678
|
|
120
|
+
- Array<string>: 12345678,87654321
|
|
121
|
+
- object:
|
|
122
|
+
- Description: Filter by the ID of the User that owns the ProcessInstances.
|
|
123
|
+
- Name: `state` Required: ``
|
|
124
|
+
- Type: Array<string> | string | SearchQuery
|
|
125
|
+
- string: running
|
|
126
|
+
- Array<string>: running,finished
|
|
127
|
+
- object:
|
|
128
|
+
- Description: Filter by the state of the ProcessInstances.
|
|
129
|
+
- Name: `parentProcessInstanceId` Required: ``
|
|
130
|
+
- Type: Array<string> | string | SearchQuery
|
|
131
|
+
- string: myParentProcessInstance_12345678
|
|
132
|
+
- Array<string>: myParentProcessInstance_12345678,myParentProcessInstance_87654321
|
|
133
|
+
- object:
|
|
134
|
+
- Description: Filter by the ID of the parent ProcessInstance.
|
|
135
|
+
- Name: `terminatedByUserId` Required: ``
|
|
136
|
+
- Type: Array<string> | string | SearchQuery
|
|
137
|
+
- string: 12345678
|
|
138
|
+
- Array<string>: 12345678,87654321
|
|
139
|
+
- object:
|
|
140
|
+
- Description: Filter by the ID of the User that terminated the ProcessInstances.
|
|
141
|
+
- Name: `createdBefore` Required: ``
|
|
142
|
+
- Type: string
|
|
143
|
+
- Description: The maximum created date of the ProcessInstances to include in the results.
|
|
144
|
+
- Name: `createdAt` Required: ``
|
|
145
|
+
- Type: Array<string> | string
|
|
146
|
+
- string: 2021-01-01T00:00:00.000Z
|
|
147
|
+
- array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
|
|
148
|
+
- Description: The minimum created date of the ProcessInstances to include in the results.
|
|
149
|
+
- Name: `createdAfter` Required: ``
|
|
150
|
+
- Type: string
|
|
151
|
+
- Description: The minimum created date of the ProcessInstances to include in the results.
|
|
152
|
+
- Name: `updatedBefore` Required: ``
|
|
153
|
+
- Type: string
|
|
154
|
+
- Description: The maximum updated date of the ProcessInstances to include in the results.
|
|
155
|
+
- Name: `updatedAt` Required: ``
|
|
156
|
+
- Type: Array<string> | string
|
|
157
|
+
- string: 2021-01-01T00:00:00.000Z
|
|
158
|
+
- array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
|
|
159
|
+
- Description: The exact updated date of the ProcessInstances to include in the results.
|
|
160
|
+
- Name: `updatedAfter` Required: ``
|
|
161
|
+
- Type: string
|
|
162
|
+
- Description: The minimum updated date of the ProcessInstances to include in the results.
|
|
163
|
+
- Name: `finishedBefore` Required: ``
|
|
164
|
+
- Type: string
|
|
165
|
+
- Description: The maximum finished date of the ProcessInstances to include in the results.
|
|
166
|
+
- Name: `finishedAt` Required: ``
|
|
167
|
+
- Type: Array<string> | string
|
|
168
|
+
- string: 2021-01-01T00:00:00.000Z
|
|
169
|
+
- array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
|
|
170
|
+
- Description: The exact finished date of the ProcessInstances to include in the results.
|
|
171
|
+
- Name: `finishedAfter` Required: ``
|
|
172
|
+
- Type: string
|
|
173
|
+
- Description: The minimum finished date of the ProcessInstances to include in the results.
|
|
174
|
+
- Name: `triggeredByFlowNodeInstance` Required: ``
|
|
175
|
+
- Type: Array<string> | string | SearchQuery
|
|
176
|
+
- string: myFlowNodeInstance_12345678
|
|
177
|
+
- array: myFlowNodeInstance_12345678,myFlowNodeInstance_87654321
|
|
178
|
+
- object:
|
|
179
|
+
- Description: Filter by the ID of the FlowNodeInstance that triggered the ProcessInstance.
|
|
173
180
|
|
|
174
181
|
### References
|
|
175
182
|
|
|
176
|
-
-
|
|
177
|
-
-
|
|
183
|
+
- [The ProcessCube© Developer Network](https://processcube.io) - All documentation for the ProcessCube© platform
|
|
184
|
+
- [ProcessCube© LowCode Integration](https://processcube.io/docs/node-red) - LowCode integration in ProcessCube©
|
|
178
185
|
</script>
|
package/processinstance-query.js
CHANGED
|
@@ -5,24 +5,47 @@ module.exports = function (RED) {
|
|
|
5
5
|
|
|
6
6
|
node.on('input', function (msg) {
|
|
7
7
|
let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
|
|
8
|
+
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
const client = engine.engineClient;
|
|
10
|
+
node.engine = RED.nodes.getNode(config.engine);
|
|
11
|
+
const client = node.engine.engineClient;
|
|
12
|
+
const isUser = !!msg._client?.user && !!msg._client.user.accessToken;
|
|
13
|
+
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
|
|
11
14
|
|
|
12
15
|
if (!client) {
|
|
13
|
-
node.error('No engine configured.');
|
|
16
|
+
node.error('No engine configured.', msg);
|
|
14
17
|
return;
|
|
15
18
|
}
|
|
16
19
|
|
|
20
|
+
let query_options = {identity: userIdentity};
|
|
21
|
+
|
|
22
|
+
let limit = config.limit;
|
|
23
|
+
if (msg.limit !== undefined) {
|
|
24
|
+
limit = msg.limit;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (limit) {
|
|
28
|
+
query_options.limit = limit;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let offset = config.offset;
|
|
32
|
+
if (msg.offset !== undefined) {
|
|
33
|
+
offset = msg.offset;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (offset) {
|
|
37
|
+
query_options.offset = offset;
|
|
38
|
+
}
|
|
39
|
+
|
|
17
40
|
client.processInstances
|
|
18
|
-
.query(query,
|
|
41
|
+
.query(query, query_options)
|
|
19
42
|
.then((matchingInstances) => {
|
|
20
43
|
msg.payload = matchingInstances;
|
|
21
44
|
|
|
22
45
|
node.send(msg);
|
|
23
46
|
})
|
|
24
47
|
.catch((error) => {
|
|
25
|
-
node.error(`Processinstancequery failed: ${error.message}
|
|
48
|
+
node.error(`Processinstancequery failed: ${error.message}`, msg);
|
|
26
49
|
});
|
|
27
50
|
});
|
|
28
51
|
}
|
package/signal-event-trigger.js
CHANGED
|
@@ -4,20 +4,22 @@ 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
|
+
const isUser = !!msg._client?.user && !!msg._client.user.accessToken;
|
|
11
|
+
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
|
|
10
12
|
|
|
11
13
|
if (!client) {
|
|
12
|
-
node.error('No engine configured.');
|
|
14
|
+
node.error('No engine configured.', msg);
|
|
13
15
|
return;
|
|
14
16
|
}
|
|
15
|
-
|
|
17
|
+
|
|
16
18
|
client.events
|
|
17
19
|
.triggerSignalEvent(config.signalname, {
|
|
18
20
|
processInstanceId: msg.processinstanceid,
|
|
19
21
|
payload: msg.payload,
|
|
20
|
-
identity:
|
|
22
|
+
identity: userIdentity
|
|
21
23
|
})
|
|
22
24
|
.then((result) => {
|
|
23
25
|
msg.payload = result;
|
|
@@ -30,7 +32,7 @@ module.exports = function (RED) {
|
|
|
30
32
|
});
|
|
31
33
|
})
|
|
32
34
|
.catch((error) => {
|
|
33
|
-
node.error(error);
|
|
35
|
+
node.error(error, msg);
|
|
34
36
|
});
|
|
35
37
|
});
|
|
36
38
|
}
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
outputs: 1,
|
|
15
15
|
icon: 'usertask_event_listener.svg',
|
|
16
16
|
label: function () {
|
|
17
|
-
return this.name || 'usertask-event-listener';
|
|
17
|
+
return this.name || (this.eventtype ? `usertask: ${this.eventtype}` : 'usertask-event-listener');
|
|
18
|
+
|
|
18
19
|
},
|
|
19
20
|
oneditprepare: function () {
|
|
20
21
|
$('#node-input-query').typedInput({
|
|
@@ -74,6 +75,127 @@ A node which listens for events triggered by usertasks
|
|
|
74
75
|
: action (string): The event that occured.
|
|
75
76
|
: type (string): The target of the event.
|
|
76
77
|
|
|
78
|
+
|
|
79
|
+
### Query fields
|
|
80
|
+
|
|
81
|
+
**Summary**:
|
|
82
|
+
|
|
83
|
+
**Description**: Filter result for 'UserTask Event Listener'
|
|
84
|
+
|
|
85
|
+
#### Parameters:
|
|
86
|
+
- Name: `offset` Required: `false`
|
|
87
|
+
- Type: number
|
|
88
|
+
- Description: The index of the first ProcessInstance to include in the result set.
|
|
89
|
+
- Name: `limit` Required: `false`
|
|
90
|
+
- Type: number
|
|
91
|
+
- Description: The maximum number of ProcessInstances to return.
|
|
92
|
+
- Name: `correlationId` Required: `false`
|
|
93
|
+
- Type: Array<string> | string | SearchQuery
|
|
94
|
+
- string: myCorrelationId
|
|
95
|
+
- Array<string>: myCorrelationId1,myCorrelationId2
|
|
96
|
+
- object:
|
|
97
|
+
- Description: Filter by the CorrelationId of the ProcessInstances.
|
|
98
|
+
- Name: `processInstanceId` Required: ``
|
|
99
|
+
- Type: Array<string> | string | SearchQuery
|
|
100
|
+
- string: myProcessInstance_12345678
|
|
101
|
+
- Array<string>: myProcessInstance_12345678,myProcessInstance_87654321
|
|
102
|
+
- object:
|
|
103
|
+
- Description: Filter by the ID of the ProcessInstances.
|
|
104
|
+
- Name: `processDefinitionId` Required: ``
|
|
105
|
+
- Type: Array<string> | string | SearchQuery
|
|
106
|
+
- string: myProcess_12345678
|
|
107
|
+
- Array<string>: myProcess_12345678,myProcess_87654321
|
|
108
|
+
- object:
|
|
109
|
+
- Description: Filter by the ID of the ProcessDefinition that the ProcessInstances belong to.
|
|
110
|
+
- Name: `processModelId` Required: ``
|
|
111
|
+
- Type: Array<string> | string | SearchQuery
|
|
112
|
+
- string: myProcessModel_12345678
|
|
113
|
+
- Array<string>: myProcessModel_12345678,myProcessModel_87654321
|
|
114
|
+
- object:
|
|
115
|
+
- Description: Filter by the ID of the ProcessModel that the ProcessInstances belong to.
|
|
116
|
+
- Name: `processModelName` Required: ``
|
|
117
|
+
- Type: Array<string> | string | SearchQuery
|
|
118
|
+
- string: My Process Model
|
|
119
|
+
- Array<string>: My Process Model,My Other Process Model
|
|
120
|
+
- object:
|
|
121
|
+
- Description: Filter by the name of the ProcessModel that the ProcessInstances belong to.
|
|
122
|
+
- Name: `processModelHash` Required: ``
|
|
123
|
+
- Type: Array<string> | string | SearchQuery
|
|
124
|
+
- string: 12345678
|
|
125
|
+
- Array<string>: 12345678,87654321
|
|
126
|
+
- object:
|
|
127
|
+
- Description: Filter by the hash of the ProcessModel that the ProcessInstances belong to.
|
|
128
|
+
- Name: `ownerId` Required: ``
|
|
129
|
+
- Type: Array<string> | string | SearchQuery
|
|
130
|
+
- string: 12345678
|
|
131
|
+
- Array<string>: 12345678,87654321
|
|
132
|
+
- object:
|
|
133
|
+
- Description: Filter by the ID of the User that owns the ProcessInstances.
|
|
134
|
+
- Name: `state` Required: ``
|
|
135
|
+
- Type: Array<string> | string | SearchQuery
|
|
136
|
+
- string: running
|
|
137
|
+
- Array<string>: running,finished
|
|
138
|
+
- object:
|
|
139
|
+
- Description: Filter by the state of the ProcessInstances.
|
|
140
|
+
- Name: `parentProcessInstanceId` Required: ``
|
|
141
|
+
- Type: Array<string> | string | SearchQuery
|
|
142
|
+
- string: myParentProcessInstance_12345678
|
|
143
|
+
- Array<string>: myParentProcessInstance_12345678,myParentProcessInstance_87654321
|
|
144
|
+
- object:
|
|
145
|
+
- Description: Filter by the ID of the parent ProcessInstance.
|
|
146
|
+
- Name: `embeddedProcessModelId` Required: ``
|
|
147
|
+
- Type: Array<string> | string | SearchQuery
|
|
148
|
+
- string: myModel1
|
|
149
|
+
- Array<string>: myModel1,myModel2
|
|
150
|
+
- object:
|
|
151
|
+
- Description: Filter by the ID of the embedded process model.
|
|
152
|
+
- Name: `terminatedByUserId` Required: ``
|
|
153
|
+
- Type: Array<string> | string | SearchQuery
|
|
154
|
+
- string: 12345678
|
|
155
|
+
- Array<string>: 12345678,87654321
|
|
156
|
+
- object:
|
|
157
|
+
- Description: Filter by the ID of the User that terminated the ProcessInstances.
|
|
158
|
+
- Name: `createdBefore` Required: ``
|
|
159
|
+
- Type: string
|
|
160
|
+
- Description: The maximum created date of the ProcessInstances to include in the results.
|
|
161
|
+
- Name: `createdAt` Required: ``
|
|
162
|
+
- Type: Array<string> | string
|
|
163
|
+
- string: 2021-01-01T00:00:00.000Z
|
|
164
|
+
- array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
|
|
165
|
+
- Description: The minimum created date of the ProcessInstances to include in the results.
|
|
166
|
+
- Name: `createdAfter` Required: ``
|
|
167
|
+
- Type: string
|
|
168
|
+
- Description: The minimum created date of the ProcessInstances to include in the results.
|
|
169
|
+
- Name: `updatedBefore` Required: ``
|
|
170
|
+
- Type: string
|
|
171
|
+
- Description: The maximum updated date of the ProcessInstances to include in the results.
|
|
172
|
+
- Name: `updatedAt` Required: ``
|
|
173
|
+
- Type: Array<string> | string
|
|
174
|
+
- string: 2021-01-01T00:00:00.000Z
|
|
175
|
+
- array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
|
|
176
|
+
- Description: The exact updated date of the ProcessInstances to include in the results.
|
|
177
|
+
- Name: `updatedAfter` Required: ``
|
|
178
|
+
- Type: string
|
|
179
|
+
- Description: The minimum updated date of the ProcessInstances to include in the results.
|
|
180
|
+
- Name: `finishedBefore` Required: ``
|
|
181
|
+
- Type: string
|
|
182
|
+
- Description: The maximum finished date of the ProcessInstances to include in the results.
|
|
183
|
+
- Name: `finishedAt` Required: ``
|
|
184
|
+
- Type: Array<string> | string
|
|
185
|
+
- string: 2021-01-01T00:00:00.000Z
|
|
186
|
+
- array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
|
|
187
|
+
- Description: The exact finished date of the ProcessInstances to include in the results.
|
|
188
|
+
- Name: `finishedAfter` Required: ``
|
|
189
|
+
- Type: string
|
|
190
|
+
- Description: The minimum finished date of the ProcessInstances to include in the results.
|
|
191
|
+
- Name: `triggeredByFlowNodeInstance` Required: ``
|
|
192
|
+
- Type: Array<string> | string | SearchQuery
|
|
193
|
+
- string: myFlowNodeInstance_12345678
|
|
194
|
+
- array: myFlowNodeInstance_12345678,myFlowNodeInstance_87654321
|
|
195
|
+
- object:
|
|
196
|
+
- Description: Filter by the ID of the FlowNodeInstance that triggered the ProcessInstance.
|
|
197
|
+
|
|
198
|
+
|
|
77
199
|
### References
|
|
78
200
|
|
|
79
201
|
- [The ProcessCube© Developer Network](https://processcube.io) - All documentation for the ProcessCube© platform
|
|
@@ -4,43 +4,45 @@ module.exports = function (RED) {
|
|
|
4
4
|
var node = this;
|
|
5
5
|
node.engine = RED.nodes.getNode(config.engine);
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
let currentIdentity = node.engine.identity;
|
|
7
|
+
let subscription;
|
|
9
8
|
|
|
9
|
+
const register = async () => {
|
|
10
10
|
const client = node.engine.engineClient;
|
|
11
11
|
|
|
12
12
|
if (!client) {
|
|
13
|
-
node.error('No engine configured.');
|
|
13
|
+
node.error('No engine configured.', {});
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
let subscription;
|
|
18
17
|
const query = RED.util.evaluateNodeProperty(config.query, config.query_type, node);
|
|
19
18
|
|
|
20
19
|
function userTaskCallback() {
|
|
21
20
|
return async (userTaskNotification) => {
|
|
22
21
|
if (config.usertask != '' && config.usertask != userTaskNotification.flowNodeId) return;
|
|
22
|
+
|
|
23
23
|
const newQuery = {
|
|
24
24
|
flowNodeInstanceId: userTaskNotification.flowNodeInstanceId,
|
|
25
25
|
...query,
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
28
|
+
try {
|
|
29
|
+
const matchingFlowNodes = await client.userTasks.query(newQuery);
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
if (matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length == 1) {
|
|
32
|
+
const userTask = matchingFlowNodes.userTasks[0];
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
node.send({
|
|
35
|
+
payload: {
|
|
36
|
+
flowNodeInstanceId: userTaskNotification.flowNodeInstanceId,
|
|
37
|
+
userTaskEvent: userTaskNotification,
|
|
38
|
+
userTask: userTask,
|
|
39
|
+
action: config.eventtype,
|
|
40
|
+
type: 'usertask',
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
} catch (error) {
|
|
45
|
+
node.error(error, {});
|
|
44
46
|
}
|
|
45
47
|
};
|
|
46
48
|
}
|
|
@@ -48,48 +50,31 @@ module.exports = function (RED) {
|
|
|
48
50
|
async function subscribe() {
|
|
49
51
|
switch (config.eventtype) {
|
|
50
52
|
case 'new':
|
|
51
|
-
return await client.userTasks.onUserTaskWaiting(userTaskCallback()
|
|
52
|
-
identity: currentIdentity,
|
|
53
|
-
});
|
|
53
|
+
return await client.userTasks.onUserTaskWaiting(userTaskCallback());
|
|
54
54
|
case 'finished':
|
|
55
|
-
return await client.userTasks.onUserTaskFinished(userTaskCallback()
|
|
56
|
-
identity: currentIdentity,
|
|
57
|
-
});
|
|
55
|
+
return await client.userTasks.onUserTaskFinished(userTaskCallback());
|
|
58
56
|
case 'reserved':
|
|
59
|
-
return await client.userTasks.onUserTaskReserved(userTaskCallback()
|
|
60
|
-
identity: currentIdentity,
|
|
61
|
-
});
|
|
57
|
+
return await client.userTasks.onUserTaskReserved(userTaskCallback());
|
|
62
58
|
case 'reservation-canceled':
|
|
63
|
-
return await client.userTasks.onUserTaskReservationCanceled(userTaskCallback()
|
|
64
|
-
identity: currentIdentity,
|
|
65
|
-
});
|
|
59
|
+
return await client.userTasks.onUserTaskReservationCanceled(userTaskCallback());
|
|
66
60
|
default:
|
|
67
|
-
|
|
61
|
+
node.error('no such event: ' + config.eventtype, {});
|
|
68
62
|
}
|
|
69
63
|
}
|
|
70
64
|
|
|
71
|
-
|
|
72
|
-
subscription = subscribe();
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
node.engine.registerOnIdentityChanged(async (identity) => {
|
|
76
|
-
if (subscription) {
|
|
77
|
-
client.userTasks.removeSubscription(subscription, currentIdentity);
|
|
78
|
-
}
|
|
79
|
-
currentIdentity = identity;
|
|
80
|
-
|
|
81
|
-
subscription = subscribe();
|
|
82
|
-
});
|
|
65
|
+
subscription = subscribe();
|
|
83
66
|
|
|
84
67
|
node.on('close', async () => {
|
|
85
68
|
if (node.engine && node.engine.engineClient && client) {
|
|
86
|
-
client.userTasks.removeSubscription(subscription
|
|
69
|
+
client.userTasks.removeSubscription(subscription);
|
|
87
70
|
}
|
|
88
71
|
});
|
|
89
72
|
};
|
|
90
73
|
|
|
91
74
|
if (node.engine) {
|
|
92
|
-
register()
|
|
75
|
+
register().catch((error) => {
|
|
76
|
+
node.error(error, {});
|
|
77
|
+
});
|
|
93
78
|
}
|
|
94
79
|
}
|
|
95
80
|
RED.nodes.registerType('usertask-event-listener', UserTaskEventListener);
|