@io-orkes/conductor-javascript 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.d.ts +339 -8
- package/dist/index.js +259 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +258 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Netflix Conductor Javascript SDK
|
|
1
|
+
# Netflix Conductor Javascript/Typescript SDK
|
|
2
2
|
|
|
3
3
|
The `conductor-javascript` repository provides the client SDKs to build task workers in javascript/typescript.
|
|
4
4
|
|
|
@@ -52,4 +52,4 @@ orkesConductorClient(config).then(client => ..... );
|
|
|
52
52
|
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
### Next: [Create and run task workers](workers_sdk.md)
|
|
55
|
+
### Next: [Create and run task workers](workers_sdk.md)
|
package/dist/index.d.ts
CHANGED
|
@@ -1201,6 +1201,281 @@ declare class WorkflowResourceService {
|
|
|
1201
1201
|
resetWorkflow(workflowId: string): CancelablePromise<void>;
|
|
1202
1202
|
}
|
|
1203
1203
|
|
|
1204
|
+
declare type AssignmentPolicy = {
|
|
1205
|
+
type: string;
|
|
1206
|
+
};
|
|
1207
|
+
|
|
1208
|
+
declare type FFAAssignment = AssignmentPolicy;
|
|
1209
|
+
|
|
1210
|
+
declare type Fixed = (AssignmentPolicy & {
|
|
1211
|
+
assignee?: string;
|
|
1212
|
+
assigneeType?: 'EXTERNAL_USER' | 'EXTERNAL_GROUP' | 'CONDUCTOR_USER' | 'CONDUCTOR_GROUP';
|
|
1213
|
+
});
|
|
1214
|
+
|
|
1215
|
+
declare type TimeoutPolicy = {
|
|
1216
|
+
type: string;
|
|
1217
|
+
};
|
|
1218
|
+
|
|
1219
|
+
declare type BackToAssigment = (TimeoutPolicy & {
|
|
1220
|
+
timeoutSeconds?: number;
|
|
1221
|
+
});
|
|
1222
|
+
|
|
1223
|
+
declare type ClearAssigment = (TimeoutPolicy & {
|
|
1224
|
+
timeoutSeconds?: number;
|
|
1225
|
+
});
|
|
1226
|
+
|
|
1227
|
+
declare type Escalate = (TimeoutPolicy & {
|
|
1228
|
+
subjects?: Array<string>;
|
|
1229
|
+
timeoutSeconds?: number;
|
|
1230
|
+
} & {
|
|
1231
|
+
subjects: Array<string>;
|
|
1232
|
+
});
|
|
1233
|
+
|
|
1234
|
+
declare type LeastBusyGroupMemberAssignment = (AssignmentPolicy & {
|
|
1235
|
+
groupId?: string;
|
|
1236
|
+
});
|
|
1237
|
+
|
|
1238
|
+
declare type Never = TimeoutPolicy;
|
|
1239
|
+
|
|
1240
|
+
declare type Terminate = (TimeoutPolicy & {
|
|
1241
|
+
timeoutSeconds?: number;
|
|
1242
|
+
});
|
|
1243
|
+
|
|
1244
|
+
declare type HumanTaskEntry = {
|
|
1245
|
+
assignee?: string;
|
|
1246
|
+
assigneeType?: 'EXTERNAL_USER' | 'EXTERNAL_GROUP' | 'CONDUCTOR_USER' | 'CONDUCTOR_GROUP';
|
|
1247
|
+
assignmentPolicy?: (FFAAssignment | Fixed | LeastBusyGroupMemberAssignment);
|
|
1248
|
+
claimedBy?: string;
|
|
1249
|
+
createdBy?: string;
|
|
1250
|
+
createdOn?: number;
|
|
1251
|
+
escalatedAt?: number;
|
|
1252
|
+
output?: Record<string, Record<string, any>>;
|
|
1253
|
+
owners?: Array<string>;
|
|
1254
|
+
predefinedInput?: Record<string, Record<string, any>>;
|
|
1255
|
+
state?: 'PENDING' | 'ASSIGNED' | 'IN_PROGRESS' | 'COMPLETED' | 'TIMED_OUT';
|
|
1256
|
+
taskId?: string;
|
|
1257
|
+
taskName?: string;
|
|
1258
|
+
taskRefName?: string;
|
|
1259
|
+
templateId?: string;
|
|
1260
|
+
timeoutPolicy?: (BackToAssigment | ClearAssigment | Escalate | Never | Terminate);
|
|
1261
|
+
workflowId?: string;
|
|
1262
|
+
workflowName?: string;
|
|
1263
|
+
};
|
|
1264
|
+
|
|
1265
|
+
declare type HTScrollableSearchResultHumanTaskEntry = {
|
|
1266
|
+
queryId?: string;
|
|
1267
|
+
results?: Array<HumanTaskEntry>;
|
|
1268
|
+
};
|
|
1269
|
+
|
|
1270
|
+
declare type HumanTaskActionLogEntry = {
|
|
1271
|
+
action?: string;
|
|
1272
|
+
actionTime?: number;
|
|
1273
|
+
cause?: string;
|
|
1274
|
+
id?: string;
|
|
1275
|
+
taskId?: string;
|
|
1276
|
+
taskRefName?: string;
|
|
1277
|
+
workflowId?: string;
|
|
1278
|
+
workflowName?: string;
|
|
1279
|
+
};
|
|
1280
|
+
|
|
1281
|
+
declare type HumanTaskLoad = {
|
|
1282
|
+
assignedUser?: string;
|
|
1283
|
+
count?: number;
|
|
1284
|
+
taskRefName?: string;
|
|
1285
|
+
workflowName?: string;
|
|
1286
|
+
};
|
|
1287
|
+
|
|
1288
|
+
declare type HumanTaskStateLogEntry = {
|
|
1289
|
+
assignee?: string;
|
|
1290
|
+
assigneeType?: 'EXTERNAL_USER' | 'EXTERNAL_GROUP' | 'CONDUCTOR_USER' | 'CONDUCTOR_GROUP';
|
|
1291
|
+
claimedBy?: string;
|
|
1292
|
+
id?: string;
|
|
1293
|
+
state?: 'PENDING' | 'ASSIGNED' | 'IN_PROGRESS' | 'COMPLETED' | 'TIMED_OUT';
|
|
1294
|
+
stateEnd?: number;
|
|
1295
|
+
stateStart?: number;
|
|
1296
|
+
taskId?: string;
|
|
1297
|
+
taskRefName?: string;
|
|
1298
|
+
workflowId?: string;
|
|
1299
|
+
workflowName?: string;
|
|
1300
|
+
};
|
|
1301
|
+
|
|
1302
|
+
declare type HumanTaskTemplate = {
|
|
1303
|
+
jsonSchema: Record<string, Record<string, any>>;
|
|
1304
|
+
name: string;
|
|
1305
|
+
templateUI: Record<string, Record<string, any>>;
|
|
1306
|
+
version?: number;
|
|
1307
|
+
};
|
|
1308
|
+
|
|
1309
|
+
declare type HumanTaskTemplateEntry = {
|
|
1310
|
+
createdBy?: string;
|
|
1311
|
+
createdOn?: number;
|
|
1312
|
+
id?: string;
|
|
1313
|
+
jsonSchema?: Record<string, Record<string, any>>;
|
|
1314
|
+
name?: string;
|
|
1315
|
+
templateUI?: Record<string, Record<string, any>>;
|
|
1316
|
+
updatedBy?: string;
|
|
1317
|
+
updatedOn?: number;
|
|
1318
|
+
version?: number;
|
|
1319
|
+
};
|
|
1320
|
+
|
|
1321
|
+
declare type SearchResultHumanTaskEntry = {
|
|
1322
|
+
results?: Array<HumanTaskEntry>;
|
|
1323
|
+
totalHits?: number;
|
|
1324
|
+
};
|
|
1325
|
+
|
|
1326
|
+
declare class HumanTaskService {
|
|
1327
|
+
readonly httpRequest: BaseHttpRequest;
|
|
1328
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
1329
|
+
/**
|
|
1330
|
+
* List tasks by filters - task name, state, assignee, assignee type, claimed
|
|
1331
|
+
* @param state
|
|
1332
|
+
* @param assignee
|
|
1333
|
+
* @param assigneeType
|
|
1334
|
+
* @param claimedBy
|
|
1335
|
+
* @param taskName
|
|
1336
|
+
* @param freeText
|
|
1337
|
+
* @param includeInputOutput
|
|
1338
|
+
* @returns SearchResultHumanTaskEntry OK
|
|
1339
|
+
* @throws ApiError
|
|
1340
|
+
*/
|
|
1341
|
+
getTasksByFilter(state: 'PENDING' | 'ASSIGNED' | 'IN_PROGRESS' | 'COMPLETED' | 'TIMED_OUT', assignee?: string, assigneeType?: 'EXTERNAL_USER' | 'EXTERNAL_GROUP' | 'CONDUCTOR_USER' | 'CONDUCTOR_GROUP', claimedBy?: string, taskName?: string, freeText?: string, includeInputOutput?: boolean): CancelablePromise<SearchResultHumanTaskEntry>;
|
|
1342
|
+
/**
|
|
1343
|
+
* Get task load grouped by workflow name and task ref name per user
|
|
1344
|
+
* @returns HumanTaskLoad OK
|
|
1345
|
+
* @throws ApiError
|
|
1346
|
+
*/
|
|
1347
|
+
getTaskLoad(): CancelablePromise<Array<HumanTaskLoad>>;
|
|
1348
|
+
/**
|
|
1349
|
+
* Search human tasks
|
|
1350
|
+
* @param queryId
|
|
1351
|
+
* @param start
|
|
1352
|
+
* @param size
|
|
1353
|
+
* @param freeText
|
|
1354
|
+
* @param query
|
|
1355
|
+
* @param jsonQuery
|
|
1356
|
+
* @param includeInputOutput
|
|
1357
|
+
* @returns HTScrollableSearchResultHumanTaskEntry OK
|
|
1358
|
+
* @throws ApiError
|
|
1359
|
+
*/
|
|
1360
|
+
search1(queryId?: string, start?: number, size?: number, freeText?: string, query?: string, jsonQuery?: string, includeInputOutput?: boolean): CancelablePromise<HTScrollableSearchResultHumanTaskEntry>;
|
|
1361
|
+
/**
|
|
1362
|
+
* If the workflow is disconnected from tasks, this API can be used to clean up
|
|
1363
|
+
* @param taskId
|
|
1364
|
+
* @returns any OK
|
|
1365
|
+
* @throws ApiError
|
|
1366
|
+
*/
|
|
1367
|
+
updateTaskOutput1(taskId: string): CancelablePromise<any>;
|
|
1368
|
+
/**
|
|
1369
|
+
* Get a task
|
|
1370
|
+
* @param taskId
|
|
1371
|
+
* @returns HumanTaskEntry OK
|
|
1372
|
+
* @throws ApiError
|
|
1373
|
+
*/
|
|
1374
|
+
getTask1(taskId: string): CancelablePromise<HumanTaskEntry>;
|
|
1375
|
+
/**
|
|
1376
|
+
* Get human task action log entries by task id
|
|
1377
|
+
* @param taskId
|
|
1378
|
+
* @returns HumanTaskActionLogEntry OK
|
|
1379
|
+
* @throws ApiError
|
|
1380
|
+
*/
|
|
1381
|
+
getActionLogs(taskId: string): CancelablePromise<Array<HumanTaskActionLogEntry>>;
|
|
1382
|
+
/**
|
|
1383
|
+
* Claim a task by authenticated Conductor user
|
|
1384
|
+
* @param taskId
|
|
1385
|
+
* @returns any OK
|
|
1386
|
+
* @throws ApiError
|
|
1387
|
+
*/
|
|
1388
|
+
claimTask(taskId: string): CancelablePromise<any>;
|
|
1389
|
+
/**
|
|
1390
|
+
* Claim a task to an external user
|
|
1391
|
+
* @param taskId
|
|
1392
|
+
* @param userId
|
|
1393
|
+
* @returns any OK
|
|
1394
|
+
* @throws ApiError
|
|
1395
|
+
*/
|
|
1396
|
+
assignAndClaim(taskId: string, userId: string): CancelablePromise<any>;
|
|
1397
|
+
/**
|
|
1398
|
+
* Release a task without completing it
|
|
1399
|
+
* @param taskId
|
|
1400
|
+
* @param requestBody
|
|
1401
|
+
* @returns any OK
|
|
1402
|
+
* @throws ApiError
|
|
1403
|
+
*/
|
|
1404
|
+
reassignTask(taskId: string, requestBody: (FFAAssignment | Fixed | LeastBusyGroupMemberAssignment)): CancelablePromise<any>;
|
|
1405
|
+
/**
|
|
1406
|
+
* Release a task without completing it
|
|
1407
|
+
* @param taskId
|
|
1408
|
+
* @returns any OK
|
|
1409
|
+
* @throws ApiError
|
|
1410
|
+
*/
|
|
1411
|
+
releaseTask(taskId: string): CancelablePromise<any>;
|
|
1412
|
+
/**
|
|
1413
|
+
* Get human task state log entries by task id
|
|
1414
|
+
* @param taskId
|
|
1415
|
+
* @returns HumanTaskStateLogEntry OK
|
|
1416
|
+
* @throws ApiError
|
|
1417
|
+
*/
|
|
1418
|
+
getStateLogs(taskId: string): CancelablePromise<Array<HumanTaskStateLogEntry>>;
|
|
1419
|
+
/**
|
|
1420
|
+
* Update task output, optionally complete
|
|
1421
|
+
* @param taskId
|
|
1422
|
+
* @param requestBody
|
|
1423
|
+
* @param complete
|
|
1424
|
+
* @returns any OK
|
|
1425
|
+
* @throws ApiError
|
|
1426
|
+
*/
|
|
1427
|
+
updateTaskOutput(taskId: string, requestBody: Record<string, Record<string, any>>, complete?: boolean): CancelablePromise<any>;
|
|
1428
|
+
/**
|
|
1429
|
+
* Delete human task templates by name
|
|
1430
|
+
* @param name
|
|
1431
|
+
* @returns any OK
|
|
1432
|
+
* @throws ApiError
|
|
1433
|
+
*/
|
|
1434
|
+
deleteTemplatesByName(name: string): CancelablePromise<any>;
|
|
1435
|
+
/**
|
|
1436
|
+
* List all human task templates or get templates by name, or a template by name and version
|
|
1437
|
+
* @param name
|
|
1438
|
+
* @param version
|
|
1439
|
+
* @returns HumanTaskTemplateEntry OK
|
|
1440
|
+
* @throws ApiError
|
|
1441
|
+
*/
|
|
1442
|
+
getAllTemplates(name?: string, version?: number): CancelablePromise<Array<HumanTaskTemplateEntry>>;
|
|
1443
|
+
/**
|
|
1444
|
+
* Save human task template
|
|
1445
|
+
* @param requestBody
|
|
1446
|
+
* @param newVersion
|
|
1447
|
+
* @returns string OK
|
|
1448
|
+
* @throws ApiError
|
|
1449
|
+
*/
|
|
1450
|
+
saveTemplate(requestBody: HumanTaskTemplate, newVersion?: boolean): CancelablePromise<string>;
|
|
1451
|
+
/**
|
|
1452
|
+
* Delete human task template
|
|
1453
|
+
* @param id
|
|
1454
|
+
* @returns any OK
|
|
1455
|
+
* @throws ApiError
|
|
1456
|
+
*/
|
|
1457
|
+
deleteTemplateById(id: string): CancelablePromise<any>;
|
|
1458
|
+
/**
|
|
1459
|
+
* Get human task template by id
|
|
1460
|
+
* @param id
|
|
1461
|
+
* @returns HumanTaskTemplateEntry OK
|
|
1462
|
+
* @throws ApiError
|
|
1463
|
+
*/
|
|
1464
|
+
getTemplateById(id: string): CancelablePromise<HumanTaskTemplateEntry>;
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
declare class HumanTaskResourceService {
|
|
1468
|
+
readonly httpRequest: BaseHttpRequest;
|
|
1469
|
+
constructor(httpRequest: BaseHttpRequest);
|
|
1470
|
+
/**
|
|
1471
|
+
* Get Conductor task by id (for human tasks only)
|
|
1472
|
+
* @param taskId
|
|
1473
|
+
* @returns Task OK
|
|
1474
|
+
* @throws ApiError
|
|
1475
|
+
*/
|
|
1476
|
+
getConductorTaskById(taskId: string): CancelablePromise<Task>;
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1204
1479
|
interface ConductorClientAPIConfig extends Omit<OpenAPIConfig, "BASE"> {
|
|
1205
1480
|
serverUrl: string;
|
|
1206
1481
|
}
|
|
@@ -1213,6 +1488,8 @@ declare class ConductorClient {
|
|
|
1213
1488
|
readonly tokenResource: TokenResourceService;
|
|
1214
1489
|
readonly workflowBulkResource: WorkflowBulkResourceService;
|
|
1215
1490
|
readonly workflowResource: WorkflowResourceService;
|
|
1491
|
+
readonly humanTask: HumanTaskService;
|
|
1492
|
+
readonly humanTaskResource: HumanTaskResourceService;
|
|
1216
1493
|
readonly request: BaseHttpRequest;
|
|
1217
1494
|
readonly token?: string | Resolver<string>;
|
|
1218
1495
|
constructor(config?: Partial<ConductorClientAPIConfig>, requestHandler?: ConductorHttpRequest);
|
|
@@ -1402,13 +1679,6 @@ interface WaitTaskDef extends CommonTaskDef {
|
|
|
1402
1679
|
until?: string;
|
|
1403
1680
|
};
|
|
1404
1681
|
}
|
|
1405
|
-
declare type U2O<U extends string> = {
|
|
1406
|
-
[key in U]: U2O<Exclude<U, key>>;
|
|
1407
|
-
};
|
|
1408
|
-
declare type O2T<O extends {}> = {} extends O ? [] : {
|
|
1409
|
-
[key in keyof O]: [key, ...O2T<O[key]>];
|
|
1410
|
-
}[keyof O];
|
|
1411
|
-
declare type WorkflowInputParameters<T extends string> = O2T<U2O<T>>;
|
|
1412
1682
|
interface WorkflowDef extends Omit<WorkflowDef$1, "tasks" | "version" | "inputParameters"> {
|
|
1413
1683
|
inputParameters: string[];
|
|
1414
1684
|
version: number;
|
|
@@ -1836,4 +2106,65 @@ declare class WorkflowExecutor {
|
|
|
1836
2106
|
getTask(taskId: string): Promise<Task>;
|
|
1837
2107
|
}
|
|
1838
2108
|
|
|
1839
|
-
|
|
2109
|
+
declare class HumanExecutor {
|
|
2110
|
+
readonly _client: ConductorClient;
|
|
2111
|
+
constructor(client: ConductorClient);
|
|
2112
|
+
/**
|
|
2113
|
+
* Takes a set of filter parameters. return matches of human tasks for that set of parameters
|
|
2114
|
+
* @param state
|
|
2115
|
+
* @param assignee
|
|
2116
|
+
* @param assigneeType
|
|
2117
|
+
* @param claimedBy
|
|
2118
|
+
* @param taskName
|
|
2119
|
+
* @param freeText
|
|
2120
|
+
* @param includeInputOutput
|
|
2121
|
+
* @returns
|
|
2122
|
+
*/
|
|
2123
|
+
getTasksByFilter(state: "PENDING" | "ASSIGNED" | "IN_PROGRESS" | "COMPLETED" | "TIMED_OUT", assignee?: string, assigneeType?: "EXTERNAL_USER" | "EXTERNAL_GROUP" | "CONDUCTOR_USER" | "CONDUCTOR_GROUP", claimedBy?: string, taskName?: string, freeText?: string, includeInputOutput?: boolean): Promise<HumanTaskEntry[]>;
|
|
2124
|
+
/**
|
|
2125
|
+
* Returns task for a given task id
|
|
2126
|
+
* @param taskId
|
|
2127
|
+
* @returns
|
|
2128
|
+
*/
|
|
2129
|
+
getTaskById(taskId: string): Promise<HumanTaskEntry>;
|
|
2130
|
+
/**
|
|
2131
|
+
* Assigns taskId to assignee. If the task is already assigned to another user, this will fail.
|
|
2132
|
+
* @param taskId
|
|
2133
|
+
* @param assignee
|
|
2134
|
+
* @returns
|
|
2135
|
+
*/
|
|
2136
|
+
claimTaskAsExternalUser(taskId: string, assignee: string): Promise<void>;
|
|
2137
|
+
/**
|
|
2138
|
+
* Claim task as conductor user
|
|
2139
|
+
* @param taskId
|
|
2140
|
+
* @returns
|
|
2141
|
+
*/
|
|
2142
|
+
claimTaskAsConductorUser(taskId: string): Promise<void>;
|
|
2143
|
+
/**
|
|
2144
|
+
* Claim task as conductor user
|
|
2145
|
+
* @param taskId
|
|
2146
|
+
* @param assignee
|
|
2147
|
+
* @returns
|
|
2148
|
+
*/
|
|
2149
|
+
releaseTask(taskId: string): Promise<void>;
|
|
2150
|
+
/**
|
|
2151
|
+
* Returns a HumanTaskTemplateEntry for a given templateId
|
|
2152
|
+
* @param templateId
|
|
2153
|
+
* @returns
|
|
2154
|
+
*/
|
|
2155
|
+
getTemplateById(templateId: string): Promise<HumanTaskTemplateEntry>;
|
|
2156
|
+
/**
|
|
2157
|
+
* Takes a taskId and a partial body. will update with given body
|
|
2158
|
+
* @param taskId
|
|
2159
|
+
* @param requestBody
|
|
2160
|
+
*/
|
|
2161
|
+
updateTaskOutput(taskId: string, requestBody: Record<string, Record<string, any>>): Promise<void>;
|
|
2162
|
+
/**
|
|
2163
|
+
* Takes a taskId and an optional partial body. will complete the task with the given body
|
|
2164
|
+
* @param taskId
|
|
2165
|
+
* @param requestBody
|
|
2166
|
+
*/
|
|
2167
|
+
completeTask(taskId: string, requestBody?: Record<string, Record<string, any>>): Promise<void>;
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
export { Action, ApiError, AssignmentPolicy, BackToAssigment, BaseHttpRequest, CancelError, CancelablePromise, ClearAssigment, CommonTaskDef, ConductorClient, ConductorError, ConductorHttpRequest, ConductorLogLevel, ConductorLogger, ConductorWorker, DefaultLogger, DefaultLoggerConfig, DoWhileTaskDef, Escalate, EventHandler, EventResourceService, EventTaskDef, ExternalStorageLocation, FFAAssignment, Fixed, ForkJoinDynamicDef, ForkJoinTaskDef, GenerateTokenRequest, HTScrollableSearchResultHumanTaskEntry, HealthCheckResourceService, HttpInputParameters, HttpTaskDef, HumanExecutor, HumanTaskActionLogEntry, HumanTaskEntry, HumanTaskLoad, HumanTaskStateLogEntry, HumanTaskTemplate, HumanTaskTemplateEntry, InlineTaskDef, InlineTaskInputParameters, JoinTaskDef, JsonJQTransformTaskDef, KafkaPublishInputParameters, KafkaPublishTaskDef, LeastBusyGroupMemberAssignment, MetadataResourceService, Never, OnCancel, OpenAPIConfig, OrkesApiConfig, PollData, RequestType, RerunWorkflowRequest, Response, RunnerArgs, SaveScheduleRequest, SchedulerResourceService, ScrollableSearchResultWorkflowSummary, SearchResultHumanTaskEntry, SearchResultTask, SearchResultTaskSummary, SearchResultWorkflow, SearchResultWorkflowScheduleExecutionModel, SearchResultWorkflowSummary, SetVariableTaskDef, SimpleTaskDef, SkipTaskRequest, StartWorkflow, StartWorkflowRequest, SubWorkflowParams, SubWorkflowTaskDef, SwitchTaskDef, Task, TaskDef, TaskDefTypes, TaskDetails, TaskErrorHandler, TaskExecLog, TaskManager, TaskManagerConfig, TaskManagerOptions, TaskResourceService, TaskResult, TaskResultStatus, TaskRunner, TaskSummary, TaskType, Terminate, TerminateTaskDef, TimeoutPolicy, TokenResourceService, WaitTaskDef, Workflow, WorkflowBulkResourceService, WorkflowDef, WorkflowExecutor, WorkflowResourceService, WorkflowSchedule, WorkflowScheduleExecutionModel, WorkflowStatus, WorkflowSummary, WorkflowTask, conductorEventTask, doWhileTask, dynamicForkTask, eventTask, forkTask, forkTaskJoin, generate, generateDoWhileTask, generateEventTask, generateForkJoinTask, generateHTTPTask, generateInlineTask, generateJQTransformTask, generateJoinTask, generateKafkaPublishTask, generateSetVariableTask, generateSimpleTask, generateSubWorkflowTask, generateSwitchTask, generateTerminateTask, generateWaitTask, httpTask, inlineTask, joinTask, jsonJqTask, kafkaPublishTask, newLoopTask, noopErrorHandler, orkesConductorClient, setVariableTask, simpleTask, sqsEventTask, subWorkflowTask, switchTask, taskGenMapper, terminateTask, waitTaskDuration, waitTaskUntil, workflow };
|
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,
|
|
@@ -1411,6 +1412,202 @@ var request = (config, options) => {
|
|
|
1411
1412
|
});
|
|
1412
1413
|
};
|
|
1413
1414
|
|
|
1415
|
+
// src/common/open-api/services/HumanTaskService.ts
|
|
1416
|
+
var HumanTaskService = class {
|
|
1417
|
+
constructor(httpRequest) {
|
|
1418
|
+
this.httpRequest = httpRequest;
|
|
1419
|
+
}
|
|
1420
|
+
getTasksByFilter(state, assignee, assigneeType, claimedBy, taskName, freeText, includeInputOutput = false) {
|
|
1421
|
+
return this.httpRequest.request({
|
|
1422
|
+
method: "GET",
|
|
1423
|
+
url: "/human/tasks",
|
|
1424
|
+
query: {
|
|
1425
|
+
"state": state,
|
|
1426
|
+
"assignee": assignee,
|
|
1427
|
+
"assigneeType": assigneeType,
|
|
1428
|
+
"claimedBy": claimedBy,
|
|
1429
|
+
"taskName": taskName,
|
|
1430
|
+
"freeText": freeText,
|
|
1431
|
+
"includeInputOutput": includeInputOutput
|
|
1432
|
+
}
|
|
1433
|
+
});
|
|
1434
|
+
}
|
|
1435
|
+
getTaskLoad() {
|
|
1436
|
+
return this.httpRequest.request({
|
|
1437
|
+
method: "GET",
|
|
1438
|
+
url: "/human/tasks/load"
|
|
1439
|
+
});
|
|
1440
|
+
}
|
|
1441
|
+
search1(queryId, start, size = 100, freeText = "*", query, jsonQuery, includeInputOutput = false) {
|
|
1442
|
+
return this.httpRequest.request({
|
|
1443
|
+
method: "GET",
|
|
1444
|
+
url: "/human/tasks/search",
|
|
1445
|
+
query: {
|
|
1446
|
+
"queryId": queryId,
|
|
1447
|
+
"start": start,
|
|
1448
|
+
"size": size,
|
|
1449
|
+
"freeText": freeText,
|
|
1450
|
+
"query": query,
|
|
1451
|
+
"jsonQuery": jsonQuery,
|
|
1452
|
+
"includeInputOutput": includeInputOutput
|
|
1453
|
+
}
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
updateTaskOutput1(taskId) {
|
|
1457
|
+
return this.httpRequest.request({
|
|
1458
|
+
method: "DELETE",
|
|
1459
|
+
url: "/human/tasks/{taskId}",
|
|
1460
|
+
path: {
|
|
1461
|
+
"taskId": taskId
|
|
1462
|
+
}
|
|
1463
|
+
});
|
|
1464
|
+
}
|
|
1465
|
+
getTask1(taskId) {
|
|
1466
|
+
return this.httpRequest.request({
|
|
1467
|
+
method: "GET",
|
|
1468
|
+
url: "/human/tasks/{taskId}",
|
|
1469
|
+
path: {
|
|
1470
|
+
"taskId": taskId
|
|
1471
|
+
}
|
|
1472
|
+
});
|
|
1473
|
+
}
|
|
1474
|
+
getActionLogs(taskId) {
|
|
1475
|
+
return this.httpRequest.request({
|
|
1476
|
+
method: "GET",
|
|
1477
|
+
url: "/human/tasks/{taskId}/actionLogs",
|
|
1478
|
+
path: {
|
|
1479
|
+
"taskId": taskId
|
|
1480
|
+
}
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
claimTask(taskId) {
|
|
1484
|
+
return this.httpRequest.request({
|
|
1485
|
+
method: "POST",
|
|
1486
|
+
url: "/human/tasks/{taskId}/claim",
|
|
1487
|
+
path: {
|
|
1488
|
+
"taskId": taskId
|
|
1489
|
+
}
|
|
1490
|
+
});
|
|
1491
|
+
}
|
|
1492
|
+
assignAndClaim(taskId, userId) {
|
|
1493
|
+
return this.httpRequest.request({
|
|
1494
|
+
method: "POST",
|
|
1495
|
+
url: "/human/tasks/{taskId}/externalUser/{userId}",
|
|
1496
|
+
path: {
|
|
1497
|
+
"taskId": taskId,
|
|
1498
|
+
"userId": userId
|
|
1499
|
+
}
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1502
|
+
reassignTask(taskId, requestBody) {
|
|
1503
|
+
return this.httpRequest.request({
|
|
1504
|
+
method: "POST",
|
|
1505
|
+
url: "/human/tasks/{taskId}/reassign",
|
|
1506
|
+
path: {
|
|
1507
|
+
"taskId": taskId
|
|
1508
|
+
},
|
|
1509
|
+
body: requestBody,
|
|
1510
|
+
mediaType: "application/json"
|
|
1511
|
+
});
|
|
1512
|
+
}
|
|
1513
|
+
releaseTask(taskId) {
|
|
1514
|
+
return this.httpRequest.request({
|
|
1515
|
+
method: "POST",
|
|
1516
|
+
url: "/human/tasks/{taskId}/release",
|
|
1517
|
+
path: {
|
|
1518
|
+
"taskId": taskId
|
|
1519
|
+
}
|
|
1520
|
+
});
|
|
1521
|
+
}
|
|
1522
|
+
getStateLogs(taskId) {
|
|
1523
|
+
return this.httpRequest.request({
|
|
1524
|
+
method: "GET",
|
|
1525
|
+
url: "/human/tasks/{taskId}/stateLogs",
|
|
1526
|
+
path: {
|
|
1527
|
+
"taskId": taskId
|
|
1528
|
+
}
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1531
|
+
updateTaskOutput(taskId, requestBody, complete = false) {
|
|
1532
|
+
return this.httpRequest.request({
|
|
1533
|
+
method: "POST",
|
|
1534
|
+
url: "/human/tasks/{taskId}/update",
|
|
1535
|
+
path: {
|
|
1536
|
+
"taskId": taskId
|
|
1537
|
+
},
|
|
1538
|
+
query: {
|
|
1539
|
+
"complete": complete
|
|
1540
|
+
},
|
|
1541
|
+
body: requestBody,
|
|
1542
|
+
mediaType: "application/json"
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1545
|
+
deleteTemplatesByName(name) {
|
|
1546
|
+
return this.httpRequest.request({
|
|
1547
|
+
method: "DELETE",
|
|
1548
|
+
url: "/human/template",
|
|
1549
|
+
query: {
|
|
1550
|
+
"name": name
|
|
1551
|
+
}
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
getAllTemplates(name, version) {
|
|
1555
|
+
return this.httpRequest.request({
|
|
1556
|
+
method: "GET",
|
|
1557
|
+
url: "/human/template",
|
|
1558
|
+
query: {
|
|
1559
|
+
"name": name,
|
|
1560
|
+
"version": version
|
|
1561
|
+
}
|
|
1562
|
+
});
|
|
1563
|
+
}
|
|
1564
|
+
saveTemplate(requestBody, newVersion = false) {
|
|
1565
|
+
return this.httpRequest.request({
|
|
1566
|
+
method: "POST",
|
|
1567
|
+
url: "/human/template",
|
|
1568
|
+
query: {
|
|
1569
|
+
"newVersion": newVersion
|
|
1570
|
+
},
|
|
1571
|
+
body: requestBody,
|
|
1572
|
+
mediaType: "application/json"
|
|
1573
|
+
});
|
|
1574
|
+
}
|
|
1575
|
+
deleteTemplateById(id) {
|
|
1576
|
+
return this.httpRequest.request({
|
|
1577
|
+
method: "DELETE",
|
|
1578
|
+
url: "/human/template/{id}",
|
|
1579
|
+
path: {
|
|
1580
|
+
"id": id
|
|
1581
|
+
}
|
|
1582
|
+
});
|
|
1583
|
+
}
|
|
1584
|
+
getTemplateById(id) {
|
|
1585
|
+
return this.httpRequest.request({
|
|
1586
|
+
method: "GET",
|
|
1587
|
+
url: "/human/template/{id}",
|
|
1588
|
+
path: {
|
|
1589
|
+
"id": id
|
|
1590
|
+
}
|
|
1591
|
+
});
|
|
1592
|
+
}
|
|
1593
|
+
};
|
|
1594
|
+
|
|
1595
|
+
// src/common/open-api/services/HumanTaskResourceService.ts
|
|
1596
|
+
var HumanTaskResourceService = class {
|
|
1597
|
+
constructor(httpRequest) {
|
|
1598
|
+
this.httpRequest = httpRequest;
|
|
1599
|
+
}
|
|
1600
|
+
getConductorTaskById(taskId) {
|
|
1601
|
+
return this.httpRequest.request({
|
|
1602
|
+
method: "GET",
|
|
1603
|
+
url: "/human/tasks/{taskId}/conductorTask",
|
|
1604
|
+
path: {
|
|
1605
|
+
"taskId": taskId
|
|
1606
|
+
}
|
|
1607
|
+
});
|
|
1608
|
+
}
|
|
1609
|
+
};
|
|
1610
|
+
|
|
1414
1611
|
// src/common/open-api/ConductorClient.ts
|
|
1415
1612
|
var defaultRequestHandler = (request2, config, options) => request2(config, options);
|
|
1416
1613
|
var ConductorClient = class {
|
|
@@ -1441,6 +1638,8 @@ var ConductorClient = class {
|
|
|
1441
1638
|
this.tokenResource = new TokenResourceService(this.request);
|
|
1442
1639
|
this.workflowBulkResource = new WorkflowBulkResourceService(this.request);
|
|
1443
1640
|
this.workflowResource = new WorkflowResourceService(this.request);
|
|
1641
|
+
this.humanTask = new HumanTaskService(this.request);
|
|
1642
|
+
this.humanTaskResource = new HumanTaskResourceService(this.request);
|
|
1444
1643
|
}
|
|
1445
1644
|
};
|
|
1446
1645
|
|
|
@@ -2026,8 +2225,7 @@ var ConductorError = class extends Error {
|
|
|
2026
2225
|
}
|
|
2027
2226
|
};
|
|
2028
2227
|
|
|
2029
|
-
// src/core/
|
|
2030
|
-
var RETRY_TIME_IN_MILLISECONDS = 1e4;
|
|
2228
|
+
// src/core/helpers.ts
|
|
2031
2229
|
var errorMapper = (error) => new ConductorError(error?.body?.message, error);
|
|
2032
2230
|
var tryCatchReThrow = (fn) => {
|
|
2033
2231
|
try {
|
|
@@ -2036,6 +2234,9 @@ var tryCatchReThrow = (fn) => {
|
|
|
2036
2234
|
throw errorMapper(error);
|
|
2037
2235
|
}
|
|
2038
2236
|
};
|
|
2237
|
+
|
|
2238
|
+
// src/core/executor.ts
|
|
2239
|
+
var RETRY_TIME_IN_MILLISECONDS = 1e4;
|
|
2039
2240
|
var WorkflowExecutor = class {
|
|
2040
2241
|
constructor(client) {
|
|
2041
2242
|
this._client = client;
|
|
@@ -2109,6 +2310,61 @@ var WorkflowExecutor = class {
|
|
|
2109
2310
|
return tryCatchReThrow(() => this._client.taskResource.getTask(taskId));
|
|
2110
2311
|
}
|
|
2111
2312
|
};
|
|
2313
|
+
|
|
2314
|
+
// src/core/human.ts
|
|
2315
|
+
var HumanExecutor = class {
|
|
2316
|
+
constructor(client) {
|
|
2317
|
+
this._client = client;
|
|
2318
|
+
}
|
|
2319
|
+
async getTasksByFilter(state, assignee, assigneeType, claimedBy, taskName, freeText, includeInputOutput = false) {
|
|
2320
|
+
const response = await this._client.humanTask.getTasksByFilter(state, assignee, assigneeType, claimedBy, taskName, freeText, includeInputOutput);
|
|
2321
|
+
if (response.results != void 0) {
|
|
2322
|
+
return response.results;
|
|
2323
|
+
}
|
|
2324
|
+
return [];
|
|
2325
|
+
}
|
|
2326
|
+
getTaskById(taskId) {
|
|
2327
|
+
return tryCatchReThrow(() => this._client.humanTask.getTask1(taskId));
|
|
2328
|
+
}
|
|
2329
|
+
async claimTaskAsExternalUser(taskId, assignee) {
|
|
2330
|
+
try {
|
|
2331
|
+
await this._client.humanTask.assignAndClaim(taskId, assignee);
|
|
2332
|
+
} catch (error) {
|
|
2333
|
+
throw errorMapper(error);
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
async claimTaskAsConductorUser(taskId) {
|
|
2337
|
+
try {
|
|
2338
|
+
await this._client.humanTask.claimTask(taskId);
|
|
2339
|
+
} catch (error) {
|
|
2340
|
+
throw errorMapper(error);
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
async releaseTask(taskId) {
|
|
2344
|
+
try {
|
|
2345
|
+
await this._client.humanTask.releaseTask(taskId);
|
|
2346
|
+
} catch (error) {
|
|
2347
|
+
throw errorMapper(error);
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
async getTemplateById(templateId) {
|
|
2351
|
+
return tryCatchReThrow(() => this._client.humanTask.getTemplateById(templateId));
|
|
2352
|
+
}
|
|
2353
|
+
async updateTaskOutput(taskId, requestBody) {
|
|
2354
|
+
try {
|
|
2355
|
+
await this._client.humanTask.updateTaskOutput(taskId, requestBody, false);
|
|
2356
|
+
} catch (error) {
|
|
2357
|
+
throw errorMapper(error);
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
async completeTask(taskId, requestBody = {}) {
|
|
2361
|
+
try {
|
|
2362
|
+
await this._client.humanTask.updateTaskOutput(taskId, requestBody, true);
|
|
2363
|
+
} catch (error) {
|
|
2364
|
+
throw errorMapper(error);
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
};
|
|
2112
2368
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2113
2369
|
0 && (module.exports = {
|
|
2114
2370
|
ApiError,
|
|
@@ -2120,6 +2376,7 @@ var WorkflowExecutor = class {
|
|
|
2120
2376
|
DefaultLogger,
|
|
2121
2377
|
EventResourceService,
|
|
2122
2378
|
HealthCheckResourceService,
|
|
2379
|
+
HumanExecutor,
|
|
2123
2380
|
MetadataResourceService,
|
|
2124
2381
|
SchedulerResourceService,
|
|
2125
2382
|
TaskManager,
|