@5minds/node-red-contrib-processcube 0.2.5 → 0.2.6-feature-1b79c0-lvmvp9ag

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.
@@ -499,7 +499,7 @@
499
499
  },
500
500
  "@5minds/node-red-contrib-processcube": {
501
501
  "name": "@5minds/node-red-contrib-processcube",
502
- "version": "0.2.4",
502
+ "version": "0.2.6",
503
503
  "local": true,
504
504
  "user": false,
505
505
  "nodes": {
@@ -547,6 +547,17 @@
547
547
  "module": "@5minds/node-red-contrib-processcube",
548
548
  "file": "/data/node_modules/node-red-contrib-processcube/process-start.js"
549
549
  },
550
+ "UserTaskInput": {
551
+ "name": "UserTaskInput",
552
+ "types": [
553
+ "usertask-input"
554
+ ],
555
+ "enabled": true,
556
+ "local": true,
557
+ "user": false,
558
+ "module": "@5minds/node-red-contrib-processcube",
559
+ "file": "/data/node_modules/node-red-contrib-processcube/usertask-input.js"
560
+ },
550
561
  "processcubeEngineConfig": {
551
562
  "name": "processcubeEngineConfig",
552
563
  "types": [
@@ -499,7 +499,7 @@
499
499
  },
500
500
  "@5minds/node-red-contrib-processcube": {
501
501
  "name": "@5minds/node-red-contrib-processcube",
502
- "version": "0.2.4",
502
+ "version": "0.2.6",
503
503
  "local": true,
504
504
  "user": false,
505
505
  "nodes": {
@@ -546,6 +546,17 @@
546
546
  "user": false,
547
547
  "module": "@5minds/node-red-contrib-processcube",
548
548
  "file": "/data/node_modules/node-red-contrib-processcube/process-start.js"
549
+ },
550
+ "processcubeEngineConfig": {
551
+ "name": "processcubeEngineConfig",
552
+ "types": [
553
+ "processcube-engine-config"
554
+ ],
555
+ "enabled": true,
556
+ "local": true,
557
+ "user": false,
558
+ "module": "@5minds/node-red-contrib-processcube",
559
+ "file": "/data/node_modules/node-red-contrib-processcube/processcube-engine-config.js"
549
560
  }
550
561
  }
551
562
  }
@@ -17,6 +17,6 @@
17
17
  }
18
18
  },
19
19
  "menu-menu-item-sidebar": true,
20
- "menu-menu-item-palette": true
20
+ "menu-menu-item-palette": false
21
21
  }
22
22
  }
@@ -16,7 +16,7 @@
16
16
  "welcome": "3.1.8"
17
17
  }
18
18
  },
19
- "menu-menu-item-sidebar": false,
19
+ "menu-menu-item-sidebar": true,
20
20
  "menu-menu-item-palette": true
21
21
  }
22
22
  }
@@ -7,6 +7,14 @@
7
7
  "info": "",
8
8
  "env": []
9
9
  },
10
+ {
11
+ "id": "fd3c725340de4f74",
12
+ "type": "tab",
13
+ "label": "Flow 2",
14
+ "disabled": false,
15
+ "info": "",
16
+ "env": []
17
+ },
10
18
  {
11
19
  "id": "d042a4c68f51d6ab",
12
20
  "type": "processcube-engine-config",
@@ -874,5 +882,35 @@
874
882
  "x": 770,
875
883
  "y": 840,
876
884
  "wires": []
885
+ },
886
+ {
887
+ "id": "ec0be0ef92746967",
888
+ "type": "usertask-input",
889
+ "z": "fd3c725340de4f74",
890
+ "name": "",
891
+ "engine": "d042a4c68f51d6ab",
892
+ "x": 290,
893
+ "y": 360,
894
+ "wires": [
895
+ [
896
+ "090d42845540049c"
897
+ ]
898
+ ]
899
+ },
900
+ {
901
+ "id": "090d42845540049c",
902
+ "type": "debug",
903
+ "z": "fd3c725340de4f74",
904
+ "name": "debug 10",
905
+ "active": true,
906
+ "tosidebar": true,
907
+ "console": false,
908
+ "tostatus": false,
909
+ "complete": "false",
910
+ "statusVal": "",
911
+ "statusType": "auto",
912
+ "x": 510,
913
+ "y": 360,
914
+ "wires": []
877
915
  }
878
916
  ]
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "0.2.5",
3
+ "version": "0.2.6-feature-1b79c0-lvmvp9ag",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
- "authors": [{
6
+ "authors": [
7
+ {
7
8
  "name": "Martin Moellenbeck",
8
9
  "email": "Martin.Moellenbeck@5Minds.de"
9
10
  },
@@ -31,11 +32,12 @@
31
32
  "externaltaskOutput": "externaltask-output.js",
32
33
  "externaltaskError": "externaltask-error.js",
33
34
  "processStart": "process-start.js",
35
+ "UserTaskInput": "usertask-input.js",
34
36
  "processcubeEngineConfig": "processcube-engine-config.js"
35
37
  }
36
38
  },
37
39
  "dependencies": {
38
- "@5minds/processcube_engine_client": "^5.0.0"
40
+ "@5minds/processcube_engine_client": "4.4.5"
39
41
  },
40
42
  "keywords": [
41
43
  "node-red",
@@ -0,0 +1,69 @@
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="SampleUserTask_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="SampleUserTask" processRef="SampleUserTask_Process" />
5
+ </bpmn:collaboration>
6
+ <bpmn:process id="SampleUserTask_Process" name="SampleUserTask" isExecutable="true">
7
+ <bpmn:laneSet>
8
+ <bpmn:lane id="Lane_1xzf0d3" name="Lane">
9
+ <bpmn:flowNodeRef>StartEvent_1</bpmn:flowNodeRef>
10
+ <bpmn:flowNodeRef>Event_1eeiwx4</bpmn:flowNodeRef>
11
+ <bpmn:flowNodeRef>Activity_0ljiko7</bpmn:flowNodeRef>
12
+ </bpmn:lane>
13
+ </bpmn:laneSet>
14
+ <bpmn:startEvent id="StartEvent_1" name="Start">
15
+ <bpmn:extensionElements>
16
+ <camunda:properties>
17
+ <camunda:property name="studio.defaultCustomStartToken" value="{&#10; &#34;sample&#34;: &#34;hello&#34;&#10;}" />
18
+ </camunda:properties>
19
+ </bpmn:extensionElements>
20
+ <bpmn:outgoing>Flow_1h0giih</bpmn:outgoing>
21
+ </bpmn:startEvent>
22
+ <bpmn:sequenceFlow id="Flow_1h0giih" sourceRef="StartEvent_1" targetRef="Activity_0ljiko7" />
23
+ <bpmn:endEvent id="Event_1eeiwx4">
24
+ <bpmn:incoming>Flow_1laqnja</bpmn:incoming>
25
+ </bpmn:endEvent>
26
+ <bpmn:sequenceFlow id="Flow_1laqnja" sourceRef="Activity_0ljiko7" targetRef="Event_1eeiwx4" />
27
+ <bpmn:userTask id="Activity_0ljiko7" name="Hello world">
28
+ <bpmn:extensionElements>
29
+ <camunda:formData>
30
+ <camunda:formField id="hello_id" label="Hello" type="string" customForm="{&#34;placeholder&#34;:&#34;world&#34;}" />
31
+ <camunda:formField id="AnotherField" label="AnotherField" type="long" defaultValue="${token.current.sample}" customForm="{&#34;hint&#34;:&#34;Sample&#34;}" />
32
+ </camunda:formData>
33
+ </bpmn:extensionElements>
34
+ <bpmn:incoming>Flow_1h0giih</bpmn:incoming>
35
+ <bpmn:outgoing>Flow_1laqnja</bpmn:outgoing>
36
+ </bpmn:userTask>
37
+ </bpmn:process>
38
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
39
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1cidyxu">
40
+ <bpmndi:BPMNShape id="Participant_0px403d_di" bpmnElement="Participant_0px403d" isHorizontal="true">
41
+ <dc:Bounds x="5" y="4" width="435" height="346" />
42
+ </bpmndi:BPMNShape>
43
+ <bpmndi:BPMNShape id="Lane_1xzf0d3_di" bpmnElement="Lane_1xzf0d3" isHorizontal="true">
44
+ <dc:Bounds x="35" y="4" width="405" height="346" />
45
+ </bpmndi:BPMNShape>
46
+ <bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
47
+ <dc:Bounds x="92" y="152" width="36" height="36" />
48
+ <bpmndi:BPMNLabel>
49
+ <dc:Bounds x="98" y="195" width="24" height="14" />
50
+ </bpmndi:BPMNLabel>
51
+ </bpmndi:BPMNShape>
52
+ <bpmndi:BPMNShape id="Event_1eeiwx4_di" bpmnElement="Event_1eeiwx4">
53
+ <dc:Bounds x="332" y="152" width="36" height="36" />
54
+ </bpmndi:BPMNShape>
55
+ <bpmndi:BPMNShape id="Activity_1uodwbi_di" bpmnElement="Activity_0ljiko7">
56
+ <dc:Bounds x="180" y="130" width="100" height="80" />
57
+ <bpmndi:BPMNLabel />
58
+ </bpmndi:BPMNShape>
59
+ <bpmndi:BPMNEdge id="Flow_1h0giih_di" bpmnElement="Flow_1h0giih">
60
+ <di:waypoint x="128" y="170" />
61
+ <di:waypoint x="180" y="170" />
62
+ </bpmndi:BPMNEdge>
63
+ <bpmndi:BPMNEdge id="Flow_1laqnja_di" bpmnElement="Flow_1laqnja">
64
+ <di:waypoint x="280" y="170" />
65
+ <di:waypoint x="332" y="170" />
66
+ </bpmndi:BPMNEdge>
67
+ </bpmndi:BPMNPlane>
68
+ </bpmndi:BPMNDiagram>
69
+ </bpmn:definitions>
@@ -0,0 +1,31 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType('usertask-input',{
3
+ category: 'ProcessCube',
4
+ color: '#00aed7',
5
+ defaults: {
6
+ name: {value: ""},
7
+ engine: {value: "", type: "processcube-engine-config"}
8
+ },
9
+ inputs: 0,
10
+ outputs: 1,
11
+ icon: "font-awesome/fa-envelope-open",
12
+ label: function() {
13
+ return this.name || "usertask-input";
14
+ }
15
+ });
16
+ </script>
17
+
18
+ <script type="text/html" data-template-name="usertask-input">
19
+ <div class="form-row">
20
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
21
+ <input type="text" id="node-input-name" placeholder="Name">
22
+ </div>
23
+ <div class="form-row">
24
+ <label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
25
+ <input type="text" id="node-input-engine" placeholder="http://engine:8000">
26
+ </div>
27
+ </script>
28
+
29
+ <script type="text/html" data-help-name="usertask-input">
30
+ <p>A node which subscribes to an User Task of https://processcube.io</p>
31
+ </script>
@@ -0,0 +1,56 @@
1
+ const process = require('process');
2
+ const EventEmitter = require('node:events');
3
+
4
+ const engine_client = require('@5minds/processcube_engine_client');
5
+
6
+ function showStatus(node, msgCounter) {
7
+ if (msgCounter >= 1) {
8
+ node.status({fill: "blue", shape: "dot", text: `handling tasks ${msgCounter}`});
9
+ } else {
10
+ node.status({fill: "blue", shape: "ring", text: `subcribed ${msgCounter}`});
11
+ }
12
+ }
13
+
14
+ module.exports = function(RED) {
15
+ function UserTaskInput(config) {
16
+ RED.nodes.createNode(this,config);
17
+ var node = this;
18
+ var msgCounter = 0;
19
+ var flowContext = node.context().flow;
20
+ var nodeContext = node.context();
21
+
22
+ this.engine = this.server = RED.nodes.getNode(config.engine);
23
+
24
+ const engineUrl = this.engine?.url || process.env.ENGINE_URL || 'http://engine:8000';
25
+
26
+ var client = nodeContext.get('client');
27
+
28
+ if (!client) {
29
+ nodeContext.set('client', new engine_client.EngineClient(engineUrl));
30
+ client = nodeContext.get('client');
31
+ }
32
+
33
+ var eventEmitter = flowContext.get('emitter');
34
+
35
+ if (!eventEmitter) {
36
+ flowContext.set('emitter', new EventEmitter());
37
+ eventEmitter = flowContext.get('emitter');
38
+ }
39
+
40
+ client.userTasks.onUserTaskWaiting((userTaskWaitingNotification) => {
41
+ console.log(`UserTask with id ${userTaskWaitingNotification.flowNodeInstanceId} is waiting.`);
42
+
43
+ // processModelName
44
+ // flowNodeId
45
+ client.userTasks.query({
46
+ flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
47
+ processModelId: userTaskWaitingNotification.processModelId,
48
+ flowNodeId: userTaskWaitingNotification.flowNodeId,
49
+ }).then((matchingFlowNodes) => {
50
+ node.send({ payload: matchingFlowNodes });
51
+ });
52
+
53
+ });
54
+ }
55
+ RED.nodes.registerType("usertask-input", UserTaskInput);
56
+ }