@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.
Files changed (41) hide show
  1. package/.processcube/nodered/.config.nodes.json +1 -1
  2. package/.processcube/nodered/config.js +2 -3
  3. package/.processcube/nodered/settings.js +1 -1
  4. package/README.md +8 -2
  5. package/doc_generator/generator.js +5 -5
  6. package/doc_generator/generator_with_swagger.js +80 -78
  7. package/endevent-finished-listener.html +16 -16
  8. package/externaltask-error.html +11 -11
  9. package/externaltask-error.js +3 -1
  10. package/externaltask-event-listener.html +9 -9
  11. package/externaltask-input.html +26 -26
  12. package/externaltask-input.js +6 -7
  13. package/externaltask-output.html +7 -7
  14. package/message-event-trigger.html +8 -8
  15. package/message-event-trigger.js +3 -0
  16. package/package.json +5 -2
  17. package/process-event-listener.html +74 -74
  18. package/process-event-listener.js +1 -2
  19. package/process-start.html +12 -12
  20. package/process-start.js +6 -3
  21. package/process-terminate.html +9 -9
  22. package/process-terminate.js +3 -1
  23. package/processcube-engine-config.html +8 -8
  24. package/processcube-engine-config.js +0 -2
  25. package/processdefinition-deploy.html +9 -9
  26. package/processdefinition-deploy.js +4 -2
  27. package/processdefinition-query.html +139 -140
  28. package/processdefinition-query.js +4 -0
  29. package/processinstance-delete.html +48 -46
  30. package/processinstance-delete.js +24 -9
  31. package/processinstance-query.html +120 -119
  32. package/processinstance-query.js +3 -1
  33. package/signal-event-trigger.html +8 -9
  34. package/signal-event-trigger.js +3 -0
  35. package/usertask-event-listener.html +126 -127
  36. package/usertask-input.html +126 -125
  37. package/usertask-input.js +3 -1
  38. package/usertask-output.html +7 -7
  39. package/usertask-output.js +5 -2
  40. package/wait-for-usertask.html +173 -164
  41. package/wait-for-usertask.js +36 -25
@@ -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: "", type: "processcube-engine-config"},
8
- query: {value: "payload"},
9
- query_type: {value: "msg"},
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: "font-awesome/fa-envelope-open",
15
- label: function() {
16
- return this.name || "wait-for-usertask";
14
+ icon: 'font-awesome/fa-envelope-open',
15
+ label: function () {
16
+ return this.name || 'wait-for-usertask';
17
17
  },
18
- oneditprepare: function() {
19
- $("#node-input-query").typedInput({
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
- $("#node-input-query").typedInput('value', this.query);
25
- $("#node-input-query").typedInput('type', this.query_type);
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"><i class="fa fa-list-alt"></i> Only for new</label>
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 type="checkbox" checked id="node-input-only_for_new" style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;">
52
- <label style="width:auto" for="node-input-multisend">Trigger only for new user task or *checked* also for old ones?</label>
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) : the query to filter the usertasks.
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 &#39;Wait for UserTask&#39;
78
-
79
- #### Parameters:
80
- - Name: `offset` Required: `false`
81
- - Type: number
82
- - Description: The index of the first ProcessInstance to include in the result set.
83
- - Name: `limit` Required: `false`
84
- - Type: number
85
- - Description: The maximum number of ProcessInstances to return.
86
- - Name: `correlationId` Required: `false`
87
- - Type: Array&lt;string&gt; | string | SearchQuery
88
- - string: myCorrelationId
89
- - Array&lt;string&gt;: myCorrelationId1,myCorrelationId2
90
- - object:
91
- - Description: Filter by the CorrelationId of the ProcessInstances.
92
- - Name: `processInstanceId` Required: ``
93
- - Type: Array&lt;string&gt; | string | SearchQuery
94
- - string: myProcessInstance_12345678
95
- - Array&lt;string&gt;: myProcessInstance_12345678,myProcessInstance_87654321
96
- - object:
97
- - Description: Filter by the ID of the ProcessInstances.
98
- - Name: `processDefinitionId` Required: ``
99
- - Type: Array&lt;string&gt; | string | SearchQuery
100
- - string: myProcess_12345678
101
- - Array&lt;string&gt;: myProcess_12345678,myProcess_87654321
102
- - object:
103
- - Description: Filter by the ID of the ProcessDefinition that the ProcessInstances belong to.
104
- - Name: `processModelId` Required: ``
105
- - Type: Array&lt;string&gt; | string | SearchQuery
106
- - string: myProcessModel_12345678
107
- - Array&lt;string&gt;: myProcessModel_12345678,myProcessModel_87654321
108
- - object:
109
- - Description: Filter by the ID of the ProcessModel that the ProcessInstances belong to.
110
- - Name: `processModelName` Required: ``
111
- - Type: Array&lt;string&gt; | string | SearchQuery
112
- - string: My Process Model
113
- - Array&lt;string&gt;: My Process Model,My Other Process Model
114
- - object:
115
- - Description: Filter by the name of the ProcessModel that the ProcessInstances belong to.
116
- - Name: `processModelHash` Required: ``
117
- - Type: Array&lt;string&gt; | string | SearchQuery
118
- - string: 12345678
119
- - Array&lt;string&gt;: 12345678,87654321
120
- - object:
121
- - Description: Filter by the hash of the ProcessModel that the ProcessInstances belong to.
122
- - Name: `ownerId` Required: ``
123
- - Type: Array&lt;string&gt; | string | SearchQuery
124
- - string: 12345678
125
- - Array&lt;string&gt;: 12345678,87654321
126
- - object:
127
- - Description: Filter by the ID of the User that owns the ProcessInstances.
128
- - Name: `state` Required: ``
129
- - Type: Array&lt;string&gt; | string | SearchQuery
130
- - string: running
131
- - Array&lt;string&gt;: running,finished
132
- - object:
133
- - Description: Filter by the state of the ProcessInstances.
134
- - Name: `parentProcessInstanceId` Required: ``
135
- - Type: Array&lt;string&gt; | string | SearchQuery
136
- - string: myParentProcessInstance_12345678
137
- - Array&lt;string&gt;: myParentProcessInstance_12345678,myParentProcessInstance_87654321
138
- - object:
139
- - Description: Filter by the ID of the parent ProcessInstance.
140
- - Name: `embeddedProcessModelId` Required: ``
141
- - Type: Array&lt;string&gt; | string | SearchQuery
142
- - string: myModel1
143
- - Array&lt;string&gt;: myModel1,myModel2
144
- - object:
145
- - Description: Filter by the ID of the embedded process model.
146
- - Name: `terminatedByUserId` Required: ``
147
- - Type: Array&lt;string&gt; | string | SearchQuery
148
- - string: 12345678
149
- - Array&lt;string&gt;: 12345678,87654321
150
- - object:
151
- - Description: Filter by the ID of the User that terminated the ProcessInstances.
152
- - Name: `createdBefore` Required: ``
153
- - Type: string
154
- - Description: The maximum created date of the ProcessInstances to include in the results.
155
- - Name: `createdAt` Required: ``
156
- - Type: Array&lt;string&gt; | 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 minimum created date of the ProcessInstances to include in the results.
160
- - Name: `createdAfter` Required: ``
161
- - Type: string
162
- - Description: The minimum created date of the ProcessInstances to include in the results.
163
- - Name: `updatedBefore` Required: ``
164
- - Type: string
165
- - Description: The maximum updated date of the ProcessInstances to include in the results.
166
- - Name: `updatedAt` Required: ``
167
- - Type: Array&lt;string&gt; | 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 updated date of the ProcessInstances to include in the results.
171
- - Name: `updatedAfter` Required: ``
172
- - Type: string
173
- - Description: The minimum updated date of the ProcessInstances to include in the results.
174
- - Name: `finishedBefore` Required: ``
175
- - Type: string
176
- - Description: The maximum finished date of the ProcessInstances to include in the results.
177
- - Name: `finishedAt` Required: ``
178
- - Type: Array&lt;string&gt; | string
179
- - string: 2021-01-01T00:00:00.000Z
180
- - array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
181
- - Description: The exact finished date of the ProcessInstances to include in the results.
182
- - Name: `finishedAfter` Required: ``
183
- - Type: string
184
- - Description: The minimum finished date of the ProcessInstances to include in the results.
185
- - Name: `triggeredByFlowNodeInstance` Required: ``
186
- - Type: Array&lt;string&gt; | string | SearchQuery
187
- - string: myFlowNodeInstance_12345678
188
- - array: myFlowNodeInstance_12345678,myFlowNodeInstance_87654321
189
- - object:
190
- - Description: Filter by the ID of the FlowNodeInstance that triggered the ProcessInstance.
191
-
192
- ### References
193
-
194
- - [The ProcessCube&copy; Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
195
- - [ProcessCube&copy; LowCode Integration](https://processcube.io/docs/node-red) - LowCode integration in ProcessCube&copy;
196
- </script>
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 &#39;Wait for UserTask&#39;
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&lt;string&gt; | string | SearchQuery
97
+ - string: myCorrelationId
98
+ - Array&lt;string&gt;: myCorrelationId1,myCorrelationId2
99
+ - object:
100
+ - Description: Filter by the CorrelationId of the ProcessInstances.
101
+ - Name: `processInstanceId` Required: ``
102
+ - Type: Array&lt;string&gt; | string | SearchQuery
103
+ - string: myProcessInstance_12345678
104
+ - Array&lt;string&gt;: myProcessInstance_12345678,myProcessInstance_87654321
105
+ - object:
106
+ - Description: Filter by the ID of the ProcessInstances.
107
+ - Name: `processDefinitionId` Required: ``
108
+ - Type: Array&lt;string&gt; | string | SearchQuery
109
+ - string: myProcess_12345678
110
+ - Array&lt;string&gt;: 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&lt;string&gt; | string | SearchQuery
115
+ - string: myProcessModel_12345678
116
+ - Array&lt;string&gt;: 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&lt;string&gt; | string | SearchQuery
121
+ - string: My Process Model
122
+ - Array&lt;string&gt;: 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&lt;string&gt; | string | SearchQuery
127
+ - string: 12345678
128
+ - Array&lt;string&gt;: 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&lt;string&gt; | string | SearchQuery
133
+ - string: 12345678
134
+ - Array&lt;string&gt;: 12345678,87654321
135
+ - object:
136
+ - Description: Filter by the ID of the User that owns the ProcessInstances.
137
+ - Name: `state` Required: ``
138
+ - Type: Array&lt;string&gt; | string | SearchQuery
139
+ - string: running
140
+ - Array&lt;string&gt;: running,finished
141
+ - object:
142
+ - Description: Filter by the state of the ProcessInstances.
143
+ - Name: `parentProcessInstanceId` Required: ``
144
+ - Type: Array&lt;string&gt; | string | SearchQuery
145
+ - string: myParentProcessInstance_12345678
146
+ - Array&lt;string&gt;: myParentProcessInstance_12345678,myParentProcessInstance_87654321
147
+ - object:
148
+ - Description: Filter by the ID of the parent ProcessInstance.
149
+ - Name: `embeddedProcessModelId` Required: ``
150
+ - Type: Array&lt;string&gt; | string | SearchQuery
151
+ - string: myModel1
152
+ - Array&lt;string&gt;: myModel1,myModel2
153
+ - object:
154
+ - Description: Filter by the ID of the embedded process model.
155
+ - Name: `terminatedByUserId` Required: ``
156
+ - Type: Array&lt;string&gt; | string | SearchQuery
157
+ - string: 12345678
158
+ - Array&lt;string&gt;: 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&lt;string&gt; | 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&lt;string&gt; | 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&lt;string&gt; | 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&lt;string&gt; | 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&copy; Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
204
+ - [ProcessCube&copy; LowCode Integration](https://processcube.io/docs/node-red) - LowCode integration in ProcessCube&copy;
205
+ </script>
@@ -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(async (userTaskWaitingNotification) => {
22
- const newQuery = {
23
- flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
24
- ...query,
25
- };
26
-
27
- try {
28
- const matchingFlowNodes = await client.userTasks.query(newQuery);
29
-
30
- if (matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length == 1) {
31
- // remove subscription
32
- client.userTasks.removeSubscription(subscription);
33
-
34
- const userTask = matchingFlowNodes.userTasks[0];
35
-
36
- msg.payload = { userTask: userTask };
37
- node.send(msg);
38
- } else {
39
- // nothing todo - wait for next notification
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
- } catch (error) {
42
- node.error(error, msg);
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
  }