@5minds/node-red-contrib-processcube 1.5.10-feature-e89b67-m4jqa6qs → 1.5.10-feature-79d9a9-m4k1xjd3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.5.10-feature-e89b67-m4jqa6qs",
3
+ "version": "1.5.10-feature-79d9a9-m4k1xjd3",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -6,8 +6,8 @@
6
6
  name: { value: '' },
7
7
  engine: { value: '', type: 'processcube-engine-config' },
8
8
  modelid: { value: '' },
9
- duration: { value: '', type: 'number' },
10
- time_unit: { value: 'hours' },
9
+ time: { value: '', type: 'number' },
10
+ time_type: { value: 'hours' },
11
11
  },
12
12
  inputs: 1,
13
13
  outputs: 1,
@@ -32,12 +32,12 @@
32
32
  <input type="text" id="node-input-modelid" />
33
33
  </div>
34
34
  <div class="form-row">
35
- <label for="node-input-duration"><i class="fa fa-tag"></i> Duration</label>
35
+ <label for="node-input-time"><i class="fa fa-tag"></i> Duration</label>
36
36
  <input type="text" id="node-input-time" />
37
37
  </div>
38
38
  <div class="form-row">
39
- <label for="node-input-time_unit"><i class="fa fa-sliders"></i> Time Unit</label>
40
- <select id="node-input-time_unit" style="width: 70%;">
39
+ <label for="node-input-time_type"><i class="fa fa-sliders"></i> Time Unit</label>
40
+ <select id="node-input-time_type" style="width: 70%;">
41
41
  <option value="hours">Hours</option>
42
42
  <option value="days">Days</option>
43
43
  </select>
@@ -49,8 +49,8 @@ Delete old instances of a process model in the ProcessCube.
49
49
 
50
50
  ## Inputs
51
51
 
52
- : payload.duration (number): The number of given time units.
53
- : payload.time_unit ('hours' | 'days'): The unit of time 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.
54
54
 
55
55
  ## Outputs
56
56
 
@@ -11,14 +11,15 @@ module.exports = function (RED) {
11
11
  node.error('No engine configured.');
12
12
  return;
13
13
  }
14
+
14
15
  let timeMultiplier;
15
- if (msg.payload.time_unit) {
16
- timeMultiplier = msg.payload.time_unit == 'hours' ? 1 : 24;
16
+ if (msg.payload.time_type) {
17
+ timeMultiplier = msg.payload.time_type == 'hours' ? 1 : 24;
17
18
  } else {
18
- timeMultiplier = config.time_unit == 'hours' ? 1 : 24;
19
+ timeMultiplier = config.time_type == 'hours' ? 1 : 24;
19
20
  }
20
21
 
21
- const timeToUse = msg.payload.duration ? msg.payload.duration : config.duration;
22
+ const timeToUse = msg.payload.time ? msg.payload.time : config.time;
22
23
  const modelId = msg.payload.processModelId
23
24
  ? msg.payload.processModelId != ''
24
25
  ? msg.payload.processModelId
@@ -32,7 +33,7 @@ module.exports = function (RED) {
32
33
  processModelId: modelId
33
34
  }, { identity: engine.identity });
34
35
 
35
- let allInstances = result.processInstances.filter((instance) => instance.state != 'suspended');
36
+ let allInstances = result.processInstances.filter((instance) => instance.state != 'suspended' && instance.state != 'running');
36
37
 
37
38
  const today = new Date();
38
39
 
@@ -43,15 +44,29 @@ module.exports = function (RED) {
43
44
  });
44
45
 
45
46
  const ids = oldTasks.map((obj) => obj.processInstanceId);
46
- msg.payload = ids;
47
47
 
48
- await client.processInstances.deleteProcessInstances(ids, true, engine.identity);
48
+ // Änderungen: Fehler beim Löschen abfangen
49
+ msg.payload = {
50
+ successfulDeletions: [],
51
+ failedDeletions: []
52
+ };
53
+
54
+ for (const id of ids) {
55
+ try {
56
+ await client.processInstances.deleteProcessInstances([id], true, engine.identity);
57
+ msg.payload.successfulDeletions.push(id); // Erfolgreiche IDs hinzufügen
58
+ } catch (deleteError) {
59
+ msg.payload.failedDeletions.push({ id, error: deleteError.message }); // Fehler protokollieren
60
+ node.warn(`Failed to delete process instance ID: ${id}. Error: ${deleteError.message}`);
61
+ }
62
+ }
63
+
49
64
  node.send(msg);
50
- } catch (error) {
51
- node.error(error);
65
+ } catch (queryError) {
66
+ node.error(`Failed to query process instances: ${queryError.message}`);
52
67
  }
53
68
  });
54
69
  }
55
70
 
56
71
  RED.nodes.registerType('processinstance-delete', ProcessInstanceDelete);
57
- };
72
+ };