@5minds/node-red-contrib-processcube 1.5.11 → 1.5.12-develop-c71c09-m4sa8e6d

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.
@@ -6,17 +6,6 @@ module.exports = function (RED) {
6
6
 
7
7
  let subscription = null;
8
8
 
9
- const eventEmitter = node.engine.eventEmitter;
10
-
11
- eventEmitter.on('engine-client-dispose', () => {
12
- node.engine.engineClient.events.removeSubscription(subscription, node.engine.identity);
13
- });
14
-
15
- eventEmitter.on('engine-client-changed', () => {
16
- node.log('new engineClient received');
17
- register();
18
- });
19
-
20
9
  const register = async () => {
21
10
  const client = node.engine.engineClient;
22
11
 
@@ -25,31 +14,11 @@ module.exports = function (RED) {
25
14
  return;
26
15
  }
27
16
 
28
- let currentIdentity = node.engine.identity;
29
-
30
17
  try {
31
- subscription = await client.events.onEndEventFinished(
32
- (endEventFinished) => {
33
- node.send({
34
- payload: endEventFinished,
35
- });
36
- },
37
- { identity: currentIdentity }
38
- );
39
-
40
- node.engine.registerOnIdentityChanged(async (identity) => {
41
- client.events.removeSubscription(subscription, currentIdentity);
42
-
43
- currentIdentity = identity;
44
-
45
- subscription = await client.events.onEndEventFinished(
46
- (endEventFinished) => {
47
- node.send({
48
- payload: endEventFinished,
49
- });
50
- },
51
- { identity: currentIdentity }
52
- );
18
+ subscription = await client.events.onEndEventFinished((endEventFinished) => {
19
+ node.send({
20
+ payload: endEventFinished,
21
+ });
53
22
  });
54
23
  } catch (error) {
55
24
  node.error(JSON.stringify(error));
@@ -57,7 +26,7 @@ module.exports = function (RED) {
57
26
 
58
27
  node.on('close', async () => {
59
28
  if (node.engine && node.engine.engineClient && client) {
60
- client.events.removeSubscription(subscription, currentIdentity);
29
+ client.events.removeSubscription(subscription);
61
30
  }
62
31
  });
63
32
  };
@@ -6,20 +6,7 @@ module.exports = function (RED) {
6
6
 
7
7
  let subscription;
8
8
 
9
- const eventEmitter = node.engine.eventEmitter;
10
-
11
- eventEmitter.on('engine-client-dispose', () => {
12
- node.engine.engineClient.notification.removeSubscription(subscription, node.engine.identity);
13
- });
14
-
15
- eventEmitter.on('engine-client-changed', () => {
16
- node.log('new engineClient received');
17
- register();
18
- });
19
-
20
9
  const register = async () => {
21
- let currentIdentity = node.engine.identity;
22
-
23
10
  const client = node.engine.engineClient;
24
11
 
25
12
  if (!client) {
@@ -44,38 +31,21 @@ module.exports = function (RED) {
44
31
  async function subscribe() {
45
32
  switch (config.eventtype) {
46
33
  case 'created':
47
- return await client.notification.onExternalTaskCreated(externalTaskCallback(), {
48
- identity: currentIdentity,
49
- });
34
+ return await client.notification.onExternalTaskCreated(externalTaskCallback());
50
35
  case 'locked':
51
- return await client.notification.onExternalTaskLocked(externalTaskCallback(), {
52
- identity: currentIdentity,
53
- });
36
+ return await client.notification.onExternalTaskLocked(externalTaskCallback());
54
37
  case 'unlocked':
55
- return await client.notification.onExternalTaskUnlocked(externalTaskCallback(), {
56
- identity: currentIdentity,
57
- });
38
+ return await client.notification.onExternalTaskUnlocked(externalTaskCallback());
58
39
  default:
59
40
  console.error('no such event: ' + config.eventtype);
60
41
  }
61
42
  }
62
43
 
63
- if (node.engine.isIdentityReady()) {
64
- subscription = subscribe();
65
- }
66
-
67
- node.engine.registerOnIdentityChanged(async (identity) => {
68
- if (subscription) {
69
- client.notification.removeSubscription(subscription, currentIdentity);
70
- }
71
- currentIdentity = identity;
72
-
73
- subscription = subscribe();
74
- });
44
+ subscription = subscribe();
75
45
 
76
46
  node.on('close', async () => {
77
47
  if (node.engine && node.engine.engineClient && client) {
78
- client.notification.removeSubscription(subscription, currentIdentity);
48
+ client.notification.removeSubscription(subscription);
79
49
  }
80
50
  });
81
51
  };
@@ -16,7 +16,7 @@ module.exports = function (RED) {
16
16
  var node = this;
17
17
  var flowContext = node.context().flow;
18
18
 
19
- const engine = RED.nodes.getNode(config.engine);
19
+ node.engine = RED.nodes.getNode(config.engine);
20
20
 
21
21
  var eventEmitter = flowContext.get('emitter');
22
22
 
@@ -25,13 +25,6 @@ module.exports = function (RED) {
25
25
  eventEmitter = flowContext.get('emitter');
26
26
  }
27
27
 
28
- const engineEventEmitter = engine.eventEmitter;
29
-
30
- engineEventEmitter.on('engine-client-changed', () => {
31
- node.log('new engineClient received');
32
- register();
33
- });
34
-
35
28
  const register = async () => {
36
29
  if (node.etw) {
37
30
  try {
@@ -41,7 +34,7 @@ module.exports = function (RED) {
41
34
  node.log(`cant close etw: ${JSON.stringify(node.etw)}`);
42
35
  }
43
36
  }
44
- const client = engine.engineClient;
37
+ const client = node.engine.engineClient;
45
38
 
46
39
  if (!client) {
47
40
  node.error('No engine configured.');
@@ -133,11 +126,6 @@ module.exports = function (RED) {
133
126
 
134
127
  node.etw = externalTaskWorker;
135
128
 
136
- externalTaskWorker.identity = engine.identity;
137
- engine.registerOnIdentityChanged((identity) => {
138
- externalTaskWorker.identity = identity;
139
- });
140
-
141
129
  // export type WorkerErrorHandler = (errorType: 'fetchAndLock' | 'extendLock' | 'processExternalTask' | 'finishExternalTask', error: Error, externalTask?: ExternalTask<any>) => void;
142
130
  externalTaskWorker.onWorkerError((errorType, error, externalTask) => {
143
131
  switch (errorType) {
@@ -185,7 +173,7 @@ module.exports = function (RED) {
185
173
  });
186
174
  };
187
175
 
188
- if (engine) {
176
+ if (node.engine) {
189
177
  register();
190
178
  }
191
179
  }
@@ -4,20 +4,18 @@ module.exports = function (RED) {
4
4
  var node = this;
5
5
 
6
6
  node.on('input', function (msg) {
7
-
8
- const engine = RED.nodes.getNode(config.engine);
9
- const client = engine.engineClient;
7
+ node.engine = RED.nodes.getNode(config.engine);
8
+ const client = node.engine.engineClient;
10
9
 
11
10
  if (!client) {
12
11
  node.error('No engine configured.');
13
12
  return;
14
13
  }
15
14
 
16
- engine.engineClient.events
15
+ node.engine.engineClient.events
17
16
  .triggerMessageEvent(config.messagename, {
18
17
  processInstanceId: msg.processinstanceid,
19
18
  payload: msg.payload,
20
- identity: engine.identity,
21
19
  })
22
20
  .then((result) => {
23
21
  msg.payload = result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.5.11",
3
+ "version": "1.5.12-develop-c71c09-m4sa8e6d",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -57,7 +57,7 @@
57
57
  "examples": "examples"
58
58
  },
59
59
  "dependencies": {
60
- "@5minds/processcube_engine_client": "5.1.0-hotfix-a73235-m346kg1n",
60
+ "@5minds/processcube_engine_client": "5.1.2",
61
61
  "jwt-decode": "^4.0.0",
62
62
  "openid-client": "^5.5.0"
63
63
  },