@epilot/automation-client 0.5.0 → 0.5.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/openapi.d.ts CHANGED
@@ -9,53 +9,11 @@ import {
9
9
 
10
10
  declare namespace Components {
11
11
  namespace Schemas {
12
+ export type AnyAction = MapEntityAction | TriggerWorkflowAction | TriggerWebhookAction | AutomationAction;
12
13
  export interface AutomationAction {
13
14
  id?: AutomationActionId;
14
- /**
15
- * example:
16
- * Create Contact
17
- */
18
15
  name?: string;
19
- /**
20
- * example:
21
- * entity_mapping
22
- */
23
16
  type?: string;
24
- /**
25
- * example:
26
- * {
27
- * "target_schema": "contact",
28
- * "mapping_attributes": [
29
- * {
30
- * "target": "email",
31
- * "mode": "upsert_match",
32
- * "source": "billing_contact.email"
33
- * },
34
- * {
35
- * "target": "first_name",
36
- * "mode": "copy_if_exists",
37
- * "source": "billing_contact.first_name"
38
- * },
39
- * {
40
- * "target": "last_name",
41
- * "mode": "copy_if_exists",
42
- * "source": "billing_contact.last_name"
43
- * },
44
- * {
45
- * "target": "addresses",
46
- * "mode": "append_if_exists",
47
- * "source": "billing_contact",
48
- * "value_json": "{\n \"street_name\": \"{{billing_contact.street_name}}\",\n \"street_number\": \"{{billing_contact.street_number}}\",\n \"city\": \"{{billing_contact.city}}\",\n \"postal_code\": \"{{billing_contact.postal_code}}\",\n \"country\": \"{{billing_contact.country}}\",\n}"
49
- * },
50
- * {
51
- * "target": "addresses",
52
- * "mode": "append_if_exists",
53
- * "source": "delivery_contact",
54
- * "value_json": "{\n \"street_name\": \"{{delivery_contact.street_name}}\",\n \"street_number\": \"{{delivery_contact.street_number}}\",\n \"city\": \"{{delivery_contact.city}}\",\n \"postal_code\": \"{{delivery_contact.postal_code}}\",\n \"country\": \"{{delivery_contact.country}}\",\n}"
55
- * }
56
- * ]
57
- * }
58
- */
59
17
  config?: {
60
18
  [name: string]: any;
61
19
  };
@@ -73,6 +31,7 @@ declare namespace Components {
73
31
  */
74
32
  status?: "pending" | "in_progress" | "success" | "failed" | "cancelled";
75
33
  entity_id?: EntityId;
34
+ org_id?: OrganizationId;
76
35
  flow_id?: AutomationFlowId;
77
36
  /**
78
37
  * example:
@@ -107,51 +66,8 @@ declare namespace Components {
107
66
  [name: string]: any;
108
67
  };
109
68
  id?: AutomationActionId;
110
- /**
111
- * example:
112
- * Create Contact
113
- */
114
69
  name?: string;
115
- /**
116
- * example:
117
- * entity_mapping
118
- */
119
70
  type?: string;
120
- /**
121
- * example:
122
- * {
123
- * "target_schema": "contact",
124
- * "mapping_attributes": [
125
- * {
126
- * "target": "email",
127
- * "mode": "upsert_match",
128
- * "source": "billing_contact.email"
129
- * },
130
- * {
131
- * "target": "first_name",
132
- * "mode": "copy_if_exists",
133
- * "source": "billing_contact.first_name"
134
- * },
135
- * {
136
- * "target": "last_name",
137
- * "mode": "copy_if_exists",
138
- * "source": "billing_contact.last_name"
139
- * },
140
- * {
141
- * "target": "addresses",
142
- * "mode": "append_if_exists",
143
- * "source": "billing_contact",
144
- * "value_json": "{\n \"street_name\": \"{{billing_contact.street_name}}\",\n \"street_number\": \"{{billing_contact.street_number}}\",\n \"city\": \"{{billing_contact.city}}\",\n \"postal_code\": \"{{billing_contact.postal_code}}\",\n \"country\": \"{{billing_contact.country}}\",\n}"
145
- * },
146
- * {
147
- * "target": "addresses",
148
- * "mode": "append_if_exists",
149
- * "source": "delivery_contact",
150
- * "value_json": "{\n \"street_name\": \"{{delivery_contact.street_name}}\",\n \"street_number\": \"{{delivery_contact.street_number}}\",\n \"city\": \"{{delivery_contact.city}}\",\n \"postal_code\": \"{{delivery_contact.postal_code}}\",\n \"country\": \"{{delivery_contact.country}}\",\n}"
151
- * }
152
- * ]
153
- * }
154
- */
155
71
  config?: {
156
72
  [name: string]: any;
157
73
  };
@@ -169,32 +85,14 @@ declare namespace Components {
169
85
  * Handle contact form
170
86
  */
171
87
  flow_name?: string;
172
- triggers?: {
173
- on: "entity_create" | "entity_update" | "entity_delete" | "journey_submit" | "frontend_submit";
174
- /**
175
- * example:
176
- * {
177
- * "entity_schema": "contact"
178
- * }
179
- */
180
- config: {
181
- [name: string]: any;
182
- };
183
- }[];
184
- /**
185
- * List of conditions to be met for the automation to be triggered
186
- */
187
- trigger_conditions?: {
188
- source?: string;
189
- comparison?: "not_empty" | "is_empty" | "contains" | "equals";
190
- }[];
88
+ trigger?: EntityOperationTrigger;
191
89
  /**
192
90
  * The entity schema
193
91
  * example:
194
92
  * submission
195
93
  */
196
- entity?: AutomationFlowId;
197
- actions?: AutomationAction[];
94
+ entity?: string;
95
+ actions?: AnyAction[];
198
96
  created_at?: string; // date-time
199
97
  updated_at?: string; // date-time
200
98
  }
@@ -208,6 +106,196 @@ declare namespace Components {
208
106
  * e3d3ebac-baab-4395-abf4-50b5bf1f8b74
209
107
  */
210
108
  export type EntityId = string;
109
+ export interface EntityOperationTrigger {
110
+ type?: "entity_operation";
111
+ configuration?: {
112
+ /**
113
+ * example:
114
+ * submission
115
+ */
116
+ schema?: string;
117
+ operations?: ("createEntity" | "updateEntity" | "deleteEntity")[];
118
+ /**
119
+ * example:
120
+ * [
121
+ * {
122
+ * "source": "source_type",
123
+ * "comparison": "equals",
124
+ * "value": "journey"
125
+ * },
126
+ * {
127
+ * "source": "source_id",
128
+ * "comparison": "array_in",
129
+ * "value": [
130
+ * "c69b3f50-0c9b-11ec-b2e4-8724b261c6ab",
131
+ * "6053c022-d50a-4b8d-9dcd-3b31213af36b"
132
+ * ]
133
+ * }
134
+ * ]
135
+ */
136
+ conditions?: {
137
+ source?: string;
138
+ comparison?: "not_empty" | "is_empty" | "equals" | "contains" | "array_in";
139
+ }[];
140
+ };
141
+ }
142
+ export interface FrontendSubmitTrigger {
143
+ type?: "frontend_submit";
144
+ configuration?: {
145
+ /**
146
+ * example:
147
+ * 99
148
+ */
149
+ frontend_id?: string;
150
+ };
151
+ }
152
+ export interface JourneySubmitTrigger {
153
+ type?: "journey_submit";
154
+ configuration?: {
155
+ journey_id?: string; // uuid
156
+ };
157
+ }
158
+ /**
159
+ * example:
160
+ * {
161
+ * "id": "2520gja-2sgmsaga-0asg-822jgal",
162
+ * "name": "Map Entity",
163
+ * "type": "map-entity",
164
+ * "config": {
165
+ * "target_schema": "contact",
166
+ * "target_unique": [
167
+ * "email.email"
168
+ * ],
169
+ * "mapping_attributes": [
170
+ * {
171
+ * "target": "email",
172
+ * "mode": "copy_if_exists",
173
+ * "source": "billing_contact.email"
174
+ * },
175
+ * {
176
+ * "target": "first_name",
177
+ * "mode": "copy_if_exists",
178
+ * "source": "billing_contact.first_name"
179
+ * },
180
+ * {
181
+ * "target": "last_name",
182
+ * "mode": "copy_if_exists",
183
+ * "source": "billing_contact.last_name"
184
+ * },
185
+ * {
186
+ * "target": "addresses",
187
+ * "mode": "append_if_exists",
188
+ * "source": "billing_contact",
189
+ * "value_json": "{\n \"street_name\": \"{{billing_contact.street_name}}\",\n \"street_number\": \"{{billing_contact.street_number}}\",\n \"city\": \"{{billing_contact.city}}\",\n \"postal_code\": \"{{billing_contact.postal_code}}\",\n \"country\": \"{{billing_contact.country}}\",\n}"
190
+ * },
191
+ * {
192
+ * "target": "addresses",
193
+ * "mode": "append_if_exists",
194
+ * "source": "delivery_contact",
195
+ * "value_json": "{\n \"street_name\": \"{{delivery_contact.street_name}}\",\n \"street_number\": \"{{delivery_contact.street_number}}\",\n \"city\": \"{{delivery_contact.city}}\",\n \"postal_code\": \"{{delivery_contact.postal_code}}\",\n \"country\": \"{{delivery_contact.country}}\",\n}"
196
+ * }
197
+ * ]
198
+ * }
199
+ * }
200
+ */
201
+ export interface MapEntityAction {
202
+ id?: AutomationActionId;
203
+ name?: string;
204
+ type?: string;
205
+ config?: MapEntityActionConfig;
206
+ outputs?: {
207
+ [name: string]: any;
208
+ };
209
+ }
210
+ export interface MapEntityActionConfig {
211
+ target_schema?: string;
212
+ target_unique?: string[];
213
+ mapping_attributes?: MappingAttribute[];
214
+ }
215
+ export interface MappingAttribute {
216
+ target?: string;
217
+ mode?: "copy_if_exists" | "append_if_exists";
218
+ source?: string;
219
+ value_json?: string;
220
+ }
221
+ /**
222
+ * example:
223
+ * e3d3ebac-baab-4395-abf4-50b5bf1f8b74
224
+ */
225
+ export type OrganizationId = string;
226
+ export interface StartExecutionRequest {
227
+ entity_id?: EntityId;
228
+ flow_id?: AutomationFlowId;
229
+ }
230
+ /**
231
+ * example:
232
+ * {
233
+ * "id": "2520gja-2sgmsaga-0asg-822jgal",
234
+ * "name": "Trigger Webhook",
235
+ * "type": "trigger-webhook",
236
+ * "config": {
237
+ * "entity_sources": [
238
+ * "contact",
239
+ * "account"
240
+ * ],
241
+ * "target_webhook_id": "25jg9ag2ga"
242
+ * }
243
+ * }
244
+ */
245
+ export interface TriggerWebhookAction {
246
+ id?: AutomationActionId;
247
+ name?: string;
248
+ type?: string;
249
+ config?: TriggerWebhookActionConfig;
250
+ outputs?: {
251
+ [name: string]: any;
252
+ };
253
+ }
254
+ export interface TriggerWebhookActionConfig {
255
+ entity_sources?: string[];
256
+ target_webhook_id?: string;
257
+ }
258
+ /**
259
+ * example:
260
+ * {
261
+ * "id": "08g988-ojt2jtaga-292h-8978gsaga",
262
+ * "name": "Trigger Workflow",
263
+ * "type": "trigger-workflow",
264
+ * "config": {
265
+ * "target_workflow": "mfptvUMH",
266
+ * "add_context": [
267
+ * "contact"
268
+ * ],
269
+ * "assign_steps": {
270
+ * "First Step Daniel": [
271
+ * 10010729
272
+ * ],
273
+ * "call me": [
274
+ * 10010728,
275
+ * 10010729
276
+ * ]
277
+ * }
278
+ * }
279
+ * }
280
+ */
281
+ export interface TriggerWorkflowAction {
282
+ id?: AutomationActionId;
283
+ name?: string;
284
+ type?: string;
285
+ config?: TriggerWorkflowConfig;
286
+ outputs?: {
287
+ workflow?: {
288
+ [name: string]: any;
289
+ };
290
+ };
291
+ }
292
+ export interface TriggerWorkflowConfig {
293
+ target_workflow?: string;
294
+ add_context?: string[];
295
+ assign_steps?: {
296
+ [name: string]: any;
297
+ };
298
+ }
211
299
  }
212
300
  }
213
301
  declare namespace Paths {
@@ -285,7 +373,7 @@ declare namespace Paths {
285
373
  }
286
374
  export type RequestBody = Components.Schemas.AutomationFlow;
287
375
  namespace Responses {
288
- export type $201 = Components.Schemas.AutomationFlow;
376
+ export type $200 = Components.Schemas.AutomationFlow;
289
377
  }
290
378
  }
291
379
  namespace SearchFlows {
@@ -315,10 +403,7 @@ declare namespace Paths {
315
403
  }
316
404
  }
317
405
  namespace StartExecution {
318
- export interface RequestBody {
319
- entity_id?: Components.Schemas.EntityId;
320
- flow_id?: Components.Schemas.AutomationFlowId;
321
- }
406
+ export type RequestBody = Components.Schemas.StartExecutionRequest;
322
407
  namespace Responses {
323
408
  export type $201 = Components.Schemas.AutomationExecution;
324
409
  }
@@ -365,7 +450,7 @@ export interface OperationMethods {
365
450
  parameters?: Parameters<Paths.PutFlow.PathParameters> | null,
366
451
  data?: Paths.PutFlow.RequestBody,
367
452
  config?: AxiosRequestConfig
368
- ): OperationResponse<Paths.PutFlow.Responses.$201>
453
+ ): OperationResponse<Paths.PutFlow.Responses.$200>
369
454
  /**
370
455
  * deleteFlow - deleteFlow
371
456
  *
@@ -461,7 +546,7 @@ export interface PathsDictionary {
461
546
  parameters?: Parameters<Paths.PutFlow.PathParameters> | null,
462
547
  data?: Paths.PutFlow.RequestBody,
463
548
  config?: AxiosRequestConfig
464
- ): OperationResponse<Paths.PutFlow.Responses.$201>
549
+ ): OperationResponse<Paths.PutFlow.Responses.$200>
465
550
  /**
466
551
  * deleteFlow - deleteFlow
467
552
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/automation-client",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "API Client for epilot automation API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",