@5minds/node-red-contrib-processcube 1.1.0-develop-3ff031-lz2nv5y2 → 1.1.1-develop-46a943-lz2tbzhh

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.
@@ -23,7 +23,7 @@ services:
23
23
  environment:
24
24
  application__name: Engine for Node-RED contrib
25
25
  iam__baseUrl: http://authority:11560
26
- iam__allowAnonymousRootAccess: true
26
+ iam__allowAnonymousRootAccess: false
27
27
  command: --seed-dir=/processes --port 8000
28
28
  depends_on:
29
29
  - authority
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.1.0-develop-3ff031-lz2nv5y2",
3
+ "version": "1.1.1-develop-46a943-lz2tbzhh",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -16,7 +16,16 @@ module.exports = function (RED) {
16
16
  identityChangedCallbacks.push(callback);
17
17
  };
18
18
 
19
+ this.isIdentityReady = function() {
20
+ if (this.credentials.clientId && this.credentials.clientSecret) {
21
+ return this.identity != null;
22
+ } else {
23
+ return true;
24
+ }
25
+ }
26
+
19
27
  this.setIdentity = (identity) => {
28
+ node.log(`setIdentity: ${JSON.stringify(identity)}`);
20
29
  this.identity = identity;
21
30
 
22
31
  for (const callback of identityChangedCallbacks) {
@@ -41,7 +50,7 @@ module.exports = function (RED) {
41
50
  this.credentials.clientId,
42
51
  this.credentials.clientSecret,
43
52
  authorityUrl,
44
- this,
53
+ node,
45
54
  ).catch((reason) => {
46
55
  console.error(reason);
47
56
  node.error(reason);
@@ -14,22 +14,28 @@ module.exports = function (RED) {
14
14
  return;
15
15
  }
16
16
 
17
- let subscription = await client.userTasks.onUserTaskFinished(
18
- (userTaskFinishedNotification) => {
19
- node.send({
20
- payload: {
21
- flowNodeInstanceId: userTaskFinishedNotification.flowNodeInstanceId,
22
- userTaskEvent: userTaskFinishedNotification,
23
- action: 'finished',
24
- type: 'usertask',
25
- },
26
- });
27
- },
28
- { identity: currentIdentity },
29
- );
17
+ let subscription;
30
18
 
19
+ if (node.engine.isIdentityReady()) {
20
+ subscription = await client.userTasks.onUserTaskFinished(
21
+ (userTaskFinishedNotification) => {
22
+ node.send({
23
+ payload: {
24
+ flowNodeInstanceId: userTaskFinishedNotification.flowNodeInstanceId,
25
+ userTaskEvent: userTaskFinishedNotification,
26
+ action: 'finished',
27
+ type: 'usertask',
28
+ },
29
+ });
30
+ },
31
+ { identity: currentIdentity },
32
+ );
33
+ }
34
+
31
35
  node.engine.registerOnIdentityChanged(async (identity) => {
32
- client.userTasks.removeSubscription(subscription, currentIdentity);
36
+ if (subscription) {
37
+ client.userTasks.removeSubscription(subscription, currentIdentity);
38
+ }
33
39
  currentIdentity = identity;
34
40
 
35
41
  subscription = await client.userTasks.onUserTaskFinished(
package/usertask-input.js CHANGED
@@ -17,11 +17,10 @@ module.exports = function (RED) {
17
17
  let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
18
18
 
19
19
  query = {
20
- ...query,
21
- identity: engine.identity,
20
+ ...query
22
21
  };
23
22
 
24
- client.userTasks.query(query).then((matchingFlowNodes) => {
23
+ client.userTasks.query(query, { identity: engine.identity} ).then((matchingFlowNodes) => {
25
24
  if (
26
25
  !config.force_send_array &&
27
26
  matchingFlowNodes &&
@@ -14,22 +14,29 @@ module.exports = function (RED) {
14
14
 
15
15
  let currentIdentity = node.engine.identity;
16
16
 
17
- let subscription = await client.userTasks.onUserTaskWaiting(
18
- (userTaskWaitingNotification) => {
19
- node.send({
20
- payload: {
21
- flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
22
- userTaskEvent: userTaskWaitingNotification,
23
- action: 'new',
24
- type: 'usertask',
25
- },
26
- });
27
- },
28
- { identity: currentIdentity },
29
- );
17
+ let subscription;
18
+
19
+ if (node.engine.isIdentityReady()) {
20
+ subscription = await client.userTasks.onUserTaskWaiting(
21
+ (userTaskWaitingNotification) => {
22
+ node.send({
23
+ payload: {
24
+ flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
25
+ userTaskEvent: userTaskWaitingNotification,
26
+ action: 'new',
27
+ type: 'usertask',
28
+ },
29
+ });
30
+ },
31
+ { identity: currentIdentity },
32
+ );
33
+ }
30
34
 
31
35
  node.engine.registerOnIdentityChanged(async (identity) => {
32
- client.userTasks.removeSubscription(subscription, currentIdentity);
36
+ if (subscription) {
37
+ client.userTasks.removeSubscription(subscription, currentIdentity);
38
+ }
39
+
33
40
  currentIdentity = identity;
34
41
 
35
42
  subscription = await client.userTasks.onUserTaskWaiting(