@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.mjs
CHANGED
|
@@ -52,6 +52,19 @@ var noopLogger = {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
// src/common/types.ts
|
|
55
|
+
var Consistency = /* @__PURE__ */ ((Consistency3) => {
|
|
56
|
+
Consistency3["SYNCHRONOUS"] = "SYNCHRONOUS";
|
|
57
|
+
Consistency3["DURABLE"] = "DURABLE";
|
|
58
|
+
Consistency3["REGION_DURABLE"] = "REGION_DURABLE";
|
|
59
|
+
return Consistency3;
|
|
60
|
+
})(Consistency || {});
|
|
61
|
+
var ReturnStrategy = /* @__PURE__ */ ((ReturnStrategy2) => {
|
|
62
|
+
ReturnStrategy2["TARGET_WORKFLOW"] = "TARGET_WORKFLOW";
|
|
63
|
+
ReturnStrategy2["BLOCKING_WORKFLOW"] = "BLOCKING_WORKFLOW";
|
|
64
|
+
ReturnStrategy2["BLOCKING_TASK"] = "BLOCKING_TASK";
|
|
65
|
+
ReturnStrategy2["BLOCKING_TASK_INPUT"] = "BLOCKING_TASK_INPUT";
|
|
66
|
+
return ReturnStrategy2;
|
|
67
|
+
})(ReturnStrategy || {});
|
|
55
68
|
var TaskType = /* @__PURE__ */ ((TaskType2) => {
|
|
56
69
|
TaskType2["START"] = "START";
|
|
57
70
|
TaskType2["SIMPLE"] = "SIMPLE";
|
|
@@ -890,6 +903,76 @@ var TaskResourceService = class {
|
|
|
890
903
|
}
|
|
891
904
|
});
|
|
892
905
|
}
|
|
906
|
+
/**
|
|
907
|
+
* Update a task By Ref Name synchronously. The output data is merged if data from a previous API call already exists.
|
|
908
|
+
* @param workflowId
|
|
909
|
+
* @param taskRefName
|
|
910
|
+
* @param status
|
|
911
|
+
* @param output
|
|
912
|
+
* @param workerId - Optional
|
|
913
|
+
* @returns Workflow
|
|
914
|
+
* @throws ApiError
|
|
915
|
+
*/
|
|
916
|
+
updateTaskSync(workflowId, taskRefName, status, output, workerId2) {
|
|
917
|
+
return this.httpRequest.request({
|
|
918
|
+
method: "POST",
|
|
919
|
+
url: "/tasks/{workflowId}/{taskRefName}/{status}/sync",
|
|
920
|
+
path: {
|
|
921
|
+
"workflowId": workflowId,
|
|
922
|
+
"taskRefName": taskRefName,
|
|
923
|
+
"status": status
|
|
924
|
+
},
|
|
925
|
+
query: {
|
|
926
|
+
"workerid": workerId2
|
|
927
|
+
},
|
|
928
|
+
body: output,
|
|
929
|
+
mediaType: "application/json"
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Signals a task in a workflow synchronously and returns data based on the specified return strategy
|
|
934
|
+
* @param workflowId - Workflow ID of the workflow to be signaled
|
|
935
|
+
* @param status - Signal status to be set for the workflow
|
|
936
|
+
* @param output - Output for the task
|
|
937
|
+
* @param returnStrategy - Optional strategy for what data to return (defaults to TARGET_WORKFLOW)
|
|
938
|
+
* @returns SignalResponse with data based on the return strategy
|
|
939
|
+
* @throws ApiError
|
|
940
|
+
*/
|
|
941
|
+
signal(workflowId, status, output, returnStrategy = "TARGET_WORKFLOW" /* TARGET_WORKFLOW */) {
|
|
942
|
+
return this.httpRequest.request({
|
|
943
|
+
method: "POST",
|
|
944
|
+
url: "/tasks/{workflowId}/{status}/signal/sync",
|
|
945
|
+
path: {
|
|
946
|
+
"workflowId": workflowId,
|
|
947
|
+
"status": status
|
|
948
|
+
},
|
|
949
|
+
query: {
|
|
950
|
+
"returnStrategy": returnStrategy
|
|
951
|
+
},
|
|
952
|
+
body: output,
|
|
953
|
+
mediaType: "application/json"
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Signals a task in a workflow asynchronously (fire-and-forget)
|
|
958
|
+
* @param workflowId - Workflow ID of the workflow to be signaled
|
|
959
|
+
* @param status - Signal status to be set for the workflow
|
|
960
|
+
* @param output - Output for the task
|
|
961
|
+
* @returns Promise<void>
|
|
962
|
+
* @throws ApiError
|
|
963
|
+
*/
|
|
964
|
+
signalAsync(workflowId, status, output) {
|
|
965
|
+
return this.httpRequest.request({
|
|
966
|
+
method: "POST",
|
|
967
|
+
url: "/tasks/{workflowId}/{status}/signal",
|
|
968
|
+
path: {
|
|
969
|
+
"workflowId": workflowId,
|
|
970
|
+
"status": status
|
|
971
|
+
},
|
|
972
|
+
body: output,
|
|
973
|
+
mediaType: "application/json"
|
|
974
|
+
});
|
|
975
|
+
}
|
|
893
976
|
};
|
|
894
977
|
|
|
895
978
|
// src/common/open-api/services/TokenResourceService.ts
|
|
@@ -1039,16 +1122,18 @@ var WorkflowResourceService = class {
|
|
|
1039
1122
|
}
|
|
1040
1123
|
/**
|
|
1041
1124
|
* Execute a workflow synchronously
|
|
1042
|
-
* @param body
|
|
1043
|
-
* @param name
|
|
1044
|
-
* @param version
|
|
1045
|
-
* @param requestId
|
|
1046
|
-
* @param waitUntilTaskRef
|
|
1047
|
-
* @param
|
|
1048
|
-
* @
|
|
1125
|
+
* @param body
|
|
1126
|
+
* @param name
|
|
1127
|
+
* @param version
|
|
1128
|
+
* @param requestId
|
|
1129
|
+
* @param waitUntilTaskRef
|
|
1130
|
+
* @param waitForSeconds - Optional, defaults to 10
|
|
1131
|
+
* @param consistency - Optional, defaults to "DURABLE"
|
|
1132
|
+
* @param returnStrategy - Optional, defaults to "TARGET_WORKFLOW"
|
|
1133
|
+
* @returns SignalResponse
|
|
1049
1134
|
* @throws ApiError
|
|
1050
1135
|
*/
|
|
1051
|
-
executeWorkflow(body, name, version, requestId, waitUntilTaskRef) {
|
|
1136
|
+
executeWorkflow(body, name, version, requestId, waitUntilTaskRef, waitForSeconds, consistency, returnStrategy) {
|
|
1052
1137
|
return this.httpRequest.request({
|
|
1053
1138
|
method: "POST",
|
|
1054
1139
|
url: "/workflow/execute/{name}/{version}",
|
|
@@ -1058,7 +1143,10 @@ var WorkflowResourceService = class {
|
|
|
1058
1143
|
},
|
|
1059
1144
|
query: {
|
|
1060
1145
|
"requestId": requestId,
|
|
1061
|
-
"waitUntilTaskRef": waitUntilTaskRef
|
|
1146
|
+
"waitUntilTaskRef": waitUntilTaskRef,
|
|
1147
|
+
"waitForSeconds": waitForSeconds,
|
|
1148
|
+
"consistency": consistency,
|
|
1149
|
+
"returnStrategy": returnStrategy
|
|
1062
1150
|
},
|
|
1063
1151
|
body,
|
|
1064
1152
|
mediaType: "application/json"
|
|
@@ -1637,15 +1725,15 @@ var getQueryString = (params) => {
|
|
|
1637
1725
|
const append = (key, value) => {
|
|
1638
1726
|
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
1639
1727
|
};
|
|
1640
|
-
const
|
|
1728
|
+
const process2 = (key, value) => {
|
|
1641
1729
|
if (isDefined(value)) {
|
|
1642
1730
|
if (Array.isArray(value)) {
|
|
1643
1731
|
value.forEach((v) => {
|
|
1644
|
-
|
|
1732
|
+
process2(key, v);
|
|
1645
1733
|
});
|
|
1646
1734
|
} else if (typeof value === "object") {
|
|
1647
1735
|
Object.entries(value).forEach(([k, v]) => {
|
|
1648
|
-
|
|
1736
|
+
process2(`${key}[${k}]`, v);
|
|
1649
1737
|
});
|
|
1650
1738
|
} else {
|
|
1651
1739
|
append(key, value);
|
|
@@ -1653,7 +1741,7 @@ var getQueryString = (params) => {
|
|
|
1653
1741
|
}
|
|
1654
1742
|
};
|
|
1655
1743
|
Object.entries(params).forEach(([key, value]) => {
|
|
1656
|
-
|
|
1744
|
+
process2(key, value);
|
|
1657
1745
|
});
|
|
1658
1746
|
if (qs.length > 0) {
|
|
1659
1747
|
return `?${qs.join("&")}`;
|
|
@@ -1677,7 +1765,7 @@ var getUrl = (config, options) => {
|
|
|
1677
1765
|
var getFormData = (options) => {
|
|
1678
1766
|
if (options.formData) {
|
|
1679
1767
|
const formData = new FormData();
|
|
1680
|
-
const
|
|
1768
|
+
const process2 = (key, value) => {
|
|
1681
1769
|
if (isString(value) || isBlob(value)) {
|
|
1682
1770
|
formData.append(key, value);
|
|
1683
1771
|
} else {
|
|
@@ -1686,9 +1774,9 @@ var getFormData = (options) => {
|
|
|
1686
1774
|
};
|
|
1687
1775
|
Object.entries(options.formData).filter(([_, value]) => isDefined(value)).forEach(([key, value]) => {
|
|
1688
1776
|
if (Array.isArray(value)) {
|
|
1689
|
-
value.forEach((v) =>
|
|
1777
|
+
value.forEach((v) => process2(key, v));
|
|
1690
1778
|
} else {
|
|
1691
|
-
|
|
1779
|
+
process2(key, value);
|
|
1692
1780
|
}
|
|
1693
1781
|
});
|
|
1694
1782
|
return formData;
|
|
@@ -2172,8 +2260,258 @@ var HumanTaskResourceService = class {
|
|
|
2172
2260
|
}
|
|
2173
2261
|
};
|
|
2174
2262
|
|
|
2263
|
+
// src/common/open-api/services/ServiceRegistryResourceService.ts
|
|
2264
|
+
var ServiceRegistryResourceService = class {
|
|
2265
|
+
constructor(httpRequest) {
|
|
2266
|
+
this.httpRequest = httpRequest;
|
|
2267
|
+
}
|
|
2268
|
+
/**
|
|
2269
|
+
* Retrieve all registered services
|
|
2270
|
+
* @returns Array<ServiceRegistryModels> List of all registered services
|
|
2271
|
+
* @throws ApiError
|
|
2272
|
+
*/
|
|
2273
|
+
getRegisteredServices() {
|
|
2274
|
+
return this.httpRequest.request({
|
|
2275
|
+
method: "GET",
|
|
2276
|
+
url: "/registry/service"
|
|
2277
|
+
});
|
|
2278
|
+
}
|
|
2279
|
+
/**
|
|
2280
|
+
* Remove a service by name
|
|
2281
|
+
* @param name The name of the service to remove
|
|
2282
|
+
* @returns void
|
|
2283
|
+
* @throws ApiError
|
|
2284
|
+
*/
|
|
2285
|
+
removeService(name) {
|
|
2286
|
+
return this.httpRequest.request({
|
|
2287
|
+
method: "DELETE",
|
|
2288
|
+
url: "/registry/service/{name}",
|
|
2289
|
+
path: {
|
|
2290
|
+
"name": name
|
|
2291
|
+
}
|
|
2292
|
+
});
|
|
2293
|
+
}
|
|
2294
|
+
/**
|
|
2295
|
+
* Get a service by name
|
|
2296
|
+
* @param name The name of the service to retrieve
|
|
2297
|
+
* @returns ServiceRegistryModels The requested service registry
|
|
2298
|
+
* @throws ApiError
|
|
2299
|
+
*/
|
|
2300
|
+
getService(name) {
|
|
2301
|
+
return this.httpRequest.request({
|
|
2302
|
+
method: "GET",
|
|
2303
|
+
url: "/registry/service/{name}",
|
|
2304
|
+
path: {
|
|
2305
|
+
"name": name
|
|
2306
|
+
}
|
|
2307
|
+
});
|
|
2308
|
+
}
|
|
2309
|
+
/**
|
|
2310
|
+
* Open the circuit breaker for a service
|
|
2311
|
+
* @param name The name of the service
|
|
2312
|
+
* @returns CircuitBreakerTransitionResponse Response with circuit breaker status
|
|
2313
|
+
* @throws ApiError
|
|
2314
|
+
*/
|
|
2315
|
+
openCircuitBreaker(name) {
|
|
2316
|
+
return this.httpRequest.request({
|
|
2317
|
+
method: "POST",
|
|
2318
|
+
url: "/registry/service/{name}/circuit-breaker/open",
|
|
2319
|
+
path: {
|
|
2320
|
+
"name": name
|
|
2321
|
+
}
|
|
2322
|
+
});
|
|
2323
|
+
}
|
|
2324
|
+
/**
|
|
2325
|
+
* Close the circuit breaker for a service
|
|
2326
|
+
* @param name The name of the service
|
|
2327
|
+
* @returns CircuitBreakerTransitionResponse Response with circuit breaker status
|
|
2328
|
+
* @throws ApiError
|
|
2329
|
+
*/
|
|
2330
|
+
closeCircuitBreaker(name) {
|
|
2331
|
+
return this.httpRequest.request({
|
|
2332
|
+
method: "POST",
|
|
2333
|
+
url: "/registry/service/{name}/circuit-breaker/close",
|
|
2334
|
+
path: {
|
|
2335
|
+
"name": name
|
|
2336
|
+
}
|
|
2337
|
+
});
|
|
2338
|
+
}
|
|
2339
|
+
/**
|
|
2340
|
+
* Get circuit breaker status for a service
|
|
2341
|
+
* @param name The name of the service
|
|
2342
|
+
* @returns CircuitBreakerTransitionResponse Response with circuit breaker status
|
|
2343
|
+
* @throws ApiError
|
|
2344
|
+
*/
|
|
2345
|
+
getCircuitBreakerStatus(name) {
|
|
2346
|
+
return this.httpRequest.request({
|
|
2347
|
+
method: "GET",
|
|
2348
|
+
url: "/registry/service/{name}/circuit-breaker/status",
|
|
2349
|
+
path: {
|
|
2350
|
+
"name": name
|
|
2351
|
+
}
|
|
2352
|
+
});
|
|
2353
|
+
}
|
|
2354
|
+
/**
|
|
2355
|
+
* Add or update a service registry
|
|
2356
|
+
* @param serviceRegistry The service registry to add or update
|
|
2357
|
+
* @returns void
|
|
2358
|
+
* @throws ApiError
|
|
2359
|
+
*/
|
|
2360
|
+
addOrUpdateService(serviceRegistry) {
|
|
2361
|
+
return this.httpRequest.request({
|
|
2362
|
+
method: "POST",
|
|
2363
|
+
url: "/registry/service",
|
|
2364
|
+
body: serviceRegistry,
|
|
2365
|
+
mediaType: "application/json"
|
|
2366
|
+
});
|
|
2367
|
+
}
|
|
2368
|
+
/**
|
|
2369
|
+
* Add or update a service method
|
|
2370
|
+
* @param registryName The name of the registry
|
|
2371
|
+
* @param method The service method to add or update
|
|
2372
|
+
* @returns void
|
|
2373
|
+
* @throws ApiError
|
|
2374
|
+
*/
|
|
2375
|
+
addOrUpdateServiceMethod(registryName, method) {
|
|
2376
|
+
return this.httpRequest.request({
|
|
2377
|
+
method: "POST",
|
|
2378
|
+
url: "/registry/service/{registryName}/methods",
|
|
2379
|
+
path: {
|
|
2380
|
+
"registryName": registryName
|
|
2381
|
+
},
|
|
2382
|
+
body: method,
|
|
2383
|
+
mediaType: "application/json"
|
|
2384
|
+
});
|
|
2385
|
+
}
|
|
2386
|
+
/**
|
|
2387
|
+
* Remove a service method
|
|
2388
|
+
* @param registryName The name of the registry
|
|
2389
|
+
* @param serviceName The name of the service
|
|
2390
|
+
* @param method The name of the method
|
|
2391
|
+
* @param methodType The type of the method
|
|
2392
|
+
* @returns void
|
|
2393
|
+
* @throws ApiError
|
|
2394
|
+
*/
|
|
2395
|
+
removeMethod(registryName, serviceName, method, methodType) {
|
|
2396
|
+
return this.httpRequest.request({
|
|
2397
|
+
method: "DELETE",
|
|
2398
|
+
url: "/registry/service/{registryName}/methods",
|
|
2399
|
+
path: {
|
|
2400
|
+
"registryName": registryName
|
|
2401
|
+
},
|
|
2402
|
+
query: {
|
|
2403
|
+
"serviceName": serviceName,
|
|
2404
|
+
"method": method,
|
|
2405
|
+
"methodType": methodType
|
|
2406
|
+
}
|
|
2407
|
+
});
|
|
2408
|
+
}
|
|
2409
|
+
/**
|
|
2410
|
+
* Get proto data
|
|
2411
|
+
* @param registryName The name of the registry
|
|
2412
|
+
* @param filename The name of the proto file
|
|
2413
|
+
* @returns binary The proto file data
|
|
2414
|
+
* @throws ApiError
|
|
2415
|
+
*/
|
|
2416
|
+
getProtoData(registryName, filename) {
|
|
2417
|
+
return this.httpRequest.request({
|
|
2418
|
+
method: "GET",
|
|
2419
|
+
url: "/registry/service/protos/{registryName}/{filename}",
|
|
2420
|
+
path: {
|
|
2421
|
+
"registryName": registryName,
|
|
2422
|
+
"filename": filename
|
|
2423
|
+
},
|
|
2424
|
+
headers: {
|
|
2425
|
+
"Accept": "application/octet-stream"
|
|
2426
|
+
}
|
|
2427
|
+
});
|
|
2428
|
+
}
|
|
2429
|
+
/**
|
|
2430
|
+
* Set proto data
|
|
2431
|
+
* @param registryName The name of the registry
|
|
2432
|
+
* @param filename The name of the proto file
|
|
2433
|
+
* @param data The proto file data
|
|
2434
|
+
* @returns void
|
|
2435
|
+
* @throws ApiError
|
|
2436
|
+
*/
|
|
2437
|
+
setProtoData(registryName, filename, data) {
|
|
2438
|
+
return this.httpRequest.request({
|
|
2439
|
+
method: "POST",
|
|
2440
|
+
url: "/registry/service/protos/{registryName}/{filename}",
|
|
2441
|
+
path: {
|
|
2442
|
+
"registryName": registryName,
|
|
2443
|
+
"filename": filename
|
|
2444
|
+
},
|
|
2445
|
+
body: data,
|
|
2446
|
+
mediaType: "application/octet-stream"
|
|
2447
|
+
});
|
|
2448
|
+
}
|
|
2449
|
+
/**
|
|
2450
|
+
* Delete a proto file
|
|
2451
|
+
* @param registryName The name of the registry
|
|
2452
|
+
* @param filename The name of the proto file
|
|
2453
|
+
* @returns void
|
|
2454
|
+
* @throws ApiError
|
|
2455
|
+
*/
|
|
2456
|
+
deleteProto(registryName, filename) {
|
|
2457
|
+
return this.httpRequest.request({
|
|
2458
|
+
method: "DELETE",
|
|
2459
|
+
url: "/registry/service/protos/{registryName}/{filename}",
|
|
2460
|
+
path: {
|
|
2461
|
+
"registryName": registryName,
|
|
2462
|
+
"filename": filename
|
|
2463
|
+
}
|
|
2464
|
+
});
|
|
2465
|
+
}
|
|
2466
|
+
/**
|
|
2467
|
+
* Get all proto files for a registry
|
|
2468
|
+
* @param registryName The name of the registry
|
|
2469
|
+
* @returns Array<ProtoRegistryEntry> List of proto registry entries
|
|
2470
|
+
* @throws ApiError
|
|
2471
|
+
*/
|
|
2472
|
+
getAllProtos(registryName) {
|
|
2473
|
+
return this.httpRequest.request({
|
|
2474
|
+
method: "GET",
|
|
2475
|
+
url: "/registry/service/protos/{registryName}",
|
|
2476
|
+
path: {
|
|
2477
|
+
"registryName": registryName
|
|
2478
|
+
}
|
|
2479
|
+
});
|
|
2480
|
+
}
|
|
2481
|
+
/**
|
|
2482
|
+
* Discover service methods
|
|
2483
|
+
* @param name The name of the service
|
|
2484
|
+
* @param create Whether to create the discovered methods (defaults to false)
|
|
2485
|
+
* @returns Array<ServiceMethod> The discovered service methods
|
|
2486
|
+
* @throws ApiError
|
|
2487
|
+
*/
|
|
2488
|
+
discover(name, create = false) {
|
|
2489
|
+
return this.httpRequest.request({
|
|
2490
|
+
method: "GET",
|
|
2491
|
+
url: "/registry/service/{name}/discover",
|
|
2492
|
+
path: {
|
|
2493
|
+
"name": name
|
|
2494
|
+
},
|
|
2495
|
+
query: {
|
|
2496
|
+
"create": create
|
|
2497
|
+
}
|
|
2498
|
+
});
|
|
2499
|
+
}
|
|
2500
|
+
};
|
|
2501
|
+
|
|
2175
2502
|
// src/common/open-api/ConductorClient.ts
|
|
2176
2503
|
var defaultRequestHandler = (request3, config, options) => request3(config, options);
|
|
2504
|
+
var getServerBaseURL = (config) => {
|
|
2505
|
+
if (config?.useEnvVars) {
|
|
2506
|
+
if (!process.env.CONDUCTOR_SERVER_URL) {
|
|
2507
|
+
throw new Error(
|
|
2508
|
+
"Environment variable CONDUCTOR_SERVER_URL is not defined."
|
|
2509
|
+
);
|
|
2510
|
+
}
|
|
2511
|
+
return process.env.CONDUCTOR_SERVER_URL;
|
|
2512
|
+
}
|
|
2513
|
+
return config?.serverUrl ?? "http://localhost:8080";
|
|
2514
|
+
};
|
|
2177
2515
|
var ConductorClient = class {
|
|
2178
2516
|
eventResource;
|
|
2179
2517
|
healthCheckResource;
|
|
@@ -2183,13 +2521,14 @@ var ConductorClient = class {
|
|
|
2183
2521
|
tokenResource;
|
|
2184
2522
|
workflowBulkResource;
|
|
2185
2523
|
workflowResource;
|
|
2524
|
+
serviceRegistryResource;
|
|
2186
2525
|
humanTask;
|
|
2187
2526
|
humanTaskResource;
|
|
2188
2527
|
request;
|
|
2189
2528
|
token;
|
|
2190
2529
|
constructor(config, requestHandler = defaultRequestHandler) {
|
|
2191
2530
|
const resolvedConfig = {
|
|
2192
|
-
BASE: config
|
|
2531
|
+
BASE: getServerBaseURL(config),
|
|
2193
2532
|
VERSION: config?.VERSION ?? "0",
|
|
2194
2533
|
WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
|
|
2195
2534
|
CREDENTIALS: config?.CREDENTIALS ?? "include",
|
|
@@ -2218,6 +2557,7 @@ var ConductorClient = class {
|
|
|
2218
2557
|
this.tokenResource = new TokenResourceService(this.request);
|
|
2219
2558
|
this.workflowBulkResource = new WorkflowBulkResourceService(this.request);
|
|
2220
2559
|
this.workflowResource = new WorkflowResourceService(this.request);
|
|
2560
|
+
this.serviceRegistryResource = new ServiceRegistryResourceService(this.request);
|
|
2221
2561
|
this.humanTask = new HumanTaskService(this.request);
|
|
2222
2562
|
this.humanTaskResource = new HumanTaskResourceService(this.request);
|
|
2223
2563
|
}
|
|
@@ -2673,19 +3013,18 @@ var WorkflowExecutor = class {
|
|
|
2673
3013
|
() => this._client.workflowResource.startWorkflow(workflowRequest)
|
|
2674
3014
|
);
|
|
2675
3015
|
}
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
* @param workflowRequest
|
|
2679
|
-
* @returns
|
|
2680
|
-
*/
|
|
2681
|
-
executeWorkflow(workflowRequest, name, version, requestId, waitUntilTaskRef = "") {
|
|
3016
|
+
// Implementation
|
|
3017
|
+
executeWorkflow(workflowRequest, name, version, requestId, waitUntilTaskRef = "", waitForSeconds, consistency, returnStrategy) {
|
|
2682
3018
|
return tryCatchReThrow(
|
|
2683
3019
|
() => this._client.workflowResource.executeWorkflow(
|
|
2684
3020
|
workflowRequest,
|
|
2685
3021
|
name,
|
|
2686
3022
|
version,
|
|
2687
3023
|
requestId,
|
|
2688
|
-
waitUntilTaskRef
|
|
3024
|
+
waitUntilTaskRef,
|
|
3025
|
+
waitForSeconds,
|
|
3026
|
+
consistency,
|
|
3027
|
+
returnStrategy
|
|
2689
3028
|
)
|
|
2690
3029
|
);
|
|
2691
3030
|
}
|
|
@@ -2938,6 +3277,60 @@ var WorkflowExecutor = class {
|
|
|
2938
3277
|
getTask(taskId) {
|
|
2939
3278
|
return tryCatchReThrow(() => this._client.taskResource.getTask(taskId));
|
|
2940
3279
|
}
|
|
3280
|
+
/**
|
|
3281
|
+
* Updates a task by reference name synchronously and returns the complete workflow
|
|
3282
|
+
* @param taskReferenceName
|
|
3283
|
+
* @param workflowInstanceId
|
|
3284
|
+
* @param status
|
|
3285
|
+
* @param taskOutput
|
|
3286
|
+
* @param workerId - Optional
|
|
3287
|
+
* @returns Promise<Workflow>
|
|
3288
|
+
*/
|
|
3289
|
+
updateTaskSync(taskReferenceName, workflowInstanceId, status, taskOutput, workerId2) {
|
|
3290
|
+
return tryCatchReThrow(
|
|
3291
|
+
() => this._client.taskResource.updateTaskSync(
|
|
3292
|
+
workflowInstanceId,
|
|
3293
|
+
taskReferenceName,
|
|
3294
|
+
status,
|
|
3295
|
+
taskOutput,
|
|
3296
|
+
workerId2
|
|
3297
|
+
)
|
|
3298
|
+
);
|
|
3299
|
+
}
|
|
3300
|
+
/**
|
|
3301
|
+
* Signals a workflow task and returns data based on the specified return strategy
|
|
3302
|
+
* @param workflowInstanceId - Workflow instance ID to signal
|
|
3303
|
+
* @param status - Task status to set
|
|
3304
|
+
* @param taskOutput - Output data for the task
|
|
3305
|
+
* @param returnStrategy - Optional strategy for what data to return (defaults to TARGET_WORKFLOW)
|
|
3306
|
+
* @returns Promise<SignalResponse> with data based on the return strategy
|
|
3307
|
+
*/
|
|
3308
|
+
signal(workflowInstanceId, status, taskOutput, returnStrategy = "TARGET_WORKFLOW" /* TARGET_WORKFLOW */) {
|
|
3309
|
+
return tryCatchReThrow(
|
|
3310
|
+
() => this._client.taskResource.signal(
|
|
3311
|
+
workflowInstanceId,
|
|
3312
|
+
status,
|
|
3313
|
+
taskOutput,
|
|
3314
|
+
returnStrategy
|
|
3315
|
+
)
|
|
3316
|
+
);
|
|
3317
|
+
}
|
|
3318
|
+
/**
|
|
3319
|
+
* Signals a workflow task asynchronously (fire-and-forget)
|
|
3320
|
+
* @param workflowInstanceId - Workflow instance ID to signal
|
|
3321
|
+
* @param status - Task status to set
|
|
3322
|
+
* @param taskOutput - Output data for the task
|
|
3323
|
+
* @returns Promise<void>
|
|
3324
|
+
*/
|
|
3325
|
+
signalAsync(workflowInstanceId, status, taskOutput) {
|
|
3326
|
+
return tryCatchReThrow(
|
|
3327
|
+
() => this._client.taskResource.signalAsync(
|
|
3328
|
+
workflowInstanceId,
|
|
3329
|
+
status,
|
|
3330
|
+
taskOutput
|
|
3331
|
+
)
|
|
3332
|
+
);
|
|
3333
|
+
}
|
|
2941
3334
|
};
|
|
2942
3335
|
|
|
2943
3336
|
// src/core/human.ts
|
|
@@ -3238,6 +3631,7 @@ var generateHTTPTask = (overrides = {}) => ({
|
|
|
3238
3631
|
method: "GET"
|
|
3239
3632
|
}
|
|
3240
3633
|
},
|
|
3634
|
+
asyncComplete: false,
|
|
3241
3635
|
...overrides,
|
|
3242
3636
|
type: "HTTP" /* HTTP */
|
|
3243
3637
|
});
|
|
@@ -3472,12 +3866,13 @@ var forkTaskJoin = (taskReferenceName, forkTasks) => [
|
|
|
3472
3866
|
];
|
|
3473
3867
|
|
|
3474
3868
|
// src/core/sdk/http.ts
|
|
3475
|
-
var httpTask = (taskReferenceName, inputParameters) => ({
|
|
3869
|
+
var httpTask = (taskReferenceName, inputParameters, asyncComplete = false) => ({
|
|
3476
3870
|
name: taskReferenceName,
|
|
3477
3871
|
taskReferenceName,
|
|
3478
3872
|
inputParameters: {
|
|
3479
3873
|
http_request: inputParameters
|
|
3480
3874
|
},
|
|
3875
|
+
asyncComplete,
|
|
3481
3876
|
type: "HTTP" /* HTTP */
|
|
3482
3877
|
});
|
|
3483
3878
|
|
|
@@ -3909,6 +4304,18 @@ var MetadataClient = class {
|
|
|
3909
4304
|
() => this._client.metadataResource.create(workflowDef, overwrite)
|
|
3910
4305
|
);
|
|
3911
4306
|
}
|
|
4307
|
+
/**
|
|
4308
|
+
* Unregister (overwrite: true) a workflow definition
|
|
4309
|
+
*
|
|
4310
|
+
* @param workflowDef
|
|
4311
|
+
* @param overwrite
|
|
4312
|
+
* @returns
|
|
4313
|
+
*/
|
|
4314
|
+
unregisterWorkflow(workflowName, version = 1) {
|
|
4315
|
+
return tryCatchReThrow(
|
|
4316
|
+
() => this._client.metadataResource.unregisterWorkflowDef(workflowName, version)
|
|
4317
|
+
);
|
|
4318
|
+
}
|
|
3912
4319
|
};
|
|
3913
4320
|
|
|
3914
4321
|
// src/orkes/BaseOrkesConductorClient.ts
|
|
@@ -3938,6 +4345,16 @@ var baseOrkesConductorClient = (fetchFn, baseRequestHandler = defaultRequestHand
|
|
|
3938
4345
|
method: "POST"
|
|
3939
4346
|
});
|
|
3940
4347
|
return async (config, requestHandler = baseRequestHandler) => {
|
|
4348
|
+
if (config?.useEnvVars) {
|
|
4349
|
+
if (!process.env.CONDUCTOR_SERVER_URL) {
|
|
4350
|
+
throw new Error(
|
|
4351
|
+
"Environment variable CONDUCTOR_SERVER_URL is not defined."
|
|
4352
|
+
);
|
|
4353
|
+
}
|
|
4354
|
+
config.serverUrl = process.env.CONDUCTOR_SERVER_URL;
|
|
4355
|
+
config.keyId = process.env.CONDUCTOR_AUTH_KEY;
|
|
4356
|
+
config.keySecret = process.env.CONDUCTOR_AUTH_SECRET;
|
|
4357
|
+
}
|
|
3941
4358
|
if (config?.keySecret != null && config?.keyId != null) {
|
|
3942
4359
|
const {
|
|
3943
4360
|
serverUrl,
|
|
@@ -4006,15 +4423,15 @@ var getQueryString2 = (params) => {
|
|
|
4006
4423
|
const append = (key, value) => {
|
|
4007
4424
|
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
4008
4425
|
};
|
|
4009
|
-
const
|
|
4426
|
+
const process2 = (key, value) => {
|
|
4010
4427
|
if (isDefined2(value)) {
|
|
4011
4428
|
if (Array.isArray(value)) {
|
|
4012
4429
|
value.forEach((v) => {
|
|
4013
|
-
|
|
4430
|
+
process2(key, v);
|
|
4014
4431
|
});
|
|
4015
4432
|
} else if (typeof value === "object") {
|
|
4016
4433
|
Object.entries(value).forEach(([k, v]) => {
|
|
4017
|
-
|
|
4434
|
+
process2(`${key}[${k}]`, v);
|
|
4018
4435
|
});
|
|
4019
4436
|
} else {
|
|
4020
4437
|
append(key, value);
|
|
@@ -4022,7 +4439,7 @@ var getQueryString2 = (params) => {
|
|
|
4022
4439
|
}
|
|
4023
4440
|
};
|
|
4024
4441
|
Object.entries(params).forEach(([key, value]) => {
|
|
4025
|
-
|
|
4442
|
+
process2(key, value);
|
|
4026
4443
|
});
|
|
4027
4444
|
if (qs.length > 0) {
|
|
4028
4445
|
return `?${qs.join("&")}`;
|
|
@@ -4046,7 +4463,7 @@ var getUrl2 = (config, options) => {
|
|
|
4046
4463
|
var getFormData2 = (options) => {
|
|
4047
4464
|
if (options.formData) {
|
|
4048
4465
|
const formData = new FormData();
|
|
4049
|
-
const
|
|
4466
|
+
const process2 = (key, value) => {
|
|
4050
4467
|
if (isString2(value) || isBlob2(value)) {
|
|
4051
4468
|
formData.append(key, value);
|
|
4052
4469
|
} else {
|
|
@@ -4055,9 +4472,9 @@ var getFormData2 = (options) => {
|
|
|
4055
4472
|
};
|
|
4056
4473
|
Object.entries(options.formData).filter(([_, value]) => isDefined2(value)).forEach(([key, value]) => {
|
|
4057
4474
|
if (Array.isArray(value)) {
|
|
4058
|
-
value.forEach((v) =>
|
|
4475
|
+
value.forEach((v) => process2(key, v));
|
|
4059
4476
|
} else {
|
|
4060
|
-
|
|
4477
|
+
process2(key, value);
|
|
4061
4478
|
}
|
|
4062
4479
|
});
|
|
4063
4480
|
return formData;
|
|
@@ -4220,6 +4637,7 @@ export {
|
|
|
4220
4637
|
CancelablePromise,
|
|
4221
4638
|
ConductorClient,
|
|
4222
4639
|
ConductorError,
|
|
4640
|
+
Consistency,
|
|
4223
4641
|
DefaultLogger,
|
|
4224
4642
|
EventResourceService,
|
|
4225
4643
|
HealthCheckResourceService,
|
|
@@ -4227,6 +4645,7 @@ export {
|
|
|
4227
4645
|
MAX_RETRIES,
|
|
4228
4646
|
MetadataClient,
|
|
4229
4647
|
MetadataResourceService,
|
|
4648
|
+
ReturnStrategy,
|
|
4230
4649
|
SchedulerClient,
|
|
4231
4650
|
SchedulerResourceService,
|
|
4232
4651
|
TaskClient,
|