@5minds/node-red-contrib-processcube 0.14.0-fix-error-in-process-instance-query-433395-lyzh0xul → 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.
@@ -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
+ };