@5minds/node-red-contrib-processcube 1.15.0-develop-62f409-mai3l0gh → 1.15.0-fix-waiting-for-usertask-a05829-manzzxtm
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/package.json +1 -1
- package/wait-for-usertask.js +4 -0
package/package.json
CHANGED
package/wait-for-usertask.js
CHANGED
@@ -9,10 +9,12 @@ module.exports = function (RED) {
|
|
9
9
|
let subscribe = null;
|
10
10
|
|
11
11
|
node.on('input', async function (msg) {
|
12
|
+
node.log("luis333 input")
|
12
13
|
const client = node.engine.engineClient;
|
13
14
|
const isUser = !!msg._client?.user && !!msg._client.user.accessToken;
|
14
15
|
const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
|
15
16
|
subscribe = async () => {
|
17
|
+
node.log("luis444 subscribing")
|
16
18
|
if (!client) {
|
17
19
|
node.error('No engine configured.', msg);
|
18
20
|
return;
|
@@ -21,6 +23,7 @@ module.exports = function (RED) {
|
|
21
23
|
const query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
|
22
24
|
|
23
25
|
subscription = await client.userTasks.onUserTaskWaiting(async (userTaskWaitingNotification) => {
|
26
|
+
node.log("luis555 got task")
|
24
27
|
const newQuery = {
|
25
28
|
flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
|
26
29
|
...query,
|
@@ -57,6 +60,7 @@ module.exports = function (RED) {
|
|
57
60
|
};
|
58
61
|
|
59
62
|
try {
|
63
|
+
node.log("luis777 query for old")
|
60
64
|
const matchingFlowNodes = await client.userTasks.query(suspendedQuery, {identity: userIdentity});
|
61
65
|
|
62
66
|
if (matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length >= 1) {
|