@io-orkes/conductor-javascript 1.2.3 → 2.0.0-rc1

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 CHANGED
@@ -7,7 +7,6 @@ Building the task workers in javascript mainly consists of the following steps:
7
7
  1. Setup conductor-javascript package
8
8
  2. [Create and run task workers](workers_sdk.md)
9
9
  3. [Create workflows using code](workflow_sdk.md)
10
- 4. [Api Docs](docs/api/README.md)
11
10
 
12
11
  ### Setup Conductor Javascript Package
13
12
 
@@ -1,5 +1,5 @@
1
- import { O as OrkesApiConfig, C as ConductorHttpRequest, a as ConductorClient } from './types-f83aa26f.js';
2
- export { p as Action, m as ApiError, A as ApiRequestOptions, k as ApiResult, a6 as AssignmentPolicy, a8 as BackToAssigment, B as BaseHttpRequest, o as CancelError, d as CancelablePromise, a9 as ClearAssigment, au as CommonTaskDef, b as ConductorClientAPIConfig, aR as ConductorError, ap as ConductorLogLevel, ao as ConductorLogger, h as ConductorWorker, ar as DefaultLogger, aq as DefaultLoggerConfig, ax as DoWhileTaskDef, aa as Escalate, E as EventHandler, _ as EventResourceService, ay as EventTaskDef, q as ExternalStorageLocation, ab as FFAAssignment, F as FetchFn, a7 as Fixed, aB as ForkJoinDynamicDef, az as ForkJoinTaskDef, G as GenerateTokenRequest, ac as HTScrollableSearchResultHumanTaskEntry, $ as HealthCheckResourceService, aC as HttpInputParameters, aD as HttpTaskDef, aT as HumanExecutor, ad as HumanTaskActionLogEntry, ae as HumanTaskEntry, af as HumanTaskLoad, ag as HumanTaskStateLogEntry, ah as HumanTaskTemplate, ai as HumanTaskTemplateEntry, aF as InlineTaskDef, aE as InlineTaskInputParameters, aA as JoinTaskDef, aG as JsonJQTransformTaskDef, aH as KafkaPublishInputParameters, aI as KafkaPublishTaskDef, aj as LeastBusyGroupMemberAssignment, a0 as MetadataResourceService, ak as Never, l as OnCancel, c as OpenAPIConfig, P as PollData, at as RequestType, r as RerunWorkflowRequest, s as Response, R as RunnerArgs, S as SaveScheduleRequest, a1 as SchedulerResourceService, t as ScrollableSearchResultWorkflowSummary, al as SearchResultHumanTaskEntry, u as SearchResultTask, v as SearchResultTaskSummary, w as SearchResultWorkflow, x as SearchResultWorkflowScheduleExecutionModel, y as SearchResultWorkflowSummary, aJ as SetVariableTaskDef, aK as SimpleTaskDef, z as SkipTaskRequest, D as StartWorkflow, H as StartWorkflowRequest, I as SubWorkflowParams, aL as SubWorkflowTaskDef, aM as SwitchTaskDef, J as Task, K as TaskDef, aw as TaskDefTypes, L as TaskDetails, i as TaskErrorHandler, M as TaskExecLog, g as TaskManager, f as TaskManagerConfig, e as TaskManagerOptions, a2 as TaskResourceService, N as TaskResult, aS as TaskResultStatus, T as TaskRunner, j as TaskRunnerOptions, Q as TaskSummary, av as TaskType, am as Terminate, aN as TerminateTaskDef, an as TimeoutPolicy, a3 as TokenResourceService, aO as WaitTaskDef, W as Workflow, a4 as WorkflowBulkResourceService, aP as WorkflowDef, aQ as WorkflowExecutor, a5 as WorkflowResourceService, U as WorkflowSchedule, V as WorkflowScheduleExecutionModel, X as WorkflowStatus, Y as WorkflowSummary, Z as WorkflowTask, aZ as conductorEventTask, aU as doWhileTask, aW as dynamicForkTask, aX as eventTask, a_ as forkTask, a$ as forkTaskJoin, br as generate, be as generateDoWhileTask, bf as generateEventTask, bg as generateForkJoinTask, bi as generateHTTPTask, bj as generateInlineTask, bk as generateJQTransformTask, bh as generateJoinTask, bl as generateKafkaPublishTask, bn as generateSetVariableTask, bd as generateSimpleTask, bm as generateSubWorkflowTask, bq as generateSwitchTask, bo as generateTerminateTask, bp as generateWaitTask, b0 as httpTask, b1 as inlineTask, b2 as joinTask, b3 as jsonJqTask, b4 as kafkaPublishTask, aV as newLoopTask, n as noopErrorHandler, as as noopLogger, b5 as setVariableTask, b6 as simpleTask, aY as sqsEventTask, b7 as subWorkflowTask, b8 as switchTask, bs as taskGenMapper, b9 as terminateTask, ba as waitTaskDuration, bb as waitTaskUntil, bc as workflow } from './types-f83aa26f.js';
1
+ import { O as OrkesApiConfig, C as ConductorHttpRequest, a as ConductorClient } from './types-dbfd77fb.js';
2
+ export { p as Action, m as ApiError, A as ApiRequestOptions, k as ApiResult, B as BaseHttpRequest, o as CancelError, d as CancelablePromise, ao as CommonTaskDef, b as ConductorClientAPIConfig, aN as ConductorError, aj as ConductorLogLevel, ai as ConductorLogger, h as ConductorWorker, al as DefaultLogger, ak as DefaultLoggerConfig, ar as DoWhileTaskDef, E as EventHandler, _ as EventResourceService, as as EventTaskDef, q as ExternalStorageLocation, F as FetchFn, av as ForkJoinDynamicDef, at as ForkJoinTaskDef, G as GenerateTokenRequest, a6 as HTScrollableSearchResultHumanTaskEntry, $ as HealthCheckResourceService, aw as HttpInputParameters, ax as HttpTaskDef, aP as HumanExecutor, ab as HumanTaskAssignment, aa as HumanTaskDefinition, ah as HumanTaskEntry, ag as HumanTaskSearch, af as HumanTaskSearchResult, ae as HumanTaskTemplate, ac as HumanTaskTrigger, a9 as HumanTaskUser, az as InlineTaskDef, ay as InlineTaskInputParameters, au as JoinTaskDef, aA as JsonJQTransformTaskDef, aB as KafkaPublishInputParameters, aC as KafkaPublishTaskDef, a0 as MetadataResourceService, l as OnCancel, c as OpenAPIConfig, P as PollData, an as RequestType, r as RerunWorkflowRequest, s as Response, R as RunnerArgs, S as SaveScheduleRequest, a1 as SchedulerResourceService, t as ScrollableSearchResultWorkflowSummary, u as SearchResultTask, v as SearchResultTaskSummary, w as SearchResultWorkflow, x as SearchResultWorkflowScheduleExecutionModel, y as SearchResultWorkflowSummary, aD as SetVariableTaskDef, aE as SimpleTaskDef, z as SkipTaskRequest, D as StartWorkflow, H as StartWorkflowRequest, I as SubWorkflowParams, aF as SubWorkflowTaskDef, aG as SwitchTaskDef, J as Task, K as TaskDef, aq as TaskDefTypes, L as TaskDetails, i as TaskErrorHandler, M as TaskExecLog, aK as TaskFinderPredicate, g as TaskManager, f as TaskManagerConfig, e as TaskManagerOptions, a2 as TaskResourceService, N as TaskResult, aO as TaskResultStatus, T as TaskRunner, j as TaskRunnerOptions, Q as TaskSummary, ap as TaskType, a7 as Terminate, aH as TerminateTaskDef, a8 as TimeoutPolicy, a3 as TokenResourceService, ad as UserFormTemplate, aI as WaitTaskDef, W as Workflow, a4 as WorkflowBulkResourceService, aJ as WorkflowDef, aM as WorkflowExecutor, a5 as WorkflowResourceService, U as WorkflowSchedule, V as WorkflowScheduleExecutionModel, X as WorkflowStatus, Y as WorkflowSummary, Z as WorkflowTask, aL as completedTaskMatchingType, aV as conductorEventTask, aQ as doWhileTask, aS as dynamicForkTask, aT as eventTask, aW as forkTask, aX as forkTaskJoin, bn as generate, ba as generateDoWhileTask, bb as generateEventTask, bc as generateForkJoinTask, be as generateHTTPTask, bf as generateInlineTask, bg as generateJQTransformTask, bd as generateJoinTask, bh as generateKafkaPublishTask, bj as generateSetVariableTask, b9 as generateSimpleTask, bi as generateSubWorkflowTask, bm as generateSwitchTask, bk as generateTerminateTask, bl as generateWaitTask, aY as httpTask, aZ as inlineTask, a_ as joinTask, a$ as jsonJqTask, b0 as kafkaPublishTask, aR as newLoopTask, n as noopErrorHandler, am as noopLogger, b1 as setVariableTask, b2 as simpleTask, aU as sqsEventTask, b3 as subWorkflowTask, b4 as switchTask, bo as taskGenMapper, b5 as terminateTask, b6 as waitTaskDuration, b7 as waitTaskUntil, b8 as workflow } from './types-dbfd77fb.js';
3
3
 
4
4
  /**
5
5
  * Takes a config with keyId and keySecret returns a promise with an instance of ConductorClient
package/dist/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { O as OrkesApiConfig, C as ConductorHttpRequest, a as ConductorClient } from './types-f83aa26f.js';
2
- export { p as Action, m as ApiError, A as ApiRequestOptions, k as ApiResult, a6 as AssignmentPolicy, a8 as BackToAssigment, B as BaseHttpRequest, o as CancelError, d as CancelablePromise, a9 as ClearAssigment, au as CommonTaskDef, b as ConductorClientAPIConfig, aR as ConductorError, ap as ConductorLogLevel, ao as ConductorLogger, h as ConductorWorker, ar as DefaultLogger, aq as DefaultLoggerConfig, ax as DoWhileTaskDef, aa as Escalate, E as EventHandler, _ as EventResourceService, ay as EventTaskDef, q as ExternalStorageLocation, ab as FFAAssignment, F as FetchFn, a7 as Fixed, aB as ForkJoinDynamicDef, az as ForkJoinTaskDef, G as GenerateTokenRequest, ac as HTScrollableSearchResultHumanTaskEntry, $ as HealthCheckResourceService, aC as HttpInputParameters, aD as HttpTaskDef, aT as HumanExecutor, ad as HumanTaskActionLogEntry, ae as HumanTaskEntry, af as HumanTaskLoad, ag as HumanTaskStateLogEntry, ah as HumanTaskTemplate, ai as HumanTaskTemplateEntry, aF as InlineTaskDef, aE as InlineTaskInputParameters, aA as JoinTaskDef, aG as JsonJQTransformTaskDef, aH as KafkaPublishInputParameters, aI as KafkaPublishTaskDef, aj as LeastBusyGroupMemberAssignment, a0 as MetadataResourceService, ak as Never, l as OnCancel, c as OpenAPIConfig, P as PollData, at as RequestType, r as RerunWorkflowRequest, s as Response, R as RunnerArgs, S as SaveScheduleRequest, a1 as SchedulerResourceService, t as ScrollableSearchResultWorkflowSummary, al as SearchResultHumanTaskEntry, u as SearchResultTask, v as SearchResultTaskSummary, w as SearchResultWorkflow, x as SearchResultWorkflowScheduleExecutionModel, y as SearchResultWorkflowSummary, aJ as SetVariableTaskDef, aK as SimpleTaskDef, z as SkipTaskRequest, D as StartWorkflow, H as StartWorkflowRequest, I as SubWorkflowParams, aL as SubWorkflowTaskDef, aM as SwitchTaskDef, J as Task, K as TaskDef, aw as TaskDefTypes, L as TaskDetails, i as TaskErrorHandler, M as TaskExecLog, g as TaskManager, f as TaskManagerConfig, e as TaskManagerOptions, a2 as TaskResourceService, N as TaskResult, aS as TaskResultStatus, T as TaskRunner, j as TaskRunnerOptions, Q as TaskSummary, av as TaskType, am as Terminate, aN as TerminateTaskDef, an as TimeoutPolicy, a3 as TokenResourceService, aO as WaitTaskDef, W as Workflow, a4 as WorkflowBulkResourceService, aP as WorkflowDef, aQ as WorkflowExecutor, a5 as WorkflowResourceService, U as WorkflowSchedule, V as WorkflowScheduleExecutionModel, X as WorkflowStatus, Y as WorkflowSummary, Z as WorkflowTask, aZ as conductorEventTask, aU as doWhileTask, aW as dynamicForkTask, aX as eventTask, a_ as forkTask, a$ as forkTaskJoin, br as generate, be as generateDoWhileTask, bf as generateEventTask, bg as generateForkJoinTask, bi as generateHTTPTask, bj as generateInlineTask, bk as generateJQTransformTask, bh as generateJoinTask, bl as generateKafkaPublishTask, bn as generateSetVariableTask, bd as generateSimpleTask, bm as generateSubWorkflowTask, bq as generateSwitchTask, bo as generateTerminateTask, bp as generateWaitTask, b0 as httpTask, b1 as inlineTask, b2 as joinTask, b3 as jsonJqTask, b4 as kafkaPublishTask, aV as newLoopTask, n as noopErrorHandler, as as noopLogger, b5 as setVariableTask, b6 as simpleTask, aY as sqsEventTask, b7 as subWorkflowTask, b8 as switchTask, bs as taskGenMapper, b9 as terminateTask, ba as waitTaskDuration, bb as waitTaskUntil, bc as workflow } from './types-f83aa26f.js';
1
+ import { O as OrkesApiConfig, C as ConductorHttpRequest, a as ConductorClient } from './types-dbfd77fb.js';
2
+ export { p as Action, m as ApiError, A as ApiRequestOptions, k as ApiResult, B as BaseHttpRequest, o as CancelError, d as CancelablePromise, ao as CommonTaskDef, b as ConductorClientAPIConfig, aN as ConductorError, aj as ConductorLogLevel, ai as ConductorLogger, h as ConductorWorker, al as DefaultLogger, ak as DefaultLoggerConfig, ar as DoWhileTaskDef, E as EventHandler, _ as EventResourceService, as as EventTaskDef, q as ExternalStorageLocation, F as FetchFn, av as ForkJoinDynamicDef, at as ForkJoinTaskDef, G as GenerateTokenRequest, a6 as HTScrollableSearchResultHumanTaskEntry, $ as HealthCheckResourceService, aw as HttpInputParameters, ax as HttpTaskDef, aP as HumanExecutor, ab as HumanTaskAssignment, aa as HumanTaskDefinition, ah as HumanTaskEntry, ag as HumanTaskSearch, af as HumanTaskSearchResult, ae as HumanTaskTemplate, ac as HumanTaskTrigger, a9 as HumanTaskUser, az as InlineTaskDef, ay as InlineTaskInputParameters, au as JoinTaskDef, aA as JsonJQTransformTaskDef, aB as KafkaPublishInputParameters, aC as KafkaPublishTaskDef, a0 as MetadataResourceService, l as OnCancel, c as OpenAPIConfig, P as PollData, an as RequestType, r as RerunWorkflowRequest, s as Response, R as RunnerArgs, S as SaveScheduleRequest, a1 as SchedulerResourceService, t as ScrollableSearchResultWorkflowSummary, u as SearchResultTask, v as SearchResultTaskSummary, w as SearchResultWorkflow, x as SearchResultWorkflowScheduleExecutionModel, y as SearchResultWorkflowSummary, aD as SetVariableTaskDef, aE as SimpleTaskDef, z as SkipTaskRequest, D as StartWorkflow, H as StartWorkflowRequest, I as SubWorkflowParams, aF as SubWorkflowTaskDef, aG as SwitchTaskDef, J as Task, K as TaskDef, aq as TaskDefTypes, L as TaskDetails, i as TaskErrorHandler, M as TaskExecLog, aK as TaskFinderPredicate, g as TaskManager, f as TaskManagerConfig, e as TaskManagerOptions, a2 as TaskResourceService, N as TaskResult, aO as TaskResultStatus, T as TaskRunner, j as TaskRunnerOptions, Q as TaskSummary, ap as TaskType, a7 as Terminate, aH as TerminateTaskDef, a8 as TimeoutPolicy, a3 as TokenResourceService, ad as UserFormTemplate, aI as WaitTaskDef, W as Workflow, a4 as WorkflowBulkResourceService, aJ as WorkflowDef, aM as WorkflowExecutor, a5 as WorkflowResourceService, U as WorkflowSchedule, V as WorkflowScheduleExecutionModel, X as WorkflowStatus, Y as WorkflowSummary, Z as WorkflowTask, aL as completedTaskMatchingType, aV as conductorEventTask, aQ as doWhileTask, aS as dynamicForkTask, aT as eventTask, aW as forkTask, aX as forkTaskJoin, bn as generate, ba as generateDoWhileTask, bb as generateEventTask, bc as generateForkJoinTask, be as generateHTTPTask, bf as generateInlineTask, bg as generateJQTransformTask, bd as generateJoinTask, bh as generateKafkaPublishTask, bj as generateSetVariableTask, b9 as generateSimpleTask, bi as generateSubWorkflowTask, bm as generateSwitchTask, bk as generateTerminateTask, bl as generateWaitTask, aY as httpTask, aZ as inlineTask, a_ as joinTask, a$ as jsonJqTask, b0 as kafkaPublishTask, aR as newLoopTask, n as noopErrorHandler, am as noopLogger, b1 as setVariableTask, b2 as simpleTask, aU as sqsEventTask, b3 as subWorkflowTask, b4 as switchTask, bo as taskGenMapper, b5 as terminateTask, b6 as waitTaskDuration, b7 as waitTaskUntil, b8 as workflow } from './types-dbfd77fb.js';
3
3
 
4
4
  /**
5
5
  * Takes a config with keyId and keySecret returns a promise with an instance of ConductorClient
package/dist/browser.js CHANGED
@@ -50,6 +50,7 @@ __export(browser_exports, {
50
50
  WorkflowBulkResourceService: () => WorkflowBulkResourceService,
51
51
  WorkflowExecutor: () => WorkflowExecutor,
52
52
  WorkflowResourceService: () => WorkflowResourceService,
53
+ completedTaskMatchingType: () => completedTaskMatchingType,
53
54
  conductorEventTask: () => conductorEventTask,
54
55
  doWhileTask: () => doWhileTask,
55
56
  dynamicForkTask: () => dynamicForkTask,
@@ -1918,83 +1919,70 @@ var HumanTaskService = class {
1918
1919
  this.httpRequest = httpRequest;
1919
1920
  }
1920
1921
  /**
1921
- * List tasks by filters - task name, state, assignee, assignee type, claimed
1922
- * @param state
1923
- * @param assignee
1924
- * @param assigneeType
1925
- * @param claimedBy
1926
- * @param taskName
1927
- * @param freeText
1928
- * @param includeInputOutput
1929
- * @returns SearchResultHumanTaskEntry OK
1922
+ * If the workflow is disconnected from tasks, this API can be used to clean up (in bulk)
1923
+ * @param requestBody
1924
+ * @returns any OK
1930
1925
  * @throws ApiError
1931
1926
  */
1932
- getTasksByFilter(state, assignee, assigneeType, claimedBy, taskName, freeText, includeInputOutput = false) {
1927
+ deleteTaskFromHumanTaskRecords(requestBody) {
1933
1928
  return this.httpRequest.request({
1934
- method: "GET",
1935
- url: "/human/tasks",
1936
- query: {
1937
- "state": state,
1938
- "assignee": assignee,
1939
- "assigneeType": assigneeType,
1940
- "claimedBy": claimedBy,
1941
- "taskName": taskName,
1942
- "freeText": freeText,
1943
- "includeInputOutput": includeInputOutput
1944
- }
1929
+ method: "DELETE",
1930
+ url: "/human/tasks/delete",
1931
+ body: requestBody,
1932
+ mediaType: "application/json"
1945
1933
  });
1946
1934
  }
1947
1935
  /**
1948
- * Get task load grouped by workflow name and task ref name per user
1949
- * @returns HumanTaskLoad OK
1936
+ * If the workflow is disconnected from tasks, this API can be used to clean up
1937
+ * @param taskId
1938
+ * @returns any OK
1950
1939
  * @throws ApiError
1951
1940
  */
1952
- getTaskLoad() {
1941
+ deleteTaskFromHumanTaskRecords1(taskId) {
1953
1942
  return this.httpRequest.request({
1954
- method: "GET",
1955
- url: "/human/tasks/load"
1943
+ method: "DELETE",
1944
+ url: "/human/tasks/delete/{taskId}",
1945
+ path: {
1946
+ "taskId": taskId
1947
+ }
1956
1948
  });
1957
1949
  }
1958
1950
  /**
1959
1951
  * Search human tasks
1960
- * @param queryId
1961
- * @param start
1962
- * @param size
1963
- * @param freeText
1964
- * @param query
1965
- * @param jsonQuery
1966
- * @param includeInputOutput
1967
- * @returns HTScrollableSearchResultHumanTaskEntry OK
1952
+ * @param requestBody
1953
+ * @returns HumanTaskSearchResult OK
1968
1954
  * @throws ApiError
1969
1955
  */
1970
- search1(queryId, start, size = 100, freeText = "*", query, jsonQuery, includeInputOutput = false) {
1956
+ search(requestBody) {
1971
1957
  return this.httpRequest.request({
1972
- method: "GET",
1958
+ method: "POST",
1973
1959
  url: "/human/tasks/search",
1974
- query: {
1975
- "queryId": queryId,
1976
- "start": start,
1977
- "size": size,
1978
- "freeText": freeText,
1979
- "query": query,
1980
- "jsonQuery": jsonQuery,
1981
- "includeInputOutput": includeInputOutput
1982
- }
1960
+ body: requestBody,
1961
+ mediaType: "application/json"
1983
1962
  });
1984
1963
  }
1985
1964
  /**
1986
- * If the workflow is disconnected from tasks, this API can be used to clean up
1987
- * @param taskId
1965
+ * Update task output, optionally complete
1966
+ * @param workflowId
1967
+ * @param taskRefName
1968
+ * @param requestBody
1969
+ * @param complete
1970
+ * @param iteration Populate this value if your task is in a loop and you want to update a specific iteration. If its not in a loop OR if you want to just update the latest iteration, leave this as empty
1988
1971
  * @returns any OK
1989
1972
  * @throws ApiError
1990
1973
  */
1991
- updateTaskOutput1(taskId) {
1974
+ updateTaskOutputByRef(workflowId, taskRefName, requestBody, complete = false, iteration) {
1992
1975
  return this.httpRequest.request({
1993
- method: "DELETE",
1994
- url: "/human/tasks/{taskId}",
1995
- path: {
1996
- "taskId": taskId
1997
- }
1976
+ method: "POST",
1977
+ url: "/human/tasks/update/taskRef",
1978
+ query: {
1979
+ "workflowId": workflowId,
1980
+ "taskRefName": taskRefName,
1981
+ "complete": complete,
1982
+ "iteration": iteration
1983
+ },
1984
+ body: requestBody,
1985
+ mediaType: "application/json"
1998
1986
  });
1999
1987
  }
2000
1988
  /**
@@ -2012,33 +2000,22 @@ var HumanTaskService = class {
2012
2000
  }
2013
2001
  });
2014
2002
  }
2015
- /**
2016
- * Get human task action log entries by task id
2017
- * @param taskId
2018
- * @returns HumanTaskActionLogEntry OK
2019
- * @throws ApiError
2020
- */
2021
- getActionLogs(taskId) {
2022
- return this.httpRequest.request({
2023
- method: "GET",
2024
- url: "/human/tasks/{taskId}/actionLogs",
2025
- path: {
2026
- "taskId": taskId
2027
- }
2028
- });
2029
- }
2030
2003
  /**
2031
2004
  * Claim a task by authenticated Conductor user
2032
2005
  * @param taskId
2006
+ * @param overrideAssignment
2033
2007
  * @returns any OK
2034
2008
  * @throws ApiError
2035
2009
  */
2036
- claimTask(taskId) {
2010
+ claimTask(taskId, overrideAssignment = false) {
2037
2011
  return this.httpRequest.request({
2038
2012
  method: "POST",
2039
2013
  url: "/human/tasks/{taskId}/claim",
2040
2014
  path: {
2041
2015
  "taskId": taskId
2016
+ },
2017
+ query: {
2018
+ "overrideAssignment": overrideAssignment
2042
2019
  }
2043
2020
  });
2044
2021
  }
@@ -2046,16 +2023,20 @@ var HumanTaskService = class {
2046
2023
  * Claim a task to an external user
2047
2024
  * @param taskId
2048
2025
  * @param userId
2026
+ * @param overrideAssignment
2049
2027
  * @returns any OK
2050
2028
  * @throws ApiError
2051
2029
  */
2052
- assignAndClaim(taskId, userId) {
2030
+ assignAndClaim(taskId, userId, overrideAssignment = false) {
2053
2031
  return this.httpRequest.request({
2054
2032
  method: "POST",
2055
2033
  url: "/human/tasks/{taskId}/externalUser/{userId}",
2056
2034
  path: {
2057
2035
  "taskId": taskId,
2058
2036
  "userId": userId
2037
+ },
2038
+ query: {
2039
+ "overrideAssignment": overrideAssignment
2059
2040
  }
2060
2041
  });
2061
2042
  }
@@ -2093,17 +2074,21 @@ var HumanTaskService = class {
2093
2074
  });
2094
2075
  }
2095
2076
  /**
2096
- * Get human task state log entries by task id
2077
+ * If a task is assigned to a user, this API can be used to skip that assignment and move to the next assignee
2097
2078
  * @param taskId
2098
- * @returns HumanTaskStateLogEntry OK
2079
+ * @param reason
2080
+ * @returns any OK
2099
2081
  * @throws ApiError
2100
2082
  */
2101
- getStateLogs(taskId) {
2083
+ skipTask(taskId, reason) {
2102
2084
  return this.httpRequest.request({
2103
- method: "GET",
2104
- url: "/human/tasks/{taskId}/stateLogs",
2085
+ method: "POST",
2086
+ url: "/human/tasks/{taskId}/skip",
2105
2087
  path: {
2106
2088
  "taskId": taskId
2089
+ },
2090
+ query: {
2091
+ "reason": reason
2107
2092
  }
2108
2093
  });
2109
2094
  }
@@ -2130,48 +2115,51 @@ var HumanTaskService = class {
2130
2115
  });
2131
2116
  }
2132
2117
  /**
2133
- * Delete human task templates by name
2118
+ * List all user form templates or get templates by name, or a template by name and version
2134
2119
  * @param name
2135
- * @returns any OK
2120
+ * @param version
2121
+ * @returns HumanTaskTemplate OK
2136
2122
  * @throws ApiError
2137
2123
  */
2138
- deleteTemplatesByName(name) {
2124
+ getAllTemplates(name, version) {
2139
2125
  return this.httpRequest.request({
2140
- method: "DELETE",
2126
+ method: "GET",
2141
2127
  url: "/human/template",
2142
2128
  query: {
2143
- "name": name
2129
+ "name": name,
2130
+ "version": version
2144
2131
  }
2145
2132
  });
2146
2133
  }
2147
2134
  /**
2148
- * List all human task templates or get templates by name, or a template by name and version
2149
- * @param name
2150
- * @param version
2151
- * @returns HumanTaskTemplateEntry OK
2135
+ * Save user form template
2136
+ * @param requestBody
2137
+ * @param newVersion
2138
+ * @returns HumanTaskTemplate OK
2152
2139
  * @throws ApiError
2153
2140
  */
2154
- getAllTemplates(name, version) {
2141
+ saveTemplate(requestBody, newVersion = false) {
2155
2142
  return this.httpRequest.request({
2156
- method: "GET",
2143
+ method: "POST",
2157
2144
  url: "/human/template",
2158
2145
  query: {
2159
- "name": name,
2160
- "version": version
2161
- }
2146
+ "newVersion": newVersion
2147
+ },
2148
+ body: requestBody,
2149
+ mediaType: "application/json"
2162
2150
  });
2163
2151
  }
2164
2152
  /**
2165
- * Save human task template
2153
+ * Save user form template
2166
2154
  * @param requestBody
2167
2155
  * @param newVersion
2168
- * @returns string OK
2156
+ * @returns HumanTaskTemplate OK
2169
2157
  * @throws ApiError
2170
2158
  */
2171
- saveTemplate(requestBody, newVersion = false) {
2159
+ saveTemplates(requestBody, newVersion = false) {
2172
2160
  return this.httpRequest.request({
2173
2161
  method: "POST",
2174
- url: "/human/template",
2162
+ url: "/human/template/bulk",
2175
2163
  query: {
2176
2164
  "newVersion": newVersion
2177
2165
  },
@@ -2180,32 +2168,51 @@ var HumanTaskService = class {
2180
2168
  });
2181
2169
  }
2182
2170
  /**
2183
- * Delete human task template
2184
- * @param id
2171
+ * Delete all versions of user form template by name
2172
+ * @param name
2185
2173
  * @returns any OK
2186
2174
  * @throws ApiError
2187
2175
  */
2188
- deleteTemplateById(id) {
2176
+ deleteTemplateByName(name) {
2189
2177
  return this.httpRequest.request({
2190
2178
  method: "DELETE",
2191
- url: "/human/template/{id}",
2179
+ url: "/human/template/{name}",
2192
2180
  path: {
2193
- "id": id
2181
+ "name": name
2194
2182
  }
2195
2183
  });
2196
2184
  }
2197
2185
  /**
2198
- * Get human task template by id
2199
- * @param id
2200
- * @returns HumanTaskTemplateEntry OK
2186
+ * Delete a version of form template by name
2187
+ * @param name
2188
+ * @param version
2189
+ * @returns any OK
2201
2190
  * @throws ApiError
2202
2191
  */
2203
- getTemplateById(id) {
2192
+ deleteTemplatesByNameAndVersion(name, version) {
2193
+ return this.httpRequest.request({
2194
+ method: "DELETE",
2195
+ url: "/human/template/{name}/{version}",
2196
+ path: {
2197
+ "name": name,
2198
+ "version": version
2199
+ }
2200
+ });
2201
+ }
2202
+ /**
2203
+ * Get user form template by name and version
2204
+ * @param name
2205
+ * @param version
2206
+ * @returns HumanTaskTemplate OK
2207
+ * @throws ApiError
2208
+ */
2209
+ getTemplateByNameAndVersion(name, version) {
2204
2210
  return this.httpRequest.request({
2205
2211
  method: "GET",
2206
- url: "/human/template/{id}",
2212
+ url: "/human/template/{name}/{version}",
2207
2213
  path: {
2208
- "id": id
2214
+ "name": name,
2215
+ "version": version
2209
2216
  }
2210
2217
  });
2211
2218
  }
@@ -2663,9 +2670,18 @@ var tryCatchReThrow = (fn) => {
2663
2670
  throw errorMapper(error);
2664
2671
  }
2665
2672
  };
2673
+ function reverseFind(array, predicate) {
2674
+ for (let i = array.length - 1; i >= 0; i--) {
2675
+ if (predicate(array[i], i, array)) {
2676
+ return array[i];
2677
+ }
2678
+ }
2679
+ return void 0;
2680
+ }
2666
2681
 
2667
2682
  // src/core/executor.ts
2668
2683
  var RETRY_TIME_IN_MILLISECONDS = 1e4;
2684
+ var completedTaskMatchingType = (taskType) => (task) => task.status === "COMPLETED" && task.taskType === taskType;
2669
2685
  var WorkflowExecutor = class {
2670
2686
  constructor(client) {
2671
2687
  this._client = client;
@@ -2710,6 +2726,26 @@ var WorkflowExecutor = class {
2710
2726
  startWorkflows(workflowsRequest) {
2711
2727
  return tryCatchReThrow(() => workflowsRequest.map(this.startWorkflow));
2712
2728
  }
2729
+ async goBackToTask(workflowInstanceId, taskFinderPredicate, rerunWorkflowRequestOverrides = {}) {
2730
+ const { tasks: executedTasks = [] } = await this.getExecution(
2731
+ workflowInstanceId
2732
+ );
2733
+ const maybePreviousTask = reverseFind(
2734
+ executedTasks,
2735
+ taskFinderPredicate
2736
+ );
2737
+ if (!maybePreviousTask) {
2738
+ throw new Error("Task not found");
2739
+ }
2740
+ await this.reRun(workflowInstanceId, {
2741
+ //taskInput: previousTask.inputData,
2742
+ ...rerunWorkflowRequestOverrides,
2743
+ reRunFromTaskId: maybePreviousTask.taskId
2744
+ });
2745
+ }
2746
+ async goBackToFirstTaskMatchingType(workflowInstanceId, taskType) {
2747
+ return this.goBackToTask(workflowInstanceId, completedTaskMatchingType(taskType));
2748
+ }
2713
2749
  /**
2714
2750
  * Takes an workflowInstanceId and an includeTasks and an optional retry parameter returns the whole execution status.
2715
2751
  * If includeTasks flag is provided. Details of tasks execution will be returned as well,
@@ -2754,6 +2790,22 @@ var WorkflowExecutor = class {
2754
2790
  )
2755
2791
  );
2756
2792
  }
2793
+ /**
2794
+ * Returns a summary of the current workflow status.
2795
+ *
2796
+ * @param workflowInstanceId current running workflow
2797
+ * @param includeOutput flag to include output
2798
+ * @param includeVariables flag to include variable
2799
+ * @returns Promise<WorkflowStatus>
2800
+ */
2801
+ getExecution(workflowInstanceId, includeTasks = true) {
2802
+ return tryCatchReThrow(
2803
+ () => this._client.workflowResource.getExecutionStatus(
2804
+ workflowInstanceId,
2805
+ includeTasks
2806
+ )
2807
+ );
2808
+ }
2757
2809
  /**
2758
2810
  * Pauses a running workflow
2759
2811
  * @param workflowInstanceId current workflow execution
@@ -2923,11 +2975,24 @@ var WorkflowExecutor = class {
2923
2975
  };
2924
2976
 
2925
2977
  // src/core/human.ts
2978
+ var EMPTY_SEARCH = {
2979
+ size: 15,
2980
+ states: [],
2981
+ taskInputQuery: "",
2982
+ taskOutputQuery: "",
2983
+ definitionNames: [],
2984
+ taskRefNames: [],
2985
+ claimants: [],
2986
+ assignees: [],
2987
+ start: 0
2988
+ };
2989
+ var DEFAULT_POLL_INTERVAL2 = { pollInterval: 100, maxPollTimes: 20 };
2926
2990
  var HumanExecutor = class {
2927
2991
  constructor(client) {
2928
2992
  this._client = client;
2929
2993
  }
2930
2994
  /**
2995
+ * @deprecated use search instead
2931
2996
  * Takes a set of filter parameters. return matches of human tasks for that set of parameters
2932
2997
  * @param state
2933
2998
  * @param assignee
@@ -2938,21 +3003,68 @@ var HumanExecutor = class {
2938
3003
  * @param includeInputOutput
2939
3004
  * @returns
2940
3005
  */
2941
- async getTasksByFilter(state, assignee, assigneeType, claimedBy, taskName, freeText, includeInputOutput = false) {
2942
- const response = await this._client.humanTask.getTasksByFilter(
2943
- state,
2944
- assignee,
2945
- assigneeType,
2946
- claimedBy,
2947
- taskName,
2948
- freeText,
2949
- includeInputOutput
3006
+ async getTasksByFilter(state, assignee, assigneeType, claimedBy, taskName, taskInputQuery, taskOutputQuery) {
3007
+ const [claimedUserType, claimedUser] = claimedBy?.split(":") ?? [];
3008
+ if (claimedUserType && !claimedUser) {
3009
+ throw new Error("claimedBy should be in the format of <userType>:<user>");
3010
+ }
3011
+ const response = await this.search({
3012
+ states: [state],
3013
+ assignees: assignee ? [{ userType: assigneeType, user: assignee }] : [],
3014
+ claimants: claimedBy ? [{ userType: claimedUserType, user: claimedUser }] : [],
3015
+ taskRefNames: taskName ? [taskName] : [],
3016
+ taskInputQuery,
3017
+ taskOutputQuery
3018
+ });
3019
+ return response;
3020
+ }
3021
+ /**
3022
+ * Takes a set of filter parameters. return matches of human tasks for that set of parameters
3023
+ * @param state
3024
+ * @param assignee
3025
+ * @param assigneeType
3026
+ * @param claimedBy
3027
+ * @param taskName
3028
+ * @param freeText
3029
+ * @param includeInputOutput
3030
+ * @returns Promise<HumanTaskEntry[]>
3031
+ */
3032
+ async search(searchParams) {
3033
+ const search = { ...EMPTY_SEARCH, ...searchParams };
3034
+ const response = await tryCatchReThrow(
3035
+ () => this._client.humanTask.search(search)
2950
3036
  );
2951
3037
  if (response.results != void 0) {
2952
3038
  return response.results;
2953
3039
  }
2954
3040
  return [];
2955
3041
  }
3042
+ /**
3043
+ * Takes a set of filter parameters. An polling interval options. will poll until the task returns a result
3044
+ * @param state
3045
+ * @param assignee
3046
+ * @param assigneeType
3047
+ * @param claimedBy
3048
+ * @param taskName
3049
+ * @param freeText
3050
+ * @param includeInputOutput
3051
+ * @returns Promise<HumanTaskEntry[]>
3052
+ */
3053
+ async pollSearch(searchParams, {
3054
+ pollInterval = 100,
3055
+ maxPollTimes = 20
3056
+ } = DEFAULT_POLL_INTERVAL2) {
3057
+ let pollCount = 0;
3058
+ while (pollCount < maxPollTimes) {
3059
+ const response = await this.search(searchParams);
3060
+ if (response.length > 0) {
3061
+ return response;
3062
+ }
3063
+ await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
3064
+ pollCount++;
3065
+ }
3066
+ return [];
3067
+ }
2956
3068
  /**
2957
3069
  * Returns task for a given task id
2958
3070
  * @param taskId
@@ -2968,11 +3080,9 @@ var HumanExecutor = class {
2968
3080
  * @returns
2969
3081
  */
2970
3082
  async claimTaskAsExternalUser(taskId, assignee) {
2971
- try {
2972
- await this._client.humanTask.assignAndClaim(taskId, assignee);
2973
- } catch (error) {
2974
- throw errorMapper(error);
2975
- }
3083
+ return tryCatchReThrow(
3084
+ () => this._client.humanTask.assignAndClaim(taskId, assignee)
3085
+ );
2976
3086
  }
2977
3087
  /**
2978
3088
  * Claim task as conductor user
@@ -2980,11 +3090,7 @@ var HumanExecutor = class {
2980
3090
  * @returns
2981
3091
  */
2982
3092
  async claimTaskAsConductorUser(taskId) {
2983
- try {
2984
- await this._client.humanTask.claimTask(taskId);
2985
- } catch (error) {
2986
- throw errorMapper(error);
2987
- }
3093
+ return tryCatchReThrow(() => this._client.humanTask.claimTask(taskId));
2988
3094
  }
2989
3095
  /**
2990
3096
  * Claim task as conductor user
@@ -3000,15 +3106,24 @@ var HumanExecutor = class {
3000
3106
  }
3001
3107
  }
3002
3108
  /**
3003
- * Returns a HumanTaskTemplateEntry for a given templateId
3109
+ * Returns a HumanTaskTemplateEntry for a given name and version
3004
3110
  * @param templateId
3005
3111
  * @returns
3006
3112
  */
3007
- async getTemplateById(templateId) {
3113
+ async getTemplateByNameVersion(name, version) {
3008
3114
  return tryCatchReThrow(
3009
- () => this._client.humanTask.getTemplateById(templateId)
3115
+ () => this._client.humanTask.getTemplateByNameAndVersion(name, version)
3010
3116
  );
3011
3117
  }
3118
+ /**
3119
+ * @deprecated use getTemplate instead. name will be used as id here with version 1
3120
+ * Returns a HumanTaskTemplateEntry for a given templateId
3121
+ * @param templateId
3122
+ * @returns
3123
+ */
3124
+ async getTemplateById(templateNameVersionOne) {
3125
+ return this.getTemplateByNameVersion(templateNameVersionOne, 1);
3126
+ }
3012
3127
  /**
3013
3128
  * Takes a taskId and a partial body. will update with given body
3014
3129
  * @param taskId
@@ -3604,6 +3719,7 @@ var orkesConductorClient = baseOrkesConductorClient(
3604
3719
  WorkflowBulkResourceService,
3605
3720
  WorkflowExecutor,
3606
3721
  WorkflowResourceService,
3722
+ completedTaskMatchingType,
3607
3723
  conductorEventTask,
3608
3724
  doWhileTask,
3609
3725
  dynamicForkTask,