bpmn-client 1.3.17 → 1.3.26
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 +2 -2
- package/Sample/package.json +1 -1
- package/cli.js +242 -243
- package/index.js +17 -13
- package/monitor.js +91 -91
- package/package.json +2 -2
- package/remote-import.js +133 -105
- package/remote-import.ts +39 -4
- package/src/BPMNClient.js +262 -358
- package/src/BPMNClient.ts +23 -144
- package/src/WebService.js +82 -0
- package/src/WebService.ts +91 -0
- package/src/index.js +19 -15
- package/src/interfaces/DataObjects.js +2 -2
- package/src/interfaces/DataObjects.ts +2 -0
- package/src/interfaces/Enums.js +112 -120
- package/test-raw.js +74 -74
- package/test.js +257 -190
- package/test.ts +92 -3
- package/test3.js +42 -42
package/monitor.js
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const _1 = require("./");
|
|
13
|
-
console.log("Testing BPMNClient");
|
|
14
|
-
const dotenv = require('dotenv');
|
|
15
|
-
const res = dotenv.config();
|
|
16
|
-
console.log(res);
|
|
17
|
-
monitor();
|
|
18
|
-
function monitor() {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const server = new _1.BPMNClient(process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
21
|
-
console.log('running monitor');
|
|
22
|
-
for (var i = 0; i < 1000; i++) {
|
|
23
|
-
yield checkStatus(server);
|
|
24
|
-
yield delay(15000, 'test');
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
function checkStatus(server, reason = '') {
|
|
29
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
var list = yield server.engine.status();
|
|
31
|
-
var insT = 0, insR = 0, itmT = 0, itmR = 0, tokT = 0, tokR = 0;
|
|
32
|
-
for (var i = 0; i < list.length; i++) {
|
|
33
|
-
var exec = list[i];
|
|
34
|
-
var dInstance = null;
|
|
35
|
-
insT++;
|
|
36
|
-
tokT += exec.instance.tokens.length;
|
|
37
|
-
if (exec.instance.status == 'running')
|
|
38
|
-
insR++;
|
|
39
|
-
var started = dateDiff(exec.instance.startedAt);
|
|
40
|
-
var ended = dateDiff(exec.instance.endedAt);
|
|
41
|
-
var msg = ` Instance for '${exec.instance.name}' Status: ${exec.status} Started At ${started} Ended ${ended} items: ${exec.instance.items.length}`;
|
|
42
|
-
try {
|
|
43
|
-
dInstance = yield server.datastore.findInstances({ id: exec.instance.id }, {});
|
|
44
|
-
//console.log(reason+' logs:',exec.instance.logs.length, dInstance.logs.length,dInstance.data.caseId);
|
|
45
|
-
if (dInstance.length > 0)
|
|
46
|
-
msg += ' items:' + dInstance[0].items.length;
|
|
47
|
-
}
|
|
48
|
-
catch (exc) {
|
|
49
|
-
msg += ' no instance' + exc.toString();
|
|
50
|
-
}
|
|
51
|
-
console.log(msg);
|
|
52
|
-
}
|
|
53
|
-
console.log(`${reason} ->Instances: Total: ${insT} Running: ${insR}`); // Tokens: ${tokT} `);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
function delay(time, result) {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
return new Promise(function (resolve) {
|
|
59
|
-
setTimeout(function () {
|
|
60
|
-
resolve(result);
|
|
61
|
-
}, time);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
function dateDiff(dateStr) {
|
|
66
|
-
var endDate = new Date();
|
|
67
|
-
var startTime = new Date(dateStr);
|
|
68
|
-
var time1 = endDate.getTime();
|
|
69
|
-
var time2 = startTime;
|
|
70
|
-
var seconds = Math.abs(time1 - time2) / 1000;
|
|
71
|
-
// get total seconds between the times
|
|
72
|
-
var delta = seconds; //Math.abs(date_future - date_now) / 1000;
|
|
73
|
-
// calculate (and subtract) whole days
|
|
74
|
-
var days = Math.floor(delta / 86400);
|
|
75
|
-
delta -= days * 86400;
|
|
76
|
-
// calculate (and subtract) whole hours
|
|
77
|
-
var hours = Math.floor(delta / 3600) % 24;
|
|
78
|
-
delta -= hours * 3600;
|
|
79
|
-
// calculate (and subtract) whole minutes
|
|
80
|
-
var minutes = Math.floor(delta / 60) % 60;
|
|
81
|
-
delta -= minutes * 60;
|
|
82
|
-
// what's left is seconds
|
|
83
|
-
var seconds = Math.floor(delta % 60); // in theory the modulus is not required
|
|
84
|
-
if (days > 0)
|
|
85
|
-
return (days + " days");
|
|
86
|
-
if (hours > 0)
|
|
87
|
-
return (hours + " hours");
|
|
88
|
-
if (minutes > 0)
|
|
89
|
-
return (minutes + " minutes");
|
|
90
|
-
return (seconds + " seconds");
|
|
91
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const _1 = require("./");
|
|
13
|
+
console.log("Testing BPMNClient");
|
|
14
|
+
const dotenv = require('dotenv');
|
|
15
|
+
const res = dotenv.config();
|
|
16
|
+
console.log(res);
|
|
17
|
+
monitor();
|
|
18
|
+
function monitor() {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const server = new _1.BPMNClient(process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
21
|
+
console.log('running monitor');
|
|
22
|
+
for (var i = 0; i < 1000; i++) {
|
|
23
|
+
yield checkStatus(server);
|
|
24
|
+
yield delay(15000, 'test');
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function checkStatus(server, reason = '') {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
var list = yield server.engine.status();
|
|
31
|
+
var insT = 0, insR = 0, itmT = 0, itmR = 0, tokT = 0, tokR = 0;
|
|
32
|
+
for (var i = 0; i < list.length; i++) {
|
|
33
|
+
var exec = list[i];
|
|
34
|
+
var dInstance = null;
|
|
35
|
+
insT++;
|
|
36
|
+
tokT += exec.instance.tokens.length;
|
|
37
|
+
if (exec.instance.status == 'running')
|
|
38
|
+
insR++;
|
|
39
|
+
var started = dateDiff(exec.instance.startedAt);
|
|
40
|
+
var ended = dateDiff(exec.instance.endedAt);
|
|
41
|
+
var msg = ` Instance for '${exec.instance.name}' Status: ${exec.status} Started At ${started} Ended ${ended} items: ${exec.instance.items.length}`;
|
|
42
|
+
try {
|
|
43
|
+
dInstance = yield server.datastore.findInstances({ id: exec.instance.id }, {});
|
|
44
|
+
//console.log(reason+' logs:',exec.instance.logs.length, dInstance.logs.length,dInstance.data.caseId);
|
|
45
|
+
if (dInstance.length > 0)
|
|
46
|
+
msg += ' items:' + dInstance[0].items.length;
|
|
47
|
+
}
|
|
48
|
+
catch (exc) {
|
|
49
|
+
msg += ' no instance' + exc.toString();
|
|
50
|
+
}
|
|
51
|
+
console.log(msg);
|
|
52
|
+
}
|
|
53
|
+
console.log(`${reason} ->Instances: Total: ${insT} Running: ${insR}`); // Tokens: ${tokT} `);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function delay(time, result) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return new Promise(function (resolve) {
|
|
59
|
+
setTimeout(function () {
|
|
60
|
+
resolve(result);
|
|
61
|
+
}, time);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function dateDiff(dateStr) {
|
|
66
|
+
var endDate = new Date();
|
|
67
|
+
var startTime = new Date(dateStr);
|
|
68
|
+
var time1 = endDate.getTime();
|
|
69
|
+
var time2 = startTime;
|
|
70
|
+
var seconds = Math.abs(time1 - time2) / 1000;
|
|
71
|
+
// get total seconds between the times
|
|
72
|
+
var delta = seconds; //Math.abs(date_future - date_now) / 1000;
|
|
73
|
+
// calculate (and subtract) whole days
|
|
74
|
+
var days = Math.floor(delta / 86400);
|
|
75
|
+
delta -= days * 86400;
|
|
76
|
+
// calculate (and subtract) whole hours
|
|
77
|
+
var hours = Math.floor(delta / 3600) % 24;
|
|
78
|
+
delta -= hours * 3600;
|
|
79
|
+
// calculate (and subtract) whole minutes
|
|
80
|
+
var minutes = Math.floor(delta / 60) % 60;
|
|
81
|
+
delta -= minutes * 60;
|
|
82
|
+
// what's left is seconds
|
|
83
|
+
var seconds = Math.floor(delta % 60); // in theory the modulus is not required
|
|
84
|
+
if (days > 0)
|
|
85
|
+
return (days + " days");
|
|
86
|
+
if (hours > 0)
|
|
87
|
+
return (hours + " hours");
|
|
88
|
+
if (minutes > 0)
|
|
89
|
+
return (minutes + " minutes");
|
|
90
|
+
return (seconds + " seconds");
|
|
91
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpmn-client",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.26",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc --build",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/mime": "^1.3.1",
|
|
36
|
-
"@types/node": "^
|
|
36
|
+
"@types/node": "^12.12.7",
|
|
37
37
|
"@types/serve-static": "^1.7.32",
|
|
38
38
|
"nodemon": "^2.0.19",
|
|
39
39
|
"ts-node": "^8.10.2",
|
package/remote-import.js
CHANGED
|
@@ -1,105 +1,133 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
//FromPostMan();
|
|
13
|
-
//request('test4', 'Trans.bpmn');
|
|
14
|
-
const _1 = require("./");
|
|
15
|
-
console.log('remote-import.ts');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
'
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var
|
|
50
|
-
res
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
'
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
//FromPostMan();
|
|
13
|
+
//request('test4', 'Trans.bpmn');
|
|
14
|
+
const _1 = require("./");
|
|
15
|
+
console.log('remote-import.ts');
|
|
16
|
+
//badImport();
|
|
17
|
+
fromClientLib();
|
|
18
|
+
console.log('-------------------');
|
|
19
|
+
//FromPostMan();
|
|
20
|
+
/*
|
|
21
|
+
process.on('uncaughtException', function (err) {
|
|
22
|
+
console.log('*******************Client ERROR***********');
|
|
23
|
+
console.error(err.stack);
|
|
24
|
+
throw err;
|
|
25
|
+
});
|
|
26
|
+
*/
|
|
27
|
+
function badImport() {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const path = require('path');
|
|
30
|
+
try {
|
|
31
|
+
const bpmnServer = new _1.BPMNClient('127.0.0.1', 3000, 12345);
|
|
32
|
+
const importResult = yield bpmnServer.definitions.import('dummyTest', path.resolve('test.js'));
|
|
33
|
+
console.log('badImport done');
|
|
34
|
+
return 'done';
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
console.log('badImport Error', err);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function fromClientLib() {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
console.log('from client lib');
|
|
44
|
+
try {
|
|
45
|
+
const server = new _1.BPMNClient('localhost', 3000, '12345');
|
|
46
|
+
var name = 'test-import';
|
|
47
|
+
var file = '..\\WebApp\\processes\\Trans.bpmn';
|
|
48
|
+
var file2 = '..\\WebApp\\processes\\Trans.svg';
|
|
49
|
+
var res = yield server.definitions.import(name, file, file2);
|
|
50
|
+
return res;
|
|
51
|
+
}
|
|
52
|
+
catch (exc) {
|
|
53
|
+
console.log('*******ERROR********');
|
|
54
|
+
console.log(exc);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function FromPostMan() {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
console.log("Testing Remote import");
|
|
61
|
+
var file = 'E:\\x4\\dev\\webApp\\processes\\Trans.bpmn';
|
|
62
|
+
var http = require('follow-redirects').http;
|
|
63
|
+
//const http = require('http');
|
|
64
|
+
var fs = require('fs');
|
|
65
|
+
var options = {
|
|
66
|
+
'method': 'POST',
|
|
67
|
+
'hostname': 'localhost',
|
|
68
|
+
'port': 3000,
|
|
69
|
+
'path': '/api/definitions/import/testing4',
|
|
70
|
+
'headers': {
|
|
71
|
+
'x-api-key': '12345',
|
|
72
|
+
'Cookie': 'connect.sid=s%3AXMa01DuOlQ4WsrvBj0FVaIrTak49vLPB.hDIV9j7ONA437rZf%2F%2Biu%2Bc6B7T5%2FVuEIjj1BAaoCJW4'
|
|
73
|
+
},
|
|
74
|
+
'maxRedirects': 20
|
|
75
|
+
};
|
|
76
|
+
var req = http.request(options, function (res) {
|
|
77
|
+
var chunks = [];
|
|
78
|
+
res.on("data", function (chunk) {
|
|
79
|
+
chunks.push(chunk);
|
|
80
|
+
});
|
|
81
|
+
res.on("end", function (chunk) {
|
|
82
|
+
var body = Buffer.concat(chunks);
|
|
83
|
+
console.log(body.toString());
|
|
84
|
+
});
|
|
85
|
+
res.on("error", function (error) {
|
|
86
|
+
console.error(error);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
var postData = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"; filename=\"Trans.bpmn\"\r\nContent-Type: \"text/plain\"\r\n\r\n" + fs.readFileSync(file) + "\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--";
|
|
90
|
+
req.setHeader('content-type', 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
|
|
91
|
+
req.write(postData);
|
|
92
|
+
req.end();
|
|
93
|
+
return req;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function request(name, path) {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
console.log("Testing Request");
|
|
99
|
+
var http = require('http');
|
|
100
|
+
var fs = require('fs');
|
|
101
|
+
var options = {
|
|
102
|
+
'method': 'POST',
|
|
103
|
+
'hostname': 'localhost',
|
|
104
|
+
'port': 3000,
|
|
105
|
+
'path': '/api/definitions/import/' + name,
|
|
106
|
+
'headers': {
|
|
107
|
+
'x-api-key': '12345',
|
|
108
|
+
'Cookie': 'connect.sid=s%3AXMa01DuOlQ4WsrvBj0FVaIrTak49vLPB.hDIV9j7ONA437rZf%2F%2Biu%2Bc6B7T5%2FVuEIjj1BAaoCJW4'
|
|
109
|
+
},
|
|
110
|
+
'maxRedirects': 20
|
|
111
|
+
};
|
|
112
|
+
var req = http.request(options, function (res) {
|
|
113
|
+
var chunks = [];
|
|
114
|
+
res.on("data", function (chunk) {
|
|
115
|
+
chunks.push(chunk);
|
|
116
|
+
});
|
|
117
|
+
res.on("end", function (chunk) {
|
|
118
|
+
var body = Buffer.concat(chunks);
|
|
119
|
+
console.log(body.toString());
|
|
120
|
+
});
|
|
121
|
+
res.on("error", function (error) {
|
|
122
|
+
console.error(error);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
var postData = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"; filename=\""
|
|
126
|
+
+ path + "\"\r\nContent-Type: \"text/plain\"\r\n\r\n" +
|
|
127
|
+
fs.readFileSync(path) + "\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--";
|
|
128
|
+
req.setHeader('content-type', 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
|
|
129
|
+
req.write(postData);
|
|
130
|
+
req.end();
|
|
131
|
+
console.log('end');
|
|
132
|
+
});
|
|
133
|
+
}
|
package/remote-import.ts
CHANGED
|
@@ -6,22 +6,57 @@ import { BPMNClient } from './';
|
|
|
6
6
|
|
|
7
7
|
console.log('remote-import.ts');
|
|
8
8
|
|
|
9
|
+
//badImport();
|
|
9
10
|
fromClientLib();
|
|
10
11
|
|
|
11
12
|
console.log('-------------------');
|
|
12
13
|
//FromPostMan();
|
|
13
|
-
|
|
14
|
+
/*
|
|
15
|
+
process.on('uncaughtException', function (err) {
|
|
16
|
+
console.log('*******************Client ERROR***********');
|
|
17
|
+
console.error(err.stack);
|
|
18
|
+
throw err;
|
|
19
|
+
});
|
|
20
|
+
*/
|
|
21
|
+
async function badImport()
|
|
22
|
+
{
|
|
23
|
+
const path = require('path');
|
|
24
|
+
|
|
25
|
+
try{
|
|
26
|
+
const bpmnServer = new BPMNClient(
|
|
27
|
+
'127.0.0.1',
|
|
28
|
+
3000,
|
|
29
|
+
12345,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const importResult = await bpmnServer.definitions.import(
|
|
33
|
+
'dummyTest',
|
|
34
|
+
path.resolve('test.js'),
|
|
35
|
+
);
|
|
36
|
+
console.log('badImport done');
|
|
37
|
+
return 'done';
|
|
38
|
+
} catch(err){
|
|
39
|
+
console.log('badImport Error',err);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
14
42
|
async function fromClientLib() {
|
|
15
43
|
|
|
16
44
|
console.log('from client lib');
|
|
45
|
+
try {
|
|
17
46
|
const server = new BPMNClient('localhost', 3000, '12345');
|
|
18
47
|
|
|
19
48
|
var name = 'test-import';
|
|
20
|
-
var file = '
|
|
49
|
+
var file = '..\\WebApp\\processes\\Trans.bpmn';
|
|
50
|
+
var file2 = '..\\WebApp\\processes\\Trans.svg';
|
|
21
51
|
|
|
22
|
-
var res=await server.definitions.import(name, file);
|
|
23
|
-
//console.log(res.length);
|
|
52
|
+
var res=await server.definitions.import(name, file,file2);
|
|
24
53
|
return res;
|
|
54
|
+
}
|
|
55
|
+
catch(exc)
|
|
56
|
+
{
|
|
57
|
+
console.log('*******ERROR********');
|
|
58
|
+
console.log(exc);
|
|
59
|
+
}
|
|
25
60
|
}
|
|
26
61
|
async function FromPostMan() {
|
|
27
62
|
|