@io-orkes/conductor-javascript 2.1.3 → 2.1.5
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/dist/index.d.mts +721 -341
- package/dist/index.d.ts +721 -341
- package/dist/index.js +456 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +451 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -18
package/dist/index.js
CHANGED
|
@@ -28,8 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
30
|
// index.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
33
|
ApiError: () => ApiError,
|
|
34
34
|
AuthConductorClient: () => AuthConductorClient,
|
|
35
35
|
BaseHttpRequest: () => BaseHttpRequest,
|
|
@@ -37,6 +37,7 @@ __export(conductor_javascript_exports, {
|
|
|
37
37
|
CancelablePromise: () => CancelablePromise,
|
|
38
38
|
ConductorClient: () => ConductorClient,
|
|
39
39
|
ConductorError: () => ConductorError,
|
|
40
|
+
Consistency: () => Consistency,
|
|
40
41
|
DefaultLogger: () => DefaultLogger,
|
|
41
42
|
EventResourceService: () => EventResourceService,
|
|
42
43
|
HealthCheckResourceService: () => HealthCheckResourceService,
|
|
@@ -44,6 +45,7 @@ __export(conductor_javascript_exports, {
|
|
|
44
45
|
MAX_RETRIES: () => MAX_RETRIES,
|
|
45
46
|
MetadataClient: () => MetadataClient,
|
|
46
47
|
MetadataResourceService: () => MetadataResourceService,
|
|
48
|
+
ReturnStrategy: () => ReturnStrategy,
|
|
47
49
|
SchedulerClient: () => SchedulerClient,
|
|
48
50
|
SchedulerResourceService: () => SchedulerResourceService,
|
|
49
51
|
TaskClient: () => TaskClient,
|
|
@@ -101,7 +103,7 @@ __export(conductor_javascript_exports, {
|
|
|
101
103
|
waitTaskUntil: () => waitTaskUntil,
|
|
102
104
|
workflow: () => workflow
|
|
103
105
|
});
|
|
104
|
-
module.exports = __toCommonJS(
|
|
106
|
+
module.exports = __toCommonJS(index_exports);
|
|
105
107
|
|
|
106
108
|
// src/common/ConductorLogger.ts
|
|
107
109
|
var LOG_LEVELS = {
|
|
@@ -157,6 +159,19 @@ var noopLogger = {
|
|
|
157
159
|
};
|
|
158
160
|
|
|
159
161
|
// src/common/types.ts
|
|
162
|
+
var Consistency = /* @__PURE__ */ ((Consistency3) => {
|
|
163
|
+
Consistency3["SYNCHRONOUS"] = "SYNCHRONOUS";
|
|
164
|
+
Consistency3["DURABLE"] = "DURABLE";
|
|
165
|
+
Consistency3["REGION_DURABLE"] = "REGION_DURABLE";
|
|
166
|
+
return Consistency3;
|
|
167
|
+
})(Consistency || {});
|
|
168
|
+
var ReturnStrategy = /* @__PURE__ */ ((ReturnStrategy2) => {
|
|
169
|
+
ReturnStrategy2["TARGET_WORKFLOW"] = "TARGET_WORKFLOW";
|
|
170
|
+
ReturnStrategy2["BLOCKING_WORKFLOW"] = "BLOCKING_WORKFLOW";
|
|
171
|
+
ReturnStrategy2["BLOCKING_TASK"] = "BLOCKING_TASK";
|
|
172
|
+
ReturnStrategy2["BLOCKING_TASK_INPUT"] = "BLOCKING_TASK_INPUT";
|
|
173
|
+
return ReturnStrategy2;
|
|
174
|
+
})(ReturnStrategy || {});
|
|
160
175
|
var TaskType = /* @__PURE__ */ ((TaskType2) => {
|
|
161
176
|
TaskType2["START"] = "START";
|
|
162
177
|
TaskType2["SIMPLE"] = "SIMPLE";
|
|
@@ -995,6 +1010,76 @@ var TaskResourceService = class {
|
|
|
995
1010
|
}
|
|
996
1011
|
});
|
|
997
1012
|
}
|
|
1013
|
+
/**
|
|
1014
|
+
* Update a task By Ref Name synchronously. The output data is merged if data from a previous API call already exists.
|
|
1015
|
+
* @param workflowId
|
|
1016
|
+
* @param taskRefName
|
|
1017
|
+
* @param status
|
|
1018
|
+
* @param output
|
|
1019
|
+
* @param workerId - Optional
|
|
1020
|
+
* @returns Workflow
|
|
1021
|
+
* @throws ApiError
|
|
1022
|
+
*/
|
|
1023
|
+
updateTaskSync(workflowId, taskRefName, status, output, workerId2) {
|
|
1024
|
+
return this.httpRequest.request({
|
|
1025
|
+
method: "POST",
|
|
1026
|
+
url: "/tasks/{workflowId}/{taskRefName}/{status}/sync",
|
|
1027
|
+
path: {
|
|
1028
|
+
"workflowId": workflowId,
|
|
1029
|
+
"taskRefName": taskRefName,
|
|
1030
|
+
"status": status
|
|
1031
|
+
},
|
|
1032
|
+
query: {
|
|
1033
|
+
"workerid": workerId2
|
|
1034
|
+
},
|
|
1035
|
+
body: output,
|
|
1036
|
+
mediaType: "application/json"
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
/**
|
|
1040
|
+
* Signals a task in a workflow synchronously and returns data based on the specified return strategy
|
|
1041
|
+
* @param workflowId - Workflow ID of the workflow to be signaled
|
|
1042
|
+
* @param status - Signal status to be set for the workflow
|
|
1043
|
+
* @param output - Output for the task
|
|
1044
|
+
* @param returnStrategy - Optional strategy for what data to return (defaults to TARGET_WORKFLOW)
|
|
1045
|
+
* @returns SignalResponse with data based on the return strategy
|
|
1046
|
+
* @throws ApiError
|
|
1047
|
+
*/
|
|
1048
|
+
signal(workflowId, status, output, returnStrategy = "TARGET_WORKFLOW" /* TARGET_WORKFLOW */) {
|
|
1049
|
+
return this.httpRequest.request({
|
|
1050
|
+
method: "POST",
|
|
1051
|
+
url: "/tasks/{workflowId}/{status}/signal/sync",
|
|
1052
|
+
path: {
|
|
1053
|
+
"workflowId": workflowId,
|
|
1054
|
+
"status": status
|
|
1055
|
+
},
|
|
1056
|
+
query: {
|
|
1057
|
+
"returnStrategy": returnStrategy
|
|
1058
|
+
},
|
|
1059
|
+
body: output,
|
|
1060
|
+
mediaType: "application/json"
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* Signals a task in a workflow asynchronously (fire-and-forget)
|
|
1065
|
+
* @param workflowId - Workflow ID of the workflow to be signaled
|
|
1066
|
+
* @param status - Signal status to be set for the workflow
|
|
1067
|
+
* @param output - Output for the task
|
|
1068
|
+
* @returns Promise<void>
|
|
1069
|
+
* @throws ApiError
|
|
1070
|
+
*/
|
|
1071
|
+
signalAsync(workflowId, status, output) {
|
|
1072
|
+
return this.httpRequest.request({
|
|
1073
|
+
method: "POST",
|
|
1074
|
+
url: "/tasks/{workflowId}/{status}/signal",
|
|
1075
|
+
path: {
|
|
1076
|
+
"workflowId": workflowId,
|
|
1077
|
+
"status": status
|
|
1078
|
+
},
|
|
1079
|
+
body: output,
|
|
1080
|
+
mediaType: "application/json"
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
998
1083
|
};
|
|
999
1084
|
|
|
1000
1085
|
// src/common/open-api/services/TokenResourceService.ts
|
|
@@ -1144,16 +1229,18 @@ var WorkflowResourceService = class {
|
|
|
1144
1229
|
}
|
|
1145
1230
|
/**
|
|
1146
1231
|
* Execute a workflow synchronously
|
|
1147
|
-
* @param body
|
|
1148
|
-
* @param name
|
|
1149
|
-
* @param version
|
|
1150
|
-
* @param requestId
|
|
1151
|
-
* @param waitUntilTaskRef
|
|
1152
|
-
* @param
|
|
1153
|
-
* @
|
|
1232
|
+
* @param body
|
|
1233
|
+
* @param name
|
|
1234
|
+
* @param version
|
|
1235
|
+
* @param requestId
|
|
1236
|
+
* @param waitUntilTaskRef
|
|
1237
|
+
* @param waitForSeconds - Optional, defaults to 10
|
|
1238
|
+
* @param consistency - Optional, defaults to "DURABLE"
|
|
1239
|
+
* @param returnStrategy - Optional, defaults to "TARGET_WORKFLOW"
|
|
1240
|
+
* @returns SignalResponse
|
|
1154
1241
|
* @throws ApiError
|
|
1155
1242
|
*/
|
|
1156
|
-
executeWorkflow(body, name, version, requestId, waitUntilTaskRef) {
|
|
1243
|
+
executeWorkflow(body, name, version, requestId, waitUntilTaskRef, waitForSeconds, consistency, returnStrategy) {
|
|
1157
1244
|
return this.httpRequest.request({
|
|
1158
1245
|
method: "POST",
|
|
1159
1246
|
url: "/workflow/execute/{name}/{version}",
|
|
@@ -1163,7 +1250,10 @@ var WorkflowResourceService = class {
|
|
|
1163
1250
|
},
|
|
1164
1251
|
query: {
|
|
1165
1252
|
"requestId": requestId,
|
|
1166
|
-
"waitUntilTaskRef": waitUntilTaskRef
|
|
1253
|
+
"waitUntilTaskRef": waitUntilTaskRef,
|
|
1254
|
+
"waitForSeconds": waitForSeconds,
|
|
1255
|
+
"consistency": consistency,
|
|
1256
|
+
"returnStrategy": returnStrategy
|
|
1167
1257
|
},
|
|
1168
1258
|
body,
|
|
1169
1259
|
mediaType: "application/json"
|
|
@@ -1742,15 +1832,15 @@ var getQueryString = (params) => {
|
|
|
1742
1832
|
const append = (key, value) => {
|
|
1743
1833
|
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
1744
1834
|
};
|
|
1745
|
-
const
|
|
1835
|
+
const process2 = (key, value) => {
|
|
1746
1836
|
if (isDefined(value)) {
|
|
1747
1837
|
if (Array.isArray(value)) {
|
|
1748
1838
|
value.forEach((v) => {
|
|
1749
|
-
|
|
1839
|
+
process2(key, v);
|
|
1750
1840
|
});
|
|
1751
1841
|
} else if (typeof value === "object") {
|
|
1752
1842
|
Object.entries(value).forEach(([k, v]) => {
|
|
1753
|
-
|
|
1843
|
+
process2(`${key}[${k}]`, v);
|
|
1754
1844
|
});
|
|
1755
1845
|
} else {
|
|
1756
1846
|
append(key, value);
|
|
@@ -1758,7 +1848,7 @@ var getQueryString = (params) => {
|
|
|
1758
1848
|
}
|
|
1759
1849
|
};
|
|
1760
1850
|
Object.entries(params).forEach(([key, value]) => {
|
|
1761
|
-
|
|
1851
|
+
process2(key, value);
|
|
1762
1852
|
});
|
|
1763
1853
|
if (qs.length > 0) {
|
|
1764
1854
|
return `?${qs.join("&")}`;
|
|
@@ -1782,7 +1872,7 @@ var getUrl = (config, options) => {
|
|
|
1782
1872
|
var getFormData = (options) => {
|
|
1783
1873
|
if (options.formData) {
|
|
1784
1874
|
const formData = new FormData();
|
|
1785
|
-
const
|
|
1875
|
+
const process2 = (key, value) => {
|
|
1786
1876
|
if (isString(value) || isBlob(value)) {
|
|
1787
1877
|
formData.append(key, value);
|
|
1788
1878
|
} else {
|
|
@@ -1791,9 +1881,9 @@ var getFormData = (options) => {
|
|
|
1791
1881
|
};
|
|
1792
1882
|
Object.entries(options.formData).filter(([_, value]) => isDefined(value)).forEach(([key, value]) => {
|
|
1793
1883
|
if (Array.isArray(value)) {
|
|
1794
|
-
value.forEach((v) =>
|
|
1884
|
+
value.forEach((v) => process2(key, v));
|
|
1795
1885
|
} else {
|
|
1796
|
-
|
|
1886
|
+
process2(key, value);
|
|
1797
1887
|
}
|
|
1798
1888
|
});
|
|
1799
1889
|
return formData;
|
|
@@ -2277,8 +2367,258 @@ var HumanTaskResourceService = class {
|
|
|
2277
2367
|
}
|
|
2278
2368
|
};
|
|
2279
2369
|
|
|
2370
|
+
// src/common/open-api/services/ServiceRegistryResourceService.ts
|
|
2371
|
+
var ServiceRegistryResourceService = class {
|
|
2372
|
+
constructor(httpRequest) {
|
|
2373
|
+
this.httpRequest = httpRequest;
|
|
2374
|
+
}
|
|
2375
|
+
/**
|
|
2376
|
+
* Retrieve all registered services
|
|
2377
|
+
* @returns Array<ServiceRegistryModels> List of all registered services
|
|
2378
|
+
* @throws ApiError
|
|
2379
|
+
*/
|
|
2380
|
+
getRegisteredServices() {
|
|
2381
|
+
return this.httpRequest.request({
|
|
2382
|
+
method: "GET",
|
|
2383
|
+
url: "/registry/service"
|
|
2384
|
+
});
|
|
2385
|
+
}
|
|
2386
|
+
/**
|
|
2387
|
+
* Remove a service by name
|
|
2388
|
+
* @param name The name of the service to remove
|
|
2389
|
+
* @returns void
|
|
2390
|
+
* @throws ApiError
|
|
2391
|
+
*/
|
|
2392
|
+
removeService(name) {
|
|
2393
|
+
return this.httpRequest.request({
|
|
2394
|
+
method: "DELETE",
|
|
2395
|
+
url: "/registry/service/{name}",
|
|
2396
|
+
path: {
|
|
2397
|
+
"name": name
|
|
2398
|
+
}
|
|
2399
|
+
});
|
|
2400
|
+
}
|
|
2401
|
+
/**
|
|
2402
|
+
* Get a service by name
|
|
2403
|
+
* @param name The name of the service to retrieve
|
|
2404
|
+
* @returns ServiceRegistryModels The requested service registry
|
|
2405
|
+
* @throws ApiError
|
|
2406
|
+
*/
|
|
2407
|
+
getService(name) {
|
|
2408
|
+
return this.httpRequest.request({
|
|
2409
|
+
method: "GET",
|
|
2410
|
+
url: "/registry/service/{name}",
|
|
2411
|
+
path: {
|
|
2412
|
+
"name": name
|
|
2413
|
+
}
|
|
2414
|
+
});
|
|
2415
|
+
}
|
|
2416
|
+
/**
|
|
2417
|
+
* Open the circuit breaker for a service
|
|
2418
|
+
* @param name The name of the service
|
|
2419
|
+
* @returns CircuitBreakerTransitionResponse Response with circuit breaker status
|
|
2420
|
+
* @throws ApiError
|
|
2421
|
+
*/
|
|
2422
|
+
openCircuitBreaker(name) {
|
|
2423
|
+
return this.httpRequest.request({
|
|
2424
|
+
method: "POST",
|
|
2425
|
+
url: "/registry/service/{name}/circuit-breaker/open",
|
|
2426
|
+
path: {
|
|
2427
|
+
"name": name
|
|
2428
|
+
}
|
|
2429
|
+
});
|
|
2430
|
+
}
|
|
2431
|
+
/**
|
|
2432
|
+
* Close the circuit breaker for a service
|
|
2433
|
+
* @param name The name of the service
|
|
2434
|
+
* @returns CircuitBreakerTransitionResponse Response with circuit breaker status
|
|
2435
|
+
* @throws ApiError
|
|
2436
|
+
*/
|
|
2437
|
+
closeCircuitBreaker(name) {
|
|
2438
|
+
return this.httpRequest.request({
|
|
2439
|
+
method: "POST",
|
|
2440
|
+
url: "/registry/service/{name}/circuit-breaker/close",
|
|
2441
|
+
path: {
|
|
2442
|
+
"name": name
|
|
2443
|
+
}
|
|
2444
|
+
});
|
|
2445
|
+
}
|
|
2446
|
+
/**
|
|
2447
|
+
* Get circuit breaker status for a service
|
|
2448
|
+
* @param name The name of the service
|
|
2449
|
+
* @returns CircuitBreakerTransitionResponse Response with circuit breaker status
|
|
2450
|
+
* @throws ApiError
|
|
2451
|
+
*/
|
|
2452
|
+
getCircuitBreakerStatus(name) {
|
|
2453
|
+
return this.httpRequest.request({
|
|
2454
|
+
method: "GET",
|
|
2455
|
+
url: "/registry/service/{name}/circuit-breaker/status",
|
|
2456
|
+
path: {
|
|
2457
|
+
"name": name
|
|
2458
|
+
}
|
|
2459
|
+
});
|
|
2460
|
+
}
|
|
2461
|
+
/**
|
|
2462
|
+
* Add or update a service registry
|
|
2463
|
+
* @param serviceRegistry The service registry to add or update
|
|
2464
|
+
* @returns void
|
|
2465
|
+
* @throws ApiError
|
|
2466
|
+
*/
|
|
2467
|
+
addOrUpdateService(serviceRegistry) {
|
|
2468
|
+
return this.httpRequest.request({
|
|
2469
|
+
method: "POST",
|
|
2470
|
+
url: "/registry/service",
|
|
2471
|
+
body: serviceRegistry,
|
|
2472
|
+
mediaType: "application/json"
|
|
2473
|
+
});
|
|
2474
|
+
}
|
|
2475
|
+
/**
|
|
2476
|
+
* Add or update a service method
|
|
2477
|
+
* @param registryName The name of the registry
|
|
2478
|
+
* @param method The service method to add or update
|
|
2479
|
+
* @returns void
|
|
2480
|
+
* @throws ApiError
|
|
2481
|
+
*/
|
|
2482
|
+
addOrUpdateServiceMethod(registryName, method) {
|
|
2483
|
+
return this.httpRequest.request({
|
|
2484
|
+
method: "POST",
|
|
2485
|
+
url: "/registry/service/{registryName}/methods",
|
|
2486
|
+
path: {
|
|
2487
|
+
"registryName": registryName
|
|
2488
|
+
},
|
|
2489
|
+
body: method,
|
|
2490
|
+
mediaType: "application/json"
|
|
2491
|
+
});
|
|
2492
|
+
}
|
|
2493
|
+
/**
|
|
2494
|
+
* Remove a service method
|
|
2495
|
+
* @param registryName The name of the registry
|
|
2496
|
+
* @param serviceName The name of the service
|
|
2497
|
+
* @param method The name of the method
|
|
2498
|
+
* @param methodType The type of the method
|
|
2499
|
+
* @returns void
|
|
2500
|
+
* @throws ApiError
|
|
2501
|
+
*/
|
|
2502
|
+
removeMethod(registryName, serviceName, method, methodType) {
|
|
2503
|
+
return this.httpRequest.request({
|
|
2504
|
+
method: "DELETE",
|
|
2505
|
+
url: "/registry/service/{registryName}/methods",
|
|
2506
|
+
path: {
|
|
2507
|
+
"registryName": registryName
|
|
2508
|
+
},
|
|
2509
|
+
query: {
|
|
2510
|
+
"serviceName": serviceName,
|
|
2511
|
+
"method": method,
|
|
2512
|
+
"methodType": methodType
|
|
2513
|
+
}
|
|
2514
|
+
});
|
|
2515
|
+
}
|
|
2516
|
+
/**
|
|
2517
|
+
* Get proto data
|
|
2518
|
+
* @param registryName The name of the registry
|
|
2519
|
+
* @param filename The name of the proto file
|
|
2520
|
+
* @returns binary The proto file data
|
|
2521
|
+
* @throws ApiError
|
|
2522
|
+
*/
|
|
2523
|
+
getProtoData(registryName, filename) {
|
|
2524
|
+
return this.httpRequest.request({
|
|
2525
|
+
method: "GET",
|
|
2526
|
+
url: "/registry/service/protos/{registryName}/{filename}",
|
|
2527
|
+
path: {
|
|
2528
|
+
"registryName": registryName,
|
|
2529
|
+
"filename": filename
|
|
2530
|
+
},
|
|
2531
|
+
headers: {
|
|
2532
|
+
"Accept": "application/octet-stream"
|
|
2533
|
+
}
|
|
2534
|
+
});
|
|
2535
|
+
}
|
|
2536
|
+
/**
|
|
2537
|
+
* Set proto data
|
|
2538
|
+
* @param registryName The name of the registry
|
|
2539
|
+
* @param filename The name of the proto file
|
|
2540
|
+
* @param data The proto file data
|
|
2541
|
+
* @returns void
|
|
2542
|
+
* @throws ApiError
|
|
2543
|
+
*/
|
|
2544
|
+
setProtoData(registryName, filename, data) {
|
|
2545
|
+
return this.httpRequest.request({
|
|
2546
|
+
method: "POST",
|
|
2547
|
+
url: "/registry/service/protos/{registryName}/{filename}",
|
|
2548
|
+
path: {
|
|
2549
|
+
"registryName": registryName,
|
|
2550
|
+
"filename": filename
|
|
2551
|
+
},
|
|
2552
|
+
body: data,
|
|
2553
|
+
mediaType: "application/octet-stream"
|
|
2554
|
+
});
|
|
2555
|
+
}
|
|
2556
|
+
/**
|
|
2557
|
+
* Delete a proto file
|
|
2558
|
+
* @param registryName The name of the registry
|
|
2559
|
+
* @param filename The name of the proto file
|
|
2560
|
+
* @returns void
|
|
2561
|
+
* @throws ApiError
|
|
2562
|
+
*/
|
|
2563
|
+
deleteProto(registryName, filename) {
|
|
2564
|
+
return this.httpRequest.request({
|
|
2565
|
+
method: "DELETE",
|
|
2566
|
+
url: "/registry/service/protos/{registryName}/{filename}",
|
|
2567
|
+
path: {
|
|
2568
|
+
"registryName": registryName,
|
|
2569
|
+
"filename": filename
|
|
2570
|
+
}
|
|
2571
|
+
});
|
|
2572
|
+
}
|
|
2573
|
+
/**
|
|
2574
|
+
* Get all proto files for a registry
|
|
2575
|
+
* @param registryName The name of the registry
|
|
2576
|
+
* @returns Array<ProtoRegistryEntry> List of proto registry entries
|
|
2577
|
+
* @throws ApiError
|
|
2578
|
+
*/
|
|
2579
|
+
getAllProtos(registryName) {
|
|
2580
|
+
return this.httpRequest.request({
|
|
2581
|
+
method: "GET",
|
|
2582
|
+
url: "/registry/service/protos/{registryName}",
|
|
2583
|
+
path: {
|
|
2584
|
+
"registryName": registryName
|
|
2585
|
+
}
|
|
2586
|
+
});
|
|
2587
|
+
}
|
|
2588
|
+
/**
|
|
2589
|
+
* Discover service methods
|
|
2590
|
+
* @param name The name of the service
|
|
2591
|
+
* @param create Whether to create the discovered methods (defaults to false)
|
|
2592
|
+
* @returns Array<ServiceMethod> The discovered service methods
|
|
2593
|
+
* @throws ApiError
|
|
2594
|
+
*/
|
|
2595
|
+
discover(name, create = false) {
|
|
2596
|
+
return this.httpRequest.request({
|
|
2597
|
+
method: "GET",
|
|
2598
|
+
url: "/registry/service/{name}/discover",
|
|
2599
|
+
path: {
|
|
2600
|
+
"name": name
|
|
2601
|
+
},
|
|
2602
|
+
query: {
|
|
2603
|
+
"create": create
|
|
2604
|
+
}
|
|
2605
|
+
});
|
|
2606
|
+
}
|
|
2607
|
+
};
|
|
2608
|
+
|
|
2280
2609
|
// src/common/open-api/ConductorClient.ts
|
|
2281
2610
|
var defaultRequestHandler = (request3, config, options) => request3(config, options);
|
|
2611
|
+
var getServerBaseURL = (config) => {
|
|
2612
|
+
if (config?.useEnvVars) {
|
|
2613
|
+
if (!process.env.CONDUCTOR_SERVER_URL) {
|
|
2614
|
+
throw new Error(
|
|
2615
|
+
"Environment variable CONDUCTOR_SERVER_URL is not defined."
|
|
2616
|
+
);
|
|
2617
|
+
}
|
|
2618
|
+
return process.env.CONDUCTOR_SERVER_URL;
|
|
2619
|
+
}
|
|
2620
|
+
return config?.serverUrl ?? "http://localhost:8080";
|
|
2621
|
+
};
|
|
2282
2622
|
var ConductorClient = class {
|
|
2283
2623
|
eventResource;
|
|
2284
2624
|
healthCheckResource;
|
|
@@ -2288,13 +2628,14 @@ var ConductorClient = class {
|
|
|
2288
2628
|
tokenResource;
|
|
2289
2629
|
workflowBulkResource;
|
|
2290
2630
|
workflowResource;
|
|
2631
|
+
serviceRegistryResource;
|
|
2291
2632
|
humanTask;
|
|
2292
2633
|
humanTaskResource;
|
|
2293
2634
|
request;
|
|
2294
2635
|
token;
|
|
2295
2636
|
constructor(config, requestHandler = defaultRequestHandler) {
|
|
2296
2637
|
const resolvedConfig = {
|
|
2297
|
-
BASE: config
|
|
2638
|
+
BASE: getServerBaseURL(config),
|
|
2298
2639
|
VERSION: config?.VERSION ?? "0",
|
|
2299
2640
|
WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
|
|
2300
2641
|
CREDENTIALS: config?.CREDENTIALS ?? "include",
|
|
@@ -2323,6 +2664,7 @@ var ConductorClient = class {
|
|
|
2323
2664
|
this.tokenResource = new TokenResourceService(this.request);
|
|
2324
2665
|
this.workflowBulkResource = new WorkflowBulkResourceService(this.request);
|
|
2325
2666
|
this.workflowResource = new WorkflowResourceService(this.request);
|
|
2667
|
+
this.serviceRegistryResource = new ServiceRegistryResourceService(this.request);
|
|
2326
2668
|
this.humanTask = new HumanTaskService(this.request);
|
|
2327
2669
|
this.humanTaskResource = new HumanTaskResourceService(this.request);
|
|
2328
2670
|
}
|
|
@@ -2778,19 +3120,18 @@ var WorkflowExecutor = class {
|
|
|
2778
3120
|
() => this._client.workflowResource.startWorkflow(workflowRequest)
|
|
2779
3121
|
);
|
|
2780
3122
|
}
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
* @param workflowRequest
|
|
2784
|
-
* @returns
|
|
2785
|
-
*/
|
|
2786
|
-
executeWorkflow(workflowRequest, name, version, requestId, waitUntilTaskRef = "") {
|
|
3123
|
+
// Implementation
|
|
3124
|
+
executeWorkflow(workflowRequest, name, version, requestId, waitUntilTaskRef = "", waitForSeconds, consistency, returnStrategy) {
|
|
2787
3125
|
return tryCatchReThrow(
|
|
2788
3126
|
() => this._client.workflowResource.executeWorkflow(
|
|
2789
3127
|
workflowRequest,
|
|
2790
3128
|
name,
|
|
2791
3129
|
version,
|
|
2792
3130
|
requestId,
|
|
2793
|
-
waitUntilTaskRef
|
|
3131
|
+
waitUntilTaskRef,
|
|
3132
|
+
waitForSeconds,
|
|
3133
|
+
consistency,
|
|
3134
|
+
returnStrategy
|
|
2794
3135
|
)
|
|
2795
3136
|
);
|
|
2796
3137
|
}
|
|
@@ -3043,6 +3384,60 @@ var WorkflowExecutor = class {
|
|
|
3043
3384
|
getTask(taskId) {
|
|
3044
3385
|
return tryCatchReThrow(() => this._client.taskResource.getTask(taskId));
|
|
3045
3386
|
}
|
|
3387
|
+
/**
|
|
3388
|
+
* Updates a task by reference name synchronously and returns the complete workflow
|
|
3389
|
+
* @param taskReferenceName
|
|
3390
|
+
* @param workflowInstanceId
|
|
3391
|
+
* @param status
|
|
3392
|
+
* @param taskOutput
|
|
3393
|
+
* @param workerId - Optional
|
|
3394
|
+
* @returns Promise<Workflow>
|
|
3395
|
+
*/
|
|
3396
|
+
updateTaskSync(taskReferenceName, workflowInstanceId, status, taskOutput, workerId2) {
|
|
3397
|
+
return tryCatchReThrow(
|
|
3398
|
+
() => this._client.taskResource.updateTaskSync(
|
|
3399
|
+
workflowInstanceId,
|
|
3400
|
+
taskReferenceName,
|
|
3401
|
+
status,
|
|
3402
|
+
taskOutput,
|
|
3403
|
+
workerId2
|
|
3404
|
+
)
|
|
3405
|
+
);
|
|
3406
|
+
}
|
|
3407
|
+
/**
|
|
3408
|
+
* Signals a workflow task and returns data based on the specified return strategy
|
|
3409
|
+
* @param workflowInstanceId - Workflow instance ID to signal
|
|
3410
|
+
* @param status - Task status to set
|
|
3411
|
+
* @param taskOutput - Output data for the task
|
|
3412
|
+
* @param returnStrategy - Optional strategy for what data to return (defaults to TARGET_WORKFLOW)
|
|
3413
|
+
* @returns Promise<SignalResponse> with data based on the return strategy
|
|
3414
|
+
*/
|
|
3415
|
+
signal(workflowInstanceId, status, taskOutput, returnStrategy = "TARGET_WORKFLOW" /* TARGET_WORKFLOW */) {
|
|
3416
|
+
return tryCatchReThrow(
|
|
3417
|
+
() => this._client.taskResource.signal(
|
|
3418
|
+
workflowInstanceId,
|
|
3419
|
+
status,
|
|
3420
|
+
taskOutput,
|
|
3421
|
+
returnStrategy
|
|
3422
|
+
)
|
|
3423
|
+
);
|
|
3424
|
+
}
|
|
3425
|
+
/**
|
|
3426
|
+
* Signals a workflow task asynchronously (fire-and-forget)
|
|
3427
|
+
* @param workflowInstanceId - Workflow instance ID to signal
|
|
3428
|
+
* @param status - Task status to set
|
|
3429
|
+
* @param taskOutput - Output data for the task
|
|
3430
|
+
* @returns Promise<void>
|
|
3431
|
+
*/
|
|
3432
|
+
signalAsync(workflowInstanceId, status, taskOutput) {
|
|
3433
|
+
return tryCatchReThrow(
|
|
3434
|
+
() => this._client.taskResource.signalAsync(
|
|
3435
|
+
workflowInstanceId,
|
|
3436
|
+
status,
|
|
3437
|
+
taskOutput
|
|
3438
|
+
)
|
|
3439
|
+
);
|
|
3440
|
+
}
|
|
3046
3441
|
};
|
|
3047
3442
|
|
|
3048
3443
|
// src/core/human.ts
|
|
@@ -3343,6 +3738,7 @@ var generateHTTPTask = (overrides = {}) => ({
|
|
|
3343
3738
|
method: "GET"
|
|
3344
3739
|
}
|
|
3345
3740
|
},
|
|
3741
|
+
asyncComplete: false,
|
|
3346
3742
|
...overrides,
|
|
3347
3743
|
type: "HTTP" /* HTTP */
|
|
3348
3744
|
});
|
|
@@ -3577,12 +3973,13 @@ var forkTaskJoin = (taskReferenceName, forkTasks) => [
|
|
|
3577
3973
|
];
|
|
3578
3974
|
|
|
3579
3975
|
// src/core/sdk/http.ts
|
|
3580
|
-
var httpTask = (taskReferenceName, inputParameters) => ({
|
|
3976
|
+
var httpTask = (taskReferenceName, inputParameters, asyncComplete = false) => ({
|
|
3581
3977
|
name: taskReferenceName,
|
|
3582
3978
|
taskReferenceName,
|
|
3583
3979
|
inputParameters: {
|
|
3584
3980
|
http_request: inputParameters
|
|
3585
3981
|
},
|
|
3982
|
+
asyncComplete,
|
|
3586
3983
|
type: "HTTP" /* HTTP */
|
|
3587
3984
|
});
|
|
3588
3985
|
|
|
@@ -4014,6 +4411,18 @@ var MetadataClient = class {
|
|
|
4014
4411
|
() => this._client.metadataResource.create(workflowDef, overwrite)
|
|
4015
4412
|
);
|
|
4016
4413
|
}
|
|
4414
|
+
/**
|
|
4415
|
+
* Unregister (overwrite: true) a workflow definition
|
|
4416
|
+
*
|
|
4417
|
+
* @param workflowDef
|
|
4418
|
+
* @param overwrite
|
|
4419
|
+
* @returns
|
|
4420
|
+
*/
|
|
4421
|
+
unregisterWorkflow(workflowName, version = 1) {
|
|
4422
|
+
return tryCatchReThrow(
|
|
4423
|
+
() => this._client.metadataResource.unregisterWorkflowDef(workflowName, version)
|
|
4424
|
+
);
|
|
4425
|
+
}
|
|
4017
4426
|
};
|
|
4018
4427
|
|
|
4019
4428
|
// src/orkes/BaseOrkesConductorClient.ts
|
|
@@ -4043,6 +4452,16 @@ var baseOrkesConductorClient = (fetchFn, baseRequestHandler = defaultRequestHand
|
|
|
4043
4452
|
method: "POST"
|
|
4044
4453
|
});
|
|
4045
4454
|
return async (config, requestHandler = baseRequestHandler) => {
|
|
4455
|
+
if (config?.useEnvVars) {
|
|
4456
|
+
if (!process.env.CONDUCTOR_SERVER_URL) {
|
|
4457
|
+
throw new Error(
|
|
4458
|
+
"Environment variable CONDUCTOR_SERVER_URL is not defined."
|
|
4459
|
+
);
|
|
4460
|
+
}
|
|
4461
|
+
config.serverUrl = process.env.CONDUCTOR_SERVER_URL;
|
|
4462
|
+
config.keyId = process.env.CONDUCTOR_AUTH_KEY;
|
|
4463
|
+
config.keySecret = process.env.CONDUCTOR_AUTH_SECRET;
|
|
4464
|
+
}
|
|
4046
4465
|
if (config?.keySecret != null && config?.keyId != null) {
|
|
4047
4466
|
const {
|
|
4048
4467
|
serverUrl,
|
|
@@ -4111,15 +4530,15 @@ var getQueryString2 = (params) => {
|
|
|
4111
4530
|
const append = (key, value) => {
|
|
4112
4531
|
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
4113
4532
|
};
|
|
4114
|
-
const
|
|
4533
|
+
const process2 = (key, value) => {
|
|
4115
4534
|
if (isDefined2(value)) {
|
|
4116
4535
|
if (Array.isArray(value)) {
|
|
4117
4536
|
value.forEach((v) => {
|
|
4118
|
-
|
|
4537
|
+
process2(key, v);
|
|
4119
4538
|
});
|
|
4120
4539
|
} else if (typeof value === "object") {
|
|
4121
4540
|
Object.entries(value).forEach(([k, v]) => {
|
|
4122
|
-
|
|
4541
|
+
process2(`${key}[${k}]`, v);
|
|
4123
4542
|
});
|
|
4124
4543
|
} else {
|
|
4125
4544
|
append(key, value);
|
|
@@ -4127,7 +4546,7 @@ var getQueryString2 = (params) => {
|
|
|
4127
4546
|
}
|
|
4128
4547
|
};
|
|
4129
4548
|
Object.entries(params).forEach(([key, value]) => {
|
|
4130
|
-
|
|
4549
|
+
process2(key, value);
|
|
4131
4550
|
});
|
|
4132
4551
|
if (qs.length > 0) {
|
|
4133
4552
|
return `?${qs.join("&")}`;
|
|
@@ -4151,7 +4570,7 @@ var getUrl2 = (config, options) => {
|
|
|
4151
4570
|
var getFormData2 = (options) => {
|
|
4152
4571
|
if (options.formData) {
|
|
4153
4572
|
const formData = new FormData();
|
|
4154
|
-
const
|
|
4573
|
+
const process2 = (key, value) => {
|
|
4155
4574
|
if (isString2(value) || isBlob2(value)) {
|
|
4156
4575
|
formData.append(key, value);
|
|
4157
4576
|
} else {
|
|
@@ -4160,9 +4579,9 @@ var getFormData2 = (options) => {
|
|
|
4160
4579
|
};
|
|
4161
4580
|
Object.entries(options.formData).filter(([_, value]) => isDefined2(value)).forEach(([key, value]) => {
|
|
4162
4581
|
if (Array.isArray(value)) {
|
|
4163
|
-
value.forEach((v) =>
|
|
4582
|
+
value.forEach((v) => process2(key, v));
|
|
4164
4583
|
} else {
|
|
4165
|
-
|
|
4584
|
+
process2(key, value);
|
|
4166
4585
|
}
|
|
4167
4586
|
});
|
|
4168
4587
|
return formData;
|
|
@@ -4326,6 +4745,7 @@ var request2 = (config, options, fetchFn = fetch) => {
|
|
|
4326
4745
|
CancelablePromise,
|
|
4327
4746
|
ConductorClient,
|
|
4328
4747
|
ConductorError,
|
|
4748
|
+
Consistency,
|
|
4329
4749
|
DefaultLogger,
|
|
4330
4750
|
EventResourceService,
|
|
4331
4751
|
HealthCheckResourceService,
|
|
@@ -4333,6 +4753,7 @@ var request2 = (config, options, fetchFn = fetch) => {
|
|
|
4333
4753
|
MAX_RETRIES,
|
|
4334
4754
|
MetadataClient,
|
|
4335
4755
|
MetadataResourceService,
|
|
4756
|
+
ReturnStrategy,
|
|
4336
4757
|
SchedulerClient,
|
|
4337
4758
|
SchedulerResourceService,
|
|
4338
4759
|
TaskClient,
|