bpmn-client 1.0.3 → 1.2.0

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.
Files changed (43) hide show
  1. package/.env +4 -0
  2. package/Sample/package.json +44 -0
  3. package/Sample/test.js +30 -0
  4. package/Sample/test.ts +27 -0
  5. package/Sample/tsconfig.json +17 -0
  6. package/bpmn-client-1.2.0.tgz +0 -0
  7. package/index.js +10 -141
  8. package/index.ts +1 -139
  9. package/package.json +8 -8
  10. package/{BPMNClient.js → src/BPMNClient.js} +124 -52
  11. package/src/BPMNClient.ts +219 -0
  12. package/src/index.js +15 -0
  13. package/src/index.ts +4 -0
  14. package/src/interfaces/DataObjects.js +2 -0
  15. package/src/interfaces/DataObjects.ts +97 -0
  16. package/src/interfaces/Enums.js +117 -0
  17. package/src/interfaces/Enums.ts +71 -0
  18. package/test/.eslintrc.json +20 -0
  19. package/test/feature/.env +5 -0
  20. package/test/feature/carServer.js +117 -0
  21. package/test/helpers/setup.js +9 -0
  22. package/test/logs/Buy Used Carrepairsfalse cleaning +0 -0
  23. package/test/logs/Buy Used Carrepairstrue cleaning +0 -0
  24. package/test/logs/Buy Used Carscenario CaseId +0 -0
  25. package/test/logs/carrepairsfalse cleaning +0 -0
  26. package/test/logs/carrepairstrue cleaning +0 -0
  27. package/test/mocha.opts +5 -0
  28. package/test/resources/Invoice.js +91 -0
  29. package/test/resources/car.js +69 -0
  30. package/test/resources/loop.js +50 -0
  31. package/test.js +14 -5
  32. package/test.ts +21 -4
  33. package/test2.js +270 -0
  34. package/test2.ts +326 -0
  35. package/tsconfig.json +4 -4
  36. package/BPMNClient.d.ts +0 -36
  37. package/BPMNClient.js.map +0 -1
  38. package/BPMNClient.ts +0 -139
  39. package/index.d.ts +0 -36
  40. package/index.js.map +0 -1
  41. package/npm.list +0 -579
  42. package/test.d.ts +0 -1
  43. package/test.js.map +0 -1
@@ -0,0 +1,71 @@
1
+
2
+ enum BPMN_TYPE {
3
+ UserTask = 'bpmn:UserTask',
4
+ ScriptTask = 'bpmn:ScriptTask',
5
+ ServiceTask = 'bpmn:ServiceTask',
6
+ SendTask = 'bpmn:SendTask',
7
+ ReceiveTask = 'bpmn:ReceiveTask',
8
+ BusinessRuleTask = 'bpmn:BusinessRuleTask',
9
+ SubProcess = 'bpmn:SubProces',
10
+ ParallelGateway = 'bpmn:ParallelGateway',
11
+ EventBasedGateway = 'bpmn:EventBasedGateway',
12
+ InclusiveGateway = 'bpmn:InclusiveGateway',
13
+ ExclusiveGateway = 'bpmn:ExclusiveGateway',
14
+ BoundaryEvent = 'bpmn:BoundaryEvent',
15
+ StartEvent = 'bpmn:StartEvent',
16
+ IntermediateCatchEvent = 'bpmn:IntermediateCatchEvent',
17
+ IntermediateThrowEvent = 'bpmn:IntermediateThrowEvent',
18
+ EndEvent = 'bpmn:EndEvent',
19
+ SequenceFlow = 'bpmn:SequenceFlow',
20
+ MessageFlow = 'bpmn:MessageFlow',
21
+ CallActivity = 'bpmn:CallActivity'
22
+ }
23
+
24
+ enum NODE_SUBTYPE {
25
+ timer = 'timer',
26
+ message = 'message',
27
+ signal = 'signal',
28
+ error = 'error',
29
+ escalation = 'escalation'
30
+ }
31
+ /*
32
+ * ALL events
33
+ */
34
+ enum EXECUTION_EVENT {
35
+ node_enter = 'enter', node_start = 'start', node_wait = 'wait', node_end = 'end', node_terminated = 'terminated',
36
+ transform_input = 'transformInput', transform_output ='transformOutput',
37
+ flow_take = 'take', flow_discard = 'discard',
38
+ process_loaded ='process.loaded',
39
+ process_start = 'process.start', process_started = 'process.started',
40
+ process_invoke = 'process.invoke', process_invoked = 'process.invoked',
41
+ process_restored = 'process.restored', process_resumed = 'process_resumed',
42
+ process_wait = 'process.wait',
43
+ process_end = 'process.end', process_terminated = 'executeion.terminate' ,
44
+ token_start = 'token.start', token_wait = 'token.wait', token_end = 'token.end', token_terminated = 'token.terminated'
45
+ }
46
+ /*
47
+ * possible actions by node
48
+ */
49
+ // must be same as above
50
+ enum NODE_ACTION { continue = 1, wait, end , stop , error , abort };
51
+
52
+ enum ITEM_STATUS { enter = 'enter', start = 'start', wait = 'wait', end = 'end', terminated = 'terminated' , discard= 'discard'}
53
+
54
+ //type ITEMSTATUS = 'enter' | 'start' | 'wait' | 'end' | 'terminated' | 'discard';
55
+
56
+ enum EXECUTION_STATUS { running='running',wait='wait', end = 'end' , terminated ='terminated' }
57
+
58
+ enum TOKEN_STATUS { running = 'running', wait = 'wait', end = 'end', terminated = 'terminated' }
59
+ /*
60
+ * possible actions by flow
61
+ */
62
+ // must be same as above
63
+
64
+ enum FLOW_ACTION { take = 'take', discard = 'discard' }
65
+
66
+
67
+ export {
68
+ BPMN_TYPE ,
69
+ EXECUTION_EVENT, NODE_ACTION, FLOW_ACTION,
70
+ ITEM_STATUS, TOKEN_STATUS, EXECUTION_STATUS , NODE_SUBTYPE
71
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "env": {
3
+ "mocha": true
4
+ },
5
+ "rules": {
6
+ "no-unused-expressions": 0,
7
+ "no-var": 1,
8
+ "prefer-arrow-callback": 1
9
+ },
10
+ "globals": {
11
+ "expect": false,
12
+ "Feature": false,
13
+ "Scenario": false,
14
+ "Given": false,
15
+ "When": false,
16
+ "Then": false,
17
+ "And": false,
18
+ "But": false
19
+ }
20
+ }
@@ -0,0 +1,5 @@
1
+ API_KEY=1234
2
+ MONGO_DB_URL=mongodb://localhost:27017?retryWrites=true&w=majority
3
+ MONGO_DB_NAME=bpmn
4
+ SENDGRID_API_KEY=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
5
+
@@ -0,0 +1,117 @@
1
+ const { BPMNClient } = require("../../src/");
2
+
3
+
4
+
5
+ const API_KEY = '12345';
6
+ //const HOST = 'localhost';
7
+ //const PORT = '3000';
8
+ const HOST = 'test.omniworkflow.com';
9
+ const PORT = '443';
10
+
11
+ const BASE_URL = 'api';
12
+
13
+
14
+ console.log('-------- car.js -----------');
15
+
16
+ const server = new BPMNClient(HOST, PORT, API_KEY);
17
+
18
+ var caseId = Math.floor(Math.random() * 10000);
19
+
20
+ let name = 'Buy Used Car';
21
+ let process;
22
+ let response;
23
+ let instanceId;
24
+
25
+ Feature('Buy Used Car- clean and repair', () => {
26
+ Scenario('Simple', () => {
27
+ Given('Start Buy Used Car Process', async () => {
28
+ response = await server.engine.start(name, { caseId: caseId });
29
+ instanceId = response.id;
30
+ console.log('**instanceId', response.id, instanceId);
31
+ console.log(' after start ', response.data.caseId);
32
+ });
33
+ Then('check for output', () => {
34
+ expect(response.data.caseId).equals(caseId);
35
+ expect(getItem('task_Buy').status).equals('wait');
36
+ });
37
+
38
+ When('a process defintion is executed', async () => {
39
+
40
+ const data = { needsCleaning: "Yes", needsRepairs: "Yes" };
41
+ const query = {
42
+ id: instanceId,
43
+ "items.elementId": 'task_Buy'
44
+ };
45
+ console.log(query);
46
+ response = await server.engine.invoke(query, data);
47
+ });
48
+
49
+ When('engine get', async () => {
50
+ const query = { id: instanceId };
51
+
52
+ response = await server.engine.get(query);
53
+
54
+ expect(response.id).equals(instanceId);
55
+
56
+ });
57
+
58
+
59
+ Then('check for output to have engine', () => {
60
+ expect(getItem('task_Buy').status).equals('end');
61
+ });
62
+
63
+ and('Clean it', async () => {
64
+
65
+ const query = {
66
+ "data.caseId": caseId,
67
+ "items.elementId": 'task_clean'
68
+ };
69
+ console.log(query);
70
+ await server.engine.invoke(query, {});
71
+ });
72
+
73
+ and('Repair it', async () => {
74
+ const query = { id: instanceId, "items.elementId": 'task_repair' };
75
+ response = await server.engine.invoke(query, {});
76
+ });
77
+ and('Drive it 1', async () => {
78
+ const query = {
79
+ id: instanceId,
80
+ "items.elementId": 'task_Drive'
81
+ };
82
+ response = await server.engine.invoke(query, {});
83
+ });
84
+
85
+ and('Case Complete', async () => {
86
+
87
+ console.log(response.status);
88
+ expect(getItem('task_Drive').status).equals('end');
89
+
90
+ });
91
+
92
+
93
+ //
94
+ and('find instances', async () => {
95
+
96
+ var insts = await server.datastore.findInstances({ id: response.id });
97
+ expect(insts).to.have.lengthOf(1);
98
+
99
+ });
100
+
101
+ and('find items', async () => {
102
+
103
+ var items = await server.datastore.findItems({ id: response.id } );
104
+ expect(items).to.have.lengthOf(17);
105
+
106
+ });
107
+
108
+
109
+
110
+
111
+ });
112
+
113
+ });
114
+
115
+ function getItem(id) {
116
+ return response.items.filter(item => { return item.elementId == id; })[0];
117
+ }
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ process.env.NODE_ENV = 'test';
4
+ Error.stackTraceLimit = 20;
5
+ global.expect = require('chai').expect;
6
+ global.assert = require('chai').assert;
7
+
8
+
9
+
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ --timeout 50000
2
+ --reporter spec
3
+ --recursive
4
+ --require ./test/helpers/setup.js
5
+ --ui mocha-cakes-2
@@ -0,0 +1,91 @@
1
+ const fs = require('fs');
2
+
3
+ const source = file = fs.readFileSync('../../WebApp/processes/invoice.bpmn',
4
+ { encoding: 'utf8', flag: 'r' });
5
+
6
+ const source2 = `
7
+ <?xml version="1.0" encoding="UTF-8"?>
8
+ <bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="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:di="http://www.omg.org/spec/DD/20100524/DI" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
9
+ <bpmn2:collaboration id="Collaboration_1vzc4e2">
10
+ <bpmn2:participant id="Participant_1g6enp2" name="Account Payable" processRef="Process_1" />
11
+ <bpmn2:participant id="Participant_1e7gk8x" name="Manager" processRef="Process_0t314on" />
12
+ <bpmn2:messageFlow id="MessageFlow_18tfm5f" sourceRef="task_cancelInvoice" targetRef="IntermediateCatchEvent_1xr94uz" />
13
+ </bpmn2:collaboration>
14
+ <bpmn2:process id="Process_1" isExecutable="false">
15
+ <bpmn2:startEvent id="StartEvent_0wntki2">
16
+ <bpmn2:outgoing>SequenceFlow_129vlnl</bpmn2:outgoing>
17
+ </bpmn2:startEvent>
18
+ <bpmn2:userTask id="task_issueInvoice" name="Issue Invoice">
19
+ <bpmn2:incoming>SequenceFlow_129vlnl</bpmn2:incoming>
20
+ <bpmn2:outgoing>SequenceFlow_1nmqrtq</bpmn2:outgoing>
21
+ </bpmn2:userTask>
22
+ <bpmn2:sequenceFlow id="SequenceFlow_129vlnl" sourceRef="StartEvent_0wntki2" targetRef="task_issueInvoice" />
23
+ <bpmn2:sequenceFlow id="SequenceFlow_1nmqrtq" sourceRef="task_issueInvoice" targetRef="ExclusiveGateway_04dgpye" />
24
+ <bpmn2:eventBasedGateway id="ExclusiveGateway_04dgpye">
25
+ <bpmn2:incoming>SequenceFlow_1nmqrtq</bpmn2:incoming>
26
+ <bpmn2:outgoing>SequenceFlow_147bbuq</bpmn2:outgoing>
27
+ <bpmn2:outgoing>SequenceFlow_1ucmquu</bpmn2:outgoing>
28
+ <bpmn2:outgoing>SequenceFlow_0dq5qq6</bpmn2:outgoing>
29
+ </bpmn2:eventBasedGateway>
30
+ <bpmn2:sequenceFlow id="SequenceFlow_147bbuq" sourceRef="ExclusiveGateway_04dgpye" targetRef="receiveTask_payment" />
31
+ <bpmn2:sequenceFlow id="SequenceFlow_1ucmquu" sourceRef="ExclusiveGateway_04dgpye" targetRef="event_timer">
32
+ <bpmn2:conditionExpression xsi:type="bpmn:tExpression">
33
+ <![CDATA[(this.reminderCounter < 3)]]>
34
+ </bpmn2:conditionExpression>
35
+ </bpmn2:sequenceFlow>
36
+ <bpmn2:sequenceFlow id="sequence_timer_reminder" sourceRef="event_timer" targetRef="task_reminder" />
37
+ <bpmn2:sequenceFlow id="SequenceFlow_1ml8g8q" sourceRef="receiveTask_payment" targetRef="EndEvent_0sxnxfz" />
38
+ <bpmn2:sequenceFlow id="SequenceFlow_0dq5qq6" sourceRef="ExclusiveGateway_04dgpye" targetRef="IntermediateCatchEvent_1xr94uz" />
39
+ <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1xr94uz" name="Cancel by Admin">
40
+ <bpmn2:incoming>SequenceFlow_0dq5qq6</bpmn2:incoming>
41
+ <bpmn2:outgoing>SequenceFlow_0karre6</bpmn2:outgoing>
42
+ <bpmn2:messageEventDefinition />
43
+ </bpmn2:intermediateCatchEvent>
44
+ <bpmn2:sequenceFlow id="SequenceFlow_0karre6" sourceRef="IntermediateCatchEvent_1xr94uz" targetRef="EndEvent_0ypa03q" />
45
+ <bpmn2:endEvent id="EndEvent_0ypa03q">
46
+ <bpmn2:incoming>SequenceFlow_0karre6</bpmn2:incoming>
47
+ <bpmn2:terminateEventDefinition />
48
+ </bpmn2:endEvent>
49
+ <bpmn2:intermediateCatchEvent id="event_timer" name="30 days later">
50
+ <bpmn2:incoming>SequenceFlow_1ucmquu</bpmn2:incoming>
51
+ <bpmn2:outgoing>sequence_timer_reminder</bpmn2:outgoing>
52
+
53
+ <bpmn2:timerEventDefinition id="TimerEventDefinition_07xu06a">
54
+ <bpmn2:timeDuration xsi:type="bpmn2:tExpression">PT2S</bpmn2:timeDuration>
55
+ </bpmn2:timerEventDefinition>
56
+
57
+ </bpmn2:intermediateCatchEvent>
58
+ <bpmn2:sendTask id="task_reminder" name="Issue Reminder">
59
+ <script>
60
+ <![CDATA[
61
+ this.token.log('testing from the inside Issue Reminder ');
62
+ ]]>
63
+ </script>
64
+ <bpmn2:incoming>sequence_timer_reminder</bpmn2:incoming>
65
+ </bpmn2:sendTask>
66
+ <bpmn2:receiveTask id="receiveTask_payment" name="Got Payment">
67
+ <bpmn2:incoming>SequenceFlow_147bbuq</bpmn2:incoming>
68
+ <bpmn2:outgoing>SequenceFlow_1ml8g8q</bpmn2:outgoing>
69
+ </bpmn2:receiveTask>
70
+ <bpmn2:endEvent id="EndEvent_0sxnxfz">
71
+ <bpmn2:incoming>SequenceFlow_1ml8g8q</bpmn2:incoming>
72
+ </bpmn2:endEvent>
73
+ </bpmn2:process>
74
+ <bpmn2:process id="Process_0t314on">
75
+ <bpmn2:sequenceFlow id="SequenceFlow_1vs4h9e" sourceRef="StartEvent_0loa7qt" targetRef="task_cancelInvoice" />
76
+ <bpmn2:sequenceFlow id="SequenceFlow_0yw5wjo" sourceRef="task_cancelInvoice" targetRef="IntermediateThrowEvent_0vasq6m" />
77
+ <bpmn2:startEvent id="StartEvent_0loa7qt">
78
+ <bpmn2:outgoing>SequenceFlow_1vs4h9e</bpmn2:outgoing>
79
+ </bpmn2:startEvent>
80
+ <bpmn2:userTask id="task_cancelInvoice" name="Cancel Invoice">
81
+ <bpmn2:incoming>SequenceFlow_1vs4h9e</bpmn2:incoming>
82
+ <bpmn2:outgoing>SequenceFlow_0yw5wjo</bpmn2:outgoing>
83
+ </bpmn2:userTask>
84
+ <bpmn2:endEvent id="IntermediateThrowEvent_0vasq6m">
85
+ <bpmn2:incoming>SequenceFlow_0yw5wjo</bpmn2:incoming>
86
+ </bpmn2:endEvent>
87
+ </bpmn2:process>
88
+ </bpmn2:definitions>
89
+ `;
90
+
91
+ module.exports = { source };
@@ -0,0 +1,69 @@
1
+ const source = `
2
+ <?xml version="1.0" encoding="UTF-8"?>
3
+ <bpmn:definitions
4
+ xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
5
+ xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
6
+ xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
7
+ xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
8
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9
+ xmlns:camunda="http://camunda.org/schema/1.0/bpmn"
10
+ exporter="bpmn-js (https://demo.bpmn.io)" exporterVersion="6.5.1">
11
+ <bpmn:collaboration id="Collaboration_0memx95">
12
+ <bpmn:participant id="Participant_1c0lpx5" processRef="Process_1hf9394" />
13
+ </bpmn:collaboration>
14
+ <bpmn:process id="Process_1hf9394" isExecutable="true">
15
+ <bpmn:startEvent id="StartEvent_158yep3">
16
+ <bpmn:outgoing>flow_start_buy</bpmn:outgoing>
17
+ </bpmn:startEvent>
18
+ <bpmn:userTask id="task_Buy" name="Buy">
19
+ <bpmn:extensionElements>
20
+ <camunda:formData>
21
+ <camunda:formField id="repairsRequired" label="Repairs Required?" type="boolean" />
22
+ <camunda:formField id="cleaningRequired" label="Cleaning Required?" type="boolean" />
23
+ </camunda:formData>
24
+ </bpmn:extensionElements>
25
+ <bpmn:incoming>flow_start_buy</bpmn:incoming>
26
+ <bpmn:outgoing>flow_buy_gateway</bpmn:outgoing>
27
+ </bpmn:userTask>
28
+ <bpmn:userTask id="task_clean" name="Clean">
29
+ <bpmn:incoming>flow_gateway_clean</bpmn:incoming>
30
+ <bpmn:outgoing>flow_clean_gateway</bpmn:outgoing>
31
+ </bpmn:userTask>
32
+ <bpmn:parallelGateway id="gateway_2">
33
+ <bpmn:incoming>flow_repair_gateway</bpmn:incoming>
34
+ <bpmn:incoming>flow_clean_gateway</bpmn:incoming>
35
+ <bpmn:outgoing>flow_gateway_drive</bpmn:outgoing>
36
+ </bpmn:parallelGateway>
37
+ <bpmn:endEvent id="Event_19ebav7">
38
+ <bpmn:incoming>flow_drive_end</bpmn:incoming>
39
+ </bpmn:endEvent>
40
+ <bpmn:userTask id="task_repair" name="Repair">
41
+ <bpmn:incoming>flow_gateway_repair</bpmn:incoming>
42
+ <bpmn:outgoing>flow_repair_gateway</bpmn:outgoing>
43
+ </bpmn:userTask>
44
+ <bpmn:sequenceFlow id="flow_start_buy" sourceRef="StartEvent_158yep3" targetRef="task_Buy" />
45
+ <bpmn:sequenceFlow id="flow_buy_gateway" sourceRef="task_Buy" targetRef="gateway_1" />
46
+ <bpmn:sequenceFlow id="flow_gateway_repair" sourceRef="gateway_1" targetRef="task_repair">
47
+ <bpmn:conditionExpression>(this.needsRepairs==true)</bpmn:conditionExpression>
48
+ </bpmn:sequenceFlow >
49
+ <bpmn:sequenceFlow id="flow_gateway_clean" sourceRef="gateway_1" targetRef="task_clean">
50
+ <bpmn:conditionExpression>(this.needsCleaning==true)</bpmn:conditionExpression>
51
+ </bpmn:sequenceFlow >
52
+ <bpmn:sequenceFlow id="flow_repair_gateway" sourceRef="task_repair" targetRef="gateway_2" />
53
+ <bpmn:sequenceFlow id="flow_clean_gateway" sourceRef="task_clean" targetRef="gateway_2" />
54
+ <bpmn:sequenceFlow id="flow_gateway_drive" sourceRef="gateway_2" targetRef="task_Drive" />
55
+ <bpmn:sequenceFlow id="flow_drive_end" sourceRef="task_Drive" targetRef="Event_19ebav7" />
56
+ <bpmn:userTask id="task_Drive" name="Drive">
57
+ <bpmn:incoming>flow_gateway_drive</bpmn:incoming>
58
+ <bpmn:outgoing>flow_drive_end</bpmn:outgoing>
59
+ </bpmn:userTask>
60
+ <bpmn:inclusiveGateway id="gateway_1">
61
+ <bpmn:incoming>flow_buy_gateway</bpmn:incoming>
62
+ <bpmn:outgoing>flow_gateway_repair</bpmn:outgoing>
63
+ <bpmn:outgoing>flow_gateway_clean</bpmn:outgoing>
64
+ </bpmn:inclusiveGateway>
65
+ </bpmn:process>
66
+ </bpmn:definitions>
67
+ `;
68
+
69
+ module.exports = { source };
@@ -0,0 +1,50 @@
1
+
2
+ const source = `
3
+ <?xml version="1.0" encoding="UTF-8"?>
4
+ <bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+ xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
6
+ xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
7
+ xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
8
+ xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1vpaa20"
9
+ targetNamespace="http://bpmn.io/schema/bpmn"
10
+ exporter="bpmn-js (https://demo.bpmn.io)" exporterVersion="6.5.1">
11
+ <bpmn:process id="Process_15krzlx" isExecutable="false">
12
+ <bpmn:startEvent id="StartEvent_12lfa5f">
13
+ <bpmn:outgoing>Flow_0bb7flg</bpmn:outgoing>
14
+ </bpmn:startEvent>
15
+ <bpmn:sequenceFlow id="Flow_0bb7flg" sourceRef="StartEvent_12lfa5f" targetRef="scriptTask" />
16
+ <bpmn:sequenceFlow id="Flow_03lw5wj" sourceRef="scriptTask" targetRef="serviceTask" />
17
+ <bpmn:sequenceFlow id="Flow_0cq93ga" sourceRef="serviceTask" targetRef="sendTask" />
18
+ <bpmn:endEvent id="Event_0iwmzob">
19
+ <bpmn:incoming>Flow_0wyvfqv</bpmn:incoming>
20
+ </bpmn:endEvent>
21
+ <bpmn:sequenceFlow id="Flow_0wyvfqv" sourceRef="sendTask" targetRef="Event_0iwmzob" />
22
+ <bpmn:scriptTask id="scriptTask" name="ScriptTask">
23
+ <script>
24
+ <![CDATA[
25
+ this.token.log('testing from the inside: '+this.token.data.loopKey);
26
+ ]]>
27
+ </script>
28
+ <bpmn:multiInstanceLoopCharacteristics isSequential="true" js:collection="(this.records)" />
29
+ <bpmn:incoming>Flow_0bb7flg</bpmn:incoming>
30
+ <bpmn:outgoing>Flow_03lw5wj</bpmn:outgoing>
31
+ </bpmn:scriptTask>
32
+
33
+
34
+ <bpmn:serviceTask id="serviceTask" name="ServiceTask"
35
+ implementation="\{this.token.execution.handler.service1(this);}">
36
+ <bpmn:multiInstanceLoopCharacteristics isSequential="false" js:collection="(this.records)" />
37
+
38
+ <bpmn:incoming>Flow_03lw5wj</bpmn:incoming>
39
+ <bpmn:outgoing>Flow_0cq93ga</bpmn:outgoing>
40
+ </bpmn:serviceTask>
41
+ <bpmn:sendTask id="sendTask" name="SendTask">
42
+ <bpmn:incoming>Flow_0cq93ga</bpmn:incoming>
43
+ <bpmn:outgoing>Flow_0wyvfqv</bpmn:outgoing>
44
+ </bpmn:sendTask>
45
+ </bpmn:process>
46
+ </bpmn:definitions>
47
+ `;
48
+
49
+
50
+ module.exports = { source };
package/test.js CHANGED
@@ -9,12 +9,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const BPMNClient_1 = require("./BPMNClient");
12
+ const BPMNClient_1 = require("./src/BPMNClient");
13
+ console.log("Testing BPMNClient");
14
+ test();
13
15
  function test() {
14
16
  return __awaiter(this, void 0, void 0, function* () {
15
- const client = new BPMNClient_1.BPMNClient('bpmn.omniworkflow.com', 80);
16
- const ret = yield client.engine.start({ name: "Buy Used Car", data: {} });
17
- console.log(ret);
17
+ const client = new BPMNClient_1.BPMNClient('localhost', 3000, 12345);
18
+ var instance = yield client.engine.start("Buy Used Car", {});
19
+ console.log("instance.id", instance.id, instance.name, instance.status);
20
+ var insts = yield client.datastore.findInstances({ 'status': 'running' });
21
+ insts.forEach(inst => {
22
+ console.log('id==>' + inst.id, inst.name, 'status==>', inst.status);
23
+ });
24
+ var items = yield client.datastore.findItems({ query: { "items.elementId": "task_Buy" } });
25
+ items.forEach(item => {
26
+ console.log('item: id==>' + item.id, item.name, 'status==>', item.status);
27
+ });
18
28
  });
19
29
  }
20
- //# sourceMappingURL=test.js.map
package/test.ts CHANGED
@@ -1,10 +1,27 @@
1
- import { BPMNClient } from './BPMNClient';
1
+ import { BPMNClient } from './src/BPMNClient';
2
2
 
3
3
 
4
+ console.log("Testing BPMNClient");
5
+ test();
6
+
4
7
  async function test() {
5
- const client = new BPMNClient('bpmn.omniworkflow.com', 80);
6
- const ret= await client.engine.start({ name: "Buy Used Car", data: {} });
7
- console.log(ret);
8
+ const client = new BPMNClient('localhost', 3000,12345);
9
+ var instance = await client.engine.start("Buy Used Car", {} );
10
+ console.log("instance.id", instance.id, instance.name,instance.status);
11
+
12
+ var insts= await client.datastore.findInstances({ 'status': 'running' });
13
+
14
+ insts.forEach(inst => {
15
+ console.log('id==>' + inst.id,inst.name, 'status==>',inst.status);
16
+ });
17
+
18
+
19
+ var items = await client.datastore.findItems({ query: { "items.elementId": "task_Buy" } });
20
+
21
+
22
+ items.forEach(item => {
23
+ console.log('item: id==>' + item.id, item.name, 'status==>', item.status);
24
+ });
8
25
 
9
26
  }
10
27