@io-orkes/conductor-javascript 2.1.3-alpha1 → 2.1.3

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 CHANGED
@@ -933,6 +933,29 @@ declare type WorkflowStatus = {
933
933
  status?: 'RUNNING' | 'COMPLETED' | 'FAILED' | 'TIMED_OUT' | 'TERMINATED' | 'PAUSED';
934
934
  };
935
935
 
936
+ declare type TaskMock = {
937
+ executionTime?: number;
938
+ output: Record<string, any>;
939
+ queueWaitTime?: number;
940
+ status: "IN_PROGRESS" | "FAILED" | "FAILED_WITH_TERMINAL_ERROR" | "COMPLETED";
941
+ };
942
+
943
+ declare type WorkflowTestRequest = {
944
+ correlationId?: string;
945
+ createdBy?: string;
946
+ externalInputPayloadStoragePath?: string;
947
+ idempotencyKey?: string;
948
+ idempotencyStrategy?: "FAIL" | "RETURN_EXISTING";
949
+ input?: Record<string, Record<string, any>>;
950
+ name: string;
951
+ priority?: number;
952
+ subWorkflowTestRequest?: Record<string, WorkflowTestRequest>;
953
+ taskRefToMockOutput?: Record<string, Array<TaskMock>>;
954
+ taskToDomain?: Record<string, string>;
955
+ version?: number;
956
+ workflowDef?: WorkflowDef$1;
957
+ };
958
+
936
959
  declare class WorkflowResourceService {
937
960
  readonly httpRequest: BaseHttpRequest;
938
961
  constructor(httpRequest: BaseHttpRequest);
@@ -1149,6 +1172,13 @@ declare class WorkflowResourceService {
1149
1172
  * @throws ApiError
1150
1173
  */
1151
1174
  resetWorkflow(workflowId: string): CancelablePromise<void>;
1175
+ /**
1176
+ * Test workflow execution using mock data
1177
+ * @param requestBody
1178
+ * @returns Workflow OK
1179
+ * @throws ApiError
1180
+ */
1181
+ testWorkflow(requestBody: WorkflowTestRequest): CancelablePromise<Workflow>;
1152
1182
  }
1153
1183
 
1154
1184
  /**
@@ -1192,17 +1222,6 @@ declare type HumanTaskAssignment = {
1192
1222
  slaMinutes?: number;
1193
1223
  };
1194
1224
 
1195
- declare type HumanTaskTemplate = {
1196
- createdBy?: string;
1197
- createdOn?: number;
1198
- jsonSchema: Record<string, any>;
1199
- name: string;
1200
- templateUI: Record<string, any>;
1201
- updatedBy?: string;
1202
- updatedOn?: number;
1203
- version: number;
1204
- };
1205
-
1206
1225
  declare type HumanTaskTrigger = {
1207
1226
  startWorkflowRequest?: StartWorkflowRequest;
1208
1227
  triggerType?: 'ASSIGNEE_CHANGED' | 'PENDING' | 'IN_PROGRESS' | 'ASSIGNED' | 'COMPLETED' | 'TIMED_OUT';
@@ -1214,11 +1233,10 @@ declare type UserFormTemplate = {
1214
1233
  };
1215
1234
 
1216
1235
  declare type HumanTaskDefinition = {
1217
- assignmentCompletionStrategy?: "LEAVE_OPEN" | "TERMINATE";
1236
+ assignmentCompletionStrategy?: 'LEAVE_OPEN' | 'TERMINATE';
1218
1237
  assignments?: Array<HumanTaskAssignment>;
1219
1238
  taskTriggers?: Array<HumanTaskTrigger>;
1220
1239
  userFormTemplate?: UserFormTemplate;
1221
- fullTemplate?: HumanTaskTemplate;
1222
1240
  };
1223
1241
 
1224
1242
  declare type HumanTaskEntry = {
@@ -1251,7 +1269,6 @@ declare type HumanTaskSearch = {
1251
1269
  start?: number;
1252
1270
  states?: Array<'PENDING' | 'ASSIGNED' | 'IN_PROGRESS' | 'COMPLETED' | 'TIMED_OUT' | 'DELETED'>;
1253
1271
  taskRefNames?: Array<string>;
1254
- workflowIds?: Array<string>;
1255
1272
  workflowNames?: Array<string>;
1256
1273
  };
1257
1274
 
@@ -1260,6 +1277,17 @@ declare type HumanTaskSearchResult = {
1260
1277
  totalHits?: number;
1261
1278
  };
1262
1279
 
1280
+ declare type HumanTaskTemplate = {
1281
+ createdBy?: string;
1282
+ createdOn?: number;
1283
+ jsonSchema: Record<string, any>;
1284
+ name: string;
1285
+ templateUI: Record<string, any>;
1286
+ updatedBy?: string;
1287
+ updatedOn?: number;
1288
+ version: number;
1289
+ };
1290
+
1263
1291
  declare class HumanTaskService {
1264
1292
  readonly httpRequest: BaseHttpRequest;
1265
1293
  constructor(httpRequest: BaseHttpRequest);
@@ -1301,7 +1329,7 @@ declare class HumanTaskService {
1301
1329
  * @returns HumanTaskEntry OK
1302
1330
  * @throws ApiError
1303
1331
  */
1304
- getTask1(taskId: string, withTemplate?: boolean): CancelablePromise<HumanTaskEntry>;
1332
+ getTask1(taskId: string): CancelablePromise<HumanTaskEntry>;
1305
1333
  /**
1306
1334
  * Claim a task by authenticated Conductor user
1307
1335
  * @param taskId
@@ -1963,7 +1991,7 @@ declare class HumanExecutor {
1963
1991
  * @param taskId
1964
1992
  * @returns
1965
1993
  */
1966
- getTaskById(taskId: string, withTemplate?: boolean): Promise<HumanTaskEntry>;
1994
+ getTaskById(taskId: string): Promise<HumanTaskEntry>;
1967
1995
  /**
1968
1996
  * Assigns taskId to assignee. If the task is already assigned to another user, this will fail.
1969
1997
  * @param taskId
@@ -2358,6 +2386,14 @@ declare class MetadataClient {
2358
2386
  * @returns
2359
2387
  */
2360
2388
  updateTask(taskDef: TaskDef): Promise<void>;
2389
+ /**
2390
+ * Creates or updates (overwrite: true) a workflow definition
2391
+ *
2392
+ * @param workflowDef
2393
+ * @param overwrite
2394
+ * @returns
2395
+ */
2396
+ registerWorkflowDef(workflowDef: WorkflowDef$1, overwrite?: boolean): any;
2361
2397
  }
2362
2398
 
2363
2399
  declare type FetchFn<T = RequestInit, R extends {
package/dist/index.d.ts CHANGED
@@ -933,6 +933,29 @@ declare type WorkflowStatus = {
933
933
  status?: 'RUNNING' | 'COMPLETED' | 'FAILED' | 'TIMED_OUT' | 'TERMINATED' | 'PAUSED';
934
934
  };
935
935
 
936
+ declare type TaskMock = {
937
+ executionTime?: number;
938
+ output: Record<string, any>;
939
+ queueWaitTime?: number;
940
+ status: "IN_PROGRESS" | "FAILED" | "FAILED_WITH_TERMINAL_ERROR" | "COMPLETED";
941
+ };
942
+
943
+ declare type WorkflowTestRequest = {
944
+ correlationId?: string;
945
+ createdBy?: string;
946
+ externalInputPayloadStoragePath?: string;
947
+ idempotencyKey?: string;
948
+ idempotencyStrategy?: "FAIL" | "RETURN_EXISTING";
949
+ input?: Record<string, Record<string, any>>;
950
+ name: string;
951
+ priority?: number;
952
+ subWorkflowTestRequest?: Record<string, WorkflowTestRequest>;
953
+ taskRefToMockOutput?: Record<string, Array<TaskMock>>;
954
+ taskToDomain?: Record<string, string>;
955
+ version?: number;
956
+ workflowDef?: WorkflowDef$1;
957
+ };
958
+
936
959
  declare class WorkflowResourceService {
937
960
  readonly httpRequest: BaseHttpRequest;
938
961
  constructor(httpRequest: BaseHttpRequest);
@@ -1149,6 +1172,13 @@ declare class WorkflowResourceService {
1149
1172
  * @throws ApiError
1150
1173
  */
1151
1174
  resetWorkflow(workflowId: string): CancelablePromise<void>;
1175
+ /**
1176
+ * Test workflow execution using mock data
1177
+ * @param requestBody
1178
+ * @returns Workflow OK
1179
+ * @throws ApiError
1180
+ */
1181
+ testWorkflow(requestBody: WorkflowTestRequest): CancelablePromise<Workflow>;
1152
1182
  }
1153
1183
 
1154
1184
  /**
@@ -1192,17 +1222,6 @@ declare type HumanTaskAssignment = {
1192
1222
  slaMinutes?: number;
1193
1223
  };
1194
1224
 
1195
- declare type HumanTaskTemplate = {
1196
- createdBy?: string;
1197
- createdOn?: number;
1198
- jsonSchema: Record<string, any>;
1199
- name: string;
1200
- templateUI: Record<string, any>;
1201
- updatedBy?: string;
1202
- updatedOn?: number;
1203
- version: number;
1204
- };
1205
-
1206
1225
  declare type HumanTaskTrigger = {
1207
1226
  startWorkflowRequest?: StartWorkflowRequest;
1208
1227
  triggerType?: 'ASSIGNEE_CHANGED' | 'PENDING' | 'IN_PROGRESS' | 'ASSIGNED' | 'COMPLETED' | 'TIMED_OUT';
@@ -1214,11 +1233,10 @@ declare type UserFormTemplate = {
1214
1233
  };
1215
1234
 
1216
1235
  declare type HumanTaskDefinition = {
1217
- assignmentCompletionStrategy?: "LEAVE_OPEN" | "TERMINATE";
1236
+ assignmentCompletionStrategy?: 'LEAVE_OPEN' | 'TERMINATE';
1218
1237
  assignments?: Array<HumanTaskAssignment>;
1219
1238
  taskTriggers?: Array<HumanTaskTrigger>;
1220
1239
  userFormTemplate?: UserFormTemplate;
1221
- fullTemplate?: HumanTaskTemplate;
1222
1240
  };
1223
1241
 
1224
1242
  declare type HumanTaskEntry = {
@@ -1251,7 +1269,6 @@ declare type HumanTaskSearch = {
1251
1269
  start?: number;
1252
1270
  states?: Array<'PENDING' | 'ASSIGNED' | 'IN_PROGRESS' | 'COMPLETED' | 'TIMED_OUT' | 'DELETED'>;
1253
1271
  taskRefNames?: Array<string>;
1254
- workflowIds?: Array<string>;
1255
1272
  workflowNames?: Array<string>;
1256
1273
  };
1257
1274
 
@@ -1260,6 +1277,17 @@ declare type HumanTaskSearchResult = {
1260
1277
  totalHits?: number;
1261
1278
  };
1262
1279
 
1280
+ declare type HumanTaskTemplate = {
1281
+ createdBy?: string;
1282
+ createdOn?: number;
1283
+ jsonSchema: Record<string, any>;
1284
+ name: string;
1285
+ templateUI: Record<string, any>;
1286
+ updatedBy?: string;
1287
+ updatedOn?: number;
1288
+ version: number;
1289
+ };
1290
+
1263
1291
  declare class HumanTaskService {
1264
1292
  readonly httpRequest: BaseHttpRequest;
1265
1293
  constructor(httpRequest: BaseHttpRequest);
@@ -1301,7 +1329,7 @@ declare class HumanTaskService {
1301
1329
  * @returns HumanTaskEntry OK
1302
1330
  * @throws ApiError
1303
1331
  */
1304
- getTask1(taskId: string, withTemplate?: boolean): CancelablePromise<HumanTaskEntry>;
1332
+ getTask1(taskId: string): CancelablePromise<HumanTaskEntry>;
1305
1333
  /**
1306
1334
  * Claim a task by authenticated Conductor user
1307
1335
  * @param taskId
@@ -1963,7 +1991,7 @@ declare class HumanExecutor {
1963
1991
  * @param taskId
1964
1992
  * @returns
1965
1993
  */
1966
- getTaskById(taskId: string, withTemplate?: boolean): Promise<HumanTaskEntry>;
1994
+ getTaskById(taskId: string): Promise<HumanTaskEntry>;
1967
1995
  /**
1968
1996
  * Assigns taskId to assignee. If the task is already assigned to another user, this will fail.
1969
1997
  * @param taskId
@@ -2358,6 +2386,14 @@ declare class MetadataClient {
2358
2386
  * @returns
2359
2387
  */
2360
2388
  updateTask(taskDef: TaskDef): Promise<void>;
2389
+ /**
2390
+ * Creates or updates (overwrite: true) a workflow definition
2391
+ *
2392
+ * @param workflowDef
2393
+ * @param overwrite
2394
+ * @returns
2395
+ */
2396
+ registerWorkflowDef(workflowDef: WorkflowDef$1, overwrite?: boolean): any;
2361
2397
  }
2362
2398
 
2363
2399
  declare type FetchFn<T = RequestInit, R extends {
package/dist/index.js CHANGED
@@ -1589,6 +1589,20 @@ var WorkflowResourceService = class {
1589
1589
  }
1590
1590
  });
1591
1591
  }
1592
+ /**
1593
+ * Test workflow execution using mock data
1594
+ * @param requestBody
1595
+ * @returns Workflow OK
1596
+ * @throws ApiError
1597
+ */
1598
+ testWorkflow(requestBody) {
1599
+ return this.httpRequest.request({
1600
+ method: "POST",
1601
+ url: "/workflow/test",
1602
+ body: requestBody,
1603
+ mediaType: "application/json"
1604
+ });
1605
+ }
1592
1606
  };
1593
1607
 
1594
1608
  // src/common/open-api/core/ApiError.ts
@@ -2012,13 +2026,12 @@ var HumanTaskService = class {
2012
2026
  * @returns HumanTaskEntry OK
2013
2027
  * @throws ApiError
2014
2028
  */
2015
- getTask1(taskId, withTemplate = false) {
2029
+ getTask1(taskId) {
2016
2030
  return this.httpRequest.request({
2017
2031
  method: "GET",
2018
2032
  url: "/human/tasks/{taskId}",
2019
2033
  path: {
2020
- "taskId": taskId,
2021
- withTemplate
2034
+ "taskId": taskId
2022
2035
  }
2023
2036
  });
2024
2037
  }
@@ -3129,10 +3142,8 @@ var HumanExecutor = class {
3129
3142
  * @param taskId
3130
3143
  * @returns
3131
3144
  */
3132
- getTaskById(taskId, withTemplate = false) {
3133
- return tryCatchReThrow(
3134
- () => this._client.humanTask.getTask1(taskId, withTemplate)
3135
- );
3145
+ getTaskById(taskId) {
3146
+ return tryCatchReThrow(() => this._client.humanTask.getTask1(taskId));
3136
3147
  }
3137
3148
  /**
3138
3149
  * Assigns taskId to assignee. If the task is already assigned to another user, this will fail.
@@ -3142,12 +3153,7 @@ var HumanExecutor = class {
3142
3153
  */
3143
3154
  async claimTaskAsExternalUser(taskId, assignee, options) {
3144
3155
  return tryCatchReThrow(
3145
- () => this._client.humanTask.assignAndClaim(
3146
- taskId,
3147
- assignee,
3148
- options?.overrideAssignment,
3149
- options?.withTemplate
3150
- )
3156
+ () => this._client.humanTask.assignAndClaim(taskId, assignee, options?.overrideAssignment, options?.withTemplate)
3151
3157
  );
3152
3158
  }
3153
3159
  /**
@@ -3156,13 +3162,7 @@ var HumanExecutor = class {
3156
3162
  * @returns
3157
3163
  */
3158
3164
  async claimTaskAsConductorUser(taskId, options) {
3159
- return tryCatchReThrow(
3160
- () => this._client.humanTask.claimTask(
3161
- taskId,
3162
- options?.overrideAssignment,
3163
- options?.withTemplate
3164
- )
3165
- );
3165
+ return tryCatchReThrow(() => this._client.humanTask.claimTask(taskId, options?.overrideAssignment, options?.withTemplate));
3166
3166
  }
3167
3167
  /**
3168
3168
  * Claim task as conductor user
@@ -4002,6 +4002,18 @@ var MetadataClient = class {
4002
4002
  () => this._client.metadataResource.updateTaskDef(taskDef)
4003
4003
  );
4004
4004
  }
4005
+ /**
4006
+ * Creates or updates (overwrite: true) a workflow definition
4007
+ *
4008
+ * @param workflowDef
4009
+ * @param overwrite
4010
+ * @returns
4011
+ */
4012
+ registerWorkflowDef(workflowDef, overwrite = false) {
4013
+ return tryCatchReThrow(
4014
+ () => this._client.metadataResource.create(workflowDef, overwrite)
4015
+ );
4016
+ }
4005
4017
  };
4006
4018
 
4007
4019
  // src/orkes/BaseOrkesConductorClient.ts