bpmn-client 1.3.17 → 1.3.23
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 +132 -105
- package/remote-import.ts +37 -3
- package/src/BPMNClient.js +262 -358
- package/src/BPMNClient.ts +22 -143
- package/src/WebService.js +78 -0
- package/src/WebService.ts +85 -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/test.ts
CHANGED
|
@@ -1,4 +1,75 @@
|
|
|
1
1
|
import { BPMNClient } from './';
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
|
|
4
|
+
const axios = require('axios');
|
|
5
|
+
const FormData = require('form-data');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
uploadFile('Trans.bpmn');
|
|
9
|
+
|
|
10
|
+
//-----------------------------------
|
|
11
|
+
async function uploadFile(file) {
|
|
12
|
+
|
|
13
|
+
var axios = require('axios');
|
|
14
|
+
|
|
15
|
+
const fileContents = fs.createReadStream(file);
|
|
16
|
+
const title = 'My file';
|
|
17
|
+
|
|
18
|
+
const form = new FormData();
|
|
19
|
+
form.append('title', 'title');
|
|
20
|
+
form.append('file', fileContents);
|
|
21
|
+
console.log(1);
|
|
22
|
+
var postData = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"; filename=\""
|
|
23
|
+
+ file + "\"\r\nContent-Type: \"text/plain\"\r\n\r\n" +
|
|
24
|
+
fs.readFileSync(file) + "\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--";
|
|
25
|
+
// formData.append(postData);
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
console.log(2,form);
|
|
31
|
+
|
|
32
|
+
const response = await axios.post('http://localhost:3000/api/definitions/import/test1', form, {
|
|
33
|
+
headers: {
|
|
34
|
+
"Content-Type": "multipart/form-data",
|
|
35
|
+
"x-api-key": "12345",
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
console.log(3);
|
|
40
|
+
|
|
41
|
+
console.log('Response Status:',response.status,response.data);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.log('ERROR------------');
|
|
44
|
+
if (error.response) { // get response with a status code not in range 2xx
|
|
45
|
+
console.log(error.response.data);
|
|
46
|
+
console.log(error.response.status);
|
|
47
|
+
console.log(error.response.headers);
|
|
48
|
+
} else if (error.request) { // no response
|
|
49
|
+
console.log(error.request);
|
|
50
|
+
} else { // Something wrong in setting up the request
|
|
51
|
+
console.log('Error', error.message);
|
|
52
|
+
}
|
|
53
|
+
console.log(error.config);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
2
73
|
|
|
3
74
|
import * as readline from 'readline';
|
|
4
75
|
const cl = readline.createInterface(process.stdin, process.stdout);
|
|
@@ -10,22 +81,40 @@ const question = function (q) {
|
|
|
10
81
|
});
|
|
11
82
|
};
|
|
12
83
|
|
|
84
|
+
//fun1();
|
|
13
85
|
|
|
86
|
+
async function fun1()
|
|
87
|
+
{
|
|
88
|
+
await fun2();
|
|
89
|
+
}
|
|
90
|
+
async function fun2()
|
|
91
|
+
{
|
|
92
|
+
try {
|
|
93
|
+
await fun3();
|
|
94
|
+
}
|
|
95
|
+
catch(exc)
|
|
96
|
+
{
|
|
97
|
+
console.log('error caught but not handled');
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
async function fun3()
|
|
101
|
+
{
|
|
102
|
+
throw new Error('fun3');
|
|
103
|
+
}
|
|
14
104
|
console.log("Testing BPMNClient");
|
|
15
105
|
const dotenv = require('dotenv');
|
|
16
106
|
const res = dotenv.config();
|
|
17
107
|
console.log(res.parsed.PORT);
|
|
18
|
-
const fs = require('fs');
|
|
19
108
|
//raw();
|
|
20
109
|
|
|
21
110
|
|
|
22
111
|
const server = new BPMNClient(process.env.HOST, res.parsed.PORT, process.env.API_KEY);
|
|
23
|
-
console.log(server);
|
|
24
112
|
//testMessage();
|
|
25
113
|
// testImport();
|
|
114
|
+
/*
|
|
26
115
|
test1();
|
|
27
116
|
end();
|
|
28
|
-
|
|
117
|
+
*/
|
|
29
118
|
async function raw() {
|
|
30
119
|
var https = require('follow-redirects').https;
|
|
31
120
|
var fs = require('fs');
|
package/test3.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
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
|
-
//import { BPMNClient } from "bpmn-client";
|
|
13
|
-
const _1 = require("./");
|
|
14
|
-
const readline = require("readline");
|
|
15
|
-
const dotenv = require('dotenv');
|
|
16
|
-
const res = dotenv.config();
|
|
17
|
-
const cl = readline.createInterface(process.stdin, process.stdout);
|
|
18
|
-
const question = function (q) {
|
|
19
|
-
return new Promise((res, rej) => {
|
|
20
|
-
cl.question(q, answer => {
|
|
21
|
-
res(answer);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
completeUserTask();
|
|
26
|
-
function completeUserTask() {
|
|
27
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
const server = new _1.BPMNClient(process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
29
|
-
const instanceId = yield question('Please provide your Instance ID: ');
|
|
30
|
-
const taskId = yield question('Please provide your Task ID: ');
|
|
31
|
-
let taskData = yield question('Please provide your Task Data (json obj) if any: ');
|
|
32
|
-
cl.close();
|
|
33
|
-
if (taskData === "") {
|
|
34
|
-
taskData = {};
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
taskData = JSON.parse(taskData.toString());
|
|
38
|
-
}
|
|
39
|
-
yield server.engine.invoke({ id: instanceId, "items.elementId": taskId }, taskData);
|
|
40
|
-
console.log("Completed UserTask:", taskId);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
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
|
+
//import { BPMNClient } from "bpmn-client";
|
|
13
|
+
const _1 = require("./");
|
|
14
|
+
const readline = require("readline");
|
|
15
|
+
const dotenv = require('dotenv');
|
|
16
|
+
const res = dotenv.config();
|
|
17
|
+
const cl = readline.createInterface(process.stdin, process.stdout);
|
|
18
|
+
const question = function (q) {
|
|
19
|
+
return new Promise((res, rej) => {
|
|
20
|
+
cl.question(q, answer => {
|
|
21
|
+
res(answer);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
completeUserTask();
|
|
26
|
+
function completeUserTask() {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const server = new _1.BPMNClient(process.env.HOST, process.env.PORT, process.env.API_KEY);
|
|
29
|
+
const instanceId = yield question('Please provide your Instance ID: ');
|
|
30
|
+
const taskId = yield question('Please provide your Task ID: ');
|
|
31
|
+
let taskData = yield question('Please provide your Task Data (json obj) if any: ');
|
|
32
|
+
cl.close();
|
|
33
|
+
if (taskData === "") {
|
|
34
|
+
taskData = {};
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
taskData = JSON.parse(taskData.toString());
|
|
38
|
+
}
|
|
39
|
+
yield server.engine.invoke({ id: instanceId, "items.elementId": taskId }, taskData);
|
|
40
|
+
console.log("Completed UserTask:", taskId);
|
|
41
|
+
});
|
|
42
|
+
}
|