bpmn-client 1.3.23 → 1.3.27
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 +2 -2
- package/cli.ts +2 -2
- package/package.json +1 -1
- package/remote-import.js +7 -2
- package/remote-import.ts +9 -2
- package/src/BPMNClient.js +4 -4
- package/src/BPMNClient.ts +4 -4
- package/src/WebService.js +9 -5
- package/src/WebService.ts +11 -6
package/.env
CHANGED
package/cli.js
CHANGED
|
@@ -118,10 +118,10 @@ function start() {
|
|
|
118
118
|
function findItems(query) {
|
|
119
119
|
return __awaiter(this, void 0, void 0, function* () {
|
|
120
120
|
var items = yield server.datastore.findItems(query);
|
|
121
|
-
console.log(
|
|
121
|
+
console.log(`processName item.name item.elementId instanceId item.id`);
|
|
122
122
|
for (var i = 0; i < items.length; i++) {
|
|
123
123
|
let item = items[i];
|
|
124
|
-
console.log(`${item.name}
|
|
124
|
+
console.log(`${item['processName']} ${item.name} ${item.elementId} ${item['instanceId']} ${item.id}`);
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
127
|
}
|
package/cli.ts
CHANGED
|
@@ -127,10 +127,10 @@ async function start()
|
|
|
127
127
|
async function findItems(query) {
|
|
128
128
|
var items = await server.datastore.findItems(query);
|
|
129
129
|
|
|
130
|
-
console.log(
|
|
130
|
+
console.log(`processName item.name item.elementId instanceId item.id`);
|
|
131
131
|
for (var i = 0; i < items.length; i++) {
|
|
132
132
|
let item = items[i];
|
|
133
|
-
console.log(`${item.name}
|
|
133
|
+
console.log(`${item['processName']} ${item.name} ${item.elementId} ${item['instanceId']} ${item.id}`);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
}
|
package/package.json
CHANGED
package/remote-import.js
CHANGED
|
@@ -42,10 +42,15 @@ function fromClientLib() {
|
|
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
43
|
console.log('from client lib');
|
|
44
44
|
try {
|
|
45
|
-
const server = new
|
|
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);
|
|
46
50
|
var name = 'test-import';
|
|
47
51
|
var file = '..\\WebApp\\processes\\Trans.bpmn';
|
|
48
|
-
var
|
|
52
|
+
var file2 = '..\\WebApp\\processes\\Trans.svg';
|
|
53
|
+
var res = yield server.definitions.import(name, file, file2);
|
|
49
54
|
return res;
|
|
50
55
|
}
|
|
51
56
|
catch (exc) {
|
package/remote-import.ts
CHANGED
|
@@ -43,12 +43,19 @@ async function fromClientLib() {
|
|
|
43
43
|
|
|
44
44
|
console.log('from client lib');
|
|
45
45
|
try {
|
|
46
|
-
const server = new BPMNClient('localhost', 3000, '12345');
|
|
46
|
+
// const server = new BPMNClient('localhost', 3000, '12345');
|
|
47
|
+
|
|
48
|
+
const dotenv = require('dotenv');
|
|
49
|
+
dotenv.config();
|
|
50
|
+
console.log('env:',process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
51
|
+
|
|
52
|
+
const server = new BPMNClient(process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
47
53
|
|
|
48
54
|
var name = 'test-import';
|
|
49
55
|
var file = '..\\WebApp\\processes\\Trans.bpmn';
|
|
56
|
+
var file2 = '..\\WebApp\\processes\\Trans.svg';
|
|
50
57
|
|
|
51
|
-
var res=await server.definitions.import(name, file);
|
|
58
|
+
var res=await server.definitions.import(name, file,file2);
|
|
52
59
|
return res;
|
|
53
60
|
}
|
|
54
61
|
catch(exc)
|
package/src/BPMNClient.js
CHANGED
|
@@ -190,11 +190,11 @@ class ClientDefinitions {
|
|
|
190
190
|
constructor(client) {
|
|
191
191
|
this.client = client;
|
|
192
192
|
}
|
|
193
|
-
import(name,
|
|
193
|
+
import(name, pathToBPMN, pathToSVG = null) {
|
|
194
194
|
return __awaiter(this, void 0, void 0, function* () {
|
|
195
195
|
var options = {
|
|
196
196
|
'method': 'POST',
|
|
197
|
-
'
|
|
197
|
+
'host': this.client.host,
|
|
198
198
|
'port': this.client.port,
|
|
199
199
|
'path': '/api/definitions/import/' + name,
|
|
200
200
|
'headers': {
|
|
@@ -202,8 +202,8 @@ class ClientDefinitions {
|
|
|
202
202
|
},
|
|
203
203
|
'maxRedirects': 20
|
|
204
204
|
};
|
|
205
|
-
console.log('import ', name,
|
|
206
|
-
var res = yield this.client.upload(name,
|
|
205
|
+
console.log('import ', name, pathToBPMN, pathToSVG);
|
|
206
|
+
var res = yield this.client.upload(name, pathToBPMN, pathToSVG, options);
|
|
207
207
|
console.log('import done ', res);
|
|
208
208
|
this.checkErrors(res);
|
|
209
209
|
return res;
|
package/src/BPMNClient.ts
CHANGED
|
@@ -186,11 +186,11 @@ class ClientDefinitions {
|
|
|
186
186
|
this.client = client;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
async import(name,
|
|
189
|
+
async import(name, pathToBPMN,pathToSVG=null) {
|
|
190
190
|
|
|
191
191
|
var options = {
|
|
192
192
|
'method': 'POST',
|
|
193
|
-
'
|
|
193
|
+
'host': this.client.host,
|
|
194
194
|
'port': this.client.port,
|
|
195
195
|
'path': '/api/definitions/import/' + name,
|
|
196
196
|
'headers': {
|
|
@@ -199,8 +199,8 @@ class ClientDefinitions {
|
|
|
199
199
|
'maxRedirects': 20
|
|
200
200
|
};
|
|
201
201
|
|
|
202
|
-
console.log('import ',name,
|
|
203
|
-
var res = await this.client.upload(name,
|
|
202
|
+
console.log('import ',name,pathToBPMN,pathToSVG);
|
|
203
|
+
var res = await this.client.upload(name,pathToBPMN,pathToSVG,options);
|
|
204
204
|
console.log('import done ',res);
|
|
205
205
|
this.checkErrors(res);
|
|
206
206
|
return res;
|
package/src/WebService.js
CHANGED
|
@@ -40,16 +40,20 @@ class WebService {
|
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
upload(fileName, path, options) {
|
|
43
|
+
upload(fileName, path, path2, options) {
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const fileContents = fs.createReadStream(path);
|
|
46
45
|
const title = fileName;
|
|
47
|
-
var url = 'http://' + options.
|
|
46
|
+
var url = 'http://' + options.host + ':' + options.port + options.path;
|
|
48
47
|
if (options.port == 443)
|
|
49
48
|
url = 'https://' + options.host + options.path;
|
|
50
49
|
const form = new FormData();
|
|
51
|
-
form.append('title',
|
|
50
|
+
form.append('title', title);
|
|
51
|
+
const fileContents = fs.createReadStream(path);
|
|
52
52
|
form.append('file', fileContents);
|
|
53
|
+
if (path2 !== null) {
|
|
54
|
+
const fileContents2 = fs.createReadStream(path2);
|
|
55
|
+
form.append('file', fileContents2);
|
|
56
|
+
}
|
|
53
57
|
try {
|
|
54
58
|
const response = yield axios.post(url, form, {
|
|
55
59
|
headers: options.headers
|
|
@@ -58,7 +62,7 @@ class WebService {
|
|
|
58
62
|
return response.data;
|
|
59
63
|
}
|
|
60
64
|
catch (error) {
|
|
61
|
-
console.log('upload failed:', error
|
|
65
|
+
console.log('upload failed:', error);
|
|
62
66
|
throw new Error(error.message);
|
|
63
67
|
/*
|
|
64
68
|
if (error.response) { // get response with a status code not in range 2xx
|
package/src/WebService.ts
CHANGED
|
@@ -40,20 +40,25 @@ class WebService {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
async upload(fileName, path, options) {
|
|
43
|
+
async upload(fileName, path,path2, options) {
|
|
44
44
|
|
|
45
|
-
const fileContents = fs.createReadStream(path);
|
|
46
45
|
const title = fileName;
|
|
47
46
|
|
|
48
|
-
var url = 'http://'+options.
|
|
47
|
+
var url = 'http://'+options.host+':'+options.port+options.path;
|
|
49
48
|
|
|
50
49
|
if (options.port == 443)
|
|
51
50
|
url = 'https://'+options.host+options.path;
|
|
52
|
-
|
|
53
51
|
|
|
54
52
|
const form = new FormData();
|
|
55
|
-
form.append('title',
|
|
53
|
+
form.append('title', title);
|
|
54
|
+
const fileContents = fs.createReadStream(path);
|
|
56
55
|
form.append('file', fileContents);
|
|
56
|
+
if (path2!==null)
|
|
57
|
+
{
|
|
58
|
+
const fileContents2 = fs.createReadStream(path2);
|
|
59
|
+
form.append('file', fileContents2);
|
|
60
|
+
}
|
|
61
|
+
|
|
57
62
|
|
|
58
63
|
try {
|
|
59
64
|
|
|
@@ -65,7 +70,7 @@ class WebService {
|
|
|
65
70
|
|
|
66
71
|
}
|
|
67
72
|
catch (error) {
|
|
68
|
-
console.log('upload failed:',error
|
|
73
|
+
console.log('upload failed:',error);
|
|
69
74
|
throw new Error(error.message);
|
|
70
75
|
/*
|
|
71
76
|
if (error.response) { // get response with a status code not in range 2xx
|