@5minds/node-red-contrib-processcube 1.6.0-process-instances-delete-HOTFIX-4de3b9-m4v609ad → 1.6.0-process-instance-delete-hotfix-de8a1e-m4v8zmvl

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.6.0-process-instances-delete-HOTFIX-4de3b9-m4v609ad",
3
+ "version": "1.6.0-process-instance-delete-hotfix-de8a1e-m4v8zmvl",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -35,21 +35,20 @@ module.exports = function (RED) {
35
35
 
36
36
  try {
37
37
  const result = await client.processInstances.query(
38
- { processModelId: modelId, finishedBefore: deletionDate },
38
+ { processModelId: modelId,
39
+ finishedBefore: deletionDate,
40
+ state: ['finished', 'error', 'terminated'],
41
+ },
39
42
  { identity: node.engine.identity }
40
43
  );
41
44
 
42
- const allInstances = result.processInstances.filter(
43
- (instance) => instance.state !== 'suspended' && instance.state !== 'running'
44
- );
45
-
46
- if (allInstances.length === 0) {
45
+ if (result.length === 0) {
47
46
  node.log('No process instances to delete.');
48
47
  node.send(msg);
49
48
  return;
50
49
  }
51
50
 
52
- const ids = allInstances.map((obj) => obj.processInstanceId);
51
+ const ids = result.map((obj) => obj.processInstanceId);
53
52
 
54
53
  msg.payload = { successfulDeletions: [], failedDeletions: [] };
55
54