bpmn-client 1.6.0 → 2.1.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/README.md +3 -0
- package/bin/cli.js +245 -245
- package/bin/setup.js +24 -24
- package/dist/BPMNClient.js +295 -273
- package/dist/BPMNClient2.js +252 -0
- package/dist/WebService.js +82 -82
- package/dist/cli.js +281 -245
- package/dist/index.js +16 -19
- package/dist/interfaces/API.js +2 -2
- package/dist/interfaces/DataObjects.js +2 -2
- package/dist/interfaces/Enums.js +124 -112
- package/dist/monitor.js +91 -91
- package/dist/remote-import.js +137 -137
- package/dist/setup.js +22 -22
- package/dist/test-raw.js +73 -74
- package/dist/test.js +75 -75
- package/dist/test2.js +78 -0
- package/dist/test3.js +42 -42
- package/package.json +1 -1
package/dist/remote-import.js
CHANGED
|
@@ -1,137 +1,137 @@
|
|
|
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 BPMNClient('localhost', 3000, '12345');
|
|
46
|
-
const dotenv = require('dotenv');
|
|
47
|
-
dotenv.config();
|
|
48
|
-
console.log('env:', process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
49
|
-
const server = new _1.BPMNClient(process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
50
|
-
var name = 'test-import';
|
|
51
|
-
var file = '..\\WebApp\\processes\\Trans.bpmn';
|
|
52
|
-
var file2 = '..\\WebApp\\processes\\Trans.svg';
|
|
53
|
-
var res = yield server.definitions.import(name, file, file2);
|
|
54
|
-
return res;
|
|
55
|
-
}
|
|
56
|
-
catch (exc) {
|
|
57
|
-
console.log('*******ERROR********');
|
|
58
|
-
console.log(exc);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
function FromPostMan() {
|
|
63
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
console.log("Testing Remote import");
|
|
65
|
-
var file = 'E:\\x4\\dev\\webApp\\processes\\Trans.bpmn';
|
|
66
|
-
var http = require('follow-redirects').http;
|
|
67
|
-
//const http = require('http');
|
|
68
|
-
var fs = require('fs');
|
|
69
|
-
var options = {
|
|
70
|
-
'method': 'POST',
|
|
71
|
-
'hostname': 'localhost',
|
|
72
|
-
'port': 3000,
|
|
73
|
-
'path': '/api/definitions/import/testing4',
|
|
74
|
-
'headers': {
|
|
75
|
-
'x-api-key': '12345',
|
|
76
|
-
'Cookie': 'connect.sid=s%3AXMa01DuOlQ4WsrvBj0FVaIrTak49vLPB.hDIV9j7ONA437rZf%2F%2Biu%2Bc6B7T5%2FVuEIjj1BAaoCJW4'
|
|
77
|
-
},
|
|
78
|
-
'maxRedirects': 20
|
|
79
|
-
};
|
|
80
|
-
var req = http.request(options, function (res) {
|
|
81
|
-
var chunks = [];
|
|
82
|
-
res.on("data", function (chunk) {
|
|
83
|
-
chunks.push(chunk);
|
|
84
|
-
});
|
|
85
|
-
res.on("end", function (chunk) {
|
|
86
|
-
var body = Buffer.concat(chunks);
|
|
87
|
-
console.log(body.toString());
|
|
88
|
-
});
|
|
89
|
-
res.on("error", function (error) {
|
|
90
|
-
console.error(error);
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
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--";
|
|
94
|
-
req.setHeader('content-type', 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
|
|
95
|
-
req.write(postData);
|
|
96
|
-
req.end();
|
|
97
|
-
return req;
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
function request(name, path) {
|
|
101
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
-
console.log("Testing Request");
|
|
103
|
-
var http = require('http');
|
|
104
|
-
var fs = require('fs');
|
|
105
|
-
var options = {
|
|
106
|
-
'method': 'POST',
|
|
107
|
-
'hostname': 'localhost',
|
|
108
|
-
'port': 3000,
|
|
109
|
-
'path': '/api/definitions/import/' + name,
|
|
110
|
-
'headers': {
|
|
111
|
-
'x-api-key': '12345',
|
|
112
|
-
'Cookie': 'connect.sid=s%3AXMa01DuOlQ4WsrvBj0FVaIrTak49vLPB.hDIV9j7ONA437rZf%2F%2Biu%2Bc6B7T5%2FVuEIjj1BAaoCJW4'
|
|
113
|
-
},
|
|
114
|
-
'maxRedirects': 20
|
|
115
|
-
};
|
|
116
|
-
var req = http.request(options, function (res) {
|
|
117
|
-
var chunks = [];
|
|
118
|
-
res.on("data", function (chunk) {
|
|
119
|
-
chunks.push(chunk);
|
|
120
|
-
});
|
|
121
|
-
res.on("end", function (chunk) {
|
|
122
|
-
var body = Buffer.concat(chunks);
|
|
123
|
-
console.log(body.toString());
|
|
124
|
-
});
|
|
125
|
-
res.on("error", function (error) {
|
|
126
|
-
console.error(error);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
var postData = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"; filename=\""
|
|
130
|
-
+ path + "\"\r\nContent-Type: \"text/plain\"\r\n\r\n" +
|
|
131
|
-
fs.readFileSync(path) + "\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--";
|
|
132
|
-
req.setHeader('content-type', 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
|
|
133
|
-
req.write(postData);
|
|
134
|
-
req.end();
|
|
135
|
-
console.log('end');
|
|
136
|
-
});
|
|
137
|
-
}
|
|
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 BPMNClient('localhost', 3000, '12345');
|
|
46
|
+
const dotenv = require('dotenv');
|
|
47
|
+
dotenv.config();
|
|
48
|
+
console.log('env:', process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
49
|
+
const server = new _1.BPMNClient(process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
50
|
+
var name = 'test-import';
|
|
51
|
+
var file = '..\\WebApp\\processes\\Trans.bpmn';
|
|
52
|
+
var file2 = '..\\WebApp\\processes\\Trans.svg';
|
|
53
|
+
var res = yield server.definitions.import(name, file, file2);
|
|
54
|
+
return res;
|
|
55
|
+
}
|
|
56
|
+
catch (exc) {
|
|
57
|
+
console.log('*******ERROR********');
|
|
58
|
+
console.log(exc);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function FromPostMan() {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
console.log("Testing Remote import");
|
|
65
|
+
var file = 'E:\\x4\\dev\\webApp\\processes\\Trans.bpmn';
|
|
66
|
+
var http = require('follow-redirects').http;
|
|
67
|
+
//const http = require('http');
|
|
68
|
+
var fs = require('fs');
|
|
69
|
+
var options = {
|
|
70
|
+
'method': 'POST',
|
|
71
|
+
'hostname': 'localhost',
|
|
72
|
+
'port': 3000,
|
|
73
|
+
'path': '/api/definitions/import/testing4',
|
|
74
|
+
'headers': {
|
|
75
|
+
'x-api-key': '12345',
|
|
76
|
+
'Cookie': 'connect.sid=s%3AXMa01DuOlQ4WsrvBj0FVaIrTak49vLPB.hDIV9j7ONA437rZf%2F%2Biu%2Bc6B7T5%2FVuEIjj1BAaoCJW4'
|
|
77
|
+
},
|
|
78
|
+
'maxRedirects': 20
|
|
79
|
+
};
|
|
80
|
+
var req = http.request(options, function (res) {
|
|
81
|
+
var chunks = [];
|
|
82
|
+
res.on("data", function (chunk) {
|
|
83
|
+
chunks.push(chunk);
|
|
84
|
+
});
|
|
85
|
+
res.on("end", function (chunk) {
|
|
86
|
+
var body = Buffer.concat(chunks);
|
|
87
|
+
console.log(body.toString());
|
|
88
|
+
});
|
|
89
|
+
res.on("error", function (error) {
|
|
90
|
+
console.error(error);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
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--";
|
|
94
|
+
req.setHeader('content-type', 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
|
|
95
|
+
req.write(postData);
|
|
96
|
+
req.end();
|
|
97
|
+
return req;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function request(name, path) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
console.log("Testing Request");
|
|
103
|
+
var http = require('http');
|
|
104
|
+
var fs = require('fs');
|
|
105
|
+
var options = {
|
|
106
|
+
'method': 'POST',
|
|
107
|
+
'hostname': 'localhost',
|
|
108
|
+
'port': 3000,
|
|
109
|
+
'path': '/api/definitions/import/' + name,
|
|
110
|
+
'headers': {
|
|
111
|
+
'x-api-key': '12345',
|
|
112
|
+
'Cookie': 'connect.sid=s%3AXMa01DuOlQ4WsrvBj0FVaIrTak49vLPB.hDIV9j7ONA437rZf%2F%2Biu%2Bc6B7T5%2FVuEIjj1BAaoCJW4'
|
|
113
|
+
},
|
|
114
|
+
'maxRedirects': 20
|
|
115
|
+
};
|
|
116
|
+
var req = http.request(options, function (res) {
|
|
117
|
+
var chunks = [];
|
|
118
|
+
res.on("data", function (chunk) {
|
|
119
|
+
chunks.push(chunk);
|
|
120
|
+
});
|
|
121
|
+
res.on("end", function (chunk) {
|
|
122
|
+
var body = Buffer.concat(chunks);
|
|
123
|
+
console.log(body.toString());
|
|
124
|
+
});
|
|
125
|
+
res.on("error", function (error) {
|
|
126
|
+
console.error(error);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
var postData = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"; filename=\""
|
|
130
|
+
+ path + "\"\r\nContent-Type: \"text/plain\"\r\n\r\n" +
|
|
131
|
+
fs.readFileSync(path) + "\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--";
|
|
132
|
+
req.setHeader('content-type', 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
|
|
133
|
+
req.write(postData);
|
|
134
|
+
req.end();
|
|
135
|
+
console.log('end');
|
|
136
|
+
});
|
|
137
|
+
}
|
package/dist/setup.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const readline = require("readline");
|
|
3
|
-
const cl = readline.createInterface({ input: process.stdin, output: process.stdout, terminal: false });
|
|
4
|
-
const question = function (q) {
|
|
5
|
-
return new Promise((res, rej) => {
|
|
6
|
-
cl.question(q, answer => {
|
|
7
|
-
res(answer);
|
|
8
|
-
});
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
console.log('This routine will create .env file');
|
|
12
|
-
const cwd = process.cwd();
|
|
13
|
-
createEnv();
|
|
14
|
-
function createEnv() {
|
|
15
|
-
if (!fs.existsSync('.env')) {
|
|
16
|
-
fs.appendFileSync('.env', "API_KEY = 12345 \nHOST = localhost\nPORT = 3000\nBASE_URL = api");
|
|
17
|
-
console.log(`file ".env" created.`);
|
|
18
|
-
}
|
|
19
|
-
else
|
|
20
|
-
console.log('.env file already exists.');
|
|
21
|
-
process.exit();
|
|
22
|
-
}
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const readline = require("readline");
|
|
3
|
+
const cl = readline.createInterface({ input: process.stdin, output: process.stdout, terminal: false });
|
|
4
|
+
const question = function (q) {
|
|
5
|
+
return new Promise((res, rej) => {
|
|
6
|
+
cl.question(q, answer => {
|
|
7
|
+
res(answer);
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
console.log('This routine will create .env file');
|
|
12
|
+
const cwd = process.cwd();
|
|
13
|
+
createEnv();
|
|
14
|
+
function createEnv() {
|
|
15
|
+
if (!fs.existsSync('.env')) {
|
|
16
|
+
fs.appendFileSync('.env', "API_KEY = 12345 \nHOST = localhost\nPORT = 3000\nBASE_URL = api");
|
|
17
|
+
console.log(`file ".env" created.`);
|
|
18
|
+
}
|
|
19
|
+
else
|
|
20
|
+
console.log('.env file already exists.');
|
|
21
|
+
process.exit();
|
|
22
|
+
}
|
package/dist/test-raw.js
CHANGED
|
@@ -1,74 +1,73 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
console.log("Testing BPMNClient raw");
|
|
11
|
-
raw1();
|
|
12
|
-
function raw1() {
|
|
13
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
-
var axios = require('axios');
|
|
15
|
-
var data = JSON.stringify({ "items.status": "end", "items.elementId": "script_task" });
|
|
16
|
-
var config = {
|
|
17
|
-
method: 'get',
|
|
18
|
-
url: 'http://localhost:3000/api/datastore/findItems',
|
|
19
|
-
headers: {
|
|
20
|
-
'x-api-key': '12345',
|
|
21
|
-
'Content-Type': 'application/json',
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
'
|
|
49
|
-
|
|
50
|
-
'
|
|
51
|
-
'
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
req.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
console.log("Testing BPMNClient raw");
|
|
11
|
+
raw1();
|
|
12
|
+
function raw1() {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
var axios = require('axios');
|
|
15
|
+
var data = JSON.stringify({ "items.status": "end", "items.elementId": "script_task" });
|
|
16
|
+
var config = {
|
|
17
|
+
method: 'get',
|
|
18
|
+
url: 'http://localhost:3000/api/datastore/findItems',
|
|
19
|
+
headers: {
|
|
20
|
+
'x-api-key': '12345',
|
|
21
|
+
'Content-Type': 'application/json',
|
|
22
|
+
},
|
|
23
|
+
data: data
|
|
24
|
+
};
|
|
25
|
+
var response = yield axios(config);
|
|
26
|
+
console.log(response.data);
|
|
27
|
+
/*
|
|
28
|
+
axios(config)
|
|
29
|
+
.then(function (response) {
|
|
30
|
+
console.log('then',JSON.stringify(response.data));
|
|
31
|
+
})
|
|
32
|
+
.catch(function (error) {
|
|
33
|
+
console.log('error',error);
|
|
34
|
+
});
|
|
35
|
+
*/
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function raw() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
console.log('raw');
|
|
41
|
+
var https = require('follow-redirects').http;
|
|
42
|
+
var fs = require('fs');
|
|
43
|
+
var options = {
|
|
44
|
+
'method': 'GET',
|
|
45
|
+
'hostname': 'localhost',
|
|
46
|
+
'port': 3000,
|
|
47
|
+
'path': '/api/datastore/findItems',
|
|
48
|
+
'headers': {
|
|
49
|
+
'x-api-key': '12345',
|
|
50
|
+
'Content-Type': 'application/json',
|
|
51
|
+
'Cookie': 'connect.sid=s%3AFJpzbs-nlVsxrhROzC_e0joMyopi6ke0.uoCjT87OZa3SOJosZxXCrC7zriAIVdMmtwcKsrY2C4I'
|
|
52
|
+
},
|
|
53
|
+
'maxRedirects': 20
|
|
54
|
+
};
|
|
55
|
+
var req = https.request(options, function (res) {
|
|
56
|
+
var chunks = [];
|
|
57
|
+
res.on("data", function (chunk) {
|
|
58
|
+
console.log('data', chunk);
|
|
59
|
+
chunks.push(chunk);
|
|
60
|
+
});
|
|
61
|
+
res.on("end", function (chunk) {
|
|
62
|
+
var body = Buffer.concat(chunks);
|
|
63
|
+
console.log('end', body.toString());
|
|
64
|
+
});
|
|
65
|
+
res.on("error", function (error) {
|
|
66
|
+
console.error(error);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
var postData = JSON.stringify({ "items.status": "end", "items.elementId": "script_task" });
|
|
70
|
+
req.write(postData);
|
|
71
|
+
req.end();
|
|
72
|
+
});
|
|
73
|
+
}
|
package/dist/test.js
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
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
|
-
testLong();
|
|
14
|
-
function testLong() {
|
|
15
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
console.log('testlong');
|
|
17
|
-
const dotenv = require('dotenv');
|
|
18
|
-
dotenv.config();
|
|
19
|
-
console.log('env:', process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
20
|
-
var caseId = Math.floor(Math.random() * 10000);
|
|
21
|
-
let name = 'test-concurrency';
|
|
22
|
-
let response;
|
|
23
|
-
let instanceId;
|
|
24
|
-
let userId = 'user1';
|
|
25
|
-
let options = { noWait: true };
|
|
26
|
-
const server1 = new _1.BPMNClient(process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
27
|
-
response = yield server1.engine.start(name, { caseId: caseId }, null, userId);
|
|
28
|
-
console.log(response.id, response.items.length);
|
|
29
|
-
response.items.forEach(item => { console.log(item.id, item.name, item.type, item.status); });
|
|
30
|
-
response = yield server1.engine.invoke({ id: response.id, "items.elementId": 'UserLong' }, null, userId, options);
|
|
31
|
-
console.log('invoked userLong', response.items.length);
|
|
32
|
-
response = yield server1.engine.invoke({ id: response.id, "items.elementId": 'UserShort' }, null, userId, options);
|
|
33
|
-
console.log('invoked userShort', response.items.length);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function test() {
|
|
37
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
const dotenv = require('dotenv');
|
|
39
|
-
dotenv.config();
|
|
40
|
-
console.log('env:', process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
41
|
-
var caseId = Math.floor(Math.random() * 10000);
|
|
42
|
-
let name = 'Buy Used Car';
|
|
43
|
-
let response;
|
|
44
|
-
let instanceId;
|
|
45
|
-
let userId = 'user1';
|
|
46
|
-
let options = { noWait: true };
|
|
47
|
-
const server1 = new _1.BPMNClient(process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
48
|
-
const server2 = new _1.BPMNClient(process.env.HOST, 3030, process.env.API_KEY);
|
|
49
|
-
response = yield server1.engine.start(name, { caseId: caseId }, null, userId, options);
|
|
50
|
-
console.log(response.id);
|
|
51
|
-
response = yield server2.engine.invoke({ id: response.id, "items.elementId": 'task_Buy' }, null, userId, options);
|
|
52
|
-
console.log('invoked', response.id);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
function importModel() {
|
|
56
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
console.log('from client lib');
|
|
58
|
-
try {
|
|
59
|
-
// const server = new BPMNClient('localhost', 3000, '12345');
|
|
60
|
-
const dotenv = require('dotenv');
|
|
61
|
-
dotenv.config();
|
|
62
|
-
console.log('env:', process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
63
|
-
const server = new _1.BPMNClient(process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
64
|
-
var name = 'test-import';
|
|
65
|
-
var file = '..\\WebApp\\processes\\Trans.bpmn';
|
|
66
|
-
var file2 = '..\\WebApp\\processes\\Trans.svg';
|
|
67
|
-
var res = yield server.definitions.import(name, file, file2);
|
|
68
|
-
return res;
|
|
69
|
-
}
|
|
70
|
-
catch (exc) {
|
|
71
|
-
console.log('*******ERROR********');
|
|
72
|
-
console.log(exc);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}
|
|
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
|
+
testLong();
|
|
14
|
+
function testLong() {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
console.log('testlong');
|
|
17
|
+
const dotenv = require('dotenv');
|
|
18
|
+
dotenv.config();
|
|
19
|
+
console.log('env:', process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
20
|
+
var caseId = Math.floor(Math.random() * 10000);
|
|
21
|
+
let name = 'test-concurrency';
|
|
22
|
+
let response;
|
|
23
|
+
let instanceId;
|
|
24
|
+
let userId = 'user1';
|
|
25
|
+
let options = { noWait: true };
|
|
26
|
+
const server1 = new _1.BPMNClient(process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
27
|
+
response = yield server1.engine.start(name, { caseId: caseId }, null, userId);
|
|
28
|
+
console.log(response.id, response.items.length);
|
|
29
|
+
response.items.forEach(item => { console.log(item.id, item.name, item.type, item.status); });
|
|
30
|
+
response = yield server1.engine.invoke({ id: response.id, "items.elementId": 'UserLong' }, null, userId, options);
|
|
31
|
+
console.log('invoked userLong', response.items.length);
|
|
32
|
+
response = yield server1.engine.invoke({ id: response.id, "items.elementId": 'UserShort' }, null, userId, options);
|
|
33
|
+
console.log('invoked userShort', response.items.length);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function test() {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const dotenv = require('dotenv');
|
|
39
|
+
dotenv.config();
|
|
40
|
+
console.log('env:', process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
41
|
+
var caseId = Math.floor(Math.random() * 10000);
|
|
42
|
+
let name = 'Buy Used Car';
|
|
43
|
+
let response;
|
|
44
|
+
let instanceId;
|
|
45
|
+
let userId = 'user1';
|
|
46
|
+
let options = { noWait: true };
|
|
47
|
+
const server1 = new _1.BPMNClient(process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
48
|
+
const server2 = new _1.BPMNClient(process.env.HOST, 3030, process.env.API_KEY);
|
|
49
|
+
response = yield server1.engine.start(name, { caseId: caseId }, null, userId, options);
|
|
50
|
+
console.log(response.id);
|
|
51
|
+
response = yield server2.engine.invoke({ id: response.id, "items.elementId": 'task_Buy' }, null, userId, options);
|
|
52
|
+
console.log('invoked', response.id);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function importModel() {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
console.log('from client lib');
|
|
58
|
+
try {
|
|
59
|
+
// const server = new BPMNClient('localhost', 3000, '12345');
|
|
60
|
+
const dotenv = require('dotenv');
|
|
61
|
+
dotenv.config();
|
|
62
|
+
console.log('env:', process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
63
|
+
const server = new _1.BPMNClient(process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
64
|
+
var name = 'test-import';
|
|
65
|
+
var file = '..\\WebApp\\processes\\Trans.bpmn';
|
|
66
|
+
var file2 = '..\\WebApp\\processes\\Trans.svg';
|
|
67
|
+
var res = yield server.definitions.import(name, file, file2);
|
|
68
|
+
return res;
|
|
69
|
+
}
|
|
70
|
+
catch (exc) {
|
|
71
|
+
console.log('*******ERROR********');
|
|
72
|
+
console.log(exc);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|