@5minds/node-red-contrib-processcube 0.14.0-feature-084b12-lyxa7tam → 0.14.0-feature-ebe375-lyxawl6i

Sign up to get free protection for your applications and to get access to all the features.
package/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM node:20 as builder
1
+ FROM node:20 AS builder
2
2
 
3
3
  COPY ./ /src/node-red-contrib-processcube
4
4
 
@@ -14,16 +14,18 @@ module.exports = function(RED) {
14
14
 
15
15
  if (msgError === undefined) {
16
16
  msgError.message = "An error occurred";
17
- msgError.source = msg.payload;
18
17
  }
19
18
 
20
19
  msg.errorCode = config.error;
21
20
  msg.errorMessage = msgError.message;
22
- msg.errorDetails = msgError.source;
21
+ //msg.errorDetails = RED.util.encodeObject(msg); // circular structure
23
22
 
24
23
  const error = new Error(msg.errorMessage);
25
24
  error.errorCode = msg.errorCode;
26
- error.errorDetails = msg.errorDetails;
25
+ error.errorDetails = RED.util.encodeObject(msg);
26
+
27
+ // TODO: hack cause https://github.com/5minds/ProcessCube.Engine.Client.ts/blob/develop/src/ExternalTaskWorker.ts#L180
28
+ error.stack = error.errorDetails;
27
29
  error.externalTaskId = externalTaskId;
28
30
  error._msgid = msg._msgid;
29
31
 
@@ -20,7 +20,6 @@ module.exports = function(RED) {
20
20
  var flowContext = node.context().flow;
21
21
  var nodeContext = node.context();
22
22
 
23
-
24
23
  this.engine = this.server = RED.nodes.getNode(config.engine);
25
24
 
26
25
  const engineUrl = this.engine?.url || process.env.ENGINE_URL || 'http://engine:8000';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "0.14.0-feature-084b12-lyxa7tam",
3
+ "version": "0.14.0-feature-ebe375-lyxawl6i",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "authors": [
@@ -13,14 +13,29 @@ module.exports = function(RED) {
13
13
  this.identity = null;
14
14
  this.registerOnIdentityChanged = function (callback) {
15
15
  identityChangedCallbacks.push(callback);
16
- }
16
+ };
17
+
17
18
  this.setIdentity = (identity) => {
18
19
  this.identity = identity;
19
20
 
20
21
  for (const callback of identityChangedCallbacks) {
21
22
  callback(identity);
22
23
  }
23
- }
24
+ };
25
+
26
+ var nodeContext = node.context();
27
+
28
+ this.getEngineClient = () => {
29
+ const engineUrl = this.url || process.env.ENGINE_URL || 'http://engine:8000';
30
+ let client = nodeContext.get('client');
31
+
32
+ if (!client) {
33
+ nodeContext.set('client', new engine_client.EngineClient(engineUrl));
34
+ client = nodeContext.get('client');
35
+ }
36
+
37
+ return client;
38
+ };
24
39
 
25
40
  if (this.credentials.clientId && this.credentials.clientSecret) {
26
41
  const engineClient = new engine_client.EngineClient(this.url);