bpmn-client 2.3.2 → 3.0.0
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 +32 -32
- package/dist/BPMNClient.d.ts +62 -0
- package/dist/BPMNClient.js +206 -257
- package/dist/BPMNClient.js.map +1 -0
- package/dist/BPMNClient2.d.ts +59 -0
- package/dist/BPMNClient2.js +173 -216
- package/dist/BPMNClient2.js.map +1 -0
- package/dist/WebService.d.ts +9 -0
- package/dist/WebService.js +63 -77
- package/dist/WebService.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +189 -225
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -20
- package/dist/index.js.map +1 -0
- package/dist/interfaces/API.d.ts +26 -0
- package/dist/interfaces/API.js +2 -2
- package/dist/interfaces/API.js.map +1 -0
- package/dist/interfaces/DataObjects.d.ts +92 -0
- package/dist/interfaces/DataObjects.js +2 -2
- package/dist/interfaces/DataObjects.js.map +1 -0
- package/dist/interfaces/Enums.d.ts +94 -0
- package/dist/interfaces/Enums.js +10 -11
- package/dist/interfaces/Enums.js.map +1 -0
- package/dist/setup.d.ts +2 -0
- package/dist/setup.js +4 -2
- package/dist/setup.js.map +1 -0
- package/package.json +65 -54
- package/bin/cli.js +0 -245
- package/bin/setup.js +0 -24
- package/dist/monitor.js +0 -91
- package/dist/remote-import.js +0 -137
- package/dist/test-raw.js +0 -74
- package/dist/test.js +0 -85
- package/dist/test2.js +0 -52
- package/dist/test3.js +0 -42
- package/dist/testFind.js +0 -30
package/README.md
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
cbpmn-client
|
|
2
|
-
===========
|
|
3
|
-
|
|
4
|
-
[](http://www.repostatus.org/#active)
|
|
5
|
-
|
|
6
|
-
This is a light-weight package to allow remote access to [bpmn-server](https://github.com/bpmnServer/bpmn-server)
|
|
7
|
-
|
|
8
|
-
# Installation
|
|
9
|
-
|
|
10
|
-
This installs bpmn-client-sample application along with `bpmn-client`
|
|
11
|
-
|
|
12
|
-
```sh
|
|
13
|
-
|
|
14
|
-
git clone https://github.com/bpmnServer/bpmn-client-sample.git
|
|
15
|
-
|
|
16
|
-
cd bpmn-client-sample
|
|
17
|
-
|
|
18
|
-
npm install
|
|
19
|
-
|
|
20
|
-
npm run setup
|
|
21
|
-
|
|
22
|
-
npm run cli
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
the above setup command will copy .env
|
|
26
|
-
You can edit .env file to point to your implementation of `bpmn-server`
|
|
27
|
-
|
|
28
|
-
### to update to latest release
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
$ npm update bpmn-client
|
|
32
|
-
```
|
|
1
|
+
cbpmn-client
|
|
2
|
+
===========
|
|
3
|
+
|
|
4
|
+
[](http://www.repostatus.org/#active)
|
|
5
|
+
|
|
6
|
+
This is a light-weight package to allow remote access to [bpmn-server](https://github.com/bpmnServer/bpmn-server)
|
|
7
|
+
|
|
8
|
+
# Installation
|
|
9
|
+
|
|
10
|
+
This installs bpmn-client-sample application along with `bpmn-client`
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
|
|
14
|
+
git clone https://github.com/bpmnServer/bpmn-client-sample.git
|
|
15
|
+
|
|
16
|
+
cd bpmn-client-sample
|
|
17
|
+
|
|
18
|
+
npm install
|
|
19
|
+
|
|
20
|
+
npm run setup
|
|
21
|
+
|
|
22
|
+
npm run cli
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
the above setup command will copy .env
|
|
26
|
+
You can edit .env file to point to your implementation of `bpmn-server`
|
|
27
|
+
|
|
28
|
+
### to update to latest release
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
$ npm update bpmn-client
|
|
32
|
+
```
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { IInstanceData, IItemData, IDefinitionData } from './interfaces/DataObjects.js';
|
|
2
|
+
import { WebService } from './WebService.js';
|
|
3
|
+
declare class BPMNClient extends WebService {
|
|
4
|
+
host: any;
|
|
5
|
+
port: any;
|
|
6
|
+
apiKey: any;
|
|
7
|
+
engine: ClientEngine;
|
|
8
|
+
datastore: ClientDatastore;
|
|
9
|
+
definitions: ClientDefinitions;
|
|
10
|
+
constructor(host: any, port: any, apiKey: any);
|
|
11
|
+
get(url: any, data?: {}): Promise<any>;
|
|
12
|
+
post(url: any, data?: {}): Promise<any>;
|
|
13
|
+
put(url: any, data?: {}): Promise<any>;
|
|
14
|
+
del(url: any, data?: {}): Promise<any>;
|
|
15
|
+
request(url: any, method: any, params: any): Promise<any>;
|
|
16
|
+
}
|
|
17
|
+
declare class ClientEngine {
|
|
18
|
+
private client;
|
|
19
|
+
constructor(client: any);
|
|
20
|
+
start(name: any, data?: {}, startNodeId?: any, userId?: any, options?: {}): Promise<IInstanceData>;
|
|
21
|
+
invoke(query: any, data: any, userId?: any, options?: {}): Promise<IInstanceData>;
|
|
22
|
+
assign(query: any, data: any, userId: any, assignment: any): Promise<IInstanceData>;
|
|
23
|
+
restart(query: any, data: any, userId?: any, options?: {}): Promise<IInstanceData>;
|
|
24
|
+
throwMessage(messageId: any, data?: {}, messageMatchingKey?: {}): Promise<any>;
|
|
25
|
+
throwSignal(signalId: any, data?: {}, messageMatchingKey?: {}): Promise<any>;
|
|
26
|
+
startEvent(instanceId: any, startNodeId: any, data?: {}, userId?: any, options?: {}): Promise<IInstanceData>;
|
|
27
|
+
get(query: any): Promise<IInstanceData>;
|
|
28
|
+
status(): Promise<any>;
|
|
29
|
+
}
|
|
30
|
+
declare class ClientDatastore {
|
|
31
|
+
private client;
|
|
32
|
+
constructor(client: any);
|
|
33
|
+
find({ filter, sort, limit, after, projection, lastItem, latestItem, getTotalCount }: {
|
|
34
|
+
filter?: Record<string, any>;
|
|
35
|
+
after?: string;
|
|
36
|
+
limit?: number;
|
|
37
|
+
sort?: Record<string, 1 | -1>;
|
|
38
|
+
projection?: Record<string, 0 | 1 | any>;
|
|
39
|
+
lastItem?: Record<string, any>;
|
|
40
|
+
latestItem?: Record<string, any>;
|
|
41
|
+
getTotalCount?: boolean;
|
|
42
|
+
}): Promise<{
|
|
43
|
+
data?: any[];
|
|
44
|
+
nextCursor?: string | null;
|
|
45
|
+
totalCount?: number;
|
|
46
|
+
error?: string;
|
|
47
|
+
}>;
|
|
48
|
+
findItems(query: any): Promise<IItemData[]>;
|
|
49
|
+
findInstances(query: any, projection?: {}): Promise<IInstanceData[]>;
|
|
50
|
+
deleteInstances(query: any): Promise<any>;
|
|
51
|
+
}
|
|
52
|
+
declare class ClientDefinitions {
|
|
53
|
+
private client;
|
|
54
|
+
constructor(client: any);
|
|
55
|
+
import(name: any, pathToBPMN: any, pathToSVG?: any): Promise<any>;
|
|
56
|
+
list(): Promise<string[]>;
|
|
57
|
+
delete(name: any): Promise<IDefinitionData>;
|
|
58
|
+
rename(name: any, newName: any): Promise<IDefinitionData>;
|
|
59
|
+
load(name: any): Promise<IDefinitionData>;
|
|
60
|
+
checkErrors(res: any): void;
|
|
61
|
+
}
|
|
62
|
+
export { BPMNClient, ClientEngine, ClientDatastore, ClientDefinitions };
|
package/dist/BPMNClient.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ClientDefinitions = exports.ClientDatastore = exports.ClientEngine = exports.BPMNClient = void 0;
|
|
13
|
-
const WebService_1 = require("./WebService");
|
|
14
|
-
class BPMNClient extends WebService_1.WebService {
|
|
1
|
+
import { WebService } from './WebService.js';
|
|
2
|
+
class BPMNClient extends WebService {
|
|
3
|
+
host;
|
|
4
|
+
port;
|
|
5
|
+
apiKey;
|
|
6
|
+
engine;
|
|
7
|
+
datastore;
|
|
8
|
+
definitions;
|
|
15
9
|
constructor(host, port, apiKey) {
|
|
16
10
|
super();
|
|
17
11
|
this.host = host;
|
|
@@ -21,280 +15,234 @@ class BPMNClient extends WebService_1.WebService {
|
|
|
21
15
|
this.datastore = new ClientDatastore(this);
|
|
22
16
|
this.definitions = new ClientDefinitions(this);
|
|
23
17
|
}
|
|
24
|
-
get(
|
|
25
|
-
return
|
|
26
|
-
return yield this.request(url, 'GET', data);
|
|
27
|
-
});
|
|
18
|
+
async get(url, data = {}) {
|
|
19
|
+
return await this.request(url, 'GET', data);
|
|
28
20
|
}
|
|
29
|
-
post(
|
|
30
|
-
return
|
|
31
|
-
return yield this.request(url, 'POST', data);
|
|
32
|
-
});
|
|
21
|
+
async post(url, data = {}) {
|
|
22
|
+
return await this.request(url, 'POST', data);
|
|
33
23
|
}
|
|
34
|
-
put(
|
|
35
|
-
return
|
|
36
|
-
return yield this.request(url, 'PUT', data);
|
|
37
|
-
});
|
|
24
|
+
async put(url, data = {}) {
|
|
25
|
+
return await this.request(url, 'PUT', data);
|
|
38
26
|
}
|
|
39
|
-
del(
|
|
40
|
-
return
|
|
41
|
-
return yield this.request(url, 'DELETE', data);
|
|
42
|
-
});
|
|
27
|
+
async del(url, data = {}) {
|
|
28
|
+
return await this.request(url, 'DELETE', data);
|
|
43
29
|
}
|
|
44
|
-
request(url, method, params) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
30
|
+
async request(url, method, params) {
|
|
31
|
+
var body = JSON.stringify(params);
|
|
32
|
+
var size = Buffer.byteLength(body);
|
|
33
|
+
var contentType = "application/json";
|
|
34
|
+
if (method == 'UPLOAD') {
|
|
35
|
+
contentType = 'multipart/form-data; boundary = ----WebKitFormBoundary7MA4YWxkTrZu0gW';
|
|
36
|
+
method = 'POST';
|
|
37
|
+
}
|
|
38
|
+
var headers = {
|
|
39
|
+
"Content-Type": contentType,
|
|
40
|
+
"x-api-key": this.apiKey,
|
|
41
|
+
"Accept": "*/*",
|
|
42
|
+
// "User-Agent": "PostmanRuntime/ 7.26.8",
|
|
43
|
+
// "Accept-Encoding": "gzip, deflate, br",
|
|
44
|
+
"Connection": "keep-alive"
|
|
45
|
+
//,
|
|
46
|
+
// "Content-Length": Buffer.byteLength(body)
|
|
47
|
+
};
|
|
48
|
+
var options;
|
|
49
|
+
if (params) {
|
|
50
|
+
options = {
|
|
51
|
+
host: this.host,
|
|
52
|
+
port: this.port,
|
|
53
|
+
path: '/api/' + url,
|
|
54
|
+
method: method,
|
|
55
|
+
headers: headers
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
options = {
|
|
60
|
+
host: this.host,
|
|
61
|
+
port: this.port,
|
|
62
|
+
path: '/api/' + url,
|
|
63
|
+
method: method
|
|
62
64
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
options = {
|
|
66
|
-
host: this.host,
|
|
67
|
-
port: this.port,
|
|
68
|
-
path: '/api/' + url,
|
|
69
|
-
method: method,
|
|
70
|
-
headers: headers
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
options = {
|
|
75
|
-
host: this.host,
|
|
76
|
-
port: this.port,
|
|
77
|
-
path: '/api/' + url,
|
|
78
|
-
method: method
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
return yield this.invoke(params, options);
|
|
82
|
-
});
|
|
65
|
+
}
|
|
66
|
+
return await this.invoke(params, options);
|
|
83
67
|
}
|
|
84
68
|
}
|
|
85
|
-
exports.BPMNClient = BPMNClient;
|
|
86
69
|
class ClientEngine {
|
|
70
|
+
client;
|
|
87
71
|
constructor(client) {
|
|
88
72
|
this.client = client;
|
|
89
73
|
}
|
|
90
|
-
start(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
console.log('
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
throwMessage(messageId_1) {
|
|
137
|
-
return __awaiter(this, arguments, void 0, function* (messageId, data = {}, messageMatchingKey = {}) {
|
|
138
|
-
const ret = yield this.client.post('engine/throwMessage', { "messageId": messageId, "data": data, messageMatchingKey });
|
|
139
|
-
if (ret['errors']) {
|
|
140
|
-
console.log(ret['errors']);
|
|
141
|
-
throw new Error(ret['errors']);
|
|
142
|
-
}
|
|
143
|
-
return ret;
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
throwSignal(signalId_1) {
|
|
147
|
-
return __awaiter(this, arguments, void 0, function* (signalId, data = {}, messageMatchingKey = {}) {
|
|
148
|
-
const ret = yield this.client.post('engine/throwSignal', { "signalId": signalId, "data": data, messageMatchingKey });
|
|
149
|
-
if (ret['errors']) {
|
|
150
|
-
console.log(ret['errors']);
|
|
151
|
-
throw new Error(ret['errors']);
|
|
152
|
-
}
|
|
153
|
-
return ret;
|
|
154
|
-
});
|
|
74
|
+
async start(name, data = {}, startNodeId = null, userId = null, options = {}) {
|
|
75
|
+
const ret = await this.client.post('engine/start', { name, data, startNodeId, userId, options });
|
|
76
|
+
if (ret['errors']) {
|
|
77
|
+
console.log(ret['errors']);
|
|
78
|
+
throw new Error(ret['errors']);
|
|
79
|
+
}
|
|
80
|
+
const instance = ret;
|
|
81
|
+
return instance;
|
|
82
|
+
}
|
|
83
|
+
async invoke(query, data, userId = null, options = {}) {
|
|
84
|
+
console.log('invoke', options);
|
|
85
|
+
const ret = await this.client.put('engine/invoke', { query, data, userId, options });
|
|
86
|
+
if (ret['errors']) {
|
|
87
|
+
console.log(ret['errors']);
|
|
88
|
+
throw new Error(ret['errors']);
|
|
89
|
+
}
|
|
90
|
+
const instance = ret['instance'];
|
|
91
|
+
return instance;
|
|
92
|
+
}
|
|
93
|
+
async assign(query, data, userId = null, assignment) {
|
|
94
|
+
const ret = await this.client.put('engine/assign', { query, data, userId, assignment });
|
|
95
|
+
if (ret['errors']) {
|
|
96
|
+
console.log(ret['errors']);
|
|
97
|
+
throw new Error(ret['errors']);
|
|
98
|
+
}
|
|
99
|
+
const instance = ret['instance'];
|
|
100
|
+
return instance;
|
|
101
|
+
}
|
|
102
|
+
async restart(query, data, userId = null, options = {}) {
|
|
103
|
+
console.log('invoke', options);
|
|
104
|
+
const ret = await this.client.put('engine/restart', { query, data, userId, options });
|
|
105
|
+
if (ret['errors']) {
|
|
106
|
+
console.log(ret['errors']);
|
|
107
|
+
throw new Error(ret['errors']);
|
|
108
|
+
}
|
|
109
|
+
const instance = ret['instance'];
|
|
110
|
+
return instance;
|
|
111
|
+
}
|
|
112
|
+
async throwMessage(messageId, data = {}, messageMatchingKey = {}) {
|
|
113
|
+
const ret = await this.client.post('engine/throwMessage', { "messageId": messageId, "data": data, messageMatchingKey });
|
|
114
|
+
if (ret['errors']) {
|
|
115
|
+
console.log(ret['errors']);
|
|
116
|
+
throw new Error(ret['errors']);
|
|
117
|
+
}
|
|
118
|
+
return ret;
|
|
155
119
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return ret;
|
|
164
|
-
});
|
|
120
|
+
async throwSignal(signalId, data = {}, messageMatchingKey = {}) {
|
|
121
|
+
const ret = await this.client.post('engine/throwSignal', { "signalId": signalId, "data": data, messageMatchingKey });
|
|
122
|
+
if (ret['errors']) {
|
|
123
|
+
console.log(ret['errors']);
|
|
124
|
+
throw new Error(ret['errors']);
|
|
125
|
+
}
|
|
126
|
+
return ret;
|
|
165
127
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const instance = ret['instance'];
|
|
174
|
-
return instance;
|
|
175
|
-
});
|
|
128
|
+
async startEvent(instanceId, startNodeId, data = {}, userId = null, options = {}) {
|
|
129
|
+
const ret = await this.client.put('engine/startEvent', { "instanceId": instanceId, "startNodeId": startNodeId, "data": data, "userName": userId, "options": options });
|
|
130
|
+
if (ret['errors']) {
|
|
131
|
+
console.log(ret['errors']);
|
|
132
|
+
throw new Error(ret['errors']);
|
|
133
|
+
}
|
|
134
|
+
return ret;
|
|
176
135
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
136
|
+
async get(query) {
|
|
137
|
+
const ret = await this.client.get('engine/get', query);
|
|
138
|
+
if (ret['errors']) {
|
|
139
|
+
console.log(ret['errors']);
|
|
140
|
+
throw new Error(ret['errors']);
|
|
141
|
+
}
|
|
142
|
+
const instance = ret['instance'];
|
|
143
|
+
return instance;
|
|
144
|
+
}
|
|
145
|
+
async status() {
|
|
146
|
+
const ret = await this.client.get('engine/status', {});
|
|
147
|
+
if (ret['errors']) {
|
|
148
|
+
console.log(ret['errors']);
|
|
149
|
+
throw new Error(ret['errors']);
|
|
150
|
+
}
|
|
151
|
+
return ret;
|
|
186
152
|
}
|
|
187
153
|
}
|
|
188
|
-
exports.ClientEngine = ClientEngine;
|
|
189
154
|
class ClientDatastore {
|
|
155
|
+
client;
|
|
190
156
|
constructor(client) {
|
|
191
157
|
this.client = client;
|
|
192
158
|
}
|
|
193
|
-
find(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
return res;
|
|
202
|
-
});
|
|
159
|
+
async find({ filter, sort, limit, after, projection, lastItem, latestItem, getTotalCount }) {
|
|
160
|
+
var res = await this.client.get('datastore/find', { filter, after, limit, sort, projection, lastItem, latestItem, getTotalCount });
|
|
161
|
+
if (res.error) {
|
|
162
|
+
console.log(res.error);
|
|
163
|
+
throw new Error(res.error);
|
|
164
|
+
throw new Error(res['errors']);
|
|
165
|
+
}
|
|
166
|
+
return res;
|
|
203
167
|
}
|
|
204
|
-
findItems(query) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
return items;
|
|
213
|
-
});
|
|
168
|
+
async findItems(query) {
|
|
169
|
+
var res = await this.client.get('datastore/findItems', query);
|
|
170
|
+
if (res['errors']) {
|
|
171
|
+
console.log(res['errors']);
|
|
172
|
+
throw new Error(res['errors']);
|
|
173
|
+
}
|
|
174
|
+
const items = res['items'];
|
|
175
|
+
return items;
|
|
214
176
|
}
|
|
215
|
-
findInstances(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
return instances;
|
|
224
|
-
});
|
|
177
|
+
async findInstances(query, projection = {}) {
|
|
178
|
+
const res = await this.client.get('datastore/findInstances', { query, projection });
|
|
179
|
+
if (res['errors']) {
|
|
180
|
+
console.log(res['errors']);
|
|
181
|
+
throw new Error(res['errors']);
|
|
182
|
+
}
|
|
183
|
+
const instances = res['instances'];
|
|
184
|
+
return instances;
|
|
225
185
|
}
|
|
226
|
-
deleteInstances(query) {
|
|
227
|
-
return
|
|
228
|
-
return yield this.client.del('datastore/deleteInstances', query);
|
|
229
|
-
});
|
|
186
|
+
async deleteInstances(query) {
|
|
187
|
+
return await this.client.del('datastore/deleteInstances', query);
|
|
230
188
|
}
|
|
231
189
|
}
|
|
232
|
-
exports.ClientDatastore = ClientDatastore;
|
|
233
190
|
class ClientDefinitions {
|
|
191
|
+
client;
|
|
234
192
|
constructor(client) {
|
|
235
193
|
this.client = client;
|
|
236
194
|
}
|
|
237
|
-
import(
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
'
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
throw new Error(res['errors']);
|
|
262
|
-
}
|
|
263
|
-
return res;
|
|
264
|
-
});
|
|
195
|
+
async import(name, pathToBPMN, pathToSVG = null) {
|
|
196
|
+
var options = {
|
|
197
|
+
'method': 'POST',
|
|
198
|
+
'host': this.client.host,
|
|
199
|
+
'port': this.client.port,
|
|
200
|
+
'path': '/api/definitions/import/' + name,
|
|
201
|
+
'headers': {
|
|
202
|
+
'x-api-key': this.client.apiKey
|
|
203
|
+
},
|
|
204
|
+
'maxRedirects': 20
|
|
205
|
+
};
|
|
206
|
+
console.log('import ', name, pathToBPMN, pathToSVG);
|
|
207
|
+
var res = await this.client.upload(name, pathToBPMN, pathToSVG, options);
|
|
208
|
+
console.log('import done ', res);
|
|
209
|
+
this.checkErrors(res);
|
|
210
|
+
return res;
|
|
211
|
+
}
|
|
212
|
+
async list() {
|
|
213
|
+
var res = await this.client.get('definitions/list', []);
|
|
214
|
+
if (res['errors']) {
|
|
215
|
+
console.log(res['errors']);
|
|
216
|
+
throw new Error(res['errors']);
|
|
217
|
+
}
|
|
218
|
+
return res;
|
|
265
219
|
}
|
|
266
|
-
delete(name) {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
return res;
|
|
275
|
-
});
|
|
220
|
+
async delete(name) {
|
|
221
|
+
const res = await this.client.post('definitions/delete/', { name });
|
|
222
|
+
if (res['errors']) {
|
|
223
|
+
console.log(res['errors']);
|
|
224
|
+
throw new Error(res['errors']);
|
|
225
|
+
}
|
|
226
|
+
console.log(res);
|
|
227
|
+
return res;
|
|
276
228
|
}
|
|
277
|
-
rename(name, newName) {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
return res;
|
|
286
|
-
});
|
|
229
|
+
async rename(name, newName) {
|
|
230
|
+
const res = await this.client.post('definitions/rename/', { name, newName });
|
|
231
|
+
if (res['errors']) {
|
|
232
|
+
console.log(res['errors']);
|
|
233
|
+
throw new Error(res['errors']);
|
|
234
|
+
}
|
|
235
|
+
console.log(res);
|
|
236
|
+
return res;
|
|
287
237
|
}
|
|
288
|
-
load(name) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
return res;
|
|
297
|
-
});
|
|
238
|
+
async load(name) {
|
|
239
|
+
const res = await this.client.get(encodeURI('definitions/load/' + name), { name });
|
|
240
|
+
if (res['errors']) {
|
|
241
|
+
console.log(res['errors']);
|
|
242
|
+
throw new Error(res['errors']);
|
|
243
|
+
}
|
|
244
|
+
console.log(res);
|
|
245
|
+
return res;
|
|
298
246
|
}
|
|
299
247
|
checkErrors(res) {
|
|
300
248
|
if (res['errors']) {
|
|
@@ -303,4 +251,5 @@ class ClientDefinitions {
|
|
|
303
251
|
}
|
|
304
252
|
}
|
|
305
253
|
}
|
|
306
|
-
|
|
254
|
+
export { BPMNClient, ClientEngine, ClientDatastore, ClientDefinitions };
|
|
255
|
+
//# sourceMappingURL=BPMNClient.js.map
|