@5minds/node-red-contrib-processcube 1.7.4-feature-07cad4-m6jljf8p → 1.7.4-feature-da60e6-m6kk6nga

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/process-start.js +4 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.7.4-feature-07cad4-m6jljf8p",
3
+ "version": "1.7.4-feature-da60e6-m6kk6nga",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
package/process-start.js CHANGED
@@ -35,22 +35,18 @@ module.exports = function (RED) {
35
35
  }
36
36
 
37
37
  node.engine = RED.nodes.getNode(config.engine);
38
- const engineClientExternalSecret = node.engine.engineClient;
39
-
40
- var client = engineClientExternalSecret;
38
+ const client = node.engine.engineClient;
41
39
 
42
40
  if (!client) {
43
41
  node.error('No engine configured.', msg);
44
42
  return;
45
43
  }
46
44
 
47
- if (msg._client.user) {
48
- const identity = { userId: msg._client.user.id, token: msg._client.user.accessToken };
49
- client = new engine_client.EngineClient(engineClientExternalSecret.engineUrl, identity);
50
- }
45
+ const isUser = !!msg._client.user
46
+ const identity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
51
47
 
52
48
  client.processDefinitions
53
- .startProcessInstance(startParameters)
49
+ .startProcessInstance(startParameters, identity)
54
50
  .then((result) => {
55
51
  msg.payload = result;
56
52