@oursprivacy/platform-sdk 1.20.0 → 1.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.
Files changed (179) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/api-promise.d.mts +1 -0
  3. package/api-promise.d.mts.map +1 -1
  4. package/api-promise.d.ts +1 -0
  5. package/api-promise.d.ts.map +1 -1
  6. package/api-promise.mjs +1 -0
  7. package/api-promise.mjs.map +1 -1
  8. package/client.d.mts +7 -7
  9. package/client.d.mts.map +1 -1
  10. package/client.d.ts +7 -7
  11. package/client.d.ts.map +1 -1
  12. package/client.js +3 -3
  13. package/client.js.map +1 -1
  14. package/client.mjs +3 -3
  15. package/client.mjs.map +1 -1
  16. package/core/api-promise.d.mts.map +1 -1
  17. package/core/api-promise.d.ts.map +1 -1
  18. package/core/api-promise.mjs.map +1 -1
  19. package/core/error.mjs.map +1 -1
  20. package/core/pagination.d.mts.map +1 -1
  21. package/core/pagination.d.ts.map +1 -1
  22. package/core/pagination.mjs.map +1 -1
  23. package/core/resource.d.mts.map +1 -1
  24. package/core/resource.d.ts.map +1 -1
  25. package/core/uploads.d.mts.map +1 -1
  26. package/core/uploads.d.ts.map +1 -1
  27. package/core/uploads.mjs.map +1 -1
  28. package/error.d.mts +1 -0
  29. package/error.d.mts.map +1 -1
  30. package/error.d.ts +1 -0
  31. package/error.d.ts.map +1 -1
  32. package/error.mjs +1 -0
  33. package/error.mjs.map +1 -1
  34. package/index.d.mts.map +1 -1
  35. package/index.d.ts.map +1 -1
  36. package/index.mjs.map +1 -1
  37. package/internal/detect-platform.mjs.map +1 -1
  38. package/internal/headers.mjs.map +1 -1
  39. package/internal/parse.d.mts.map +1 -1
  40. package/internal/parse.d.ts.map +1 -1
  41. package/internal/parse.mjs.map +1 -1
  42. package/internal/request-options.d.mts.map +1 -1
  43. package/internal/request-options.d.ts.map +1 -1
  44. package/internal/shims.d.mts +6 -0
  45. package/internal/shims.d.mts.map +1 -1
  46. package/internal/shims.d.ts +6 -0
  47. package/internal/shims.d.ts.map +1 -1
  48. package/internal/to-file.d.mts.map +1 -1
  49. package/internal/to-file.d.ts.map +1 -1
  50. package/internal/to-file.mjs.map +1 -1
  51. package/internal/types.d.mts +4 -4
  52. package/internal/types.d.mts.map +1 -1
  53. package/internal/types.d.ts +4 -4
  54. package/internal/types.d.ts.map +1 -1
  55. package/internal/uploads.d.mts.map +1 -1
  56. package/internal/uploads.d.ts.map +1 -1
  57. package/internal/uploads.mjs.map +1 -1
  58. package/internal/utils/base64.mjs.map +1 -1
  59. package/internal/utils/log.d.mts.map +1 -1
  60. package/internal/utils/log.d.ts.map +1 -1
  61. package/internal/utils/log.mjs.map +1 -1
  62. package/internal/utils/path.mjs.map +1 -1
  63. package/internal/utils/query.mjs.map +1 -1
  64. package/internal/utils/values.mjs.map +1 -1
  65. package/internal/utils.d.mts.map +1 -1
  66. package/internal/utils.d.ts.map +1 -1
  67. package/internal/utils.mjs.map +1 -1
  68. package/package.json +1 -1
  69. package/pagination.d.mts +1 -0
  70. package/pagination.d.mts.map +1 -1
  71. package/pagination.d.ts +1 -0
  72. package/pagination.d.ts.map +1 -1
  73. package/pagination.mjs +1 -0
  74. package/pagination.mjs.map +1 -1
  75. package/resource.d.mts +1 -0
  76. package/resource.d.mts.map +1 -1
  77. package/resource.d.ts +1 -0
  78. package/resource.d.ts.map +1 -1
  79. package/resource.mjs +1 -0
  80. package/resource.mjs.map +1 -1
  81. package/resources/allowed-events.d.mts.map +1 -1
  82. package/resources/allowed-events.d.ts.map +1 -1
  83. package/resources/allowed-events.mjs.map +1 -1
  84. package/resources/consent-settings.d.mts.map +1 -1
  85. package/resources/consent-settings.d.ts.map +1 -1
  86. package/resources/consent-settings.mjs.map +1 -1
  87. package/resources/default-mappings.d.mts +140 -0
  88. package/resources/default-mappings.d.mts.map +1 -0
  89. package/resources/default-mappings.d.ts +140 -0
  90. package/resources/default-mappings.d.ts.map +1 -0
  91. package/resources/default-mappings.js +38 -0
  92. package/resources/default-mappings.js.map +1 -0
  93. package/resources/default-mappings.mjs +34 -0
  94. package/resources/default-mappings.mjs.map +1 -0
  95. package/resources/destinations.d.mts +78 -5
  96. package/resources/destinations.d.mts.map +1 -1
  97. package/resources/destinations.d.ts +78 -5
  98. package/resources/destinations.d.ts.map +1 -1
  99. package/resources/destinations.js +11 -0
  100. package/resources/destinations.js.map +1 -1
  101. package/resources/destinations.mjs +11 -0
  102. package/resources/destinations.mjs.map +1 -1
  103. package/resources/experiment-settings.d.mts.map +1 -1
  104. package/resources/experiment-settings.d.ts.map +1 -1
  105. package/resources/experiment-settings.mjs.map +1 -1
  106. package/resources/experiment-variants.d.mts.map +1 -1
  107. package/resources/experiment-variants.d.ts.map +1 -1
  108. package/resources/experiment-variants.mjs.map +1 -1
  109. package/resources/experiments.d.mts.map +1 -1
  110. package/resources/experiments.d.ts.map +1 -1
  111. package/resources/experiments.mjs.map +1 -1
  112. package/resources/global-dispatch-centers.d.mts.map +1 -1
  113. package/resources/global-dispatch-centers.d.ts.map +1 -1
  114. package/resources/global-dispatch-centers.mjs.map +1 -1
  115. package/resources/heatmap-pages.d.mts.map +1 -1
  116. package/resources/heatmap-pages.d.ts.map +1 -1
  117. package/resources/heatmap-pages.mjs.map +1 -1
  118. package/resources/index.d.mts +3 -3
  119. package/resources/index.d.mts.map +1 -1
  120. package/resources/index.d.ts +3 -3
  121. package/resources/index.d.ts.map +1 -1
  122. package/resources/index.js +3 -3
  123. package/resources/index.js.map +1 -1
  124. package/resources/index.mjs +1 -1
  125. package/resources/index.mjs.map +1 -1
  126. package/resources/locations.d.mts.map +1 -1
  127. package/resources/locations.d.ts.map +1 -1
  128. package/resources/locations.mjs.map +1 -1
  129. package/resources/mappings.d.mts +373 -6
  130. package/resources/mappings.d.mts.map +1 -1
  131. package/resources/mappings.d.ts +373 -6
  132. package/resources/mappings.d.ts.map +1 -1
  133. package/resources/mappings.js +67 -3
  134. package/resources/mappings.js.map +1 -1
  135. package/resources/mappings.mjs +67 -3
  136. package/resources/mappings.mjs.map +1 -1
  137. package/resources/replay-settings.d.mts.map +1 -1
  138. package/resources/replay-settings.d.ts.map +1 -1
  139. package/resources/replay-settings.mjs.map +1 -1
  140. package/resources/sources.d.mts.map +1 -1
  141. package/resources/sources.d.ts.map +1 -1
  142. package/resources/sources.mjs.map +1 -1
  143. package/resources/versions.d.mts.map +1 -1
  144. package/resources/versions.d.ts.map +1 -1
  145. package/resources/versions.mjs.map +1 -1
  146. package/resources/web-scanner-rules.d.mts.map +1 -1
  147. package/resources/web-scanner-rules.d.ts.map +1 -1
  148. package/resources/web-scanner-rules.mjs.map +1 -1
  149. package/resources/web-scanners.d.mts.map +1 -1
  150. package/resources/web-scanners.d.ts.map +1 -1
  151. package/resources/web-scanners.mjs.map +1 -1
  152. package/resources.d.mts.map +1 -1
  153. package/resources.d.ts.map +1 -1
  154. package/resources.mjs.map +1 -1
  155. package/src/client.ts +29 -9
  156. package/src/resources/default-mappings.ts +332 -0
  157. package/src/resources/destinations.ts +189 -4
  158. package/src/resources/index.ts +14 -4
  159. package/src/resources/mappings.ts +663 -5
  160. package/src/version.ts +1 -1
  161. package/uploads.d.mts +1 -0
  162. package/uploads.d.mts.map +1 -1
  163. package/uploads.d.ts +1 -0
  164. package/uploads.d.ts.map +1 -1
  165. package/uploads.mjs +1 -0
  166. package/uploads.mjs.map +1 -1
  167. package/version.d.mts +1 -1
  168. package/version.d.ts +1 -1
  169. package/version.js +1 -1
  170. package/version.mjs +1 -1
  171. package/resources/destination-types.d.mts +0 -146
  172. package/resources/destination-types.d.mts.map +0 -1
  173. package/resources/destination-types.d.ts +0 -146
  174. package/resources/destination-types.d.ts.map +0 -1
  175. package/resources/destination-types.js +0 -28
  176. package/resources/destination-types.js.map +0 -1
  177. package/resources/destination-types.mjs +0 -24
  178. package/resources/destination-types.mjs.map +0 -1
  179. package/src/resources/destination-types.ts +0 -373
@@ -21,7 +21,19 @@ export class Mappings extends APIResource {
21
21
  }
22
22
 
23
23
  /**
24
- * Create a new mapping. Requires scope: mapping:create
24
+ * Create a mapping. Two body shapes are accepted:
25
+ *
26
+ * 1. Quick-create — `{ allowedEventId, destinationId }`. Binds an allowed event to
27
+ * a destination. Returns a slim entity with empty `mappings[]`; follow up with
28
+ * PATCH to populate fields.
29
+ * 2. Template fat-create —
30
+ * `{ entityId, templateId, mappings?, logic?, isEnabled?, name?, insertAfterIdx? }`.
31
+ * Lands a fully-shaped mapping in one round-trip. Use
32
+ * `GET /rest/v1/mapping-templates?entityId=...` to discover the valid
33
+ * `templateId` and `mappings[].property` values.
34
+ *
35
+ * Sending both `allowedEventId` and `templateId` returns 400. Requires scope:
36
+ * mapping:create
25
37
  */
26
38
  create(body: MappingCreateParams, options?: RequestOptions): APIPromise<MappingCreateResponse> {
27
39
  return this._client.post('/rest/v1/mappings', { body, ...options });
@@ -35,8 +47,10 @@ export class Mappings extends APIResource {
35
47
  }
36
48
 
37
49
  /**
38
- * Partially update a mapping. Only the fields you send are changed. Requires
39
- * scope: mapping:update
50
+ * Partially update a mapping. Only the fields you send are changed. Send
51
+ * `isEnabled: false` to pause the mapping without changing other fields (mirrors
52
+ * `status` on destinations). `mappings[]` is replaced wholesale when sent.
53
+ * Requires scope: mapping:update
40
54
  */
41
55
  update(id: string, body: MappingUpdateParams, options?: RequestOptions): APIPromise<MappingUpdateResponse> {
42
56
  return this._client.patch(path`/rest/v1/mappings/${id}`, { body, ...options });
@@ -48,6 +62,61 @@ export class Mappings extends APIResource {
48
62
  delete(id: string, options?: RequestOptions): APIPromise<MappingDeleteResponse> {
49
63
  return this._client.delete(path`/rest/v1/mappings/${id}`, options);
50
64
  }
65
+
66
+ /**
67
+ * Reassign `priority` for a set of mappings. Pass `{ uuids: [...] }` with the
68
+ * mapping ids in their new order — index 0 becomes the highest-priority mapping.
69
+ * All ids must belong to the same parent entity (source or destination); mixing
70
+ * entities returns 400. Requires scope: mapping:update
71
+ */
72
+ reorder(body: MappingReorderParams, options?: RequestOptions): APIPromise<MappingReorderResponse> {
73
+ return this._client.post('/rest/v1/mappings/reorder', { body, ...options });
74
+ }
75
+
76
+ /**
77
+ * Discover every mapping template available for a destination or source, with full
78
+ * property descriptors inlined. Use the returned `id` as `templateId` when calling
79
+ * `POST /rest/v1/mappings` (template fat-create variant), and use each entry under
80
+ * `mappings[]` to learn the valid `property`, `kind`, `modificationOptions`, and
81
+ * any enforced `options`. The `isDefault: true` entry is the destination's
82
+ * built-in default template (the one stored at `MAPPER#{destinationId}` when
83
+ * configured via `PUT /rest/v1/default-mappings/{destinationId}`). Requires scope:
84
+ * mapping:find
85
+ */
86
+ templates(query: MappingTemplatesParams, options?: RequestOptions): APIPromise<MappingTemplatesResponse> {
87
+ return this._client.get('/rest/v1/mappings/templates', { query, ...options });
88
+ }
89
+
90
+ /**
91
+ * Lists the platform-provided variables that any mapping `value` can reference
92
+ * (e.g. `event.email`, `event.request_context.ip`, `visitor.id`). Account-agnostic
93
+ * discovery — use these paths as the right-hand side of a mapping field. Requires
94
+ * scope: variables:find-default
95
+ */
96
+ defaultVariables(options?: RequestOptions): APIPromise<MappingDefaultVariablesResponse> {
97
+ return this._client.get('/rest/v1/mappings/default-variables', options);
98
+ }
99
+
100
+ /**
101
+ * Lists the custom variables observed in this account’s recent event stream (last
102
+ * 14 days). These are dot-paths under `event.event_properties.*` that callers can
103
+ * target in mapping `value` fields. The result is cached for 10 minutes; an empty
104
+ * list means no custom properties have been seen yet for this account. Requires
105
+ * scope: variables:find-custom
106
+ */
107
+ customVariables(options?: RequestOptions): APIPromise<MappingCustomVariablesResponse> {
108
+ return this._client.get('/rest/v1/mappings/custom-variables', options);
109
+ }
110
+
111
+ /**
112
+ * Lists every value accepted on a mapping field’s `modification` property, with a
113
+ * human-readable label and one-sentence description. Account-agnostic. Use this
114
+ * alongside `GET /rest/v1/mapping-templates` to render a labelled modification
115
+ * picker without hardcoding the enum. Requires scope: variables:find-default
116
+ */
117
+ modifications(options?: RequestOptions): APIPromise<MappingModificationsResponse> {
118
+ return this._client.get('/rest/v1/mappings/modifications', options);
119
+ }
51
120
  }
52
121
 
53
122
  export type MappingListResponsesCursor = Cursor<MappingListResponse>;
@@ -63,6 +132,15 @@ export interface MappingListResponse {
63
132
 
64
133
  isDefaultMapping?: boolean | null;
65
134
 
135
+ /**
136
+ * Condition tree gating when this mapping fires. A node is either a leaf
137
+ * `condition` or a combinator (`AND`, `OR`, `NOT`). Combinator children are
138
+ * themselves `MappingLogic` nodes, so trees nest arbitrarily. Example leaf:
139
+ * `{ "condition": { "property": "$event.event", "operator": "Is", "value": "page_view" } }`.
140
+ * Example combinator: `{ "AND": [{ "condition": ... }, { "OR": [...] }] }`.
141
+ */
142
+ logic?: unknown;
143
+
66
144
  name?: string | null;
67
145
 
68
146
  priority?: number | null;
@@ -127,6 +205,15 @@ export interface MappingCreateResponse {
127
205
 
128
206
  isDefaultMapping?: boolean | null;
129
207
 
208
+ /**
209
+ * Condition tree gating when this mapping fires. A node is either a leaf
210
+ * `condition` or a combinator (`AND`, `OR`, `NOT`). Combinator children are
211
+ * themselves `MappingLogic` nodes, so trees nest arbitrarily. Example leaf:
212
+ * `{ "condition": { "property": "$event.event", "operator": "Is", "value": "page_view" } }`.
213
+ * Example combinator: `{ "AND": [{ "condition": ... }, { "OR": [...] }] }`.
214
+ */
215
+ logic?: unknown;
216
+
130
217
  name?: string | null;
131
218
 
132
219
  priority?: number | null;
@@ -191,6 +278,15 @@ export interface MappingRetrieveResponse {
191
278
 
192
279
  isDefaultMapping?: boolean | null;
193
280
 
281
+ /**
282
+ * Condition tree gating when this mapping fires. A node is either a leaf
283
+ * `condition` or a combinator (`AND`, `OR`, `NOT`). Combinator children are
284
+ * themselves `MappingLogic` nodes, so trees nest arbitrarily. Example leaf:
285
+ * `{ "condition": { "property": "$event.event", "operator": "Is", "value": "page_view" } }`.
286
+ * Example combinator: `{ "AND": [{ "condition": ... }, { "OR": [...] }] }`.
287
+ */
288
+ logic?: unknown;
289
+
194
290
  name?: string | null;
195
291
 
196
292
  priority?: number | null;
@@ -255,6 +351,15 @@ export interface MappingUpdateResponse {
255
351
 
256
352
  isDefaultMapping?: boolean | null;
257
353
 
354
+ /**
355
+ * Condition tree gating when this mapping fires. A node is either a leaf
356
+ * `condition` or a combinator (`AND`, `OR`, `NOT`). Combinator children are
357
+ * themselves `MappingLogic` nodes, so trees nest arbitrarily. Example leaf:
358
+ * `{ "condition": { "property": "$event.event", "operator": "Is", "value": "page_view" } }`.
359
+ * Example combinator: `{ "AND": [{ "condition": ... }, { "OR": [...] }] }`.
360
+ */
361
+ logic?: unknown;
362
+
258
363
  name?: string | null;
259
364
 
260
365
  priority?: number | null;
@@ -310,6 +415,371 @@ export namespace MappingUpdateResponse {
310
415
 
311
416
  export type MappingDeleteResponse = boolean;
312
417
 
418
+ export interface MappingReorderResponse {
419
+ entities: Array<MappingReorderResponse.Entity>;
420
+ }
421
+
422
+ export namespace MappingReorderResponse {
423
+ export interface Entity {
424
+ id: string;
425
+
426
+ isEnabled: boolean;
427
+
428
+ mappings: Array<Entity.Mapping>;
429
+
430
+ destinationId?: string | null;
431
+
432
+ isDefaultMapping?: boolean | null;
433
+
434
+ /**
435
+ * Condition tree gating when this mapping fires. A node is either a leaf
436
+ * `condition` or a combinator (`AND`, `OR`, `NOT`). Combinator children are
437
+ * themselves `MappingLogic` nodes, so trees nest arbitrarily. Example leaf:
438
+ * `{ "condition": { "property": "$event.event", "operator": "Is", "value": "page_view" } }`.
439
+ * Example combinator: `{ "AND": [{ "condition": ... }, { "OR": [...] }] }`.
440
+ */
441
+ logic?: unknown;
442
+
443
+ name?: string | null;
444
+
445
+ priority?: number | null;
446
+
447
+ sourceId?: string | null;
448
+
449
+ templateId?: string | null;
450
+
451
+ templateName?: string | null;
452
+
453
+ updatedAt?: string | null;
454
+ }
455
+
456
+ export namespace Entity {
457
+ export interface Mapping {
458
+ map: string;
459
+
460
+ property: string;
461
+
462
+ modification?:
463
+ | 'CamelCase'
464
+ | 'DmaIP'
465
+ | 'DomainOnly'
466
+ | 'DomainPathOnly'
467
+ | 'DomainPathUTMs'
468
+ | 'DomainUTMs'
469
+ | 'FakeDomain'
470
+ | 'FakeDomainRealPath'
471
+ | 'FakeIP'
472
+ | 'FullUrl'
473
+ | 'Hash'
474
+ | 'HashMD5'
475
+ | 'HashedCountry'
476
+ | 'HashedDateOfBirth'
477
+ | 'HashedGender'
478
+ | 'HashedNormalized'
479
+ | 'HashedNormalizedNoSpecialChars'
480
+ | 'HashedPhone'
481
+ | 'HashedState'
482
+ | 'HashedZip'
483
+ | 'KebabCase'
484
+ | 'LowerCase'
485
+ | 'None'
486
+ | 'Null'
487
+ | 'Redacted'
488
+ | 'RegionalIP'
489
+ | 'SnakeCase'
490
+ | 'StartCase'
491
+ | 'UpperCase'
492
+ | null;
493
+ }
494
+ }
495
+ }
496
+
497
+ export interface MappingTemplatesResponse {
498
+ entities: Array<MappingTemplatesResponse.Entity>;
499
+ }
500
+
501
+ export namespace MappingTemplatesResponse {
502
+ export interface Entity {
503
+ /**
504
+ * Template identifier — pass to `POST /rest/v1/mappings` as `templateId`.
505
+ */
506
+ id: string;
507
+
508
+ /**
509
+ * True for the destination's built-in default template (the one stored at
510
+ * `MAPPER#{destinationId}` when configured). Sources only have one template; it is
511
+ * always default.
512
+ */
513
+ isDefault: boolean;
514
+
515
+ mappings: Array<Entity.Mapping>;
516
+
517
+ name: string;
518
+
519
+ description?: string | null;
520
+ }
521
+
522
+ export namespace Entity {
523
+ export interface Mapping {
524
+ /**
525
+ * Long-form description / tooltip for this property.
526
+ */
527
+ description: string | null;
528
+
529
+ isPII: boolean;
530
+
531
+ /**
532
+ * Type information for SDK validation (Text, Integer, Email, Url, IP, Object,
533
+ * KnownObject, Date, DateTime, Array, Boolean, JSON).
534
+ */
535
+ kind:
536
+ | 'Array'
537
+ | 'Boolean'
538
+ | 'Date'
539
+ | 'DateTime'
540
+ | 'Email'
541
+ | 'IP'
542
+ | 'Integer'
543
+ | 'JSON'
544
+ | 'KnownObject'
545
+ | 'Object'
546
+ | 'Text'
547
+ | 'Url';
548
+
549
+ /**
550
+ * Human-readable label (e.g. "Email", "Event Name").
551
+ */
552
+ label: string;
553
+
554
+ /**
555
+ * The template default source expression, e.g. `{{visitor.email}}`.
556
+ */
557
+ map: string;
558
+
559
+ /**
560
+ * The value to send as `mappings[].property` when creating or patching a mapping.
561
+ */
562
+ property: string;
563
+
564
+ required: boolean;
565
+
566
+ /**
567
+ * The template default modification (hashing / case / URL truncation).
568
+ */
569
+ modification?:
570
+ | 'CamelCase'
571
+ | 'DmaIP'
572
+ | 'DomainOnly'
573
+ | 'DomainPathOnly'
574
+ | 'DomainPathUTMs'
575
+ | 'DomainUTMs'
576
+ | 'FakeDomain'
577
+ | 'FakeDomainRealPath'
578
+ | 'FakeIP'
579
+ | 'FullUrl'
580
+ | 'Hash'
581
+ | 'HashMD5'
582
+ | 'HashedCountry'
583
+ | 'HashedDateOfBirth'
584
+ | 'HashedGender'
585
+ | 'HashedNormalized'
586
+ | 'HashedNormalizedNoSpecialChars'
587
+ | 'HashedPhone'
588
+ | 'HashedState'
589
+ | 'HashedZip'
590
+ | 'KebabCase'
591
+ | 'LowerCase'
592
+ | 'None'
593
+ | 'Null'
594
+ | 'Redacted'
595
+ | 'RegionalIP'
596
+ | 'SnakeCase'
597
+ | 'StartCase'
598
+ | 'UpperCase'
599
+ | null;
600
+
601
+ /**
602
+ * Suggested modification options for this property. Not a whitelist.
603
+ */
604
+ modificationOptions?: Array<
605
+ | 'CamelCase'
606
+ | 'DmaIP'
607
+ | 'DomainOnly'
608
+ | 'DomainPathOnly'
609
+ | 'DomainPathUTMs'
610
+ | 'DomainUTMs'
611
+ | 'FakeDomain'
612
+ | 'FakeDomainRealPath'
613
+ | 'FakeIP'
614
+ | 'FullUrl'
615
+ | 'Hash'
616
+ | 'HashMD5'
617
+ | 'HashedCountry'
618
+ | 'HashedDateOfBirth'
619
+ | 'HashedGender'
620
+ | 'HashedNormalized'
621
+ | 'HashedNormalizedNoSpecialChars'
622
+ | 'HashedPhone'
623
+ | 'HashedState'
624
+ | 'HashedZip'
625
+ | 'KebabCase'
626
+ | 'LowerCase'
627
+ | 'None'
628
+ | 'Null'
629
+ | 'Redacted'
630
+ | 'RegionalIP'
631
+ | 'SnakeCase'
632
+ | 'StartCase'
633
+ | 'UpperCase'
634
+ > | null;
635
+
636
+ /**
637
+ * When set, the ONLY valid `map` values for this property. Typically used for
638
+ * enum-shaped destinations.
639
+ */
640
+ options?: Array<Mapping.Option> | null;
641
+
642
+ /**
643
+ * Non-binding suggestions for the `map` value (e.g. common event names a customer
644
+ * might want to use).
645
+ */
646
+ suggestedOptions?: Array<Mapping.SuggestedOption> | null;
647
+ }
648
+
649
+ export namespace Mapping {
650
+ export interface Option {
651
+ label: string;
652
+
653
+ value: string;
654
+ }
655
+
656
+ export interface SuggestedOption {
657
+ label: string;
658
+
659
+ value: string;
660
+ }
661
+ }
662
+ }
663
+ }
664
+
665
+ export interface MappingDefaultVariablesResponse {
666
+ entities: Array<MappingDefaultVariablesResponse.Entity>;
667
+ }
668
+
669
+ export namespace MappingDefaultVariablesResponse {
670
+ export interface Entity {
671
+ /**
672
+ * Sample values observed for this path (empty for unsampled defaults).
673
+ */
674
+ examples: Array<string>;
675
+
676
+ /**
677
+ * Human-readable display name.
678
+ */
679
+ name: string;
680
+
681
+ /**
682
+ * Dot-path used in mapping `value` fields (e.g. `event.email`).
683
+ */
684
+ path: string;
685
+
686
+ /**
687
+ * Relative popularity rank. Higher means more frequently set across events.
688
+ */
689
+ popularity: number;
690
+
691
+ /**
692
+ * Optional long-form context shown in the variable dictionary drawer.
693
+ */
694
+ advancedInfo?: string | null;
695
+ }
696
+ }
697
+
698
+ export interface MappingCustomVariablesResponse {
699
+ entities: Array<MappingCustomVariablesResponse.Entity>;
700
+ }
701
+
702
+ export namespace MappingCustomVariablesResponse {
703
+ export interface Entity {
704
+ /**
705
+ * Sample values observed for this path (empty for unsampled defaults).
706
+ */
707
+ examples: Array<string>;
708
+
709
+ /**
710
+ * Human-readable display name.
711
+ */
712
+ name: string;
713
+
714
+ /**
715
+ * Dot-path used in mapping `value` fields (e.g. `event.email`).
716
+ */
717
+ path: string;
718
+
719
+ /**
720
+ * Relative popularity rank. Higher means more frequently set across events.
721
+ */
722
+ popularity: number;
723
+
724
+ /**
725
+ * Optional long-form context shown in the variable dictionary drawer.
726
+ */
727
+ advancedInfo?: string | null;
728
+ }
729
+ }
730
+
731
+ export interface MappingModificationsResponse {
732
+ entities: Array<MappingModificationsResponse.Entity>;
733
+ }
734
+
735
+ export namespace MappingModificationsResponse {
736
+ export interface Entity {
737
+ /**
738
+ * One-sentence explanation of what the modification does to the mapped value.
739
+ */
740
+ description: string;
741
+
742
+ /**
743
+ * Short human-readable name (suitable for picker labels).
744
+ */
745
+ label: string;
746
+
747
+ /**
748
+ * Enum value to send on `modification` fields when authoring a mapping.
749
+ */
750
+ value:
751
+ | 'CamelCase'
752
+ | 'DmaIP'
753
+ | 'DomainOnly'
754
+ | 'DomainPathOnly'
755
+ | 'DomainPathUTMs'
756
+ | 'DomainUTMs'
757
+ | 'FakeDomain'
758
+ | 'FakeDomainRealPath'
759
+ | 'FakeIP'
760
+ | 'FullUrl'
761
+ | 'Hash'
762
+ | 'HashMD5'
763
+ | 'HashedCountry'
764
+ | 'HashedDateOfBirth'
765
+ | 'HashedGender'
766
+ | 'HashedNormalized'
767
+ | 'HashedNormalizedNoSpecialChars'
768
+ | 'HashedPhone'
769
+ | 'HashedState'
770
+ | 'HashedZip'
771
+ | 'KebabCase'
772
+ | 'LowerCase'
773
+ | 'None'
774
+ | 'Null'
775
+ | 'Redacted'
776
+ | 'RegionalIP'
777
+ | 'SnakeCase'
778
+ | 'StartCase'
779
+ | 'UpperCase';
780
+ }
781
+ }
782
+
313
783
  export interface MappingListParams extends CursorParams {
314
784
  /**
315
785
  * Filter mappings by their parent entity id. Must be a destination id or source
@@ -319,12 +789,178 @@ export interface MappingListParams extends CursorParams {
319
789
  }
320
790
 
321
791
  export interface MappingCreateParams {
322
- allowedEventId: string;
792
+ /**
793
+ * Quick-create variant: allowed event to bind the new mapping to. Required
794
+ * together with `destinationId`. Mutually exclusive with `templateId`/`entityId`.
795
+ */
796
+ allowedEventId?: string;
797
+
798
+ /**
799
+ * Quick-create variant: destination that should receive events matched by this
800
+ * mapping. Required together with `allowedEventId`.
801
+ */
802
+ destinationId?: string;
803
+
804
+ /**
805
+ * Template fat-create variant: destination or source id this mapping belongs to.
806
+ * Required together with `templateId`.
807
+ */
808
+ entityId?: string;
809
+
810
+ /**
811
+ * Template fat-create only. Zero-based position in the destination/source priority
812
+ * order to insert this mapping after. Omit to append at the end.
813
+ */
814
+ insertAfterIdx?: number;
815
+
816
+ /**
817
+ * Template fat-create only. Initial enabled state. Defaults to `true`.
818
+ */
819
+ isEnabled?: boolean;
820
+
821
+ /**
822
+ * Condition tree gating when this mapping fires. A node is either a leaf
823
+ * `condition` or a combinator (`AND`, `OR`, `NOT`). Combinator children are
824
+ * themselves `MappingLogic` nodes, so trees nest arbitrarily. Example leaf:
825
+ * `{ "condition": { "property": "$event.event", "operator": "Is", "value": "page_view" } }`.
826
+ * Example combinator: `{ "AND": [{ "condition": ... }, { "OR": [...] }] }`.
827
+ */
828
+ logic?: MappingCreateParams.Logic;
829
+
830
+ /**
831
+ * Template fat-create only. Optional initial property mappings. When omitted the
832
+ * mapping is seeded with template defaults for sources and non-default destination
833
+ * templates, and with `[]` for default destination templates.
834
+ */
835
+ mappings?: Array<MappingCreateParams.Mapping>;
836
+
837
+ /**
838
+ * Template fat-create only. Override the auto-generated mapping name.
839
+ */
840
+ name?: string | null;
323
841
 
324
- destinationId: string;
842
+ /**
843
+ * Template fat-create variant: template id from `GET /rest/v1/mapping-templates`.
844
+ * Picks the property descriptor set used to validate `mappings[].property`.
845
+ * Required together with `entityId`.
846
+ */
847
+ templateId?: string;
848
+ }
849
+
850
+ export namespace MappingCreateParams {
851
+ /**
852
+ * Condition tree gating when this mapping fires. A node is either a leaf
853
+ * `condition` or a combinator (`AND`, `OR`, `NOT`). Combinator children are
854
+ * themselves `MappingLogic` nodes, so trees nest arbitrarily. Example leaf:
855
+ * `{ "condition": { "property": "$event.event", "operator": "Is", "value": "page_view" } }`.
856
+ * Example combinator: `{ "AND": [{ "condition": ... }, { "OR": [...] }] }`.
857
+ */
858
+ export interface Logic {
859
+ /**
860
+ * All child nodes must match. Each child is a `MappingLogic` node.
861
+ */
862
+ AND?: Array<unknown> | null;
863
+
864
+ condition?: Logic.Condition;
865
+
866
+ /**
867
+ * Negates a single child `MappingLogic` node.
868
+ */
869
+ NOT?: unknown;
870
+
871
+ /**
872
+ * Any child node must match. Each child is a `MappingLogic` node.
873
+ */
874
+ OR?: Array<unknown> | null;
875
+ }
876
+
877
+ export namespace Logic {
878
+ export interface Condition {
879
+ operator:
880
+ | 'Is'
881
+ | 'IsNot'
882
+ | 'Contains'
883
+ | 'DoesNotContain'
884
+ | 'StartsWith'
885
+ | 'EndsWith'
886
+ | 'IsFalsy'
887
+ | 'IsTruthy'
888
+ | 'IsNull'
889
+ | 'IsNotNull'
890
+ | 'IsUndefined'
891
+ | 'IsNotUndefined'
892
+ | 'IsGreaterThan'
893
+ | 'IsGreaterThanOrEqual'
894
+ | 'IsLessThan'
895
+ | 'IsLessThanOrEqual'
896
+ | 'IsIn'
897
+ | 'IsNotIn'
898
+ | 'IsFoundIn'
899
+ | 'IsNotFoundIn'
900
+ | 'IsTrue'
901
+ | 'IsFalse'
902
+ | 'IsBefore'
903
+ | 'IsAfter'
904
+ | 'IsBetween'
905
+ | 'IsOnOrBefore'
906
+ | 'IsOnOrAfter'
907
+ | 'MatchesRegex'
908
+ | 'MatchesRegexIgnoreCase'
909
+ | 'DoesNotMatchRegex'
910
+ | 'DoesNotMatchRegexIgnoreCase';
911
+
912
+ property: string;
913
+
914
+ value: string;
915
+ }
916
+ }
917
+
918
+ export interface Mapping {
919
+ map: string;
920
+
921
+ property: string;
922
+
923
+ modification?:
924
+ | 'CamelCase'
925
+ | 'DmaIP'
926
+ | 'DomainOnly'
927
+ | 'DomainPathOnly'
928
+ | 'DomainPathUTMs'
929
+ | 'DomainUTMs'
930
+ | 'FakeDomain'
931
+ | 'FakeDomainRealPath'
932
+ | 'FakeIP'
933
+ | 'FullUrl'
934
+ | 'Hash'
935
+ | 'HashMD5'
936
+ | 'HashedCountry'
937
+ | 'HashedDateOfBirth'
938
+ | 'HashedGender'
939
+ | 'HashedNormalized'
940
+ | 'HashedNormalizedNoSpecialChars'
941
+ | 'HashedPhone'
942
+ | 'HashedState'
943
+ | 'HashedZip'
944
+ | 'KebabCase'
945
+ | 'LowerCase'
946
+ | 'None'
947
+ | 'Null'
948
+ | 'Redacted'
949
+ | 'RegionalIP'
950
+ | 'SnakeCase'
951
+ | 'StartCase'
952
+ | 'UpperCase'
953
+ | null;
954
+ }
325
955
  }
326
956
 
327
957
  export interface MappingUpdateParams {
958
+ /**
959
+ * Flip the mapping on/off without changing other fields. `null` is treated as
960
+ * omitted.
961
+ */
962
+ isEnabled?: boolean | null;
963
+
328
964
  /**
329
965
  * Condition tree gating when this mapping fires. A node is either a leaf
330
966
  * `condition` or a combinator (`AND`, `OR`, `NOT`). Combinator children are
@@ -446,6 +1082,21 @@ export namespace MappingUpdateParams {
446
1082
  }
447
1083
  }
448
1084
 
1085
+ export interface MappingReorderParams {
1086
+ /**
1087
+ * Mapping ids in their new priority order, low priority index first. All ids must
1088
+ * belong to the same parent entity (source or destination).
1089
+ */
1090
+ uuids: Array<string>;
1091
+ }
1092
+
1093
+ export interface MappingTemplatesParams {
1094
+ /**
1095
+ * Destination or source id. Required.
1096
+ */
1097
+ entityId: string;
1098
+ }
1099
+
449
1100
  export declare namespace Mappings {
450
1101
  export {
451
1102
  type MappingListResponse as MappingListResponse,
@@ -453,9 +1104,16 @@ export declare namespace Mappings {
453
1104
  type MappingRetrieveResponse as MappingRetrieveResponse,
454
1105
  type MappingUpdateResponse as MappingUpdateResponse,
455
1106
  type MappingDeleteResponse as MappingDeleteResponse,
1107
+ type MappingReorderResponse as MappingReorderResponse,
1108
+ type MappingTemplatesResponse as MappingTemplatesResponse,
1109
+ type MappingDefaultVariablesResponse as MappingDefaultVariablesResponse,
1110
+ type MappingCustomVariablesResponse as MappingCustomVariablesResponse,
1111
+ type MappingModificationsResponse as MappingModificationsResponse,
456
1112
  type MappingListResponsesCursor as MappingListResponsesCursor,
457
1113
  type MappingListParams as MappingListParams,
458
1114
  type MappingCreateParams as MappingCreateParams,
459
1115
  type MappingUpdateParams as MappingUpdateParams,
1116
+ type MappingReorderParams as MappingReorderParams,
1117
+ type MappingTemplatesParams as MappingTemplatesParams,
460
1118
  };
461
1119
  }