@epilot/automation-client 2.21.0 → 2.22.0

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={330: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"},{"name":"include_flows","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"},{"name":"include_flows","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}(330),n=exports;for(var r in o)n[r]=o[r];o.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();
@@ -24,6 +24,10 @@
24
24
  {
25
25
  "name": "trigger_source_id",
26
26
  "in": "query"
27
+ },
28
+ {
29
+ "name": "include_flows",
30
+ "in": "query"
27
31
  }
28
32
  ],
29
33
  "responses": {}
@@ -93,6 +97,10 @@
93
97
  {
94
98
  "name": "from",
95
99
  "in": "query"
100
+ },
101
+ {
102
+ "name": "include_flows",
103
+ "in": "query"
96
104
  }
97
105
  ],
98
106
  "responses": {}
@@ -205,6 +213,24 @@
205
213
  },
206
214
  "responses": {}
207
215
  }
216
+ },
217
+ "/v1/automation/executions/{execution_id}/schedules/{schedule_id}": {
218
+ "delete": {
219
+ "operationId": "cancelSchedule",
220
+ "parameters": [
221
+ {
222
+ "name": "execution_id",
223
+ "in": "path",
224
+ "required": true
225
+ },
226
+ {
227
+ "name": "schedule_id",
228
+ "in": "path",
229
+ "required": true
230
+ }
231
+ ],
232
+ "responses": {}
233
+ }
208
234
  }
209
235
  },
210
236
  "components": {
@@ -220,5 +246,10 @@
220
246
  }
221
247
  }
222
248
  }
223
- }
249
+ },
250
+ "servers": [
251
+ {
252
+ "url": "https://automation.sls.epilot.io"
253
+ }
254
+ ]
224
255
  }
package/dist/openapi.d.ts CHANGED
@@ -792,6 +792,14 @@ declare namespace Components {
792
792
  * eyJraWQiOiJrZXkifQ==
793
793
  */
794
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;
795
803
  /**
796
804
  * Version of the flow
797
805
  * example:
@@ -799,6 +807,7 @@ declare namespace Components {
799
807
  */
800
808
  version?: number;
801
809
  trigger_event?: TriggerEventManual | TriggerEventEntityActivity | TriggerEventEntityOperation | TriggerEventFlowAutomationTask;
810
+ workflow_context?: WorkflowExecutionContext;
802
811
  }
803
812
  /**
804
813
  * example:
@@ -914,6 +923,7 @@ declare namespace Components {
914
923
  * Source blueprint/manifest ID used when automation is created via blueprints.
915
924
  */
916
925
  _manifest?: string /* uuid */[] | null;
926
+ workflow_context?: /* For automation that are connected to workflows V2, this field tracks various information about the workflow. */ WorkflowContext;
917
927
  }
918
928
  /**
919
929
  * ID of the Automation Flow
@@ -972,6 +982,14 @@ declare namespace Components {
972
982
  * Time when the bulk trigger automation executions job was approved
973
983
  */
974
984
  approved_at?: string; // date-time
985
+ trigger_context?: /**
986
+ * 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.
987
+ * example:
988
+ * {
989
+ * "entity_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
990
+ * }
991
+ */
992
+ TriggerContext;
975
993
  /**
976
994
  * Task token to approve/cancel the bulk automation job
977
995
  * example:
@@ -1049,6 +1067,14 @@ declare namespace Components {
1049
1067
  */
1050
1068
  AutomationFlowId;
1051
1069
  entities_refs: EntityRef[];
1070
+ trigger_context?: /**
1071
+ * 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.
1072
+ * example:
1073
+ * {
1074
+ * "entity_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
1075
+ * }
1076
+ */
1077
+ TriggerContext;
1052
1078
  } | {
1053
1079
  flow_id: /**
1054
1080
  * ID of the Automation Flow
@@ -1057,6 +1083,14 @@ declare namespace Components {
1057
1083
  */
1058
1084
  AutomationFlowId;
1059
1085
  entities_query: string;
1086
+ trigger_context?: /**
1087
+ * 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.
1088
+ * example:
1089
+ * {
1090
+ * "entity_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
1091
+ * }
1092
+ */
1093
+ TriggerContext;
1060
1094
  } | {
1061
1095
  flow_id: /**
1062
1096
  * ID of the Automation Flow
@@ -1083,6 +1117,14 @@ declare namespace Components {
1083
1117
  * ]
1084
1118
  */
1085
1119
  EntitySearchFilter;
1120
+ trigger_context?: /**
1121
+ * 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.
1122
+ * example:
1123
+ * {
1124
+ * "entity_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
1125
+ * }
1126
+ */
1127
+ TriggerContext;
1086
1128
  };
1087
1129
  /**
1088
1130
  * A reason for cancelling a flow execution
@@ -1942,7 +1984,7 @@ declare namespace Components {
1942
1984
  export interface EqualsIgnoreCaseCondition {
1943
1985
  "equals-ignore-case"?: string;
1944
1986
  }
1945
- 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";
1987
+ 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_NOT_FOUND" | "ENTITY_NOT_FOUND";
1946
1988
  export interface ErrorDetail {
1947
1989
  explanation: string;
1948
1990
  context?: string;
@@ -2995,14 +3037,15 @@ declare namespace Components {
2995
3037
  * 7791b04a-16d2-44a2-9af9-2d59c25c512f
2996
3038
  */
2997
3039
  AutomationFlowId;
3040
+ workflow_context?: WorkflowExecutionContext;
2998
3041
  /**
2999
- * ID of the Flow Execution
3042
+ * Use workflow_context.workflow_exec_id instead
3000
3043
  */
3001
3044
  flow_execution_id?: string;
3002
3045
  /**
3003
- * ID of the automated flow action
3046
+ * Use workflow_context.workflow_exec_task_id instead
3004
3047
  */
3005
- flow_automation_task_id?: string; // UUID
3048
+ flow_automation_task_id?: string;
3006
3049
  }
3007
3050
  export interface SuffixCondition {
3008
3051
  suffix?: string;
@@ -3019,6 +3062,16 @@ declare namespace Components {
3019
3062
  comparison: Comparison;
3020
3063
  value?: string | number | string[] | number[];
3021
3064
  }
3065
+ /**
3066
+ * 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.
3067
+ * example:
3068
+ * {
3069
+ * "entity_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
3070
+ * }
3071
+ */
3072
+ export interface TriggerContext {
3073
+ [name: string]: string;
3074
+ }
3022
3075
  export interface TriggerEventEntityActivity {
3023
3076
  type?: "entity_activity";
3024
3077
  /**
@@ -3539,6 +3592,29 @@ declare namespace Components {
3539
3592
  export interface WildcardCondition {
3540
3593
  wildcard?: string;
3541
3594
  }
3595
+ /**
3596
+ * For automation that are connected to workflows V2, this field tracks various information about the workflow.
3597
+ */
3598
+ export interface WorkflowContext {
3599
+ /**
3600
+ * The ID of the workflow this automation is connected to
3601
+ */
3602
+ workflow_id: string; // uuid
3603
+ /**
3604
+ * The ID of the task in the workflow that this automation is connected to
3605
+ */
3606
+ task_id?: string; // uuid
3607
+ workflow_role: /* The role this automation plays in the workflow. */ WorkflowContextRole;
3608
+ }
3609
+ /**
3610
+ * The role this automation plays in the workflow.
3611
+ */
3612
+ export type WorkflowContextRole = "trigger_workflow" | "run_task_automation";
3613
+ export interface WorkflowExecutionContext {
3614
+ workflow_exec_id: string;
3615
+ workflow_exec_task_id?: string;
3616
+ workflow_role: /* The role this automation plays in the workflow. */ WorkflowContextRole;
3617
+ }
3542
3618
  }
3543
3619
  }
3544
3620
  declare namespace Paths {
@@ -3587,6 +3663,39 @@ declare namespace Paths {
3587
3663
  Components.Responses.NotFoundError;
3588
3664
  }
3589
3665
  }
3666
+ namespace CancelSchedule {
3667
+ namespace Parameters {
3668
+ export type ExecutionId = /**
3669
+ * example:
3670
+ * 9baf184f-bc81-4128-bca3-d974c90a12c4
3671
+ */
3672
+ Components.Schemas.AutomationExecutionId;
3673
+ export type ScheduleId = string;
3674
+ }
3675
+ export interface PathParameters {
3676
+ execution_id: Parameters.ExecutionId;
3677
+ schedule_id: Parameters.ScheduleId;
3678
+ }
3679
+ namespace Responses {
3680
+ export type $200 = Components.Schemas.ActionSchedule;
3681
+ export type $403 = /**
3682
+ * example:
3683
+ * {
3684
+ * "status": 403,
3685
+ * "error": "Forbidden"
3686
+ * }
3687
+ */
3688
+ Components.Responses.ForbiddenError;
3689
+ export type $404 = /**
3690
+ * example:
3691
+ * {
3692
+ * "status": 404,
3693
+ * "error": "Not Found"
3694
+ * }
3695
+ */
3696
+ Components.Responses.NotFoundError;
3697
+ }
3698
+ }
3590
3699
  namespace CreateFlow {
3591
3700
  export type RequestBody = Components.Schemas.AutomationFlow;
3592
3701
  namespace Responses {
@@ -3705,12 +3814,14 @@ declare namespace Paths {
3705
3814
  */
3706
3815
  Components.Schemas.EntityId;
3707
3816
  export type From = number;
3817
+ export type IncludeFlows = boolean;
3708
3818
  export type Size = number;
3709
3819
  }
3710
3820
  export interface QueryParameters {
3711
3821
  entity_id?: Parameters.EntityId;
3712
3822
  size?: Parameters.Size;
3713
3823
  from?: Parameters.From;
3824
+ include_flows?: Parameters.IncludeFlows;
3714
3825
  }
3715
3826
  namespace Responses {
3716
3827
  export type $200 = Components.Schemas.GetExecutionsResp;
@@ -3880,6 +3991,7 @@ declare namespace Paths {
3880
3991
  namespace SearchFlows {
3881
3992
  namespace Parameters {
3882
3993
  export type From = number;
3994
+ export type IncludeFlows = boolean;
3883
3995
  /**
3884
3996
  * example:
3885
3997
  * submission
@@ -3905,6 +4017,7 @@ declare namespace Paths {
3905
4017
  * 600945fe-212e-4b97-acf7-391d64648384
3906
4018
  */
3907
4019
  Parameters.TriggerSourceId;
4020
+ include_flows?: Parameters.IncludeFlows;
3908
4021
  }
3909
4022
  namespace Responses {
3910
4023
  export type $200 = Components.Schemas.SearchAutomationsResp;
@@ -4073,6 +4186,16 @@ export interface OperationMethods {
4073
4186
  data?: Paths.ResumeExecutionWithToken.RequestBody,
4074
4187
  config?: AxiosRequestConfig
4075
4188
  ): OperationResponse<Paths.ResumeExecutionWithToken.Responses.$200>
4189
+ /**
4190
+ * cancelSchedule - cancelSchedule
4191
+ *
4192
+ * Cancel a scheduled automation
4193
+ */
4194
+ 'cancelSchedule'(
4195
+ parameters?: Parameters<Paths.CancelSchedule.PathParameters> | null,
4196
+ data?: any,
4197
+ config?: AxiosRequestConfig
4198
+ ): OperationResponse<Paths.CancelSchedule.Responses.$200>
4076
4199
  }
4077
4200
 
4078
4201
  export interface PathsDictionary {
@@ -4237,6 +4360,18 @@ export interface PathsDictionary {
4237
4360
  config?: AxiosRequestConfig
4238
4361
  ): OperationResponse<Paths.ResumeExecutionWithToken.Responses.$200>
4239
4362
  }
4363
+ ['/v1/automation/executions/{execution_id}/schedules/{schedule_id}']: {
4364
+ /**
4365
+ * cancelSchedule - cancelSchedule
4366
+ *
4367
+ * Cancel a scheduled automation
4368
+ */
4369
+ 'delete'(
4370
+ parameters?: Parameters<Paths.CancelSchedule.PathParameters> | null,
4371
+ data?: any,
4372
+ config?: AxiosRequestConfig
4373
+ ): OperationResponse<Paths.CancelSchedule.Responses.$200>
4374
+ }
4240
4375
  }
4241
4376
 
4242
4377
  export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
@@ -4340,6 +4475,7 @@ export type SetValueMapper = Components.Schemas.SetValueMapper;
4340
4475
  export type StartExecutionRequest = Components.Schemas.StartExecutionRequest;
4341
4476
  export type SuffixCondition = Components.Schemas.SuffixCondition;
4342
4477
  export type TriggerCondition = Components.Schemas.TriggerCondition;
4478
+ export type TriggerContext = Components.Schemas.TriggerContext;
4343
4479
  export type TriggerEventEntityActivity = Components.Schemas.TriggerEventEntityActivity;
4344
4480
  export type TriggerEventEntityOperation = Components.Schemas.TriggerEventEntityOperation;
4345
4481
  export type TriggerEventFlowAutomationTask = Components.Schemas.TriggerEventFlowAutomationTask;
@@ -4355,3 +4491,6 @@ export type TriggerWorkflowActionConfig = Components.Schemas.TriggerWorkflowActi
4355
4491
  export type TriggerWorkflowCondition = Components.Schemas.TriggerWorkflowCondition;
4356
4492
  export type TriggerWorkflowConfig = Components.Schemas.TriggerWorkflowConfig;
4357
4493
  export type WildcardCondition = Components.Schemas.WildcardCondition;
4494
+ export type WorkflowContext = Components.Schemas.WorkflowContext;
4495
+ export type WorkflowContextRole = Components.Schemas.WorkflowContextRole;
4496
+ export type WorkflowExecutionContext = Components.Schemas.WorkflowExecutionContext;
package/dist/openapi.json CHANGED
@@ -69,6 +69,15 @@
69
69
  "type": "string",
70
70
  "example": "600945fe-212e-4b97-acf7-391d64648384"
71
71
  }
72
+ },
73
+ {
74
+ "name": "include_flows",
75
+ "in": "query",
76
+ "description": "Include flow automations in the response",
77
+ "schema": {
78
+ "type": "boolean",
79
+ "default": false
80
+ }
72
81
  }
73
82
  ],
74
83
  "responses": {
@@ -261,6 +270,15 @@
261
270
  "type": "integer",
262
271
  "default": 0
263
272
  }
273
+ },
274
+ {
275
+ "name": "include_flows",
276
+ "in": "query",
277
+ "description": "Include flow automations in the response",
278
+ "schema": {
279
+ "type": "boolean",
280
+ "default": false
281
+ }
264
282
  }
265
283
  ],
266
284
  "tags": [
@@ -574,7 +592,10 @@
574
592
  "entity_schema": "opportunity",
575
593
  "entity_id": "b35a6c51-2a15-4ef1-9623-20db37b0744f"
576
594
  }
577
- ]
595
+ ],
596
+ "trigger_context": {
597
+ "entity_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
598
+ }
578
599
  }
579
600
  }
580
601
  }
@@ -853,6 +874,53 @@
853
874
  }
854
875
  }
855
876
  }
877
+ },
878
+ "/v1/automation/executions/{execution_id}/schedules/{schedule_id}": {
879
+ "delete": {
880
+ "operationId": "cancelSchedule",
881
+ "summary": "cancelSchedule",
882
+ "description": "Cancel a scheduled automation",
883
+ "parameters": [
884
+ {
885
+ "name": "execution_id",
886
+ "in": "path",
887
+ "schema": {
888
+ "$ref": "#/components/schemas/AutomationExecutionId"
889
+ },
890
+ "required": true
891
+ },
892
+ {
893
+ "name": "schedule_id",
894
+ "in": "path",
895
+ "schema": {
896
+ "type": "string"
897
+ },
898
+ "required": true,
899
+ "description": "ID of the schedule to cancel"
900
+ }
901
+ ],
902
+ "tags": [
903
+ "executions"
904
+ ],
905
+ "responses": {
906
+ "200": {
907
+ "description": "The schedule was successfully cancelled",
908
+ "content": {
909
+ "application/json": {
910
+ "schema": {
911
+ "$ref": "#/components/schemas/ActionSchedule"
912
+ }
913
+ }
914
+ }
915
+ },
916
+ "403": {
917
+ "$ref": "#/components/responses/ForbiddenError"
918
+ },
919
+ "404": {
920
+ "$ref": "#/components/responses/NotFoundError"
921
+ }
922
+ }
923
+ }
856
924
  }
857
925
  },
858
926
  "components": {
@@ -1020,6 +1088,9 @@
1020
1088
  "example": "123e4567-e89b-12d3-a456-426614174000"
1021
1089
  },
1022
1090
  "nullable": true
1091
+ },
1092
+ "workflow_context": {
1093
+ "$ref": "#/components/schemas/WorkflowContext"
1023
1094
  }
1024
1095
  },
1025
1096
  "required": [
@@ -1028,6 +1099,37 @@
1028
1099
  "actions"
1029
1100
  ]
1030
1101
  },
1102
+ "WorkflowContext": {
1103
+ "type": "object",
1104
+ "description": "For automation that are connected to workflows V2, this field tracks various information about the workflow.",
1105
+ "required": [
1106
+ "workflow_id",
1107
+ "workflow_role"
1108
+ ],
1109
+ "properties": {
1110
+ "workflow_id": {
1111
+ "type": "string",
1112
+ "format": "uuid",
1113
+ "description": "The ID of the workflow this automation is connected to"
1114
+ },
1115
+ "task_id": {
1116
+ "type": "string",
1117
+ "format": "uuid",
1118
+ "description": "The ID of the task in the workflow that this automation is connected to"
1119
+ },
1120
+ "workflow_role": {
1121
+ "$ref": "#/components/schemas/WorkflowContextRole"
1122
+ }
1123
+ }
1124
+ },
1125
+ "WorkflowContextRole": {
1126
+ "type": "string",
1127
+ "description": "The role this automation plays in the workflow.",
1128
+ "enum": [
1129
+ "trigger_workflow",
1130
+ "run_task_automation"
1131
+ ]
1132
+ },
1031
1133
  "SearchAutomationsResp": {
1032
1134
  "type": "object",
1033
1135
  "properties": {
@@ -1288,7 +1390,15 @@
1288
1390
  "TRIGGER_WEBHOOK_ERROR",
1289
1391
  "TEMPLATE_ERROR",
1290
1392
  "INVALID_PAYLOAD",
1291
- "INVALID_SCHEDULE_CONFIG"
1393
+ "INVALID_SCHEDULE_CONFIG",
1394
+ "CUSTOM_ACTION_ERROR",
1395
+ "ORDER_CREATION_ERROR",
1396
+ "DOCUMENT_GENERATION_ERROR",
1397
+ "BULK_EMAIL_ERROR",
1398
+ "SHARING_ERROR",
1399
+ "CANCEL_FLOW_EXECUTION_ERROR",
1400
+ "METER_READING_NOT_FOUND",
1401
+ "ENTITY_NOT_FOUND"
1292
1402
  ]
1293
1403
  },
1294
1404
  "ErrorDetail": {
@@ -2877,6 +2987,9 @@
2877
2987
  "resume_token": {
2878
2988
  "$ref": "#/components/schemas/ResumeToken"
2879
2989
  },
2990
+ "trigger_context": {
2991
+ "$ref": "#/components/schemas/TriggerContext"
2992
+ },
2880
2993
  "version": {
2881
2994
  "type": "number",
2882
2995
  "description": "Version of the flow",
@@ -2897,6 +3010,9 @@
2897
3010
  "$ref": "#/components/schemas/TriggerEventFlowAutomationTask"
2898
3011
  }
2899
3012
  ]
3013
+ },
3014
+ "workflow_context": {
3015
+ "$ref": "#/components/schemas/WorkflowExecutionContext"
2900
3016
  }
2901
3017
  },
2902
3018
  "required": [
@@ -2908,6 +3024,24 @@
2908
3024
  "actions"
2909
3025
  ]
2910
3026
  },
3027
+ "WorkflowExecutionContext": {
3028
+ "type": "object",
3029
+ "required": [
3030
+ "workflow_exec_id",
3031
+ "workflow_role"
3032
+ ],
3033
+ "properties": {
3034
+ "workflow_exec_id": {
3035
+ "type": "string"
3036
+ },
3037
+ "workflow_exec_task_id": {
3038
+ "type": "string"
3039
+ },
3040
+ "workflow_role": {
3041
+ "$ref": "#/components/schemas/WorkflowContextRole"
3042
+ }
3043
+ }
3044
+ },
2911
3045
  "TriggerEventManual": {
2912
3046
  "type": "object",
2913
3047
  "properties": {
@@ -3132,14 +3266,18 @@
3132
3266
  "flow_id": {
3133
3267
  "$ref": "#/components/schemas/AutomationFlowId"
3134
3268
  },
3269
+ "workflow_context": {
3270
+ "$ref": "#/components/schemas/WorkflowExecutionContext"
3271
+ },
3135
3272
  "flow_execution_id": {
3136
3273
  "type": "string",
3137
- "description": "ID of the Flow Execution"
3274
+ "deprecated": true,
3275
+ "description": "Use workflow_context.workflow_exec_id instead"
3138
3276
  },
3139
3277
  "flow_automation_task_id": {
3140
3278
  "type": "string",
3141
- "format": "UUID",
3142
- "description": "ID of the automated flow action"
3279
+ "deprecated": true,
3280
+ "description": "Use workflow_context.workflow_exec_task_id instead"
3143
3281
  }
3144
3282
  },
3145
3283
  "required": [
@@ -3179,13 +3317,15 @@
3179
3317
  "items": {
3180
3318
  "$ref": "#/components/schemas/EntityRef"
3181
3319
  }
3320
+ },
3321
+ "trigger_context": {
3322
+ "$ref": "#/components/schemas/TriggerContext"
3182
3323
  }
3183
3324
  },
3184
3325
  "required": [
3185
3326
  "flow_id",
3186
3327
  "entities_refs"
3187
- ],
3188
- "additionalProperties": false
3328
+ ]
3189
3329
  },
3190
3330
  {
3191
3331
  "type": "object",
@@ -3195,13 +3335,15 @@
3195
3335
  },
3196
3336
  "entities_query": {
3197
3337
  "type": "string"
3338
+ },
3339
+ "trigger_context": {
3340
+ "$ref": "#/components/schemas/TriggerContext"
3198
3341
  }
3199
3342
  },
3200
3343
  "required": [
3201
3344
  "flow_id",
3202
3345
  "entities_query"
3203
- ],
3204
- "additionalProperties": false
3346
+ ]
3205
3347
  },
3206
3348
  {
3207
3349
  "type": "object",
@@ -3211,13 +3353,15 @@
3211
3353
  },
3212
3354
  "entities_filter": {
3213
3355
  "$ref": "#/components/schemas/EntitySearchFilter"
3356
+ },
3357
+ "trigger_context": {
3358
+ "$ref": "#/components/schemas/TriggerContext"
3214
3359
  }
3215
3360
  },
3216
3361
  "required": [
3217
3362
  "flow_id",
3218
3363
  "entities_filter"
3219
- ],
3220
- "additionalProperties": false
3364
+ ]
3221
3365
  }
3222
3366
  ]
3223
3367
  },
@@ -3290,6 +3434,9 @@
3290
3434
  "description": "Time when the bulk trigger automation executions job was approved",
3291
3435
  "format": "date-time"
3292
3436
  },
3437
+ "trigger_context": {
3438
+ "$ref": "#/components/schemas/TriggerContext"
3439
+ },
3293
3440
  "task_token": {
3294
3441
  "type": "string",
3295
3442
  "description": "Task token to approve/cancel the bulk automation job",
@@ -3425,6 +3572,16 @@
3425
3572
  "type": "string",
3426
3573
  "example": "e3d3ebac-baab-4395-abf4-50b5bf1f8b74"
3427
3574
  },
3575
+ "TriggerContext": {
3576
+ "type": "object",
3577
+ "additionalProperties": {
3578
+ "type": "string"
3579
+ },
3580
+ "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.",
3581
+ "example": {
3582
+ "entity_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
3583
+ }
3584
+ },
3428
3585
  "AutomationTrigger": {
3429
3586
  "type": "object",
3430
3587
  "properties": {
@@ -4361,5 +4518,10 @@
4361
4518
  }
4362
4519
  }
4363
4520
  }
4364
- }
4521
+ },
4522
+ "servers": [
4523
+ {
4524
+ "url": "https://automation.sls.epilot.io"
4525
+ }
4526
+ ]
4365
4527
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/automation-client",
3
- "version": "2.21.0",
3
+ "version": "2.22.0",
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",