bpmn-client 1.2.1 → 1.2.5

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.
package/.env CHANGED
@@ -1,4 +1,4 @@
1
1
  API_KEY=12345
2
- HOST=localhost
3
- PORT=3000
2
+ HOST=test.omniworkflow.com
3
+ PORT=443
4
4
  BASE_URL=api
package/demo.env ADDED
@@ -0,0 +1,4 @@
1
+ API_KEY=12345
2
+ HOST=bpmn.omniworkflow.com
3
+ PORT=443
4
+ BASE_URL=api
package/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/local.env ADDED
@@ -0,0 +1,4 @@
1
+ API_KEY=12345
2
+ HOST=localhost
3
+ PORT=3000
4
+ BASE_URL=api
package/package.json CHANGED
@@ -1,17 +1,14 @@
1
1
  {
2
2
  "name": "bpmn-client",
3
- "version": "1.2.1",
3
+ "version": "1.2.5",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "build": "tsc --build",
7
+ "compileRun": "tsc --build && node app.js",
8
+ "dev": "nodemon -e ts --exec \"npm run compileRun\"",
7
9
  "clean": "tsc --build --clean",
8
- "start": "node app.ts",
9
- "test": "mocha -R dot",
10
- "posttest": "eslint . --cache && npm run toc",
11
- "wintest": "node_modules/.bin/mocha",
12
- "start:watch": "tsc-watch --project . --onSuccess \"nodemon ./test.ts\"",
13
- "toc": "node scripts/generate-api-toc ./docs/API.md,./docs/Examples.md",
14
- "test-md": "node scripts/test-markdown.js ./docs/API.md && node scripts/test-markdown.js ./docs/Examples.md"
10
+ "start": "node test.ts",
11
+ "test": "mocha -exit --config=test\\.mocharc.json"
15
12
  },
16
13
  "description": "Client API for BPMN-Server webservices",
17
14
  "keywords": [
package/src/BPMNClient.js CHANGED
@@ -28,6 +28,7 @@ class WebService {
28
28
  try {
29
29
  driver.request(options, function (res) {
30
30
  console.log('STATUS: ' + res.statusCode);
31
+ this.response = res;
31
32
  //console.log(res);
32
33
  self.statusCode = res.statusCode;
33
34
  res.setEncoding('utf8');
@@ -171,6 +172,16 @@ class ClientEngine {
171
172
  return instance;
172
173
  });
173
174
  }
175
+ status() {
176
+ return __awaiter(this, void 0, void 0, function* () {
177
+ const ret = yield this.client.get('engine/status', {});
178
+ if (ret['errors']) {
179
+ console.log(ret['errors']);
180
+ throw new Error(ret['errors']);
181
+ }
182
+ return ret;
183
+ });
184
+ }
174
185
  }
175
186
  exports.ClientEngine = ClientEngine;
176
187
  class ClientDatastore {
package/src/BPMNClient.ts CHANGED
@@ -8,6 +8,7 @@ const http = require('http');
8
8
  class WebService {
9
9
  statusCode;
10
10
  result;
11
+ response;
11
12
  constructor() { }
12
13
  async invoke(params, options) {
13
14
 
@@ -25,6 +26,7 @@ class WebService {
25
26
 
26
27
  driver.request(options, function (res) {
27
28
  console.log('STATUS: ' + res.statusCode);
29
+ this.response = res;
28
30
  //console.log(res);
29
31
  self.statusCode = res.statusCode;
30
32
  res.setEncoding('utf8');
@@ -176,6 +178,14 @@ class ClientEngine {
176
178
  const instance = ret['instance'] as IInstanceData;
177
179
  return instance;
178
180
  }
181
+ async status() {
182
+ const ret = await this.client.get('engine/status', {});
183
+ if (ret['errors']) {
184
+ console.log(ret['errors']);
185
+ throw new Error(ret['errors']);
186
+ }
187
+ return ret;
188
+ }
179
189
  }
180
190
  class ClientDatastore {
181
191
  private client: BPMNClient;
package/src/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -0,0 +1,12 @@
1
+ {
2
+ "diff": true,
3
+ "extension": [ "js" ],
4
+ "package": "package.json",
5
+ "reporter": "spec",
6
+ "slow": 1500,
7
+ "timeout": 50000,
8
+ "recursive": true,
9
+ "file": [ "test/helpers/setup.js" ],
10
+ "ui": "mocha-cakes-2",
11
+ "watch-files": [ "test/feature/*.js" ]
12
+ }
@@ -3,10 +3,10 @@ const { BPMNClient } = require("../../src/");
3
3
 
4
4
 
5
5
  const API_KEY = '12345';
6
- //const HOST = 'localhost';
7
- //const PORT = '3000';
8
- const HOST = 'test.omniworkflow.com';
9
- const PORT = '443';
6
+ const HOST = 'localhost';
7
+ const PORT = '3000';
8
+ //const HOST = 'test.omniworkflow.com';
9
+ //const PORT = '443';
10
10
 
11
11
  const BASE_URL = 'api';
12
12
 
@@ -89,6 +89,11 @@ Feature('Buy Used Car- clean and repair', () => {
89
89
 
90
90
  });
91
91
 
92
+ and('find engine status', async () => {
93
+
94
+ var insts = await server.engine.status();
95
+
96
+ });
92
97
 
93
98
  //
94
99
  and('find instances', async () => {
package/test.env ADDED
@@ -0,0 +1,4 @@
1
+ API_KEY=12345
2
+ HOST=test.omniworkflow.com
3
+ PORT=443
4
+ BASE_URL=api
package/test.js CHANGED
@@ -39,6 +39,10 @@ function test() {
39
39
  catch (exc) {
40
40
  console.log(exc);
41
41
  }
42
+ var items = yield server.datastore.findItems({ "items.status": "end", "items.elementId": "task_Buy" });
43
+ items.forEach(item => {
44
+ console.log('item: id==>' + item.elementId, item.type, item.name, 'status==>', item.status);
45
+ });
42
46
  var insts = yield server.datastore.findInstances({ data: { caseId: caseId } });
43
47
  insts.forEach(inst => {
44
48
  console.log('Inst for CaseId id==>' + inst.id, inst.name, inst.data.caseId, 'status==>', inst.status);
package/test.ts CHANGED
@@ -60,7 +60,17 @@ async function test() {
60
60
  }
61
61
 
62
62
 
63
+
63
64
 
65
+ var items = await server.datastore.findItems({ "items.status": "end", "items.elementId": "task_Buy" });
66
+
67
+
68
+ items.forEach(item => {
69
+ console.log('item: id==>' + item.elementId, item.type, item.name, 'status==>', item.status);
70
+ });
71
+
72
+
73
+
64
74
  var insts = await server.datastore.findInstances({ data: { caseId: caseId } });
65
75
 
66
76
  insts.forEach(inst => {
package/test/mocha.opts DELETED
@@ -1,5 +0,0 @@
1
- --timeout 50000
2
- --reporter spec
3
- --recursive
4
- --require ./test/helpers/setup.js
5
- --ui mocha-cakes-2
@@ -1,91 +0,0 @@
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 };
@@ -1,69 +0,0 @@
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 };
@@ -1,50 +0,0 @@
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 };