@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.js
CHANGED
|
@@ -48,6 +48,7 @@ __export(conductor_javascript_exports, {
|
|
|
48
48
|
DefaultLogger: () => DefaultLogger,
|
|
49
49
|
EventResourceService: () => EventResourceService,
|
|
50
50
|
HealthCheckResourceService: () => HealthCheckResourceService,
|
|
51
|
+
HumanExecutor: () => HumanExecutor,
|
|
51
52
|
MetadataResourceService: () => MetadataResourceService,
|
|
52
53
|
SchedulerResourceService: () => SchedulerResourceService,
|
|
53
54
|
TaskManager: () => TaskManager,
|
|
@@ -100,11 +101,7 @@ __export(conductor_javascript_exports, {
|
|
|
100
101
|
});
|
|
101
102
|
module.exports = __toCommonJS(conductor_javascript_exports);
|
|
102
103
|
|
|
103
|
-
// src/task/
|
|
104
|
-
var DEFAULT_ERROR_MESSAGE = "An unknown error occurred";
|
|
105
|
-
var MAX_RETRIES = 3;
|
|
106
|
-
var noopErrorHandler = (__error) => {
|
|
107
|
-
};
|
|
104
|
+
// src/task/helpers.ts
|
|
108
105
|
var noopLogger = {
|
|
109
106
|
debug: (...args) => {
|
|
110
107
|
},
|
|
@@ -113,6 +110,88 @@ var noopLogger = {
|
|
|
113
110
|
error: (...args) => {
|
|
114
111
|
}
|
|
115
112
|
};
|
|
113
|
+
|
|
114
|
+
// src/task/Poller.ts
|
|
115
|
+
var Poller = class {
|
|
116
|
+
constructor(pollFunction, pollerOptions, logger) {
|
|
117
|
+
this.concurrentCalls = [];
|
|
118
|
+
this.pollFunction = async () => {
|
|
119
|
+
};
|
|
120
|
+
this.isPolling = false;
|
|
121
|
+
this.options = {
|
|
122
|
+
pollInterval: 1e3,
|
|
123
|
+
concurrency: 1
|
|
124
|
+
};
|
|
125
|
+
this.logger = noopLogger;
|
|
126
|
+
this.startPolling = () => {
|
|
127
|
+
if (this.isPolling) {
|
|
128
|
+
throw new Error("Runner is already started");
|
|
129
|
+
}
|
|
130
|
+
return this.poll();
|
|
131
|
+
};
|
|
132
|
+
this.stopPolling = () => {
|
|
133
|
+
this.isPolling = false;
|
|
134
|
+
this.concurrentCalls.forEach((call) => call.stop());
|
|
135
|
+
};
|
|
136
|
+
this.poll = async () => {
|
|
137
|
+
if (!this.isPolling) {
|
|
138
|
+
this.isPolling = true;
|
|
139
|
+
for (let i = 0; i < this.options.concurrency; i++) {
|
|
140
|
+
this.concurrentCalls.push(this.singlePoll());
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
this.singlePoll = () => {
|
|
145
|
+
let poll = this.isPolling;
|
|
146
|
+
let timeout;
|
|
147
|
+
const pollingCall = async () => {
|
|
148
|
+
while (poll) {
|
|
149
|
+
await this.pollFunction();
|
|
150
|
+
await new Promise((r) => timeout = setTimeout(() => r(true), this.options.pollInterval));
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
return {
|
|
154
|
+
promise: pollingCall(),
|
|
155
|
+
stop: () => {
|
|
156
|
+
clearTimeout(timeout);
|
|
157
|
+
poll = false;
|
|
158
|
+
this.logger.debug("stopping single poll call");
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
this.pollFunction = pollFunction;
|
|
163
|
+
this.options = __spreadValues(__spreadValues({}, this.options), pollerOptions);
|
|
164
|
+
this.logger = logger || noopLogger;
|
|
165
|
+
}
|
|
166
|
+
updateConcurrency(concurrency) {
|
|
167
|
+
if (concurrency > 0 && concurrency !== this.options.concurrency) {
|
|
168
|
+
if (concurrency < this.options.concurrency) {
|
|
169
|
+
const result = this.concurrentCalls.splice(0, this.options.concurrency - concurrency);
|
|
170
|
+
result.forEach((call) => {
|
|
171
|
+
call.stop();
|
|
172
|
+
this.logger.debug("stopping some spawned calls");
|
|
173
|
+
});
|
|
174
|
+
} else {
|
|
175
|
+
for (let i = 0; i < concurrency - this.options.concurrency; i++) {
|
|
176
|
+
this.concurrentCalls.push(this.singlePoll());
|
|
177
|
+
this.logger.debug("spawning additional poll calls");
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
this.options.concurrency = concurrency;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
updateOptions(options) {
|
|
184
|
+
const newOptions = __spreadValues(__spreadValues({}, this.options), options);
|
|
185
|
+
this.updateConcurrency(newOptions.concurrency);
|
|
186
|
+
this.options = newOptions;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
// src/task/TaskRunner.ts
|
|
191
|
+
var DEFAULT_ERROR_MESSAGE = "An unknown error occurred";
|
|
192
|
+
var MAX_RETRIES = 3;
|
|
193
|
+
var noopErrorHandler = (__error) => {
|
|
194
|
+
};
|
|
116
195
|
var TaskRunner = class {
|
|
117
196
|
constructor({
|
|
118
197
|
worker,
|
|
@@ -121,32 +200,24 @@ var TaskRunner = class {
|
|
|
121
200
|
logger = noopLogger,
|
|
122
201
|
onError: errorHandler = noopErrorHandler
|
|
123
202
|
}) {
|
|
124
|
-
this.isPolling = false;
|
|
125
203
|
this.startPolling = () => {
|
|
126
|
-
|
|
127
|
-
throw new Error("Runner is already started");
|
|
128
|
-
}
|
|
129
|
-
this.isPolling = true;
|
|
130
|
-
return this.poll();
|
|
204
|
+
this.poller.startPolling();
|
|
131
205
|
};
|
|
132
206
|
this.stopPolling = () => {
|
|
133
|
-
this.
|
|
207
|
+
this.poller.stopPolling();
|
|
134
208
|
};
|
|
135
|
-
this.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
this.logger.debug(`No tasks for ${this.worker.taskDefName}`);
|
|
144
|
-
}
|
|
145
|
-
} catch (unknownError) {
|
|
146
|
-
this.handleUnknownError(unknownError);
|
|
147
|
-
this.errorHandler(unknownError);
|
|
209
|
+
this.pollAndExecute = async () => {
|
|
210
|
+
try {
|
|
211
|
+
const { workerID } = this.options;
|
|
212
|
+
const task = await this.taskResource.poll(this.worker.taskDefName, workerID, this.worker.domain ?? this.options.domain);
|
|
213
|
+
if (task && task.taskId) {
|
|
214
|
+
await this.executeTask(task);
|
|
215
|
+
} else {
|
|
216
|
+
this.logger.debug(`No tasks for ${this.worker.taskDefName}`);
|
|
148
217
|
}
|
|
149
|
-
|
|
218
|
+
} catch (unknownError) {
|
|
219
|
+
this.handleUnknownError(unknownError);
|
|
220
|
+
this.errorHandler(unknownError);
|
|
150
221
|
}
|
|
151
222
|
};
|
|
152
223
|
this.updateTaskWithRetry = async (task, taskResult) => {
|
|
@@ -200,6 +271,18 @@ var TaskRunner = class {
|
|
|
200
271
|
this.worker = worker;
|
|
201
272
|
this.options = options;
|
|
202
273
|
this.errorHandler = errorHandler;
|
|
274
|
+
this.poller = new Poller(this.pollAndExecute, { concurrency: options.concurrency, pollInterval: options.pollInterval }, this.logger);
|
|
275
|
+
}
|
|
276
|
+
updateOptions(options) {
|
|
277
|
+
const newOptions = __spreadValues(__spreadValues({}, this.options), options);
|
|
278
|
+
this.poller.updateOptions({
|
|
279
|
+
concurrency: newOptions.concurrency,
|
|
280
|
+
pollInterval: newOptions.pollInterval
|
|
281
|
+
});
|
|
282
|
+
this.options = newOptions;
|
|
283
|
+
}
|
|
284
|
+
get getOptions() {
|
|
285
|
+
return this.options;
|
|
203
286
|
}
|
|
204
287
|
};
|
|
205
288
|
|
|
@@ -1411,6 +1494,202 @@ var request = (config, options) => {
|
|
|
1411
1494
|
});
|
|
1412
1495
|
};
|
|
1413
1496
|
|
|
1497
|
+
// src/common/open-api/services/HumanTaskService.ts
|
|
1498
|
+
var HumanTaskService = class {
|
|
1499
|
+
constructor(httpRequest) {
|
|
1500
|
+
this.httpRequest = httpRequest;
|
|
1501
|
+
}
|
|
1502
|
+
getTasksByFilter(state, assignee, assigneeType, claimedBy, taskName, freeText, includeInputOutput = false) {
|
|
1503
|
+
return this.httpRequest.request({
|
|
1504
|
+
method: "GET",
|
|
1505
|
+
url: "/human/tasks",
|
|
1506
|
+
query: {
|
|
1507
|
+
"state": state,
|
|
1508
|
+
"assignee": assignee,
|
|
1509
|
+
"assigneeType": assigneeType,
|
|
1510
|
+
"claimedBy": claimedBy,
|
|
1511
|
+
"taskName": taskName,
|
|
1512
|
+
"freeText": freeText,
|
|
1513
|
+
"includeInputOutput": includeInputOutput
|
|
1514
|
+
}
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
getTaskLoad() {
|
|
1518
|
+
return this.httpRequest.request({
|
|
1519
|
+
method: "GET",
|
|
1520
|
+
url: "/human/tasks/load"
|
|
1521
|
+
});
|
|
1522
|
+
}
|
|
1523
|
+
search1(queryId, start, size = 100, freeText = "*", query, jsonQuery, includeInputOutput = false) {
|
|
1524
|
+
return this.httpRequest.request({
|
|
1525
|
+
method: "GET",
|
|
1526
|
+
url: "/human/tasks/search",
|
|
1527
|
+
query: {
|
|
1528
|
+
"queryId": queryId,
|
|
1529
|
+
"start": start,
|
|
1530
|
+
"size": size,
|
|
1531
|
+
"freeText": freeText,
|
|
1532
|
+
"query": query,
|
|
1533
|
+
"jsonQuery": jsonQuery,
|
|
1534
|
+
"includeInputOutput": includeInputOutput
|
|
1535
|
+
}
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1538
|
+
updateTaskOutput1(taskId) {
|
|
1539
|
+
return this.httpRequest.request({
|
|
1540
|
+
method: "DELETE",
|
|
1541
|
+
url: "/human/tasks/{taskId}",
|
|
1542
|
+
path: {
|
|
1543
|
+
"taskId": taskId
|
|
1544
|
+
}
|
|
1545
|
+
});
|
|
1546
|
+
}
|
|
1547
|
+
getTask1(taskId) {
|
|
1548
|
+
return this.httpRequest.request({
|
|
1549
|
+
method: "GET",
|
|
1550
|
+
url: "/human/tasks/{taskId}",
|
|
1551
|
+
path: {
|
|
1552
|
+
"taskId": taskId
|
|
1553
|
+
}
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
getActionLogs(taskId) {
|
|
1557
|
+
return this.httpRequest.request({
|
|
1558
|
+
method: "GET",
|
|
1559
|
+
url: "/human/tasks/{taskId}/actionLogs",
|
|
1560
|
+
path: {
|
|
1561
|
+
"taskId": taskId
|
|
1562
|
+
}
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1565
|
+
claimTask(taskId) {
|
|
1566
|
+
return this.httpRequest.request({
|
|
1567
|
+
method: "POST",
|
|
1568
|
+
url: "/human/tasks/{taskId}/claim",
|
|
1569
|
+
path: {
|
|
1570
|
+
"taskId": taskId
|
|
1571
|
+
}
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1574
|
+
assignAndClaim(taskId, userId) {
|
|
1575
|
+
return this.httpRequest.request({
|
|
1576
|
+
method: "POST",
|
|
1577
|
+
url: "/human/tasks/{taskId}/externalUser/{userId}",
|
|
1578
|
+
path: {
|
|
1579
|
+
"taskId": taskId,
|
|
1580
|
+
"userId": userId
|
|
1581
|
+
}
|
|
1582
|
+
});
|
|
1583
|
+
}
|
|
1584
|
+
reassignTask(taskId, requestBody) {
|
|
1585
|
+
return this.httpRequest.request({
|
|
1586
|
+
method: "POST",
|
|
1587
|
+
url: "/human/tasks/{taskId}/reassign",
|
|
1588
|
+
path: {
|
|
1589
|
+
"taskId": taskId
|
|
1590
|
+
},
|
|
1591
|
+
body: requestBody,
|
|
1592
|
+
mediaType: "application/json"
|
|
1593
|
+
});
|
|
1594
|
+
}
|
|
1595
|
+
releaseTask(taskId) {
|
|
1596
|
+
return this.httpRequest.request({
|
|
1597
|
+
method: "POST",
|
|
1598
|
+
url: "/human/tasks/{taskId}/release",
|
|
1599
|
+
path: {
|
|
1600
|
+
"taskId": taskId
|
|
1601
|
+
}
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1604
|
+
getStateLogs(taskId) {
|
|
1605
|
+
return this.httpRequest.request({
|
|
1606
|
+
method: "GET",
|
|
1607
|
+
url: "/human/tasks/{taskId}/stateLogs",
|
|
1608
|
+
path: {
|
|
1609
|
+
"taskId": taskId
|
|
1610
|
+
}
|
|
1611
|
+
});
|
|
1612
|
+
}
|
|
1613
|
+
updateTaskOutput(taskId, requestBody, complete = false) {
|
|
1614
|
+
return this.httpRequest.request({
|
|
1615
|
+
method: "POST",
|
|
1616
|
+
url: "/human/tasks/{taskId}/update",
|
|
1617
|
+
path: {
|
|
1618
|
+
"taskId": taskId
|
|
1619
|
+
},
|
|
1620
|
+
query: {
|
|
1621
|
+
"complete": complete
|
|
1622
|
+
},
|
|
1623
|
+
body: requestBody,
|
|
1624
|
+
mediaType: "application/json"
|
|
1625
|
+
});
|
|
1626
|
+
}
|
|
1627
|
+
deleteTemplatesByName(name) {
|
|
1628
|
+
return this.httpRequest.request({
|
|
1629
|
+
method: "DELETE",
|
|
1630
|
+
url: "/human/template",
|
|
1631
|
+
query: {
|
|
1632
|
+
"name": name
|
|
1633
|
+
}
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
getAllTemplates(name, version) {
|
|
1637
|
+
return this.httpRequest.request({
|
|
1638
|
+
method: "GET",
|
|
1639
|
+
url: "/human/template",
|
|
1640
|
+
query: {
|
|
1641
|
+
"name": name,
|
|
1642
|
+
"version": version
|
|
1643
|
+
}
|
|
1644
|
+
});
|
|
1645
|
+
}
|
|
1646
|
+
saveTemplate(requestBody, newVersion = false) {
|
|
1647
|
+
return this.httpRequest.request({
|
|
1648
|
+
method: "POST",
|
|
1649
|
+
url: "/human/template",
|
|
1650
|
+
query: {
|
|
1651
|
+
"newVersion": newVersion
|
|
1652
|
+
},
|
|
1653
|
+
body: requestBody,
|
|
1654
|
+
mediaType: "application/json"
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1657
|
+
deleteTemplateById(id) {
|
|
1658
|
+
return this.httpRequest.request({
|
|
1659
|
+
method: "DELETE",
|
|
1660
|
+
url: "/human/template/{id}",
|
|
1661
|
+
path: {
|
|
1662
|
+
"id": id
|
|
1663
|
+
}
|
|
1664
|
+
});
|
|
1665
|
+
}
|
|
1666
|
+
getTemplateById(id) {
|
|
1667
|
+
return this.httpRequest.request({
|
|
1668
|
+
method: "GET",
|
|
1669
|
+
url: "/human/template/{id}",
|
|
1670
|
+
path: {
|
|
1671
|
+
"id": id
|
|
1672
|
+
}
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1675
|
+
};
|
|
1676
|
+
|
|
1677
|
+
// src/common/open-api/services/HumanTaskResourceService.ts
|
|
1678
|
+
var HumanTaskResourceService = class {
|
|
1679
|
+
constructor(httpRequest) {
|
|
1680
|
+
this.httpRequest = httpRequest;
|
|
1681
|
+
}
|
|
1682
|
+
getConductorTaskById(taskId) {
|
|
1683
|
+
return this.httpRequest.request({
|
|
1684
|
+
method: "GET",
|
|
1685
|
+
url: "/human/tasks/{taskId}/conductorTask",
|
|
1686
|
+
path: {
|
|
1687
|
+
"taskId": taskId
|
|
1688
|
+
}
|
|
1689
|
+
});
|
|
1690
|
+
}
|
|
1691
|
+
};
|
|
1692
|
+
|
|
1414
1693
|
// src/common/open-api/ConductorClient.ts
|
|
1415
1694
|
var defaultRequestHandler = (request2, config, options) => request2(config, options);
|
|
1416
1695
|
var ConductorClient = class {
|
|
@@ -1441,6 +1720,8 @@ var ConductorClient = class {
|
|
|
1441
1720
|
this.tokenResource = new TokenResourceService(this.request);
|
|
1442
1721
|
this.workflowBulkResource = new WorkflowBulkResourceService(this.request);
|
|
1443
1722
|
this.workflowResource = new WorkflowResourceService(this.request);
|
|
1723
|
+
this.humanTask = new HumanTaskService(this.request);
|
|
1724
|
+
this.humanTaskResource = new HumanTaskResourceService(this.request);
|
|
1444
1725
|
}
|
|
1445
1726
|
};
|
|
1446
1727
|
|
|
@@ -1971,25 +2252,35 @@ function workerId(options) {
|
|
|
1971
2252
|
var TaskManager = class {
|
|
1972
2253
|
constructor(client, workers, config = {}) {
|
|
1973
2254
|
this.tasks = {};
|
|
2255
|
+
this.workerManagerWorkerOptions = (worker) => {
|
|
2256
|
+
return __spreadProps(__spreadValues({}, this.taskManageOptions), {
|
|
2257
|
+
concurrency: worker.concurrency ?? this.taskManageOptions.concurrency,
|
|
2258
|
+
domain: worker.domain ?? this.taskManageOptions.domain
|
|
2259
|
+
});
|
|
2260
|
+
};
|
|
2261
|
+
this.updatePollingOptions = (options) => {
|
|
2262
|
+
this.workers.forEach((worker) => {
|
|
2263
|
+
const newOptions = __spreadValues(__spreadValues({}, this.workerManagerWorkerOptions(worker)), options);
|
|
2264
|
+
const runners = this.tasks[worker.taskDefName];
|
|
2265
|
+
runners.forEach((runner) => {
|
|
2266
|
+
runner.updateOptions(newOptions);
|
|
2267
|
+
});
|
|
2268
|
+
});
|
|
2269
|
+
};
|
|
1974
2270
|
this.startPolling = () => {
|
|
1975
2271
|
this.workers.forEach((worker) => {
|
|
1976
2272
|
this.tasks[worker.taskDefName] = [];
|
|
1977
|
-
const options =
|
|
1978
|
-
concurrency: worker.concurrency ?? this.taskManageOptions.concurrency,
|
|
1979
|
-
domain: worker.domain ?? this.taskManageOptions.domain
|
|
1980
|
-
});
|
|
2273
|
+
const options = this.workerManagerWorkerOptions(worker);
|
|
1981
2274
|
this.logger.debug(`Starting taskDefName=${worker.taskDefName} concurrency=${options.concurrency} domain=${options.domain}`);
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
this.tasks[worker.taskDefName].push(runner);
|
|
1992
|
-
}
|
|
2275
|
+
const runner = new TaskRunner({
|
|
2276
|
+
worker,
|
|
2277
|
+
options,
|
|
2278
|
+
taskResource: this.client.taskResource,
|
|
2279
|
+
logger: this.logger,
|
|
2280
|
+
onError: this.errorHandler
|
|
2281
|
+
});
|
|
2282
|
+
runner.startPolling();
|
|
2283
|
+
this.tasks[worker.taskDefName].push(runner);
|
|
1993
2284
|
});
|
|
1994
2285
|
};
|
|
1995
2286
|
this.stopPolling = () => {
|
|
@@ -2026,8 +2317,7 @@ var ConductorError = class extends Error {
|
|
|
2026
2317
|
}
|
|
2027
2318
|
};
|
|
2028
2319
|
|
|
2029
|
-
// src/core/
|
|
2030
|
-
var RETRY_TIME_IN_MILLISECONDS = 1e4;
|
|
2320
|
+
// src/core/helpers.ts
|
|
2031
2321
|
var errorMapper = (error) => new ConductorError(error?.body?.message, error);
|
|
2032
2322
|
var tryCatchReThrow = (fn) => {
|
|
2033
2323
|
try {
|
|
@@ -2036,6 +2326,9 @@ var tryCatchReThrow = (fn) => {
|
|
|
2036
2326
|
throw errorMapper(error);
|
|
2037
2327
|
}
|
|
2038
2328
|
};
|
|
2329
|
+
|
|
2330
|
+
// src/core/executor.ts
|
|
2331
|
+
var RETRY_TIME_IN_MILLISECONDS = 1e4;
|
|
2039
2332
|
var WorkflowExecutor = class {
|
|
2040
2333
|
constructor(client) {
|
|
2041
2334
|
this._client = client;
|
|
@@ -2109,6 +2402,61 @@ var WorkflowExecutor = class {
|
|
|
2109
2402
|
return tryCatchReThrow(() => this._client.taskResource.getTask(taskId));
|
|
2110
2403
|
}
|
|
2111
2404
|
};
|
|
2405
|
+
|
|
2406
|
+
// src/core/human.ts
|
|
2407
|
+
var HumanExecutor = class {
|
|
2408
|
+
constructor(client) {
|
|
2409
|
+
this._client = client;
|
|
2410
|
+
}
|
|
2411
|
+
async getTasksByFilter(state, assignee, assigneeType, claimedBy, taskName, freeText, includeInputOutput = false) {
|
|
2412
|
+
const response = await this._client.humanTask.getTasksByFilter(state, assignee, assigneeType, claimedBy, taskName, freeText, includeInputOutput);
|
|
2413
|
+
if (response.results != void 0) {
|
|
2414
|
+
return response.results;
|
|
2415
|
+
}
|
|
2416
|
+
return [];
|
|
2417
|
+
}
|
|
2418
|
+
getTaskById(taskId) {
|
|
2419
|
+
return tryCatchReThrow(() => this._client.humanTask.getTask1(taskId));
|
|
2420
|
+
}
|
|
2421
|
+
async claimTaskAsExternalUser(taskId, assignee) {
|
|
2422
|
+
try {
|
|
2423
|
+
await this._client.humanTask.assignAndClaim(taskId, assignee);
|
|
2424
|
+
} catch (error) {
|
|
2425
|
+
throw errorMapper(error);
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
async claimTaskAsConductorUser(taskId) {
|
|
2429
|
+
try {
|
|
2430
|
+
await this._client.humanTask.claimTask(taskId);
|
|
2431
|
+
} catch (error) {
|
|
2432
|
+
throw errorMapper(error);
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
async releaseTask(taskId) {
|
|
2436
|
+
try {
|
|
2437
|
+
await this._client.humanTask.releaseTask(taskId);
|
|
2438
|
+
} catch (error) {
|
|
2439
|
+
throw errorMapper(error);
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
async getTemplateById(templateId) {
|
|
2443
|
+
return tryCatchReThrow(() => this._client.humanTask.getTemplateById(templateId));
|
|
2444
|
+
}
|
|
2445
|
+
async updateTaskOutput(taskId, requestBody) {
|
|
2446
|
+
try {
|
|
2447
|
+
await this._client.humanTask.updateTaskOutput(taskId, requestBody, false);
|
|
2448
|
+
} catch (error) {
|
|
2449
|
+
throw errorMapper(error);
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
async completeTask(taskId, requestBody = {}) {
|
|
2453
|
+
try {
|
|
2454
|
+
await this._client.humanTask.updateTaskOutput(taskId, requestBody, true);
|
|
2455
|
+
} catch (error) {
|
|
2456
|
+
throw errorMapper(error);
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
};
|
|
2112
2460
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2113
2461
|
0 && (module.exports = {
|
|
2114
2462
|
ApiError,
|
|
@@ -2120,6 +2468,7 @@ var WorkflowExecutor = class {
|
|
|
2120
2468
|
DefaultLogger,
|
|
2121
2469
|
EventResourceService,
|
|
2122
2470
|
HealthCheckResourceService,
|
|
2471
|
+
HumanExecutor,
|
|
2123
2472
|
MetadataResourceService,
|
|
2124
2473
|
SchedulerResourceService,
|
|
2125
2474
|
TaskManager,
|