@5minds/node-red-contrib-processcube 1.0.1 → 1.1.0-develop-df258e-lz2taz5p

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ {
2
+ "$": "5734715650ad0e2f488ff78226956694NX4T+QkHGMiy67VaEDstg8xD7Z8kNywCkq+GrSTQz7ttIGBCvHQfpyNBVWzSH8Aq9x4P3kH7avpdOoc2owoMDjEeBmS8uKg021bt/ukf+Vn1KHJLA6NVAIh6"
3
+ }
@@ -52,7 +52,7 @@ module.exports = {
52
52
  * the user's home directory. To use a different location, the following
53
53
  * property can be used
54
54
  */
55
- userDir: '/nodered/',
55
+ //userDir: '/nodered/',
56
56
 
57
57
  /** Node-RED scans the `nodes` directory in the userDir to find local node files.
58
58
  * The following property can be used to specify an additional directory to scan.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.0.1",
3
+ "version": "1.1.0-develop-df258e-lz2taz5p",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -2,19 +2,24 @@
2
2
  RED.nodes.registerType('processcube-engine-config', {
3
3
  category: 'config',
4
4
  defaults: {
5
+ name : { value: '' },
5
6
  url: { value: 'http://engine:8000', required: true },
6
7
  },
7
8
  label: function () {
8
- return this.url;
9
+ return this.name || this.url;
9
10
  },
10
11
  credentials: {
11
12
  clientId: { type: 'text' },
12
13
  clientSecret: { type: 'password' },
13
- },
14
+ }
14
15
  });
15
16
  </script>
16
17
 
17
18
  <script type="text/html" data-template-name="processcube-engine-config">
19
+ <div class="form-row">
20
+ <label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
21
+ <input type="text" id="node-config-input-name" />
22
+ </div>
18
23
  <div class="form-row">
19
24
  <label for="node-config-input-url"><i class="fa fa-bookmark"></i> Url</label>
20
25
  <input type="text" id="node-config-input-url" />
@@ -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);
@@ -0,0 +1,82 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="External-Task-Auth-Sample_Definition" targetNamespace="http://bpmn.io/schema/bpmn" exporter="5Minds Studio" exporterVersion="1">
3
+ <bpmn:collaboration id="Collaboration_1cidyxu" name="">
4
+ <bpmn:participant id="Participant_0px403d" name="External-Task-Auth-Sample" processRef="External-Task-Auth-Sample_Process" />
5
+ </bpmn:collaboration>
6
+ <bpmn:process id="External-Task-Auth-Sample_Process" name="External-Task-Auth-Sample" isExecutable="true">
7
+ <bpmn:laneSet />
8
+ <bpmn:startEvent id="StartEvent_1" name="Start">
9
+ <bpmn:outgoing>Flow_1ld6sfg</bpmn:outgoing>
10
+ </bpmn:startEvent>
11
+ <bpmn:sequenceFlow id="Flow_1ld6sfg" sourceRef="StartEvent_1" targetRef="Activity_0u64tc3" />
12
+ <bpmn:sequenceFlow id="Flow_06m00cc" sourceRef="Activity_0u64tc3" targetRef="Activity_07p3p4z" />
13
+ <bpmn:endEvent id="Event_1itn9nv">
14
+ <bpmn:incoming>Flow_1m5vjpz</bpmn:incoming>
15
+ </bpmn:endEvent>
16
+ <bpmn:sequenceFlow id="Flow_1m5vjpz" sourceRef="Activity_07p3p4z" targetRef="Event_1itn9nv" />
17
+ <bpmn:sequenceFlow id="Flow_0ltw0h7" sourceRef="Event_0fz5x27" targetRef="Event_0rv3086" />
18
+ <bpmn:endEvent id="Event_0rv3086">
19
+ <bpmn:incoming>Flow_0ltw0h7</bpmn:incoming>
20
+ </bpmn:endEvent>
21
+ <bpmn:serviceTask id="Activity_0u64tc3" name="Topic: &#34;Test_Auth&#34;" camunda:type="external" camunda:topic="Test_Auth">
22
+ <bpmn:incoming>Flow_1ld6sfg</bpmn:incoming>
23
+ <bpmn:outgoing>Flow_06m00cc</bpmn:outgoing>
24
+ </bpmn:serviceTask>
25
+ <bpmn:serviceTask id="Activity_07p3p4z" name="Topic: &#34;SampleError_Auth&#34;" camunda:type="external" camunda:topic="SampleError_Auth">
26
+ <bpmn:incoming>Flow_06m00cc</bpmn:incoming>
27
+ <bpmn:outgoing>Flow_1m5vjpz</bpmn:outgoing>
28
+ </bpmn:serviceTask>
29
+ <bpmn:boundaryEvent id="Event_0fz5x27" attachedToRef="Activity_07p3p4z">
30
+ <bpmn:outgoing>Flow_0ltw0h7</bpmn:outgoing>
31
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_1owejc3" errorRef="Error_tYBTV3t5" />
32
+ </bpmn:boundaryEvent>
33
+ </bpmn:process>
34
+ <bpmn:error id="Error_tYBTV3t5" errorCode="MyErrorCode" />
35
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
36
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1cidyxu">
37
+ <bpmndi:BPMNShape id="Participant_0px403d_di" bpmnElement="Participant_0px403d" isHorizontal="true">
38
+ <dc:Bounds x="5" y="4" width="655" height="346" />
39
+ </bpmndi:BPMNShape>
40
+ <bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
41
+ <dc:Bounds x="92" y="152" width="36" height="36" />
42
+ <bpmndi:BPMNLabel>
43
+ <dc:Bounds x="98" y="195" width="24" height="14" />
44
+ </bpmndi:BPMNLabel>
45
+ </bpmndi:BPMNShape>
46
+ <bpmndi:BPMNShape id="Event_1itn9nv_di" bpmnElement="Event_1itn9nv">
47
+ <dc:Bounds x="502" y="152" width="36" height="36" />
48
+ </bpmndi:BPMNShape>
49
+ <bpmndi:BPMNShape id="Event_0rv3086_di" bpmnElement="Event_0rv3086">
50
+ <dc:Bounds x="502" y="272" width="36" height="36" />
51
+ </bpmndi:BPMNShape>
52
+ <bpmndi:BPMNShape id="Activity_1yv65fq_di" bpmnElement="Activity_0u64tc3">
53
+ <dc:Bounds x="180" y="130" width="100" height="80" />
54
+ <bpmndi:BPMNLabel />
55
+ </bpmndi:BPMNShape>
56
+ <bpmndi:BPMNShape id="Activity_1dgy0dm_di" bpmnElement="Activity_07p3p4z">
57
+ <dc:Bounds x="340" y="130" width="100" height="80" />
58
+ <bpmndi:BPMNLabel />
59
+ </bpmndi:BPMNShape>
60
+ <bpmndi:BPMNShape id="Event_1is2r7x_di" bpmnElement="Event_0fz5x27">
61
+ <dc:Bounds x="372" y="192" width="36" height="36" />
62
+ </bpmndi:BPMNShape>
63
+ <bpmndi:BPMNEdge id="Flow_1ld6sfg_di" bpmnElement="Flow_1ld6sfg">
64
+ <di:waypoint x="128" y="170" />
65
+ <di:waypoint x="180" y="170" />
66
+ </bpmndi:BPMNEdge>
67
+ <bpmndi:BPMNEdge id="Flow_06m00cc_di" bpmnElement="Flow_06m00cc">
68
+ <di:waypoint x="280" y="170" />
69
+ <di:waypoint x="340" y="170" />
70
+ </bpmndi:BPMNEdge>
71
+ <bpmndi:BPMNEdge id="Flow_1m5vjpz_di" bpmnElement="Flow_1m5vjpz">
72
+ <di:waypoint x="440" y="170" />
73
+ <di:waypoint x="502" y="170" />
74
+ </bpmndi:BPMNEdge>
75
+ <bpmndi:BPMNEdge id="Flow_0ltw0h7_di" bpmnElement="Flow_0ltw0h7">
76
+ <di:waypoint x="390" y="228" />
77
+ <di:waypoint x="390" y="290" />
78
+ <di:waypoint x="502" y="290" />
79
+ </bpmndi:BPMNEdge>
80
+ </bpmndi:BPMNPlane>
81
+ </bpmndi:BPMNDiagram>
82
+ </bpmn:definitions>
@@ -0,0 +1,63 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="User-Task-Auth-Sample_Definition" targetNamespace="http://bpmn.io/schema/bpmn" exporter="5Minds Studio" exporterVersion="1">
3
+ <bpmn:collaboration id="Collaboration_1cidyxu" name="">
4
+ <bpmn:participant id="Participant_0px403d" name="User-Task-Auth-Sample" processRef="User-Task-Auth-Sample_Process" />
5
+ </bpmn:collaboration>
6
+ <bpmn:process id="User-Task-Auth-Sample_Process" name="User-Task-Auth-Sample" isExecutable="true">
7
+ <bpmn:laneSet>
8
+ <bpmn:lane id="Lane_1xzf0d3" name="Lane">
9
+ <bpmn:flowNodeRef>StartEvent_1</bpmn:flowNodeRef>
10
+ <bpmn:flowNodeRef>user_task_auth</bpmn:flowNodeRef>
11
+ <bpmn:flowNodeRef>Event_03cwr86</bpmn:flowNodeRef>
12
+ </bpmn:lane>
13
+ </bpmn:laneSet>
14
+ <bpmn:startEvent id="StartEvent_1" name="Start">
15
+ <bpmn:outgoing>Flow_1t268h6</bpmn:outgoing>
16
+ </bpmn:startEvent>
17
+ <bpmn:sequenceFlow id="Flow_1t268h6" sourceRef="StartEvent_1" targetRef="user_task_auth" />
18
+ <bpmn:userTask id="user_task_auth" name="User Task">
19
+ <bpmn:extensionElements>
20
+ <camunda:formData>
21
+ <camunda:formField id="field_01" label="Field 01" type="string" />
22
+ <camunda:formField id="field_02" label="Field 02" type="string" />
23
+ </camunda:formData>
24
+ </bpmn:extensionElements>
25
+ <bpmn:incoming>Flow_1t268h6</bpmn:incoming>
26
+ <bpmn:outgoing>Flow_1t2shtu</bpmn:outgoing>
27
+ </bpmn:userTask>
28
+ <bpmn:endEvent id="Event_03cwr86">
29
+ <bpmn:incoming>Flow_1t2shtu</bpmn:incoming>
30
+ </bpmn:endEvent>
31
+ <bpmn:sequenceFlow id="Flow_1t2shtu" sourceRef="user_task_auth" targetRef="Event_03cwr86" />
32
+ </bpmn:process>
33
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
34
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1cidyxu">
35
+ <bpmndi:BPMNShape id="Participant_0px403d_di" bpmnElement="Participant_0px403d" isHorizontal="true">
36
+ <dc:Bounds x="5" y="4" width="445" height="346" />
37
+ </bpmndi:BPMNShape>
38
+ <bpmndi:BPMNShape id="Lane_1xzf0d3_di" bpmnElement="Lane_1xzf0d3" isHorizontal="true">
39
+ <dc:Bounds x="35" y="4" width="415" height="346" />
40
+ </bpmndi:BPMNShape>
41
+ <bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
42
+ <dc:Bounds x="92" y="152" width="36" height="36" />
43
+ <bpmndi:BPMNLabel>
44
+ <dc:Bounds x="98" y="195" width="24" height="14" />
45
+ </bpmndi:BPMNLabel>
46
+ </bpmndi:BPMNShape>
47
+ <bpmndi:BPMNShape id="Activity_0c7im8g_di" bpmnElement="user_task_auth">
48
+ <dc:Bounds x="190" y="130" width="100" height="80" />
49
+ </bpmndi:BPMNShape>
50
+ <bpmndi:BPMNShape id="Event_03cwr86_di" bpmnElement="Event_03cwr86">
51
+ <dc:Bounds x="352" y="152" width="36" height="36" />
52
+ </bpmndi:BPMNShape>
53
+ <bpmndi:BPMNEdge id="Flow_1t268h6_di" bpmnElement="Flow_1t268h6">
54
+ <di:waypoint x="128" y="170" />
55
+ <di:waypoint x="190" y="170" />
56
+ </bpmndi:BPMNEdge>
57
+ <bpmndi:BPMNEdge id="Flow_1t2shtu_di" bpmnElement="Flow_1t2shtu">
58
+ <di:waypoint x="290" y="170" />
59
+ <di:waypoint x="352" y="170" />
60
+ </bpmndi:BPMNEdge>
61
+ </bpmndi:BPMNPlane>
62
+ </bpmndi:BPMNDiagram>
63
+ </bpmn:definitions>
@@ -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(
@@ -1,3 +0,0 @@
1
- {
2
- "$": "161b525bcc3a85ed486f778fadca44e0c0RvyjjTCLddR3fu+V4rGaC/L1NxysY="
3
- }
@@ -1,15 +0,0 @@
1
- {
2
- "name": "node-red-contrib-processcube-sample",
3
- "version": "1.0.0",
4
- "description": "A sample for the processcube node-red contrib package",
5
- "dependencies": {
6
- "@5minds/node-red-contrib-processcube": "file:/src/node-red-contrib-processcube/",
7
- "@5minds/node-red-dashboard-2-processcube-dynamic-form": "^1.0.4",
8
- "@5minds/node-red-dashboard-2-processcube-usertask-table": "^1.0.7",
9
- "@flowfuse/node-red-dashboard": "^1.11.1",
10
- "node-red": "^4.0.2",
11
- "node-red-contrib-inspector": "~1.0.1",
12
- "node-red-debugger": "^1.1.1",
13
- "openapi-red": "^1.2.5"
14
- }
15
- }
@@ -1,159 +0,0 @@
1
- {
2
- "formFields": [
3
- {
4
- "id": "text_id",
5
- "type": "text",
6
- "required": false,
7
- "label": "Text Label",
8
- "value": "",
9
- "title": "Some helpful text"
10
- },
11
- {
12
- "id": "number_id",
13
- "type": "number",
14
- "required": true,
15
- "label": "Number Label",
16
- "title": "Some helpful text"
17
- },
18
- {
19
- "id": "date_id",
20
- "type": "date",
21
- "required": true,
22
- "label": "Date Label",
23
- "title": "Some helpful text"
24
- },
25
- {
26
- "id": "select_id",
27
- "type": "select",
28
- "required": true,
29
- "label": "Select Label",
30
- "options": [
31
- {
32
- "id": "value_01",
33
- "name": "Value 01"
34
- },
35
- {
36
- "id": "value_02",
37
- "name": "Value 02"
38
- }
39
- ],
40
- "title": "Choose an option"
41
- },
42
- {
43
- "id": "boolean_id",
44
- "type": "checkbox",
45
- "required": false,
46
- "label": "Boolean Label",
47
- "title": "Check for Yes"
48
- },
49
- {
50
- "id": "_flowNodeInstanceId",
51
- "type": "hidden",
52
- "value": "549abda6-911c-4b10-b8e3-f4d6383674b2"
53
- }
54
- ],
55
- "userTask": {
56
- "flowNodeInstanceId": "549abda6-911c-4b10-b8e3-f4d6383674b2",
57
- "flowNodeId": "Activity_0ljiko7",
58
- "flowNodeName": "Hello world",
59
- "flowNodeLane": "Lane",
60
- "flowNodeType": "bpmn:UserTask",
61
- "previousFlowNodeInstanceId": "a678b21e-db08-48e8-b228-ffc48618022b",
62
- "parentProcessInstanceId": null,
63
- "processDefinitionId": "SampleUserTask_Definition",
64
- "processModelId": "SampleUserTask_Process",
65
- "processInstanceId": "251bfdd1-16fb-4f2b-98b3-7c28a49eec4d",
66
- "correlationId": "3c6dadd7-a0fe-43c0-a8aa-9b1b87c149f5",
67
- "state": "suspended",
68
- "tokens": [],
69
- "startToken": {},
70
- "endToken": {},
71
- "ownerId": "dummy_token",
72
- "startedAt": "2024-06-09T20:47:27.494Z",
73
- "assignedUserIds": null,
74
- "actualOwnerId": null,
75
- "finishedByUserId": null,
76
- "userTaskConfig": {
77
- "formFields": [
78
- {
79
- "id": "text_id",
80
- "label": "Text Label",
81
- "type": "string"
82
- },
83
- {
84
- "id": "number_id",
85
- "label": "Number Label",
86
- "type": "long",
87
- "defaultValue": "undefined",
88
- "customForm": "{\"hint\":\"Sample\"}"
89
- },
90
- {
91
- "id": "date_id",
92
- "label": "Date Label",
93
- "type": "date"
94
- },
95
- {
96
- "id": "select_id",
97
- "label": "Select Label",
98
- "type": "enum",
99
- "enumValues": [
100
- {
101
- "id": "value_01",
102
- "name": "Value 01"
103
- },
104
- {
105
- "id": "value_02",
106
- "name": "Value 02"
107
- }
108
- ]
109
- },
110
- {
111
- "id": "boolean_id",
112
- "label": "Boolean Label",
113
- "type": "boolean"
114
- }
115
- ]
116
- },
117
- "userTaskConfigModel": {
118
- "formFields": [
119
- {
120
- "id": "text_id",
121
- "label": "Text Label",
122
- "type": "string"
123
- },
124
- {
125
- "id": "number_id",
126
- "label": "Number Label",
127
- "type": "long",
128
- "defaultValue": "${token.current.sample}",
129
- "customForm": "{\"hint\":\"Sample\"}"
130
- },
131
- {
132
- "id": "date_id",
133
- "label": "Date Label",
134
- "type": "date"
135
- },
136
- {
137
- "id": "select_id",
138
- "label": "Select Label",
139
- "type": "enum",
140
- "enumValues": [
141
- {
142
- "id": "value_01",
143
- "name": "Value 01"
144
- },
145
- {
146
- "id": "value_02",
147
- "name": "Value 02"
148
- }
149
- ]
150
- },
151
- {
152
- "id": "boolean_id",
153
- "label": "Boolean Label",
154
- "type": "boolean"
155
- }
156
- ]
157
- }
158
- }
159
- }