@5minds/node-red-contrib-processcube 1.7.5-develop-106e2c-m6jdhezm → 1.7.5-feature-f9d61e-m6l18es1
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.js +2 -3
- package/.processcube/nodered/settings.js +1 -1
- package/README.md +8 -2
- package/doc_generator/generator.js +5 -5
- package/doc_generator/generator_with_swagger.js +80 -78
- package/endevent-finished-listener.html +16 -16
- package/externaltask-error.html +11 -11
- package/externaltask-error.js +3 -1
- package/externaltask-event-listener.html +9 -9
- package/externaltask-input.html +26 -26
- package/externaltask-input.js +6 -7
- package/externaltask-output.html +7 -7
- package/message-event-trigger.html +8 -8
- package/message-event-trigger.js +3 -0
- package/package.json +5 -2
- package/process-event-listener.html +74 -74
- package/process-event-listener.js +1 -2
- package/process-start.html +12 -12
- package/process-start.js +6 -3
- package/process-terminate.html +9 -9
- package/process-terminate.js +3 -1
- package/processcube-engine-config.html +8 -8
- package/processcube-engine-config.js +0 -2
- package/processdefinition-deploy.html +9 -9
- package/processdefinition-deploy.js +4 -2
- package/processdefinition-query.html +139 -140
- package/processdefinition-query.js +4 -0
- package/processinstance-delete.html +48 -46
- package/processinstance-delete.js +24 -9
- package/processinstance-query.html +120 -119
- package/processinstance-query.js +3 -1
- package/signal-event-trigger.html +8 -9
- package/signal-event-trigger.js +3 -0
- package/usertask-event-listener.html +126 -127
- package/usertask-input.html +126 -125
- package/usertask-input.js +3 -1
- package/usertask-output.html +7 -7
- package/usertask-output.js +5 -2
- package/wait-for-usertask.html +173 -164
- package/wait-for-usertask.js +36 -25
package/wait-for-usertask.html
CHANGED
@@ -1,196 +1,205 @@
|
|
1
1
|
<script type="text/javascript">
|
2
|
-
RED.nodes.registerType('wait-for-usertask',{
|
2
|
+
RED.nodes.registerType('wait-for-usertask', {
|
3
3
|
category: 'ProcessCube',
|
4
4
|
color: '#02AFD6',
|
5
5
|
defaults: {
|
6
|
-
name: {value:
|
7
|
-
engine: {value:
|
8
|
-
query: {value:
|
9
|
-
query_type: {value:
|
10
|
-
only_for_new: {value: false}
|
6
|
+
name: { value: '' },
|
7
|
+
engine: { value: '', type: 'processcube-engine-config' },
|
8
|
+
query: { value: 'payload' },
|
9
|
+
query_type: { value: 'msg' },
|
10
|
+
only_for_new: { value: false },
|
11
11
|
},
|
12
12
|
inputs: 1,
|
13
13
|
outputs: 1,
|
14
|
-
icon:
|
15
|
-
label: function() {
|
16
|
-
return this.name ||
|
14
|
+
icon: 'font-awesome/fa-envelope-open',
|
15
|
+
label: function () {
|
16
|
+
return this.name || 'wait-for-usertask';
|
17
17
|
},
|
18
|
-
oneditprepare: function() {
|
19
|
-
$(
|
18
|
+
oneditprepare: function () {
|
19
|
+
$('#node-input-query').typedInput({
|
20
20
|
default: 'msg',
|
21
|
-
types: ['msg', 'json']
|
21
|
+
types: ['msg', 'json'],
|
22
22
|
});
|
23
23
|
|
24
|
-
$(
|
25
|
-
$(
|
24
|
+
$('#node-input-query').typedInput('value', this.query);
|
25
|
+
$('#node-input-query').typedInput('type', this.query_type);
|
26
|
+
},
|
27
|
+
oneditsave: function () {
|
28
|
+
(this.query = $('#node-input-query').typedInput('value')),
|
29
|
+
(this.query_type = $('#node-input-query').typedInput('type'));
|
26
30
|
},
|
27
|
-
oneditsave: function() {
|
28
|
-
this.query = $("#node-input-query").typedInput('value'),
|
29
|
-
this.query_type = $("#node-input-query").typedInput('type')
|
30
|
-
|
31
|
-
}
|
32
31
|
});
|
33
32
|
</script>
|
34
33
|
|
35
34
|
<script type="text/html" data-template-name="wait-for-usertask">
|
36
35
|
<div class="form-row">
|
37
36
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
38
|
-
<input type="text" id="node-input-name" placeholder="Name"
|
37
|
+
<input type="text" id="node-input-name" placeholder="Name" />
|
39
38
|
</div>
|
40
39
|
<div class="form-row">
|
41
40
|
<label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
|
42
|
-
<input type="text" id="node-input-engine" placeholder="http://engine:8000"
|
41
|
+
<input type="text" id="node-input-engine" placeholder="http://engine:8000" />
|
43
42
|
</div>
|
44
43
|
<div class="form-row">
|
45
44
|
<label for="node-input-query"><i class="fa fa-tag"></i> Query</label>
|
46
|
-
<input type="text" id="node-input-query"
|
45
|
+
<input type="text" id="node-input-query" />
|
47
46
|
</div>
|
48
47
|
<div class="form-row" style="display:flex; margin-bottom: 3px;">
|
49
|
-
<label for="node-input-only_for_new" style="vertical-align:top"
|
48
|
+
<label for="node-input-only_for_new" style="vertical-align:top"
|
49
|
+
><i class="fa fa-list-alt"></i> Only for new</label
|
50
|
+
>
|
50
51
|
<div>
|
51
|
-
<input
|
52
|
-
|
52
|
+
<input
|
53
|
+
type="checkbox"
|
54
|
+
checked
|
55
|
+
id="node-input-only_for_new"
|
56
|
+
style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;"
|
57
|
+
/>
|
58
|
+
<label style="width:auto" for="node-input-multisend"
|
59
|
+
>Trigger only for new user task or *checked* also for old ones?</label
|
60
|
+
>
|
53
61
|
</div>
|
54
62
|
</div>
|
55
63
|
</script>
|
56
64
|
|
57
65
|
<script type="text/markdown" data-help-name="wait-for-usertask">
|
58
|
-
Waiting for Usertasks of the connected ProcessCube Engine.
|
59
|
-
|
60
|
-
### Inputs
|
61
|
-
|
62
|
-
: payload (json)
|
63
|
-
|
64
|
-
## Outputs
|
65
|
-
|
66
|
-
: payload.userTask (string) : The filtered UserTask
|
67
|
-
|
68
|
-
### Details
|
69
|
-
|
70
|
-
- `msg.payload` or a constant json to filter the UserTasks for Waiting for
|
71
|
-
- `Only for new` will trigger only for new UserTasks if checked and also for old ones if not checked.
|
72
|
-
|
73
|
-
### Query fields
|
74
|
-
|
75
|
-
**Summary**:
|
76
|
-
|
77
|
-
**Description**: Filter result for 'Wait for UserTask'
|
78
|
-
|
79
|
-
#### Parameters:
|
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
|
-
|
66
|
+
Waiting for Usertasks of the connected ProcessCube Engine.
|
67
|
+
|
68
|
+
### Inputs
|
69
|
+
|
70
|
+
: payload (json) : the query to filter the usertasks.
|
71
|
+
|
72
|
+
## Outputs
|
73
|
+
|
74
|
+
: payload.userTask (string) : The filtered UserTask
|
75
|
+
|
76
|
+
### Details
|
77
|
+
|
78
|
+
- `msg.payload` or a constant json to filter the UserTasks for Waiting for
|
79
|
+
- `Only for new` will trigger only for new UserTasks if checked and also for old ones if not checked.
|
80
|
+
|
81
|
+
### Query fields
|
82
|
+
|
83
|
+
**Summary**:
|
84
|
+
|
85
|
+
**Description**: Filter result for 'Wait for UserTask'
|
86
|
+
|
87
|
+
#### Parameters:
|
88
|
+
|
89
|
+
- Name: `offset` Required: `false`
|
90
|
+
- Type: number
|
91
|
+
- Description: The index of the first ProcessInstance to include in the result set.
|
92
|
+
- Name: `limit` Required: `false`
|
93
|
+
- Type: number
|
94
|
+
- Description: The maximum number of ProcessInstances to return.
|
95
|
+
- Name: `correlationId` Required: `false`
|
96
|
+
- Type: Array<string> | string | SearchQuery
|
97
|
+
- string: myCorrelationId
|
98
|
+
- Array<string>: myCorrelationId1,myCorrelationId2
|
99
|
+
- object:
|
100
|
+
- Description: Filter by the CorrelationId of the ProcessInstances.
|
101
|
+
- Name: `processInstanceId` Required: ``
|
102
|
+
- Type: Array<string> | string | SearchQuery
|
103
|
+
- string: myProcessInstance_12345678
|
104
|
+
- Array<string>: myProcessInstance_12345678,myProcessInstance_87654321
|
105
|
+
- object:
|
106
|
+
- Description: Filter by the ID of the ProcessInstances.
|
107
|
+
- Name: `processDefinitionId` Required: ``
|
108
|
+
- Type: Array<string> | string | SearchQuery
|
109
|
+
- string: myProcess_12345678
|
110
|
+
- Array<string>: myProcess_12345678,myProcess_87654321
|
111
|
+
- object:
|
112
|
+
- Description: Filter by the ID of the ProcessDefinition that the ProcessInstances belong to.
|
113
|
+
- Name: `processModelId` Required: ``
|
114
|
+
- Type: Array<string> | string | SearchQuery
|
115
|
+
- string: myProcessModel_12345678
|
116
|
+
- Array<string>: myProcessModel_12345678,myProcessModel_87654321
|
117
|
+
- object:
|
118
|
+
- Description: Filter by the ID of the ProcessModel that the ProcessInstances belong to.
|
119
|
+
- Name: `processModelName` Required: ``
|
120
|
+
- Type: Array<string> | string | SearchQuery
|
121
|
+
- string: My Process Model
|
122
|
+
- Array<string>: My Process Model,My Other Process Model
|
123
|
+
- object:
|
124
|
+
- Description: Filter by the name of the ProcessModel that the ProcessInstances belong to.
|
125
|
+
- Name: `processModelHash` Required: ``
|
126
|
+
- Type: Array<string> | string | SearchQuery
|
127
|
+
- string: 12345678
|
128
|
+
- Array<string>: 12345678,87654321
|
129
|
+
- object:
|
130
|
+
- Description: Filter by the hash of the ProcessModel that the ProcessInstances belong to.
|
131
|
+
- Name: `ownerId` Required: ``
|
132
|
+
- Type: Array<string> | string | SearchQuery
|
133
|
+
- string: 12345678
|
134
|
+
- Array<string>: 12345678,87654321
|
135
|
+
- object:
|
136
|
+
- Description: Filter by the ID of the User that owns the ProcessInstances.
|
137
|
+
- Name: `state` Required: ``
|
138
|
+
- Type: Array<string> | string | SearchQuery
|
139
|
+
- string: running
|
140
|
+
- Array<string>: running,finished
|
141
|
+
- object:
|
142
|
+
- Description: Filter by the state of the ProcessInstances.
|
143
|
+
- Name: `parentProcessInstanceId` Required: ``
|
144
|
+
- Type: Array<string> | string | SearchQuery
|
145
|
+
- string: myParentProcessInstance_12345678
|
146
|
+
- Array<string>: myParentProcessInstance_12345678,myParentProcessInstance_87654321
|
147
|
+
- object:
|
148
|
+
- Description: Filter by the ID of the parent ProcessInstance.
|
149
|
+
- Name: `embeddedProcessModelId` Required: ``
|
150
|
+
- Type: Array<string> | string | SearchQuery
|
151
|
+
- string: myModel1
|
152
|
+
- Array<string>: myModel1,myModel2
|
153
|
+
- object:
|
154
|
+
- Description: Filter by the ID of the embedded process model.
|
155
|
+
- Name: `terminatedByUserId` Required: ``
|
156
|
+
- Type: Array<string> | string | SearchQuery
|
157
|
+
- string: 12345678
|
158
|
+
- Array<string>: 12345678,87654321
|
159
|
+
- object:
|
160
|
+
- Description: Filter by the ID of the User that terminated the ProcessInstances.
|
161
|
+
- Name: `createdBefore` Required: ``
|
162
|
+
- Type: string
|
163
|
+
- Description: The maximum created date of the ProcessInstances to include in the results.
|
164
|
+
- Name: `createdAt` Required: ``
|
165
|
+
- Type: Array<string> | string
|
166
|
+
- string: 2021-01-01T00:00:00.000Z
|
167
|
+
- array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
|
168
|
+
- Description: The minimum created date of the ProcessInstances to include in the results.
|
169
|
+
- Name: `createdAfter` Required: ``
|
170
|
+
- Type: string
|
171
|
+
- Description: The minimum created date of the ProcessInstances to include in the results.
|
172
|
+
- Name: `updatedBefore` Required: ``
|
173
|
+
- Type: string
|
174
|
+
- Description: The maximum updated date of the ProcessInstances to include in the results.
|
175
|
+
- Name: `updatedAt` Required: ``
|
176
|
+
- Type: Array<string> | string
|
177
|
+
- string: 2021-01-01T00:00:00.000Z
|
178
|
+
- array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
|
179
|
+
- Description: The exact updated date of the ProcessInstances to include in the results.
|
180
|
+
- Name: `updatedAfter` Required: ``
|
181
|
+
- Type: string
|
182
|
+
- Description: The minimum updated date of the ProcessInstances to include in the results.
|
183
|
+
- Name: `finishedBefore` Required: ``
|
184
|
+
- Type: string
|
185
|
+
- Description: The maximum finished date of the ProcessInstances to include in the results.
|
186
|
+
- Name: `finishedAt` Required: ``
|
187
|
+
- Type: Array<string> | string
|
188
|
+
- string: 2021-01-01T00:00:00.000Z
|
189
|
+
- array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
|
190
|
+
- Description: The exact finished date of the ProcessInstances to include in the results.
|
191
|
+
- Name: `finishedAfter` Required: ``
|
192
|
+
- Type: string
|
193
|
+
- Description: The minimum finished date of the ProcessInstances to include in the results.
|
194
|
+
- Name: `triggeredByFlowNodeInstance` Required: ``
|
195
|
+
- Type: Array<string> | string | SearchQuery
|
196
|
+
- string: myFlowNodeInstance_12345678
|
197
|
+
- array: myFlowNodeInstance_12345678,myFlowNodeInstance_87654321
|
198
|
+
- object:
|
199
|
+
- Description: Filter by the ID of the FlowNodeInstance that triggered the ProcessInstance.
|
200
|
+
|
201
|
+
### References
|
202
|
+
|
203
|
+
- [The ProcessCube© Developer Network](https://processcube.io) - All documentation for the ProcessCube© platform
|
204
|
+
- [ProcessCube© LowCode Integration](https://processcube.io/docs/node-red) - LowCode integration in ProcessCube©
|
205
|
+
</script>
|
package/wait-for-usertask.js
CHANGED
@@ -10,6 +10,8 @@ module.exports = function (RED) {
|
|
10
10
|
|
11
11
|
node.on('input', async function (msg) {
|
12
12
|
const client = node.engine.engineClient;
|
13
|
+
const isUser = !!msg._client?.user;
|
14
|
+
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
|
13
15
|
subscribe = async () => {
|
14
16
|
if (!client) {
|
15
17
|
node.error('No engine configured.', msg);
|
@@ -18,30 +20,37 @@ module.exports = function (RED) {
|
|
18
20
|
|
19
21
|
const query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
|
20
22
|
|
21
|
-
subscription = await client.userTasks.onUserTaskWaiting(
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
23
|
+
subscription = await client.userTasks.onUserTaskWaiting(
|
24
|
+
async (userTaskWaitingNotification) => {
|
25
|
+
const newQuery = {
|
26
|
+
flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
|
27
|
+
...query,
|
28
|
+
};
|
29
|
+
|
30
|
+
try {
|
31
|
+
const matchingFlowNodes = await client.userTasks.query(newQuery, {
|
32
|
+
identity: userIdentity,
|
33
|
+
});
|
34
|
+
|
35
|
+
if (matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length == 1) {
|
36
|
+
// remove subscription
|
37
|
+
client.userTasks.removeSubscription(subscription, userIdentity);
|
38
|
+
|
39
|
+
const userTask = matchingFlowNodes.userTasks[0];
|
40
|
+
|
41
|
+
msg.payload = { userTask: userTask };
|
42
|
+
node.send(msg);
|
43
|
+
} else {
|
44
|
+
// nothing todo - wait for next notification
|
45
|
+
}
|
46
|
+
} catch (error) {
|
47
|
+
node.error(error, msg);
|
40
48
|
}
|
41
|
-
}
|
42
|
-
|
43
|
-
|
44
|
-
|
49
|
+
},
|
50
|
+
{
|
51
|
+
identity: userIdentity,
|
52
|
+
},
|
53
|
+
);
|
45
54
|
|
46
55
|
node.log({ 'Handling old userTasks config.only_for_new': config.only_for_new });
|
47
56
|
|
@@ -53,7 +62,9 @@ module.exports = function (RED) {
|
|
53
62
|
};
|
54
63
|
|
55
64
|
try {
|
56
|
-
const matchingFlowNodes = await client.userTasks.query(suspendedQuery
|
65
|
+
const matchingFlowNodes = await client.userTasks.query(suspendedQuery, {
|
66
|
+
identity: userIdentity,
|
67
|
+
});
|
57
68
|
|
58
69
|
if (matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length >= 1) {
|
59
70
|
const userTask = matchingFlowNodes.userTasks[0];
|
@@ -62,7 +73,7 @@ module.exports = function (RED) {
|
|
62
73
|
node.send(msg);
|
63
74
|
|
64
75
|
// remove subscription
|
65
|
-
client.userTasks.removeSubscription(subscription);
|
76
|
+
client.userTasks.removeSubscription(subscription, userIdentity);
|
66
77
|
} else {
|
67
78
|
// let the *currentIdentity* be active
|
68
79
|
}
|