@5minds/node-red-contrib-processcube 0.0.7 → 0.0.8

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.0.6",
502
+ "version": "0.0.8",
503
503
  "local": true,
504
504
  "user": false,
505
505
  "nodes": {
@@ -525,6 +525,17 @@
525
525
  "module": "@5minds/node-red-contrib-processcube",
526
526
  "file": "/data/node_modules/node-red-contrib-processcube/externaltask-output.js"
527
527
  },
528
+ "externaltaskError": {
529
+ "name": "externaltaskError",
530
+ "types": [
531
+ "externaltask-error"
532
+ ],
533
+ "enabled": true,
534
+ "local": true,
535
+ "user": false,
536
+ "module": "@5minds/node-red-contrib-processcube",
537
+ "file": "/data/node_modules/node-red-contrib-processcube/externaltask-error.js"
538
+ },
528
539
  "processStart": {
529
540
  "name": "processStart",
530
541
  "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.0.3",
502
+ "version": "0.0.6",
503
503
  "local": true,
504
504
  "user": false,
505
505
  "nodes": {
@@ -16,7 +16,7 @@
16
16
  "welcome": "3.1.8"
17
17
  }
18
18
  },
19
- "menu-menu-item-sidebar": false,
20
- "menu-menu-item-palette": false
19
+ "menu-menu-item-sidebar": true,
20
+ "menu-menu-item-palette": true
21
21
  }
22
22
  }
@@ -738,5 +738,133 @@
738
738
  "x": 760,
739
739
  "y": 120,
740
740
  "wires": []
741
+ },
742
+ {
743
+ "id": "18e05d562d48f32d",
744
+ "type": "externaltask-input",
745
+ "z": "a23d2e782beb66f4",
746
+ "name": "SampleError",
747
+ "topic": "SampleError",
748
+ "x": 110,
749
+ "y": 840,
750
+ "wires": [
751
+ [
752
+ "49aee03a7885fae8"
753
+ ]
754
+ ]
755
+ },
756
+ {
757
+ "id": "49aee03a7885fae8",
758
+ "type": "delay",
759
+ "z": "a23d2e782beb66f4",
760
+ "name": "",
761
+ "pauseType": "delay",
762
+ "timeout": "5",
763
+ "timeoutUnits": "seconds",
764
+ "rate": "1",
765
+ "nbRateUnits": "1",
766
+ "rateUnits": "second",
767
+ "randomFirst": "1",
768
+ "randomLast": "5",
769
+ "randomUnits": "seconds",
770
+ "drop": false,
771
+ "allowrate": false,
772
+ "outputs": 1,
773
+ "x": 350,
774
+ "y": 840,
775
+ "wires": [
776
+ [
777
+ "bd68c4bdc53b8f80"
778
+ ]
779
+ ]
780
+ },
781
+ {
782
+ "id": "e4555d9019cd3f47",
783
+ "type": "catch",
784
+ "z": "a23d2e782beb66f4",
785
+ "name": "",
786
+ "scope": null,
787
+ "uncaught": false,
788
+ "x": 360,
789
+ "y": 960,
790
+ "wires": [
791
+ [
792
+ "fa1c26d470c38efd",
793
+ "019797b5a0882e7b",
794
+ "fb87f79852b22e4a"
795
+ ]
796
+ ]
797
+ },
798
+ {
799
+ "id": "bd68c4bdc53b8f80",
800
+ "type": "function",
801
+ "z": "a23d2e782beb66f4",
802
+ "name": "function 1",
803
+ "func": "throw Error(\"hello error\");\n\nreturn msg;",
804
+ "outputs": 1,
805
+ "timeout": 0,
806
+ "noerr": 0,
807
+ "initialize": "",
808
+ "finalize": "",
809
+ "libs": [],
810
+ "x": 560,
811
+ "y": 840,
812
+ "wires": [
813
+ [
814
+ "1ba1e62c9935255f"
815
+ ]
816
+ ]
817
+ },
818
+ {
819
+ "id": "fa1c26d470c38efd",
820
+ "type": "debug",
821
+ "z": "a23d2e782beb66f4",
822
+ "name": "debug 8",
823
+ "active": true,
824
+ "tosidebar": true,
825
+ "console": false,
826
+ "tostatus": false,
827
+ "complete": "false",
828
+ "statusVal": "",
829
+ "statusType": "auto",
830
+ "x": 620,
831
+ "y": 960,
832
+ "wires": []
833
+ },
834
+ {
835
+ "id": "019797b5a0882e7b",
836
+ "type": "debug",
837
+ "z": "a23d2e782beb66f4",
838
+ "name": "debug 9",
839
+ "active": true,
840
+ "tosidebar": true,
841
+ "console": false,
842
+ "tostatus": false,
843
+ "complete": "externalTaskId",
844
+ "targetType": "msg",
845
+ "statusVal": "",
846
+ "statusType": "auto",
847
+ "x": 620,
848
+ "y": 1020,
849
+ "wires": []
850
+ },
851
+ {
852
+ "id": "fb87f79852b22e4a",
853
+ "type": "externaltask-error",
854
+ "z": "a23d2e782beb66f4",
855
+ "name": "",
856
+ "error": "MyErrorCode",
857
+ "x": 610,
858
+ "y": 1100,
859
+ "wires": []
860
+ },
861
+ {
862
+ "id": "1ba1e62c9935255f",
863
+ "type": "externaltask-output",
864
+ "z": "a23d2e782beb66f4",
865
+ "name": "",
866
+ "x": 770,
867
+ "y": 840,
868
+ "wires": []
741
869
  }
742
870
  ]
@@ -0,0 +1,31 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType('externaltask-error',{
3
+ category: 'ProcessCube',
4
+ color: '#00aed7',
5
+ defaults: {
6
+ name: {value:""},
7
+ error: {value:""}
8
+ },
9
+ inputs: 1,
10
+ outputs: 0,
11
+ icon: "font-awesome/fa-exclamation-triangle",
12
+ label: function() {
13
+ return this.name || "externaltask-error";
14
+ }
15
+ });
16
+ </script>
17
+
18
+ <script type="text/html" data-template-name="externaltask-error">
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-error"><i class="fa fa-tag"></i> Error Code</label>
25
+ <input type="text" id="node-input-error" placeholder="Error Code of ExternalTask">
26
+ </div>
27
+ </script>
28
+
29
+ <script type="text/html" data-help-name="externaltask-error">
30
+ <p>A node which error response to an External Task of https://processcube.io</p>
31
+ </script>
@@ -0,0 +1,24 @@
1
+ const EventAggregator = require('./EventAggregator');
2
+
3
+ module.exports = function(RED) {
4
+ function ExternalTaskError(config) {
5
+ RED.nodes.createNode(this,config);
6
+ var node = this;
7
+
8
+ node.on('input', function(msg) {
9
+
10
+ const externalTaskId = msg.externalTaskId;
11
+
12
+ msg.payload = {
13
+ "error": {
14
+ errorCode: config.error,
15
+ errorMessage: msg.error.message,
16
+ errorDetails: msg.error.source
17
+ }
18
+ };
19
+
20
+ EventAggregator.eventEmitter.emit(`error-${externalTaskId}`, msg.payload);
21
+ });
22
+ }
23
+ RED.nodes.registerType("externaltask-error", ExternalTaskError);
24
+ }
@@ -34,9 +34,12 @@ module.exports = function(RED) {
34
34
  resolve(result);
35
35
  });
36
36
 
37
- EventAggregator.eventEmitter.once(`error-${externalTask.flowNodeInstanceId}`, (result) => {
37
+ EventAggregator.eventEmitter.once(`error-${externalTask.flowNodeInstanceId}`, (msg) => {
38
38
  msgCounter--;
39
39
  showStatus(node, msgCounter);
40
+
41
+ var result = msg.payload ? msg.payload : msg;
42
+
40
43
  reject(result);
41
44
  });
42
45
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "keywords": [
@@ -18,6 +18,7 @@
18
18
  "nodes": {
19
19
  "externaltaskInput": "externaltask-input.js",
20
20
  "externaltaskOutput": "externaltask-output.js",
21
+ "externaltaskError": "externaltask-error.js",
21
22
  "processStart": "process-start.js"
22
23
  }
23
24
  },
@@ -0,0 +1,78 @@
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="CheckError_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="CheckError" processRef="CheckError_Process" />
5
+ </bpmn:collaboration>
6
+ <bpmn:process id="CheckError_Process" name="CheckError" isExecutable="true">
7
+ <bpmn:laneSet>
8
+ <bpmn:lane id="Lane_1xzf0d3" name="Lane">
9
+ <bpmn:flowNodeRef>StartEvent_1</bpmn:flowNodeRef>
10
+ <bpmn:flowNodeRef>Event_0kmuys0</bpmn:flowNodeRef>
11
+ <bpmn:flowNodeRef>Activity_09zn4t5</bpmn:flowNodeRef>
12
+ <bpmn:flowNodeRef>Event_1gy657v</bpmn:flowNodeRef>
13
+ <bpmn:flowNodeRef>Event_1w4tivm</bpmn:flowNodeRef>
14
+ </bpmn:lane>
15
+ </bpmn:laneSet>
16
+ <bpmn:startEvent id="StartEvent_1" name="Start">
17
+ <bpmn:outgoing>Flow_14izvt0</bpmn:outgoing>
18
+ </bpmn:startEvent>
19
+ <bpmn:sequenceFlow id="Flow_14izvt0" sourceRef="StartEvent_1" targetRef="Activity_09zn4t5" />
20
+ <bpmn:endEvent id="Event_0kmuys0">
21
+ <bpmn:incoming>Flow_1ukmuxb</bpmn:incoming>
22
+ </bpmn:endEvent>
23
+ <bpmn:sequenceFlow id="Flow_1ukmuxb" sourceRef="Activity_09zn4t5" targetRef="Event_0kmuys0" />
24
+ <bpmn:serviceTask id="Activity_09zn4t5" name="ETW with error" camunda:type="external" camunda:topic="SampleError">
25
+ <bpmn:incoming>Flow_14izvt0</bpmn:incoming>
26
+ <bpmn:outgoing>Flow_1ukmuxb</bpmn:outgoing>
27
+ </bpmn:serviceTask>
28
+ <bpmn:sequenceFlow id="Flow_0tgf785" sourceRef="Event_1w4tivm" targetRef="Event_1gy657v" />
29
+ <bpmn:endEvent id="Event_1gy657v">
30
+ <bpmn:incoming>Flow_0tgf785</bpmn:incoming>
31
+ </bpmn:endEvent>
32
+ <bpmn:boundaryEvent id="Event_1w4tivm" attachedToRef="Activity_09zn4t5">
33
+ <bpmn:outgoing>Flow_0tgf785</bpmn:outgoing>
34
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_0nesf0j" />
35
+ </bpmn:boundaryEvent>
36
+ </bpmn:process>
37
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
38
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1cidyxu">
39
+ <bpmndi:BPMNShape id="Participant_0px403d_di" bpmnElement="Participant_0px403d" isHorizontal="true">
40
+ <dc:Bounds x="5" y="4" width="525" height="346" />
41
+ </bpmndi:BPMNShape>
42
+ <bpmndi:BPMNShape id="Lane_1xzf0d3_di" bpmnElement="Lane_1xzf0d3" isHorizontal="true">
43
+ <dc:Bounds x="35" y="4" width="495" height="346" />
44
+ </bpmndi:BPMNShape>
45
+ <bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
46
+ <dc:Bounds x="92" y="152" width="36" height="36" />
47
+ <bpmndi:BPMNLabel>
48
+ <dc:Bounds x="98" y="195" width="24" height="14" />
49
+ </bpmndi:BPMNLabel>
50
+ </bpmndi:BPMNShape>
51
+ <bpmndi:BPMNShape id="Event_0kmuys0_di" bpmnElement="Event_0kmuys0">
52
+ <dc:Bounds x="332" y="152" width="36" height="36" />
53
+ </bpmndi:BPMNShape>
54
+ <bpmndi:BPMNShape id="Activity_04h2kr7_di" bpmnElement="Activity_09zn4t5">
55
+ <dc:Bounds x="180" y="130" width="100" height="80" />
56
+ </bpmndi:BPMNShape>
57
+ <bpmndi:BPMNShape id="Event_1gy657v_di" bpmnElement="Event_1gy657v">
58
+ <dc:Bounds x="362" y="272" width="36" height="36" />
59
+ </bpmndi:BPMNShape>
60
+ <bpmndi:BPMNShape id="Event_0s7ur9g_di" bpmnElement="Event_1w4tivm">
61
+ <dc:Bounds x="222" y="192" width="36" height="36" />
62
+ </bpmndi:BPMNShape>
63
+ <bpmndi:BPMNEdge id="Flow_14izvt0_di" bpmnElement="Flow_14izvt0">
64
+ <di:waypoint x="128" y="170" />
65
+ <di:waypoint x="180" y="170" />
66
+ </bpmndi:BPMNEdge>
67
+ <bpmndi:BPMNEdge id="Flow_1ukmuxb_di" bpmnElement="Flow_1ukmuxb">
68
+ <di:waypoint x="280" y="170" />
69
+ <di:waypoint x="332" y="170" />
70
+ </bpmndi:BPMNEdge>
71
+ <bpmndi:BPMNEdge id="Flow_0tgf785_di" bpmnElement="Flow_0tgf785">
72
+ <di:waypoint x="240" y="228" />
73
+ <di:waypoint x="240" y="290" />
74
+ <di:waypoint x="362" y="290" />
75
+ </bpmndi:BPMNEdge>
76
+ </bpmndi:BPMNPlane>
77
+ </bpmndi:BPMNDiagram>
78
+ </bpmn:definitions>