@5minds/node-red-contrib-processcube 1.1.5-develop-51e433-m1hth9rs → 1.2.1-develop-3f34f2-m1xw7p4r
Sign up to get free protection for your applications and to get access to all the features.
- package/externaltask-error.js +2 -0
- package/externaltask-input.js +5 -4
- package/externaltask-output.js +14 -7
- package/package.json +1 -1
package/externaltask-error.js
CHANGED
@@ -22,6 +22,8 @@ module.exports = function (RED) {
|
|
22
22
|
msg.errorCode = config.error;
|
23
23
|
msg.errorMessage = msgError.message;
|
24
24
|
|
25
|
+
node.log(`handle-${flowNodeInstanceId}: *flowNodeInstanceId* '${flowNodeInstanceId}' with *msg._msgid* '${msg._msgid}'`);
|
26
|
+
|
25
27
|
eventEmitter.emit(`handle-${flowNodeInstanceId}`, error, true);
|
26
28
|
|
27
29
|
node.send(msg);
|
package/externaltask-input.js
CHANGED
@@ -47,7 +47,7 @@ module.exports = function (RED) {
|
|
47
47
|
let result = RED.util.encodeObject(msg.payload);
|
48
48
|
|
49
49
|
node.log(
|
50
|
-
`handle
|
50
|
+
`handle finish task *flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* ${externalTask.processInstanceId} with result ${result} on msg._msgid ${msg._msgid}.`,
|
51
51
|
);
|
52
52
|
|
53
53
|
if (externalTask.flowNodeInstanceId) {
|
@@ -62,7 +62,7 @@ module.exports = function (RED) {
|
|
62
62
|
|
63
63
|
const handleErrorTask = (msg) => {
|
64
64
|
node.log(
|
65
|
-
`handle error
|
65
|
+
`handle error task *flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' on *msg._msgid* '${msg._msgid}'.`,
|
66
66
|
);
|
67
67
|
|
68
68
|
if (externalTask.flowNodeInstanceId) {
|
@@ -80,7 +80,7 @@ module.exports = function (RED) {
|
|
80
80
|
|
81
81
|
eventEmitter.once(`handle-${externalTask.flowNodeInstanceId}`, (msg, isError = false) => {
|
82
82
|
node.log(
|
83
|
-
`handle
|
83
|
+
`handle-${externalTask.flowNodeInstanceId}: *flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' with *msg._msgid* '${msg._msgid}' and *isError* '${isError}'`,
|
84
84
|
);
|
85
85
|
|
86
86
|
if (isError) {
|
@@ -99,10 +99,11 @@ module.exports = function (RED) {
|
|
99
99
|
task: RED.util.encodeObject(externalTask),
|
100
100
|
payload: payload,
|
101
101
|
flowNodeInstanceId: externalTask.flowNodeInstanceId,
|
102
|
+
processInstanceId: externalTask.processInstanceId
|
102
103
|
};
|
103
104
|
|
104
105
|
node.log(
|
105
|
-
`
|
106
|
+
`new task *flowNodeInstanceId* '${externalTask.flowNodeInstanceId}' and *processInstanceId* '${externalTask.processInstanceId}' with *msg._msgid* '${msg._msgid}'`,
|
106
107
|
);
|
107
108
|
|
108
109
|
node.send(msg);
|
package/externaltask-output.js
CHANGED
@@ -1,21 +1,28 @@
|
|
1
1
|
module.exports = function (RED) {
|
2
2
|
function ExternalTaskOutput(config) {
|
3
3
|
RED.nodes.createNode(this, config);
|
4
|
-
|
4
|
+
const node = this;
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
const flowContext = node.context().flow;
|
7
|
+
let eventEmitter = null;
|
8
8
|
|
9
|
-
|
10
|
-
flowContext.set('emitter', new EventEmitter());
|
9
|
+
node.on('input', function (msg) {
|
11
10
|
eventEmitter = flowContext.get('emitter');
|
12
|
-
}
|
13
11
|
|
14
|
-
|
12
|
+
if (!eventEmitter) {
|
13
|
+
flowContext.set('emitter', new EventEmitter());
|
14
|
+
eventEmitter = flowContext.get('emitter');
|
15
|
+
}
|
16
|
+
|
15
17
|
const flowNodeInstanceId = msg.flowNodeInstanceId;
|
18
|
+
const processInstanceId = msg.processInstanceId;
|
16
19
|
|
17
20
|
if (!flowNodeInstanceId) {
|
18
21
|
node.error('Error: The message did not contain the required external task id.', msg);
|
22
|
+
} else {
|
23
|
+
node.log(
|
24
|
+
`handle-${flowNodeInstanceId}: *flowNodeInstanceId* '${flowNodeInstanceId}' and *processInstanceId* '${processInstanceId}' with *msg._msgid* '${msg._msgid}'`,
|
25
|
+
);
|
19
26
|
}
|
20
27
|
|
21
28
|
eventEmitter.emit(`handle-${flowNodeInstanceId}`, msg, false);
|