@epilot/automation-client 2.21.0 → 2.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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;
@@ -2150,7 +2192,14 @@ declare namespace Components {
2150
2192
  id?: string; // uuid
2151
2193
  type: "flows_trigger";
2152
2194
  configuration: {
2195
+ /**
2196
+ * The ID of the workflow v2 that triggers this automation
2197
+ */
2153
2198
  source_id: string; // uuid
2199
+ /**
2200
+ * When Journeys are linked to Workflows V2 as Journey Automations, this field will contain the ID of the Journey
2201
+ */
2202
+ journey_id?: string; // uuid
2154
2203
  };
2155
2204
  }
2156
2205
  export interface FrontendSubmitTrigger {
@@ -2995,14 +3044,15 @@ declare namespace Components {
2995
3044
  * 7791b04a-16d2-44a2-9af9-2d59c25c512f
2996
3045
  */
2997
3046
  AutomationFlowId;
3047
+ workflow_context?: WorkflowExecutionContext;
2998
3048
  /**
2999
- * ID of the Flow Execution
3049
+ * Use workflow_context.workflow_exec_id instead
3000
3050
  */
3001
3051
  flow_execution_id?: string;
3002
3052
  /**
3003
- * ID of the automated flow action
3053
+ * Use workflow_context.workflow_exec_task_id instead
3004
3054
  */
3005
- flow_automation_task_id?: string; // UUID
3055
+ flow_automation_task_id?: string;
3006
3056
  }
3007
3057
  export interface SuffixCondition {
3008
3058
  suffix?: string;
@@ -3019,6 +3069,16 @@ declare namespace Components {
3019
3069
  comparison: Comparison;
3020
3070
  value?: string | number | string[] | number[];
3021
3071
  }
3072
+ /**
3073
+ * 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.
3074
+ * example:
3075
+ * {
3076
+ * "entity_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
3077
+ * }
3078
+ */
3079
+ export interface TriggerContext {
3080
+ [name: string]: string;
3081
+ }
3022
3082
  export interface TriggerEventEntityActivity {
3023
3083
  type?: "entity_activity";
3024
3084
  /**
@@ -3539,6 +3599,29 @@ declare namespace Components {
3539
3599
  export interface WildcardCondition {
3540
3600
  wildcard?: string;
3541
3601
  }
3602
+ /**
3603
+ * For automation that are connected to workflows V2, this field tracks various information about the workflow.
3604
+ */
3605
+ export interface WorkflowContext {
3606
+ /**
3607
+ * The ID of the workflow this automation is connected to
3608
+ */
3609
+ workflow_id: string; // uuid
3610
+ /**
3611
+ * The ID of the task in the workflow that this automation is connected to
3612
+ */
3613
+ task_id?: string; // uuid
3614
+ workflow_role: /* The role this automation plays in the workflow. */ WorkflowContextRole;
3615
+ }
3616
+ /**
3617
+ * The role this automation plays in the workflow.
3618
+ */
3619
+ export type WorkflowContextRole = "trigger_workflow" | "run_task_automation";
3620
+ export interface WorkflowExecutionContext {
3621
+ workflow_exec_id: string;
3622
+ workflow_exec_task_id?: string;
3623
+ workflow_role: /* The role this automation plays in the workflow. */ WorkflowContextRole;
3624
+ }
3542
3625
  }
3543
3626
  }
3544
3627
  declare namespace Paths {
@@ -3587,6 +3670,39 @@ declare namespace Paths {
3587
3670
  Components.Responses.NotFoundError;
3588
3671
  }
3589
3672
  }
3673
+ namespace CancelSchedule {
3674
+ namespace Parameters {
3675
+ export type ExecutionId = /**
3676
+ * example:
3677
+ * 9baf184f-bc81-4128-bca3-d974c90a12c4
3678
+ */
3679
+ Components.Schemas.AutomationExecutionId;
3680
+ export type ScheduleId = string;
3681
+ }
3682
+ export interface PathParameters {
3683
+ execution_id: Parameters.ExecutionId;
3684
+ schedule_id: Parameters.ScheduleId;
3685
+ }
3686
+ namespace Responses {
3687
+ export type $200 = Components.Schemas.ActionSchedule;
3688
+ export type $403 = /**
3689
+ * example:
3690
+ * {
3691
+ * "status": 403,
3692
+ * "error": "Forbidden"
3693
+ * }
3694
+ */
3695
+ Components.Responses.ForbiddenError;
3696
+ export type $404 = /**
3697
+ * example:
3698
+ * {
3699
+ * "status": 404,
3700
+ * "error": "Not Found"
3701
+ * }
3702
+ */
3703
+ Components.Responses.NotFoundError;
3704
+ }
3705
+ }
3590
3706
  namespace CreateFlow {
3591
3707
  export type RequestBody = Components.Schemas.AutomationFlow;
3592
3708
  namespace Responses {
@@ -3705,12 +3821,14 @@ declare namespace Paths {
3705
3821
  */
3706
3822
  Components.Schemas.EntityId;
3707
3823
  export type From = number;
3824
+ export type IncludeFlows = boolean;
3708
3825
  export type Size = number;
3709
3826
  }
3710
3827
  export interface QueryParameters {
3711
3828
  entity_id?: Parameters.EntityId;
3712
3829
  size?: Parameters.Size;
3713
3830
  from?: Parameters.From;
3831
+ include_flows?: Parameters.IncludeFlows;
3714
3832
  }
3715
3833
  namespace Responses {
3716
3834
  export type $200 = Components.Schemas.GetExecutionsResp;
@@ -3880,6 +3998,7 @@ declare namespace Paths {
3880
3998
  namespace SearchFlows {
3881
3999
  namespace Parameters {
3882
4000
  export type From = number;
4001
+ export type IncludeFlows = boolean;
3883
4002
  /**
3884
4003
  * example:
3885
4004
  * submission
@@ -3905,6 +4024,7 @@ declare namespace Paths {
3905
4024
  * 600945fe-212e-4b97-acf7-391d64648384
3906
4025
  */
3907
4026
  Parameters.TriggerSourceId;
4027
+ include_flows?: Parameters.IncludeFlows;
3908
4028
  }
3909
4029
  namespace Responses {
3910
4030
  export type $200 = Components.Schemas.SearchAutomationsResp;
@@ -4073,6 +4193,16 @@ export interface OperationMethods {
4073
4193
  data?: Paths.ResumeExecutionWithToken.RequestBody,
4074
4194
  config?: AxiosRequestConfig
4075
4195
  ): OperationResponse<Paths.ResumeExecutionWithToken.Responses.$200>
4196
+ /**
4197
+ * cancelSchedule - cancelSchedule
4198
+ *
4199
+ * Cancel a scheduled automation
4200
+ */
4201
+ 'cancelSchedule'(
4202
+ parameters?: Parameters<Paths.CancelSchedule.PathParameters> | null,
4203
+ data?: any,
4204
+ config?: AxiosRequestConfig
4205
+ ): OperationResponse<Paths.CancelSchedule.Responses.$200>
4076
4206
  }
4077
4207
 
4078
4208
  export interface PathsDictionary {
@@ -4237,6 +4367,18 @@ export interface PathsDictionary {
4237
4367
  config?: AxiosRequestConfig
4238
4368
  ): OperationResponse<Paths.ResumeExecutionWithToken.Responses.$200>
4239
4369
  }
4370
+ ['/v1/automation/executions/{execution_id}/schedules/{schedule_id}']: {
4371
+ /**
4372
+ * cancelSchedule - cancelSchedule
4373
+ *
4374
+ * Cancel a scheduled automation
4375
+ */
4376
+ 'delete'(
4377
+ parameters?: Parameters<Paths.CancelSchedule.PathParameters> | null,
4378
+ data?: any,
4379
+ config?: AxiosRequestConfig
4380
+ ): OperationResponse<Paths.CancelSchedule.Responses.$200>
4381
+ }
4240
4382
  }
4241
4383
 
4242
4384
  export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
@@ -4340,6 +4482,7 @@ export type SetValueMapper = Components.Schemas.SetValueMapper;
4340
4482
  export type StartExecutionRequest = Components.Schemas.StartExecutionRequest;
4341
4483
  export type SuffixCondition = Components.Schemas.SuffixCondition;
4342
4484
  export type TriggerCondition = Components.Schemas.TriggerCondition;
4485
+ export type TriggerContext = Components.Schemas.TriggerContext;
4343
4486
  export type TriggerEventEntityActivity = Components.Schemas.TriggerEventEntityActivity;
4344
4487
  export type TriggerEventEntityOperation = Components.Schemas.TriggerEventEntityOperation;
4345
4488
  export type TriggerEventFlowAutomationTask = Components.Schemas.TriggerEventFlowAutomationTask;
@@ -4355,3 +4498,6 @@ export type TriggerWorkflowActionConfig = Components.Schemas.TriggerWorkflowActi
4355
4498
  export type TriggerWorkflowCondition = Components.Schemas.TriggerWorkflowCondition;
4356
4499
  export type TriggerWorkflowConfig = Components.Schemas.TriggerWorkflowConfig;
4357
4500
  export type WildcardCondition = Components.Schemas.WildcardCondition;
4501
+ export type WorkflowContext = Components.Schemas.WorkflowContext;
4502
+ export type WorkflowContextRole = Components.Schemas.WorkflowContextRole;
4503
+ 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": {
@@ -3454,7 +3611,13 @@
3454
3611
  "properties": {
3455
3612
  "source_id": {
3456
3613
  "type": "string",
3457
- "format": "uuid"
3614
+ "format": "uuid",
3615
+ "description": "The ID of the workflow v2 that triggers this automation"
3616
+ },
3617
+ "journey_id": {
3618
+ "type": "string",
3619
+ "format": "uuid",
3620
+ "description": "When Journeys are linked to Workflows V2 as Journey Automations, this field will contain the ID of the Journey"
3458
3621
  }
3459
3622
  },
3460
3623
  "required": [
@@ -4361,5 +4524,10 @@
4361
4524
  }
4362
4525
  }
4363
4526
  }
4364
- }
4527
+ },
4528
+ "servers": [
4529
+ {
4530
+ "url": "https://automation.sls.epilot.io"
4531
+ }
4532
+ ]
4365
4533
  }
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.1",
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",