@browserbasehq/sdk 2.22.0 → 2.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.
@@ -0,0 +1,545 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../resource';
4
+ import * as Core from '../core';
5
+
6
+ export class NavigationPolicies extends APIResource {
7
+ /**
8
+ * Create a navigation policy for this project. Omitted fields take the defaults:
9
+ * enabled, block by default, block unknown domains, no category rules, and no
10
+ * overrides. Bind the policy to a session with `browserSettings.riskPolicyId`.
11
+ */
12
+ create(
13
+ body: NavigationPolicyCreateParams,
14
+ options?: Core.RequestOptions,
15
+ ): Core.APIPromise<NavigationPolicy> {
16
+ return this._client.post('/v1/navigation-policies', { body, ...options });
17
+ }
18
+
19
+ /**
20
+ * Retrieve a single navigation policy by ID.
21
+ */
22
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<NavigationPolicy> {
23
+ return this._client.get(`/v1/navigation-policies/${id}`, options);
24
+ }
25
+
26
+ /**
27
+ * Update a navigation policy. Omitted fields keep their values; a supplied list
28
+ * replaces the stored list rather than adding to it. The change applies to
29
+ * sessions that start afterwards; running sessions keep the policy they started
30
+ * with.
31
+ */
32
+ update(
33
+ id: string,
34
+ body: NavigationPolicyUpdateParams,
35
+ options?: Core.RequestOptions,
36
+ ): Core.APIPromise<NavigationPolicy> {
37
+ return this._client.patch(`/v1/navigation-policies/${id}`, { body, ...options });
38
+ }
39
+
40
+ /**
41
+ * List the project's navigation policies, ordered by name.
42
+ */
43
+ list(options?: Core.RequestOptions): Core.APIPromise<NavigationPolicyListResponse> {
44
+ return this._client.get('/v1/navigation-policies', options);
45
+ }
46
+
47
+ /**
48
+ * Delete a navigation policy. New sessions can no longer bind to it; running
49
+ * sessions keep the policy they started with.
50
+ */
51
+ delete(id: string, options?: Core.RequestOptions): Core.APIPromise<void> {
52
+ return this._client.delete(`/v1/navigation-policies/${id}`, {
53
+ ...options,
54
+ headers: { Accept: '*/*', ...options?.headers },
55
+ });
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Rules for which domains a browser session may navigate to. Bind a policy to a
61
+ * session with `browserSettings.riskPolicyId`; Browserbase then allows or blocks
62
+ * each navigation by the policy's overrides, its category rules, and finally its
63
+ * default decision. A session keeps the policy as it was when the session started:
64
+ * edits, disables, and deletes apply to sessions that start afterwards. A policy
65
+ * checks navigations: page loads, iframes, popups, and each redirect. It doesn't
66
+ * check requests a page makes itself, such as scripts, images, and `fetch` calls.
67
+ * In a session that loads a Context, pages skip their service workers so that the
68
+ * policy checks every navigation.
69
+ */
70
+ export interface NavigationPolicy {
71
+ /**
72
+ * Unique identifier for the navigation policy.
73
+ */
74
+ id: string;
75
+
76
+ /**
77
+ * Navigation categories. Browserbase blocks a domain in any blocked category, even
78
+ * if it is also in an allowed one.
79
+ */
80
+ allowedCategories: Array<
81
+ | 'adult'
82
+ | 'ai-tools'
83
+ | 'alcohol-tobacco'
84
+ | 'business'
85
+ | 'child-abuse'
86
+ | 'communication'
87
+ | 'dating'
88
+ | 'drugs'
89
+ | 'education'
90
+ | 'entertainment'
91
+ | 'finance'
92
+ | 'gambling'
93
+ | 'games'
94
+ | 'government-military'
95
+ | 'hacking'
96
+ | 'hate'
97
+ | 'health'
98
+ | 'illegal-activity'
99
+ | 'infrastructure'
100
+ | 'kids'
101
+ | 'lifestyle'
102
+ | 'malware'
103
+ | 'newly-registered'
104
+ | 'news'
105
+ | 'parked-inactive'
106
+ | 'phishing-scams'
107
+ | 'piracy'
108
+ | 'proxy-anonymizer'
109
+ | 'search-portal'
110
+ | 'self-harm'
111
+ | 'shopping'
112
+ | 'social-media'
113
+ | 'society-culture'
114
+ | 'sports'
115
+ | 'technology'
116
+ | 'terrorism-extremism'
117
+ | 'travel'
118
+ | 'url-shortener'
119
+ | 'violence'
120
+ | 'weapons'
121
+ >;
122
+
123
+ /**
124
+ * Navigation categories. Browserbase blocks a domain in any blocked category, even
125
+ * if it is also in an allowed one.
126
+ */
127
+ blockedCategories: Array<
128
+ | 'adult'
129
+ | 'ai-tools'
130
+ | 'alcohol-tobacco'
131
+ | 'business'
132
+ | 'child-abuse'
133
+ | 'communication'
134
+ | 'dating'
135
+ | 'drugs'
136
+ | 'education'
137
+ | 'entertainment'
138
+ | 'finance'
139
+ | 'gambling'
140
+ | 'games'
141
+ | 'government-military'
142
+ | 'hacking'
143
+ | 'hate'
144
+ | 'health'
145
+ | 'illegal-activity'
146
+ | 'infrastructure'
147
+ | 'kids'
148
+ | 'lifestyle'
149
+ | 'malware'
150
+ | 'newly-registered'
151
+ | 'news'
152
+ | 'parked-inactive'
153
+ | 'phishing-scams'
154
+ | 'piracy'
155
+ | 'proxy-anonymizer'
156
+ | 'search-portal'
157
+ | 'self-harm'
158
+ | 'shopping'
159
+ | 'social-media'
160
+ | 'society-culture'
161
+ | 'sports'
162
+ | 'technology'
163
+ | 'terrorism-extremism'
164
+ | 'travel'
165
+ | 'url-shortener'
166
+ | 'violence'
167
+ | 'weapons'
168
+ >;
169
+
170
+ createdAt: string;
171
+
172
+ /**
173
+ * Decision for each of a domain's categories that has no category rule. The
174
+ * strictest of a domain's category decisions applies, and overrides take
175
+ * precedence.
176
+ */
177
+ defaultDecision: 'allow' | 'block';
178
+
179
+ /**
180
+ * Free-form notes about the policy.
181
+ */
182
+ description: string;
183
+
184
+ /**
185
+ * Per-host decisions that take precedence over category rules and the default.
186
+ * Each host may appear once.
187
+ */
188
+ domainOverrides: Array<NavigationPolicy.DomainOverride>;
189
+
190
+ /**
191
+ * Whether the policy can be bound to new sessions. Running sessions keep the
192
+ * policy they started with. A disabled policy stays editable and can be
193
+ * re-enabled.
194
+ */
195
+ enabled: boolean;
196
+
197
+ /**
198
+ * Display name. A policy's id identifies it, not its name.
199
+ */
200
+ name: string;
201
+
202
+ /**
203
+ * The project the policy belongs to.
204
+ */
205
+ projectId: string;
206
+
207
+ /**
208
+ * Decision for a domain, or one of its categories, that Browserbase can't
209
+ * classify. It counts as one of the domain's category decisions, so the strictest
210
+ * still applies.
211
+ */
212
+ unknownDomainBehavior: 'allow' | 'block';
213
+
214
+ updatedAt: string;
215
+ }
216
+
217
+ export namespace NavigationPolicy {
218
+ export interface DomainOverride {
219
+ /**
220
+ * Decision for navigations to this host.
221
+ */
222
+ decision: 'allow' | 'block';
223
+
224
+ /**
225
+ * Host the override applies to, for example `example.com`. Matching is
226
+ * case-insensitive and covers subdomains.
227
+ */
228
+ domain: string;
229
+ }
230
+ }
231
+
232
+ /**
233
+ * The project's navigation policies.
234
+ */
235
+ export interface NavigationPolicyListResponse {
236
+ /**
237
+ * The project's navigation policies, ordered by name.
238
+ */
239
+ data: Array<NavigationPolicy>;
240
+ }
241
+
242
+ export interface NavigationPolicyCreateParams {
243
+ /**
244
+ * Display name. A policy's id identifies it, not its name.
245
+ */
246
+ name: string;
247
+
248
+ /**
249
+ * Navigation categories. Browserbase blocks a domain in any blocked category, even
250
+ * if it is also in an allowed one.
251
+ */
252
+ allowedCategories?: Array<
253
+ | 'adult'
254
+ | 'ai-tools'
255
+ | 'alcohol-tobacco'
256
+ | 'business'
257
+ | 'child-abuse'
258
+ | 'communication'
259
+ | 'dating'
260
+ | 'drugs'
261
+ | 'education'
262
+ | 'entertainment'
263
+ | 'finance'
264
+ | 'gambling'
265
+ | 'games'
266
+ | 'government-military'
267
+ | 'hacking'
268
+ | 'hate'
269
+ | 'health'
270
+ | 'illegal-activity'
271
+ | 'infrastructure'
272
+ | 'kids'
273
+ | 'lifestyle'
274
+ | 'malware'
275
+ | 'newly-registered'
276
+ | 'news'
277
+ | 'parked-inactive'
278
+ | 'phishing-scams'
279
+ | 'piracy'
280
+ | 'proxy-anonymizer'
281
+ | 'search-portal'
282
+ | 'self-harm'
283
+ | 'shopping'
284
+ | 'social-media'
285
+ | 'society-culture'
286
+ | 'sports'
287
+ | 'technology'
288
+ | 'terrorism-extremism'
289
+ | 'travel'
290
+ | 'url-shortener'
291
+ | 'violence'
292
+ | 'weapons'
293
+ >;
294
+
295
+ /**
296
+ * Navigation categories. Browserbase blocks a domain in any blocked category, even
297
+ * if it is also in an allowed one.
298
+ */
299
+ blockedCategories?: Array<
300
+ | 'adult'
301
+ | 'ai-tools'
302
+ | 'alcohol-tobacco'
303
+ | 'business'
304
+ | 'child-abuse'
305
+ | 'communication'
306
+ | 'dating'
307
+ | 'drugs'
308
+ | 'education'
309
+ | 'entertainment'
310
+ | 'finance'
311
+ | 'gambling'
312
+ | 'games'
313
+ | 'government-military'
314
+ | 'hacking'
315
+ | 'hate'
316
+ | 'health'
317
+ | 'illegal-activity'
318
+ | 'infrastructure'
319
+ | 'kids'
320
+ | 'lifestyle'
321
+ | 'malware'
322
+ | 'newly-registered'
323
+ | 'news'
324
+ | 'parked-inactive'
325
+ | 'phishing-scams'
326
+ | 'piracy'
327
+ | 'proxy-anonymizer'
328
+ | 'search-portal'
329
+ | 'self-harm'
330
+ | 'shopping'
331
+ | 'social-media'
332
+ | 'society-culture'
333
+ | 'sports'
334
+ | 'technology'
335
+ | 'terrorism-extremism'
336
+ | 'travel'
337
+ | 'url-shortener'
338
+ | 'violence'
339
+ | 'weapons'
340
+ >;
341
+
342
+ /**
343
+ * Decision for each of a domain's categories that has no category rule. The
344
+ * strictest of a domain's category decisions applies, and overrides take
345
+ * precedence.
346
+ */
347
+ defaultDecision?: 'allow' | 'block';
348
+
349
+ /**
350
+ * Free-form notes about the policy.
351
+ */
352
+ description?: string;
353
+
354
+ /**
355
+ * Per-host decisions that take precedence over category rules and the default.
356
+ * Each host may appear once.
357
+ */
358
+ domainOverrides?: Array<NavigationPolicyCreateParams.DomainOverride>;
359
+
360
+ /**
361
+ * Whether the policy can be bound to new sessions. Running sessions keep the
362
+ * policy they started with. A disabled policy stays editable and can be
363
+ * re-enabled.
364
+ */
365
+ enabled?: boolean;
366
+
367
+ /**
368
+ * Decision for a domain, or one of its categories, that Browserbase can't
369
+ * classify. It counts as one of the domain's category decisions, so the strictest
370
+ * still applies.
371
+ */
372
+ unknownDomainBehavior?: 'allow' | 'block';
373
+ }
374
+
375
+ export namespace NavigationPolicyCreateParams {
376
+ export interface DomainOverride {
377
+ /**
378
+ * Decision for navigations to this host.
379
+ */
380
+ decision: 'allow' | 'block';
381
+
382
+ /**
383
+ * Host the override applies to, for example `example.com`. Matching is
384
+ * case-insensitive and covers subdomains.
385
+ */
386
+ domain: string;
387
+ }
388
+ }
389
+
390
+ export interface NavigationPolicyUpdateParams {
391
+ /**
392
+ * Navigation categories. Browserbase blocks a domain in any blocked category, even
393
+ * if it is also in an allowed one.
394
+ */
395
+ allowedCategories?: Array<
396
+ | 'adult'
397
+ | 'ai-tools'
398
+ | 'alcohol-tobacco'
399
+ | 'business'
400
+ | 'child-abuse'
401
+ | 'communication'
402
+ | 'dating'
403
+ | 'drugs'
404
+ | 'education'
405
+ | 'entertainment'
406
+ | 'finance'
407
+ | 'gambling'
408
+ | 'games'
409
+ | 'government-military'
410
+ | 'hacking'
411
+ | 'hate'
412
+ | 'health'
413
+ | 'illegal-activity'
414
+ | 'infrastructure'
415
+ | 'kids'
416
+ | 'lifestyle'
417
+ | 'malware'
418
+ | 'newly-registered'
419
+ | 'news'
420
+ | 'parked-inactive'
421
+ | 'phishing-scams'
422
+ | 'piracy'
423
+ | 'proxy-anonymizer'
424
+ | 'search-portal'
425
+ | 'self-harm'
426
+ | 'shopping'
427
+ | 'social-media'
428
+ | 'society-culture'
429
+ | 'sports'
430
+ | 'technology'
431
+ | 'terrorism-extremism'
432
+ | 'travel'
433
+ | 'url-shortener'
434
+ | 'violence'
435
+ | 'weapons'
436
+ >;
437
+
438
+ /**
439
+ * Navigation categories. Browserbase blocks a domain in any blocked category, even
440
+ * if it is also in an allowed one.
441
+ */
442
+ blockedCategories?: Array<
443
+ | 'adult'
444
+ | 'ai-tools'
445
+ | 'alcohol-tobacco'
446
+ | 'business'
447
+ | 'child-abuse'
448
+ | 'communication'
449
+ | 'dating'
450
+ | 'drugs'
451
+ | 'education'
452
+ | 'entertainment'
453
+ | 'finance'
454
+ | 'gambling'
455
+ | 'games'
456
+ | 'government-military'
457
+ | 'hacking'
458
+ | 'hate'
459
+ | 'health'
460
+ | 'illegal-activity'
461
+ | 'infrastructure'
462
+ | 'kids'
463
+ | 'lifestyle'
464
+ | 'malware'
465
+ | 'newly-registered'
466
+ | 'news'
467
+ | 'parked-inactive'
468
+ | 'phishing-scams'
469
+ | 'piracy'
470
+ | 'proxy-anonymizer'
471
+ | 'search-portal'
472
+ | 'self-harm'
473
+ | 'shopping'
474
+ | 'social-media'
475
+ | 'society-culture'
476
+ | 'sports'
477
+ | 'technology'
478
+ | 'terrorism-extremism'
479
+ | 'travel'
480
+ | 'url-shortener'
481
+ | 'violence'
482
+ | 'weapons'
483
+ >;
484
+
485
+ /**
486
+ * Decision for each of a domain's categories that has no category rule. The
487
+ * strictest of a domain's category decisions applies, and overrides take
488
+ * precedence.
489
+ */
490
+ defaultDecision?: 'allow' | 'block';
491
+
492
+ /**
493
+ * Free-form notes about the policy.
494
+ */
495
+ description?: string;
496
+
497
+ /**
498
+ * Per-host decisions that take precedence over category rules and the default.
499
+ * Each host may appear once.
500
+ */
501
+ domainOverrides?: Array<NavigationPolicyUpdateParams.DomainOverride>;
502
+
503
+ /**
504
+ * Whether the policy can be bound to new sessions. Running sessions keep the
505
+ * policy they started with. A disabled policy stays editable and can be
506
+ * re-enabled.
507
+ */
508
+ enabled?: boolean;
509
+
510
+ /**
511
+ * Display name. A policy's id identifies it, not its name.
512
+ */
513
+ name?: string;
514
+
515
+ /**
516
+ * Decision for a domain, or one of its categories, that Browserbase can't
517
+ * classify. It counts as one of the domain's category decisions, so the strictest
518
+ * still applies.
519
+ */
520
+ unknownDomainBehavior?: 'allow' | 'block';
521
+ }
522
+
523
+ export namespace NavigationPolicyUpdateParams {
524
+ export interface DomainOverride {
525
+ /**
526
+ * Decision for navigations to this host.
527
+ */
528
+ decision: 'allow' | 'block';
529
+
530
+ /**
531
+ * Host the override applies to, for example `example.com`. Matching is
532
+ * case-insensitive and covers subdomains.
533
+ */
534
+ domain: string;
535
+ }
536
+ }
537
+
538
+ export declare namespace NavigationPolicies {
539
+ export {
540
+ type NavigationPolicy as NavigationPolicy,
541
+ type NavigationPolicyListResponse as NavigationPolicyListResponse,
542
+ type NavigationPolicyCreateParams as NavigationPolicyCreateParams,
543
+ type NavigationPolicyUpdateParams as NavigationPolicyUpdateParams,
544
+ };
545
+ }
@@ -68,7 +68,7 @@ export namespace SearchWebResponse {
68
68
  }
69
69
  }
70
70
 
71
- export type SearchWebParams = SearchWebParams.Variant0 | SearchWebParams.Variant1;
71
+ export type SearchWebParams = SearchWebParams.Variant0 | SearchWebParams.Variant1 | SearchWebParams.Variant2;
72
72
 
73
73
  export declare namespace SearchWebParams {
74
74
  export interface Variant0 {
@@ -97,21 +97,40 @@ export declare namespace SearchWebParams {
97
97
  }
98
98
 
99
99
  export interface Variant1 {
100
+ /**
101
+ * Search provider to serve this request. Omit to use the default provider for your
102
+ * project.
103
+ */
104
+ provider: 'exa';
105
+
100
106
  /**
101
107
  * The search query string
102
108
  */
103
109
  query: string;
104
110
 
111
+ /**
112
+ * The search mode used by the underlying provider.
113
+ * [Search docs](https://docs.browserbase.com/platform/search/overview) for the
114
+ * available modes and defaults.
115
+ */
116
+ mode?: 'fast' | 'deep-lite' | 'deep';
117
+
105
118
  /**
106
119
  * Number of results to return (1-25)
107
120
  */
108
121
  numResults?: number;
122
+ }
109
123
 
124
+ export interface Variant2 {
110
125
  /**
111
- * Search provider to serve this request. Omit to use the default provider for your
112
- * project.
126
+ * The search query string
127
+ */
128
+ query: string;
129
+
130
+ /**
131
+ * Number of results to return (1-25)
113
132
  */
114
- provider?: 'exa';
133
+ numResults?: number;
115
134
  }
116
135
  }
117
136
 
@@ -322,6 +322,14 @@ export namespace SessionCreateParams {
322
322
  */
323
323
  recordSession?: boolean;
324
324
 
325
+ /**
326
+ * Navigation policy to enforce for the session. Must belong to the session's
327
+ * project and be enabled. The session keeps the policy as it was when the session
328
+ * started; later edits apply to sessions that start afterwards. Browserbase
329
+ * enforces it only when navigation policy enforcement is enabled for the project.
330
+ */
331
+ riskPolicyId?: string;
332
+
325
333
  /**
326
334
  * Enable or disable captcha solving in the browser. Defaults to `true`.
327
335
  */
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '2.22.0'; // x-release-please-version
1
+ export const VERSION = '2.24.0'; // x-release-please-version
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.22.0";
1
+ export declare const VERSION = "2.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 = '2.22.0'; // x-release-please-version
4
+ exports.VERSION = '2.24.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.22.0'; // x-release-please-version
1
+ export const VERSION = '2.24.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map