@epilot/automation-client 2.15.1 → 2.16.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.
@@ -1 +1 @@
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":{}}}},"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})})();
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":{}}}},"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}(914),n=exports;for(var r in o)n[r]=o[r];o.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();
@@ -220,10 +220,5 @@
220
220
  }
221
221
  }
222
222
  }
223
- },
224
- "servers": [
225
- {
226
- "url": "https://automation.sls.epilot.io"
227
- }
228
- ]
223
+ }
229
224
  }
package/dist/openapi.d.ts CHANGED
@@ -126,7 +126,27 @@ declare namespace Components {
126
126
  types?: (("CreateMeterReading" | "UpdateMeterReading" | "DocDownloadedFromPortal" | "PortalUserResetPassword" | "PortalUserResetForgotPassword" | "SelfAssignmentFromPortal") | string)[];
127
127
  };
128
128
  }
129
- export type AnyAction = MapEntityAction | TriggerWorkflowAction | TriggerWebhookAction | CreateDocumentAction | SendEmailAction | /* Creates an order entity with prices from journey */ CartCheckoutAction | AutomationAction;
129
+ export interface AdvancedCustomActionConfig {
130
+ /**
131
+ * Name of the custom action
132
+ */
133
+ name?: string;
134
+ /**
135
+ * Description of the custom action
136
+ */
137
+ description?: string;
138
+ /**
139
+ * The ID of the app to fetch configuration from the app API
140
+ * example:
141
+ * c451c26a-cc7a-4c1c-92bf-1c6246cbfe88
142
+ */
143
+ app_id?: string;
144
+ type: "advanced";
145
+ advanced_settings?: {
146
+ [name: string]: any;
147
+ };
148
+ }
149
+ export type AnyAction = MapEntityAction | TriggerWorkflowAction | TriggerWebhookAction | CreateDocumentAction | SendEmailAction | /* Creates an order entity with prices from journey */ CartCheckoutAction | CustomAction | AutomationAction;
130
150
  export type AnyActionConfig = /**
131
151
  * example:
132
152
  * {
@@ -326,7 +346,7 @@ declare namespace Components {
326
346
  * }
327
347
  * }
328
348
  */
329
- SendEmailActionConfig | /* Creates an order entity with prices from journey */ CartCheckoutActionConfig | AutomationActionConfig;
349
+ SendEmailActionConfig | /* Creates an order entity with prices from journey */ CartCheckoutActionConfig | CustomActionConfig | AutomationActionConfig;
330
350
  export type AnyTrigger = FrontendSubmitTrigger | JourneySubmitTrigger | ApiSubmissionTrigger | /**
331
351
  * - If provides filter_config, executes an automation based on the filtered configuration when an entity event occurs.
332
352
  * - The conditions on a filter follows the event bridge patterns - `https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html`
@@ -885,6 +905,52 @@ declare namespace Components {
885
905
  */
886
906
  id?: string; // uuid
887
907
  }
908
+ export interface BaseCustomActionConfig {
909
+ /**
910
+ * Name of the custom action
911
+ */
912
+ name?: string;
913
+ /**
914
+ * Description of the custom action
915
+ */
916
+ description?: string;
917
+ /**
918
+ * The ID of the app to fetch configuration from the app API
919
+ * example:
920
+ * c451c26a-cc7a-4c1c-92bf-1c6246cbfe88
921
+ */
922
+ app_id?: string;
923
+ }
924
+ export interface BasicCustomActionConfig {
925
+ /**
926
+ * Name of the custom action
927
+ */
928
+ name?: string;
929
+ /**
930
+ * Description of the custom action
931
+ */
932
+ description?: string;
933
+ /**
934
+ * The ID of the app to fetch configuration from the app API
935
+ * example:
936
+ * c451c26a-cc7a-4c1c-92bf-1c6246cbfe88
937
+ */
938
+ app_id?: string;
939
+ type: "basic";
940
+ basic_settings?: {
941
+ /**
942
+ * URL to call
943
+ */
944
+ url?: string;
945
+ headers?: {
946
+ [name: string]: any;
947
+ };
948
+ /**
949
+ * SSM Reference to the auth token to use for the request
950
+ */
951
+ auth_token_ref?: string;
952
+ };
953
+ }
888
954
  export interface BulkTriggerJob {
889
955
  job_id: /**
890
956
  * Job ID for tracking the status of bulk trigger automation executions
@@ -1289,6 +1355,116 @@ declare namespace Components {
1289
1355
  template_id?: string;
1290
1356
  filename?: string;
1291
1357
  }
1358
+ export interface CustomAction {
1359
+ id?: /**
1360
+ * example:
1361
+ * 9ec3711b-db63-449c-b894-54d5bb622a8f
1362
+ */
1363
+ AutomationActionId;
1364
+ flow_action_id?: /**
1365
+ * example:
1366
+ * 9ec3711b-db63-449c-b894-54d5bb622a8f
1367
+ */
1368
+ AutomationActionId;
1369
+ name?: string;
1370
+ type?: "custom-action";
1371
+ config?: BasicCustomActionConfig | AdvancedCustomActionConfig;
1372
+ /**
1373
+ * Whether to stop execution in a failed state if this action fails
1374
+ */
1375
+ allow_failure?: boolean;
1376
+ /**
1377
+ * Flag indicating whether the action was created automatically or manually
1378
+ */
1379
+ created_automatically?: boolean;
1380
+ /**
1381
+ * Flag indicating whether the same action can be in bulk in a single execution. e.g; send-email / map-entity
1382
+ */
1383
+ is_bulk_action?: boolean;
1384
+ reason?: {
1385
+ /**
1386
+ * Why the action has to be skipped/failed
1387
+ * example:
1388
+ * There are no registered portal users for the given emails, hence skipping the action
1389
+ */
1390
+ message?: string;
1391
+ /**
1392
+ * Extra metadata about the skipping reason - such as a certain condition not met, etc.
1393
+ */
1394
+ payload?: {
1395
+ [name: string]: any;
1396
+ };
1397
+ };
1398
+ /**
1399
+ * Condition Id to be checked before executing the action
1400
+ */
1401
+ condition_id?: string;
1402
+ /**
1403
+ * Schedule Id which indicates the schedule of the action
1404
+ */
1405
+ schedule_id?: string;
1406
+ execution_status?: ExecutionStatus;
1407
+ started_at?: string;
1408
+ updated_at?: string;
1409
+ /**
1410
+ * example:
1411
+ * {}
1412
+ */
1413
+ outputs?: {
1414
+ [name: string]: any;
1415
+ };
1416
+ error_output?: ErrorOutput;
1417
+ retry_strategy?: /* different behaviors for retrying failed execution actions. */ RetryStrategy;
1418
+ }
1419
+ export interface CustomActionConfig {
1420
+ id?: /**
1421
+ * example:
1422
+ * 9ec3711b-db63-449c-b894-54d5bb622a8f
1423
+ */
1424
+ AutomationActionId;
1425
+ flow_action_id?: /**
1426
+ * example:
1427
+ * 9ec3711b-db63-449c-b894-54d5bb622a8f
1428
+ */
1429
+ AutomationActionId;
1430
+ name?: string;
1431
+ type?: "custom-action";
1432
+ config?: BasicCustomActionConfig | AdvancedCustomActionConfig;
1433
+ /**
1434
+ * Whether to stop execution in a failed state if this action fails
1435
+ */
1436
+ allow_failure?: boolean;
1437
+ /**
1438
+ * Flag indicating whether the action was created automatically or manually
1439
+ */
1440
+ created_automatically?: boolean;
1441
+ /**
1442
+ * Flag indicating whether the same action can be in bulk in a single execution. e.g; send-email / map-entity
1443
+ */
1444
+ is_bulk_action?: boolean;
1445
+ reason?: {
1446
+ /**
1447
+ * Why the action has to be skipped/failed
1448
+ * example:
1449
+ * There are no registered portal users for the given emails, hence skipping the action
1450
+ */
1451
+ message?: string;
1452
+ /**
1453
+ * Extra metadata about the skipping reason - such as a certain condition not met, etc.
1454
+ */
1455
+ payload?: {
1456
+ [name: string]: any;
1457
+ };
1458
+ };
1459
+ /**
1460
+ * Condition Id to be checked before executing the action
1461
+ */
1462
+ condition_id?: string;
1463
+ /**
1464
+ * Schedule Id which indicates the schedule of the action
1465
+ */
1466
+ schedule_id?: string;
1467
+ }
1292
1468
  export type DiffAdded = FilterConditionOnEvent;
1293
1469
  export type DiffDeleted = FilterConditionOnEvent;
1294
1470
  export type DiffUpdated = FilterConditionOnEvent;
@@ -3408,6 +3584,7 @@ export type ActionSchedule = Components.Schemas.ActionSchedule;
3408
3584
  export type ActionScheduleSource = Components.Schemas.ActionScheduleSource;
3409
3585
  export type ActivityId = Components.Schemas.ActivityId;
3410
3586
  export type ActivityTrigger = Components.Schemas.ActivityTrigger;
3587
+ export type AdvancedCustomActionConfig = Components.Schemas.AdvancedCustomActionConfig;
3411
3588
  export type AnyAction = Components.Schemas.AnyAction;
3412
3589
  export type AnyActionConfig = Components.Schemas.AnyActionConfig;
3413
3590
  export type AnyTrigger = Components.Schemas.AnyTrigger;
@@ -3425,6 +3602,8 @@ export type AutomationExecutionId = Components.Schemas.AutomationExecutionId;
3425
3602
  export type AutomationFlow = Components.Schemas.AutomationFlow;
3426
3603
  export type AutomationFlowId = Components.Schemas.AutomationFlowId;
3427
3604
  export type AutomationTrigger = Components.Schemas.AutomationTrigger;
3605
+ export type BaseCustomActionConfig = Components.Schemas.BaseCustomActionConfig;
3606
+ export type BasicCustomActionConfig = Components.Schemas.BasicCustomActionConfig;
3428
3607
  export type BulkTriggerJob = Components.Schemas.BulkTriggerJob;
3429
3608
  export type BulkTriggerRequest = Components.Schemas.BulkTriggerRequest;
3430
3609
  export type CartCheckoutAction = Components.Schemas.CartCheckoutAction;
@@ -3436,6 +3615,8 @@ export type CopyValueMapper = Components.Schemas.CopyValueMapper;
3436
3615
  export type CreateDocumentAction = Components.Schemas.CreateDocumentAction;
3437
3616
  export type CreateDocumentActionConfig = Components.Schemas.CreateDocumentActionConfig;
3438
3617
  export type CreateDocumentConfig = Components.Schemas.CreateDocumentConfig;
3618
+ export type CustomAction = Components.Schemas.CustomAction;
3619
+ export type CustomActionConfig = Components.Schemas.CustomActionConfig;
3439
3620
  export type DiffAdded = Components.Schemas.DiffAdded;
3440
3621
  export type DiffDeleted = Components.Schemas.DiffDeleted;
3441
3622
  export type DiffUpdated = Components.Schemas.DiffUpdated;
package/dist/openapi.json CHANGED
@@ -845,6 +845,9 @@
845
845
  {
846
846
  "$ref": "#/components/schemas/CartCheckoutAction"
847
847
  },
848
+ {
849
+ "$ref": "#/components/schemas/CustomAction"
850
+ },
848
851
  {
849
852
  "$ref": "#/components/schemas/AutomationAction"
850
853
  }
@@ -870,6 +873,9 @@
870
873
  {
871
874
  "$ref": "#/components/schemas/CartCheckoutActionConfig"
872
875
  },
876
+ {
877
+ "$ref": "#/components/schemas/CustomActionConfig"
878
+ },
873
879
  {
874
880
  "$ref": "#/components/schemas/AutomationActionConfig"
875
881
  }
@@ -1999,6 +2005,157 @@
1999
2005
  }
2000
2006
  ]
2001
2007
  },
2008
+ "BaseCustomActionConfig": {
2009
+ "type": "object",
2010
+ "properties": {
2011
+ "name": {
2012
+ "type": "string",
2013
+ "description": "Name of the custom action"
2014
+ },
2015
+ "description": {
2016
+ "type": "string",
2017
+ "description": "Description of the custom action"
2018
+ },
2019
+ "app_id": {
2020
+ "type": "string",
2021
+ "description": "The ID of the app to fetch configuration from the app API",
2022
+ "example": "c451c26a-cc7a-4c1c-92bf-1c6246cbfe88"
2023
+ }
2024
+ }
2025
+ },
2026
+ "BasicCustomActionConfig": {
2027
+ "allOf": [
2028
+ {
2029
+ "$ref": "#/components/schemas/BaseCustomActionConfig"
2030
+ },
2031
+ {
2032
+ "type": "object",
2033
+ "properties": {
2034
+ "type": {
2035
+ "type": "string",
2036
+ "enum": [
2037
+ "basic"
2038
+ ]
2039
+ },
2040
+ "basic_settings": {
2041
+ "type": "object",
2042
+ "properties": {
2043
+ "url": {
2044
+ "type": "string",
2045
+ "description": "URL to call"
2046
+ },
2047
+ "headers": {
2048
+ "type": "object",
2049
+ "additionalProperties": true
2050
+ },
2051
+ "auth_token_ref": {
2052
+ "type": "string",
2053
+ "description": "SSM Reference to the auth token to use for the request"
2054
+ }
2055
+ }
2056
+ }
2057
+ },
2058
+ "required": [
2059
+ "type"
2060
+ ]
2061
+ }
2062
+ ]
2063
+ },
2064
+ "AdvancedCustomActionConfig": {
2065
+ "allOf": [
2066
+ {
2067
+ "$ref": "#/components/schemas/BaseCustomActionConfig"
2068
+ },
2069
+ {
2070
+ "type": "object",
2071
+ "properties": {
2072
+ "type": {
2073
+ "type": "string",
2074
+ "enum": [
2075
+ "advanced"
2076
+ ]
2077
+ },
2078
+ "advanced_settings": {
2079
+ "type": "object",
2080
+ "additionalProperties": true
2081
+ }
2082
+ },
2083
+ "required": [
2084
+ "type"
2085
+ ]
2086
+ }
2087
+ ]
2088
+ },
2089
+ "CustomActionConfig": {
2090
+ "allOf": [
2091
+ {
2092
+ "$ref": "#/components/schemas/AutomationActionConfig"
2093
+ },
2094
+ {
2095
+ "type": "object",
2096
+ "properties": {
2097
+ "type": {
2098
+ "type": "string",
2099
+ "enum": [
2100
+ "custom-action"
2101
+ ]
2102
+ },
2103
+ "config": {
2104
+ "oneOf": [
2105
+ {
2106
+ "$ref": "#/components/schemas/BasicCustomActionConfig"
2107
+ },
2108
+ {
2109
+ "$ref": "#/components/schemas/AdvancedCustomActionConfig"
2110
+ }
2111
+ ],
2112
+ "discriminator": {
2113
+ "propertyName": "type",
2114
+ "mapping": {
2115
+ "basic": "#/components/schemas/BasicCustomActionConfig",
2116
+ "advanced": "#/components/schemas/AdvancedCustomActionConfig"
2117
+ }
2118
+ }
2119
+ }
2120
+ }
2121
+ }
2122
+ ]
2123
+ },
2124
+ "CustomAction": {
2125
+ "allOf": [
2126
+ {
2127
+ "$ref": "#/components/schemas/AutomationAction"
2128
+ },
2129
+ {
2130
+ "type": "object",
2131
+ "properties": {
2132
+ "type": {
2133
+ "type": "string",
2134
+ "enum": [
2135
+ "custom-action"
2136
+ ]
2137
+ },
2138
+ "config": {
2139
+ "oneOf": [
2140
+ {
2141
+ "$ref": "#/components/schemas/BasicCustomActionConfig"
2142
+ },
2143
+ {
2144
+ "$ref": "#/components/schemas/AdvancedCustomActionConfig"
2145
+ }
2146
+ ],
2147
+ "discriminator": {
2148
+ "propertyName": "type",
2149
+ "mapping": {
2150
+ "basic": "#/components/schemas/BasicCustomActionConfig",
2151
+ "advanced": "#/components/schemas/AdvancedCustomActionConfig"
2152
+ }
2153
+ }
2154
+ }
2155
+ }
2156
+ }
2157
+ ]
2158
+ },
2002
2159
  "TriggerWebhookActionConfig": {
2003
2160
  "allOf": [
2004
2161
  {
@@ -3458,10 +3615,5 @@
3458
3615
  }
3459
3616
  }
3460
3617
  }
3461
- },
3462
- "servers": [
3463
- {
3464
- "url": "https://automation.sls.epilot.io"
3465
- }
3466
- ]
3618
+ }
3467
3619
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/automation-client",
3
- "version": "2.15.1",
3
+ "version": "2.16.0",
4
4
  "description": "Client library for epilot automation API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "test": "jest",
25
25
  "typescript": "tsc",
26
26
  "bundle-definition": "webpack",
27
- "openapi": "node ../../scripts/update-openapi.js https://docs.api.epilot.io/automation.yaml",
27
+ "openapi": "node ../../scripts/update-openapi.js ../../../backend/automation-api/lambda/ApiHandlerFunction/openapi.yml",
28
28
  "typegen": "openapi typegen src/openapi.json --client -b '/* eslint-disable */' > src/openapi.d.ts",
29
29
  "build": "tsc && npm run build:patch && npm run bundle-definition",
30
30
  "build:patch": "sed -i'' -e '/^__exportStar.*openapi.*$/d' dist/index.js",