bpmn-client 1.3.23 → 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/package.json +1 -1
- package/remote-import.js +2 -1
- package/remote-import.ts +2 -1
- package/src/BPMNClient.js +3 -3
- package/src/BPMNClient.ts +3 -3
- package/src/WebService.js +7 -3
- package/src/WebService.ts +9 -3
package/package.json
CHANGED
package/remote-import.js
CHANGED
|
@@ -45,7 +45,8 @@ function fromClientLib() {
|
|
|
45
45
|
const server = new _1.BPMNClient('localhost', 3000, '12345');
|
|
46
46
|
var name = 'test-import';
|
|
47
47
|
var file = '..\\WebApp\\processes\\Trans.bpmn';
|
|
48
|
-
var
|
|
48
|
+
var file2 = '..\\WebApp\\processes\\Trans.svg';
|
|
49
|
+
var res = yield server.definitions.import(name, file, file2);
|
|
49
50
|
return res;
|
|
50
51
|
}
|
|
51
52
|
catch (exc) {
|
package/remote-import.ts
CHANGED
|
@@ -47,8 +47,9 @@ async function fromClientLib() {
|
|
|
47
47
|
|
|
48
48
|
var name = 'test-import';
|
|
49
49
|
var file = '..\\WebApp\\processes\\Trans.bpmn';
|
|
50
|
+
var file2 = '..\\WebApp\\processes\\Trans.svg';
|
|
50
51
|
|
|
51
|
-
var res=await server.definitions.import(name, file);
|
|
52
|
+
var res=await server.definitions.import(name, file,file2);
|
|
52
53
|
return res;
|
|
53
54
|
}
|
|
54
55
|
catch(exc)
|
package/src/BPMNClient.js
CHANGED
|
@@ -190,7 +190,7 @@ 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',
|
|
@@ -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,7 +186,7 @@ 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',
|
|
@@ -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
46
|
var url = 'http://' + options.hostname + ':' + 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
|
package/src/WebService.ts
CHANGED
|
@@ -40,9 +40,8 @@ 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
47
|
var url = 'http://'+options.hostname+':'+options.port+options.path;
|
|
@@ -52,8 +51,15 @@ class WebService {
|
|
|
52
51
|
|
|
53
52
|
|
|
54
53
|
const form = new FormData();
|
|
55
|
-
form.append('title',
|
|
54
|
+
form.append('title', title);
|
|
55
|
+
const fileContents = fs.createReadStream(path);
|
|
56
56
|
form.append('file', fileContents);
|
|
57
|
+
if (path2!==null)
|
|
58
|
+
{
|
|
59
|
+
const fileContents2 = fs.createReadStream(path2);
|
|
60
|
+
form.append('file', fileContents2);
|
|
61
|
+
}
|
|
62
|
+
|
|
57
63
|
|
|
58
64
|
try {
|
|
59
65
|
|