@5minds/node-red-contrib-processcube 1.5.1-feature-6ba46c-m2lk79r9 → 1.5.2-debug-ea65c8-m35v1ji4

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.
@@ -98,7 +98,7 @@ module.exports = function (RED) {
98
98
  task: RED.util.encodeObject(externalTask),
99
99
  payload: payload,
100
100
  flowNodeInstanceId: externalTask.flowNodeInstanceId,
101
- processInstanceId: externalTask.processInstanceId,
101
+ processInstanceId: externalTask.processInstanceId
102
102
  };
103
103
 
104
104
  node.log(
@@ -110,11 +110,7 @@ module.exports = function (RED) {
110
110
  };
111
111
 
112
112
  client.externalTasks
113
- .subscribeToExternalTaskTopic(
114
- config.topic,
115
- etwCallback,
116
- RED.util.evaluateNodeProperty(config.workerConfig, 'json', node)
117
- )
113
+ .subscribeToExternalTaskTopic(config.topic, etwCallback, RED.util.evaluateNodeProperty(config.workerConfig, 'json', node))
118
114
  .then(async (externalTaskWorker) => {
119
115
  node.status({ fill: 'blue', shape: 'ring', text: 'subcribed' });
120
116
 
@@ -139,9 +135,6 @@ module.exports = function (RED) {
139
135
 
140
136
  showStatus(node, Object.keys(started_external_tasks).length);
141
137
  break;
142
- case 'fetchAndLock':
143
- node.status({});
144
- node.error(`Worker error ${errorType}: ${error.message}`);
145
138
  default:
146
139
  node.error(`Worker error ${errorType}: ${error.message}`);
147
140
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.5.1-feature-6ba46c-m2lk79r9",
3
+ "version": "1.5.2-debug-ea65c8-m35v1ji4",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -6,6 +6,7 @@ const DELAY_FACTOR = 0.85;
6
6
 
7
7
  module.exports = function (RED) {
8
8
  function ProcessCubeEngineNode(n) {
9
+ node.log('node-redeploy777');
9
10
  RED.nodes.createNode(this, n);
10
11
  const node = this;
11
12
  const identityChangedCallbacks = [];
@@ -15,6 +16,11 @@ module.exports = function (RED) {
15
16
  this.credentials.clientId = RED.util.evaluateNodeProperty(n.clientId, n.clientIdType, node);
16
17
  this.credentials.clientSecret = RED.util.evaluateNodeProperty(n.clientSecret, n.clientSecretType, node);
17
18
 
19
+ node.log('clientId777');
20
+ node.log(this.credentials.clientId);
21
+ node.log('clientSecret777');
22
+ node.log(this.credentials.clientSecret);
23
+
18
24
  this.registerOnIdentityChanged = function (callback) {
19
25
  identityChangedCallbacks.push(callback);
20
26
  };
@@ -44,6 +50,7 @@ module.exports = function (RED) {
44
50
  });
45
51
 
46
52
  if (this.credentials.clientId && this.credentials.clientSecret) {
53
+ node.log('credentials_set777');
47
54
  this.engineClient = new engine_client.EngineClient(this.url);
48
55
 
49
56
  this.engineClient.applicationInfo
@@ -64,6 +71,7 @@ module.exports = function (RED) {
64
71
  node.error(reason);
65
72
  });
66
73
  } else {
74
+ node.log('credentials_NOT_set777');
67
75
  this.engineClient = new engine_client.EngineClient(this.url);
68
76
  }
69
77
  }
@@ -125,6 +133,7 @@ async function startRefreshingIdentityCycle(clientId, clientSecret, authorityUrl
125
133
 
126
134
  const refresh = async () => {
127
135
  try {
136
+ console.log('refreshing_identity777', clientId, clientSecret);
128
137
  const newTokenSet = await getFreshTokenSet(clientId, clientSecret, authorityUrl);
129
138
  const expiresIn = await getExpiresInForExternalTaskWorkers(newTokenSet);
130
139
  const delay = expiresIn * DELAY_FACTOR * 1000;
@@ -134,7 +143,7 @@ async function startRefreshingIdentityCycle(clientId, clientSecret, authorityUrl
134
143
  configNode.setIdentity(freshIdentity);
135
144
 
136
145
  retries = 5;
137
- setTimeout(refresh, delay);
146
+ setTimeout(refresh, 2000);
138
147
  } catch (error) {
139
148
  if (retries === 0) {
140
149
  console.error(
@@ -5,6 +5,7 @@
5
5
  defaults: {
6
6
  name: { value: '' },
7
7
  engine: { value: '', type: 'processcube-engine-config' },
8
+ modelid: { value: '' },
8
9
  time: { value: '', type: 'number' },
9
10
  time_type: { value: 'hours' },
10
11
  },
@@ -27,11 +28,15 @@
27
28
  <input type="text" id="node-input-engine" placeholder="Engine-URL" />
28
29
  </div>
29
30
  <div class="form-row">
30
- <label for="node-input-time"><i class="fa fa-tag"></i> Time</label>
31
+ <label for="node-input-modelid"><i class="fa fa-tag"></i> Model-ID</label>
32
+ <input type="text" id="node-input-modelid" />
33
+ </div>
34
+ <div class="form-row">
35
+ <label for="node-input-time"><i class="fa fa-tag"></i> Duration</label>
31
36
  <input type="text" id="node-input-time" />
32
37
  </div>
33
38
  <div class="form-row">
34
- <label for="node-input-time_type"><i class="fa fa-sliders"></i> Period</label>
39
+ <label for="node-input-time_type"><i class="fa fa-sliders"></i> Time Unit</label>
35
40
  <select id="node-input-time_type" style="width: 70%;">
36
41
  <option value="hours">Hours</option>
37
42
  <option value="days">Days</option>
@@ -40,19 +45,19 @@
40
45
  </script>
41
46
 
42
47
  <script type="text/markdown" data-help-name="processinstance-delete">
43
- Delete old instances of a process model in the ProcessCube.
48
+ Delete old instances of a process model in the ProcessCube.
44
49
 
45
- ## Inputs
50
+ ## Inputs
46
51
 
47
- : payload.time (number): The number of given time periods.
48
- : payload.time_type ('hours' | 'days'): The type of time period to use.
52
+ : payload.time (number): The number of given time periods.
53
+ : payload.time_type ('hours' | 'days'): The type of time period to use.
49
54
 
50
- ## Outputs
55
+ ## Outputs
51
56
 
52
- : payload (string[]): The ids of the processinstances that were deleted.
57
+ : payload (string[]): The ids of the processinstances that were deleted.
53
58
 
54
- ### References
59
+ ### References
55
60
 
56
- - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
57
- - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube&copy;
61
+ - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
62
+ - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube&copy;
58
63
  </script>
@@ -19,18 +19,21 @@ module.exports = function (RED) {
19
19
  }
20
20
 
21
21
  const timeToUse = msg.payload.time ? msg.payload.time : config.time;
22
+ const modelId = msg.payload.processModelId
23
+ ? msg.payload.processModelId != ''
24
+ ? msg.payload.processModelId
25
+ : undefined
26
+ : config.modelid != ''
27
+ ? config.modelid
28
+ : undefined;
22
29
 
23
30
  try {
24
- const fetchInstancesByState = async (state) => {
25
- const result = await client.processInstances.query({ state });
26
- return result.processInstances;
27
- };
28
-
29
- const finishedInstances = await fetchInstancesByState('finished');
30
- const terminatedInstances = await fetchInstancesByState('terminated');
31
- const errorInstances = await fetchInstancesByState('error');
31
+ const result = await client.processInstances.query({
32
+ processModelId: modelId,
33
+ identity: engine.identity,
34
+ });
32
35
 
33
- let allInstances = [...finishedInstances, ...terminatedInstances, ...errorInstances];
36
+ let allInstances = result.processInstances.filter((instance) => instance.state != 'suspended');
34
37
 
35
38
  const today = new Date();
36
39