@5minds/node-red-contrib-processcube 1.8.3-feature-829069-m7nhmav6 → 1.8.4-develop-d81c9d-m7pcbct5

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.
@@ -429,7 +429,7 @@
429
429
  },
430
430
  "@5minds/node-red-contrib-processcube": {
431
431
  "name": "@5minds/node-red-contrib-processcube",
432
- "version": "1.8.2",
432
+ "version": "1.8.4",
433
433
  "local": false,
434
434
  "user": false,
435
435
  "nodes": {
@@ -698,17 +698,6 @@
698
698
  "name": "Engine Auth 8000",
699
699
  "url": "http://engine:8000"
700
700
  },
701
- {
702
- "id": "f7961bee80d8bcb5",
703
- "type": "processcube-engine-config",
704
- "name": "",
705
- "url": "http://engine:8001",
706
- "urlType": "str",
707
- "clientId": "",
708
- "clientIdType": "str",
709
- "clientSecret": "",
710
- "clientSecretType": "str"
711
- },
712
701
  {
713
702
  "id": "b7ddfedf82d8120f",
714
703
  "type": "externaltask-error",
@@ -818,7 +807,7 @@
818
807
  "z": "a23d2e782beb66f4",
819
808
  "g": "31cb6729aac0ba46",
820
809
  "name": "raise Error",
821
- "func": "throw Error(\"hello error\");\n\nreturn msg;",
810
+ "func": "const randomDelay = Math.floor(Math.random() * (10000 - 1000 + 1)) + 1000; // Zufall zwischen 1000 und 10000 ms\n\nsetTimeout(() => {\n node.send(msg);\n}, randomDelay);\n\n//throw Error(\"hello error\");",
822
811
  "outputs": 1,
823
812
  "timeout": 0,
824
813
  "noerr": 0,
@@ -1172,7 +1161,7 @@
1172
1161
  "z": "a23d2e782beb66f4",
1173
1162
  "g": "70d7a70e375b162a",
1174
1163
  "name": "debug 3",
1175
- "active": true,
1164
+ "active": false,
1176
1165
  "tosidebar": true,
1177
1166
  "console": false,
1178
1167
  "tostatus": false,
@@ -2616,7 +2605,7 @@
2616
2605
  "type": "debug",
2617
2606
  "z": "76c047e0d8770a20",
2618
2607
  "name": "debug 34",
2619
- "active": true,
2608
+ "active": false,
2620
2609
  "tosidebar": true,
2621
2610
  "console": false,
2622
2611
  "tostatus": false,
@@ -14,7 +14,8 @@ services:
14
14
  - TOPIC=TopicFromENV
15
15
  # start node-red with debugger port open
16
16
  - NODE_OPTIONS=--inspect=0.0.0.0:9229
17
- - NODE_RED_ETW_HEARTBEAT_LOGGING=true
17
+ - NODE_RED_ETW_HEARTBEAT_LOGGING=false
18
+ - NODE_RED_ETW_STEP_LOGGING=true
18
19
  volumes:
19
20
  # required for mapping the current source into the directory
20
21
  - ./.:/package_src/
@@ -1,4 +1,5 @@
1
1
  const EventEmitter = require('node:events');
2
+ const { send } = require('node:process');
2
3
 
3
4
 
4
5
  module.exports = function (RED) {
@@ -14,10 +15,114 @@ module.exports = function (RED) {
14
15
 
15
16
  let options = RED.util.evaluateNodeProperty(config.workerConfig, config.workerConfigType, node);
16
17
  let topic = node.topic = RED.util.evaluateNodeProperty(config.topic, config.topicType, node)
17
-
18
-
18
+
19
19
  node._subscribed = true;
20
20
  node._subscribed_error = null;
21
+ node._trace = '';
22
+ node._step = '';
23
+ node._tracking_nodes = {};
24
+ node._tracking_for_etw = {};
25
+
26
+ node.isHandling = () => {
27
+ return Object.keys(node.started_external_tasks).length > 0;
28
+ };
29
+
30
+ node.ownMessage = (msg) => {
31
+ return msg.etw_input_node_id === node.id;
32
+ };
33
+
34
+ node.clearTracking = (msg) => {
35
+ if (msg.flowNodeInstanceId) {
36
+ node._tracking_for_etw[msg.flowNodeInstanceId].forEach((theNode) => {
37
+ node.decrMsgOnNode(theNode, msg);
38
+ });
39
+ }
40
+ };
41
+
42
+ node.incMsgOnNode = (theNode, msg) => {
43
+ if (node.id === theNode.id) {
44
+ return;
45
+ }
46
+
47
+ if (!node._tracking_nodes[theNode.id]) {
48
+ node._tracking_nodes[theNode.id] = {
49
+ node: theNode,
50
+ count: 1,
51
+ };
52
+ } else {
53
+ node._tracking_nodes[theNode.id].count++;
54
+ }
55
+
56
+ if (!node._tracking_for_etw[msg.flowNodeInstanceId]) {
57
+ node._tracking_for_etw[msg.flowNodeInstanceId] = [];
58
+ node._tracking_for_etw[msg.flowNodeInstanceId].push(theNode);
59
+ } else {
60
+ node._tracking_for_etw[msg.flowNodeInstanceId].push(theNode);
61
+ }
62
+
63
+ theNode.status({ fill: 'green', shape: 'dot', text: `tasks(${node._tracking_nodes[theNode.id].count}).` });
64
+ };
65
+
66
+ node.decrMsgOnNode = (theNode, msg) => {
67
+ if (node.id === theNode.id) {
68
+ return;
69
+ }
70
+
71
+ if (!node._tracking_nodes[theNode.id]) {
72
+ node._tracking_nodes[theNode.id] = {
73
+ node: theNode,
74
+ count: 0,
75
+ };
76
+ } else {
77
+ node._tracking_nodes[theNode.id].count--;
78
+
79
+ if (node._tracking_nodes[theNode.id].count <= 0) {
80
+ node._tracking_nodes[theNode.id].count = 0;
81
+ }
82
+ }
83
+
84
+ if (node._tracking_for_etw[msg.flowNodeInstanceId]) {
85
+ node._tracking_for_etw[msg.flowNodeInstanceId] = node._tracking_for_etw[msg.flowNodeInstanceId].filter(item => item !== theNode)
86
+
87
+ if (node._tracking_for_etw[msg.flowNodeInstanceId].count <= 0) {
88
+ delete node._tracking_for_etw[msg.flowNodeInstanceId];
89
+ }
90
+ }
91
+
92
+ theNode.status({ fill: 'green', shape: 'dot', text: `tasks(${node._tracking_nodes[theNode.id].count}).` });
93
+ };
94
+
95
+ RED.hooks.add('preDeliver', (sendEvent) => {
96
+ if (node.isHandling() && node.ownMessage(sendEvent.msg)) {
97
+
98
+ const sourceNode = sendEvent?.source?.node;
99
+ const destinationNode = sendEvent?.destination?.node;
100
+
101
+ node._step = `${destinationNode.name || destinationNode.type}`;
102
+
103
+ node.showStatus();
104
+
105
+ if (process.env.NODE_RED_ETW_STEP_LOGGING == 'true') {
106
+ node._trace = `'${sourceNode.name || sourceNode.type}'->'${destinationNode.name || destinationNode.type}'`;
107
+ node.log(`preDeliver: ${node._trace}`);
108
+ }
109
+ }
110
+ });
111
+
112
+ RED.hooks.add('postDeliver', (sendEvent) => {
113
+ if (node.isHandling() && node.ownMessage(sendEvent.msg)) {
114
+ const sourceNode = sendEvent?.source?.node;
115
+ const destinationNode = sendEvent?.destination?.node;
116
+
117
+ node.decrMsgOnNode(sourceNode, sendEvent.msg);
118
+ node.incMsgOnNode(destinationNode, sendEvent.msg);
119
+
120
+ if (process.env.NODE_RED_ETW_STEP_LOGGING == 'true') {
121
+ node._trace = `'${sourceNode.name || sourceNode.type}'->'${destinationNode.name || destinationNode.type}'`;
122
+ node.log(`postDeliver: ${node._trace}`);
123
+ }
124
+ }
125
+ });
21
126
 
22
127
  node.setSubscribedStatus = () => {
23
128
  this._subscribed = true;
@@ -30,7 +135,7 @@ module.exports = function (RED) {
30
135
  this._subscribed_error = error;
31
136
 
32
137
  this.error(`subscription failed (topic: ${node.topic}).`);
33
- RED.log.error(`topic: ${node.topic} (${error.message}).`);
138
+ RED.log.error(`topic: ${node.topic} (${error?.message}).`);
34
139
 
35
140
  this.showStatus();
36
141
  };
@@ -46,11 +151,14 @@ module.exports = function (RED) {
46
151
  node.setFinishHandlingTaskStatus = (externalTask) => {
47
152
  if (externalTask.flowNodeInstanceId) {
48
153
  delete this.started_external_tasks[externalTask.flowNodeInstanceId];
154
+ node._trace = '';
155
+ node._step = '';
49
156
  }
50
157
 
51
158
  this._subscribed = true;
52
159
  this._subscribed_error = null;
53
160
 
161
+ this.clearTracking(externalTask); // as msg
54
162
  this.showStatus();
55
163
  };
56
164
 
@@ -61,7 +169,7 @@ module.exports = function (RED) {
61
169
 
62
170
  this._subscribed_error = error;
63
171
  this.error(`finished task failed (topic: ${node.topic}).`);
64
- RED.log.error(`topic: ${node.topic} (${error.message}).`);
172
+ RED.log.error(`topic: ${node.topic} (${error?.message}).`);
65
173
 
66
174
  this.showStatus();
67
175
  };
@@ -73,7 +181,11 @@ module.exports = function (RED) {
73
181
  this.status({ fill: 'red', shape: 'ring', text: `subscription failed (${msgCounter}).` })
74
182
  } else {
75
183
  if (msgCounter >= 1) {
76
- this.status({ fill: 'green', shape: 'dot', text: `handling tasks ${msgCounter}.` });
184
+ if (node._step) {
185
+ this.status({ fill: 'green', shape: 'dot', text: `tasks(${msgCounter}) ->'${node._step}'.` });
186
+ } else {
187
+ this.status({ fill: 'green', shape: 'dot', text: `tasks(${msgCounter}).` });
188
+ }
77
189
  this.log(`handling tasks ${msgCounter}.`);
78
190
  } else {
79
191
  this.status({ fill: 'blue', shape: 'ring', text: `subcribed.` });
@@ -101,11 +213,12 @@ module.exports = function (RED) {
101
213
  const saveHandleCallback = (data, callback, msg) => {
102
214
  try {
103
215
  callback(data);
216
+ node.log(`send to engine *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* ${externalTask.processInstanceId}`);
104
217
  node.setFinishHandlingTaskStatus(externalTask);
105
218
  } catch (error) {
106
219
  node.setErrorFinishHandlingTaskStatus(externalTask, error);
107
220
  msg.error = error;
108
- node.error(`Error in callback 'saveHandleCallback': ${error.message}`, msg);
221
+ node.error(`failed send to engine *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* ${externalTask.processInstanceId}: ${erro?.message}`, msg);
109
222
  }
110
223
  };
111
224
 
@@ -125,16 +238,16 @@ module.exports = function (RED) {
125
238
  saveHandleCallback(result, resolve, msg);
126
239
  };
127
240
 
128
- const handleErrorTask = (msg) => {
241
+ const handleErrorTask = (error) => {
129
242
  node.log(
130
- `handle error event for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' on *msg._msgid* '${msg._msgid}'.`
243
+ `handle error event for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' on *msg._msgid* '${error.errorDetails?._msgid}'.`
131
244
  );
132
245
 
133
246
  // TODO: with reject, the default error handling is proceed
134
247
  // SEE: https://github.com/5minds/ProcessCube.Engine.Client.ts/blob/develop/src/ExternalTaskWorker.ts#L180
135
248
  // reject(result);
136
249
  //resolve(msg);
137
- saveHandleCallback(msg, resolve, msg);
250
+ saveHandleCallback(error, resolve, error);
138
251
  };
139
252
 
140
253
  node.eventEmitter.once(`handle-${externalTask.flowNodeInstanceId}`, (msg, isError = false) => {
@@ -178,7 +291,7 @@ module.exports = function (RED) {
178
291
  externalTaskWorker.onHeartbeat((event, external_task_id) => {
179
292
  node.setSubscribedStatus();
180
293
 
181
- if (process.env.NODE_RED_ETW_HEARTBEAT_LOGGING) {
294
+ if (process.env.NODE_RED_ETW_HEARTBEAT_LOGGING == 'true') {
182
295
  if (external_task_id) {
183
296
  this.log(`subscription (heartbeat:topic ${node.topic}, ${event} for ${external_task_id}).`);
184
297
  } else {
@@ -193,13 +306,9 @@ module.exports = function (RED) {
193
306
  case 'finishExternalTask':
194
307
  case 'processExternalTask':
195
308
  node.error(
196
- `Worker error ${errorType} for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}': ${error.message}`
309
+ `Worker error ${errorType} for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}': ${error?.message}`
197
310
  );
198
311
 
199
- //if (externalTask) {
200
- // delete node.started_external_tasks[externalTask.flowNodeInstanceId];
201
- //}
202
-
203
312
  node.setUnsubscribedStatus(error);
204
313
 
205
314
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.8.3-feature-829069-m7nhmav6",
3
+ "version": "1.8.4-develop-d81c9d-m7pcbct5",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -36,7 +36,6 @@
36
36
  "version": ">=3.1.9",
37
37
  "nodes": {
38
38
  "checkAuthorization": "check-authorization.js",
39
- "DataobjectInstanceQuery": "dataobject-instance-query.js",
40
39
  "EndEventFinishedListener": "endevent-finished-listener.js",
41
40
  "externaltaskInput": "externaltask-input.js",
42
41
  "externaltaskOutput": "externaltask-output.js",
@@ -9,9 +9,6 @@
9
9
  </bpmn:collaboration>
10
10
  <bpmn:process id="External-Task-Sample_Process" name="External-Task-Sample" isExecutable="true">
11
11
  <bpmn:laneSet />
12
- <bpmn:startEvent id="StartEvent_1" name="Start">
13
- <bpmn:outgoing>Flow_0qmxzxk</bpmn:outgoing>
14
- </bpmn:startEvent>
15
12
  <bpmn:sequenceFlow id="Flow_0qmxzxk" sourceRef="StartEvent_1" targetRef="Activity_02ykwt2" />
16
13
  <bpmn:sequenceFlow id="Flow_16dfeac" sourceRef="Activity_02ykwt2" targetRef="Activity_0ma3kzt" />
17
14
  <bpmn:endEvent id="Event_05wpeos">
@@ -23,6 +20,11 @@
23
20
  </bpmn:endEvent>
24
21
  <bpmn:sequenceFlow id="Flow_0y6es1p" sourceRef="Event_0o7qlkd" targetRef="Event_0yn9mzh" />
25
22
  <bpmn:serviceTask id="Activity_02ykwt2" name="Topic &#34;Test&#34;" camunda:type="external" camunda:topic="Test">
23
+ <bpmn:extensionElements>
24
+ <camunda:properties>
25
+ <camunda:property name="payload" value="{&#10; &#34;hello&#34;: &#34;world&#34;&#10;}" />
26
+ </camunda:properties>
27
+ </bpmn:extensionElements>
26
28
  <bpmn:incoming>Flow_0qmxzxk</bpmn:incoming>
27
29
  <bpmn:outgoing>Flow_16dfeac</bpmn:outgoing>
28
30
  </bpmn:serviceTask>
@@ -42,6 +44,17 @@
42
44
  <bpmn:outgoing>Flow_1fsn04u</bpmn:outgoing>
43
45
  <bpmn:errorEventDefinition id="ErrorEventDefinition_0kojqkb" errorRef="Error_TrRFOiMy" />
44
46
  </bpmn:boundaryEvent>
47
+ <bpmn:startEvent id="StartEvent_1" name="Start">
48
+ <bpmn:extensionElements>
49
+ <camunda:properties>
50
+ <camunda:property name="enabled" value="false" />
51
+ </camunda:properties>
52
+ </bpmn:extensionElements>
53
+ <bpmn:outgoing>Flow_0qmxzxk</bpmn:outgoing>
54
+ <bpmn:timerEventDefinition id="TimerEventDefinition_02zdsh9">
55
+ <bpmn:timeCycle xsi:type="bpmn:tFormalExpression">*/10 * * * * *</bpmn:timeCycle>
56
+ </bpmn:timerEventDefinition>
57
+ </bpmn:startEvent>
45
58
  </bpmn:process>
46
59
  <bpmn:error id="Error_3O8wBFQi" errorCode="MyErrorCode" />
47
60
  <bpmn:error id="Error_TrRFOiMy" errorCode="handleSubFlowError" />
@@ -50,12 +63,6 @@
50
63
  <bpmndi:BPMNShape id="Participant_0px403d_di" bpmnElement="Participant_0px403d" isHorizontal="true">
51
64
  <dc:Bounds x="5" y="30" width="635" height="320" />
52
65
  </bpmndi:BPMNShape>
53
- <bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
54
- <dc:Bounds x="92" y="152" width="36" height="36" />
55
- <bpmndi:BPMNLabel>
56
- <dc:Bounds x="98" y="195" width="24" height="14" />
57
- </bpmndi:BPMNLabel>
58
- </bpmndi:BPMNShape>
59
66
  <bpmndi:BPMNShape id="Event_05wpeos_di" bpmnElement="Event_05wpeos">
60
67
  <dc:Bounds x="502" y="152" width="36" height="36" />
61
68
  </bpmndi:BPMNShape>
@@ -73,6 +80,12 @@
73
80
  <bpmndi:BPMNShape id="Event_0rs3geg_di" bpmnElement="Event_0rs3geg">
74
81
  <dc:Bounds x="312" y="272" width="36" height="36" />
75
82
  </bpmndi:BPMNShape>
83
+ <bpmndi:BPMNShape id="Event_00jrf2t_di" bpmnElement="StartEvent_1">
84
+ <dc:Bounds x="92" y="152" width="36" height="36" />
85
+ <bpmndi:BPMNLabel>
86
+ <dc:Bounds x="98" y="195" width="24" height="14" />
87
+ </bpmndi:BPMNLabel>
88
+ </bpmndi:BPMNShape>
76
89
  <bpmndi:BPMNShape id="Event_03ytp91_di" bpmnElement="Event_007u06e">
77
90
  <dc:Bounds x="222" y="192" width="36" height="36" />
78
91
  </bpmndi:BPMNShape>
@@ -1,120 +0,0 @@
1
- <script type="text/javascript">
2
- RED.nodes.registerType('dataobject-instance-query', {
3
- category: 'ProcessCube',
4
- color: '#02AFD6',
5
- defaults: {
6
- name: { value: '' },
7
- engine: { value: '', type: 'processcube-engine-config' },
8
- query: { value: 'payload' },
9
- query_type: { value: 'msg' },
10
- },
11
- inputs: 1,
12
- outputs: 1,
13
- icon: 'processinstance_query.svg',
14
- label: function () {
15
- return this.name || 'dataobject-instance-query';
16
- },
17
- oneditprepare: function () {
18
- $('#node-input-query').typedInput({
19
- default: 'msg',
20
- types: ['msg', 'json'],
21
- });
22
-
23
- $('#node-input-query').typedInput('value', this.query);
24
- $('#node-input-query').typedInput('type', this.query_type);
25
- },
26
- oneditsave: function () {
27
- (this.query = $('#node-input-query').typedInput('value')),
28
- (this.query_type = $('#node-input-query').typedInput('type'));
29
- },
30
- });
31
- </script>
32
-
33
- <script type="text/html" data-template-name="dataobject-instance-query">
34
- <div class="form-row">
35
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
36
- <input type="text" id="node-input-name" placeholder="Name" />
37
- </div>
38
- <div class="form-row">
39
- <label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
40
- <input type="text" id="node-input-engine" placeholder="http://engine:8000" />
41
- </div>
42
- <div class="form-row">
43
- <label for="node-input-query"><i class="fa fa-tag"></i> Query</label>
44
- <input type="text" id="node-input-query" />
45
- </div>
46
- </script>
47
-
48
- <script type="text/markdown" data-help-name="dataobject-instance-query">
49
- A node to query dataobject instances on the ProcessCube Engine.
50
-
51
- ## Inputs
52
-
53
- : 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
- : query (Object) : The query that was used.
55
-
56
- ## Outputs
57
-
58
- : dataObjectInstances (Array) : The dataobject instances that matched the query.
59
- : totalCount (number) : The number of matches.
60
-
61
- ### Query fields
62
-
63
- **Summary**:
64
-
65
- **Description**: Gets all DataObjectInstances that match the given query.
66
-
67
- #### Parameters:
68
- - Name: `offset` Required: `false`
69
- - Type: number
70
- - Description: The index of the first DataObjectInstance to include in the result set.
71
- - Name: `limit` Required: `false`
72
- - Type: number
73
- - Description: The maximum number of DataObjectInstances to return.
74
- - Name: `dataObjectId` Required: ``
75
- - Type: Array&lt;string&gt; | string | SearchQuery
76
- - string: myDataObjectId_12345678
77
- - Array&lt;string&gt;: myDataObjectId_12345678,myDataObjectId_87654321
78
- - object:
79
- - Description: Filter by the ID of the DataObject.
80
- - Name: `flowNodeInstanceId` Required: ``
81
- - Type: Array&lt;string&gt; | string | SearchQuery
82
- - string: myFlowNodeInstanceId_12345678
83
- - Array&lt;string&gt;: myFlowNodeInstanceId_12345678,myFlowNodeInstanceId_87654321
84
- - object:
85
- - Description: Filter by the ID of the FlowNodeInstance that wrote to the DataObject.
86
- - Name: `processInstanceId` Required: ``
87
- - Type: Array&lt;string&gt; | string | SearchQuery
88
- - string: myProcessInstance_12345678
89
- - Array&lt;string&gt;: myProcessInstance_12345678,myProcessInstance_87654321
90
- - object:
91
- - Description: Filter by the ID of the ProcessInstances.
92
- - Name: `processDefinitionId` Required: ``
93
- - Type: Array&lt;string&gt; | string | SearchQuery
94
- - string: myProcess_12345678
95
- - Array&lt;string&gt;: myProcess_12345678,myProcess_87654321
96
- - object:
97
- - Description: Filter by the ID of the ProcessDefinition that the DataObjectInstances belong to.
98
- - Name: `processModelId` Required: ``
99
- - Type: Array&lt;string&gt; | string | SearchQuery
100
- - string: myProcessModel_12345678
101
- - Array&lt;string&gt;: myProcessModel_12345678,myProcessModel_87654321
102
- - object:
103
- - Description: Filter by the ID of the ProcessModel that the DataObjectInstances belong to.
104
- - Name: `embeddedProcessModelId` 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 EmbeededProcessModel that the DataObjectInstances belong to.
110
- - Name: `createdAt` Required: ``
111
- - Type: Array&lt;string&gt; | string
112
- - string: 2021-01-01T00:00:00.000Z
113
- - array: 2021-01-01T00:00:00.000Z,2021-01-02T00:00:00.000Z
114
- - Description: The created date of the DataObjectInstances to include in the results.
115
-
116
- ### References
117
-
118
- - [The ProcessCube&copy; Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
119
- - [ProcessCube&copy; LowCode Integration](https://processcube.io/docs/node-red) - LowCode integration in ProcessCube&copy;
120
- </script>
@@ -1,32 +0,0 @@
1
- module.exports = function (RED) {
2
- function DataobjectInstanceQuery(config) {
3
- RED.nodes.createNode(this, config);
4
- var node = this;
5
-
6
- node.on('input', function (msg) {
7
- let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
8
-
9
- node.engine = RED.nodes.getNode(config.engine);
10
- const client = node.engine.engineClient;
11
- const isUser = !!msg._client?.user && !!msg._client.user.accessToken;
12
- const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
13
-
14
- if (!client) {
15
- node.error('No engine configured.', msg);
16
- return;
17
- }
18
-
19
- client.dataObjectInstances
20
- .query(query, { identity: userIdentity })
21
- .then((matchingInstances) => {
22
- msg.payload = matchingInstances;
23
-
24
- node.send(msg);
25
- })
26
- .catch((error) => {
27
- node.error(`Dataobject Instance Query failed: ${error.message}`, msg);
28
- });
29
- });
30
- }
31
- RED.nodes.registerType('dataobject-instance-query', DataobjectInstanceQuery);
32
- };
@@ -1,109 +0,0 @@
1
- [
2
- {
3
- "id": "8b280114f8ac9c23",
4
- "type": "tab",
5
- "label": "Dataobject Instances Query Sample",
6
- "disabled": false,
7
- "info": "",
8
- "env": []
9
- },
10
- {
11
- "id": "be0d703c70d1687b",
12
- "type": "group",
13
- "z": "8b280114f8ac9c23",
14
- "style": {
15
- "stroke": "#999999",
16
- "stroke-opacity": "1",
17
- "fill": "none",
18
- "fill-opacity": "1",
19
- "label": true,
20
- "label-position": "nw",
21
- "color": "#a4a4a4"
22
- },
23
- "nodes": [
24
- "8687cdf9bf6c4d7d",
25
- "74773491693b7f22",
26
- "29e796ef38867f2a"
27
- ],
28
- "x": 74,
29
- "y": 79,
30
- "w": 632,
31
- "h": 82
32
- },
33
- {
34
- "id": "8687cdf9bf6c4d7d",
35
- "type": "dataobject-instance-query",
36
- "z": "8b280114f8ac9c23",
37
- "g": "be0d703c70d1687b",
38
- "name": "Query 5 DataobjectInstances",
39
- "engine": "7de3086e71c028f9",
40
- "query": "{ \"limit\": 5}",
41
- "query_type": "json",
42
- "x": 400,
43
- "y": 120,
44
- "wires": [
45
- [
46
- "74773491693b7f22"
47
- ]
48
- ]
49
- },
50
- {
51
- "id": "74773491693b7f22",
52
- "type": "debug",
53
- "z": "8b280114f8ac9c23",
54
- "g": "be0d703c70d1687b",
55
- "name": "Log",
56
- "active": true,
57
- "tosidebar": true,
58
- "console": false,
59
- "tostatus": false,
60
- "complete": "payload",
61
- "targetType": "msg",
62
- "statusVal": "",
63
- "statusType": "auto",
64
- "x": 610,
65
- "y": 120,
66
- "wires": []
67
- },
68
- {
69
- "id": "29e796ef38867f2a",
70
- "type": "inject",
71
- "z": "8b280114f8ac9c23",
72
- "g": "be0d703c70d1687b",
73
- "name": "Trigger",
74
- "props": [
75
- {
76
- "p": "payload"
77
- },
78
- {
79
- "p": "topic",
80
- "vt": "str"
81
- }
82
- ],
83
- "repeat": "",
84
- "crontab": "",
85
- "once": false,
86
- "onceDelay": 0.1,
87
- "topic": "",
88
- "payload": "",
89
- "payloadType": "date",
90
- "x": 170,
91
- "y": 120,
92
- "wires": [
93
- [
94
- "8687cdf9bf6c4d7d"
95
- ]
96
- ]
97
- },
98
- {
99
- "id": "7de3086e71c028f9",
100
- "type": "processcube-engine-config",
101
- "name": "",
102
- "url": "http://engine:8000",
103
- "urlType": "str",
104
- "clientId": "",
105
- "clientIdType": "str",
106
- "clientSecret": "",
107
- "clientSecretType": "str"
108
- }
109
- ]