@oursprivacy/platform-sdk 1.23.0 → 1.24.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.
@@ -2,19 +2,27 @@
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 Sources extends APIResource {
9
10
  /**
10
- * List all sources. Requires scope: source:list
11
+ * List all sources for this account. Supports cursor pagination and optional
12
+ * filters for `type`, `status`, and `nameContains`. Results are sorted by creation
13
+ * date descending. Requires scope: source:list
11
14
  */
12
- list(options?: RequestOptions): APIPromise<SourceListResponse> {
13
- return this._client.get('/rest/v1/sources', options);
15
+ list(
16
+ query: SourceListParams | null | undefined = {},
17
+ options?: RequestOptions,
18
+ ): PagePromise<SourceListResponsesCursor, SourceListResponse> {
19
+ return this._client.getAPIList('/rest/v1/sources', Cursor<SourceListResponse>, { query, ...options });
14
20
  }
15
21
 
16
22
  /**
17
- * Create a new source. Requires scope: source:create
23
+ * Create a new source. Returns the full source entity (same shape as GET
24
+ * /sources/{id}) so callers can read all server-assigned fields without a
25
+ * follow-up GET. Requires scope: source:create
18
26
  */
19
27
  create(body: SourceCreateParams, options?: RequestOptions): APIPromise<SourceCreateResponse> {
20
28
  return this._client.post('/rest/v1/sources', { body, ...options });
@@ -28,8 +36,9 @@ export class Sources extends APIResource {
28
36
  }
29
37
 
30
38
  /**
31
- * Partially update a source. Only the fields you send are changed. Requires scope:
32
- * source:update
39
+ * Partially update a source. Only the fields you send are changed; omitted fields
40
+ * are unchanged. Send explicit `null` to clear a nullable field. Returns the full
41
+ * source entity after the update. Requires scope: source:update
33
42
  */
34
43
  update(id: string, body: SourceUpdateParams, options?: RequestOptions): APIPromise<SourceUpdateResponse> {
35
44
  return this._client.patch(path`/rest/v1/sources/${id}`, { body, ...options });
@@ -43,88 +52,117 @@ export class Sources extends APIResource {
43
52
  }
44
53
 
45
54
  /**
46
- * Fetch install tokens and snippets for a source. Requires scope: source:view
55
+ * Returns the install or ingest tokens for a source. Pixel sources (WebSource,
56
+ * PixelImage, HTTPApiSource) return
57
+ * `{ sourceType: "pixel", token, testToken, installScript, testInstallScript }`.
58
+ * Webhook sources (Webhook, CallRail, Formstack, Healthie, etc.) return
59
+ * `{ sourceType: "webhook", token, testToken, ingestUrl, testIngestUrl, sampleCurl }`.
60
+ * Requires scope: source:view
47
61
  */
48
62
  tokens(id: string, options?: RequestOptions): APIPromise<SourceTokensResponse> {
49
63
  return this._client.get(path`/rest/v1/sources/${id}/tokens`, options);
50
64
  }
51
65
  }
52
66
 
67
+ export type SourceListResponsesCursor = Cursor<SourceListResponse>;
68
+
53
69
  export interface SourceListResponse {
54
- entities: Array<SourceListResponse.Entity>;
55
- }
70
+ id: string;
56
71
 
57
- export namespace SourceListResponse {
58
- export interface Entity {
59
- id: string;
60
-
61
- createdAt: string;
62
-
63
- status: 'Disabled' | 'Enabled';
64
-
65
- type:
66
- | 'AlchemerWebhook'
67
- | 'AndroidNativeApi'
68
- | 'CSharpApi'
69
- | 'CalComWebhooks'
70
- | 'CalendlyWebhook'
71
- | 'CallRail'
72
- | 'CallTrackingMetrics'
73
- | 'DotNetApi'
74
- | 'FacebookLeadAds'
75
- | 'FormsortWebhooks'
76
- | 'Formstack'
77
- | 'GoLangApi'
78
- | 'HTTPApiSource'
79
- | 'Healthie'
80
- | 'HubspotAppActions'
81
- | 'HubspotFormWebhook'
82
- | 'JotFormWebhooks'
83
- | 'KotlinApi'
84
- | 'NodejsApi'
85
- | 'PHPApi'
86
- | 'PixelImage'
87
- | 'PythonApi'
88
- | 'ReactNativeApi'
89
- | 'RedirectSource'
90
- | 'RubyApi'
91
- | 'SegmentWebPlugin'
92
- | 'TypeformWebhooks'
93
- | 'WebSource'
94
- | 'Webhook'
95
- | 'WhatConverts'
96
- | 'iOSNativeApi';
97
-
98
- botControlMode?: string | null;
99
-
100
- botScoreThreshold?: number | null;
101
-
102
- excludeRequestContext?: boolean | null;
103
-
104
- name?: string | null;
105
-
106
- probabilisticIdentity?: unknown | null;
107
-
108
- projectAPIKey?: string | null;
109
-
110
- redirectUrl?: string | null;
111
-
112
- selectedAccountId?: string | null;
72
+ /**
73
+ * Organization id that owns this source.
74
+ */
75
+ accountId: string;
113
76
 
114
- /**
115
- * Limits which domains can send events to the CDP. When set, only requests from
116
- * these domains are accepted for this source. Separate from experiment settings
117
- * `whitelistDomains`, which limits which domains can load your experiments.
118
- */
119
- whitelistDomains?: Array<string> | null;
77
+ createdAt: string;
120
78
 
121
- whitelistIps?: Array<string> | null;
122
- }
79
+ status: 'Disabled' | 'Enabled';
80
+
81
+ type:
82
+ | 'AlchemerWebhook'
83
+ | 'AndroidNativeApi'
84
+ | 'CSharpApi'
85
+ | 'CalComWebhooks'
86
+ | 'CalendlyWebhook'
87
+ | 'CallRail'
88
+ | 'CallTrackingMetrics'
89
+ | 'DotNetApi'
90
+ | 'FacebookLeadAds'
91
+ | 'FormsortWebhooks'
92
+ | 'Formstack'
93
+ | 'GoLangApi'
94
+ | 'HTTPApiSource'
95
+ | 'Healthie'
96
+ | 'HubspotAppActions'
97
+ | 'HubspotFormWebhook'
98
+ | 'JotFormWebhooks'
99
+ | 'KotlinApi'
100
+ | 'NodejsApi'
101
+ | 'PHPApi'
102
+ | 'PixelImage'
103
+ | 'PythonApi'
104
+ | 'ReactNativeApi'
105
+ | 'RedirectSource'
106
+ | 'RubyApi'
107
+ | 'SegmentWebPlugin'
108
+ | 'TypeformWebhooks'
109
+ | 'WebSource'
110
+ | 'Webhook'
111
+ | 'WhatConverts'
112
+ | 'iOSNativeApi';
113
+
114
+ botControlMode?: string | null;
115
+
116
+ botScoreThreshold?: number | null;
117
+
118
+ excludeRequestContext?: boolean | null;
119
+
120
+ /**
121
+ * Whether this source exists in the currently published version. A source that is
122
+ * not published will not accept events.
123
+ */
124
+ isPublished?: boolean | null;
125
+
126
+ /**
127
+ * ISO-8601 timestamp of the most recent event from this source successfully
128
+ * dispatched to a destination.
129
+ */
130
+ lastDispatchedAt?: string | null;
131
+
132
+ /**
133
+ * ISO-8601 timestamp of the most recent inbound request received by this source.
134
+ * Useful for debugging "is my webhook even reaching us?"
135
+ */
136
+ lastTriggeredAt?: string | null;
137
+
138
+ name?: string | null;
139
+
140
+ probabilisticIdentity?: unknown | null;
141
+
142
+ projectAPIKey?: string | null;
143
+
144
+ redirectUrl?: string | null;
145
+
146
+ selectedAccountId?: string | null;
147
+
148
+ /**
149
+ * Limits which domains can send events to the CDP. When set, only requests from
150
+ * these domains are accepted for this source. Separate from experiment settings
151
+ * `whitelistDomains`, which limits which domains can load your experiments.
152
+ */
153
+ whitelistDomains?: Array<string> | null;
154
+
155
+ whitelistIps?: Array<string> | null;
123
156
  }
124
157
 
125
158
  export interface SourceCreateResponse {
126
159
  id: string;
127
160
 
161
+ /**
162
+ * Organization id that owns this source.
163
+ */
164
+ accountId: string;
165
+
128
166
  createdAt: string;
129
167
 
130
168
  status: 'Disabled' | 'Enabled';
@@ -162,12 +200,58 @@ export interface SourceCreateResponse {
162
200
  | 'WhatConverts'
163
201
  | 'iOSNativeApi';
164
202
 
203
+ botControlMode?: string | null;
204
+
205
+ botScoreThreshold?: number | null;
206
+
207
+ excludeRequestContext?: boolean | null;
208
+
209
+ /**
210
+ * Whether this source exists in the currently published version. A source that is
211
+ * not published will not accept events.
212
+ */
213
+ isPublished?: boolean | null;
214
+
215
+ /**
216
+ * ISO-8601 timestamp of the most recent event from this source successfully
217
+ * dispatched to a destination.
218
+ */
219
+ lastDispatchedAt?: string | null;
220
+
221
+ /**
222
+ * ISO-8601 timestamp of the most recent inbound request received by this source.
223
+ * Useful for debugging "is my webhook even reaching us?"
224
+ */
225
+ lastTriggeredAt?: string | null;
226
+
165
227
  name?: string | null;
228
+
229
+ probabilisticIdentity?: unknown | null;
230
+
231
+ projectAPIKey?: string | null;
232
+
233
+ redirectUrl?: string | null;
234
+
235
+ selectedAccountId?: string | null;
236
+
237
+ /**
238
+ * Limits which domains can send events to the CDP. When set, only requests from
239
+ * these domains are accepted for this source. Separate from experiment settings
240
+ * `whitelistDomains`, which limits which domains can load your experiments.
241
+ */
242
+ whitelistDomains?: Array<string> | null;
243
+
244
+ whitelistIps?: Array<string> | null;
166
245
  }
167
246
 
168
247
  export interface SourceRetrieveResponse {
169
248
  id: string;
170
249
 
250
+ /**
251
+ * Organization id that owns this source.
252
+ */
253
+ accountId: string;
254
+
171
255
  createdAt: string;
172
256
 
173
257
  status: 'Disabled' | 'Enabled';
@@ -211,6 +295,24 @@ export interface SourceRetrieveResponse {
211
295
 
212
296
  excludeRequestContext?: boolean | null;
213
297
 
298
+ /**
299
+ * Whether this source exists in the currently published version. A source that is
300
+ * not published will not accept events.
301
+ */
302
+ isPublished?: boolean | null;
303
+
304
+ /**
305
+ * ISO-8601 timestamp of the most recent event from this source successfully
306
+ * dispatched to a destination.
307
+ */
308
+ lastDispatchedAt?: string | null;
309
+
310
+ /**
311
+ * ISO-8601 timestamp of the most recent inbound request received by this source.
312
+ * Useful for debugging "is my webhook even reaching us?"
313
+ */
314
+ lastTriggeredAt?: string | null;
315
+
214
316
  name?: string | null;
215
317
 
216
318
  probabilisticIdentity?: unknown | null;
@@ -234,6 +336,11 @@ export interface SourceRetrieveResponse {
234
336
  export interface SourceUpdateResponse {
235
337
  id: string;
236
338
 
339
+ /**
340
+ * Organization id that owns this source.
341
+ */
342
+ accountId: string;
343
+
237
344
  createdAt: string;
238
345
 
239
346
  status: 'Disabled' | 'Enabled';
@@ -271,33 +378,173 @@ export interface SourceUpdateResponse {
271
378
  | 'WhatConverts'
272
379
  | 'iOSNativeApi';
273
380
 
381
+ botControlMode?: string | null;
382
+
383
+ botScoreThreshold?: number | null;
384
+
385
+ excludeRequestContext?: boolean | null;
386
+
387
+ /**
388
+ * Whether this source exists in the currently published version. A source that is
389
+ * not published will not accept events.
390
+ */
391
+ isPublished?: boolean | null;
392
+
393
+ /**
394
+ * ISO-8601 timestamp of the most recent event from this source successfully
395
+ * dispatched to a destination.
396
+ */
397
+ lastDispatchedAt?: string | null;
398
+
399
+ /**
400
+ * ISO-8601 timestamp of the most recent inbound request received by this source.
401
+ * Useful for debugging "is my webhook even reaching us?"
402
+ */
403
+ lastTriggeredAt?: string | null;
404
+
274
405
  name?: string | null;
275
- }
276
406
 
277
- export type SourceDeleteResponse = boolean;
407
+ probabilisticIdentity?: unknown | null;
408
+
409
+ projectAPIKey?: string | null;
410
+
411
+ redirectUrl?: string | null;
412
+
413
+ selectedAccountId?: string | null;
278
414
 
279
- export interface SourceTokensResponse {
280
415
  /**
281
- * Install token for the source.
416
+ * Limits which domains can send events to the CDP. When set, only requests from
417
+ * these domains are accepted for this source. Separate from experiment settings
418
+ * `whitelistDomains`, which limits which domains can load your experiments.
282
419
  */
283
- token: string;
420
+ whitelistDomains?: Array<string> | null;
421
+
422
+ whitelistIps?: Array<string> | null;
423
+ }
424
+
425
+ export interface SourceDeleteResponse {
426
+ deleted: true;
427
+ }
428
+
429
+ /**
430
+ * Token data for the source. The `sourceType` field discriminates between pixel
431
+ * sources (web / PixelImage) which return an `installScript`, and webhook sources
432
+ * which return an `ingestUrl` and `sampleCurl` instead. Pixel sources use
433
+ * `installScript` / `testInstallScript` to add the tracking pixel to a website.
434
+ * Webhook sources POST JSON to `ingestUrl` directly.
435
+ */
436
+ export type SourceTokensResponse = SourceTokensResponse.UnionMember0 | SourceTokensResponse.UnionMember1;
437
+
438
+ export namespace SourceTokensResponse {
439
+ export interface UnionMember0 {
440
+ /**
441
+ * Install token for the source.
442
+ */
443
+ token: string;
444
+
445
+ /**
446
+ * Ready-to-paste install snippet for the production token, including linked
447
+ * runtime tokens for supported modules.
448
+ */
449
+ installScript: string;
450
+
451
+ /**
452
+ * Discriminator: this is a pixel/web source.
453
+ */
454
+ sourceType: 'pixel';
455
+
456
+ /**
457
+ * Ready-to-paste install snippet for the test token, suitable for validation
458
+ * before a live install.
459
+ */
460
+ testInstallScript: string;
461
+
462
+ /**
463
+ * Test-mode token derived from `token`.
464
+ */
465
+ testToken: string;
466
+ }
467
+
468
+ export interface UnionMember1 {
469
+ /**
470
+ * Source token (the source id).
471
+ */
472
+ token: string;
473
+
474
+ /**
475
+ * Production ingest URL for the webhook source.
476
+ */
477
+ ingestUrl: string;
478
+
479
+ /**
480
+ * Example curl command showing how to POST a sample event to the ingest URL. Copy
481
+ * and run to verify connectivity.
482
+ */
483
+ sampleCurl: string;
484
+
485
+ /**
486
+ * Discriminator: this is a webhook source.
487
+ */
488
+ sourceType: 'webhook';
284
489
 
490
+ /**
491
+ * Test-mode ingest URL.
492
+ */
493
+ testIngestUrl: string;
494
+
495
+ /**
496
+ * Test-mode token derived from `token`.
497
+ */
498
+ testToken: string;
499
+ }
500
+ }
501
+
502
+ export interface SourceListParams extends CursorParams {
285
503
  /**
286
- * Ready-to-paste install snippet for the production token, including linked
287
- * runtime tokens for supported modules.
504
+ * Case-insensitive substring filter on the source name.
288
505
  */
289
- installScript: string;
506
+ nameContains?: string;
290
507
 
291
508
  /**
292
- * Ready-to-paste install snippet for the test token, suitable for validation
293
- * before a live install.
509
+ * Filter by source status.
294
510
  */
295
- testInstallScript: string;
511
+ status?: 'Disabled' | 'Enabled';
296
512
 
297
513
  /**
298
- * Test-mode token derived from `token`.
514
+ * Filter by source type.
299
515
  */
300
- testToken: string;
516
+ type?:
517
+ | 'AlchemerWebhook'
518
+ | 'AndroidNativeApi'
519
+ | 'CSharpApi'
520
+ | 'CalComWebhooks'
521
+ | 'CalendlyWebhook'
522
+ | 'CallRail'
523
+ | 'CallTrackingMetrics'
524
+ | 'DotNetApi'
525
+ | 'FacebookLeadAds'
526
+ | 'FormsortWebhooks'
527
+ | 'Formstack'
528
+ | 'GoLangApi'
529
+ | 'HTTPApiSource'
530
+ | 'Healthie'
531
+ | 'HubspotAppActions'
532
+ | 'HubspotFormWebhook'
533
+ | 'JotFormWebhooks'
534
+ | 'KotlinApi'
535
+ | 'NodejsApi'
536
+ | 'PHPApi'
537
+ | 'PixelImage'
538
+ | 'PythonApi'
539
+ | 'ReactNativeApi'
540
+ | 'RedirectSource'
541
+ | 'RubyApi'
542
+ | 'SegmentWebPlugin'
543
+ | 'TypeformWebhooks'
544
+ | 'WebSource'
545
+ | 'Webhook'
546
+ | 'WhatConverts'
547
+ | 'iOSNativeApi';
301
548
  }
302
549
 
303
550
  export interface SourceCreateParams {
@@ -338,8 +585,6 @@ export interface SourceCreateParams {
338
585
  }
339
586
 
340
587
  export interface SourceUpdateParams {
341
- status: 'Disabled' | 'Enabled';
342
-
343
588
  botControlMode?: string | null;
344
589
 
345
590
  botScoreThreshold?: number | null;
@@ -356,6 +601,8 @@ export interface SourceUpdateParams {
356
601
 
357
602
  selectedAccountId?: string | null;
358
603
 
604
+ status?: string | null;
605
+
359
606
  whitelistDomains?: Array<string> | null;
360
607
 
361
608
  whitelistIps?: Array<string> | null;
@@ -369,6 +616,8 @@ export declare namespace Sources {
369
616
  type SourceUpdateResponse as SourceUpdateResponse,
370
617
  type SourceDeleteResponse as SourceDeleteResponse,
371
618
  type SourceTokensResponse as SourceTokensResponse,
619
+ type SourceListResponsesCursor as SourceListResponsesCursor,
620
+ type SourceListParams as SourceListParams,
372
621
  type SourceCreateParams as SourceCreateParams,
373
622
  type SourceUpdateParams as SourceUpdateParams,
374
623
  };
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.23.0'; // x-release-please-version
1
+ export const VERSION = '1.24.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.23.0";
1
+ export declare const VERSION = "1.24.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.23.0";
1
+ export declare const VERSION = "1.24.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.23.0'; // x-release-please-version
4
+ exports.VERSION = '1.24.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.23.0'; // x-release-please-version
1
+ export const VERSION = '1.24.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map