@5minds/node-red-contrib-processcube 0.14.0-feature-7cec87-lyytfjz9 → 0.14.0-fix-error-in-process-instance-query-9aeac9-lyzi0gix

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. package/.prettierrc.json +6 -0
  2. package/Dockerfile +1 -1
  3. package/docker-compose.yml +0 -12
  4. package/externaltask-error.html +12 -26
  5. package/externaltask-error.js +20 -19
  6. package/externaltask-input.html +14 -31
  7. package/externaltask-input.js +55 -107
  8. package/externaltask-output.html +10 -20
  9. package/externaltask-output.js +11 -12
  10. package/message-event-trigger.html +14 -14
  11. package/message-event-trigger.js +21 -25
  12. package/nodered/node-red-contrib-processcube-flows.json +132 -216
  13. package/nodered/package.json +0 -1
  14. package/nodered/settings.js +82 -92
  15. package/package.json +9 -3
  16. package/process-start.html +19 -23
  17. package/process-start.js +18 -18
  18. package/processcube-engine-config.html +10 -10
  19. package/processcube-engine-config.js +22 -30
  20. package/processdefinition-query.html +29 -23
  21. package/processdefinition-query.js +12 -16
  22. package/processes/CheckError.bpmn +78 -0
  23. package/processes/NodeRedExternalTask.bpmn +77 -0
  24. package/processes/SampleUserTask.bpmn +95 -0
  25. package/processinstance-query.html +19 -20
  26. package/processinstance-query.js +17 -12
  27. package/signal-event-trigger.html +14 -14
  28. package/signal-event-trigger.js +21 -25
  29. package/usertask-finished-listener.html +17 -12
  30. package/usertask-finished-listener.js +34 -16
  31. package/usertask-input.html +40 -27
  32. package/usertask-input.js +19 -18
  33. package/usertask-new-listener.html +17 -12
  34. package/usertask-new-listener.js +35 -18
  35. package/usertask-output.html +23 -24
  36. package/usertask-output.js +12 -12
  37. package/examples/External-Task-Sample.json +0 -252
  38. package/processes/External-Task-Sample.bpmn +0 -94
@@ -1,34 +1,39 @@
1
1
  <script type="text/javascript">
2
- RED.nodes.registerType('usertask-finished-listener',{
2
+ RED.nodes.registerType('usertask-finished-listener', {
3
3
  category: 'ProcessCube Events',
4
4
  color: '#02AFD6',
5
5
  defaults: {
6
- name: {value: ""},
7
- engine: {value: "", type: "processcube-engine-config"},
8
- multisend: {value: false}
6
+ name: { value: '' },
7
+ engine: { value: '', type: 'processcube-engine-config' },
8
+ multisend: { value: false },
9
9
  },
10
10
  inputs: 0,
11
11
  outputs: 1,
12
- icon: "font-awesome/fa-envelope",
13
- label: function() {
14
- return this.name || "usertask-finished-listener";
15
- }
12
+ icon: 'font-awesome/fa-envelope',
13
+ label: function () {
14
+ return this.name || 'usertask-finished-listener';
15
+ },
16
16
  });
17
17
  </script>
18
18
 
19
19
  <script type="text/html" data-template-name="usertask-finished-listener">
20
20
  <div class="form-row">
21
21
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
22
- <input type="text" id="node-input-name" placeholder="Name">
22
+ <input type="text" id="node-input-name" placeholder="Name" />
23
23
  </div>
24
24
  <div class="form-row">
25
25
  <label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
26
- <input type="text" id="node-input-engine" placeholder="http://engine:8000">
26
+ <input type="text" id="node-input-engine" placeholder="http://engine:8000" />
27
27
  </div>
28
28
  <div class="form-row" style="display:flex; margin-bottom: 3px;">
29
29
  <label for="node-input-multisend" style="vertical-align:top"><i class="fa fa-list-alt"></i> Send multi</label>
30
30
  <div>
31
- <input type="checkbox" checked id="node-input-multisend" style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;">
31
+ <input
32
+ type="checkbox"
33
+ checked
34
+ id="node-input-multisend"
35
+ style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;"
36
+ />
32
37
  <label style="width:auto" for="node-input-multisend">Send one output of each usertask input?</label>
33
38
  </div>
34
39
  </div>
@@ -36,4 +41,4 @@
36
41
 
37
42
  <script type="text/html" data-help-name="usertask-finished-listener">
38
43
  <p>A node which subscribes to an User Task of https://processcube.io</p>
39
- </script>
44
+ </script>
@@ -3,7 +3,7 @@ const EventEmitter = require('node:events');
3
3
 
4
4
  const engine_client = require('@5minds/processcube_engine_client');
5
5
 
6
- module.exports = function(RED) {
6
+ module.exports = function (RED) {
7
7
  function UserTaskFinishedListener(config) {
8
8
  RED.nodes.createNode(this, config);
9
9
  var node = this;
@@ -19,7 +19,7 @@ module.exports = function(RED) {
19
19
  if (!client) {
20
20
  nodeContext.set('client', new engine_client.EngineClient(engineUrl));
21
21
  client = nodeContext.get('client');
22
- }
22
+ }
23
23
 
24
24
  var eventEmitter = flowContext.get('emitter');
25
25
 
@@ -30,29 +30,47 @@ module.exports = function(RED) {
30
30
 
31
31
  const register = async () => {
32
32
  let currentIdentity = node.server.identity;
33
- let subscription = await client.userTasks.onUserTaskFinished((userTaskFinishedNotification) => {
34
- node.send({ payload: { flowNodeInstanceId: userTaskFinishedNotification.flowNodeInstanceId, action: "finished", type: "usertask" } });
35
- }, { identity: currentIdentity });
36
-
37
- node.server.registerOnIdentityChanged(async (identity) => {
33
+ let subscription = await client.userTasks.onUserTaskFinished(
34
+ (userTaskFinishedNotification) => {
35
+ node.send({
36
+ payload: {
37
+ flowNodeInstanceId: userTaskFinishedNotification.flowNodeInstanceId,
38
+ action: 'finished',
39
+ type: 'usertask',
40
+ },
41
+ });
42
+ },
43
+ { identity: currentIdentity },
44
+ );
45
+
46
+ node.server.registerOnIdentityChanged(async (identity) => {
38
47
  client.userTasks.removeSubscription(subscription, currentIdentity);
39
48
  currentIdentity = identity;
40
-
41
- subscription = await client.userTasks.onUserTaskFinished((userTaskFinishedNotification) => {
42
- node.send({ payload: { flowNodeInstanceId: userTaskFinishedNotification.flowNodeInstanceId, action: "finished", type: "usertask" } });
43
- }, { identity: currentIdentity });
49
+
50
+ subscription = await client.userTasks.onUserTaskFinished(
51
+ (userTaskFinishedNotification) => {
52
+ node.send({
53
+ payload: {
54
+ flowNodeInstanceId: userTaskFinishedNotification.flowNodeInstanceId,
55
+ action: 'finished',
56
+ type: 'usertask',
57
+ },
58
+ });
59
+ },
60
+ { identity: currentIdentity },
61
+ );
44
62
  });
45
-
46
- node.on("close", async () => {
63
+
64
+ node.on('close', async () => {
47
65
  client.userTasks.removeSubscription(subscription, currentIdentity);
48
66
  client.dispose();
49
67
  client = null;
50
68
  });
51
- }
69
+ };
52
70
 
53
71
  if (node.server) {
54
72
  register();
55
73
  }
56
74
  }
57
- RED.nodes.registerType("usertask-finished-listener", UserTaskFinishedListener);
58
- }
75
+ RED.nodes.registerType('usertask-finished-listener', UserTaskFinishedListener);
76
+ };
@@ -1,62 +1,75 @@
1
1
  <script type="text/javascript">
2
- RED.nodes.registerType('usertask-input',{
2
+ RED.nodes.registerType('usertask-input', {
3
3
  category: 'ProcessCube',
4
4
  color: '#02AFD6',
5
5
  defaults: {
6
- name: {value: ""},
7
- engine: {value: "", type: "processcube-engine-config"},
8
- query: {value: "payload"},
9
- query_type: {value: "msg"},
10
- force_send_array: {value: false},
11
- multisend: {value: false}
6
+ name: { value: '' },
7
+ engine: { value: '', type: 'processcube-engine-config' },
8
+ query: { value: 'payload' },
9
+ query_type: { value: 'msg' },
10
+ force_send_array: { value: false },
11
+ multisend: { value: false },
12
12
  },
13
13
  inputs: 1,
14
14
  outputs: 1,
15
- icon: "font-awesome/fa-envelope-open",
16
- label: function() {
17
- return this.name || "usertask-input";
15
+ icon: 'font-awesome/fa-envelope-open',
16
+ label: function () {
17
+ return this.name || 'usertask-input';
18
18
  },
19
- oneditprepare: function() {
20
- $("#node-input-query").typedInput({
19
+ oneditprepare: function () {
20
+ $('#node-input-query').typedInput({
21
21
  default: 'msg',
22
- types: ['msg', 'json']
22
+ types: ['msg', 'json'],
23
23
  });
24
24
 
25
- $("#node-input-query").typedInput('value', this.query);
26
- $("#node-input-query").typedInput('type', this.query_type);
25
+ $('#node-input-query').typedInput('value', this.query);
26
+ $('#node-input-query').typedInput('type', this.query_type);
27
+ },
28
+ oneditsave: function () {
29
+ (this.query = $('#node-input-query').typedInput('value')),
30
+ (this.query_type = $('#node-input-query').typedInput('type'));
27
31
  },
28
- oneditsave: function() {
29
- this.query = $("#node-input-query").typedInput('value'),
30
- this.query_type = $("#node-input-query").typedInput('type')
31
-
32
- }
33
32
  });
34
33
  </script>
35
34
 
36
35
  <script type="text/html" data-template-name="usertask-input">
37
36
  <div class="form-row">
38
37
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
39
- <input type="text" id="node-input-name" placeholder="Name">
38
+ <input type="text" id="node-input-name" placeholder="Name" />
40
39
  </div>
41
40
  <div class="form-row">
42
41
  <label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
43
- <input type="text" id="node-input-engine" placeholder="http://engine:8000">
42
+ <input type="text" id="node-input-engine" placeholder="http://engine:8000" />
44
43
  </div>
45
44
  <div class="form-row">
46
45
  <label for="node-input-query"><i class="fa fa-tag"></i> Query</label>
47
- <input type="text" id="node-input-query">
46
+ <input type="text" id="node-input-query" />
48
47
  </div>
49
48
  <div class="form-row" style="display:flex; margin-bottom: 3px;">
50
- <label for="node-input-force_send_array" style="vertical-align:top"><i class="fa fa-list-alt"></i> Force send payload as array</label>
49
+ <label for="node-input-force_send_array" style="vertical-align:top"
50
+ ><i class="fa fa-list-alt"></i> Force send payload as array</label
51
+ >
51
52
  <div>
52
- <input type="checkbox" checked id="node-input-force_send_array" style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;">
53
- <label style="width:auto" for="node-input-force_send_array">Alway send an array? Only works if <i>Send multi</i> is false.</label>
53
+ <input
54
+ type="checkbox"
55
+ checked
56
+ id="node-input-force_send_array"
57
+ style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;"
58
+ />
59
+ <label style="width:auto" for="node-input-force_send_array"
60
+ >Alway send an array? Only works if <i>Send multi</i> is false.</label
61
+ >
54
62
  </div>
55
63
  </div>
56
64
  <div class="form-row" style="display:flex; margin-bottom: 3px;">
57
65
  <label for="node-input-multisend" style="vertical-align:top"><i class="fa fa-list-alt"></i> Send multi</label>
58
66
  <div>
59
- <input type="checkbox" checked id="node-input-multisend" style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;">
67
+ <input
68
+ type="checkbox"
69
+ checked
70
+ id="node-input-multisend"
71
+ style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;"
72
+ />
60
73
  <label style="width:auto" for="node-input-multisend">Send one output of each usertask input?</label>
61
74
  </div>
62
75
  </div>
package/usertask-input.js CHANGED
@@ -5,15 +5,15 @@ const engine_client = require('@5minds/processcube_engine_client');
5
5
 
6
6
  function showStatus(node, msgCounter) {
7
7
  if (msgCounter >= 1) {
8
- node.status({fill: "blue", shape: "dot", text: `handling tasks ${msgCounter}`});
8
+ node.status({ fill: 'blue', shape: 'dot', text: `handling tasks ${msgCounter}` });
9
9
  } else {
10
- node.status({fill: "blue", shape: "ring", text: `subcribed ${msgCounter}`});
10
+ node.status({ fill: 'blue', shape: 'ring', text: `subcribed ${msgCounter}` });
11
11
  }
12
12
  }
13
13
 
14
- module.exports = function(RED) {
14
+ module.exports = function (RED) {
15
15
  function UserTaskInput(config) {
16
- RED.nodes.createNode(this,config);
16
+ RED.nodes.createNode(this, config);
17
17
  var node = this;
18
18
  var msgCounter = 0;
19
19
  var flowContext = node.context().flow;
@@ -37,20 +37,24 @@ module.exports = function(RED) {
37
37
  eventEmitter = flowContext.get('emitter');
38
38
  }
39
39
 
40
- node.on("close", async () => {
40
+ node.on('close', async () => {
41
41
  client.dispose();
42
42
  client = null;
43
43
  });
44
44
 
45
- node.on('input', function(msg) {
46
- let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg)
45
+ node.on('input', function (msg) {
46
+ let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
47
47
  query = {
48
48
  ...query,
49
- identity: node.server.identity
50
- }
49
+ identity: node.server.identity,
50
+ };
51
51
  client.userTasks.query(query).then((matchingFlowNodes) => {
52
-
53
- if (!config.force_send_array && matchingFlowNodes && matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length == 1) {
52
+ if (
53
+ !config.force_send_array &&
54
+ matchingFlowNodes &&
55
+ matchingFlowNodes.userTasks &&
56
+ matchingFlowNodes.userTasks.length == 1
57
+ ) {
54
58
  userTask = matchingFlowNodes.userTasks[0];
55
59
 
56
60
  msg.payload = { userTask: userTask };
@@ -59,23 +63,20 @@ module.exports = function(RED) {
59
63
  if (!config.force_send_array) {
60
64
  if (config.multisend && matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length > 1) {
61
65
  matchingFlowNodes.userTasks.forEach((userTask) => {
62
-
63
- msg.payload = { userTask: userTask } ;
66
+ msg.payload = { userTask: userTask };
64
67
  node.send(msg);
65
68
  });
66
69
  } else {
67
-
68
70
  msg.payload = { userTasks: matchingFlowNodes.userTasks };
69
71
  node.send(msg);
70
72
  }
71
73
  } else {
72
-
73
74
  msg.payload = { userTasks: matchingFlowNodes.userTasks || [] };
74
75
  node.send(msg);
75
76
  }
76
- }
77
+ }
77
78
  });
78
79
  });
79
80
  }
80
- RED.nodes.registerType("usertask-input", UserTaskInput);
81
- }
81
+ RED.nodes.registerType('usertask-input', UserTaskInput);
82
+ };
@@ -1,34 +1,39 @@
1
1
  <script type="text/javascript">
2
- RED.nodes.registerType('usertask-new-listener',{
2
+ RED.nodes.registerType('usertask-new-listener', {
3
3
  category: 'ProcessCube Events',
4
4
  color: '#02AFD6',
5
5
  defaults: {
6
- name: {value: ""},
7
- engine: {value: "", type: "processcube-engine-config"},
8
- multisend: {value: false}
6
+ name: { value: '' },
7
+ engine: { value: '', type: 'processcube-engine-config' },
8
+ multisend: { value: false },
9
9
  },
10
10
  inputs: 0,
11
11
  outputs: 1,
12
- icon: "font-awesome/fa-envelope-open",
13
- label: function() {
14
- return this.name || "usertask-new-listener";
15
- }
12
+ icon: 'font-awesome/fa-envelope-open',
13
+ label: function () {
14
+ return this.name || 'usertask-new-listener';
15
+ },
16
16
  });
17
17
  </script>
18
18
 
19
19
  <script type="text/html" data-template-name="usertask-new-listener">
20
20
  <div class="form-row">
21
21
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
22
- <input type="text" id="node-input-name" placeholder="Name">
22
+ <input type="text" id="node-input-name" placeholder="Name" />
23
23
  </div>
24
24
  <div class="form-row">
25
25
  <label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
26
- <input type="text" id="node-input-engine" placeholder="http://engine:8000">
26
+ <input type="text" id="node-input-engine" placeholder="http://engine:8000" />
27
27
  </div>
28
28
  <div class="form-row" style="display:flex; margin-bottom: 3px;">
29
29
  <label for="node-input-multisend" style="vertical-align:top"><i class="fa fa-list-alt"></i> Send multi</label>
30
30
  <div>
31
- <input type="checkbox" checked id="node-input-multisend" style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;">
31
+ <input
32
+ type="checkbox"
33
+ checked
34
+ id="node-input-multisend"
35
+ style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;"
36
+ />
32
37
  <label style="width:auto" for="node-input-multisend">Send one output of each usertask input?</label>
33
38
  </div>
34
39
  </div>
@@ -36,4 +41,4 @@
36
41
 
37
42
  <script type="text/html" data-help-name="usertask-new-listener">
38
43
  <p>A node which subscribes to an User Task of https://processcube.io</p>
39
- </script>
44
+ </script>
@@ -3,7 +3,7 @@ const EventEmitter = require('node:events');
3
3
 
4
4
  const engine_client = require('@5minds/processcube_engine_client');
5
5
 
6
- module.exports = function(RED) {
6
+ module.exports = function (RED) {
7
7
  function UserTaskNewListener(config) {
8
8
  RED.nodes.createNode(this, config);
9
9
  var node = this;
@@ -19,7 +19,7 @@ module.exports = function(RED) {
19
19
  if (!client) {
20
20
  nodeContext.set('client', new engine_client.EngineClient(engineUrl));
21
21
  client = nodeContext.get('client');
22
- }
22
+ }
23
23
 
24
24
  var eventEmitter = flowContext.get('emitter');
25
25
 
@@ -27,33 +27,50 @@ module.exports = function(RED) {
27
27
  flowContext.set('emitter', new EventEmitter());
28
28
  eventEmitter = flowContext.get('emitter');
29
29
  }
30
-
30
+
31
31
  const register = async () => {
32
32
  let currentIdentity = node.server.identity;
33
- let subscription = await client.userTasks.onUserTaskWaiting((userTaskWaitingNotification) => {
34
- node.send({ payload: { flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId, action: "new", type: "usertask" } });
35
- }, { identity: currentIdentity });
36
-
37
- node.server.registerOnIdentityChanged(async (identity) => {
33
+ let subscription = await client.userTasks.onUserTaskWaiting(
34
+ (userTaskWaitingNotification) => {
35
+ node.send({
36
+ payload: {
37
+ flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
38
+ action: 'new',
39
+ type: 'usertask',
40
+ },
41
+ });
42
+ },
43
+ { identity: currentIdentity },
44
+ );
45
+
46
+ node.server.registerOnIdentityChanged(async (identity) => {
38
47
  client.userTasks.removeSubscription(subscription, currentIdentity);
39
48
  currentIdentity = identity;
40
-
41
- subscription = await client.userTasks.onUserTaskWaiting((userTaskWaitingNotification) => {
42
- node.send({ payload: { flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId, action: "new", type: "usertask" } });
43
- }, { identity: currentIdentity });
49
+
50
+ subscription = await client.userTasks.onUserTaskWaiting(
51
+ (userTaskWaitingNotification) => {
52
+ node.send({
53
+ payload: {
54
+ flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
55
+ action: 'new',
56
+ type: 'usertask',
57
+ },
58
+ });
59
+ },
60
+ { identity: currentIdentity },
61
+ );
44
62
  });
45
-
46
- node.on("close", async () => {
63
+
64
+ node.on('close', async () => {
47
65
  client.userTasks.removeSubscription(subscription, currentIdentity);
48
66
  client.dispose();
49
67
  client = null;
50
68
  });
51
- }
69
+ };
52
70
 
53
71
  if (node.server) {
54
72
  register();
55
73
  }
56
-
57
74
  }
58
- RED.nodes.registerType("usertask-new-listener", UserTaskNewListener);
59
- }
75
+ RED.nodes.registerType('usertask-new-listener', UserTaskNewListener);
76
+ };
@@ -1,48 +1,47 @@
1
1
  <script type="text/javascript">
2
- RED.nodes.registerType('usertask-output',{
2
+ RED.nodes.registerType('usertask-output', {
3
3
  category: 'ProcessCube',
4
4
  color: '#02AFD6',
5
5
  defaults: {
6
- name: {value: ""},
7
- engine: {value: "", type: "processcube-engine-config"},
8
- result: {value: "payload"},
9
- result_type: {value: "msg"}
6
+ name: { value: '' },
7
+ engine: { value: '', type: 'processcube-engine-config' },
8
+ result: { value: 'payload' },
9
+ result_type: { value: 'msg' },
10
10
  },
11
11
  inputs: 1,
12
12
  outputs: 1,
13
- icon: "font-awesome/fa-envelope",
14
- label: function() {
15
- return this.name || "usertask-output";
13
+ icon: 'font-awesome/fa-envelope',
14
+ label: function () {
15
+ return this.name || 'usertask-output';
16
16
  },
17
- oneditprepare: function() {
18
- $("#node-input-result").typedInput({
19
- default: 'msg',
20
- types: ['msg', 'json']
21
- });
17
+ oneditprepare: function () {
18
+ $('#node-input-result').typedInput({
19
+ default: 'msg',
20
+ types: ['msg', 'json'],
21
+ });
22
22
 
23
- $("#node-input-result").typedInput('value', this.result);
24
- $("#node-input-result").typedInput('type', this.result_type);
25
- },
26
- oneditsave: function() {
27
- this.result = $("#node-input-result").typedInput('value'),
28
- this.result_type = $("#node-input-result").typedInput('type')
29
-
30
- }
23
+ $('#node-input-result').typedInput('value', this.result);
24
+ $('#node-input-result').typedInput('type', this.result_type);
25
+ },
26
+ oneditsave: function () {
27
+ (this.result = $('#node-input-result').typedInput('value')),
28
+ (this.result_type = $('#node-input-result').typedInput('type'));
29
+ },
31
30
  });
32
31
  </script>
33
32
 
34
33
  <script type="text/html" data-template-name="usertask-output">
35
34
  <div class="form-row">
36
35
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
37
- <input type="text" id="node-input-name" placeholder="Name">
36
+ <input type="text" id="node-input-name" placeholder="Name" />
38
37
  </div>
39
38
  <div class="form-row">
40
39
  <label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
41
- <input type="text" id="node-input-engine" placeholder="http://engine:8000">
40
+ <input type="text" id="node-input-engine" placeholder="http://engine:8000" />
42
41
  </div>
43
42
  <div class="form-row">
44
43
  <label for="node-input-result"><i class="fa fa-tag"></i> Result</label>
45
- <input type="text" id="node-input-result">
44
+ <input type="text" id="node-input-result" />
46
45
  </div>
47
46
  </script>
48
47
 
@@ -3,9 +3,8 @@ const EventEmitter = require('node:events');
3
3
 
4
4
  const engine_client = require('@5minds/processcube_engine_client');
5
5
 
6
- module.exports = function(RED) {
6
+ module.exports = function (RED) {
7
7
  function UserTaskOutput(config) {
8
-
9
8
  RED.nodes.createNode(this, config);
10
9
 
11
10
  var node = this;
@@ -30,24 +29,25 @@ module.exports = function(RED) {
30
29
  eventEmitter = flowContext.get('emitter');
31
30
  }
32
31
 
33
- node.on('input', function(msg) {
32
+ node.on('input', function (msg) {
34
33
  if (msg.payload.userTask) {
35
-
36
34
  const flowNodeInstanceId = msg.payload.userTask.flowNodeInstanceId;
37
35
 
38
36
  const userTaskResult = RED.util.evaluateNodeProperty(config.result, config.result_type, node, msg);
39
37
 
40
- client.userTasks.finishUserTask(flowNodeInstanceId, userTaskResult, node.server.identity).then(() => {
41
-
42
- node.send(msg);
43
- }).catch(error => {
44
- node.error(error);
45
- });
38
+ client.userTasks
39
+ .finishUserTask(flowNodeInstanceId, userTaskResult, node.server.identity)
40
+ .then(() => {
41
+ node.send(msg);
42
+ })
43
+ .catch((error) => {
44
+ node.error(error);
45
+ });
46
46
  } else {
47
47
  node.error(`No UserTask found in message: ${JSON.stringify(msg.payload)}`);
48
48
  }
49
49
  });
50
50
  }
51
51
 
52
- RED.nodes.registerType("usertask-output", UserTaskOutput);
53
- }
52
+ RED.nodes.registerType('usertask-output', UserTaskOutput);
53
+ };