@5minds/node-red-contrib-processcube 1.1.2 → 1.1.3-develop-20c517-lzs4zkpn
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/usertask-input.js +35 -32
package/package.json
CHANGED
package/usertask-input.js
CHANGED
@@ -20,42 +20,45 @@ module.exports = function (RED) {
|
|
20
20
|
...query
|
21
21
|
};
|
22
22
|
|
23
|
-
client.userTasks.query(query, { identity: engine.identity} )
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
if (config.
|
37
|
-
matchingFlowNodes.userTasks.
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
if (matchingFlowNodes.userTasks == 1) {
|
43
|
-
msg.payload = {
|
44
|
-
userTasks: matchingFlowNodes.userTasks,
|
45
|
-
};
|
46
|
-
node.send(msg);
|
23
|
+
client.userTasks.query(query, { identity: engine.identity} )
|
24
|
+
.then((matchingFlowNodes) => {
|
25
|
+
if (
|
26
|
+
!config.force_send_array &&
|
27
|
+
matchingFlowNodes &&
|
28
|
+
matchingFlowNodes.userTasks &&
|
29
|
+
matchingFlowNodes.userTasks.length == 1
|
30
|
+
) {
|
31
|
+
userTask = matchingFlowNodes.userTasks[0];
|
32
|
+
|
33
|
+
msg.payload = { userTask: userTask };
|
34
|
+
node.send(msg);
|
35
|
+
} else {
|
36
|
+
if (!config.force_send_array) {
|
37
|
+
if (config.multisend && matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length > 1) {
|
38
|
+
matchingFlowNodes.userTasks.forEach((userTask) => {
|
39
|
+
msg.payload = { userTask: userTask };
|
40
|
+
node.send(msg);
|
41
|
+
});
|
47
42
|
} else {
|
48
|
-
|
43
|
+
if (matchingFlowNodes.userTasks == 1) {
|
44
|
+
msg.payload = {
|
45
|
+
userTasks: matchingFlowNodes.userTasks,
|
46
|
+
};
|
47
|
+
node.send(msg);
|
48
|
+
} else {
|
49
|
+
node.log(`No user tasks found for query: ${JSON.stringify(query)}`);
|
50
|
+
}
|
49
51
|
}
|
52
|
+
} else {
|
53
|
+
msg.payload = {
|
54
|
+
userTasks: matchingFlowNodes.userTasks || [],
|
55
|
+
};
|
56
|
+
node.send(msg);
|
50
57
|
}
|
51
|
-
} else {
|
52
|
-
msg.payload = {
|
53
|
-
userTasks: matchingFlowNodes.userTasks || [],
|
54
|
-
};
|
55
|
-
node.send(msg);
|
56
58
|
}
|
57
|
-
}
|
58
|
-
|
59
|
+
}).catch((error) => {
|
60
|
+
node.error(error);
|
61
|
+
});
|
59
62
|
});
|
60
63
|
}
|
61
64
|
RED.nodes.registerType('usertask-input', UserTaskInput);
|