@io-orkes/conductor-javascript 1.0.0 → 1.1.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 +2 -2
- package/dist/index.d.ts +383 -42
- package/dist/index.js +392 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +391 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -18,11 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
|
|
21
|
-
// src/task/
|
|
22
|
-
var DEFAULT_ERROR_MESSAGE = "An unknown error occurred";
|
|
23
|
-
var MAX_RETRIES = 3;
|
|
24
|
-
var noopErrorHandler = (__error) => {
|
|
25
|
-
};
|
|
21
|
+
// src/task/helpers.ts
|
|
26
22
|
var noopLogger = {
|
|
27
23
|
debug: (...args) => {
|
|
28
24
|
},
|
|
@@ -31,6 +27,88 @@ var noopLogger = {
|
|
|
31
27
|
error: (...args) => {
|
|
32
28
|
}
|
|
33
29
|
};
|
|
30
|
+
|
|
31
|
+
// src/task/Poller.ts
|
|
32
|
+
var Poller = class {
|
|
33
|
+
constructor(pollFunction, pollerOptions, logger) {
|
|
34
|
+
this.concurrentCalls = [];
|
|
35
|
+
this.pollFunction = async () => {
|
|
36
|
+
};
|
|
37
|
+
this.isPolling = false;
|
|
38
|
+
this.options = {
|
|
39
|
+
pollInterval: 1e3,
|
|
40
|
+
concurrency: 1
|
|
41
|
+
};
|
|
42
|
+
this.logger = noopLogger;
|
|
43
|
+
this.startPolling = () => {
|
|
44
|
+
if (this.isPolling) {
|
|
45
|
+
throw new Error("Runner is already started");
|
|
46
|
+
}
|
|
47
|
+
return this.poll();
|
|
48
|
+
};
|
|
49
|
+
this.stopPolling = () => {
|
|
50
|
+
this.isPolling = false;
|
|
51
|
+
this.concurrentCalls.forEach((call) => call.stop());
|
|
52
|
+
};
|
|
53
|
+
this.poll = async () => {
|
|
54
|
+
if (!this.isPolling) {
|
|
55
|
+
this.isPolling = true;
|
|
56
|
+
for (let i = 0; i < this.options.concurrency; i++) {
|
|
57
|
+
this.concurrentCalls.push(this.singlePoll());
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
this.singlePoll = () => {
|
|
62
|
+
let poll = this.isPolling;
|
|
63
|
+
let timeout;
|
|
64
|
+
const pollingCall = async () => {
|
|
65
|
+
while (poll) {
|
|
66
|
+
await this.pollFunction();
|
|
67
|
+
await new Promise((r) => timeout = setTimeout(() => r(true), this.options.pollInterval));
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
return {
|
|
71
|
+
promise: pollingCall(),
|
|
72
|
+
stop: () => {
|
|
73
|
+
clearTimeout(timeout);
|
|
74
|
+
poll = false;
|
|
75
|
+
this.logger.debug("stopping single poll call");
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
this.pollFunction = pollFunction;
|
|
80
|
+
this.options = __spreadValues(__spreadValues({}, this.options), pollerOptions);
|
|
81
|
+
this.logger = logger || noopLogger;
|
|
82
|
+
}
|
|
83
|
+
updateConcurrency(concurrency) {
|
|
84
|
+
if (concurrency > 0 && concurrency !== this.options.concurrency) {
|
|
85
|
+
if (concurrency < this.options.concurrency) {
|
|
86
|
+
const result = this.concurrentCalls.splice(0, this.options.concurrency - concurrency);
|
|
87
|
+
result.forEach((call) => {
|
|
88
|
+
call.stop();
|
|
89
|
+
this.logger.debug("stopping some spawned calls");
|
|
90
|
+
});
|
|
91
|
+
} else {
|
|
92
|
+
for (let i = 0; i < concurrency - this.options.concurrency; i++) {
|
|
93
|
+
this.concurrentCalls.push(this.singlePoll());
|
|
94
|
+
this.logger.debug("spawning additional poll calls");
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
this.options.concurrency = concurrency;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
updateOptions(options) {
|
|
101
|
+
const newOptions = __spreadValues(__spreadValues({}, this.options), options);
|
|
102
|
+
this.updateConcurrency(newOptions.concurrency);
|
|
103
|
+
this.options = newOptions;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// src/task/TaskRunner.ts
|
|
108
|
+
var DEFAULT_ERROR_MESSAGE = "An unknown error occurred";
|
|
109
|
+
var MAX_RETRIES = 3;
|
|
110
|
+
var noopErrorHandler = (__error) => {
|
|
111
|
+
};
|
|
34
112
|
var TaskRunner = class {
|
|
35
113
|
constructor({
|
|
36
114
|
worker,
|
|
@@ -39,32 +117,24 @@ var TaskRunner = class {
|
|
|
39
117
|
logger = noopLogger,
|
|
40
118
|
onError: errorHandler = noopErrorHandler
|
|
41
119
|
}) {
|
|
42
|
-
this.isPolling = false;
|
|
43
120
|
this.startPolling = () => {
|
|
44
|
-
|
|
45
|
-
throw new Error("Runner is already started");
|
|
46
|
-
}
|
|
47
|
-
this.isPolling = true;
|
|
48
|
-
return this.poll();
|
|
121
|
+
this.poller.startPolling();
|
|
49
122
|
};
|
|
50
123
|
this.stopPolling = () => {
|
|
51
|
-
this.
|
|
124
|
+
this.poller.stopPolling();
|
|
52
125
|
};
|
|
53
|
-
this.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
this.logger.debug(`No tasks for ${this.worker.taskDefName}`);
|
|
62
|
-
}
|
|
63
|
-
} catch (unknownError) {
|
|
64
|
-
this.handleUnknownError(unknownError);
|
|
65
|
-
this.errorHandler(unknownError);
|
|
126
|
+
this.pollAndExecute = async () => {
|
|
127
|
+
try {
|
|
128
|
+
const { workerID } = this.options;
|
|
129
|
+
const task = await this.taskResource.poll(this.worker.taskDefName, workerID, this.worker.domain ?? this.options.domain);
|
|
130
|
+
if (task && task.taskId) {
|
|
131
|
+
await this.executeTask(task);
|
|
132
|
+
} else {
|
|
133
|
+
this.logger.debug(`No tasks for ${this.worker.taskDefName}`);
|
|
66
134
|
}
|
|
67
|
-
|
|
135
|
+
} catch (unknownError) {
|
|
136
|
+
this.handleUnknownError(unknownError);
|
|
137
|
+
this.errorHandler(unknownError);
|
|
68
138
|
}
|
|
69
139
|
};
|
|
70
140
|
this.updateTaskWithRetry = async (task, taskResult) => {
|
|
@@ -118,6 +188,18 @@ var TaskRunner = class {
|
|
|
118
188
|
this.worker = worker;
|
|
119
189
|
this.options = options;
|
|
120
190
|
this.errorHandler = errorHandler;
|
|
191
|
+
this.poller = new Poller(this.pollAndExecute, { concurrency: options.concurrency, pollInterval: options.pollInterval }, this.logger);
|
|
192
|
+
}
|
|
193
|
+
updateOptions(options) {
|
|
194
|
+
const newOptions = __spreadValues(__spreadValues({}, this.options), options);
|
|
195
|
+
this.poller.updateOptions({
|
|
196
|
+
concurrency: newOptions.concurrency,
|
|
197
|
+
pollInterval: newOptions.pollInterval
|
|
198
|
+
});
|
|
199
|
+
this.options = newOptions;
|
|
200
|
+
}
|
|
201
|
+
get getOptions() {
|
|
202
|
+
return this.options;
|
|
121
203
|
}
|
|
122
204
|
};
|
|
123
205
|
|
|
@@ -1329,6 +1411,202 @@ var request = (config, options) => {
|
|
|
1329
1411
|
});
|
|
1330
1412
|
};
|
|
1331
1413
|
|
|
1414
|
+
// src/common/open-api/services/HumanTaskService.ts
|
|
1415
|
+
var HumanTaskService = class {
|
|
1416
|
+
constructor(httpRequest) {
|
|
1417
|
+
this.httpRequest = httpRequest;
|
|
1418
|
+
}
|
|
1419
|
+
getTasksByFilter(state, assignee, assigneeType, claimedBy, taskName, freeText, includeInputOutput = false) {
|
|
1420
|
+
return this.httpRequest.request({
|
|
1421
|
+
method: "GET",
|
|
1422
|
+
url: "/human/tasks",
|
|
1423
|
+
query: {
|
|
1424
|
+
"state": state,
|
|
1425
|
+
"assignee": assignee,
|
|
1426
|
+
"assigneeType": assigneeType,
|
|
1427
|
+
"claimedBy": claimedBy,
|
|
1428
|
+
"taskName": taskName,
|
|
1429
|
+
"freeText": freeText,
|
|
1430
|
+
"includeInputOutput": includeInputOutput
|
|
1431
|
+
}
|
|
1432
|
+
});
|
|
1433
|
+
}
|
|
1434
|
+
getTaskLoad() {
|
|
1435
|
+
return this.httpRequest.request({
|
|
1436
|
+
method: "GET",
|
|
1437
|
+
url: "/human/tasks/load"
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1440
|
+
search1(queryId, start, size = 100, freeText = "*", query, jsonQuery, includeInputOutput = false) {
|
|
1441
|
+
return this.httpRequest.request({
|
|
1442
|
+
method: "GET",
|
|
1443
|
+
url: "/human/tasks/search",
|
|
1444
|
+
query: {
|
|
1445
|
+
"queryId": queryId,
|
|
1446
|
+
"start": start,
|
|
1447
|
+
"size": size,
|
|
1448
|
+
"freeText": freeText,
|
|
1449
|
+
"query": query,
|
|
1450
|
+
"jsonQuery": jsonQuery,
|
|
1451
|
+
"includeInputOutput": includeInputOutput
|
|
1452
|
+
}
|
|
1453
|
+
});
|
|
1454
|
+
}
|
|
1455
|
+
updateTaskOutput1(taskId) {
|
|
1456
|
+
return this.httpRequest.request({
|
|
1457
|
+
method: "DELETE",
|
|
1458
|
+
url: "/human/tasks/{taskId}",
|
|
1459
|
+
path: {
|
|
1460
|
+
"taskId": taskId
|
|
1461
|
+
}
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
getTask1(taskId) {
|
|
1465
|
+
return this.httpRequest.request({
|
|
1466
|
+
method: "GET",
|
|
1467
|
+
url: "/human/tasks/{taskId}",
|
|
1468
|
+
path: {
|
|
1469
|
+
"taskId": taskId
|
|
1470
|
+
}
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
getActionLogs(taskId) {
|
|
1474
|
+
return this.httpRequest.request({
|
|
1475
|
+
method: "GET",
|
|
1476
|
+
url: "/human/tasks/{taskId}/actionLogs",
|
|
1477
|
+
path: {
|
|
1478
|
+
"taskId": taskId
|
|
1479
|
+
}
|
|
1480
|
+
});
|
|
1481
|
+
}
|
|
1482
|
+
claimTask(taskId) {
|
|
1483
|
+
return this.httpRequest.request({
|
|
1484
|
+
method: "POST",
|
|
1485
|
+
url: "/human/tasks/{taskId}/claim",
|
|
1486
|
+
path: {
|
|
1487
|
+
"taskId": taskId
|
|
1488
|
+
}
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
assignAndClaim(taskId, userId) {
|
|
1492
|
+
return this.httpRequest.request({
|
|
1493
|
+
method: "POST",
|
|
1494
|
+
url: "/human/tasks/{taskId}/externalUser/{userId}",
|
|
1495
|
+
path: {
|
|
1496
|
+
"taskId": taskId,
|
|
1497
|
+
"userId": userId
|
|
1498
|
+
}
|
|
1499
|
+
});
|
|
1500
|
+
}
|
|
1501
|
+
reassignTask(taskId, requestBody) {
|
|
1502
|
+
return this.httpRequest.request({
|
|
1503
|
+
method: "POST",
|
|
1504
|
+
url: "/human/tasks/{taskId}/reassign",
|
|
1505
|
+
path: {
|
|
1506
|
+
"taskId": taskId
|
|
1507
|
+
},
|
|
1508
|
+
body: requestBody,
|
|
1509
|
+
mediaType: "application/json"
|
|
1510
|
+
});
|
|
1511
|
+
}
|
|
1512
|
+
releaseTask(taskId) {
|
|
1513
|
+
return this.httpRequest.request({
|
|
1514
|
+
method: "POST",
|
|
1515
|
+
url: "/human/tasks/{taskId}/release",
|
|
1516
|
+
path: {
|
|
1517
|
+
"taskId": taskId
|
|
1518
|
+
}
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
getStateLogs(taskId) {
|
|
1522
|
+
return this.httpRequest.request({
|
|
1523
|
+
method: "GET",
|
|
1524
|
+
url: "/human/tasks/{taskId}/stateLogs",
|
|
1525
|
+
path: {
|
|
1526
|
+
"taskId": taskId
|
|
1527
|
+
}
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
updateTaskOutput(taskId, requestBody, complete = false) {
|
|
1531
|
+
return this.httpRequest.request({
|
|
1532
|
+
method: "POST",
|
|
1533
|
+
url: "/human/tasks/{taskId}/update",
|
|
1534
|
+
path: {
|
|
1535
|
+
"taskId": taskId
|
|
1536
|
+
},
|
|
1537
|
+
query: {
|
|
1538
|
+
"complete": complete
|
|
1539
|
+
},
|
|
1540
|
+
body: requestBody,
|
|
1541
|
+
mediaType: "application/json"
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1544
|
+
deleteTemplatesByName(name) {
|
|
1545
|
+
return this.httpRequest.request({
|
|
1546
|
+
method: "DELETE",
|
|
1547
|
+
url: "/human/template",
|
|
1548
|
+
query: {
|
|
1549
|
+
"name": name
|
|
1550
|
+
}
|
|
1551
|
+
});
|
|
1552
|
+
}
|
|
1553
|
+
getAllTemplates(name, version) {
|
|
1554
|
+
return this.httpRequest.request({
|
|
1555
|
+
method: "GET",
|
|
1556
|
+
url: "/human/template",
|
|
1557
|
+
query: {
|
|
1558
|
+
"name": name,
|
|
1559
|
+
"version": version
|
|
1560
|
+
}
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
saveTemplate(requestBody, newVersion = false) {
|
|
1564
|
+
return this.httpRequest.request({
|
|
1565
|
+
method: "POST",
|
|
1566
|
+
url: "/human/template",
|
|
1567
|
+
query: {
|
|
1568
|
+
"newVersion": newVersion
|
|
1569
|
+
},
|
|
1570
|
+
body: requestBody,
|
|
1571
|
+
mediaType: "application/json"
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1574
|
+
deleteTemplateById(id) {
|
|
1575
|
+
return this.httpRequest.request({
|
|
1576
|
+
method: "DELETE",
|
|
1577
|
+
url: "/human/template/{id}",
|
|
1578
|
+
path: {
|
|
1579
|
+
"id": id
|
|
1580
|
+
}
|
|
1581
|
+
});
|
|
1582
|
+
}
|
|
1583
|
+
getTemplateById(id) {
|
|
1584
|
+
return this.httpRequest.request({
|
|
1585
|
+
method: "GET",
|
|
1586
|
+
url: "/human/template/{id}",
|
|
1587
|
+
path: {
|
|
1588
|
+
"id": id
|
|
1589
|
+
}
|
|
1590
|
+
});
|
|
1591
|
+
}
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1594
|
+
// src/common/open-api/services/HumanTaskResourceService.ts
|
|
1595
|
+
var HumanTaskResourceService = class {
|
|
1596
|
+
constructor(httpRequest) {
|
|
1597
|
+
this.httpRequest = httpRequest;
|
|
1598
|
+
}
|
|
1599
|
+
getConductorTaskById(taskId) {
|
|
1600
|
+
return this.httpRequest.request({
|
|
1601
|
+
method: "GET",
|
|
1602
|
+
url: "/human/tasks/{taskId}/conductorTask",
|
|
1603
|
+
path: {
|
|
1604
|
+
"taskId": taskId
|
|
1605
|
+
}
|
|
1606
|
+
});
|
|
1607
|
+
}
|
|
1608
|
+
};
|
|
1609
|
+
|
|
1332
1610
|
// src/common/open-api/ConductorClient.ts
|
|
1333
1611
|
var defaultRequestHandler = (request2, config, options) => request2(config, options);
|
|
1334
1612
|
var ConductorClient = class {
|
|
@@ -1359,6 +1637,8 @@ var ConductorClient = class {
|
|
|
1359
1637
|
this.tokenResource = new TokenResourceService(this.request);
|
|
1360
1638
|
this.workflowBulkResource = new WorkflowBulkResourceService(this.request);
|
|
1361
1639
|
this.workflowResource = new WorkflowResourceService(this.request);
|
|
1640
|
+
this.humanTask = new HumanTaskService(this.request);
|
|
1641
|
+
this.humanTaskResource = new HumanTaskResourceService(this.request);
|
|
1362
1642
|
}
|
|
1363
1643
|
};
|
|
1364
1644
|
|
|
@@ -1889,25 +2169,35 @@ function workerId(options) {
|
|
|
1889
2169
|
var TaskManager = class {
|
|
1890
2170
|
constructor(client, workers, config = {}) {
|
|
1891
2171
|
this.tasks = {};
|
|
2172
|
+
this.workerManagerWorkerOptions = (worker) => {
|
|
2173
|
+
return __spreadProps(__spreadValues({}, this.taskManageOptions), {
|
|
2174
|
+
concurrency: worker.concurrency ?? this.taskManageOptions.concurrency,
|
|
2175
|
+
domain: worker.domain ?? this.taskManageOptions.domain
|
|
2176
|
+
});
|
|
2177
|
+
};
|
|
2178
|
+
this.updatePollingOptions = (options) => {
|
|
2179
|
+
this.workers.forEach((worker) => {
|
|
2180
|
+
const newOptions = __spreadValues(__spreadValues({}, this.workerManagerWorkerOptions(worker)), options);
|
|
2181
|
+
const runners = this.tasks[worker.taskDefName];
|
|
2182
|
+
runners.forEach((runner) => {
|
|
2183
|
+
runner.updateOptions(newOptions);
|
|
2184
|
+
});
|
|
2185
|
+
});
|
|
2186
|
+
};
|
|
1892
2187
|
this.startPolling = () => {
|
|
1893
2188
|
this.workers.forEach((worker) => {
|
|
1894
2189
|
this.tasks[worker.taskDefName] = [];
|
|
1895
|
-
const options =
|
|
1896
|
-
concurrency: worker.concurrency ?? this.taskManageOptions.concurrency,
|
|
1897
|
-
domain: worker.domain ?? this.taskManageOptions.domain
|
|
1898
|
-
});
|
|
2190
|
+
const options = this.workerManagerWorkerOptions(worker);
|
|
1899
2191
|
this.logger.debug(`Starting taskDefName=${worker.taskDefName} concurrency=${options.concurrency} domain=${options.domain}`);
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
this.tasks[worker.taskDefName].push(runner);
|
|
1910
|
-
}
|
|
2192
|
+
const runner = new TaskRunner({
|
|
2193
|
+
worker,
|
|
2194
|
+
options,
|
|
2195
|
+
taskResource: this.client.taskResource,
|
|
2196
|
+
logger: this.logger,
|
|
2197
|
+
onError: this.errorHandler
|
|
2198
|
+
});
|
|
2199
|
+
runner.startPolling();
|
|
2200
|
+
this.tasks[worker.taskDefName].push(runner);
|
|
1911
2201
|
});
|
|
1912
2202
|
};
|
|
1913
2203
|
this.stopPolling = () => {
|
|
@@ -1944,8 +2234,7 @@ var ConductorError = class extends Error {
|
|
|
1944
2234
|
}
|
|
1945
2235
|
};
|
|
1946
2236
|
|
|
1947
|
-
// src/core/
|
|
1948
|
-
var RETRY_TIME_IN_MILLISECONDS = 1e4;
|
|
2237
|
+
// src/core/helpers.ts
|
|
1949
2238
|
var errorMapper = (error) => new ConductorError(error?.body?.message, error);
|
|
1950
2239
|
var tryCatchReThrow = (fn) => {
|
|
1951
2240
|
try {
|
|
@@ -1954,6 +2243,9 @@ var tryCatchReThrow = (fn) => {
|
|
|
1954
2243
|
throw errorMapper(error);
|
|
1955
2244
|
}
|
|
1956
2245
|
};
|
|
2246
|
+
|
|
2247
|
+
// src/core/executor.ts
|
|
2248
|
+
var RETRY_TIME_IN_MILLISECONDS = 1e4;
|
|
1957
2249
|
var WorkflowExecutor = class {
|
|
1958
2250
|
constructor(client) {
|
|
1959
2251
|
this._client = client;
|
|
@@ -2027,6 +2319,61 @@ var WorkflowExecutor = class {
|
|
|
2027
2319
|
return tryCatchReThrow(() => this._client.taskResource.getTask(taskId));
|
|
2028
2320
|
}
|
|
2029
2321
|
};
|
|
2322
|
+
|
|
2323
|
+
// src/core/human.ts
|
|
2324
|
+
var HumanExecutor = class {
|
|
2325
|
+
constructor(client) {
|
|
2326
|
+
this._client = client;
|
|
2327
|
+
}
|
|
2328
|
+
async getTasksByFilter(state, assignee, assigneeType, claimedBy, taskName, freeText, includeInputOutput = false) {
|
|
2329
|
+
const response = await this._client.humanTask.getTasksByFilter(state, assignee, assigneeType, claimedBy, taskName, freeText, includeInputOutput);
|
|
2330
|
+
if (response.results != void 0) {
|
|
2331
|
+
return response.results;
|
|
2332
|
+
}
|
|
2333
|
+
return [];
|
|
2334
|
+
}
|
|
2335
|
+
getTaskById(taskId) {
|
|
2336
|
+
return tryCatchReThrow(() => this._client.humanTask.getTask1(taskId));
|
|
2337
|
+
}
|
|
2338
|
+
async claimTaskAsExternalUser(taskId, assignee) {
|
|
2339
|
+
try {
|
|
2340
|
+
await this._client.humanTask.assignAndClaim(taskId, assignee);
|
|
2341
|
+
} catch (error) {
|
|
2342
|
+
throw errorMapper(error);
|
|
2343
|
+
}
|
|
2344
|
+
}
|
|
2345
|
+
async claimTaskAsConductorUser(taskId) {
|
|
2346
|
+
try {
|
|
2347
|
+
await this._client.humanTask.claimTask(taskId);
|
|
2348
|
+
} catch (error) {
|
|
2349
|
+
throw errorMapper(error);
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
async releaseTask(taskId) {
|
|
2353
|
+
try {
|
|
2354
|
+
await this._client.humanTask.releaseTask(taskId);
|
|
2355
|
+
} catch (error) {
|
|
2356
|
+
throw errorMapper(error);
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
async getTemplateById(templateId) {
|
|
2360
|
+
return tryCatchReThrow(() => this._client.humanTask.getTemplateById(templateId));
|
|
2361
|
+
}
|
|
2362
|
+
async updateTaskOutput(taskId, requestBody) {
|
|
2363
|
+
try {
|
|
2364
|
+
await this._client.humanTask.updateTaskOutput(taskId, requestBody, false);
|
|
2365
|
+
} catch (error) {
|
|
2366
|
+
throw errorMapper(error);
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
async completeTask(taskId, requestBody = {}) {
|
|
2370
|
+
try {
|
|
2371
|
+
await this._client.humanTask.updateTaskOutput(taskId, requestBody, true);
|
|
2372
|
+
} catch (error) {
|
|
2373
|
+
throw errorMapper(error);
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
};
|
|
2030
2377
|
export {
|
|
2031
2378
|
ApiError,
|
|
2032
2379
|
BaseHttpRequest,
|
|
@@ -2037,6 +2384,7 @@ export {
|
|
|
2037
2384
|
DefaultLogger,
|
|
2038
2385
|
EventResourceService,
|
|
2039
2386
|
HealthCheckResourceService,
|
|
2387
|
+
HumanExecutor,
|
|
2040
2388
|
MetadataResourceService,
|
|
2041
2389
|
SchedulerResourceService,
|
|
2042
2390
|
TaskManager,
|