@5minds/node-red-contrib-processcube 1.5.10-feature-d3ca99-m4jqtub3 → 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.
@@ -52,7 +52,7 @@ module.exports = function (RED) {
52
52
  );
53
53
  });
54
54
  } catch (error) {
55
- node.error(JSON.stringify(error));
55
+ node.error(error);
56
56
  }
57
57
 
58
58
  node.on('close', async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.5.10-feature-d3ca99-m4jqtub3",
3
+ "version": "1.5.10-feature-79d9a9-m4k1xjd3",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -68,7 +68,7 @@ module.exports = function (RED) {
68
68
  });
69
69
  }
70
70
  } catch (error) {
71
- node.error(JSON.stringify(error));
71
+ node.error(error);
72
72
  }
73
73
  },
74
74
  { identity: currentIdentity }
@@ -111,7 +111,7 @@ module.exports = function (RED) {
111
111
  });
112
112
  }
113
113
  } catch (error) {
114
- node.error(JSON.stringify(error));
114
+ node.error(error);
115
115
  }
116
116
  },
117
117
  { identity: currentIdentity }
@@ -152,7 +152,7 @@ module.exports = function (RED) {
152
152
  });
153
153
  }
154
154
  } catch (error) {
155
- node.error(JSON.stringify(error));
155
+ node.error(error);
156
156
  }
157
157
  },
158
158
  { identity: currentIdentity }
@@ -194,7 +194,7 @@ module.exports = function (RED) {
194
194
  });
195
195
  }
196
196
  } catch (error) {
197
- node.error(JSON.stringify(error));
197
+ node.error(error);
198
198
  }
199
199
  },
200
200
  { identity: currentIdentity }
@@ -234,7 +234,7 @@ module.exports = function (RED) {
234
234
  });
235
235
  }
236
236
  } catch (error) {
237
- node.error(JSON.stringify(error));
237
+ node.error(error);
238
238
  }
239
239
  },
240
240
  { identity: currentIdentity }
@@ -275,7 +275,7 @@ module.exports = function (RED) {
275
275
  });
276
276
  }
277
277
  } catch (error) {
278
- node.error(JSON.stringify(error));
278
+ node.error(error);
279
279
  }
280
280
  },
281
281
  { identity: currentIdentity }
@@ -315,7 +315,7 @@ module.exports = function (RED) {
315
315
  });
316
316
  }
317
317
  } catch (error) {
318
- node.error(JSON.stringify(error));
318
+ node.error(error);
319
319
  }
320
320
  },
321
321
  { identity: currentIdentity }
@@ -355,7 +355,7 @@ module.exports = function (RED) {
355
355
  });
356
356
  }
357
357
  } catch (error) {
358
- node.error(JSON.stringify(error));
358
+ node.error(error);
359
359
  }
360
360
  },
361
361
  { identity: currentIdentity }
package/process-start.js CHANGED
@@ -43,7 +43,7 @@ module.exports = function (RED) {
43
43
  });
44
44
  })
45
45
  .catch((error) => {
46
- node.error(JSON.stringify(error));
46
+ node.error(error);
47
47
  });
48
48
  });
49
49
  }
@@ -18,7 +18,7 @@ module.exports = function (RED) {
18
18
  node.send(msg);
19
19
  })
20
20
  .catch((error) => {
21
- node.error(JSON.stringify(error));
21
+ node.error(error);
22
22
  });
23
23
  });
24
24
  }
@@ -127,7 +127,7 @@ module.exports = function (RED) {
127
127
 
128
128
  return freshIdentity;
129
129
  } catch (e) {
130
- node.error(`Could not get fresh identity: ${JSON.stringify(e)}`);
130
+ node.error(`Could not get fresh identity: ${e}`);
131
131
  }
132
132
  }
133
133
 
@@ -43,7 +43,7 @@ module.exports = function (RED) {
43
43
 
44
44
  node.send(msg);
45
45
  }).catch((error) => {
46
- node.error(JSON.stringify(error));
46
+ node.error(error);
47
47
  });
48
48
  });
49
49
  }
@@ -11,6 +11,7 @@ module.exports = function (RED) {
11
11
  node.error('No engine configured.');
12
12
  return;
13
13
  }
14
+
14
15
  let timeMultiplier;
15
16
  if (msg.payload.time_type) {
16
17
  timeMultiplier = msg.payload.time_type == 'hours' ? 1 : 24;
@@ -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(JSON.stringify(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
+ };
@@ -30,7 +30,7 @@ module.exports = function (RED) {
30
30
  });
31
31
  })
32
32
  .catch((error) => {
33
- node.error(JSON.stringify(error));
33
+ node.error(error);
34
34
  });
35
35
  });
36
36
  }
@@ -57,7 +57,7 @@ module.exports = function (RED) {
57
57
  });
58
58
  }
59
59
  } catch (error) {
60
- node.error(JSON.stringify(error));
60
+ node.error(error);
61
61
  }
62
62
  };
63
63
  }
package/usertask-input.js CHANGED
@@ -36,7 +36,7 @@ module.exports = function (RED) {
36
36
  } else node.log(`No user tasks found for query: ${JSON.stringify(query)}`);
37
37
  })
38
38
  .catch((error) => {
39
- node.error(JSON.stringify(error));
39
+ node.error(error);
40
40
  });
41
41
  });
42
42
  }
@@ -24,7 +24,7 @@ module.exports = function (RED) {
24
24
  node.send(msg);
25
25
  })
26
26
  .catch((error) => {
27
- node.error(JSON.stringify(error));
27
+ node.error(error);
28
28
  });
29
29
  } else {
30
30
  node.error(`No UserTask found in message: ${JSON.stringify(msg.payload)}`);
@@ -43,7 +43,7 @@ module.exports = function (RED) {
43
43
  // nothing todo - wait for next notification
44
44
  }
45
45
  } catch (error) {
46
- node.error(JSON.stringify(error));
46
+ node.error(error);
47
47
  }
48
48
  },
49
49
  { identity: currentIdentity }
@@ -75,7 +75,7 @@ module.exports = function (RED) {
75
75
  // let the *currentIdentity* be active
76
76
  }
77
77
  } catch (error) {
78
- node.error(JSON.stringify(error));
78
+ node.error(error);
79
79
  }
80
80
  }
81
81
  };