@5minds/node-red-contrib-processcube
Advanced tools
Comparing version 1.6.0-process-instances-delete-HOTFIX-4de3b9-m4v609ad to 1.6.0-process-instances-delete-HOTFIX-de8a1e-m4v6cinx
{ | ||
"name": "@5minds/node-red-contrib-processcube", | ||
"version": "1.6.0-process-instances-delete-HOTFIX-4de3b9-m4v609ad", | ||
"version": "1.6.0-process-instances-delete-HOTFIX-de8a1e-m4v6cinx", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Node-RED nodes for ProcessCube", |
@@ -38,11 +38,10 @@ module.exports = function (RED) { | ||
const result = await client.processInstances.query( | ||
{ processModelId: modelId, finishedBefore: deletionDate }, | ||
{ processModelId: modelId, | ||
finishedBefore: deletionDate, | ||
state: ['finished', 'error', 'terminated'], | ||
}, | ||
{ identity: node.engine.identity } | ||
); | ||
const allInstances = result.processInstances.filter( | ||
(instance) => instance.state !== 'suspended' && instance.state !== 'running' | ||
); | ||
if (allInstances.length === 0) { | ||
if (result.length === 0) { | ||
node.log('No process instances to delete.'); | ||
@@ -53,3 +52,3 @@ node.send(msg); | ||
const ids = allInstances.map((obj) => obj.processInstanceId); | ||
const ids = result.map((obj) => obj.processInstanceId); | ||
@@ -56,0 +55,0 @@ msg.payload = { successfulDeletions: [], failedDeletions: [] }; |
515033