@5minds/node-red-contrib-processcube
Advanced tools
Comparing version 1.5.10 to 1.5.11-develop-0a7a7c-m4r8trh2
@@ -55,3 +55,3 @@ module.exports = function (RED) { | ||
} catch (error) { | ||
node.error(error); | ||
node.error(JSON.stringify(error)); | ||
} | ||
@@ -58,0 +58,0 @@ |
{ | ||
"name": "@5minds/node-red-contrib-processcube", | ||
"version": "1.5.10", | ||
"version": "1.5.11-develop-0a7a7c-m4r8trh2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Node-RED nodes for ProcessCube", |
@@ -71,3 +71,3 @@ module.exports = function (RED) { | ||
} catch (error) { | ||
node.error(error); | ||
node.error(JSON.stringify(error)); | ||
} | ||
@@ -115,3 +115,3 @@ }, | ||
} catch (error) { | ||
node.error(error); | ||
node.error(JSON.stringify(error)); | ||
} | ||
@@ -157,3 +157,3 @@ }, | ||
} catch (error) { | ||
node.error(error); | ||
node.error(JSON.stringify(error)); | ||
} | ||
@@ -200,3 +200,3 @@ }, | ||
} catch (error) { | ||
node.error(error); | ||
node.error(JSON.stringify(error)); | ||
} | ||
@@ -241,3 +241,3 @@ }, | ||
} catch (error) { | ||
node.error(error); | ||
node.error(JSON.stringify(error)); | ||
} | ||
@@ -283,3 +283,3 @@ }, | ||
} catch (error) { | ||
node.error(error); | ||
node.error(JSON.stringify(error)); | ||
} | ||
@@ -324,3 +324,3 @@ }, | ||
} catch (error) { | ||
node.error(error); | ||
node.error(JSON.stringify(error)); | ||
} | ||
@@ -365,3 +365,3 @@ }, | ||
} catch (error) { | ||
node.error(error); | ||
node.error(JSON.stringify(error)); | ||
} | ||
@@ -368,0 +368,0 @@ }, |
@@ -7,3 +7,2 @@ module.exports = function (RED) { | ||
node.on('input', function (msg) { | ||
const initialToken = RED.util.encodeObject(msg.payload); | ||
@@ -17,2 +16,12 @@ | ||
if (!startParameters.processModelId) { | ||
node.error('No processModelId configured.'); | ||
return; | ||
} | ||
if (!startParameters.startEventId) { | ||
node.error('No startEventId configured.'); | ||
return; | ||
} | ||
const engine = RED.nodes.getNode(config.engine); | ||
@@ -39,3 +48,3 @@ const client = engine.engineClient; | ||
.catch((error) => { | ||
node.error(error); | ||
node.error(JSON.stringify(error)); | ||
}); | ||
@@ -42,0 +51,0 @@ }); |
@@ -21,3 +21,3 @@ module.exports = function (RED) { | ||
.catch((error) => { | ||
node.error(error); | ||
node.error(JSON.stringify(error)); | ||
}); | ||
@@ -24,0 +24,0 @@ }); |
@@ -130,3 +130,3 @@ const EventEmitter = require('node:events'); | ||
} catch (e) { | ||
node.error(`Could not get fresh identity: ${e}`); | ||
node.error(`Could not get fresh identity: ${JSON.stringify(e)}`); | ||
} | ||
@@ -133,0 +133,0 @@ } |
@@ -46,3 +46,3 @@ module.exports = function (RED) { | ||
}).catch((error) => { | ||
node.error(error); | ||
node.error(JSON.stringify(error)); | ||
}); | ||
@@ -49,0 +49,0 @@ }); |
@@ -14,10 +14,11 @@ module.exports = function (RED) { | ||
} | ||
let timeMultiplier; | ||
if (msg.payload.time_type) { | ||
timeMultiplier = msg.payload.time_type == 'hours' ? 1 : 24; | ||
if (msg.payload.time_unit) { | ||
timeMultiplier = msg.payload.time_unit == 'hours' ? 1 : 24; | ||
} else { | ||
timeMultiplier = config.time_type == 'hours' ? 1 : 24; | ||
timeMultiplier = config.time_unit == 'hours' ? 1 : 24; | ||
} | ||
const timeToUse = msg.payload.time ? msg.payload.time : config.time; | ||
const timeToUse = msg.payload.duration ? msg.payload.duration : config.duration; | ||
const modelId = msg.payload.processModelId | ||
@@ -31,2 +32,4 @@ ? msg.payload.processModelId != '' | ||
const batchSize = config.batch_size || 100; // Konfigurierbare Batchgröße, Standardwert 100 | ||
try { | ||
@@ -37,3 +40,3 @@ const result = await client.processInstances.query({ | ||
let allInstances = result.processInstances.filter((instance) => instance.state != 'suspended'); | ||
let allInstances = result.processInstances.filter((instance) => instance.state != 'suspended' && instance.state != 'running'); | ||
@@ -49,8 +52,24 @@ const today = new Date(); | ||
const ids = oldTasks.map((obj) => obj.processInstanceId); | ||
msg.payload = ids; | ||
await client.processInstances.deleteProcessInstances(ids, true, engine.identity); | ||
msg.payload = { | ||
successfulDeletions: [], | ||
failedDeletions: [] | ||
}; | ||
for (let i = 0; i < ids.length; i += batchSize) { | ||
const batch = ids.slice(i, i + batchSize); | ||
try { | ||
await client.processInstances.deleteProcessInstances(batch, true, engine.identity); | ||
msg.payload.successfulDeletions.push(...batch); // Erfolgreiche IDs hinzufügen | ||
} catch (deleteError) { | ||
batch.forEach(id => { | ||
msg.payload.failedDeletions.push({ id, error: deleteError.message }); // Fehler protokollieren | ||
}); | ||
node.warn(`Failed to delete process instances in batch: ${batch.join(', ')}. Error: ${deleteError.message}`); | ||
} | ||
} | ||
node.send(msg); | ||
} catch (error) { | ||
node.error(error); | ||
} catch (queryError) { | ||
node.error(`Failed to query process instances: ${queryError.message}`); | ||
} | ||
@@ -57,0 +76,0 @@ }); |
@@ -33,3 +33,3 @@ module.exports = function (RED) { | ||
.catch((error) => { | ||
node.error(error); | ||
node.error(JSON.stringify(error)); | ||
}); | ||
@@ -36,0 +36,0 @@ }); |
@@ -60,3 +60,3 @@ module.exports = function (RED) { | ||
} catch (error) { | ||
node.error(error); | ||
node.error(JSON.stringify(error)); | ||
} | ||
@@ -63,0 +63,0 @@ }; |
@@ -39,3 +39,3 @@ module.exports = function (RED) { | ||
.catch((error) => { | ||
node.error(error); | ||
node.error(JSON.stringify(error)); | ||
}); | ||
@@ -42,0 +42,0 @@ }); |
@@ -27,3 +27,3 @@ module.exports = function (RED) { | ||
.catch((error) => { | ||
node.error(error); | ||
node.error(JSON.stringify(error)); | ||
}); | ||
@@ -30,0 +30,0 @@ } else { |
@@ -46,3 +46,3 @@ module.exports = function (RED) { | ||
} catch (error) { | ||
node.error(error); | ||
node.error(JSON.stringify(error)); | ||
} | ||
@@ -79,3 +79,3 @@ }, | ||
} catch (error) { | ||
node.error(error); | ||
node.error(JSON.stringify(error)); | ||
} | ||
@@ -82,0 +82,0 @@ } |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
529657
10159
27
10
374
2