@5minds/node-red-contrib-processcube 1.1.4-feature-69bc41-m050i4xt → 1.1.4-feature-50e361-m052vesf

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.1.4-feature-69bc41-m050i4xt",
3
+ "version": "1.1.4-feature-50e361-m052vesf",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -42,6 +42,9 @@
42
42
  "processStart": "process-start.js",
43
43
  "processStartedListener": "process-started-listener.js",
44
44
  "processFinishedListener": "process-finished-listener.js",
45
+ "processTerminatedListener": "process-terminated-listener.js",
46
+ "processErrorListener": "process-error-listener.js",
47
+ "processResumedListener": "process-resumed-listener.js",
45
48
  "processcubeEngineConfig": "processcube-engine-config.js",
46
49
  "ProcessinstanceQuery": "processinstance-query.js",
47
50
  "ProcessdefinitionQuery": "processdefinition-query.js",
@@ -0,0 +1,36 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType('process-error-listener', {
3
+ category: 'ProcessCube',
4
+ color: '#02AFD6',
5
+ defaults: {
6
+ name: { value: '' },
7
+ engine: { value: '', type: 'processcube-engine-config' },
8
+ processmodel: { value: '', required: false },
9
+ },
10
+ inputs: 0,
11
+ outputs: 1,
12
+ icon: 'font-awesome/fa-sign-in',
13
+ label: function () {
14
+ return this.name || 'process-error-listener';
15
+ },
16
+ });
17
+ </script>
18
+
19
+ <script type="text/html" data-template-name="process-error-listener">
20
+ <div class="form-row">
21
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
22
+ <input type="text" id="node-input-name" placeholder="Name" />
23
+ </div>
24
+ <div class="form-row">
25
+ <label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
26
+ <input type="text" id="node-input-engine" placeholder="http://engine:8000" />
27
+ </div>
28
+ <div class="form-row">
29
+ <label for="node-input-processmodel"><i class="fa fa-tag"></i> Processmodel</label>
30
+ <input type="text" id="node-input-processmodel" placeholder="ID of Processmodel" />
31
+ </div>
32
+ </script>
33
+
34
+ <script type="text/markdown" data-help-name="process-start">
35
+ Subscribe to process endings
36
+ </script>
@@ -0,0 +1,76 @@
1
+ module.exports = function (RED) {
2
+ function ProcessErrorListener(config) {
3
+ RED.nodes.createNode(this, config);
4
+ var node = this;
5
+ node.engine = RED.nodes.getNode(config.engine);
6
+
7
+ const register = async () => {
8
+ const client = node.engine.engineClient;
9
+
10
+ if (!client) {
11
+ node.error('No engine configured.');
12
+ return;
13
+ }
14
+
15
+ let currentIdentity = node.engine.identity;
16
+
17
+ let subscription;
18
+
19
+ if (node.engine.isIdentityReady()) {
20
+ subscription = await client.notification.onProcessError(
21
+ (processNotification) => {
22
+ if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
23
+ return;
24
+ console.log(processNotification);
25
+ node.send({
26
+ payload: {
27
+ processInstanceId: processNotification.processInstanceId,
28
+ processModelId: processNotification.processModelId,
29
+ token: processNotification.currentToken,
30
+ action: 'error',
31
+ type: 'processInstance',
32
+ },
33
+ });
34
+ },
35
+ { identity: currentIdentity }
36
+ );
37
+ }
38
+
39
+ node.engine.registerOnIdentityChanged(async (identity) => {
40
+ if (subscription) {
41
+ client.notification.removeSubscription(subscription, currentIdentity);
42
+ }
43
+
44
+ currentIdentity = identity;
45
+
46
+ subscription = await client.notification.onProcessError(
47
+ (processNotification) => {
48
+ if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
49
+ return;
50
+ node.send({
51
+ payload: {
52
+ processInstanceId: processNotification.processInstanceId,
53
+ processModelId: processNotification.processModelId,
54
+ token: processNotification.currentToken,
55
+ action: 'error',
56
+ type: 'processInstance',
57
+ },
58
+ });
59
+ },
60
+ { identity: currentIdentity }
61
+ );
62
+ });
63
+
64
+ node.on('close', () => {
65
+ if (node.engine && node.engine.engineClient && client) {
66
+ client.notification.removeSubscription(subscription, currentIdentity);
67
+ }
68
+ });
69
+ };
70
+
71
+ if (node.engine) {
72
+ register();
73
+ }
74
+ }
75
+ RED.nodes.registerType('process-error-listener', ProcessErrorListener);
76
+ };
@@ -19,14 +19,15 @@ module.exports = function (RED) {
19
19
  if (node.engine.isIdentityReady()) {
20
20
  subscription = await client.notification.onProcessEnded(
21
21
  (processNotification) => {
22
- console.log(processNotification);
23
- if (config.processmodel != processNotification.processModelId) return;
22
+ if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
23
+ return;
24
24
  node.send({
25
25
  payload: {
26
26
  processInstanceId: processNotification.processInstanceId,
27
+ processModelId: processNotification.processModelId,
27
28
  flowNodeId: processNotification.flowNodeId,
28
29
  token: processNotification.currentToken,
29
- action: 'started',
30
+ action: 'finished',
30
31
  type: 'processInstance',
31
32
  },
32
33
  });
@@ -44,13 +45,15 @@ module.exports = function (RED) {
44
45
 
45
46
  subscription = await client.notification.onProcessEnded(
46
47
  (processNotification) => {
47
- if (config.processmodel != processNotification.processModelId) return;
48
+ if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
49
+ return;
48
50
  node.send({
49
51
  payload: {
50
52
  processInstanceId: processNotification.processInstanceId,
53
+ processModelId: processNotification.processModelId,
51
54
  flowNodeId: processNotification.flowNodeId,
52
55
  token: processNotification.currentToken,
53
- action: 'ended',
56
+ action: 'finished',
54
57
  type: 'processInstance',
55
58
  },
56
59
  });
@@ -0,0 +1,36 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType('process-resumed-listener', {
3
+ category: 'ProcessCube',
4
+ color: '#02AFD6',
5
+ defaults: {
6
+ name: { value: '' },
7
+ engine: { value: '', type: 'processcube-engine-config' },
8
+ processmodel: { value: '', required: false },
9
+ },
10
+ inputs: 0,
11
+ outputs: 1,
12
+ icon: 'font-awesome/fa-sign-in',
13
+ label: function () {
14
+ return this.name || 'process-resumed-listener';
15
+ },
16
+ });
17
+ </script>
18
+
19
+ <script type="text/html" data-template-name="process-resumed-listener">
20
+ <div class="form-row">
21
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
22
+ <input type="text" id="node-input-name" placeholder="Name" />
23
+ </div>
24
+ <div class="form-row">
25
+ <label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
26
+ <input type="text" id="node-input-engine" placeholder="http://engine:8000" />
27
+ </div>
28
+ <div class="form-row">
29
+ <label for="node-input-processmodel"><i class="fa fa-tag"></i> Processmodel</label>
30
+ <input type="text" id="node-input-processmodel" placeholder="ID of Processmodel" />
31
+ </div>
32
+ </script>
33
+
34
+ <script type="text/markdown" data-help-name="process-start">
35
+ Subscribe to process starts
36
+ </script>
@@ -0,0 +1,75 @@
1
+ module.exports = function (RED) {
2
+ function ProcessResumedListener(config) {
3
+ RED.nodes.createNode(this, config);
4
+ var node = this;
5
+ node.engine = RED.nodes.getNode(config.engine);
6
+
7
+ const register = async () => {
8
+ const client = node.engine.engineClient;
9
+
10
+ if (!client) {
11
+ node.error('No engine configured.');
12
+ return;
13
+ }
14
+
15
+ let currentIdentity = node.engine.identity;
16
+
17
+ let subscription;
18
+
19
+ if (node.engine.isIdentityReady()) {
20
+ subscription = await client.notification.onProcessResumed(
21
+ (processNotification) => {
22
+ if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
23
+ return;
24
+ node.send({
25
+ payload: {
26
+ processInstanceId: processNotification.processInstanceId,
27
+ processModelId: processNotification.processModelId,
28
+ token: processNotification.currentToken,
29
+ action: 'resumed',
30
+ type: 'processInstance',
31
+ },
32
+ });
33
+ },
34
+ { identity: currentIdentity }
35
+ );
36
+ }
37
+
38
+ node.engine.registerOnIdentityChanged(async (identity) => {
39
+ if (subscription) {
40
+ client.notification.removeSubscription(subscription, currentIdentity);
41
+ }
42
+
43
+ currentIdentity = identity;
44
+
45
+ subscription = await client.notification.onProcessResumed(
46
+ (processNotification) => {
47
+ if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
48
+ return;
49
+ node.send({
50
+ payload: {
51
+ processInstanceId: processNotification.processInstanceId,
52
+ processModelId: processNotification.processModelId,
53
+ token: processNotification.currentToken,
54
+ action: 'resumed',
55
+ type: 'processInstance',
56
+ },
57
+ });
58
+ },
59
+ { identity: currentIdentity }
60
+ );
61
+ });
62
+
63
+ node.on('close', () => {
64
+ if (node.engine && node.engine.engineClient && client) {
65
+ client.notification.removeSubscription(subscription, currentIdentity);
66
+ }
67
+ });
68
+ };
69
+
70
+ if (node.engine) {
71
+ register();
72
+ }
73
+ }
74
+ RED.nodes.registerType('process-resumed-listener', ProcessResumedListener);
75
+ };
@@ -19,10 +19,12 @@ module.exports = function (RED) {
19
19
  if (node.engine.isIdentityReady()) {
20
20
  subscription = await client.notification.onProcessStarted(
21
21
  (processNotification) => {
22
- if (config.processmodel != processNotification.processModelId) return;
22
+ if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
23
+ return;
23
24
  node.send({
24
25
  payload: {
25
26
  processInstanceId: processNotification.processInstanceId,
27
+ processModelId: processNotification.processModelId,
26
28
  flowNodeId: processNotification.flowNodeId,
27
29
  token: processNotification.currentToken,
28
30
  action: 'started',
@@ -43,10 +45,12 @@ module.exports = function (RED) {
43
45
 
44
46
  subscription = await client.notification.onProcessStarted(
45
47
  (processNotification) => {
46
- if (config.processmodel != processNotification.processModelId) return;
48
+ if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
49
+ return;
47
50
  node.send({
48
51
  payload: {
49
52
  processInstanceId: processNotification.processInstanceId,
53
+ processModelId: processNotification.processModelId,
50
54
  flowNodeId: processNotification.flowNodeId,
51
55
  token: processNotification.currentToken,
52
56
  action: 'started',
@@ -0,0 +1,36 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType('process-terminated-listener', {
3
+ category: 'ProcessCube',
4
+ color: '#02AFD6',
5
+ defaults: {
6
+ name: { value: '' },
7
+ engine: { value: '', type: 'processcube-engine-config' },
8
+ processmodel: { value: '', required: false },
9
+ },
10
+ inputs: 0,
11
+ outputs: 1,
12
+ icon: 'font-awesome/fa-sign-in',
13
+ label: function () {
14
+ return this.name || 'process-terminated-listener';
15
+ },
16
+ });
17
+ </script>
18
+
19
+ <script type="text/html" data-template-name="process-terminated-listener">
20
+ <div class="form-row">
21
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
22
+ <input type="text" id="node-input-name" placeholder="Name" />
23
+ </div>
24
+ <div class="form-row">
25
+ <label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
26
+ <input type="text" id="node-input-engine" placeholder="http://engine:8000" />
27
+ </div>
28
+ <div class="form-row">
29
+ <label for="node-input-processmodel"><i class="fa fa-tag"></i> Processmodel</label>
30
+ <input type="text" id="node-input-processmodel" placeholder="ID of Processmodel" />
31
+ </div>
32
+ </script>
33
+
34
+ <script type="text/markdown" data-help-name="process-start">
35
+ Subscribe to process endings
36
+ </script>
@@ -0,0 +1,75 @@
1
+ module.exports = function (RED) {
2
+ function ProcessTerminatedListener(config) {
3
+ RED.nodes.createNode(this, config);
4
+ var node = this;
5
+ node.engine = RED.nodes.getNode(config.engine);
6
+
7
+ const register = async () => {
8
+ const client = node.engine.engineClient;
9
+
10
+ if (!client) {
11
+ node.error('No engine configured.');
12
+ return;
13
+ }
14
+
15
+ let currentIdentity = node.engine.identity;
16
+
17
+ let subscription;
18
+
19
+ if (node.engine.isIdentityReady()) {
20
+ subscription = await client.notification.onProcessTerminated(
21
+ (processNotification) => {
22
+ if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
23
+ return;
24
+ node.send({
25
+ payload: {
26
+ processInstanceId: processNotification.processInstanceId,
27
+ processModelId: processNotification.processModelId,
28
+ token: processNotification.currentToken,
29
+ action: 'terminated',
30
+ type: 'processInstance',
31
+ },
32
+ });
33
+ },
34
+ { identity: currentIdentity }
35
+ );
36
+ }
37
+
38
+ node.engine.registerOnIdentityChanged(async (identity) => {
39
+ if (subscription) {
40
+ client.notification.removeSubscription(subscription, currentIdentity);
41
+ }
42
+
43
+ currentIdentity = identity;
44
+
45
+ subscription = await client.notification.onProcessTerminated(
46
+ (processNotification) => {
47
+ if (config.processmodel != '' && config.processmodel != processNotification.processModelId)
48
+ return;
49
+ node.send({
50
+ payload: {
51
+ processInstanceId: processNotification.processInstanceId,
52
+ processModelId: processNotification.processModelId,
53
+ token: processNotification.currentToken,
54
+ action: 'terminated',
55
+ type: 'processInstance',
56
+ },
57
+ });
58
+ },
59
+ { identity: currentIdentity }
60
+ );
61
+ });
62
+
63
+ node.on('close', () => {
64
+ if (node.engine && node.engine.engineClient && client) {
65
+ client.notification.removeSubscription(subscription, currentIdentity);
66
+ }
67
+ });
68
+ };
69
+
70
+ if (node.engine) {
71
+ register();
72
+ }
73
+ }
74
+ RED.nodes.registerType('process-terminated-listener', ProcessTerminatedListener);
75
+ };
@@ -9,10 +9,6 @@
9
9
  <bpmn:outgoing>Flow_142awo6</bpmn:outgoing>
10
10
  </bpmn:startEvent>
11
11
  <bpmn:sequenceFlow id="Flow_142awo6" sourceRef="StartEvent_1" targetRef="user_task" />
12
- <bpmn:endEvent id="Event_07hak5r" name="End">
13
- <bpmn:incoming>Flow_0i7xqvi</bpmn:incoming>
14
- </bpmn:endEvent>
15
- <bpmn:sequenceFlow id="Flow_0i7xqvi" sourceRef="user_task" targetRef="Event_07hak5r" />
16
12
  <bpmn:userTask id="user_task" name="User Task">
17
13
  <bpmn:extensionElements>
18
14
  <camunda:formData>
@@ -21,13 +17,24 @@
21
17
  </camunda:formData>
22
18
  </bpmn:extensionElements>
23
19
  <bpmn:incoming>Flow_142awo6</bpmn:incoming>
24
- <bpmn:outgoing>Flow_0i7xqvi</bpmn:outgoing>
20
+ <bpmn:outgoing>Flow_0z2tka5</bpmn:outgoing>
25
21
  </bpmn:userTask>
22
+ <bpmn:exclusiveGateway id="Gateway_1frlxvt">
23
+ <bpmn:incoming>Flow_0z2tka5</bpmn:incoming>
24
+ <bpmn:outgoing>Flow_05f69lu</bpmn:outgoing>
25
+ </bpmn:exclusiveGateway>
26
+ <bpmn:sequenceFlow id="Flow_0z2tka5" sourceRef="user_task" targetRef="Gateway_1frlxvt" />
27
+ <bpmn:endEvent id="Event_118hnmn">
28
+ <bpmn:incoming>Flow_05f69lu</bpmn:incoming>
29
+ </bpmn:endEvent>
30
+ <bpmn:sequenceFlow id="Flow_05f69lu" sourceRef="Gateway_1frlxvt" targetRef="Event_118hnmn">
31
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"></bpmn:conditionExpression>
32
+ </bpmn:sequenceFlow>
26
33
  </bpmn:process>
27
34
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
28
35
  <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1cidyxu">
29
36
  <bpmndi:BPMNShape id="Participant_0px403d_di" bpmnElement="Participant_0px403d" isHorizontal="true">
30
- <dc:Bounds x="5" y="30" width="415" height="260" />
37
+ <dc:Bounds x="5" y="30" width="455" height="260" />
31
38
  </bpmndi:BPMNShape>
32
39
  <bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
33
40
  <dc:Bounds x="92" y="152" width="36" height="36" />
@@ -35,22 +42,28 @@
35
42
  <dc:Bounds x="98" y="195" width="24" height="14" />
36
43
  </bpmndi:BPMNLabel>
37
44
  </bpmndi:BPMNShape>
38
- <bpmndi:BPMNShape id="Event_07hak5r_di" bpmnElement="Event_07hak5r">
39
- <dc:Bounds x="332" y="152" width="36" height="36" />
40
- <bpmndi:BPMNLabel>
41
- <dc:Bounds x="340" y="195" width="20" height="14" />
42
- </bpmndi:BPMNLabel>
43
- </bpmndi:BPMNShape>
44
45
  <bpmndi:BPMNShape id="Activity_0c7im8g_di" bpmnElement="user_task">
45
46
  <dc:Bounds x="180" y="130" width="100" height="80" />
46
47
  </bpmndi:BPMNShape>
48
+ <bpmndi:BPMNShape id="Gateway_1frlxvt_di" bpmnElement="Gateway_1frlxvt" isMarkerVisible="true">
49
+ <dc:Bounds x="315" y="135" width="50" height="50" />
50
+ </bpmndi:BPMNShape>
51
+ <bpmndi:BPMNShape id="Event_118hnmn_di" bpmnElement="Event_118hnmn">
52
+ <dc:Bounds x="382" y="142" width="36" height="36" />
53
+ </bpmndi:BPMNShape>
47
54
  <bpmndi:BPMNEdge id="Flow_142awo6_di" bpmnElement="Flow_142awo6">
48
55
  <di:waypoint x="128" y="170" />
49
56
  <di:waypoint x="180" y="170" />
50
57
  </bpmndi:BPMNEdge>
51
- <bpmndi:BPMNEdge id="Flow_0i7xqvi_di" bpmnElement="Flow_0i7xqvi">
58
+ <bpmndi:BPMNEdge id="Flow_0z2tka5_di" bpmnElement="Flow_0z2tka5">
52
59
  <di:waypoint x="280" y="170" />
53
- <di:waypoint x="332" y="170" />
60
+ <di:waypoint x="298" y="170" />
61
+ <di:waypoint x="298" y="160" />
62
+ <di:waypoint x="315" y="160" />
63
+ </bpmndi:BPMNEdge>
64
+ <bpmndi:BPMNEdge id="Flow_05f69lu_di" bpmnElement="Flow_05f69lu">
65
+ <di:waypoint x="365" y="160" />
66
+ <di:waypoint x="382" y="160" />
54
67
  </bpmndi:BPMNEdge>
55
68
  </bpmndi:BPMNPlane>
56
69
  </bpmndi:BPMNDiagram>