@oursprivacy/platform-sdk 1.19.0 → 1.21.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 (205) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +8 -12
  3. package/api-promise.d.mts +1 -0
  4. package/api-promise.d.mts.map +1 -1
  5. package/api-promise.d.ts +1 -0
  6. package/api-promise.d.ts.map +1 -1
  7. package/api-promise.mjs +1 -0
  8. package/api-promise.mjs.map +1 -1
  9. package/client.d.mts +21 -6
  10. package/client.d.mts.map +1 -1
  11. package/client.d.ts +21 -6
  12. package/client.d.ts.map +1 -1
  13. package/client.js +17 -2
  14. package/client.js.map +1 -1
  15. package/client.mjs +17 -2
  16. package/client.mjs.map +1 -1
  17. package/core/api-promise.d.mts.map +1 -1
  18. package/core/api-promise.d.ts.map +1 -1
  19. package/core/api-promise.mjs.map +1 -1
  20. package/core/error.mjs.map +1 -1
  21. package/core/pagination.d.mts.map +1 -1
  22. package/core/pagination.d.ts.map +1 -1
  23. package/core/pagination.mjs.map +1 -1
  24. package/core/resource.d.mts.map +1 -1
  25. package/core/resource.d.ts.map +1 -1
  26. package/core/uploads.d.mts.map +1 -1
  27. package/core/uploads.d.ts.map +1 -1
  28. package/core/uploads.mjs.map +1 -1
  29. package/error.d.mts +1 -0
  30. package/error.d.mts.map +1 -1
  31. package/error.d.ts +1 -0
  32. package/error.d.ts.map +1 -1
  33. package/error.mjs +1 -0
  34. package/error.mjs.map +1 -1
  35. package/index.d.mts.map +1 -1
  36. package/index.d.ts.map +1 -1
  37. package/index.mjs.map +1 -1
  38. package/internal/detect-platform.mjs.map +1 -1
  39. package/internal/headers.mjs.map +1 -1
  40. package/internal/parse.d.mts.map +1 -1
  41. package/internal/parse.d.ts.map +1 -1
  42. package/internal/parse.mjs.map +1 -1
  43. package/internal/request-options.d.mts.map +1 -1
  44. package/internal/request-options.d.ts.map +1 -1
  45. package/internal/shims.d.mts +6 -0
  46. package/internal/shims.d.mts.map +1 -1
  47. package/internal/shims.d.ts +6 -0
  48. package/internal/shims.d.ts.map +1 -1
  49. package/internal/to-file.d.mts.map +1 -1
  50. package/internal/to-file.d.ts.map +1 -1
  51. package/internal/to-file.mjs.map +1 -1
  52. package/internal/types.d.mts +4 -4
  53. package/internal/types.d.mts.map +1 -1
  54. package/internal/types.d.ts +4 -4
  55. package/internal/types.d.ts.map +1 -1
  56. package/internal/uploads.d.mts.map +1 -1
  57. package/internal/uploads.d.ts.map +1 -1
  58. package/internal/uploads.mjs.map +1 -1
  59. package/internal/utils/base64.mjs.map +1 -1
  60. package/internal/utils/log.d.mts.map +1 -1
  61. package/internal/utils/log.d.ts.map +1 -1
  62. package/internal/utils/log.mjs.map +1 -1
  63. package/internal/utils/path.mjs.map +1 -1
  64. package/internal/utils/query.mjs.map +1 -1
  65. package/internal/utils/values.mjs.map +1 -1
  66. package/internal/utils.d.mts.map +1 -1
  67. package/internal/utils.d.ts.map +1 -1
  68. package/internal/utils.mjs.map +1 -1
  69. package/package.json +1 -1
  70. package/pagination.d.mts +1 -0
  71. package/pagination.d.mts.map +1 -1
  72. package/pagination.d.ts +1 -0
  73. package/pagination.d.ts.map +1 -1
  74. package/pagination.mjs +1 -0
  75. package/pagination.mjs.map +1 -1
  76. package/resource.d.mts +1 -0
  77. package/resource.d.mts.map +1 -1
  78. package/resource.d.ts +1 -0
  79. package/resource.d.ts.map +1 -1
  80. package/resource.mjs +1 -0
  81. package/resource.mjs.map +1 -1
  82. package/resources/allowed-events.d.mts.map +1 -1
  83. package/resources/allowed-events.d.ts.map +1 -1
  84. package/resources/allowed-events.mjs.map +1 -1
  85. package/resources/consent-settings.d.mts.map +1 -1
  86. package/resources/consent-settings.d.ts.map +1 -1
  87. package/resources/consent-settings.mjs.map +1 -1
  88. package/resources/default-mappings.d.mts +140 -0
  89. package/resources/default-mappings.d.mts.map +1 -0
  90. package/resources/default-mappings.d.ts +140 -0
  91. package/resources/default-mappings.d.ts.map +1 -0
  92. package/resources/default-mappings.js +38 -0
  93. package/resources/default-mappings.js.map +1 -0
  94. package/resources/default-mappings.mjs +34 -0
  95. package/resources/default-mappings.mjs.map +1 -0
  96. package/resources/destination-types.d.mts +21 -13
  97. package/resources/destination-types.d.mts.map +1 -1
  98. package/resources/destination-types.d.ts +21 -13
  99. package/resources/destination-types.d.ts.map +1 -1
  100. package/resources/destination-types.js.map +1 -1
  101. package/resources/destination-types.mjs.map +1 -1
  102. package/resources/destinations.d.mts +61 -98
  103. package/resources/destinations.d.mts.map +1 -1
  104. package/resources/destinations.d.ts +61 -98
  105. package/resources/destinations.d.ts.map +1 -1
  106. package/resources/destinations.js +11 -13
  107. package/resources/destinations.js.map +1 -1
  108. package/resources/destinations.mjs +11 -13
  109. package/resources/destinations.mjs.map +1 -1
  110. package/resources/experiment-settings.d.mts.map +1 -1
  111. package/resources/experiment-settings.d.ts.map +1 -1
  112. package/resources/experiment-settings.mjs.map +1 -1
  113. package/resources/experiment-variants.d.mts.map +1 -1
  114. package/resources/experiment-variants.d.ts.map +1 -1
  115. package/resources/experiment-variants.mjs.map +1 -1
  116. package/resources/experiments.d.mts.map +1 -1
  117. package/resources/experiments.d.ts.map +1 -1
  118. package/resources/experiments.mjs.map +1 -1
  119. package/resources/global-dispatch-centers.d.mts.map +1 -1
  120. package/resources/global-dispatch-centers.d.ts.map +1 -1
  121. package/resources/global-dispatch-centers.mjs.map +1 -1
  122. package/resources/heatmap-pages.d.mts.map +1 -1
  123. package/resources/heatmap-pages.d.ts.map +1 -1
  124. package/resources/heatmap-pages.mjs.map +1 -1
  125. package/resources/index.d.mts +7 -2
  126. package/resources/index.d.mts.map +1 -1
  127. package/resources/index.d.ts +7 -2
  128. package/resources/index.d.ts.map +1 -1
  129. package/resources/index.js +11 -1
  130. package/resources/index.js.map +1 -1
  131. package/resources/index.mjs +5 -0
  132. package/resources/index.mjs.map +1 -1
  133. package/resources/locations.d.mts +270 -0
  134. package/resources/locations.d.mts.map +1 -0
  135. package/resources/locations.d.ts +270 -0
  136. package/resources/locations.d.ts.map +1 -0
  137. package/resources/locations.js +48 -0
  138. package/resources/locations.js.map +1 -0
  139. package/resources/locations.mjs +44 -0
  140. package/resources/locations.mjs.map +1 -0
  141. package/resources/mapping-templates.d.mts +101 -0
  142. package/resources/mapping-templates.d.mts.map +1 -0
  143. package/resources/mapping-templates.d.ts +101 -0
  144. package/resources/mapping-templates.d.ts.map +1 -0
  145. package/resources/mapping-templates.js +22 -0
  146. package/resources/mapping-templates.js.map +1 -0
  147. package/resources/mapping-templates.mjs +18 -0
  148. package/resources/mapping-templates.mjs.map +1 -0
  149. package/resources/mappings.d.mts +186 -6
  150. package/resources/mappings.d.mts.map +1 -1
  151. package/resources/mappings.d.ts +186 -6
  152. package/resources/mappings.d.ts.map +1 -1
  153. package/resources/mappings.js +26 -3
  154. package/resources/mappings.js.map +1 -1
  155. package/resources/mappings.mjs +26 -3
  156. package/resources/mappings.mjs.map +1 -1
  157. package/resources/replay-settings.d.mts.map +1 -1
  158. package/resources/replay-settings.d.ts.map +1 -1
  159. package/resources/replay-settings.mjs.map +1 -1
  160. package/resources/sources.d.mts.map +1 -1
  161. package/resources/sources.d.ts.map +1 -1
  162. package/resources/sources.mjs.map +1 -1
  163. package/resources/versions.d.mts.map +1 -1
  164. package/resources/versions.d.ts.map +1 -1
  165. package/resources/versions.mjs.map +1 -1
  166. package/resources/web-scanner-rules.d.mts +195 -0
  167. package/resources/web-scanner-rules.d.mts.map +1 -0
  168. package/resources/web-scanner-rules.d.ts +195 -0
  169. package/resources/web-scanner-rules.d.ts.map +1 -0
  170. package/resources/web-scanner-rules.js +48 -0
  171. package/resources/web-scanner-rules.js.map +1 -0
  172. package/resources/web-scanner-rules.mjs +44 -0
  173. package/resources/web-scanner-rules.mjs.map +1 -0
  174. package/resources/web-scanners.d.mts +199 -0
  175. package/resources/web-scanners.d.mts.map +1 -0
  176. package/resources/web-scanners.d.ts +199 -0
  177. package/resources/web-scanners.d.ts.map +1 -0
  178. package/resources/web-scanners.js +67 -0
  179. package/resources/web-scanners.js.map +1 -0
  180. package/resources/web-scanners.mjs +63 -0
  181. package/resources/web-scanners.mjs.map +1 -0
  182. package/resources.d.mts.map +1 -1
  183. package/resources.d.ts.map +1 -1
  184. package/resources.mjs.map +1 -1
  185. package/src/client.ts +116 -5
  186. package/src/resources/default-mappings.ts +332 -0
  187. package/src/resources/destination-types.ts +117 -202
  188. package/src/resources/destinations.ts +227 -212
  189. package/src/resources/index.ts +48 -0
  190. package/src/resources/locations.ts +463 -0
  191. package/src/resources/mapping-templates.ts +203 -0
  192. package/src/resources/mappings.ts +320 -5
  193. package/src/resources/web-scanner-rules.ts +304 -0
  194. package/src/resources/web-scanners.ts +333 -0
  195. package/src/version.ts +1 -1
  196. package/uploads.d.mts +1 -0
  197. package/uploads.d.mts.map +1 -1
  198. package/uploads.d.ts +1 -0
  199. package/uploads.d.ts.map +1 -1
  200. package/uploads.mjs +1 -0
  201. package/uploads.mjs.map +1 -1
  202. package/version.d.mts +1 -1
  203. package/version.d.ts +1 -1
  204. package/version.js +1 -1
  205. package/version.mjs +1 -1
@@ -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,16 @@ 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
+ }
51
75
  }
52
76
 
53
77
  export type MappingListResponsesCursor = Cursor<MappingListResponse>;
@@ -63,6 +87,15 @@ export interface MappingListResponse {
63
87
 
64
88
  isDefaultMapping?: boolean | null;
65
89
 
90
+ /**
91
+ * Condition tree gating when this mapping fires. A node is either a leaf
92
+ * `condition` or a combinator (`AND`, `OR`, `NOT`). Combinator children are
93
+ * themselves `MappingLogic` nodes, so trees nest arbitrarily. Example leaf:
94
+ * `{ "condition": { "property": "$event.event", "operator": "Is", "value": "page_view" } }`.
95
+ * Example combinator: `{ "AND": [{ "condition": ... }, { "OR": [...] }] }`.
96
+ */
97
+ logic?: unknown;
98
+
66
99
  name?: string | null;
67
100
 
68
101
  priority?: number | null;
@@ -127,6 +160,15 @@ export interface MappingCreateResponse {
127
160
 
128
161
  isDefaultMapping?: boolean | null;
129
162
 
163
+ /**
164
+ * Condition tree gating when this mapping fires. A node is either a leaf
165
+ * `condition` or a combinator (`AND`, `OR`, `NOT`). Combinator children are
166
+ * themselves `MappingLogic` nodes, so trees nest arbitrarily. Example leaf:
167
+ * `{ "condition": { "property": "$event.event", "operator": "Is", "value": "page_view" } }`.
168
+ * Example combinator: `{ "AND": [{ "condition": ... }, { "OR": [...] }] }`.
169
+ */
170
+ logic?: unknown;
171
+
130
172
  name?: string | null;
131
173
 
132
174
  priority?: number | null;
@@ -191,6 +233,15 @@ export interface MappingRetrieveResponse {
191
233
 
192
234
  isDefaultMapping?: boolean | null;
193
235
 
236
+ /**
237
+ * Condition tree gating when this mapping fires. A node is either a leaf
238
+ * `condition` or a combinator (`AND`, `OR`, `NOT`). Combinator children are
239
+ * themselves `MappingLogic` nodes, so trees nest arbitrarily. Example leaf:
240
+ * `{ "condition": { "property": "$event.event", "operator": "Is", "value": "page_view" } }`.
241
+ * Example combinator: `{ "AND": [{ "condition": ... }, { "OR": [...] }] }`.
242
+ */
243
+ logic?: unknown;
244
+
194
245
  name?: string | null;
195
246
 
196
247
  priority?: number | null;
@@ -255,6 +306,15 @@ export interface MappingUpdateResponse {
255
306
 
256
307
  isDefaultMapping?: boolean | null;
257
308
 
309
+ /**
310
+ * Condition tree gating when this mapping fires. A node is either a leaf
311
+ * `condition` or a combinator (`AND`, `OR`, `NOT`). Combinator children are
312
+ * themselves `MappingLogic` nodes, so trees nest arbitrarily. Example leaf:
313
+ * `{ "condition": { "property": "$event.event", "operator": "Is", "value": "page_view" } }`.
314
+ * Example combinator: `{ "AND": [{ "condition": ... }, { "OR": [...] }] }`.
315
+ */
316
+ logic?: unknown;
317
+
258
318
  name?: string | null;
259
319
 
260
320
  priority?: number | null;
@@ -310,6 +370,85 @@ export namespace MappingUpdateResponse {
310
370
 
311
371
  export type MappingDeleteResponse = boolean;
312
372
 
373
+ export interface MappingReorderResponse {
374
+ entities: Array<MappingReorderResponse.Entity>;
375
+ }
376
+
377
+ export namespace MappingReorderResponse {
378
+ export interface Entity {
379
+ id: string;
380
+
381
+ isEnabled: boolean;
382
+
383
+ mappings: Array<Entity.Mapping>;
384
+
385
+ destinationId?: string | null;
386
+
387
+ isDefaultMapping?: boolean | null;
388
+
389
+ /**
390
+ * Condition tree gating when this mapping fires. A node is either a leaf
391
+ * `condition` or a combinator (`AND`, `OR`, `NOT`). Combinator children are
392
+ * themselves `MappingLogic` nodes, so trees nest arbitrarily. Example leaf:
393
+ * `{ "condition": { "property": "$event.event", "operator": "Is", "value": "page_view" } }`.
394
+ * Example combinator: `{ "AND": [{ "condition": ... }, { "OR": [...] }] }`.
395
+ */
396
+ logic?: unknown;
397
+
398
+ name?: string | null;
399
+
400
+ priority?: number | null;
401
+
402
+ sourceId?: string | null;
403
+
404
+ templateId?: string | null;
405
+
406
+ templateName?: string | null;
407
+
408
+ updatedAt?: string | null;
409
+ }
410
+
411
+ export namespace Entity {
412
+ export interface Mapping {
413
+ map: string;
414
+
415
+ property: string;
416
+
417
+ modification?:
418
+ | 'CamelCase'
419
+ | 'DmaIP'
420
+ | 'DomainOnly'
421
+ | 'DomainPathOnly'
422
+ | 'DomainPathUTMs'
423
+ | 'DomainUTMs'
424
+ | 'FakeDomain'
425
+ | 'FakeDomainRealPath'
426
+ | 'FakeIP'
427
+ | 'FullUrl'
428
+ | 'Hash'
429
+ | 'HashMD5'
430
+ | 'HashedCountry'
431
+ | 'HashedDateOfBirth'
432
+ | 'HashedGender'
433
+ | 'HashedNormalized'
434
+ | 'HashedNormalizedNoSpecialChars'
435
+ | 'HashedPhone'
436
+ | 'HashedState'
437
+ | 'HashedZip'
438
+ | 'KebabCase'
439
+ | 'LowerCase'
440
+ | 'None'
441
+ | 'Null'
442
+ | 'Redacted'
443
+ | 'RegionalIP'
444
+ | 'SnakeCase'
445
+ | 'StartCase'
446
+ | 'UpperCase'
447
+ | null;
448
+ }
449
+ }
450
+ }
451
+
313
452
  export interface MappingListParams extends CursorParams {
314
453
  /**
315
454
  * Filter mappings by their parent entity id. Must be a destination id or source
@@ -319,12 +458,178 @@ export interface MappingListParams extends CursorParams {
319
458
  }
320
459
 
321
460
  export interface MappingCreateParams {
322
- allowedEventId: string;
461
+ /**
462
+ * Quick-create variant: allowed event to bind the new mapping to. Required
463
+ * together with `destinationId`. Mutually exclusive with `templateId`/`entityId`.
464
+ */
465
+ allowedEventId?: string;
466
+
467
+ /**
468
+ * Quick-create variant: destination that should receive events matched by this
469
+ * mapping. Required together with `allowedEventId`.
470
+ */
471
+ destinationId?: string;
472
+
473
+ /**
474
+ * Template fat-create variant: destination or source id this mapping belongs to.
475
+ * Required together with `templateId`.
476
+ */
477
+ entityId?: string;
478
+
479
+ /**
480
+ * Template fat-create only. Zero-based position in the destination/source priority
481
+ * order to insert this mapping after. Omit to append at the end.
482
+ */
483
+ insertAfterIdx?: number;
484
+
485
+ /**
486
+ * Template fat-create only. Initial enabled state. Defaults to `true`.
487
+ */
488
+ isEnabled?: boolean;
489
+
490
+ /**
491
+ * Condition tree gating when this mapping fires. A node is either a leaf
492
+ * `condition` or a combinator (`AND`, `OR`, `NOT`). Combinator children are
493
+ * themselves `MappingLogic` nodes, so trees nest arbitrarily. Example leaf:
494
+ * `{ "condition": { "property": "$event.event", "operator": "Is", "value": "page_view" } }`.
495
+ * Example combinator: `{ "AND": [{ "condition": ... }, { "OR": [...] }] }`.
496
+ */
497
+ logic?: MappingCreateParams.Logic;
498
+
499
+ /**
500
+ * Template fat-create only. Optional initial property mappings. When omitted the
501
+ * mapping is seeded with template defaults for sources and non-default destination
502
+ * templates, and with `[]` for default destination templates.
503
+ */
504
+ mappings?: Array<MappingCreateParams.Mapping>;
505
+
506
+ /**
507
+ * Template fat-create only. Override the auto-generated mapping name.
508
+ */
509
+ name?: string | null;
510
+
511
+ /**
512
+ * Template fat-create variant: template id from `GET /rest/v1/mapping-templates`.
513
+ * Picks the property descriptor set used to validate `mappings[].property`.
514
+ * Required together with `entityId`.
515
+ */
516
+ templateId?: string;
517
+ }
518
+
519
+ export namespace MappingCreateParams {
520
+ /**
521
+ * Condition tree gating when this mapping fires. A node is either a leaf
522
+ * `condition` or a combinator (`AND`, `OR`, `NOT`). Combinator children are
523
+ * themselves `MappingLogic` nodes, so trees nest arbitrarily. Example leaf:
524
+ * `{ "condition": { "property": "$event.event", "operator": "Is", "value": "page_view" } }`.
525
+ * Example combinator: `{ "AND": [{ "condition": ... }, { "OR": [...] }] }`.
526
+ */
527
+ export interface Logic {
528
+ /**
529
+ * All child nodes must match. Each child is a `MappingLogic` node.
530
+ */
531
+ AND?: Array<unknown> | null;
532
+
533
+ condition?: Logic.Condition;
534
+
535
+ /**
536
+ * Negates a single child `MappingLogic` node.
537
+ */
538
+ NOT?: unknown;
539
+
540
+ /**
541
+ * Any child node must match. Each child is a `MappingLogic` node.
542
+ */
543
+ OR?: Array<unknown> | null;
544
+ }
545
+
546
+ export namespace Logic {
547
+ export interface Condition {
548
+ operator:
549
+ | 'Is'
550
+ | 'IsNot'
551
+ | 'Contains'
552
+ | 'DoesNotContain'
553
+ | 'StartsWith'
554
+ | 'EndsWith'
555
+ | 'IsFalsy'
556
+ | 'IsTruthy'
557
+ | 'IsNull'
558
+ | 'IsNotNull'
559
+ | 'IsUndefined'
560
+ | 'IsNotUndefined'
561
+ | 'IsGreaterThan'
562
+ | 'IsGreaterThanOrEqual'
563
+ | 'IsLessThan'
564
+ | 'IsLessThanOrEqual'
565
+ | 'IsIn'
566
+ | 'IsNotIn'
567
+ | 'IsFoundIn'
568
+ | 'IsNotFoundIn'
569
+ | 'IsTrue'
570
+ | 'IsFalse'
571
+ | 'IsBefore'
572
+ | 'IsAfter'
573
+ | 'IsBetween'
574
+ | 'IsOnOrBefore'
575
+ | 'IsOnOrAfter'
576
+ | 'MatchesRegex'
577
+ | 'MatchesRegexIgnoreCase'
578
+ | 'DoesNotMatchRegex'
579
+ | 'DoesNotMatchRegexIgnoreCase';
580
+
581
+ property: string;
582
+
583
+ value: string;
584
+ }
585
+ }
323
586
 
324
- destinationId: string;
587
+ export interface Mapping {
588
+ map: string;
589
+
590
+ property: string;
591
+
592
+ modification?:
593
+ | 'CamelCase'
594
+ | 'DmaIP'
595
+ | 'DomainOnly'
596
+ | 'DomainPathOnly'
597
+ | 'DomainPathUTMs'
598
+ | 'DomainUTMs'
599
+ | 'FakeDomain'
600
+ | 'FakeDomainRealPath'
601
+ | 'FakeIP'
602
+ | 'FullUrl'
603
+ | 'Hash'
604
+ | 'HashMD5'
605
+ | 'HashedCountry'
606
+ | 'HashedDateOfBirth'
607
+ | 'HashedGender'
608
+ | 'HashedNormalized'
609
+ | 'HashedNormalizedNoSpecialChars'
610
+ | 'HashedPhone'
611
+ | 'HashedState'
612
+ | 'HashedZip'
613
+ | 'KebabCase'
614
+ | 'LowerCase'
615
+ | 'None'
616
+ | 'Null'
617
+ | 'Redacted'
618
+ | 'RegionalIP'
619
+ | 'SnakeCase'
620
+ | 'StartCase'
621
+ | 'UpperCase'
622
+ | null;
623
+ }
325
624
  }
326
625
 
327
626
  export interface MappingUpdateParams {
627
+ /**
628
+ * Flip the mapping on/off without changing other fields. `null` is treated as
629
+ * omitted.
630
+ */
631
+ isEnabled?: boolean | null;
632
+
328
633
  /**
329
634
  * Condition tree gating when this mapping fires. A node is either a leaf
330
635
  * `condition` or a combinator (`AND`, `OR`, `NOT`). Combinator children are
@@ -446,6 +751,14 @@ export namespace MappingUpdateParams {
446
751
  }
447
752
  }
448
753
 
754
+ export interface MappingReorderParams {
755
+ /**
756
+ * Mapping ids in their new priority order, low priority index first. All ids must
757
+ * belong to the same parent entity (source or destination).
758
+ */
759
+ uuids: Array<string>;
760
+ }
761
+
449
762
  export declare namespace Mappings {
450
763
  export {
451
764
  type MappingListResponse as MappingListResponse,
@@ -453,9 +766,11 @@ export declare namespace Mappings {
453
766
  type MappingRetrieveResponse as MappingRetrieveResponse,
454
767
  type MappingUpdateResponse as MappingUpdateResponse,
455
768
  type MappingDeleteResponse as MappingDeleteResponse,
769
+ type MappingReorderResponse as MappingReorderResponse,
456
770
  type MappingListResponsesCursor as MappingListResponsesCursor,
457
771
  type MappingListParams as MappingListParams,
458
772
  type MappingCreateParams as MappingCreateParams,
459
773
  type MappingUpdateParams as MappingUpdateParams,
774
+ type MappingReorderParams as MappingReorderParams,
460
775
  };
461
776
  }
@@ -0,0 +1,304 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+ import { path } from '../internal/utils/path';
7
+
8
+ export class WebScannerRules extends APIResource {
9
+ /**
10
+ * List suppression rules for a single web scanner. Requires the `scannerId` query
11
+ * parameter — rules are always scoped to a parent scanner. Not paginated; the
12
+ * per-scanner rule count is bounded. Requires scope: webScanner:find
13
+ */
14
+ list(query: WebScannerRuleListParams, options?: RequestOptions): APIPromise<WebScannerRuleListResponse> {
15
+ return this._client.get('/rest/v1/web-scanner-rules', { query, ...options });
16
+ }
17
+
18
+ /**
19
+ * Create a suppression rule on a web scanner. Auth is enforced against the parent
20
+ * scanner via `webScanner:update`. At least one of `cookiePatterns`,
21
+ * `domainPatterns`, or `scriptPatterns` should be set for the rule to match
22
+ * anything; omitted pattern arrays default to `[]`. Requires scope:
23
+ * webScanner:update
24
+ */
25
+ create(
26
+ body: WebScannerRuleCreateParams,
27
+ options?: RequestOptions,
28
+ ): APIPromise<WebScannerRuleCreateResponse> {
29
+ return this._client.post('/rest/v1/web-scanner-rules', { body, ...options });
30
+ }
31
+
32
+ /**
33
+ * Find a single web scanner rule by ID. Requires scope: webScanner:find
34
+ */
35
+ retrieve(id: string, options?: RequestOptions): APIPromise<WebScannerRuleRetrieveResponse> {
36
+ return this._client.get(path`/rest/v1/web-scanner-rules/${id}`, options);
37
+ }
38
+
39
+ /**
40
+ * Partially update a suppression rule. Only the fields you send are changed.
41
+ * List-valued fields (`cookiePatterns`, `domainPatterns`, `scriptPatterns`) are
42
+ * replaced wholesale when sent. Requires scope: webScanner:update
43
+ */
44
+ update(
45
+ id: string,
46
+ body: WebScannerRuleUpdateParams,
47
+ options?: RequestOptions,
48
+ ): APIPromise<WebScannerRuleUpdateResponse> {
49
+ return this._client.patch(path`/rest/v1/web-scanner-rules/${id}`, { body, ...options });
50
+ }
51
+
52
+ /**
53
+ * Delete a web scanner rule. Requires scope: webScanner:update
54
+ */
55
+ delete(id: string, options?: RequestOptions): APIPromise<WebScannerRuleDeleteResponse> {
56
+ return this._client.delete(path`/rest/v1/web-scanner-rules/${id}`, options);
57
+ }
58
+ }
59
+
60
+ export interface WebScannerRuleListResponse {
61
+ entities: Array<WebScannerRuleListResponse.Entity>;
62
+ }
63
+
64
+ export namespace WebScannerRuleListResponse {
65
+ export interface Entity {
66
+ id: string;
67
+
68
+ accountId: string;
69
+
70
+ cookiePatterns: Array<string>;
71
+
72
+ createdAt: string;
73
+
74
+ domainPatterns: Array<string>;
75
+
76
+ name: string;
77
+
78
+ priority: number;
79
+
80
+ scannerId: string;
81
+
82
+ scriptPatterns: Array<string>;
83
+
84
+ createdByUserId?: string | null;
85
+
86
+ notes?: string | null;
87
+
88
+ reason?: 'approved' | 'baa' | 'compliant' | 'firstParty' | 'ignore' | 'internal' | 'other' | null;
89
+
90
+ updatedAt?: string | null;
91
+
92
+ updatedByUserId?: string | null;
93
+ }
94
+ }
95
+
96
+ export interface WebScannerRuleCreateResponse {
97
+ id: string;
98
+
99
+ accountId: string;
100
+
101
+ cookiePatterns: Array<string>;
102
+
103
+ createdAt: string;
104
+
105
+ domainPatterns: Array<string>;
106
+
107
+ name: string;
108
+
109
+ priority: number;
110
+
111
+ scannerId: string;
112
+
113
+ scriptPatterns: Array<string>;
114
+
115
+ createdByUserId?: string | null;
116
+
117
+ notes?: string | null;
118
+
119
+ reason?: 'approved' | 'baa' | 'compliant' | 'firstParty' | 'ignore' | 'internal' | 'other' | null;
120
+
121
+ updatedAt?: string | null;
122
+
123
+ updatedByUserId?: string | null;
124
+ }
125
+
126
+ export interface WebScannerRuleRetrieveResponse {
127
+ id: string;
128
+
129
+ accountId: string;
130
+
131
+ cookiePatterns: Array<string>;
132
+
133
+ createdAt: string;
134
+
135
+ domainPatterns: Array<string>;
136
+
137
+ name: string;
138
+
139
+ priority: number;
140
+
141
+ scannerId: string;
142
+
143
+ scriptPatterns: Array<string>;
144
+
145
+ createdByUserId?: string | null;
146
+
147
+ notes?: string | null;
148
+
149
+ reason?: 'approved' | 'baa' | 'compliant' | 'firstParty' | 'ignore' | 'internal' | 'other' | null;
150
+
151
+ updatedAt?: string | null;
152
+
153
+ updatedByUserId?: string | null;
154
+ }
155
+
156
+ export interface WebScannerRuleUpdateResponse {
157
+ id: string;
158
+
159
+ accountId: string;
160
+
161
+ cookiePatterns: Array<string>;
162
+
163
+ createdAt: string;
164
+
165
+ domainPatterns: Array<string>;
166
+
167
+ name: string;
168
+
169
+ priority: number;
170
+
171
+ scannerId: string;
172
+
173
+ scriptPatterns: Array<string>;
174
+
175
+ createdByUserId?: string | null;
176
+
177
+ notes?: string | null;
178
+
179
+ reason?: 'approved' | 'baa' | 'compliant' | 'firstParty' | 'ignore' | 'internal' | 'other' | null;
180
+
181
+ updatedAt?: string | null;
182
+
183
+ updatedByUserId?: string | null;
184
+ }
185
+
186
+ export interface WebScannerRuleDeleteResponse {
187
+ /**
188
+ * The id of the suppression rule that was deleted.
189
+ */
190
+ id: string;
191
+
192
+ /**
193
+ * True when the underlying mutation succeeded.
194
+ */
195
+ deleted: boolean;
196
+ }
197
+
198
+ export interface WebScannerRuleListParams {
199
+ /**
200
+ * The web scanner whose suppression rules should be returned.
201
+ */
202
+ scannerId: string;
203
+ }
204
+
205
+ export interface WebScannerRuleCreateParams {
206
+ /**
207
+ * User-friendly name for the suppression rule.
208
+ */
209
+ name: string;
210
+
211
+ /**
212
+ * Rule priority (1–10,000). Lower numbers are evaluated first when multiple rules
213
+ * match.
214
+ */
215
+ priority: number;
216
+
217
+ /**
218
+ * The web scanner this rule belongs to.
219
+ */
220
+ scannerId: string;
221
+
222
+ /**
223
+ * Glob patterns matched against cookie names (e.g. `_ga*`). Max 100 entries. When
224
+ * sent on PATCH, replaces the existing list wholesale.
225
+ */
226
+ cookiePatterns?: Array<string>;
227
+
228
+ /**
229
+ * Glob patterns matched against cookie domain / script hostname (e.g.
230
+ * `*.google-analytics.com`). Max 100 entries. When sent on PATCH, replaces the
231
+ * existing list wholesale.
232
+ */
233
+ domainPatterns?: Array<string>;
234
+
235
+ /**
236
+ * Free-form notes about why this rule exists or what it covers. Trimmed
237
+ * server-side; empty strings become `null`.
238
+ */
239
+ notes?: string | null;
240
+
241
+ /**
242
+ * Why this rule was added. Surfaced in audit views. Send `null` to clear an
243
+ * existing reason on patch.
244
+ */
245
+ reason?: 'approved' | 'baa' | 'compliant' | 'firstParty' | 'ignore' | 'internal' | 'other' | null;
246
+
247
+ /**
248
+ * Glob patterns matched against full script URLs (e.g.
249
+ * `https://www.googletagmanager.com/gtm.js?id=*`). Max 100 entries. When sent on
250
+ * PATCH, replaces the existing list wholesale.
251
+ */
252
+ scriptPatterns?: Array<string>;
253
+ }
254
+
255
+ export interface WebScannerRuleUpdateParams {
256
+ /**
257
+ * Glob patterns matched against cookie names (e.g. `_ga*`). Max 100 entries. When
258
+ * sent on PATCH, replaces the existing list wholesale.
259
+ */
260
+ cookiePatterns?: Array<string>;
261
+
262
+ /**
263
+ * Glob patterns matched against cookie domain / script hostname (e.g.
264
+ * `*.google-analytics.com`). Max 100 entries. When sent on PATCH, replaces the
265
+ * existing list wholesale.
266
+ */
267
+ domainPatterns?: Array<string>;
268
+
269
+ name?: string;
270
+
271
+ /**
272
+ * Free-form notes about why this rule exists or what it covers. Trimmed
273
+ * server-side; empty strings become `null`.
274
+ */
275
+ notes?: string | null;
276
+
277
+ priority?: number;
278
+
279
+ /**
280
+ * Why this rule was added. Surfaced in audit views. Send `null` to clear an
281
+ * existing reason on patch.
282
+ */
283
+ reason?: 'approved' | 'baa' | 'compliant' | 'firstParty' | 'ignore' | 'internal' | 'other' | null;
284
+
285
+ /**
286
+ * Glob patterns matched against full script URLs (e.g.
287
+ * `https://www.googletagmanager.com/gtm.js?id=*`). Max 100 entries. When sent on
288
+ * PATCH, replaces the existing list wholesale.
289
+ */
290
+ scriptPatterns?: Array<string>;
291
+ }
292
+
293
+ export declare namespace WebScannerRules {
294
+ export {
295
+ type WebScannerRuleListResponse as WebScannerRuleListResponse,
296
+ type WebScannerRuleCreateResponse as WebScannerRuleCreateResponse,
297
+ type WebScannerRuleRetrieveResponse as WebScannerRuleRetrieveResponse,
298
+ type WebScannerRuleUpdateResponse as WebScannerRuleUpdateResponse,
299
+ type WebScannerRuleDeleteResponse as WebScannerRuleDeleteResponse,
300
+ type WebScannerRuleListParams as WebScannerRuleListParams,
301
+ type WebScannerRuleCreateParams as WebScannerRuleCreateParams,
302
+ type WebScannerRuleUpdateParams as WebScannerRuleUpdateParams,
303
+ };
304
+ }