@5minds/node-red-contrib-processcube 1.16.1-feature-b8d70b-mhvx8c1e → 1.16.1-feature-32d817-mhvxfpgt
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/externaltask-input.js +0 -28
- package/package.json +1 -1
package/externaltask-input.js
CHANGED
|
@@ -11,9 +11,7 @@ class ExternalTaskNodeStates {
|
|
|
11
11
|
this.nodeStades[nodeId] = { gotSend: false, gotCompleted: false };
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
console.log(`[DEBUG] markSended - flowNodeInstanceId: ${this.flowNodeInstanceId}, nodeId: ${nodeId}, before: ${JSON.stringify(this.nodeStades[nodeId])}`);
|
|
15
14
|
this.nodeStades[nodeId].gotSend = true;
|
|
16
|
-
console.log(`[DEBUG] markSended - after: ${JSON.stringify(this.nodeStades[nodeId])}`);
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
markCompleted(nodeId) {
|
|
@@ -21,16 +19,13 @@ class ExternalTaskNodeStates {
|
|
|
21
19
|
this.nodeStades[nodeId] = { gotSend: false, gotCompleted: false };
|
|
22
20
|
}
|
|
23
21
|
|
|
24
|
-
console.log(`[DEBUG] markCompleted - flowNodeInstanceId: ${this.flowNodeInstanceId}, nodeId: ${nodeId}, before: ${JSON.stringify(this.nodeStades[nodeId])}`);
|
|
25
22
|
this.nodeStades[nodeId].gotCompleted = true;
|
|
26
|
-
console.log(`[DEBUG] markCompleted - after: ${JSON.stringify(this.nodeStades[nodeId])}`);
|
|
27
23
|
}
|
|
28
24
|
|
|
29
25
|
checkIfCompletedWithoutSend(nodeId) {
|
|
30
26
|
const nodeState = this.nodeStades[nodeId];
|
|
31
27
|
const result = (nodeState && nodeState.gotCompleted && !nodeState.gotSend);
|
|
32
28
|
|
|
33
|
-
console.log(`[DEBUG] checkIfCompletedWithoutSend - flowNodeInstanceId: ${this.flowNodeInstanceId}, nodeId: ${nodeId}, nodeState: ${JSON.stringify(nodeState)}, result: ${result}`);
|
|
34
29
|
return result;
|
|
35
30
|
}
|
|
36
31
|
}
|
|
@@ -48,8 +43,6 @@ module.exports = function (RED) {
|
|
|
48
43
|
const wires = fullNode?.wires;
|
|
49
44
|
const hasConnectedOutputs = wires && wires.some(wireArray => wireArray && wireArray.length > 0);
|
|
50
45
|
|
|
51
|
-
console.log(`[DEBUG] raiseExternalTaskError called for flowNodeInstanceId: ${flowNodeInstanceId}, nodeId: ${nodeId}, hasConnectedOutputs: ${hasConnectedOutputs}`);
|
|
52
|
-
|
|
53
46
|
if (hasConnectedOutputs) {
|
|
54
47
|
const inputNode = RED.nodes.getNode(etwInputNodeId);
|
|
55
48
|
|
|
@@ -64,10 +57,7 @@ module.exports = function (RED) {
|
|
|
64
57
|
nodeType: fullNode.type
|
|
65
58
|
});
|
|
66
59
|
|
|
67
|
-
console.log(`[DEBUG] Emitting error event for flowNodeInstanceId: ${flowNodeInstanceId}, error: ${errorMessage}`);
|
|
68
60
|
inputNode.eventEmitter.emit(`handle-${flowNodeInstanceId}`, error, true);
|
|
69
|
-
} else {
|
|
70
|
-
console.log(`[DEBUG] Cannot raise error - inputNode or eventEmitter not found for etwInputNodeId: ${etwInputNodeId}`);
|
|
71
61
|
}
|
|
72
62
|
}
|
|
73
63
|
};
|
|
@@ -80,10 +70,7 @@ module.exports = function (RED) {
|
|
|
80
70
|
if (sendEvent.msg?.flowNodeInstanceId) {
|
|
81
71
|
let externalTaskNodeStates = globalExternalTaskStates[sendEvent.msg.flowNodeInstanceId];
|
|
82
72
|
|
|
83
|
-
console.log(`[DEBUG] onSend - flowNodeInstanceId: ${sendEvent.msg.flowNodeInstanceId}, nodeId: ${sendEvent.source.node.id}, stateExists: ${!!externalTaskNodeStates}`);
|
|
84
|
-
|
|
85
73
|
if (!externalTaskNodeStates) {
|
|
86
|
-
console.log(`[DEBUG] onSend - Creating NEW ExternalTaskNodeStates for flowNodeInstanceId: ${sendEvent.msg.flowNodeInstanceId}`);
|
|
87
74
|
externalTaskNodeStates = new ExternalTaskNodeStates(sendEvent.msg.flowNodeInstanceId);
|
|
88
75
|
globalExternalTaskStates[sendEvent.msg.flowNodeInstanceId] = externalTaskNodeStates;
|
|
89
76
|
}
|
|
@@ -91,7 +78,6 @@ module.exports = function (RED) {
|
|
|
91
78
|
externalTaskNodeStates.markSended(sendEvent.source.node.id)
|
|
92
79
|
|
|
93
80
|
if (externalTaskNodeStates.checkIfCompletedWithoutSend(sendEvent.source.node.id)) {
|
|
94
|
-
console.log(`[DEBUG] onSend - Node completed without send detected! Raising error for nodeId: ${sendEvent.source.node.id}`);
|
|
95
81
|
raiseExternalTaskError(sendEvent.msg.flowNodeInstanceId, sendEvent.msg.etw_input_node_id, sendEvent.source.node.id);
|
|
96
82
|
}
|
|
97
83
|
}
|
|
@@ -104,10 +90,7 @@ module.exports = function (RED) {
|
|
|
104
90
|
if (completeEvent.msg?.flowNodeInstanceId) {
|
|
105
91
|
let externalTaskNodeStates = globalExternalTaskStates[completeEvent.msg.flowNodeInstanceId];
|
|
106
92
|
|
|
107
|
-
console.log(`[DEBUG] onComplete - flowNodeInstanceId: ${completeEvent.msg.flowNodeInstanceId}, nodeId: ${completeEvent.node.id}, stateExists: ${!!externalTaskNodeStates}`);
|
|
108
|
-
|
|
109
93
|
if (!externalTaskNodeStates) {
|
|
110
|
-
console.log(`[DEBUG] onComplete - Creating NEW ExternalTaskNodeStates for flowNodeInstanceId: ${completeEvent.msg.flowNodeInstanceId}`);
|
|
111
94
|
externalTaskNodeStates = new ExternalTaskNodeStates(completeEvent.msg.flowNodeInstanceId);
|
|
112
95
|
globalExternalTaskStates[completeEvent.msg.flowNodeInstanceId] = externalTaskNodeStates;
|
|
113
96
|
}
|
|
@@ -115,7 +98,6 @@ module.exports = function (RED) {
|
|
|
115
98
|
externalTaskNodeStates.markCompleted(completeEvent.node.id);
|
|
116
99
|
|
|
117
100
|
if (externalTaskNodeStates.checkIfCompletedWithoutSend(completeEvent.node.id)) {
|
|
118
|
-
console.log(`[DEBUG] onComplete - Node completed without send detected! Raising error for nodeId: ${completeEvent.node.id}`);
|
|
119
101
|
raiseExternalTaskError(completeEvent.msg.flowNodeInstanceId, completeEvent.msg.etw_input_node_id, completeEvent.node.id);
|
|
120
102
|
}
|
|
121
103
|
}
|
|
@@ -477,8 +459,6 @@ module.exports = function (RED) {
|
|
|
477
459
|
}
|
|
478
460
|
const etwCallback = async (payload, externalTask) => {
|
|
479
461
|
|
|
480
|
-
console.log(`[DEBUG] etwCallback - NEW External Task received! flowNodeInstanceId: ${externalTask.flowNodeInstanceId}, processInstanceId: ${externalTask.processInstanceId}`);
|
|
481
|
-
console.log(`[DEBUG] etwCallback - Creating NEW ExternalTaskNodeStates for flowNodeInstanceId: ${externalTask.flowNodeInstanceId}`);
|
|
482
462
|
globalExternalTaskStates[externalTask.flowNodeInstanceId] = new ExternalTaskNodeStates(externalTask.flowNodeInstanceId);
|
|
483
463
|
|
|
484
464
|
const saveHandleCallback = (data, callback, msg) => {
|
|
@@ -488,7 +468,6 @@ module.exports = function (RED) {
|
|
|
488
468
|
|
|
489
469
|
// Remove ExternalTaskState from global dictionary
|
|
490
470
|
if (globalExternalTaskStates[externalTask.flowNodeInstanceId]) {
|
|
491
|
-
console.log(`[DEBUG] saveHandleCallback SUCCESS - Deleting ExternalTaskNodeStates for flowNodeInstanceId: ${externalTask.flowNodeInstanceId}`);
|
|
492
471
|
delete globalExternalTaskStates[externalTask.flowNodeInstanceId];
|
|
493
472
|
}
|
|
494
473
|
|
|
@@ -496,7 +475,6 @@ module.exports = function (RED) {
|
|
|
496
475
|
} catch (error) {
|
|
497
476
|
// Remove ExternalTaskState from global dictionary on error as well
|
|
498
477
|
if (globalExternalTaskStates[externalTask.flowNodeInstanceId]) {
|
|
499
|
-
console.log(`[DEBUG] saveHandleCallback ERROR - Deleting ExternalTaskNodeStates for flowNodeInstanceId: ${externalTask.flowNodeInstanceId}, error: ${error?.message}`);
|
|
500
478
|
delete globalExternalTaskStates[externalTask.flowNodeInstanceId];
|
|
501
479
|
}
|
|
502
480
|
|
|
@@ -524,7 +502,6 @@ module.exports = function (RED) {
|
|
|
524
502
|
};
|
|
525
503
|
|
|
526
504
|
const handleErrorTask = (error) => {
|
|
527
|
-
console.log(`[DEBUG] handleErrorTask - flowNodeInstanceId: ${externalTask.flowNodeInstanceId}, errorCode: ${error?.errorCode}, errorMessage: ${error?.message}`);
|
|
528
505
|
node.log(
|
|
529
506
|
`handle error event for *external task flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' on *msg._msgid* '${error.errorDetails?._msgid}'.`
|
|
530
507
|
);
|
|
@@ -537,8 +514,6 @@ module.exports = function (RED) {
|
|
|
537
514
|
};
|
|
538
515
|
|
|
539
516
|
node.eventEmitter.once(`handle-${externalTask.flowNodeInstanceId}`, (msg, isError = false) => {
|
|
540
|
-
console.log(`[DEBUG] eventEmitter handle event - flowNodeInstanceId: ${externalTask.flowNodeInstanceId}, isError: ${isError}, msgId: ${msg._msgid}`);
|
|
541
|
-
|
|
542
517
|
try {
|
|
543
518
|
msg.etw_finished_at = new Date().toISOString();
|
|
544
519
|
|
|
@@ -555,10 +530,8 @@ module.exports = function (RED) {
|
|
|
555
530
|
|
|
556
531
|
|
|
557
532
|
if (isError) {
|
|
558
|
-
console.log(`[DEBUG] Routing to handleErrorTask`);
|
|
559
533
|
handleErrorTask(msg);
|
|
560
534
|
} else {
|
|
561
|
-
console.log(`[DEBUG] Routing to handleFinishTask`);
|
|
562
535
|
handleFinishTask(msg);
|
|
563
536
|
}
|
|
564
537
|
});
|
|
@@ -580,7 +553,6 @@ module.exports = function (RED) {
|
|
|
580
553
|
);
|
|
581
554
|
|
|
582
555
|
node.send(msg);
|
|
583
|
-
console.log(`[DEBUG] etwCallback - Sent message for flowNodeInstanceId: ${externalTask.flowNodeInstanceId}, msgId: ${msg._msgid}`);
|
|
584
556
|
});
|
|
585
557
|
};
|
|
586
558
|
|