@5minds/node-red-contrib-processcube 0.14.0 → 0.15.0-error-handling-in-process-instance-query-and-add-prettier-6b3dae-lz096tqk

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.
@@ -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>
@@ -1,7 +1,7 @@
1
- const process = require("process");
2
- const EventEmitter = require("node:events");
1
+ const process = require('process');
2
+ const EventEmitter = require('node:events');
3
3
 
4
- const engine_client = require("@5minds/processcube_engine_client");
4
+ const engine_client = require('@5minds/processcube_engine_client');
5
5
 
6
6
  module.exports = function (RED) {
7
7
  function UserTaskNewListener(config) {
@@ -13,11 +13,11 @@ module.exports = function (RED) {
13
13
 
14
14
  const client = this.engine.getEngineClient();
15
15
 
16
- var eventEmitter = flowContext.get("emitter");
16
+ var eventEmitter = flowContext.get('emitter');
17
17
 
18
18
  if (!eventEmitter) {
19
- flowContext.set("emitter", new EventEmitter());
20
- eventEmitter = flowContext.get("emitter");
19
+ flowContext.set('emitter', new EventEmitter());
20
+ eventEmitter = flowContext.get('emitter');
21
21
  }
22
22
 
23
23
  const register = async () => {
@@ -26,43 +26,35 @@ module.exports = function (RED) {
26
26
  (userTaskWaitingNotification) => {
27
27
  node.send({
28
28
  payload: {
29
- flowNodeInstanceId:
30
- userTaskWaitingNotification.flowNodeInstanceId,
31
- action: "new",
32
- type: "usertask",
29
+ flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
30
+ action: 'new',
31
+ type: 'usertask',
33
32
  },
34
33
  });
35
34
  },
36
- { identity: currentIdentity }
35
+ { identity: currentIdentity },
37
36
  );
38
37
 
39
38
  node.server.registerOnIdentityChanged(async (identity) => {
40
- client.userTasks.removeSubscription(
41
- subscription,
42
- currentIdentity
43
- );
39
+ client.userTasks.removeSubscription(subscription, currentIdentity);
44
40
  currentIdentity = identity;
45
41
 
46
42
  subscription = await client.userTasks.onUserTaskWaiting(
47
43
  (userTaskWaitingNotification) => {
48
44
  node.send({
49
45
  payload: {
50
- flowNodeInstanceId:
51
- userTaskWaitingNotification.flowNodeInstanceId,
52
- action: "new",
53
- type: "usertask",
46
+ flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
47
+ action: 'new',
48
+ type: 'usertask',
54
49
  },
55
50
  });
56
51
  },
57
- { identity: currentIdentity }
52
+ { identity: currentIdentity },
58
53
  );
59
54
  });
60
55
 
61
- node.on("close", async () => {
62
- client.userTasks.removeSubscription(
63
- subscription,
64
- currentIdentity
65
- );
56
+ node.on('close', async () => {
57
+ client.userTasks.removeSubscription(subscription, currentIdentity);
66
58
  client.dispose();
67
59
  client = null;
68
60
  });
@@ -72,5 +64,5 @@ module.exports = function (RED) {
72
64
  register();
73
65
  }
74
66
  }
75
- RED.nodes.registerType("usertask-new-listener", UserTaskNewListener);
67
+ RED.nodes.registerType('usertask-new-listener', UserTaskNewListener);
76
68
  };
@@ -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
 
@@ -1,7 +1,7 @@
1
- const process = require("process");
2
- const EventEmitter = require("node:events");
1
+ const process = require('process');
2
+ const EventEmitter = require('node:events');
3
3
 
4
- const engine_client = require("@5minds/processcube_engine_client");
4
+ const engine_client = require('@5minds/processcube_engine_client');
5
5
 
6
6
  module.exports = function (RED) {
7
7
  function UserTaskOutput(config) {
@@ -14,31 +14,21 @@ module.exports = function (RED) {
14
14
 
15
15
  const client = this.engine.getEngineClient();
16
16
 
17
- var eventEmitter = flowContext.get("emitter");
17
+ var eventEmitter = flowContext.get('emitter');
18
18
 
19
19
  if (!eventEmitter) {
20
- flowContext.set("emitter", new EventEmitter());
21
- eventEmitter = flowContext.get("emitter");
20
+ flowContext.set('emitter', new EventEmitter());
21
+ eventEmitter = flowContext.get('emitter');
22
22
  }
23
23
 
24
- node.on("input", function (msg) {
24
+ node.on('input', function (msg) {
25
25
  if (msg.payload.userTask) {
26
- const flowNodeInstanceId =
27
- msg.payload.userTask.flowNodeInstanceId;
26
+ const flowNodeInstanceId = msg.payload.userTask.flowNodeInstanceId;
28
27
 
29
- const userTaskResult = RED.util.evaluateNodeProperty(
30
- config.result,
31
- config.result_type,
32
- node,
33
- msg
34
- );
28
+ const userTaskResult = RED.util.evaluateNodeProperty(config.result, config.result_type, node, msg);
35
29
 
36
30
  client.userTasks
37
- .finishUserTask(
38
- flowNodeInstanceId,
39
- userTaskResult,
40
- node.server.identity
41
- )
31
+ .finishUserTask(flowNodeInstanceId, userTaskResult, node.server.identity)
42
32
  .then(() => {
43
33
  node.send(msg);
44
34
  })
@@ -46,12 +36,10 @@ module.exports = function (RED) {
46
36
  node.error(error);
47
37
  });
48
38
  } else {
49
- node.error(
50
- `No UserTask found in message: ${JSON.stringify(msg.payload)}`
51
- );
39
+ node.error(`No UserTask found in message: ${JSON.stringify(msg.payload)}`);
52
40
  }
53
41
  });
54
42
  }
55
43
 
56
- RED.nodes.registerType("usertask-output", UserTaskOutput);
44
+ RED.nodes.registerType('usertask-output', UserTaskOutput);
57
45
  };