bpmn-client 1.3.15 → 1.3.17
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/cli.js +1 -0
- package/package.json +2 -2
- package/remote-import.js +11 -3
- package/remote-import.ts +15 -5
- package/src/BPMNClient.js +34 -3
- package/src/BPMNClient.ts +43 -8
- package/test-raw.js +74 -0
- package/test-raw.ts +73 -0
- package/test.js +64 -3
- package/test.ts +72 -3
package/.env
CHANGED
package/cli.js
CHANGED
|
@@ -14,6 +14,7 @@ const _1 = require("./");
|
|
|
14
14
|
const readline = require("readline");
|
|
15
15
|
const dotenv = require('dotenv');
|
|
16
16
|
const res = dotenv.config();
|
|
17
|
+
console.log(res);
|
|
17
18
|
const server = new _1.BPMNClient(process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
18
19
|
const cl = readline.createInterface(process.stdin, process.stdout);
|
|
19
20
|
const question = function (q) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpmn-client",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.17",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc --build",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"url": "git+https:github.com/ralphhanna/bpmn-client.git"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
+
"axios": "^1.3.4",
|
|
29
30
|
"connect-busboy": "0.0.2",
|
|
30
31
|
"core-js": "^3.6.5",
|
|
31
32
|
"dotenv": "^16.0.1"
|
|
@@ -40,6 +41,5 @@
|
|
|
40
41
|
},
|
|
41
42
|
"engines": {
|
|
42
43
|
"node": ">=12.0.0"
|
|
43
|
-
|
|
44
44
|
}
|
|
45
45
|
}
|
package/remote-import.js
CHANGED
|
@@ -12,14 +12,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
//FromPostMan();
|
|
13
13
|
//request('test4', 'Trans.bpmn');
|
|
14
14
|
const _1 = require("./");
|
|
15
|
+
console.log('remote-import.ts');
|
|
15
16
|
fromClientLib();
|
|
17
|
+
console.log('-------------------');
|
|
16
18
|
//FromPostMan();
|
|
17
19
|
function fromClientLib() {
|
|
18
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
|
|
21
|
+
console.log('from client lib');
|
|
22
|
+
const server = new _1.BPMNClient('localhost', 3000, '12345');
|
|
20
23
|
var name = 'test-import';
|
|
21
24
|
var file = 'E:\\x4\\dev\\webApp\\processes\\Trans.bpmn';
|
|
22
|
-
server.definitions.import(name, file);
|
|
25
|
+
var res = yield server.definitions.import(name, file);
|
|
26
|
+
//console.log(res.length);
|
|
27
|
+
return res;
|
|
23
28
|
});
|
|
24
29
|
}
|
|
25
30
|
function FromPostMan() {
|
|
@@ -27,12 +32,13 @@ function FromPostMan() {
|
|
|
27
32
|
console.log("Testing Remote import");
|
|
28
33
|
var file = 'E:\\x4\\dev\\webApp\\processes\\Trans.bpmn';
|
|
29
34
|
var http = require('follow-redirects').http;
|
|
35
|
+
//const http = require('http');
|
|
30
36
|
var fs = require('fs');
|
|
31
37
|
var options = {
|
|
32
38
|
'method': 'POST',
|
|
33
39
|
'hostname': 'localhost',
|
|
34
40
|
'port': 3000,
|
|
35
|
-
'path': '/api/definitions/import/
|
|
41
|
+
'path': '/api/definitions/import/testing4',
|
|
36
42
|
'headers': {
|
|
37
43
|
'x-api-key': '12345',
|
|
38
44
|
'Cookie': 'connect.sid=s%3AXMa01DuOlQ4WsrvBj0FVaIrTak49vLPB.hDIV9j7ONA437rZf%2F%2Biu%2Bc6B7T5%2FVuEIjj1BAaoCJW4'
|
|
@@ -56,6 +62,7 @@ function FromPostMan() {
|
|
|
56
62
|
req.setHeader('content-type', 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
|
|
57
63
|
req.write(postData);
|
|
58
64
|
req.end();
|
|
65
|
+
return req;
|
|
59
66
|
});
|
|
60
67
|
}
|
|
61
68
|
function request(name, path) {
|
|
@@ -93,5 +100,6 @@ function request(name, path) {
|
|
|
93
100
|
req.setHeader('content-type', 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
|
|
94
101
|
req.write(postData);
|
|
95
102
|
req.end();
|
|
103
|
+
console.log('end');
|
|
96
104
|
});
|
|
97
105
|
}
|
package/remote-import.ts
CHANGED
|
@@ -4,18 +4,24 @@
|
|
|
4
4
|
import { BPMNClient } from './';
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
console.log('remote-import.ts');
|
|
7
8
|
|
|
8
9
|
fromClientLib();
|
|
10
|
+
|
|
11
|
+
console.log('-------------------');
|
|
9
12
|
//FromPostMan();
|
|
10
13
|
|
|
11
14
|
async function fromClientLib() {
|
|
12
|
-
|
|
15
|
+
|
|
16
|
+
console.log('from client lib');
|
|
17
|
+
const server = new BPMNClient('localhost', 3000, '12345');
|
|
13
18
|
|
|
14
19
|
var name = 'test-import';
|
|
15
20
|
var file = 'E:\\x4\\dev\\webApp\\processes\\Trans.bpmn';
|
|
16
21
|
|
|
17
|
-
server.definitions.import(name, file);
|
|
18
|
-
|
|
22
|
+
var res=await server.definitions.import(name, file);
|
|
23
|
+
//console.log(res.length);
|
|
24
|
+
return res;
|
|
19
25
|
}
|
|
20
26
|
async function FromPostMan() {
|
|
21
27
|
|
|
@@ -24,13 +30,15 @@ async function FromPostMan() {
|
|
|
24
30
|
|
|
25
31
|
|
|
26
32
|
var http = require('follow-redirects').http;
|
|
33
|
+
//const http = require('http');
|
|
34
|
+
|
|
27
35
|
var fs = require('fs');
|
|
28
36
|
|
|
29
37
|
var options = {
|
|
30
38
|
'method': 'POST',
|
|
31
39
|
'hostname': 'localhost',
|
|
32
40
|
'port': 3000,
|
|
33
|
-
'path': '/api/definitions/import/
|
|
41
|
+
'path': '/api/definitions/import/testing4',
|
|
34
42
|
'headers': {
|
|
35
43
|
'x-api-key': '12345',
|
|
36
44
|
'Cookie': 'connect.sid=s%3AXMa01DuOlQ4WsrvBj0FVaIrTak49vLPB.hDIV9j7ONA437rZf%2F%2Biu%2Bc6B7T5%2FVuEIjj1BAaoCJW4'
|
|
@@ -63,6 +71,8 @@ async function FromPostMan() {
|
|
|
63
71
|
|
|
64
72
|
req.end();
|
|
65
73
|
|
|
74
|
+
return req;
|
|
75
|
+
|
|
66
76
|
}
|
|
67
77
|
|
|
68
78
|
|
|
@@ -112,5 +122,5 @@ async function request(name,path) {
|
|
|
112
122
|
req.write(postData);
|
|
113
123
|
|
|
114
124
|
req.end();
|
|
115
|
-
|
|
125
|
+
console.log('end');
|
|
116
126
|
}
|
package/src/BPMNClient.js
CHANGED
|
@@ -17,10 +17,30 @@ const fs = require("fs");
|
|
|
17
17
|
class WebService {
|
|
18
18
|
constructor() { }
|
|
19
19
|
invoke(params, options, postData = null) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
var axios = require('axios');
|
|
22
|
+
var data = JSON.stringify(params);
|
|
23
|
+
var url = 'http://' + options.host + ':' + options.port + options.path;
|
|
24
|
+
if (options.port == 443)
|
|
25
|
+
url = 'https://' + options.host + options.path;
|
|
26
|
+
var config = {
|
|
27
|
+
method: options.method,
|
|
28
|
+
url: url,
|
|
29
|
+
headers: options.headers,
|
|
30
|
+
data: data
|
|
31
|
+
};
|
|
32
|
+
let self = this;
|
|
33
|
+
let response = yield axios(config);
|
|
34
|
+
self.result = response.data;
|
|
35
|
+
return response.data;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
invokeOld(params, options, postData = null) {
|
|
20
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
40
|
var driver = http;
|
|
22
41
|
var body = JSON.stringify(params);
|
|
23
|
-
|
|
42
|
+
console.log('invoke:');
|
|
43
|
+
console.log('options:', options, params);
|
|
24
44
|
if (options.port == 443)
|
|
25
45
|
driver = https;
|
|
26
46
|
let data = '';
|
|
@@ -28,16 +48,21 @@ class WebService {
|
|
|
28
48
|
return new Promise(function (resolve, reject) {
|
|
29
49
|
try {
|
|
30
50
|
var req = driver.request(options, function (res) {
|
|
31
|
-
|
|
51
|
+
console.log('STATUS: ' + res.statusCode);
|
|
32
52
|
this.response = res;
|
|
33
53
|
//console.log(res);
|
|
34
54
|
self.statusCode = res.statusCode;
|
|
35
55
|
res.setEncoding('utf8');
|
|
36
56
|
res.on('data', function (chunk) {
|
|
57
|
+
console.log('>>chunk', chunk);
|
|
37
58
|
data += chunk;
|
|
38
59
|
});
|
|
39
60
|
res.on('end', () => {
|
|
61
|
+
console.log('response end');
|
|
40
62
|
try {
|
|
63
|
+
if (data == null)
|
|
64
|
+
console.log("empty response");
|
|
65
|
+
console.log('data:', data);
|
|
41
66
|
self.result = JSON.parse(data);
|
|
42
67
|
resolve(self.result);
|
|
43
68
|
}
|
|
@@ -53,7 +78,11 @@ class WebService {
|
|
|
53
78
|
});
|
|
54
79
|
if (postData !== null)
|
|
55
80
|
req.write(postData);
|
|
81
|
+
else
|
|
82
|
+
req.write('');
|
|
83
|
+
console.log('request ending', body);
|
|
56
84
|
req.end(body);
|
|
85
|
+
console.log('request ended');
|
|
57
86
|
}
|
|
58
87
|
catch (exc) {
|
|
59
88
|
console.log(exc);
|
|
@@ -65,6 +94,7 @@ class WebService {
|
|
|
65
94
|
class BPMNClient extends WebService {
|
|
66
95
|
constructor(host, port, apiKey) {
|
|
67
96
|
super();
|
|
97
|
+
;
|
|
68
98
|
this.host = host;
|
|
69
99
|
this.port = port;
|
|
70
100
|
this.apiKey = apiKey;
|
|
@@ -99,7 +129,7 @@ class BPMNClient extends WebService {
|
|
|
99
129
|
'method': 'POST',
|
|
100
130
|
'hostname': this.host,
|
|
101
131
|
'port': this.port,
|
|
102
|
-
'path': url + '/' + fileName,
|
|
132
|
+
'path': '/api/' + url + '/' + fileName,
|
|
103
133
|
'headers': {
|
|
104
134
|
'x-api-key': this.apiKey
|
|
105
135
|
},
|
|
@@ -124,6 +154,7 @@ class BPMNClient extends WebService {
|
|
|
124
154
|
req.setHeader('content-type', 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
|
|
125
155
|
req.write(postData);
|
|
126
156
|
req.end();
|
|
157
|
+
return req;
|
|
127
158
|
});
|
|
128
159
|
}
|
|
129
160
|
request(url, method, params) {
|
package/src/BPMNClient.ts
CHANGED
|
@@ -12,13 +12,37 @@ class WebService {
|
|
|
12
12
|
response;
|
|
13
13
|
constructor() { }
|
|
14
14
|
|
|
15
|
-
async invoke(params, options,postData=null) {
|
|
15
|
+
async invoke(params, options, postData = null) {
|
|
16
|
+
|
|
17
|
+
var axios = require('axios');
|
|
18
|
+
|
|
19
|
+
var data = JSON.stringify(params);
|
|
20
|
+
var url = 'http://'+options.host+':'+options.port+options.path;
|
|
21
|
+
|
|
22
|
+
if (options.port == 443)
|
|
23
|
+
url = 'https://'+options.host+options.path;
|
|
24
|
+
|
|
25
|
+
var config = {
|
|
26
|
+
method: options.method,
|
|
27
|
+
url: url,
|
|
28
|
+
headers: options.headers,
|
|
29
|
+
data: data
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
let self = this;
|
|
33
|
+
|
|
34
|
+
let response = await axios(config);
|
|
35
|
+
self.result = response.data;
|
|
36
|
+
|
|
37
|
+
return response.data;
|
|
38
|
+
}
|
|
39
|
+
async invokeOld(params, options,postData=null) {
|
|
16
40
|
|
|
17
41
|
var driver = http;
|
|
18
42
|
|
|
19
43
|
var body = JSON.stringify(params);
|
|
20
|
-
|
|
21
|
-
|
|
44
|
+
console.log('invoke:');
|
|
45
|
+
console.log('options:',options, params);
|
|
22
46
|
if (options.port == 443)
|
|
23
47
|
driver = https;
|
|
24
48
|
|
|
@@ -28,16 +52,22 @@ class WebService {
|
|
|
28
52
|
try {
|
|
29
53
|
|
|
30
54
|
var req = driver.request(options, function (res) {
|
|
31
|
-
|
|
55
|
+
console.log('STATUS: ' + res.statusCode);
|
|
32
56
|
this.response = res;
|
|
33
57
|
//console.log(res);
|
|
34
58
|
self.statusCode = res.statusCode;
|
|
35
59
|
res.setEncoding('utf8');
|
|
36
60
|
res.on('data', function (chunk) {
|
|
61
|
+
console.log('>>chunk', chunk);
|
|
37
62
|
data += chunk;
|
|
38
63
|
});
|
|
39
64
|
res.on('end', () => {
|
|
65
|
+
console.log('response end');
|
|
40
66
|
try {
|
|
67
|
+
if (data == null)
|
|
68
|
+
console.log("empty response");
|
|
69
|
+
console.log('data:', data);
|
|
70
|
+
|
|
41
71
|
self.result = JSON.parse(data);
|
|
42
72
|
resolve(self.result);
|
|
43
73
|
}
|
|
@@ -53,10 +83,13 @@ class WebService {
|
|
|
53
83
|
console.log("Error: " + err.message);
|
|
54
84
|
reject(err);
|
|
55
85
|
});
|
|
56
|
-
if (postData !==null)
|
|
86
|
+
if (postData !== null)
|
|
57
87
|
req.write(postData);
|
|
58
|
-
|
|
88
|
+
else
|
|
89
|
+
req.write('');
|
|
90
|
+
console.log('request ending',body);
|
|
59
91
|
req.end(body);
|
|
92
|
+
console.log('request ended');
|
|
60
93
|
}
|
|
61
94
|
catch (exc) {
|
|
62
95
|
console.log(exc);
|
|
@@ -76,6 +109,7 @@ class BPMNClient extends WebService {
|
|
|
76
109
|
|
|
77
110
|
constructor(host, port, apiKey) {
|
|
78
111
|
super();
|
|
112
|
+
;
|
|
79
113
|
this.host = host;
|
|
80
114
|
this.port = port;
|
|
81
115
|
this.apiKey = apiKey;
|
|
@@ -107,7 +141,7 @@ class BPMNClient extends WebService {
|
|
|
107
141
|
'method': 'POST',
|
|
108
142
|
'hostname': this.host,
|
|
109
143
|
'port': this.port,
|
|
110
|
-
'path': url + '/' + fileName,
|
|
144
|
+
'path': '/api/'+ url + '/' + fileName,
|
|
111
145
|
'headers': {
|
|
112
146
|
'x-api-key': this.apiKey
|
|
113
147
|
},
|
|
@@ -139,6 +173,8 @@ class BPMNClient extends WebService {
|
|
|
139
173
|
req.write(postData);
|
|
140
174
|
|
|
141
175
|
req.end();
|
|
176
|
+
|
|
177
|
+
return req;
|
|
142
178
|
}
|
|
143
179
|
|
|
144
180
|
|
|
@@ -185,7 +221,6 @@ class BPMNClient extends WebService {
|
|
|
185
221
|
};
|
|
186
222
|
}
|
|
187
223
|
|
|
188
|
-
|
|
189
224
|
return await this.invoke(params, options);
|
|
190
225
|
|
|
191
226
|
}
|
package/test-raw.js
ADDED
|
@@ -0,0 +1,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
|
+
// 'Cookie': 'connect.sid=s%3AFJpzbs-nlVsxrhROzC_e0joMyopi6ke0.uoCjT87OZa3SOJosZxXCrC7zriAIVdMmtwcKsrY2C4I'
|
|
23
|
+
},
|
|
24
|
+
data: data
|
|
25
|
+
};
|
|
26
|
+
var response = yield axios(config);
|
|
27
|
+
console.log(response.data);
|
|
28
|
+
/*
|
|
29
|
+
axios(config)
|
|
30
|
+
.then(function (response) {
|
|
31
|
+
console.log('then',JSON.stringify(response.data));
|
|
32
|
+
})
|
|
33
|
+
.catch(function (error) {
|
|
34
|
+
console.log('error',error);
|
|
35
|
+
});
|
|
36
|
+
*/
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function raw() {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
console.log('raw');
|
|
42
|
+
var https = require('follow-redirects').http;
|
|
43
|
+
var fs = require('fs');
|
|
44
|
+
var options = {
|
|
45
|
+
'method': 'GET',
|
|
46
|
+
'hostname': 'localhost',
|
|
47
|
+
'port': 3000,
|
|
48
|
+
'path': '/api/datastore/findItems',
|
|
49
|
+
'headers': {
|
|
50
|
+
'x-api-key': '12345',
|
|
51
|
+
'Content-Type': 'application/json',
|
|
52
|
+
'Cookie': 'connect.sid=s%3AFJpzbs-nlVsxrhROzC_e0joMyopi6ke0.uoCjT87OZa3SOJosZxXCrC7zriAIVdMmtwcKsrY2C4I'
|
|
53
|
+
},
|
|
54
|
+
'maxRedirects': 20
|
|
55
|
+
};
|
|
56
|
+
var req = https.request(options, function (res) {
|
|
57
|
+
var chunks = [];
|
|
58
|
+
res.on("data", function (chunk) {
|
|
59
|
+
console.log('data', chunk);
|
|
60
|
+
chunks.push(chunk);
|
|
61
|
+
});
|
|
62
|
+
res.on("end", function (chunk) {
|
|
63
|
+
var body = Buffer.concat(chunks);
|
|
64
|
+
console.log('end', body.toString());
|
|
65
|
+
});
|
|
66
|
+
res.on("error", function (error) {
|
|
67
|
+
console.error(error);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
var postData = JSON.stringify({ "items.status": "end", "items.elementId": "script_task" });
|
|
71
|
+
req.write(postData);
|
|
72
|
+
req.end();
|
|
73
|
+
});
|
|
74
|
+
}
|
package/test-raw.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
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.js
CHANGED
|
@@ -10,13 +10,74 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const _1 = require("./");
|
|
13
|
+
const readline = require("readline");
|
|
14
|
+
const cl = readline.createInterface(process.stdin, process.stdout);
|
|
15
|
+
const question = function (q) {
|
|
16
|
+
return new Promise((res, rej) => {
|
|
17
|
+
cl.question(q, answer => {
|
|
18
|
+
res(answer);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
};
|
|
13
22
|
console.log("Testing BPMNClient");
|
|
14
23
|
const dotenv = require('dotenv');
|
|
15
24
|
const res = dotenv.config();
|
|
25
|
+
console.log(res.parsed.PORT);
|
|
16
26
|
const fs = require('fs');
|
|
17
|
-
|
|
27
|
+
//raw();
|
|
28
|
+
const server = new _1.BPMNClient(process.env.HOST, res.parsed.PORT, process.env.API_KEY);
|
|
29
|
+
console.log(server);
|
|
18
30
|
//testMessage();
|
|
19
|
-
testImport();
|
|
31
|
+
// testImport();
|
|
32
|
+
test1();
|
|
33
|
+
end();
|
|
34
|
+
function raw() {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
var https = require('follow-redirects').https;
|
|
37
|
+
var fs = require('fs');
|
|
38
|
+
var options = {
|
|
39
|
+
'method': 'GET',
|
|
40
|
+
'hostname': 'localhost',
|
|
41
|
+
'port': 3000,
|
|
42
|
+
'path': '/api/datastore/findItems',
|
|
43
|
+
'headers': {
|
|
44
|
+
'x-api-key': '12345',
|
|
45
|
+
'Content-Type': 'application/json',
|
|
46
|
+
'Cookie': 'connect.sid=s%3AFJpzbs-nlVsxrhROzC_e0joMyopi6ke0.uoCjT87OZa3SOJosZxXCrC7zriAIVdMmtwcKsrY2C4I'
|
|
47
|
+
},
|
|
48
|
+
'maxRedirects': 20
|
|
49
|
+
};
|
|
50
|
+
var req = https.request(options, function (res) {
|
|
51
|
+
var chunks = [];
|
|
52
|
+
res.on("data", function (chunk) {
|
|
53
|
+
chunks.push(chunk);
|
|
54
|
+
});
|
|
55
|
+
res.on("end", function (chunk) {
|
|
56
|
+
var body = Buffer.concat(chunks);
|
|
57
|
+
console.log(body.toString());
|
|
58
|
+
});
|
|
59
|
+
res.on("error", function (error) {
|
|
60
|
+
console.error(error);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
var postData = JSON.stringify({ "items.status": "end", "items.elementId": "script_task" });
|
|
64
|
+
req.write(postData);
|
|
65
|
+
req.end();
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function end() {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
yield question("continue");
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function test1() {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
var items = yield server.definitions.list();
|
|
76
|
+
items.forEach(item => {
|
|
77
|
+
// console.log('item: id==>' + item.elementId, item.type, item.name, 'status==>', item.status);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
20
81
|
function testImport() {
|
|
21
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
83
|
var file = 'test-import';
|
|
@@ -67,7 +128,7 @@ function testMessage() {
|
|
|
67
128
|
}
|
|
68
129
|
function test() {
|
|
69
130
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const server = new _1.BPMNClient(process.env.HOST,
|
|
131
|
+
const server = new _1.BPMNClient(process.env.HOST, res.parsed.PORT, process.env.API_KEY);
|
|
71
132
|
const caseId = 3040;
|
|
72
133
|
var delResp = yield server.datastore.deleteInstances({ name: 'Buy Used Car' });
|
|
73
134
|
//console.log(delResp);
|
package/test.ts
CHANGED
|
@@ -1,16 +1,85 @@
|
|
|
1
1
|
import { BPMNClient } from './';
|
|
2
2
|
|
|
3
|
+
import * as readline from 'readline';
|
|
4
|
+
const cl = readline.createInterface(process.stdin, process.stdout);
|
|
5
|
+
const question = function (q) {
|
|
6
|
+
return new Promise((res, rej) => {
|
|
7
|
+
cl.question(q, answer => {
|
|
8
|
+
res(answer);
|
|
9
|
+
})
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
|
|
3
13
|
|
|
4
14
|
console.log("Testing BPMNClient");
|
|
5
15
|
const dotenv = require('dotenv');
|
|
6
16
|
const res = dotenv.config();
|
|
17
|
+
console.log(res.parsed.PORT);
|
|
7
18
|
const fs = require('fs');
|
|
19
|
+
//raw();
|
|
8
20
|
|
|
9
|
-
const server = new BPMNClient(process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
10
21
|
|
|
22
|
+
const server = new BPMNClient(process.env.HOST, res.parsed.PORT, process.env.API_KEY);
|
|
23
|
+
console.log(server);
|
|
11
24
|
//testMessage();
|
|
12
|
-
testImport();
|
|
25
|
+
// testImport();
|
|
26
|
+
test1();
|
|
27
|
+
end();
|
|
28
|
+
|
|
29
|
+
async function raw() {
|
|
30
|
+
var https = require('follow-redirects').https;
|
|
31
|
+
var fs = require('fs');
|
|
32
|
+
|
|
33
|
+
var options = {
|
|
34
|
+
'method': 'GET',
|
|
35
|
+
'hostname': 'localhost',
|
|
36
|
+
'port': 3000,
|
|
37
|
+
'path': '/api/datastore/findItems',
|
|
38
|
+
'headers': {
|
|
39
|
+
'x-api-key': '12345',
|
|
40
|
+
'Content-Type': 'application/json',
|
|
41
|
+
'Cookie': 'connect.sid=s%3AFJpzbs-nlVsxrhROzC_e0joMyopi6ke0.uoCjT87OZa3SOJosZxXCrC7zriAIVdMmtwcKsrY2C4I'
|
|
42
|
+
},
|
|
43
|
+
'maxRedirects': 20
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
var req = https.request(options, function (res) {
|
|
47
|
+
var chunks = [];
|
|
48
|
+
|
|
49
|
+
res.on("data", function (chunk) {
|
|
50
|
+
chunks.push(chunk);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
res.on("end", function (chunk) {
|
|
54
|
+
var body = Buffer.concat(chunks);
|
|
55
|
+
console.log(body.toString());
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
res.on("error", function (error) {
|
|
59
|
+
console.error(error);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
var postData = JSON.stringify({ "items.status": "end", "items.elementId": "script_task" });
|
|
13
64
|
|
|
65
|
+
req.write(postData);
|
|
66
|
+
|
|
67
|
+
req.end();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async function end() {
|
|
71
|
+
await question("continue")
|
|
72
|
+
}
|
|
73
|
+
async function test1() {
|
|
74
|
+
var items = await server.definitions.list();
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
items.forEach(item => {
|
|
78
|
+
// console.log('item: id==>' + item.elementId, item.type, item.name, 'status==>', item.status);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
}
|
|
14
83
|
async function testImport() {
|
|
15
84
|
|
|
16
85
|
|
|
@@ -70,7 +139,7 @@ async function testMessage() {
|
|
|
70
139
|
|
|
71
140
|
async function test() {
|
|
72
141
|
|
|
73
|
-
const server = new BPMNClient(process.env.HOST,
|
|
142
|
+
const server = new BPMNClient(process.env.HOST, res.parsed.PORT, process.env.API_KEY);
|
|
74
143
|
|
|
75
144
|
const caseId = 3040;
|
|
76
145
|
|