@epilot/automation-client 2.19.0 → 2.19.2

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/client.js CHANGED
@@ -15,7 +15,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.createClient = exports.getClient = void 0;
18
- var lambda_powertools_correlation_ids_1 = __importDefault(require("@dazn/lambda-powertools-correlation-ids"));
19
18
  var openapi_client_axios_1 = __importDefault(require("openapi-client-axios"));
20
19
  var definition_1 = __importDefault(require("./definition"));
21
20
  var client;
@@ -30,7 +29,7 @@ var createClient = function () {
30
29
  var _a;
31
30
  var api = new openapi_client_axios_1.default({ definition: definition_1.default, quick: true });
32
31
  var apiClient = api.initSync();
33
- apiClient.defaults.headers.common = __assign(__assign({}, ((_a = apiClient.defaults.headers.common) !== null && _a !== void 0 ? _a : {})), (lambda_powertools_correlation_ids_1.default.get() || {}));
32
+ apiClient.defaults.headers.common = __assign({}, ((_a = apiClient.defaults.headers.common) !== null && _a !== void 0 ? _a : {}));
34
33
  return apiClient;
35
34
  };
36
35
  exports.createClient = createClient;
@@ -1 +1 @@
1
- (()=>{"use strict";var e={187:function(e,t,o){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=n(o(466));t.default=r.default},466:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"","version":""},"paths":{"/v1/automation/flows":{"get":{"operationId":"searchFlows","parameters":[{"name":"schema","in":"query"},{"name":"size","in":"query"},{"name":"from","in":"query"},{"name":"trigger_source_id","in":"query"}],"responses":{}},"post":{"operationId":"createFlow","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/automation/flows/{flow_id}":{"get":{"operationId":"getFlow","parameters":[{"name":"flow_id","in":"path","required":true}],"responses":{}},"put":{"operationId":"putFlow","parameters":[{"name":"flow_id","in":"path","required":true}],"requestBody":{"content":{"application/json":{}}},"responses":{}},"delete":{"operationId":"deleteFlow","parameters":[{"name":"flow_id","in":"path","required":true}],"responses":{}}},"/v1/automation/executions":{"get":{"operationId":"getExecutions","parameters":[{"name":"entity_id","in":"query"},{"name":"size","in":"query"},{"name":"from","in":"query"}],"responses":{}},"post":{"operationId":"startExecution","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/automation/executions/bulk-jobs":{"post":{"operationId":"bulkTriggerExecutions","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/automation/executions/bulk-jobs/{job_id}":{"get":{"operationId":"getBulkJob","parameters":[{"name":"job_id","in":"path","required":true}],"responses":{}},"patch":{"operationId":"patchBulkJob","parameters":[{"name":"job_id","in":"path","required":true}],"requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/automation/executions/{execution_id}":{"get":{"operationId":"getExecution","parameters":[{"name":"execution_id","in":"path","required":true}],"responses":{}},"delete":{"operationId":"cancelExecution","parameters":[{"name":"execution_id","in":"path","required":true}],"responses":{}}},"/v1/automation/executions/{execution_id}/{action_id}/retrigger":{"post":{"operationId":"retriggerAction","parameters":[{"name":"execution_id","in":"path","required":true},{"name":"action_id","in":"path","required":true}],"requestBody":{"required":false,"content":{"application/json":{}}},"responses":{}}},"/v1/automation/public/executions:resume":{"post":{"operationId":"resumeExecutionWithToken","requestBody":{"content":{"application/json":{}}},"responses":{}}}},"components":{"responses":{"NotFoundError":{"content":{"application/json":{}}},"ForbiddenError":{"content":{"application/json":{}}}}}}')}},t={},o=function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,o),i.exports}(187),n=exports;for(var r in o)n[r]=o[r];o.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();
1
+ (()=>{"use strict";var e={914:function(e,t,o){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=n(o(240));t.default=r.default},240:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"","version":""},"paths":{"/v1/automation/flows":{"get":{"operationId":"searchFlows","parameters":[{"name":"schema","in":"query"},{"name":"size","in":"query"},{"name":"from","in":"query"},{"name":"trigger_source_id","in":"query"}],"responses":{}},"post":{"operationId":"createFlow","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/automation/flows/{flow_id}":{"get":{"operationId":"getFlow","parameters":[{"name":"flow_id","in":"path","required":true}],"responses":{}},"put":{"operationId":"putFlow","parameters":[{"name":"flow_id","in":"path","required":true}],"requestBody":{"content":{"application/json":{}}},"responses":{}},"delete":{"operationId":"deleteFlow","parameters":[{"name":"flow_id","in":"path","required":true}],"responses":{}}},"/v1/automation/executions":{"get":{"operationId":"getExecutions","parameters":[{"name":"entity_id","in":"query"},{"name":"size","in":"query"},{"name":"from","in":"query"}],"responses":{}},"post":{"operationId":"startExecution","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/automation/executions/bulk-jobs":{"post":{"operationId":"bulkTriggerExecutions","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/automation/executions/bulk-jobs/{job_id}":{"get":{"operationId":"getBulkJob","parameters":[{"name":"job_id","in":"path","required":true}],"responses":{}},"patch":{"operationId":"patchBulkJob","parameters":[{"name":"job_id","in":"path","required":true}],"requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/automation/executions/{execution_id}":{"get":{"operationId":"getExecution","parameters":[{"name":"execution_id","in":"path","required":true}],"responses":{}},"delete":{"operationId":"cancelExecution","parameters":[{"name":"execution_id","in":"path","required":true}],"responses":{}}},"/v1/automation/executions/{execution_id}/{action_id}/retrigger":{"post":{"operationId":"retriggerAction","parameters":[{"name":"execution_id","in":"path","required":true},{"name":"action_id","in":"path","required":true}],"requestBody":{"required":false,"content":{"application/json":{}}},"responses":{}}},"/v1/automation/public/executions:resume":{"post":{"operationId":"resumeExecutionWithToken","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/automation/executions/{execution_id}/schedules/{schedule_id}":{"delete":{"operationId":"cancelSchedule","parameters":[{"name":"execution_id","in":"path","required":true},{"name":"schedule_id","in":"path","required":true}],"responses":{}}}},"components":{"responses":{"NotFoundError":{"content":{"application/json":{}}},"ForbiddenError":{"content":{"application/json":{}}}}},"servers":[{"url":"https://automation.sls.epilot.io"}]}')}},t={},o=function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,o),i.exports}(914),n=exports;for(var r in o)n[r]=o[r];o.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();
@@ -205,6 +205,24 @@
205
205
  },
206
206
  "responses": {}
207
207
  }
208
+ },
209
+ "/v1/automation/executions/{execution_id}/schedules/{schedule_id}": {
210
+ "delete": {
211
+ "operationId": "cancelSchedule",
212
+ "parameters": [
213
+ {
214
+ "name": "execution_id",
215
+ "in": "path",
216
+ "required": true
217
+ },
218
+ {
219
+ "name": "schedule_id",
220
+ "in": "path",
221
+ "required": true
222
+ }
223
+ ],
224
+ "responses": {}
225
+ }
208
226
  }
209
227
  },
210
228
  "components": {
@@ -220,5 +238,10 @@
220
238
  }
221
239
  }
222
240
  }
223
- }
241
+ },
242
+ "servers": [
243
+ {
244
+ "url": "https://automation.sls.epilot.io"
245
+ }
246
+ ]
224
247
  }
package/dist/openapi.d.ts CHANGED
@@ -126,7 +126,7 @@ declare namespace Components {
126
126
  types?: (("CreateMeterReading" | "UpdateMeterReading" | "DocDownloadedFromPortal" | "PortalUserResetPassword" | "PortalUserResetForgotPassword" | "SelfAssignmentFromPortal") | string)[];
127
127
  };
128
128
  }
129
- export type AnyAction = MapEntityAction | TriggerWorkflowAction | TriggerShareEntityAction | TriggerWebhookAction | InformERPAction | CreateDocumentAction | SendEmailAction | /* Creates an order entity with prices from journey */ CartCheckoutAction | CustomAction | AutomationAction;
129
+ export type AnyAction = MapEntityAction | TriggerWorkflowAction | TriggerShareEntityAction | TriggerWebhookAction | InformERPAction | CreateDocumentAction | SendEmailAction | /* Creates an order entity with prices from journey */ CartCheckoutAction | CustomAction | AutomationAction | FlowExecutionCancelAction;
130
130
  export type AnyActionConfig = /**
131
131
  * example:
132
132
  * {
@@ -341,7 +341,28 @@ declare namespace Components {
341
341
  * }
342
342
  * }
343
343
  */
344
- SendEmailActionConfig | /* Creates an order entity with prices from journey */ CartCheckoutActionConfig | CustomAction | AutomationActionConfig;
344
+ SendEmailActionConfig | /* Creates an order entity with prices from journey */ CartCheckoutActionConfig | CustomAction | AutomationActionConfig | /**
345
+ * example:
346
+ * {
347
+ * "id": "2520gja-2sgmsaga-0asg-822jgal",
348
+ * "name": "Cancel Flow Execution",
349
+ * "type": "cancel-flow-execution",
350
+ * "config": {
351
+ * "selected_reasons": [
352
+ * {
353
+ * "id": "_6kITMwkv_0Uo4i7fO7Ja",
354
+ * "title": "when you are done! that's when you close it."
355
+ * },
356
+ * {
357
+ * "id": "qgK9sGbKoS7NxlAbNReVn",
358
+ * "title": "Client didn't want our services"
359
+ * }
360
+ * ],
361
+ * "extra_description": "Test cancellation"
362
+ * }
363
+ * }
364
+ */
365
+ FlowExecutionCancelActionConfig;
345
366
  export type AnyTrigger = FrontendSubmitTrigger | JourneySubmitTrigger | ApiSubmissionTrigger | /**
346
367
  * - If provides filter_config, executes an automation based on the filtered configuration when an entity event occurs.
347
368
  * - The conditions on a filter follows the event bridge patterns - `https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html`
@@ -771,6 +792,14 @@ declare namespace Components {
771
792
  * eyJraWQiOiJrZXkifQ==
772
793
  */
773
794
  ResumeToken;
795
+ trigger_context?: /**
796
+ * Additional contextual data for a bulk trigger automation. This would normally include additional entity IDs you'd need after a listener picks up an event.
797
+ * example:
798
+ * {
799
+ * "entity_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
800
+ * }
801
+ */
802
+ TriggerContext;
774
803
  /**
775
804
  * Version of the flow
776
805
  * example:
@@ -951,6 +980,14 @@ declare namespace Components {
951
980
  * Time when the bulk trigger automation executions job was approved
952
981
  */
953
982
  approved_at?: string; // date-time
983
+ trigger_context?: /**
984
+ * Additional contextual data for a bulk trigger automation. This would normally include additional entity IDs you'd need after a listener picks up an event.
985
+ * example:
986
+ * {
987
+ * "entity_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
988
+ * }
989
+ */
990
+ TriggerContext;
954
991
  /**
955
992
  * Task token to approve/cancel the bulk automation job
956
993
  * example:
@@ -1028,6 +1065,14 @@ declare namespace Components {
1028
1065
  */
1029
1066
  AutomationFlowId;
1030
1067
  entities_refs: EntityRef[];
1068
+ trigger_context?: /**
1069
+ * Additional contextual data for a bulk trigger automation. This would normally include additional entity IDs you'd need after a listener picks up an event.
1070
+ * example:
1071
+ * {
1072
+ * "entity_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
1073
+ * }
1074
+ */
1075
+ TriggerContext;
1031
1076
  } | {
1032
1077
  flow_id: /**
1033
1078
  * ID of the Automation Flow
@@ -1036,6 +1081,14 @@ declare namespace Components {
1036
1081
  */
1037
1082
  AutomationFlowId;
1038
1083
  entities_query: string;
1084
+ trigger_context?: /**
1085
+ * Additional contextual data for a bulk trigger automation. This would normally include additional entity IDs you'd need after a listener picks up an event.
1086
+ * example:
1087
+ * {
1088
+ * "entity_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
1089
+ * }
1090
+ */
1091
+ TriggerContext;
1039
1092
  } | {
1040
1093
  flow_id: /**
1041
1094
  * ID of the Automation Flow
@@ -1062,7 +1115,32 @@ declare namespace Components {
1062
1115
  * ]
1063
1116
  */
1064
1117
  EntitySearchFilter;
1118
+ trigger_context?: /**
1119
+ * Additional contextual data for a bulk trigger automation. This would normally include additional entity IDs you'd need after a listener picks up an event.
1120
+ * example:
1121
+ * {
1122
+ * "entity_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
1123
+ * }
1124
+ */
1125
+ TriggerContext;
1065
1126
  };
1127
+ /**
1128
+ * A reason for cancelling a flow execution
1129
+ */
1130
+ export interface CancellationReason {
1131
+ /**
1132
+ * Unique identifier for the cancellation reason
1133
+ * example:
1134
+ * _6kITMwkv_0Uo4i7fO7Ja
1135
+ */
1136
+ id: string;
1137
+ /**
1138
+ * Human-readable title for the cancellation reason
1139
+ * example:
1140
+ * Process completed successfully
1141
+ */
1142
+ title: string;
1143
+ }
1066
1144
  /**
1067
1145
  * Creates an order entity with prices from journey
1068
1146
  */
@@ -1904,7 +1982,7 @@ declare namespace Components {
1904
1982
  export interface EqualsIgnoreCaseCondition {
1905
1983
  "equals-ignore-case"?: string;
1906
1984
  }
1907
- export type ErrorCode = "MAPPING_ERROR" | "REFRESH_RELATIONS_ERROR" | "DUPLICATE_ENTITY_ERROR" | "TRIGGER_WORKFLOW_ERROR" | "TIMEOUT_ERROR" | "BAD_CONFIG" | "INTERNAL_ERROR" | "TRIGGER_WEBHOOK_ERROR" | "TEMPLATE_ERROR" | "INVALID_PAYLOAD" | "INVALID_SCHEDULE_CONFIG";
1985
+ export type ErrorCode = "MAPPING_ERROR" | "REFRESH_RELATIONS_ERROR" | "DUPLICATE_ENTITY_ERROR" | "TRIGGER_WORKFLOW_ERROR" | "TIMEOUT_ERROR" | "BAD_CONFIG" | "INTERNAL_ERROR" | "TRIGGER_WEBHOOK_ERROR" | "TEMPLATE_ERROR" | "INVALID_PAYLOAD" | "INVALID_SCHEDULE_CONFIG" | "CUSTOM_ACTION_ERROR" | "ORDER_CREATION_ERROR" | "DOCUMENT_GENERATION_ERROR" | "BULK_EMAIL_ERROR" | "SHARING_ERROR" | "CANCEL_FLOW_EXECUTION_ERROR" | "METER_READING_ERROR" | "ENTITY_NOT_FOUND";
1908
1986
  export interface ErrorDetail {
1909
1987
  explanation: string;
1910
1988
  context?: string;
@@ -1958,6 +2036,152 @@ declare namespace Components {
1958
2036
  export type FilterConditionOnEvent = OrCondition | {
1959
2037
  [name: string]: (string | EqualsIgnoreCaseCondition | AnythingButCondition | NumericCondition | ExistsCondition | PrefixCondition | SuffixCondition | WildcardCondition)[];
1960
2038
  };
2039
+ export interface FlowExecutionCancelAction {
2040
+ id?: /**
2041
+ * example:
2042
+ * 9ec3711b-db63-449c-b894-54d5bb622a8f
2043
+ */
2044
+ AutomationActionId;
2045
+ flow_action_id?: /**
2046
+ * example:
2047
+ * 9ec3711b-db63-449c-b894-54d5bb622a8f
2048
+ */
2049
+ AutomationActionId;
2050
+ name?: string;
2051
+ type?: "cancel-flow-execution";
2052
+ config?: /* Configuration for cancelling a flow execution with selected reasons */ FlowExecutionCancelConfig;
2053
+ /**
2054
+ * Whether to stop execution in a failed state if this action fails
2055
+ */
2056
+ allow_failure?: boolean;
2057
+ /**
2058
+ * Flag indicating whether the action was created automatically or manually
2059
+ */
2060
+ created_automatically?: boolean;
2061
+ /**
2062
+ * Flag indicating whether the same action can be in bulk in a single execution. e.g; send-email / map-entity
2063
+ */
2064
+ is_bulk_action?: boolean;
2065
+ reason?: {
2066
+ /**
2067
+ * Why the action has to be skipped/failed
2068
+ * example:
2069
+ * There are no registered portal users for the given emails, hence skipping the action
2070
+ */
2071
+ message?: string;
2072
+ /**
2073
+ * Extra metadata about the skipping reason - such as a certain condition not met, etc.
2074
+ */
2075
+ payload?: {
2076
+ [name: string]: any;
2077
+ };
2078
+ };
2079
+ /**
2080
+ * Condition Id to be checked before executing the action
2081
+ */
2082
+ condition_id?: string;
2083
+ /**
2084
+ * Schedule Id which indicates the schedule of the action
2085
+ */
2086
+ schedule_id?: string;
2087
+ execution_status?: ExecutionStatus;
2088
+ started_at?: string;
2089
+ updated_at?: string;
2090
+ /**
2091
+ * example:
2092
+ * {}
2093
+ */
2094
+ outputs?: {
2095
+ [name: string]: any;
2096
+ };
2097
+ error_output?: ErrorOutput;
2098
+ retry_strategy?: /* different behaviors for retrying failed execution actions. */ RetryStrategy;
2099
+ }
2100
+ /**
2101
+ * example:
2102
+ * {
2103
+ * "id": "2520gja-2sgmsaga-0asg-822jgal",
2104
+ * "name": "Cancel Flow Execution",
2105
+ * "type": "cancel-flow-execution",
2106
+ * "config": {
2107
+ * "selected_reasons": [
2108
+ * {
2109
+ * "id": "_6kITMwkv_0Uo4i7fO7Ja",
2110
+ * "title": "when you are done! that's when you close it."
2111
+ * },
2112
+ * {
2113
+ * "id": "qgK9sGbKoS7NxlAbNReVn",
2114
+ * "title": "Client didn't want our services"
2115
+ * }
2116
+ * ],
2117
+ * "extra_description": "Test cancellation"
2118
+ * }
2119
+ * }
2120
+ */
2121
+ export interface FlowExecutionCancelActionConfig {
2122
+ id?: /**
2123
+ * example:
2124
+ * 9ec3711b-db63-449c-b894-54d5bb622a8f
2125
+ */
2126
+ AutomationActionId;
2127
+ flow_action_id?: /**
2128
+ * example:
2129
+ * 9ec3711b-db63-449c-b894-54d5bb622a8f
2130
+ */
2131
+ AutomationActionId;
2132
+ name?: string;
2133
+ type?: "cancel-flow-execution";
2134
+ config?: /* Configuration for cancelling a flow execution with selected reasons */ FlowExecutionCancelConfig;
2135
+ /**
2136
+ * Whether to stop execution in a failed state if this action fails
2137
+ */
2138
+ allow_failure?: boolean;
2139
+ /**
2140
+ * Flag indicating whether the action was created automatically or manually
2141
+ */
2142
+ created_automatically?: boolean;
2143
+ /**
2144
+ * Flag indicating whether the same action can be in bulk in a single execution. e.g; send-email / map-entity
2145
+ */
2146
+ is_bulk_action?: boolean;
2147
+ reason?: {
2148
+ /**
2149
+ * Why the action has to be skipped/failed
2150
+ * example:
2151
+ * There are no registered portal users for the given emails, hence skipping the action
2152
+ */
2153
+ message?: string;
2154
+ /**
2155
+ * Extra metadata about the skipping reason - such as a certain condition not met, etc.
2156
+ */
2157
+ payload?: {
2158
+ [name: string]: any;
2159
+ };
2160
+ };
2161
+ /**
2162
+ * Condition Id to be checked before executing the action
2163
+ */
2164
+ condition_id?: string;
2165
+ /**
2166
+ * Schedule Id which indicates the schedule of the action
2167
+ */
2168
+ schedule_id?: string;
2169
+ }
2170
+ /**
2171
+ * Configuration for cancelling a flow execution with selected reasons
2172
+ */
2173
+ export interface FlowExecutionCancelConfig {
2174
+ /**
2175
+ * List of reasons selected for this specific cancellation
2176
+ */
2177
+ selected_reasons?: /* A reason for cancelling a flow execution */ CancellationReason[];
2178
+ /**
2179
+ * Additional description or notes for the cancellation
2180
+ * example:
2181
+ * Process completed successfully
2182
+ */
2183
+ extra_description?: string;
2184
+ }
1961
2185
  export interface FlowsTrigger {
1962
2186
  /**
1963
2187
  * example:
@@ -2835,6 +3059,16 @@ declare namespace Components {
2835
3059
  comparison: Comparison;
2836
3060
  value?: string | number | string[] | number[];
2837
3061
  }
3062
+ /**
3063
+ * Additional contextual data for a bulk trigger automation. This would normally include additional entity IDs you'd need after a listener picks up an event.
3064
+ * example:
3065
+ * {
3066
+ * "entity_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
3067
+ * }
3068
+ */
3069
+ export interface TriggerContext {
3070
+ [name: string]: string;
3071
+ }
2838
3072
  export interface TriggerEventEntityActivity {
2839
3073
  type?: "entity_activity";
2840
3074
  /**
@@ -3403,6 +3637,39 @@ declare namespace Paths {
3403
3637
  Components.Responses.NotFoundError;
3404
3638
  }
3405
3639
  }
3640
+ namespace CancelSchedule {
3641
+ namespace Parameters {
3642
+ export type ExecutionId = /**
3643
+ * example:
3644
+ * 9baf184f-bc81-4128-bca3-d974c90a12c4
3645
+ */
3646
+ Components.Schemas.AutomationExecutionId;
3647
+ export type ScheduleId = string;
3648
+ }
3649
+ export interface PathParameters {
3650
+ execution_id: Parameters.ExecutionId;
3651
+ schedule_id: Parameters.ScheduleId;
3652
+ }
3653
+ namespace Responses {
3654
+ export type $200 = Components.Schemas.ActionSchedule;
3655
+ export type $403 = /**
3656
+ * example:
3657
+ * {
3658
+ * "status": 403,
3659
+ * "error": "Forbidden"
3660
+ * }
3661
+ */
3662
+ Components.Responses.ForbiddenError;
3663
+ export type $404 = /**
3664
+ * example:
3665
+ * {
3666
+ * "status": 404,
3667
+ * "error": "Not Found"
3668
+ * }
3669
+ */
3670
+ Components.Responses.NotFoundError;
3671
+ }
3672
+ }
3406
3673
  namespace CreateFlow {
3407
3674
  export type RequestBody = Components.Schemas.AutomationFlow;
3408
3675
  namespace Responses {
@@ -3742,7 +4009,6 @@ declare namespace Paths {
3742
4009
  }
3743
4010
  }
3744
4011
 
3745
-
3746
4012
  export interface OperationMethods {
3747
4013
  /**
3748
4014
  * searchFlows - searchFlows
@@ -3889,6 +4155,16 @@ export interface OperationMethods {
3889
4155
  data?: Paths.ResumeExecutionWithToken.RequestBody,
3890
4156
  config?: AxiosRequestConfig
3891
4157
  ): OperationResponse<Paths.ResumeExecutionWithToken.Responses.$200>
4158
+ /**
4159
+ * cancelSchedule - cancelSchedule
4160
+ *
4161
+ * Cancel a scheduled automation
4162
+ */
4163
+ 'cancelSchedule'(
4164
+ parameters?: Parameters<Paths.CancelSchedule.PathParameters> | null,
4165
+ data?: any,
4166
+ config?: AxiosRequestConfig
4167
+ ): OperationResponse<Paths.CancelSchedule.Responses.$200>
3892
4168
  }
3893
4169
 
3894
4170
  export interface PathsDictionary {
@@ -4053,11 +4329,22 @@ export interface PathsDictionary {
4053
4329
  config?: AxiosRequestConfig
4054
4330
  ): OperationResponse<Paths.ResumeExecutionWithToken.Responses.$200>
4055
4331
  }
4332
+ ['/v1/automation/executions/{execution_id}/schedules/{schedule_id}']: {
4333
+ /**
4334
+ * cancelSchedule - cancelSchedule
4335
+ *
4336
+ * Cancel a scheduled automation
4337
+ */
4338
+ 'delete'(
4339
+ parameters?: Parameters<Paths.CancelSchedule.PathParameters> | null,
4340
+ data?: any,
4341
+ config?: AxiosRequestConfig
4342
+ ): OperationResponse<Paths.CancelSchedule.Responses.$200>
4343
+ }
4056
4344
  }
4057
4345
 
4058
4346
  export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
4059
4347
 
4060
-
4061
4348
  export type ActionCondition = Components.Schemas.ActionCondition;
4062
4349
  export type ActionSchedule = Components.Schemas.ActionSchedule;
4063
4350
  export type ActionScheduleSource = Components.Schemas.ActionScheduleSource;
@@ -4082,6 +4369,7 @@ export type AutomationFlowId = Components.Schemas.AutomationFlowId;
4082
4369
  export type AutomationTrigger = Components.Schemas.AutomationTrigger;
4083
4370
  export type BulkTriggerJob = Components.Schemas.BulkTriggerJob;
4084
4371
  export type BulkTriggerRequest = Components.Schemas.BulkTriggerRequest;
4372
+ export type CancellationReason = Components.Schemas.CancellationReason;
4085
4373
  export type CartCheckoutAction = Components.Schemas.CartCheckoutAction;
4086
4374
  export type CartCheckoutActionConfig = Components.Schemas.CartCheckoutActionConfig;
4087
4375
  export type CartCheckoutConfig = Components.Schemas.CartCheckoutConfig;
@@ -4112,6 +4400,9 @@ export type ExecItem = Components.Schemas.ExecItem;
4112
4400
  export type ExecutionStatus = Components.Schemas.ExecutionStatus;
4113
4401
  export type ExistsCondition = Components.Schemas.ExistsCondition;
4114
4402
  export type FilterConditionOnEvent = Components.Schemas.FilterConditionOnEvent;
4403
+ export type FlowExecutionCancelAction = Components.Schemas.FlowExecutionCancelAction;
4404
+ export type FlowExecutionCancelActionConfig = Components.Schemas.FlowExecutionCancelActionConfig;
4405
+ export type FlowExecutionCancelConfig = Components.Schemas.FlowExecutionCancelConfig;
4115
4406
  export type FlowsTrigger = Components.Schemas.FlowsTrigger;
4116
4407
  export type FrontendSubmitTrigger = Components.Schemas.FrontendSubmitTrigger;
4117
4408
  export type GetExecutionsResp = Components.Schemas.GetExecutionsResp;
@@ -4152,6 +4443,7 @@ export type SetValueMapper = Components.Schemas.SetValueMapper;
4152
4443
  export type StartExecutionRequest = Components.Schemas.StartExecutionRequest;
4153
4444
  export type SuffixCondition = Components.Schemas.SuffixCondition;
4154
4445
  export type TriggerCondition = Components.Schemas.TriggerCondition;
4446
+ export type TriggerContext = Components.Schemas.TriggerContext;
4155
4447
  export type TriggerEventEntityActivity = Components.Schemas.TriggerEventEntityActivity;
4156
4448
  export type TriggerEventEntityOperation = Components.Schemas.TriggerEventEntityOperation;
4157
4449
  export type TriggerEventFlowAutomationTask = Components.Schemas.TriggerEventFlowAutomationTask;
package/dist/openapi.json CHANGED
@@ -574,7 +574,10 @@
574
574
  "entity_schema": "opportunity",
575
575
  "entity_id": "b35a6c51-2a15-4ef1-9623-20db37b0744f"
576
576
  }
577
- ]
577
+ ],
578
+ "trigger_context": {
579
+ "entity_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
580
+ }
578
581
  }
579
582
  }
580
583
  }
@@ -853,6 +856,53 @@
853
856
  }
854
857
  }
855
858
  }
859
+ },
860
+ "/v1/automation/executions/{execution_id}/schedules/{schedule_id}": {
861
+ "delete": {
862
+ "operationId": "cancelSchedule",
863
+ "summary": "cancelSchedule",
864
+ "description": "Cancel a scheduled automation",
865
+ "parameters": [
866
+ {
867
+ "name": "execution_id",
868
+ "in": "path",
869
+ "schema": {
870
+ "$ref": "#/components/schemas/AutomationExecutionId"
871
+ },
872
+ "required": true
873
+ },
874
+ {
875
+ "name": "schedule_id",
876
+ "in": "path",
877
+ "schema": {
878
+ "type": "string"
879
+ },
880
+ "required": true,
881
+ "description": "ID of the schedule to cancel"
882
+ }
883
+ ],
884
+ "tags": [
885
+ "executions"
886
+ ],
887
+ "responses": {
888
+ "200": {
889
+ "description": "The schedule was successfully cancelled",
890
+ "content": {
891
+ "application/json": {
892
+ "schema": {
893
+ "$ref": "#/components/schemas/ActionSchedule"
894
+ }
895
+ }
896
+ }
897
+ },
898
+ "403": {
899
+ "$ref": "#/components/responses/ForbiddenError"
900
+ },
901
+ "404": {
902
+ "$ref": "#/components/responses/NotFoundError"
903
+ }
904
+ }
905
+ }
856
906
  }
857
907
  },
858
908
  "components": {
@@ -1105,6 +1155,9 @@
1105
1155
  },
1106
1156
  {
1107
1157
  "$ref": "#/components/schemas/AutomationAction"
1158
+ },
1159
+ {
1160
+ "$ref": "#/components/schemas/FlowExecutionCancelAction"
1108
1161
  }
1109
1162
  ]
1110
1163
  },
@@ -1139,6 +1192,9 @@
1139
1192
  },
1140
1193
  {
1141
1194
  "$ref": "#/components/schemas/AutomationActionConfig"
1195
+ },
1196
+ {
1197
+ "$ref": "#/components/schemas/FlowExecutionCancelActionConfig"
1142
1198
  }
1143
1199
  ]
1144
1200
  },
@@ -1282,7 +1338,15 @@
1282
1338
  "TRIGGER_WEBHOOK_ERROR",
1283
1339
  "TEMPLATE_ERROR",
1284
1340
  "INVALID_PAYLOAD",
1285
- "INVALID_SCHEDULE_CONFIG"
1341
+ "INVALID_SCHEDULE_CONFIG",
1342
+ "CUSTOM_ACTION_ERROR",
1343
+ "ORDER_CREATION_ERROR",
1344
+ "DOCUMENT_GENERATION_ERROR",
1345
+ "BULK_EMAIL_ERROR",
1346
+ "SHARING_ERROR",
1347
+ "CANCEL_FLOW_EXECUTION_ERROR",
1348
+ "METER_READING_ERROR",
1349
+ "ENTITY_NOT_FOUND"
1286
1350
  ]
1287
1351
  },
1288
1352
  "ErrorDetail": {
@@ -2502,6 +2566,105 @@
2502
2566
  }
2503
2567
  }
2504
2568
  },
2569
+ "FlowExecutionCancelActionConfig": {
2570
+ "allOf": [
2571
+ {
2572
+ "$ref": "#/components/schemas/AutomationActionConfig"
2573
+ },
2574
+ {
2575
+ "type": "object",
2576
+ "properties": {
2577
+ "type": {
2578
+ "enum": [
2579
+ "cancel-flow-execution"
2580
+ ]
2581
+ },
2582
+ "config": {
2583
+ "$ref": "#/components/schemas/FlowExecutionCancelConfig"
2584
+ }
2585
+ }
2586
+ }
2587
+ ],
2588
+ "example": {
2589
+ "id": "2520gja-2sgmsaga-0asg-822jgal",
2590
+ "name": "Cancel Flow Execution",
2591
+ "type": "cancel-flow-execution",
2592
+ "config": {
2593
+ "selected_reasons": [
2594
+ {
2595
+ "id": "_6kITMwkv_0Uo4i7fO7Ja",
2596
+ "title": "when you are done! that's when you close it."
2597
+ },
2598
+ {
2599
+ "id": "qgK9sGbKoS7NxlAbNReVn",
2600
+ "title": "Client didn't want our services"
2601
+ }
2602
+ ],
2603
+ "extra_description": "Test cancellation"
2604
+ }
2605
+ }
2606
+ },
2607
+ "FlowExecutionCancelAction": {
2608
+ "allOf": [
2609
+ {
2610
+ "$ref": "#/components/schemas/AutomationAction"
2611
+ },
2612
+ {
2613
+ "type": "object",
2614
+ "properties": {
2615
+ "type": {
2616
+ "enum": [
2617
+ "cancel-flow-execution"
2618
+ ]
2619
+ },
2620
+ "config": {
2621
+ "$ref": "#/components/schemas/FlowExecutionCancelConfig"
2622
+ }
2623
+ }
2624
+ }
2625
+ ]
2626
+ },
2627
+ "FlowExecutionCancelConfig": {
2628
+ "type": "object",
2629
+ "description": "Configuration for cancelling a flow execution with selected reasons",
2630
+ "properties": {
2631
+ "selected_reasons": {
2632
+ "type": "array",
2633
+ "description": "List of reasons selected for this specific cancellation",
2634
+ "items": {
2635
+ "$ref": "#/components/schemas/CancellationReason"
2636
+ }
2637
+ },
2638
+ "extra_description": {
2639
+ "type": "string",
2640
+ "description": "Additional description or notes for the cancellation",
2641
+ "example": "Process completed successfully"
2642
+ }
2643
+ },
2644
+ "required": [
2645
+ "configured_reasons"
2646
+ ]
2647
+ },
2648
+ "CancellationReason": {
2649
+ "type": "object",
2650
+ "description": "A reason for cancelling a flow execution",
2651
+ "properties": {
2652
+ "id": {
2653
+ "type": "string",
2654
+ "description": "Unique identifier for the cancellation reason",
2655
+ "example": "_6kITMwkv_0Uo4i7fO7Ja"
2656
+ },
2657
+ "title": {
2658
+ "type": "string",
2659
+ "description": "Human-readable title for the cancellation reason",
2660
+ "example": "Process completed successfully"
2661
+ }
2662
+ },
2663
+ "required": [
2664
+ "id",
2665
+ "title"
2666
+ ]
2667
+ },
2505
2668
  "ConditionStatement": {
2506
2669
  "type": "object",
2507
2670
  "properties": {
@@ -2772,6 +2935,9 @@
2772
2935
  "resume_token": {
2773
2936
  "$ref": "#/components/schemas/ResumeToken"
2774
2937
  },
2938
+ "trigger_context": {
2939
+ "$ref": "#/components/schemas/TriggerContext"
2940
+ },
2775
2941
  "version": {
2776
2942
  "type": "number",
2777
2943
  "description": "Version of the flow",
@@ -3074,13 +3240,15 @@
3074
3240
  "items": {
3075
3241
  "$ref": "#/components/schemas/EntityRef"
3076
3242
  }
3243
+ },
3244
+ "trigger_context": {
3245
+ "$ref": "#/components/schemas/TriggerContext"
3077
3246
  }
3078
3247
  },
3079
3248
  "required": [
3080
3249
  "flow_id",
3081
3250
  "entities_refs"
3082
- ],
3083
- "additionalProperties": false
3251
+ ]
3084
3252
  },
3085
3253
  {
3086
3254
  "type": "object",
@@ -3090,13 +3258,15 @@
3090
3258
  },
3091
3259
  "entities_query": {
3092
3260
  "type": "string"
3261
+ },
3262
+ "trigger_context": {
3263
+ "$ref": "#/components/schemas/TriggerContext"
3093
3264
  }
3094
3265
  },
3095
3266
  "required": [
3096
3267
  "flow_id",
3097
3268
  "entities_query"
3098
- ],
3099
- "additionalProperties": false
3269
+ ]
3100
3270
  },
3101
3271
  {
3102
3272
  "type": "object",
@@ -3106,13 +3276,15 @@
3106
3276
  },
3107
3277
  "entities_filter": {
3108
3278
  "$ref": "#/components/schemas/EntitySearchFilter"
3279
+ },
3280
+ "trigger_context": {
3281
+ "$ref": "#/components/schemas/TriggerContext"
3109
3282
  }
3110
3283
  },
3111
3284
  "required": [
3112
3285
  "flow_id",
3113
3286
  "entities_filter"
3114
- ],
3115
- "additionalProperties": false
3287
+ ]
3116
3288
  }
3117
3289
  ]
3118
3290
  },
@@ -3185,6 +3357,9 @@
3185
3357
  "description": "Time when the bulk trigger automation executions job was approved",
3186
3358
  "format": "date-time"
3187
3359
  },
3360
+ "trigger_context": {
3361
+ "$ref": "#/components/schemas/TriggerContext"
3362
+ },
3188
3363
  "task_token": {
3189
3364
  "type": "string",
3190
3365
  "description": "Task token to approve/cancel the bulk automation job",
@@ -3320,6 +3495,16 @@
3320
3495
  "type": "string",
3321
3496
  "example": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74"
3322
3497
  },
3498
+ "TriggerContext": {
3499
+ "type": "object",
3500
+ "additionalProperties": {
3501
+ "type": "string"
3502
+ },
3503
+ "description": "Additional contextual data for a bulk trigger automation. This would normally include additional entity IDs you'd need after a listener picks up an event.",
3504
+ "example": {
3505
+ "entity_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
3506
+ }
3507
+ },
3323
3508
  "AutomationTrigger": {
3324
3509
  "type": "object",
3325
3510
  "properties": {
@@ -4256,5 +4441,10 @@
4256
4441
  }
4257
4442
  }
4258
4443
  }
4259
- }
4444
+ },
4445
+ "servers": [
4446
+ {
4447
+ "url": "https://automation.sls.epilot.io"
4448
+ }
4449
+ ]
4260
4450
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/automation-client",
3
- "version": "2.19.0",
3
+ "version": "2.19.2",
4
4
  "description": "Client library for epilot automation API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,13 +25,13 @@
25
25
  "test": "jest",
26
26
  "typescript": "tsc",
27
27
  "bundle-definition": "webpack",
28
- "openapi": "node ../../scripts/update-openapi.js /Users/sureshs/workspace/automation-api/lambda/ApiHandlerFunction/openapi.yml",
28
+ "openapi": "node ../../scripts/update-openapi.js https://docs.api.epilot.io/automation.yaml",
29
29
  "typegen": "openapi typegen src/openapi.json --client -b '/* eslint-disable */' > src/openapi.d.ts",
30
30
  "build": "tsc && npm run build:patch && npm run bundle-definition",
31
31
  "build:patch": "sed -i'' -e '/^__exportStar.*openapi.*$/d' dist/index.js",
32
32
  "build:watch": "npm run build && tsc -w",
33
33
  "prepublishOnly": "npm run typegen && npm run build",
34
- "lint": "../../node_modules/eslint/bin/eslint.js src"
34
+ "lint": "pnpm exec eslint src"
35
35
  },
36
36
  "files": [
37
37
  "*.js",
@@ -50,7 +50,6 @@
50
50
  "axios": "^1.6.2"
51
51
  },
52
52
  "dependencies": {
53
- "@dazn/lambda-powertools-correlation-ids": "^1.28.1",
54
53
  "buffer": "^6.0.3",
55
54
  "https-browserify": "^1.0.0",
56
55
  "stream-http": "^3.1.1",
@@ -66,8 +65,8 @@
66
65
  "jest": "^26.6.3",
67
66
  "json-loader": "^0.5.7",
68
67
  "node-fetch": "^3.2.10",
69
- "openapi-client-axios": "^7.5.1",
70
- "openapicmd": "^2.6.2",
68
+ "openapi-client-axios": "^7.6.0",
69
+ "openapicmd": "^2.7.0",
71
70
  "ts-jest": "^26.5.0",
72
71
  "ts-loader": "^8.0.14",
73
72
  "ts-node": "^10.9.1",