@oursprivacy/platform-sdk 1.13.0 → 1.15.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 (49) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +12 -8
  3. package/client.d.mts +6 -6
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +6 -6
  6. package/client.d.ts.map +1 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/resources/experiment-variants.d.mts +73 -79
  11. package/resources/experiment-variants.d.mts.map +1 -1
  12. package/resources/experiment-variants.d.ts +73 -79
  13. package/resources/experiment-variants.d.ts.map +1 -1
  14. package/resources/experiment-variants.js +14 -7
  15. package/resources/experiment-variants.js.map +1 -1
  16. package/resources/experiment-variants.mjs +14 -7
  17. package/resources/experiment-variants.mjs.map +1 -1
  18. package/resources/index.d.mts +3 -3
  19. package/resources/index.d.mts.map +1 -1
  20. package/resources/index.d.ts +3 -3
  21. package/resources/index.d.ts.map +1 -1
  22. package/resources/index.js.map +1 -1
  23. package/resources/index.mjs.map +1 -1
  24. package/resources/mappings.d.mts +69 -30
  25. package/resources/mappings.d.mts.map +1 -1
  26. package/resources/mappings.d.ts +69 -30
  27. package/resources/mappings.d.ts.map +1 -1
  28. package/resources/mappings.js +6 -2
  29. package/resources/mappings.js.map +1 -1
  30. package/resources/mappings.mjs +6 -2
  31. package/resources/mappings.mjs.map +1 -1
  32. package/resources/versions.d.mts +1260 -8
  33. package/resources/versions.d.mts.map +1 -1
  34. package/resources/versions.d.ts +1260 -8
  35. package/resources/versions.d.ts.map +1 -1
  36. package/resources/versions.js +15 -8
  37. package/resources/versions.js.map +1 -1
  38. package/resources/versions.mjs +15 -8
  39. package/resources/versions.mjs.map +1 -1
  40. package/src/client.ts +6 -0
  41. package/src/resources/experiment-variants.ts +94 -96
  42. package/src/resources/index.ts +3 -0
  43. package/src/resources/mappings.ts +262 -31
  44. package/src/resources/versions.ts +1272 -8
  45. package/src/version.ts +1 -1
  46. package/version.d.mts +1 -1
  47. package/version.d.ts +1 -1
  48. package/version.js +1 -1
  49. package/version.mjs +1 -1
@@ -2,15 +2,22 @@
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
+ import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
5
6
  import { RequestOptions } from '../internal/request-options';
6
7
  import { path } from '../internal/utils/path';
7
8
 
8
9
  export class Mappings extends APIResource {
9
10
  /**
10
- * List all mappings for an entity. Requires scope: mapping:list
11
+ * List mappings for an entity (a source or destination). Requires the `entityId`
12
+ * query parameter. Supports cursor pagination via `limit` and `cursor`. Sorted by
13
+ * `priority` ascending, then by `id` for deterministic pagination. Requires scope:
14
+ * mapping:list
11
15
  */
12
- list(query: MappingListParams, options?: RequestOptions): APIPromise<MappingListResponse> {
13
- return this._client.get('/rest/v1/mappings', { query, ...options });
16
+ list(
17
+ query: MappingListParams,
18
+ options?: RequestOptions,
19
+ ): PagePromise<MappingListResponsesCursor, MappingListResponse> {
20
+ return this._client.getAPIList('/rest/v1/mappings', Cursor<MappingListResponse>, { query, ...options });
14
21
  }
15
22
 
16
23
  /**
@@ -43,41 +50,69 @@ export class Mappings extends APIResource {
43
50
  }
44
51
  }
45
52
 
46
- export type MappingListResponse = Array<MappingListResponse.MappingListResponseItem>;
53
+ export type MappingListResponsesCursor = Cursor<MappingListResponse>;
47
54
 
48
- export namespace MappingListResponse {
49
- export interface MappingListResponseItem {
50
- id: string;
55
+ export interface MappingListResponse {
56
+ id: string;
51
57
 
52
- isEnabled: boolean;
58
+ isEnabled: boolean;
53
59
 
54
- mappings: Array<MappingListResponseItem.Mapping>;
60
+ mappings: Array<MappingListResponse.Mapping>;
55
61
 
56
- destinationId?: string | null;
62
+ destinationId?: string | null;
57
63
 
58
- isDefaultMapping?: boolean | null;
64
+ isDefaultMapping?: boolean | null;
59
65
 
60
- name?: string | null;
66
+ name?: string | null;
61
67
 
62
- priority?: number | null;
68
+ priority?: number | null;
63
69
 
64
- sourceId?: string | null;
70
+ sourceId?: string | null;
65
71
 
66
- templateId?: string | null;
72
+ templateId?: string | null;
67
73
 
68
- templateName?: string | null;
74
+ templateName?: string | null;
69
75
 
70
- updatedAt?: string | null;
71
- }
76
+ updatedAt?: string | null;
77
+ }
72
78
 
73
- export namespace MappingListResponseItem {
74
- export interface Mapping {
75
- map: string;
79
+ export namespace MappingListResponse {
80
+ export interface Mapping {
81
+ map: string;
76
82
 
77
- property: string;
83
+ property: string;
78
84
 
79
- modification?: string | null;
80
- }
85
+ modification?:
86
+ | 'CamelCase'
87
+ | 'DmaIP'
88
+ | 'DomainOnly'
89
+ | 'DomainPathOnly'
90
+ | 'DomainPathUTMs'
91
+ | 'DomainUTMs'
92
+ | 'FakeDomain'
93
+ | 'FakeDomainRealPath'
94
+ | 'FakeIP'
95
+ | 'FullUrl'
96
+ | 'Hash'
97
+ | 'HashMD5'
98
+ | 'HashedCountry'
99
+ | 'HashedDateOfBirth'
100
+ | 'HashedGender'
101
+ | 'HashedNormalized'
102
+ | 'HashedNormalizedNoSpecialChars'
103
+ | 'HashedPhone'
104
+ | 'HashedState'
105
+ | 'HashedZip'
106
+ | 'KebabCase'
107
+ | 'LowerCase'
108
+ | 'None'
109
+ | 'Null'
110
+ | 'Redacted'
111
+ | 'RegionalIP'
112
+ | 'SnakeCase'
113
+ | 'StartCase'
114
+ | 'UpperCase'
115
+ | null;
81
116
  }
82
117
  }
83
118
 
@@ -111,7 +146,37 @@ export namespace MappingCreateResponse {
111
146
 
112
147
  property: string;
113
148
 
114
- modification?: string | null;
149
+ modification?:
150
+ | 'CamelCase'
151
+ | 'DmaIP'
152
+ | 'DomainOnly'
153
+ | 'DomainPathOnly'
154
+ | 'DomainPathUTMs'
155
+ | 'DomainUTMs'
156
+ | 'FakeDomain'
157
+ | 'FakeDomainRealPath'
158
+ | 'FakeIP'
159
+ | 'FullUrl'
160
+ | 'Hash'
161
+ | 'HashMD5'
162
+ | 'HashedCountry'
163
+ | 'HashedDateOfBirth'
164
+ | 'HashedGender'
165
+ | 'HashedNormalized'
166
+ | 'HashedNormalizedNoSpecialChars'
167
+ | 'HashedPhone'
168
+ | 'HashedState'
169
+ | 'HashedZip'
170
+ | 'KebabCase'
171
+ | 'LowerCase'
172
+ | 'None'
173
+ | 'Null'
174
+ | 'Redacted'
175
+ | 'RegionalIP'
176
+ | 'SnakeCase'
177
+ | 'StartCase'
178
+ | 'UpperCase'
179
+ | null;
115
180
  }
116
181
  }
117
182
 
@@ -145,7 +210,37 @@ export namespace MappingRetrieveResponse {
145
210
 
146
211
  property: string;
147
212
 
148
- modification?: string | null;
213
+ modification?:
214
+ | 'CamelCase'
215
+ | 'DmaIP'
216
+ | 'DomainOnly'
217
+ | 'DomainPathOnly'
218
+ | 'DomainPathUTMs'
219
+ | 'DomainUTMs'
220
+ | 'FakeDomain'
221
+ | 'FakeDomainRealPath'
222
+ | 'FakeIP'
223
+ | 'FullUrl'
224
+ | 'Hash'
225
+ | 'HashMD5'
226
+ | 'HashedCountry'
227
+ | 'HashedDateOfBirth'
228
+ | 'HashedGender'
229
+ | 'HashedNormalized'
230
+ | 'HashedNormalizedNoSpecialChars'
231
+ | 'HashedPhone'
232
+ | 'HashedState'
233
+ | 'HashedZip'
234
+ | 'KebabCase'
235
+ | 'LowerCase'
236
+ | 'None'
237
+ | 'Null'
238
+ | 'Redacted'
239
+ | 'RegionalIP'
240
+ | 'SnakeCase'
241
+ | 'StartCase'
242
+ | 'UpperCase'
243
+ | null;
149
244
  }
150
245
  }
151
246
 
@@ -179,15 +274,46 @@ export namespace MappingUpdateResponse {
179
274
 
180
275
  property: string;
181
276
 
182
- modification?: string | null;
277
+ modification?:
278
+ | 'CamelCase'
279
+ | 'DmaIP'
280
+ | 'DomainOnly'
281
+ | 'DomainPathOnly'
282
+ | 'DomainPathUTMs'
283
+ | 'DomainUTMs'
284
+ | 'FakeDomain'
285
+ | 'FakeDomainRealPath'
286
+ | 'FakeIP'
287
+ | 'FullUrl'
288
+ | 'Hash'
289
+ | 'HashMD5'
290
+ | 'HashedCountry'
291
+ | 'HashedDateOfBirth'
292
+ | 'HashedGender'
293
+ | 'HashedNormalized'
294
+ | 'HashedNormalizedNoSpecialChars'
295
+ | 'HashedPhone'
296
+ | 'HashedState'
297
+ | 'HashedZip'
298
+ | 'KebabCase'
299
+ | 'LowerCase'
300
+ | 'None'
301
+ | 'Null'
302
+ | 'Redacted'
303
+ | 'RegionalIP'
304
+ | 'SnakeCase'
305
+ | 'StartCase'
306
+ | 'UpperCase'
307
+ | null;
183
308
  }
184
309
  }
185
310
 
186
311
  export type MappingDeleteResponse = boolean;
187
312
 
188
- export interface MappingListParams {
313
+ export interface MappingListParams extends CursorParams {
189
314
  /**
190
- * Filter mappings by their parent entity id (for example an allowed event id).
315
+ * Filter mappings by their parent entity id. Must be a destination id or source
316
+ * id.
191
317
  */
192
318
  entityId: string;
193
319
  }
@@ -199,7 +325,14 @@ export interface MappingCreateParams {
199
325
  }
200
326
 
201
327
  export interface MappingUpdateParams {
202
- logic?: unknown;
328
+ /**
329
+ * Condition tree gating when this mapping fires. A node is either a leaf
330
+ * `condition` or a combinator (`AND`, `OR`, `NOT`). Combinator children are
331
+ * themselves `MappingLogic` nodes, so trees nest arbitrarily. Example leaf:
332
+ * `{ "condition": { "property": "$event.event", "operator": "Is", "value": "page_view" } }`.
333
+ * Example combinator: `{ "AND": [{ "condition": ... }, { "OR": [...] }] }`.
334
+ */
335
+ logic?: MappingUpdateParams.Logic;
203
336
 
204
337
  mappings?: Array<MappingUpdateParams.Mapping>;
205
338
 
@@ -207,12 +340,109 @@ export interface MappingUpdateParams {
207
340
  }
208
341
 
209
342
  export namespace MappingUpdateParams {
343
+ /**
344
+ * Condition tree gating when this mapping fires. A node is either a leaf
345
+ * `condition` or a combinator (`AND`, `OR`, `NOT`). Combinator children are
346
+ * themselves `MappingLogic` nodes, so trees nest arbitrarily. Example leaf:
347
+ * `{ "condition": { "property": "$event.event", "operator": "Is", "value": "page_view" } }`.
348
+ * Example combinator: `{ "AND": [{ "condition": ... }, { "OR": [...] }] }`.
349
+ */
350
+ export interface Logic {
351
+ /**
352
+ * All child nodes must match. Each child is a `MappingLogic` node.
353
+ */
354
+ AND?: Array<unknown> | null;
355
+
356
+ condition?: Logic.Condition;
357
+
358
+ /**
359
+ * Negates a single child `MappingLogic` node.
360
+ */
361
+ NOT?: unknown;
362
+
363
+ /**
364
+ * Any child node must match. Each child is a `MappingLogic` node.
365
+ */
366
+ OR?: Array<unknown> | null;
367
+ }
368
+
369
+ export namespace Logic {
370
+ export interface Condition {
371
+ operator:
372
+ | 'Is'
373
+ | 'IsNot'
374
+ | 'Contains'
375
+ | 'DoesNotContain'
376
+ | 'StartsWith'
377
+ | 'EndsWith'
378
+ | 'IsFalsy'
379
+ | 'IsTruthy'
380
+ | 'IsNull'
381
+ | 'IsNotNull'
382
+ | 'IsUndefined'
383
+ | 'IsNotUndefined'
384
+ | 'IsGreaterThan'
385
+ | 'IsGreaterThanOrEqual'
386
+ | 'IsLessThan'
387
+ | 'IsLessThanOrEqual'
388
+ | 'IsIn'
389
+ | 'IsNotIn'
390
+ | 'IsFoundIn'
391
+ | 'IsNotFoundIn'
392
+ | 'IsTrue'
393
+ | 'IsFalse'
394
+ | 'IsBefore'
395
+ | 'IsAfter'
396
+ | 'IsBetween'
397
+ | 'IsOnOrBefore'
398
+ | 'IsOnOrAfter'
399
+ | 'MatchesRegex'
400
+ | 'MatchesRegexIgnoreCase'
401
+ | 'DoesNotMatchRegex'
402
+ | 'DoesNotMatchRegexIgnoreCase';
403
+
404
+ property: string;
405
+
406
+ value: string;
407
+ }
408
+ }
409
+
210
410
  export interface Mapping {
211
411
  map: string;
212
412
 
213
413
  property: string;
214
414
 
215
- modification?: string | null;
415
+ modification?:
416
+ | 'CamelCase'
417
+ | 'DmaIP'
418
+ | 'DomainOnly'
419
+ | 'DomainPathOnly'
420
+ | 'DomainPathUTMs'
421
+ | 'DomainUTMs'
422
+ | 'FakeDomain'
423
+ | 'FakeDomainRealPath'
424
+ | 'FakeIP'
425
+ | 'FullUrl'
426
+ | 'Hash'
427
+ | 'HashMD5'
428
+ | 'HashedCountry'
429
+ | 'HashedDateOfBirth'
430
+ | 'HashedGender'
431
+ | 'HashedNormalized'
432
+ | 'HashedNormalizedNoSpecialChars'
433
+ | 'HashedPhone'
434
+ | 'HashedState'
435
+ | 'HashedZip'
436
+ | 'KebabCase'
437
+ | 'LowerCase'
438
+ | 'None'
439
+ | 'Null'
440
+ | 'Redacted'
441
+ | 'RegionalIP'
442
+ | 'SnakeCase'
443
+ | 'StartCase'
444
+ | 'UpperCase'
445
+ | null;
216
446
  }
217
447
  }
218
448
 
@@ -223,6 +453,7 @@ export declare namespace Mappings {
223
453
  type MappingRetrieveResponse as MappingRetrieveResponse,
224
454
  type MappingUpdateResponse as MappingUpdateResponse,
225
455
  type MappingDeleteResponse as MappingDeleteResponse,
456
+ type MappingListResponsesCursor as MappingListResponsesCursor,
226
457
  type MappingListParams as MappingListParams,
227
458
  type MappingCreateParams as MappingCreateParams,
228
459
  type MappingUpdateParams as MappingUpdateParams,