@epilot/entity-mapping-client 0.0.1-alpha.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.
@@ -0,0 +1,576 @@
1
+ /* eslint-disable */
2
+ import type {
3
+ OpenAPIClient,
4
+ Parameters,
5
+ UnknownParamsObject,
6
+ OperationResponse,
7
+ AxiosRequestConfig,
8
+ } from 'openapi-client-axios';
9
+
10
+ declare namespace Components {
11
+ namespace Schemas {
12
+ export interface AppendValueMapper {
13
+ mode: /**
14
+ * - copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property.
15
+ *
16
+ */
17
+ MappingAttributeMode;
18
+ /**
19
+ * JSON like target path for the attribute. Eg. last_name
20
+ */
21
+ target: string;
22
+ /**
23
+ * JSON source path for the value to be extracted from the main entity. Eg: steps[1].['Product Info'].price
24
+ *
25
+ */
26
+ source?: string;
27
+ /**
28
+ * To be provided only when mapping json objects into a target attribute. Eg array of addresses.
29
+ *
30
+ */
31
+ value_json: string;
32
+ /**
33
+ * Array of keys which should be used when checking for uniqueness. Eg: [country, city, postal_code]
34
+ *
35
+ */
36
+ target_unique?: string[];
37
+ }
38
+ export interface ConditionNode {
39
+ source?: string;
40
+ value?: string | number | {
41
+ [key: string]: any;
42
+ } | {
43
+ [key: string]: any;
44
+ }[];
45
+ }
46
+ export interface CopyValueMapper {
47
+ mode: /**
48
+ * - copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property.
49
+ *
50
+ */
51
+ MappingAttributeMode;
52
+ /**
53
+ * JSON like target path for the attribute. Eg. last_name
54
+ */
55
+ target: string;
56
+ /**
57
+ * JSON source path for the value to be extracted from the main entity. Eg: steps[1].['Product Info'].price
58
+ *
59
+ */
60
+ source: string;
61
+ }
62
+ export interface Entity {
63
+ [name: string]: any;
64
+ _id?: string;
65
+ _schema?: string;
66
+ }
67
+ export interface EntityRef {
68
+ /**
69
+ * id of the source entity to be mapped
70
+ */
71
+ entity_id: string;
72
+ /**
73
+ * schema of the source entity
74
+ * example:
75
+ * submission
76
+ */
77
+ entity_schema?: string;
78
+ }
79
+ /**
80
+ * Pass either source or source_entity
81
+ */
82
+ export interface ExecuteMappingReq {
83
+ source?: EntityRef;
84
+ source_entity?: Entity;
85
+ }
86
+ export interface ExecuteMappingResp {
87
+ mapped_entities?: Entity[];
88
+ }
89
+ export interface JourneyRef {
90
+ journey_id?: string;
91
+ }
92
+ export interface MapCondition {
93
+ _exists?: ConditionNode;
94
+ _equals?: ConditionNode;
95
+ _not_exists?: ConditionNode;
96
+ _any_of?: ConditionNode;
97
+ }
98
+ export type MappingAttribute = SetValueMapper | CopyValueMapper | AppendValueMapper;
99
+ /**
100
+ * - copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property.
101
+ *
102
+ */
103
+ export type MappingAttributeMode = "copy_if_exists" | "append_if_exists" | "set_value";
104
+ /**
105
+ * example:
106
+ * {
107
+ * "target": "_tags",
108
+ * "operation": {
109
+ * "_append": [
110
+ * "new",
111
+ * "tags"
112
+ * ],
113
+ * "_uniq": true
114
+ * }
115
+ * }
116
+ */
117
+ export interface MappingAttributeV2 {
118
+ /**
119
+ * Target JSON path for the attribute to set
120
+ */
121
+ target?: string;
122
+ operation: /* Mapping operation nodes are either primitive values or operation node objects */ OperationNode;
123
+ }
124
+ export interface MappingConfig {
125
+ id: string;
126
+ org_id: string;
127
+ version: number;
128
+ source: SourceConfig;
129
+ targets: TargetConfig[];
130
+ created_at?: string; // date-time
131
+ updated_at?: string; // date-time
132
+ /**
133
+ * User / service who created the entity mapping config
134
+ * example:
135
+ * {
136
+ * "type": "internal_service"
137
+ * }
138
+ */
139
+ created_by?: Owner;
140
+ /**
141
+ * User / service who last updated entity mapping config
142
+ * example:
143
+ * {
144
+ * "type": "user",
145
+ * "org_id": 255151,
146
+ * "user_id": 99252
147
+ * }
148
+ */
149
+ last_updated_by?: Owner;
150
+ }
151
+ export type MappingConfigs = MappingConfig[];
152
+ export interface MappingConfigsResp {
153
+ configs: MappingConfigs;
154
+ }
155
+ /**
156
+ * Mapping operation nodes are either primitive values or operation node objects
157
+ */
158
+ export type OperationNode = /* Mapping operation nodes are either primitive values or operation node objects */ OperationObjectNode | /* Represents any primitive JSON value */ PrimitiveJSONValue;
159
+ export interface OperationObjectNode {
160
+ [name: string]: any;
161
+ _set?: /* Represents any primitive JSON value */ PrimitiveJSONValue;
162
+ /**
163
+ * Append to array
164
+ */
165
+ _append?: any;
166
+ /**
167
+ * Unique array
168
+ */
169
+ _uniq?: /* Unique array */ boolean | string[];
170
+ /**
171
+ * Copy JSONPath value from source entity context
172
+ * example:
173
+ * contact.first_name
174
+ */
175
+ _copy?: string;
176
+ }
177
+ export interface Owner {
178
+ type: "user" | "internal_service";
179
+ org_id?: string;
180
+ user_id?: string;
181
+ }
182
+ /**
183
+ * Represents any primitive JSON value
184
+ */
185
+ export type PrimitiveJSONValue = /* Represents any primitive JSON value */ string | boolean | number | {
186
+ [name: string]: any;
187
+ } | any[];
188
+ export interface RelationAttribute {
189
+ /**
190
+ * Target attribute to store the relation in
191
+ */
192
+ target: string;
193
+ /**
194
+ * Relation tags (labels) to set for the stored relations
195
+ */
196
+ target_tags?: string[];
197
+ /**
198
+ * Include all relation tags (labels) present on the main entity relation
199
+ */
200
+ target_tags_include_source?: boolean;
201
+ /**
202
+ * A filter to identify which source entities to pick as relations from main entity
203
+ */
204
+ source_filter?: {
205
+ /**
206
+ * Limit relations to maximum number (default, all matched relations)
207
+ */
208
+ limit?: number;
209
+ /**
210
+ * Filter by specific schema
211
+ */
212
+ schema?: string;
213
+ /**
214
+ * Filter by a specific relation attribute on the main entity
215
+ */
216
+ attribute?: string;
217
+ /**
218
+ * Filter by relation tag (label) on the main entity
219
+ */
220
+ relation_tag?: string;
221
+ /**
222
+ * Filter by a specific tag on the related entity
223
+ */
224
+ tag?: string;
225
+ /**
226
+ * Picks main entity as relation (overrides other filters)
227
+ */
228
+ self?: boolean;
229
+ };
230
+ related_to?: {
231
+ [name: string]: any;
232
+ };
233
+ mode: "append" | "prepend" | "set";
234
+ }
235
+ export interface SearchMappingReq {
236
+ source?: SourceConfig;
237
+ }
238
+ export interface SetValueMapper {
239
+ mode: /**
240
+ * - copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property.
241
+ *
242
+ */
243
+ MappingAttributeMode;
244
+ /**
245
+ * JSON like target path for the attribute. Eg. last_name
246
+ */
247
+ target: string;
248
+ /**
249
+ * Any value to be set: string, number, string[], number[], JSON object, etc. It will override existing values, if any.
250
+ *
251
+ */
252
+ value: any;
253
+ }
254
+ export interface SourceConfig {
255
+ type?: "journey" | "entity";
256
+ config?: JourneyRef | EntityRef;
257
+ }
258
+ export interface TargetConfig {
259
+ /**
260
+ * A name for this configuration
261
+ */
262
+ name?: string;
263
+ /**
264
+ * Schema of target entity
265
+ */
266
+ target_schema: string;
267
+ /**
268
+ * Unique key for target entity (see upsertEntity of Entity API)
269
+ */
270
+ target_unique?: string[];
271
+ /**
272
+ * Conditions necessary to hold for the target entity to be mapped
273
+ */
274
+ conditions?: MapCondition[];
275
+ /**
276
+ * Attribute mappings
277
+ */
278
+ mapping_attributes?: (/**
279
+ * example:
280
+ * {
281
+ * "target": "_tags",
282
+ * "operation": {
283
+ * "_append": [
284
+ * "new",
285
+ * "tags"
286
+ * ],
287
+ * "_uniq": true
288
+ * }
289
+ * }
290
+ */
291
+ MappingAttributeV2 | MappingAttribute)[];
292
+ /**
293
+ * Relation mappings
294
+ */
295
+ relation_attributes?: RelationAttribute[];
296
+ /**
297
+ * Relation attribute on the main entity where the target entity will be linked. Set to false to disable linkback
298
+ *
299
+ */
300
+ linkback_relation_attribute?: string;
301
+ /**
302
+ * Relation tags (labels) to include in main entity linkback relation attribute
303
+ */
304
+ linkback_relation_tags?: string[];
305
+ }
306
+ }
307
+ }
308
+ declare namespace Paths {
309
+ namespace DeleteConfig {
310
+ namespace Parameters {
311
+ /**
312
+ * example:
313
+ * uuidv4
314
+ */
315
+ export type Id = string;
316
+ }
317
+ export interface PathParameters {
318
+ id: /**
319
+ * example:
320
+ * uuidv4
321
+ */
322
+ Parameters.Id;
323
+ }
324
+ namespace Responses {
325
+ export type $200 = Components.Schemas.MappingConfig;
326
+ }
327
+ }
328
+ namespace ExecuteMapping {
329
+ namespace Parameters {
330
+ /**
331
+ * example:
332
+ * uuidv4
333
+ */
334
+ export type Id = string;
335
+ }
336
+ export interface PathParameters {
337
+ id: /**
338
+ * example:
339
+ * uuidv4
340
+ */
341
+ Parameters.Id;
342
+ }
343
+ export type RequestBody = /* Pass either source or source_entity */ Components.Schemas.ExecuteMappingReq;
344
+ namespace Responses {
345
+ export type $200 = Components.Schemas.ExecuteMappingResp;
346
+ }
347
+ }
348
+ namespace GetAllVersions {
349
+ namespace Parameters {
350
+ /**
351
+ * example:
352
+ * uuidv4
353
+ */
354
+ export type Id = string;
355
+ }
356
+ export interface PathParameters {
357
+ id: /**
358
+ * example:
359
+ * uuidv4
360
+ */
361
+ Parameters.Id;
362
+ }
363
+ namespace Responses {
364
+ export type $200 = Components.Schemas.MappingConfigsResp;
365
+ }
366
+ }
367
+ namespace GetConfig {
368
+ namespace Parameters {
369
+ /**
370
+ * example:
371
+ * uuidv4
372
+ */
373
+ export type Id = string;
374
+ }
375
+ export interface PathParameters {
376
+ id: /**
377
+ * example:
378
+ * uuidv4
379
+ */
380
+ Parameters.Id;
381
+ }
382
+ namespace Responses {
383
+ export type $200 = Components.Schemas.MappingConfig;
384
+ }
385
+ }
386
+ namespace SearchConfigs {
387
+ export type RequestBody = Components.Schemas.SearchMappingReq;
388
+ namespace Responses {
389
+ export type $200 = Components.Schemas.MappingConfig;
390
+ }
391
+ }
392
+ namespace StoreConfig {
393
+ export type RequestBody = Components.Schemas.MappingConfig;
394
+ namespace Responses {
395
+ export type $201 = Components.Schemas.MappingConfig;
396
+ }
397
+ }
398
+ namespace StoreNewVersion {
399
+ namespace Parameters {
400
+ /**
401
+ * example:
402
+ * uuidv4
403
+ */
404
+ export type Id = string;
405
+ }
406
+ export interface PathParameters {
407
+ id: /**
408
+ * example:
409
+ * uuidv4
410
+ */
411
+ Parameters.Id;
412
+ }
413
+ export type RequestBody = Components.Schemas.MappingConfig;
414
+ namespace Responses {
415
+ export type $200 = Components.Schemas.MappingConfig;
416
+ }
417
+ }
418
+ }
419
+
420
+ export interface OperationMethods {
421
+ /**
422
+ * storeConfig - storeConfig
423
+ *
424
+ * Store new MappingConfig
425
+ */
426
+ 'storeConfig'(
427
+ parameters?: Parameters<UnknownParamsObject> | null,
428
+ data?: Paths.StoreConfig.RequestBody,
429
+ config?: AxiosRequestConfig
430
+ ): OperationResponse<Paths.StoreConfig.Responses.$201>
431
+ /**
432
+ * getConfig - getConfig
433
+ *
434
+ * Get latest version of a mapping config by id
435
+ */
436
+ 'getConfig'(
437
+ parameters?: Parameters<Paths.GetConfig.PathParameters> | null,
438
+ data?: any,
439
+ config?: AxiosRequestConfig
440
+ ): OperationResponse<Paths.GetConfig.Responses.$200>
441
+ /**
442
+ * deleteConfig - deleteConfig
443
+ *
444
+ * Delete entity mapping config
445
+ */
446
+ 'deleteConfig'(
447
+ parameters?: Parameters<Paths.DeleteConfig.PathParameters> | null,
448
+ data?: any,
449
+ config?: AxiosRequestConfig
450
+ ): OperationResponse<Paths.DeleteConfig.Responses.$200>
451
+ /**
452
+ * getAllVersions - getAllVersions
453
+ *
454
+ * Get all version of MappingConfig
455
+ */
456
+ 'getAllVersions'(
457
+ parameters?: Parameters<Paths.GetAllVersions.PathParameters> | null,
458
+ data?: any,
459
+ config?: AxiosRequestConfig
460
+ ): OperationResponse<Paths.GetAllVersions.Responses.$200>
461
+ /**
462
+ * storeNewVersion - storeNewVersion
463
+ *
464
+ * Store new version of MappingConfig
465
+ */
466
+ 'storeNewVersion'(
467
+ parameters?: Parameters<Paths.StoreNewVersion.PathParameters> | null,
468
+ data?: Paths.StoreNewVersion.RequestBody,
469
+ config?: AxiosRequestConfig
470
+ ): OperationResponse<Paths.StoreNewVersion.Responses.$200>
471
+ /**
472
+ * executeMapping - executeMapping
473
+ *
474
+ * Execute entity mapping based on a config
475
+ */
476
+ 'executeMapping'(
477
+ parameters?: Parameters<Paths.ExecuteMapping.PathParameters> | null,
478
+ data?: Paths.ExecuteMapping.RequestBody,
479
+ config?: AxiosRequestConfig
480
+ ): OperationResponse<Paths.ExecuteMapping.Responses.$200>
481
+ /**
482
+ * searchConfigs - searchConfigs
483
+ *
484
+ * Search mapping configs
485
+ */
486
+ 'searchConfigs'(
487
+ parameters?: Parameters<UnknownParamsObject> | null,
488
+ data?: Paths.SearchConfigs.RequestBody,
489
+ config?: AxiosRequestConfig
490
+ ): OperationResponse<Paths.SearchConfigs.Responses.$200>
491
+ }
492
+
493
+ export interface PathsDictionary {
494
+ ['/v1/mappings']: {
495
+ /**
496
+ * storeConfig - storeConfig
497
+ *
498
+ * Store new MappingConfig
499
+ */
500
+ 'post'(
501
+ parameters?: Parameters<UnknownParamsObject> | null,
502
+ data?: Paths.StoreConfig.RequestBody,
503
+ config?: AxiosRequestConfig
504
+ ): OperationResponse<Paths.StoreConfig.Responses.$201>
505
+ }
506
+ ['/v1/mappings/{id}']: {
507
+ /**
508
+ * getConfig - getConfig
509
+ *
510
+ * Get latest version of a mapping config by id
511
+ */
512
+ 'get'(
513
+ parameters?: Parameters<Paths.GetConfig.PathParameters> | null,
514
+ data?: any,
515
+ config?: AxiosRequestConfig
516
+ ): OperationResponse<Paths.GetConfig.Responses.$200>
517
+ /**
518
+ * deleteConfig - deleteConfig
519
+ *
520
+ * Delete entity mapping config
521
+ */
522
+ 'delete'(
523
+ parameters?: Parameters<Paths.DeleteConfig.PathParameters> | null,
524
+ data?: any,
525
+ config?: AxiosRequestConfig
526
+ ): OperationResponse<Paths.DeleteConfig.Responses.$200>
527
+ }
528
+ ['/v1/mappings/{id}/versions']: {
529
+ /**
530
+ * getAllVersions - getAllVersions
531
+ *
532
+ * Get all version of MappingConfig
533
+ */
534
+ 'get'(
535
+ parameters?: Parameters<Paths.GetAllVersions.PathParameters> | null,
536
+ data?: any,
537
+ config?: AxiosRequestConfig
538
+ ): OperationResponse<Paths.GetAllVersions.Responses.$200>
539
+ /**
540
+ * storeNewVersion - storeNewVersion
541
+ *
542
+ * Store new version of MappingConfig
543
+ */
544
+ 'post'(
545
+ parameters?: Parameters<Paths.StoreNewVersion.PathParameters> | null,
546
+ data?: Paths.StoreNewVersion.RequestBody,
547
+ config?: AxiosRequestConfig
548
+ ): OperationResponse<Paths.StoreNewVersion.Responses.$200>
549
+ }
550
+ ['/v1/mappings/{id}:execute']: {
551
+ /**
552
+ * executeMapping - executeMapping
553
+ *
554
+ * Execute entity mapping based on a config
555
+ */
556
+ 'post'(
557
+ parameters?: Parameters<Paths.ExecuteMapping.PathParameters> | null,
558
+ data?: Paths.ExecuteMapping.RequestBody,
559
+ config?: AxiosRequestConfig
560
+ ): OperationResponse<Paths.ExecuteMapping.Responses.$200>
561
+ }
562
+ ['/v1/mappings:search']: {
563
+ /**
564
+ * searchConfigs - searchConfigs
565
+ *
566
+ * Search mapping configs
567
+ */
568
+ 'post'(
569
+ parameters?: Parameters<UnknownParamsObject> | null,
570
+ data?: Paths.SearchConfigs.RequestBody,
571
+ config?: AxiosRequestConfig
572
+ ): OperationResponse<Paths.SearchConfigs.Responses.$200>
573
+ }
574
+ }
575
+
576
+ export type Client = OpenAPIClient<OperationMethods, PathsDictionary>