bpmn-client 1.4.0 → 2.1.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.
- package/README.md +32 -0
- package/bin/cli.js +245 -0
- package/bin/setup.js +24 -0
- package/{src → dist}/BPMNClient.js +285 -273
- package/dist/BPMNClient2.js +252 -0
- package/{src → dist}/WebService.js +82 -82
- package/{cli.js → dist/cli.js} +243 -242
- package/{src → dist}/index.js +16 -19
- package/{src/interfaces/BPMNClient.js → dist/interfaces/API.js} +2 -2
- package/{src → dist}/interfaces/DataObjects.js +2 -2
- package/{src → dist}/interfaces/Enums.js +124 -112
- package/{remote-import.js → dist/remote-import.js} +137 -137
- package/dist/setup.js +22 -0
- package/{test-raw.js → dist/test-raw.js} +73 -74
- package/dist/test.js +75 -0
- package/dist/test2.js +78 -0
- package/{test3.js → dist/test3.js} +42 -42
- package/package.json +11 -2
- package/.env +0 -4
- package/Sample/.env +0 -4
- package/Sample/CarExample.js +0 -62
- package/Sample/CarExample.ts +0 -97
- package/Sample/package.json +0 -44
- package/Sample/test.js +0 -33
- package/Sample/test.ts +0 -32
- package/Sample/tsconfig.json +0 -17
- package/cli.ts +0 -268
- package/demo.env +0 -4
- package/index.js +0 -17
- package/index.ts +0 -1
- package/local.env +0 -4
- package/monitor.js +0 -91
- package/monitor.ts +0 -100
- package/remote-import.ts +0 -167
- package/src/BPMNClient.ts +0 -265
- package/src/WebService.ts +0 -90
- package/src/index.ts +0 -4
- package/src/interfaces/BPMNClient.ts +0 -29
- package/src/interfaces/DataObjects.ts +0 -100
- package/src/interfaces/Enums.ts +0 -82
- package/test/.eslintrc.json +0 -20
- package/test/.mocharc.json +0 -12
- package/test/feature/.env +0 -4
- package/test/feature/car.js +0 -123
- package/test/feature/carServer.js +0 -123
- package/test/helpers/setup.js +0 -9
- package/test/logs/Buy Used Carrepairsfalse cleaning +0 -0
- package/test/logs/Buy Used Carrepairstrue cleaning +0 -0
- package/test/logs/Buy Used Carscenario CaseId +0 -0
- package/test/logs/carrepairsfalse cleaning +0 -0
- package/test/logs/carrepairstrue cleaning +0 -0
- package/test-raw.ts +0 -73
- package/test.env +0 -4
- package/test.js +0 -258
- package/test.ts +0 -339
- package/test3.ts +0 -40
- package/tsconfig.json +0 -17
- /package/{test2.js → dist/monitor.js} +0 -0
package/src/interfaces/Enums.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
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:SubProcess',
|
|
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
|
-
cancel = 'cancel',
|
|
31
|
-
|
|
32
|
-
compensate = 'compensate'
|
|
33
|
-
}
|
|
34
|
-
/*
|
|
35
|
-
* ALL events
|
|
36
|
-
*/
|
|
37
|
-
enum EXECUTION_EVENT {
|
|
38
|
-
node_enter = 'enter', node_start = 'start', node_wait = 'wait', node_end = 'end', node_terminated = 'terminated',
|
|
39
|
-
transform_input = 'transformInput', transform_output ='transformOutput',
|
|
40
|
-
flow_take = 'take', flow_discard = 'discard',
|
|
41
|
-
process_loaded ='process.loaded',
|
|
42
|
-
process_start = 'process.start', process_started = 'process.started',
|
|
43
|
-
process_invoke = 'process.invoke', process_invoked = 'process.invoked',
|
|
44
|
-
process_restored = 'process.restored', process_resumed = 'process_resumed',
|
|
45
|
-
process_wait = 'process.wait',
|
|
46
|
-
process_end = 'process.end', process_terminated = 'process.terminated' ,
|
|
47
|
-
token_start = 'token.start', token_wait = 'token.wait', token_end = 'token.end', token_terminated = 'token.terminated'
|
|
48
|
-
}
|
|
49
|
-
/*
|
|
50
|
-
* possible actions by node
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
enum NODE_ACTION { continue = 1, wait, end , cancel, stop , error , abort };
|
|
54
|
-
|
|
55
|
-
enum ITEM_STATUS {
|
|
56
|
-
enter = 'enter',
|
|
57
|
-
start = 'start',
|
|
58
|
-
wait = 'wait',
|
|
59
|
-
end = 'end',
|
|
60
|
-
terminated = 'terminated',
|
|
61
|
-
cancelled = 'cancelled',
|
|
62
|
-
discard = 'discard'
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
//type ITEMSTATUS = 'enter' | 'start' | 'wait' | 'end' | 'terminated' | 'discard';
|
|
67
|
-
|
|
68
|
-
enum EXECUTION_STATUS { running='running',wait='wait', end = 'end' , terminated ='terminated' }
|
|
69
|
-
|
|
70
|
-
enum TOKEN_STATUS { running = 'running', wait = 'wait', end = 'end', terminated = 'terminated' }
|
|
71
|
-
/*
|
|
72
|
-
* possible actions by flow
|
|
73
|
-
*/
|
|
74
|
-
// must be same as above
|
|
75
|
-
|
|
76
|
-
enum FLOW_ACTION { take = 'take', discard = 'discard' }
|
|
77
|
-
|
|
78
|
-
export {
|
|
79
|
-
BPMN_TYPE ,
|
|
80
|
-
EXECUTION_EVENT, NODE_ACTION, FLOW_ACTION,
|
|
81
|
-
ITEM_STATUS, TOKEN_STATUS, EXECUTION_STATUS , NODE_SUBTYPE
|
|
82
|
-
}
|
package/test/.eslintrc.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
}
|
package/test/.mocharc.json
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
}
|
package/test/feature/.env
DELETED
package/test/feature/car.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
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('-------- carServer.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
|
-
let userId='user1';
|
|
25
|
-
|
|
26
|
-
Feature('Buy Used Car- clean and repair', () => {
|
|
27
|
-
Scenario('Simple', () => {
|
|
28
|
-
Given('Start Buy Used Car Process',async () => {
|
|
29
|
-
response = await server.engine.start(name, {caseId: caseId},null,userId);
|
|
30
|
-
console.log('**instanceId', response.id);
|
|
31
|
-
instanceId = response.id;
|
|
32
|
-
console.log('data:',response.data);
|
|
33
|
-
console.log('item',getItem('task_Buy'));
|
|
34
|
-
|
|
35
|
-
// console.log(' after start ', response.instance.caseId);
|
|
36
|
-
});
|
|
37
|
-
Then('check for output', () => {
|
|
38
|
-
expect(response.data.starterUserId).equals(userId);
|
|
39
|
-
expect(response.data.caseId).equals(caseId);
|
|
40
|
-
expect(getItem('task_Buy').status).equals('wait');
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
When('assignTask', async () => {
|
|
44
|
-
const query = {id: instanceId ,"items.elementId": 'task_Buy' };
|
|
45
|
-
const assignment = {assignee: userId,
|
|
46
|
-
candidateUsers: ['employee1','manager1'],
|
|
47
|
-
dueDate :new Date() , priority: 7
|
|
48
|
-
};
|
|
49
|
-
response = await server.engine.assign(query,null,userId,assignment);
|
|
50
|
-
|
|
51
|
-
const itm=getItem('task_Buy');
|
|
52
|
-
|
|
53
|
-
console.log(itm);
|
|
54
|
-
|
|
55
|
-
expect(itm.priority).equals(7);
|
|
56
|
-
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
When('a process defintion is executed', async () => {
|
|
62
|
-
|
|
63
|
-
const data = { needsCleaning: "Yes", needsRepairs: "Yes" };
|
|
64
|
-
const query ={
|
|
65
|
-
id: instanceId ,
|
|
66
|
-
"items.elementId": 'task_Buy'
|
|
67
|
-
};
|
|
68
|
-
// console.log(query);
|
|
69
|
-
response= await server.engine.invoke(query ,data );
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
When('engine get', async () => {
|
|
73
|
-
const query = {id: instanceId };
|
|
74
|
-
|
|
75
|
-
response = await server.engine.get(query);
|
|
76
|
-
|
|
77
|
-
expect(response.id).equals(instanceId);
|
|
78
|
-
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
Then('check for output to have engine', () => {
|
|
83
|
-
expect(getItem('task_Buy').status).equals('end');
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
and('Clean it', async () => {
|
|
87
|
-
|
|
88
|
-
const query = {
|
|
89
|
-
"data.caseId": caseId ,
|
|
90
|
-
"items.elementId": 'task_clean'
|
|
91
|
-
};
|
|
92
|
-
// console.log(query);
|
|
93
|
-
await server.engine.invoke(query, {});
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
and('Repair it', async () => {
|
|
97
|
-
const query = { id: instanceId ,"items.elementId": 'task_repair'};
|
|
98
|
-
response = await server.engine.invoke(query, {});
|
|
99
|
-
});
|
|
100
|
-
and('Drive it 1', async () => {
|
|
101
|
-
const query = {
|
|
102
|
-
id: instanceId ,
|
|
103
|
-
"items.elementId": 'task_Drive'};
|
|
104
|
-
response=await server.engine.invoke(query, {});
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
and('Case Complete', async () => {
|
|
108
|
-
|
|
109
|
-
// console.log(response.instance.status);
|
|
110
|
-
// console.log(response.execution.status);
|
|
111
|
-
expect(response.status).equals('end');
|
|
112
|
-
expect(getItem('task_Drive').status).equals('end');
|
|
113
|
-
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
function getItem(id)
|
|
121
|
-
{
|
|
122
|
-
return response.items.filter(item => { return item.elementId == id; })[0];
|
|
123
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
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('-------- carServer.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 },null, 'remoteUser1');
|
|
29
|
-
instanceId = response.id;
|
|
30
|
-
|
|
31
|
-
//console.log('**instanceId', response.id, instanceId);
|
|
32
|
-
//console.log(' after start ', response.data.caseId);
|
|
33
|
-
});
|
|
34
|
-
Then('check for output', () => {
|
|
35
|
-
expect(response.data.caseId).equals(caseId);
|
|
36
|
-
expect(getItem('task_Buy').status).equals('wait');
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
When('a process defintion is executed', async () => {
|
|
40
|
-
|
|
41
|
-
const data = { needsCleaning: "Yes", needsRepairs: "Yes" };
|
|
42
|
-
const query = {
|
|
43
|
-
id: instanceId,
|
|
44
|
-
"items.elementId": 'task_Buy'
|
|
45
|
-
};
|
|
46
|
-
console.log(query);
|
|
47
|
-
response = await server.engine.invoke(query, data,'RemoteUser2');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
When('engine get', async () => {
|
|
51
|
-
const query = { id: instanceId };
|
|
52
|
-
|
|
53
|
-
response = await server.engine.get(query);
|
|
54
|
-
|
|
55
|
-
expect(response.id).equals(instanceId);
|
|
56
|
-
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
Then('check for output to have engine', () => {
|
|
61
|
-
expect(getItem('task_Buy').status).equals('end');
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
and('Clean it', async () => {
|
|
65
|
-
|
|
66
|
-
const query = {
|
|
67
|
-
"data.caseId": caseId,
|
|
68
|
-
"items.elementId": 'task_clean'
|
|
69
|
-
};
|
|
70
|
-
console.log(query);
|
|
71
|
-
await server.engine.invoke(query, {},'remoteUser3');
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
and('Repair it', async () => {
|
|
75
|
-
const query = { id: instanceId, "items.elementId": 'task_repair' };
|
|
76
|
-
response = await server.engine.invoke(query, {});
|
|
77
|
-
});
|
|
78
|
-
and('Drive it 1', async () => {
|
|
79
|
-
const query = {
|
|
80
|
-
id: instanceId,
|
|
81
|
-
"items.elementId": 'task_Drive'
|
|
82
|
-
};
|
|
83
|
-
response = await server.engine.invoke(query, {},'remote_user4');
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
and('Case Complete', async () => {
|
|
87
|
-
|
|
88
|
-
console.log(response.status);
|
|
89
|
-
expect(getItem('task_Drive').status).equals('end');
|
|
90
|
-
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
and('find engine status', async () => {
|
|
94
|
-
|
|
95
|
-
var insts = await server.engine.status();
|
|
96
|
-
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
//
|
|
100
|
-
and('find instances', async () => {
|
|
101
|
-
|
|
102
|
-
var insts = await server.datastore.findInstances({ id: response.id });
|
|
103
|
-
expect(insts).to.have.lengthOf(1);
|
|
104
|
-
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
and('find items', async () => {
|
|
108
|
-
|
|
109
|
-
var items = await server.datastore.findItems({ id: response.id } );
|
|
110
|
-
expect(items).to.have.lengthOf(17);
|
|
111
|
-
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
function getItem(id) {
|
|
122
|
-
return response.items.filter(item => { return item.elementId == id; })[0];
|
|
123
|
-
}
|
package/test/helpers/setup.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/test-raw.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
console.log("Testing BPMNClient raw");
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
raw1();
|
|
5
|
-
|
|
6
|
-
async function raw1() {
|
|
7
|
-
var axios = require('axios');
|
|
8
|
-
var data = JSON.stringify({ "items.status": "end", "items.elementId": "script_task" });
|
|
9
|
-
|
|
10
|
-
var config = {
|
|
11
|
-
method: 'get',
|
|
12
|
-
url: 'http://localhost:3000/api/datastore/findItems',
|
|
13
|
-
headers: {
|
|
14
|
-
'x-api-key': '12345',
|
|
15
|
-
'Content-Type': 'application/json',
|
|
16
|
-
// 'Cookie': 'connect.sid=s%3AFJpzbs-nlVsxrhROzC_e0joMyopi6ke0.uoCjT87OZa3SOJosZxXCrC7zriAIVdMmtwcKsrY2C4I'
|
|
17
|
-
},
|
|
18
|
-
data: data
|
|
19
|
-
};
|
|
20
|
-
var response = await axios(config);
|
|
21
|
-
console.log(response.data);
|
|
22
|
-
/*
|
|
23
|
-
axios(config)
|
|
24
|
-
.then(function (response) {
|
|
25
|
-
console.log('then',JSON.stringify(response.data));
|
|
26
|
-
})
|
|
27
|
-
.catch(function (error) {
|
|
28
|
-
console.log('error',error);
|
|
29
|
-
});
|
|
30
|
-
*/
|
|
31
|
-
}
|
|
32
|
-
async function raw() {
|
|
33
|
-
console.log('raw');
|
|
34
|
-
var https = require('follow-redirects').http;
|
|
35
|
-
var fs = require('fs');
|
|
36
|
-
|
|
37
|
-
var options = {
|
|
38
|
-
'method': 'GET',
|
|
39
|
-
'hostname': 'localhost',
|
|
40
|
-
'port': 3000,
|
|
41
|
-
'path': '/api/datastore/findItems',
|
|
42
|
-
'headers': {
|
|
43
|
-
'x-api-key': '12345',
|
|
44
|
-
'Content-Type': 'application/json',
|
|
45
|
-
'Cookie': 'connect.sid=s%3AFJpzbs-nlVsxrhROzC_e0joMyopi6ke0.uoCjT87OZa3SOJosZxXCrC7zriAIVdMmtwcKsrY2C4I'
|
|
46
|
-
},
|
|
47
|
-
'maxRedirects': 20
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
var req = https.request(options, function (res) {
|
|
51
|
-
var chunks = [];
|
|
52
|
-
|
|
53
|
-
res.on("data", function (chunk) {
|
|
54
|
-
console.log('data', chunk);
|
|
55
|
-
chunks.push(chunk);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
res.on("end", function (chunk) {
|
|
59
|
-
var body = Buffer.concat(chunks);
|
|
60
|
-
console.log('end',body.toString());
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
res.on("error", function (error) {
|
|
64
|
-
console.error(error);
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
var postData = JSON.stringify({ "items.status": "end", "items.elementId": "script_task" });
|
|
69
|
-
|
|
70
|
-
req.write(postData);
|
|
71
|
-
|
|
72
|
-
req.end();
|
|
73
|
-
}
|
package/test.env
DELETED