@io-orkes/conductor-javascript 1.0.0 → 1.0.1
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 +2 -2
- package/dist/index.d.ts +339 -8
- package/dist/index.js +259 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +258 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1329,6 +1329,202 @@ var request = (config, options) => {
|
|
|
1329
1329
|
});
|
|
1330
1330
|
};
|
|
1331
1331
|
|
|
1332
|
+
// src/common/open-api/services/HumanTaskService.ts
|
|
1333
|
+
var HumanTaskService = class {
|
|
1334
|
+
constructor(httpRequest) {
|
|
1335
|
+
this.httpRequest = httpRequest;
|
|
1336
|
+
}
|
|
1337
|
+
getTasksByFilter(state, assignee, assigneeType, claimedBy, taskName, freeText, includeInputOutput = false) {
|
|
1338
|
+
return this.httpRequest.request({
|
|
1339
|
+
method: "GET",
|
|
1340
|
+
url: "/human/tasks",
|
|
1341
|
+
query: {
|
|
1342
|
+
"state": state,
|
|
1343
|
+
"assignee": assignee,
|
|
1344
|
+
"assigneeType": assigneeType,
|
|
1345
|
+
"claimedBy": claimedBy,
|
|
1346
|
+
"taskName": taskName,
|
|
1347
|
+
"freeText": freeText,
|
|
1348
|
+
"includeInputOutput": includeInputOutput
|
|
1349
|
+
}
|
|
1350
|
+
});
|
|
1351
|
+
}
|
|
1352
|
+
getTaskLoad() {
|
|
1353
|
+
return this.httpRequest.request({
|
|
1354
|
+
method: "GET",
|
|
1355
|
+
url: "/human/tasks/load"
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
search1(queryId, start, size = 100, freeText = "*", query, jsonQuery, includeInputOutput = false) {
|
|
1359
|
+
return this.httpRequest.request({
|
|
1360
|
+
method: "GET",
|
|
1361
|
+
url: "/human/tasks/search",
|
|
1362
|
+
query: {
|
|
1363
|
+
"queryId": queryId,
|
|
1364
|
+
"start": start,
|
|
1365
|
+
"size": size,
|
|
1366
|
+
"freeText": freeText,
|
|
1367
|
+
"query": query,
|
|
1368
|
+
"jsonQuery": jsonQuery,
|
|
1369
|
+
"includeInputOutput": includeInputOutput
|
|
1370
|
+
}
|
|
1371
|
+
});
|
|
1372
|
+
}
|
|
1373
|
+
updateTaskOutput1(taskId) {
|
|
1374
|
+
return this.httpRequest.request({
|
|
1375
|
+
method: "DELETE",
|
|
1376
|
+
url: "/human/tasks/{taskId}",
|
|
1377
|
+
path: {
|
|
1378
|
+
"taskId": taskId
|
|
1379
|
+
}
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1382
|
+
getTask1(taskId) {
|
|
1383
|
+
return this.httpRequest.request({
|
|
1384
|
+
method: "GET",
|
|
1385
|
+
url: "/human/tasks/{taskId}",
|
|
1386
|
+
path: {
|
|
1387
|
+
"taskId": taskId
|
|
1388
|
+
}
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
getActionLogs(taskId) {
|
|
1392
|
+
return this.httpRequest.request({
|
|
1393
|
+
method: "GET",
|
|
1394
|
+
url: "/human/tasks/{taskId}/actionLogs",
|
|
1395
|
+
path: {
|
|
1396
|
+
"taskId": taskId
|
|
1397
|
+
}
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
claimTask(taskId) {
|
|
1401
|
+
return this.httpRequest.request({
|
|
1402
|
+
method: "POST",
|
|
1403
|
+
url: "/human/tasks/{taskId}/claim",
|
|
1404
|
+
path: {
|
|
1405
|
+
"taskId": taskId
|
|
1406
|
+
}
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1409
|
+
assignAndClaim(taskId, userId) {
|
|
1410
|
+
return this.httpRequest.request({
|
|
1411
|
+
method: "POST",
|
|
1412
|
+
url: "/human/tasks/{taskId}/externalUser/{userId}",
|
|
1413
|
+
path: {
|
|
1414
|
+
"taskId": taskId,
|
|
1415
|
+
"userId": userId
|
|
1416
|
+
}
|
|
1417
|
+
});
|
|
1418
|
+
}
|
|
1419
|
+
reassignTask(taskId, requestBody) {
|
|
1420
|
+
return this.httpRequest.request({
|
|
1421
|
+
method: "POST",
|
|
1422
|
+
url: "/human/tasks/{taskId}/reassign",
|
|
1423
|
+
path: {
|
|
1424
|
+
"taskId": taskId
|
|
1425
|
+
},
|
|
1426
|
+
body: requestBody,
|
|
1427
|
+
mediaType: "application/json"
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1430
|
+
releaseTask(taskId) {
|
|
1431
|
+
return this.httpRequest.request({
|
|
1432
|
+
method: "POST",
|
|
1433
|
+
url: "/human/tasks/{taskId}/release",
|
|
1434
|
+
path: {
|
|
1435
|
+
"taskId": taskId
|
|
1436
|
+
}
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
getStateLogs(taskId) {
|
|
1440
|
+
return this.httpRequest.request({
|
|
1441
|
+
method: "GET",
|
|
1442
|
+
url: "/human/tasks/{taskId}/stateLogs",
|
|
1443
|
+
path: {
|
|
1444
|
+
"taskId": taskId
|
|
1445
|
+
}
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
updateTaskOutput(taskId, requestBody, complete = false) {
|
|
1449
|
+
return this.httpRequest.request({
|
|
1450
|
+
method: "POST",
|
|
1451
|
+
url: "/human/tasks/{taskId}/update",
|
|
1452
|
+
path: {
|
|
1453
|
+
"taskId": taskId
|
|
1454
|
+
},
|
|
1455
|
+
query: {
|
|
1456
|
+
"complete": complete
|
|
1457
|
+
},
|
|
1458
|
+
body: requestBody,
|
|
1459
|
+
mediaType: "application/json"
|
|
1460
|
+
});
|
|
1461
|
+
}
|
|
1462
|
+
deleteTemplatesByName(name) {
|
|
1463
|
+
return this.httpRequest.request({
|
|
1464
|
+
method: "DELETE",
|
|
1465
|
+
url: "/human/template",
|
|
1466
|
+
query: {
|
|
1467
|
+
"name": name
|
|
1468
|
+
}
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
getAllTemplates(name, version) {
|
|
1472
|
+
return this.httpRequest.request({
|
|
1473
|
+
method: "GET",
|
|
1474
|
+
url: "/human/template",
|
|
1475
|
+
query: {
|
|
1476
|
+
"name": name,
|
|
1477
|
+
"version": version
|
|
1478
|
+
}
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1481
|
+
saveTemplate(requestBody, newVersion = false) {
|
|
1482
|
+
return this.httpRequest.request({
|
|
1483
|
+
method: "POST",
|
|
1484
|
+
url: "/human/template",
|
|
1485
|
+
query: {
|
|
1486
|
+
"newVersion": newVersion
|
|
1487
|
+
},
|
|
1488
|
+
body: requestBody,
|
|
1489
|
+
mediaType: "application/json"
|
|
1490
|
+
});
|
|
1491
|
+
}
|
|
1492
|
+
deleteTemplateById(id) {
|
|
1493
|
+
return this.httpRequest.request({
|
|
1494
|
+
method: "DELETE",
|
|
1495
|
+
url: "/human/template/{id}",
|
|
1496
|
+
path: {
|
|
1497
|
+
"id": id
|
|
1498
|
+
}
|
|
1499
|
+
});
|
|
1500
|
+
}
|
|
1501
|
+
getTemplateById(id) {
|
|
1502
|
+
return this.httpRequest.request({
|
|
1503
|
+
method: "GET",
|
|
1504
|
+
url: "/human/template/{id}",
|
|
1505
|
+
path: {
|
|
1506
|
+
"id": id
|
|
1507
|
+
}
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
};
|
|
1511
|
+
|
|
1512
|
+
// src/common/open-api/services/HumanTaskResourceService.ts
|
|
1513
|
+
var HumanTaskResourceService = class {
|
|
1514
|
+
constructor(httpRequest) {
|
|
1515
|
+
this.httpRequest = httpRequest;
|
|
1516
|
+
}
|
|
1517
|
+
getConductorTaskById(taskId) {
|
|
1518
|
+
return this.httpRequest.request({
|
|
1519
|
+
method: "GET",
|
|
1520
|
+
url: "/human/tasks/{taskId}/conductorTask",
|
|
1521
|
+
path: {
|
|
1522
|
+
"taskId": taskId
|
|
1523
|
+
}
|
|
1524
|
+
});
|
|
1525
|
+
}
|
|
1526
|
+
};
|
|
1527
|
+
|
|
1332
1528
|
// src/common/open-api/ConductorClient.ts
|
|
1333
1529
|
var defaultRequestHandler = (request2, config, options) => request2(config, options);
|
|
1334
1530
|
var ConductorClient = class {
|
|
@@ -1359,6 +1555,8 @@ var ConductorClient = class {
|
|
|
1359
1555
|
this.tokenResource = new TokenResourceService(this.request);
|
|
1360
1556
|
this.workflowBulkResource = new WorkflowBulkResourceService(this.request);
|
|
1361
1557
|
this.workflowResource = new WorkflowResourceService(this.request);
|
|
1558
|
+
this.humanTask = new HumanTaskService(this.request);
|
|
1559
|
+
this.humanTaskResource = new HumanTaskResourceService(this.request);
|
|
1362
1560
|
}
|
|
1363
1561
|
};
|
|
1364
1562
|
|
|
@@ -1944,8 +2142,7 @@ var ConductorError = class extends Error {
|
|
|
1944
2142
|
}
|
|
1945
2143
|
};
|
|
1946
2144
|
|
|
1947
|
-
// src/core/
|
|
1948
|
-
var RETRY_TIME_IN_MILLISECONDS = 1e4;
|
|
2145
|
+
// src/core/helpers.ts
|
|
1949
2146
|
var errorMapper = (error) => new ConductorError(error?.body?.message, error);
|
|
1950
2147
|
var tryCatchReThrow = (fn) => {
|
|
1951
2148
|
try {
|
|
@@ -1954,6 +2151,9 @@ var tryCatchReThrow = (fn) => {
|
|
|
1954
2151
|
throw errorMapper(error);
|
|
1955
2152
|
}
|
|
1956
2153
|
};
|
|
2154
|
+
|
|
2155
|
+
// src/core/executor.ts
|
|
2156
|
+
var RETRY_TIME_IN_MILLISECONDS = 1e4;
|
|
1957
2157
|
var WorkflowExecutor = class {
|
|
1958
2158
|
constructor(client) {
|
|
1959
2159
|
this._client = client;
|
|
@@ -2027,6 +2227,61 @@ var WorkflowExecutor = class {
|
|
|
2027
2227
|
return tryCatchReThrow(() => this._client.taskResource.getTask(taskId));
|
|
2028
2228
|
}
|
|
2029
2229
|
};
|
|
2230
|
+
|
|
2231
|
+
// src/core/human.ts
|
|
2232
|
+
var HumanExecutor = class {
|
|
2233
|
+
constructor(client) {
|
|
2234
|
+
this._client = client;
|
|
2235
|
+
}
|
|
2236
|
+
async getTasksByFilter(state, assignee, assigneeType, claimedBy, taskName, freeText, includeInputOutput = false) {
|
|
2237
|
+
const response = await this._client.humanTask.getTasksByFilter(state, assignee, assigneeType, claimedBy, taskName, freeText, includeInputOutput);
|
|
2238
|
+
if (response.results != void 0) {
|
|
2239
|
+
return response.results;
|
|
2240
|
+
}
|
|
2241
|
+
return [];
|
|
2242
|
+
}
|
|
2243
|
+
getTaskById(taskId) {
|
|
2244
|
+
return tryCatchReThrow(() => this._client.humanTask.getTask1(taskId));
|
|
2245
|
+
}
|
|
2246
|
+
async claimTaskAsExternalUser(taskId, assignee) {
|
|
2247
|
+
try {
|
|
2248
|
+
await this._client.humanTask.assignAndClaim(taskId, assignee);
|
|
2249
|
+
} catch (error) {
|
|
2250
|
+
throw errorMapper(error);
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
async claimTaskAsConductorUser(taskId) {
|
|
2254
|
+
try {
|
|
2255
|
+
await this._client.humanTask.claimTask(taskId);
|
|
2256
|
+
} catch (error) {
|
|
2257
|
+
throw errorMapper(error);
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
async releaseTask(taskId) {
|
|
2261
|
+
try {
|
|
2262
|
+
await this._client.humanTask.releaseTask(taskId);
|
|
2263
|
+
} catch (error) {
|
|
2264
|
+
throw errorMapper(error);
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
async getTemplateById(templateId) {
|
|
2268
|
+
return tryCatchReThrow(() => this._client.humanTask.getTemplateById(templateId));
|
|
2269
|
+
}
|
|
2270
|
+
async updateTaskOutput(taskId, requestBody) {
|
|
2271
|
+
try {
|
|
2272
|
+
await this._client.humanTask.updateTaskOutput(taskId, requestBody, false);
|
|
2273
|
+
} catch (error) {
|
|
2274
|
+
throw errorMapper(error);
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
async completeTask(taskId, requestBody = {}) {
|
|
2278
|
+
try {
|
|
2279
|
+
await this._client.humanTask.updateTaskOutput(taskId, requestBody, true);
|
|
2280
|
+
} catch (error) {
|
|
2281
|
+
throw errorMapper(error);
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
};
|
|
2030
2285
|
export {
|
|
2031
2286
|
ApiError,
|
|
2032
2287
|
BaseHttpRequest,
|
|
@@ -2037,6 +2292,7 @@ export {
|
|
|
2037
2292
|
DefaultLogger,
|
|
2038
2293
|
EventResourceService,
|
|
2039
2294
|
HealthCheckResourceService,
|
|
2295
|
+
HumanExecutor,
|
|
2040
2296
|
MetadataResourceService,
|
|
2041
2297
|
SchedulerResourceService,
|
|
2042
2298
|
TaskManager,
|