@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.
@@ -0,0 +1,6 @@
1
+ {
2
+ "singleQuote": true,
3
+ "printWidth": 120,
4
+ "arrowParens": "always",
5
+ "tabWidth": 4
6
+ }
@@ -1,31 +1,31 @@
1
1
  <script type="text/javascript">
2
- RED.nodes.registerType('externaltask-error',{
2
+ RED.nodes.registerType('externaltask-error', {
3
3
  category: 'ProcessCube',
4
4
  color: '#F6A923',
5
5
  defaults: {
6
- name: {value:""},
7
- error: {value:""}
6
+ name: { value: '' },
7
+ error: { value: '' },
8
8
  },
9
9
  inputs: 1,
10
10
  outputs: 1,
11
- icon: "font-awesome/fa-exclamation-triangle",
12
- label: function() {
13
- return this.name || "externaltask-error";
14
- }
11
+ icon: 'font-awesome/fa-exclamation-triangle',
12
+ label: function () {
13
+ return this.name || 'externaltask-error';
14
+ },
15
15
  });
16
16
  </script>
17
17
 
18
18
  <script type="text/html" data-template-name="externaltask-error">
19
19
  <div class="form-row">
20
20
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
21
- <input type="text" id="node-input-name" placeholder="Name">
21
+ <input type="text" id="node-input-name" placeholder="Name" />
22
22
  </div>
23
23
  <div class="form-row">
24
24
  <label for="node-input-error"><i class="fa fa-tag"></i> Error Code</label>
25
- <input type="text" id="node-input-error" placeholder="Error Code of ExternalTask">
25
+ <input type="text" id="node-input-error" placeholder="Error Code of ExternalTask" />
26
26
  </div>
27
27
  </script>
28
28
 
29
29
  <script type="text/html" data-help-name="externaltask-error">
30
30
  <p>A node which error response to an External Task of https://processcube.io</p>
31
- </script>
31
+ </script>
@@ -1,34 +1,33 @@
1
- module.exports = function(RED) {
1
+ module.exports = function (RED) {
2
2
  function ExternalTaskError(config) {
3
- RED.nodes.createNode(this,config);
3
+ RED.nodes.createNode(this, config);
4
4
  var node = this;
5
5
 
6
6
  var flowContext = node.context().flow;
7
- var eventEmitter = flowContext.get('emitter');
8
-
9
- node.on('input', function(msg) {
7
+ var eventEmitter = flowContext.get('emitter');
10
8
 
9
+ node.on('input', function (msg) {
11
10
  const externalTaskId = msg.externalTaskId;
12
11
 
13
12
  let error = msg.error;
14
13
 
15
14
  if (error === undefined) {
16
- error.message = "An error occurred";
15
+ error.message = 'An error occurred';
17
16
  error.source = msg.payload;
18
17
  }
19
18
 
20
19
  msg.payload = {
21
- "error": {
20
+ error: {
22
21
  errorCode: config.error,
23
22
  errorMessage: error.message,
24
- errorDetails: error.source
25
- }
23
+ errorDetails: error.source,
24
+ },
26
25
  };
27
26
 
28
27
  eventEmitter.emit(`error-${externalTaskId}`, msg.payload);
29
-
28
+
30
29
  node.send(msg);
31
- });
30
+ });
32
31
  }
33
- RED.nodes.registerType("externaltask-error", ExternalTaskError);
34
- }
32
+ RED.nodes.registerType('externaltask-error', ExternalTaskError);
33
+ };
@@ -1,36 +1,36 @@
1
1
  <script type="text/javascript">
2
- RED.nodes.registerType('externaltask-input',{
2
+ RED.nodes.registerType('externaltask-input', {
3
3
  category: 'ProcessCube',
4
4
  color: '#02AFD6',
5
5
  defaults: {
6
- name: {value: ""},
7
- engine: {value: "", type: "processcube-engine-config"},
8
- topic: {value: ""}
6
+ name: { value: '' },
7
+ engine: { value: '', type: 'processcube-engine-config' },
8
+ topic: { value: '' },
9
9
  },
10
10
  inputs: 0,
11
11
  outputs: 1,
12
- icon: "font-awesome/fa-envelope-open",
13
- label: function() {
14
- return this.name||"externaltask-input";
15
- }
12
+ icon: 'font-awesome/fa-envelope-open',
13
+ label: function () {
14
+ return this.name || 'externaltask-input';
15
+ },
16
16
  });
17
17
  </script>
18
18
 
19
19
  <script type="text/html" data-template-name="externaltask-input">
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</label>
26
- <input type="text" id="node-input-engine" placeholder="Engine">
26
+ <input type="text" id="node-input-engine" placeholder="Engine" />
27
27
  </div>
28
28
  <div class="form-row">
29
29
  <label for="node-input-topic"><i class="fa fa-tag"></i> Topic</label>
30
- <input type="text" id="node-input-topic" placeholder="Topic of ExternalTask">
30
+ <input type="text" id="node-input-topic" placeholder="Topic of ExternalTask" />
31
31
  </div>
32
32
  </script>
33
33
 
34
34
  <script type="text/html" data-help-name="externaltask-input">
35
35
  <p>A node which subscribes to an External Task Topic of https://processcube.io</p>
36
- </script>
36
+ </script>
@@ -5,9 +5,9 @@ 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
 
@@ -21,9 +21,9 @@ function decrCounter(msgCounter) {
21
21
  return msgCounter;
22
22
  }
23
23
 
24
- module.exports = function(RED) {
24
+ module.exports = function (RED) {
25
25
  function ExternalTaskInput(config) {
26
- RED.nodes.createNode(this,config);
26
+ RED.nodes.createNode(this, config);
27
27
  var node = this;
28
28
  var msgCounter = 0;
29
29
  var flowContext = node.context().flow;
@@ -38,7 +38,7 @@ module.exports = function(RED) {
38
38
  if (!client) {
39
39
  nodeContext.set('client', new engine_client.EngineClient(engineUrl));
40
40
  client = nodeContext.get('client');
41
- }
41
+ }
42
42
 
43
43
  var eventEmitter = flowContext.get('emitter');
44
44
 
@@ -47,13 +47,11 @@ module.exports = function(RED) {
47
47
  eventEmitter = flowContext.get('emitter');
48
48
  }
49
49
 
50
- client.externalTasks.subscribeToExternalTaskTopic(
51
- config.topic,
52
- async (payload, externalTask) => {
50
+ client.externalTasks
51
+ .subscribeToExternalTaskTopic(config.topic, async (payload, externalTask) => {
53
52
  msgCounter++;
54
53
 
55
54
  return await new Promise((resolve, reject) => {
56
-
57
55
  // TODO: once ist 2x gebunden
58
56
  eventEmitter.once(`finish-${externalTask.flowNodeInstanceId}`, (result) => {
59
57
  msgCounter = decrCounter(msgCounter);
@@ -72,28 +70,31 @@ module.exports = function(RED) {
72
70
  });
73
71
 
74
72
  showStatus(node, msgCounter);
75
-
76
- node.send({topic: externalTask.topic, payload: payload, externalTaskId: externalTask.flowNodeInstanceId});
73
+
74
+ node.send({
75
+ topic: externalTask.topic,
76
+ payload: payload,
77
+ externalTaskId: externalTask.flowNodeInstanceId,
78
+ });
77
79
  });
78
- },
79
- ).then(async externalTaskWorker => {
80
- node.status({fill: "blue", shape: "ring", text: "subcribed"});
80
+ })
81
+ .then(async (externalTaskWorker) => {
82
+ node.status({ fill: 'blue', shape: 'ring', text: 'subcribed' });
81
83
 
82
84
  externalTaskWorker.identity = node.server.identity;
83
85
  node.server.registerOnIdentityChanged((identity) => {
84
86
  externalTaskWorker.identity = identity;
85
- });
87
+ });
86
88
  await externalTaskWorker.start();
87
89
 
88
- node.on("close", async () => {
90
+ node.on('close', async () => {
89
91
  try {
90
92
  externalTaskWorker.stop();
91
93
  } catch {
92
94
  console.warn('Client close failed');
93
95
  }
94
96
  });
95
- }
96
- );
97
+ });
97
98
  }
98
- RED.nodes.registerType("externaltask-input", ExternalTaskInput);
99
- }
99
+ RED.nodes.registerType('externaltask-input', ExternalTaskInput);
100
+ };
@@ -1,26 +1,26 @@
1
1
  <script type="text/javascript">
2
- RED.nodes.registerType('externaltask-output',{
2
+ RED.nodes.registerType('externaltask-output', {
3
3
  category: 'ProcessCube',
4
4
  color: '#02AFD6',
5
5
  defaults: {
6
- name: {value:""}
6
+ name: { value: '' },
7
7
  },
8
8
  inputs: 1,
9
9
  outputs: 0,
10
- icon: "font-awesome/fa-envelope",
11
- label: function() {
12
- return this.name||"externaltask-output";
13
- }
10
+ icon: 'font-awesome/fa-envelope',
11
+ label: function () {
12
+ return this.name || 'externaltask-output';
13
+ },
14
14
  });
15
15
  </script>
16
16
 
17
17
  <script type="text/html" data-template-name="externaltask-output">
18
18
  <div class="form-row">
19
19
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
20
- <input type="text" id="node-input-name" placeholder="Name">
20
+ <input type="text" id="node-input-name" placeholder="Name" />
21
21
  </div>
22
22
  </script>
23
23
 
24
24
  <script type="text/html" data-help-name="externaltask-output">
25
25
  <p>A node which response to an External Task of https://processcube.io</p>
26
- </script>
26
+ </script>
@@ -1,21 +1,20 @@
1
- module.exports = function(RED) {
1
+ module.exports = function (RED) {
2
2
  function ExternalTaskOutput(config) {
3
- RED.nodes.createNode(this,config);
3
+ RED.nodes.createNode(this, config);
4
4
  var node = this;
5
5
 
6
6
  var flowContext = node.context().flow;
7
7
  var eventEmitter = flowContext.get('emitter');
8
8
 
9
- node.on('input', function(msg) {
10
-
9
+ node.on('input', function (msg) {
11
10
  const externalTaskId = msg.externalTaskId;
12
11
 
13
12
  if (!externalTaskId) {
14
- node.error('Error: The message did not contain the required external task id.', msg);
15
- }
13
+ node.error('Error: The message did not contain the required external task id.', msg);
14
+ }
16
15
 
17
16
  eventEmitter.emit(`finish-${externalTaskId}`, msg.payload);
18
- });
17
+ });
19
18
  }
20
- RED.nodes.registerType("externaltask-output", ExternalTaskOutput);
21
- }
19
+ RED.nodes.registerType('externaltask-output', ExternalTaskOutput);
20
+ };
@@ -1,41 +1,41 @@
1
1
  <script type="text/javascript">
2
- RED.nodes.registerType('message-event-trigger',{
2
+ RED.nodes.registerType('message-event-trigger', {
3
3
  category: 'ProcessCube',
4
4
  color: '#02AFD6',
5
5
  defaults: {
6
- name: {value: ""},
7
- engine: {value: "", type: "processcube-engine-config"},
8
- messagename: {value: "", required: true},
9
- processInstanceId: {value:""}
6
+ name: { value: '' },
7
+ engine: { value: '', type: 'processcube-engine-config' },
8
+ messagename: { value: '', required: true },
9
+ processInstanceId: { value: '' },
10
10
  },
11
11
  inputs: 1,
12
12
  outputs: 1,
13
- icon: "font-awesome/fa-envelope-open",
14
- label: function() {
15
- return this.name||"message-event-trigger";
16
- }
13
+ icon: 'font-awesome/fa-envelope-open',
14
+ label: function () {
15
+ return this.name || 'message-event-trigger';
16
+ },
17
17
  });
18
18
  </script>
19
19
 
20
20
  <script type="text/html" data-template-name="message-event-trigger">
21
21
  <div class="form-row">
22
22
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
23
- <input type="text" id="node-input-name" placeholder="Name">
23
+ <input type="text" id="node-input-name" placeholder="Name" />
24
24
  </div>
25
25
  <div class="form-row">
26
26
  <label for="node-input-engine"><i class="fa fa-tag"></i> Engine</label>
27
- <input type="text" id="node-input-engine" placeholder="Engine">
27
+ <input type="text" id="node-input-engine" placeholder="Engine" />
28
28
  </div>
29
29
  <div class="form-row">
30
30
  <label for="node-input-messagename"><i class="fa fa-tag"></i> Message Name</label>
31
- <input type="text" id="node-input-messagename" placeholder="Name of the Message-Event">
31
+ <input type="text" id="node-input-messagename" placeholder="Name of the Message-Event" />
32
32
  </div>
33
33
  <div class="form-row">
34
34
  <label for="node-input-processinstanceid"><i class="fa fa-tag"></i> Process Instance Id</label>
35
- <input type="text" id="node-input-processinstanceid" placeholder="Id of the recipient process instance">
35
+ <input type="text" id="node-input-processinstanceid" placeholder="Id of the recipient process instance" />
36
36
  </div>
37
37
  </script>
38
38
 
39
39
  <script type="text/html" data-help-name="externaltask-input">
40
40
  <p>A node which emmits an message event to the Engine.</p>
41
- </script>
41
+ </script>
@@ -2,7 +2,7 @@ const process = require('process');
2
2
 
3
3
  const engine_client = require('@5minds/processcube_engine_client');
4
4
 
5
- module.exports = function(RED) {
5
+ module.exports = function (RED) {
6
6
  function MessageEventTrigger(config) {
7
7
  RED.nodes.createNode(this, config);
8
8
  var node = this;
@@ -17,29 +17,25 @@ module.exports = function(RED) {
17
17
  if (!client) {
18
18
  nodeContext.set('client', new engine_client.EngineClient(engineUrl));
19
19
  client = nodeContext.get('client');
20
- }
21
-
22
- node.on('input', function(msg) {
23
-
24
- client.events.triggerMessageEvent(
25
- config.messagename,
26
- {
27
- processInstanceId: config.processinstanceid,
28
- payload: msg.payload,
29
- identity: node.server.identity
30
- }
31
-
32
- ).then((result) => {
33
-
34
- msg.payload = result;
35
-
36
- node.send(msg);
37
- node.status({fill: "blue", shape: "dot", text: `message event triggered`});
38
-
39
- }).catch((error) => {
40
- node.error(error);
41
- });
20
+ }
21
+
22
+ node.on('input', function (msg) {
23
+ client.events
24
+ .triggerMessageEvent(config.messagename, {
25
+ processInstanceId: config.processinstanceid,
26
+ payload: msg.payload,
27
+ identity: node.server.identity,
28
+ })
29
+ .then((result) => {
30
+ msg.payload = result;
31
+
32
+ node.send(msg);
33
+ node.status({ fill: 'blue', shape: 'dot', text: `message event triggered` });
34
+ })
35
+ .catch((error) => {
36
+ node.error(error);
37
+ });
42
38
  });
43
39
  }
44
- RED.nodes.registerType("message-event-trigger", MessageEventTrigger);
45
- }
40
+ RED.nodes.registerType('message-event-trigger', MessageEventTrigger);
41
+ };