@browserbasehq/sdk 2.25.0 → 2.27.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 (65) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +31 -0
  3. package/index.d.mts +12 -2
  4. package/index.d.ts +12 -2
  5. package/index.d.ts.map +1 -1
  6. package/index.js +7 -0
  7. package/index.js.map +1 -1
  8. package/index.mjs +7 -0
  9. package/index.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/pagination.d.ts +28 -0
  12. package/pagination.d.ts.map +1 -0
  13. package/pagination.js +44 -0
  14. package/pagination.js.map +1 -0
  15. package/pagination.mjs +40 -0
  16. package/pagination.mjs.map +1 -0
  17. package/resources/agents/runs.d.ts +37 -0
  18. package/resources/agents/runs.d.ts.map +1 -1
  19. package/resources/certificates.d.ts +9 -4
  20. package/resources/certificates.d.ts.map +1 -1
  21. package/resources/certificates.js +9 -4
  22. package/resources/certificates.js.map +1 -1
  23. package/resources/certificates.mjs +9 -4
  24. package/resources/certificates.mjs.map +1 -1
  25. package/resources/downloads.d.ts +90 -0
  26. package/resources/downloads.d.ts.map +1 -0
  27. package/resources/downloads.js +47 -0
  28. package/resources/downloads.js.map +1 -0
  29. package/resources/downloads.mjs +42 -0
  30. package/resources/downloads.mjs.map +1 -0
  31. package/resources/index.d.ts +3 -1
  32. package/resources/index.d.ts.map +1 -1
  33. package/resources/index.js +6 -1
  34. package/resources/index.js.map +1 -1
  35. package/resources/index.mjs +2 -0
  36. package/resources/index.mjs.map +1 -1
  37. package/resources/labels.d.ts +97 -0
  38. package/resources/labels.d.ts.map +1 -0
  39. package/resources/labels.js +38 -0
  40. package/resources/labels.js.map +1 -0
  41. package/resources/labels.mjs +34 -0
  42. package/resources/labels.mjs.map +1 -0
  43. package/resources/sessions/index.d.ts +1 -1
  44. package/resources/sessions/index.d.ts.map +1 -1
  45. package/resources/sessions/index.js.map +1 -1
  46. package/resources/sessions/index.mjs.map +1 -1
  47. package/resources/sessions/sessions.d.ts +54 -1
  48. package/resources/sessions/sessions.d.ts.map +1 -1
  49. package/resources/sessions/sessions.js +12 -5
  50. package/resources/sessions/sessions.js.map +1 -1
  51. package/resources/sessions/sessions.mjs +12 -5
  52. package/resources/sessions/sessions.mjs.map +1 -1
  53. package/src/index.ts +41 -0
  54. package/src/pagination.ts +80 -0
  55. package/src/resources/agents/runs.ts +44 -0
  56. package/src/resources/certificates.ts +9 -4
  57. package/src/resources/downloads.ts +134 -0
  58. package/src/resources/index.ts +12 -0
  59. package/src/resources/labels.ts +140 -0
  60. package/src/resources/sessions/index.ts +3 -0
  61. package/src/resources/sessions/sessions.ts +85 -2
  62. package/src/version.ts +1 -1
  63. package/version.d.ts +1 -1
  64. package/version.js +1 -1
  65. package/version.mjs +1 -1
@@ -23,9 +23,18 @@ export {
23
23
  type ContextUpdateResponse,
24
24
  type ContextCreateParams,
25
25
  } from './contexts';
26
+ export { DownloadsOffsetPage, Downloads, type Download, type DownloadListParams } from './downloads';
26
27
  export { Extensions, type Extension, type ExtensionCreateParams } from './extensions';
27
28
  export { FetchAPI, type FetchAPICreateResponse, type FetchAPICreateParams } from './fetch-api';
28
29
  export { Functions } from './functions/functions';
30
+ export {
31
+ Labels,
32
+ type Label,
33
+ type LabelListResponse,
34
+ type LabelCreateParams,
35
+ type LabelUpdateParams,
36
+ type LabelListParams,
37
+ } from './labels';
29
38
  export {
30
39
  NavigationPolicies,
31
40
  type NavigationPolicy,
@@ -51,10 +60,13 @@ export {
51
60
  type SessionCreateResponse,
52
61
  type SessionRetrieveResponse,
53
62
  type SessionListResponse,
63
+ type SessionSetLabelsResponse,
54
64
  type SessionCreateParams,
65
+ type SessionRetrieveParams,
55
66
  type SessionUpdateParams,
56
67
  type SessionListParams,
57
68
  type SessionDebugParams,
69
+ type SessionSetLabelsParams,
58
70
  } from './sessions/sessions';
59
71
  export {
60
72
  Webhooks,
@@ -0,0 +1,140 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../resource';
4
+ import { isRequestOptions } from '../core';
5
+ import * as Core from '../core';
6
+
7
+ export class Labels extends APIResource {
8
+ /**
9
+ * Create a project-owned label.
10
+ */
11
+ create(body: LabelCreateParams, options?: Core.RequestOptions): Core.APIPromise<Label> {
12
+ return this._client.post('/v1/labels', { body, ...options });
13
+ }
14
+
15
+ /**
16
+ * Rename a label, preserving its ID, creation time, and session assignments.
17
+ */
18
+ update(labelId: string, body: LabelUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Label> {
19
+ return this._client.patch(`/v1/labels/${labelId}`, { body, ...options });
20
+ }
21
+
22
+ /**
23
+ * List the project's labels, newest first. Page by passing the previous response's
24
+ * `nextCursor` as `cursor`; a null `nextCursor` means there are no further pages.
25
+ */
26
+ list(query?: LabelListParams, options?: Core.RequestOptions): Core.APIPromise<LabelListResponse>;
27
+ list(options?: Core.RequestOptions): Core.APIPromise<LabelListResponse>;
28
+ list(
29
+ query: LabelListParams | Core.RequestOptions = {},
30
+ options?: Core.RequestOptions,
31
+ ): Core.APIPromise<LabelListResponse> {
32
+ if (isRequestOptions(query)) {
33
+ return this.list({}, query);
34
+ }
35
+ return this._client.get('/v1/labels', { query, ...options });
36
+ }
37
+
38
+ /**
39
+ * Delete a label and its session assignments, preserving the sessions. Missing and
40
+ * other-project labels are successful no-ops.
41
+ */
42
+ delete(labelId: string, options?: Core.RequestOptions): Core.APIPromise<void> {
43
+ return this._client.delete(`/v1/labels/${labelId}`, {
44
+ ...options,
45
+ headers: { Accept: '*/*', ...options?.headers },
46
+ });
47
+ }
48
+ }
49
+
50
+ /**
51
+ * A project-owned session label.
52
+ */
53
+ export interface Label {
54
+ /**
55
+ * Stable identifier of the label.
56
+ */
57
+ id: string;
58
+
59
+ /**
60
+ * UTC timestamp when the label was created.
61
+ */
62
+ createdAt: string;
63
+
64
+ /**
65
+ * Display name, unique ignoring case within the project.
66
+ */
67
+ name: string;
68
+
69
+ /**
70
+ * The project that owns the label.
71
+ */
72
+ projectId: string;
73
+
74
+ /**
75
+ * UTC timestamp when the label was last renamed.
76
+ */
77
+ updatedAt: string;
78
+ }
79
+
80
+ /**
81
+ * A page of labels.
82
+ */
83
+ export interface LabelListResponse {
84
+ /**
85
+ * The page of matching labels.
86
+ */
87
+ data: Array<Label>;
88
+
89
+ /**
90
+ * The maximum number of results returned in this page.
91
+ */
92
+ limit: number;
93
+
94
+ /**
95
+ * Cursor for the next page. Pass it back as `cursor` on the next request to
96
+ * continue paging. null when there are no more results.
97
+ */
98
+ nextCursor: string | null;
99
+ }
100
+
101
+ export interface LabelCreateParams {
102
+ /**
103
+ * Label name. Browserbase trims surrounding Unicode whitespace and preserves
104
+ * display capitalization. The trimmed name must contain 1–128 Unicode characters
105
+ * and no NUL characters. Names are unique ignoring case within the project.
106
+ */
107
+ name: string;
108
+ }
109
+
110
+ export interface LabelUpdateParams {
111
+ /**
112
+ * Label name. Browserbase trims surrounding Unicode whitespace and preserves
113
+ * display capitalization. The trimmed name must contain 1–128 Unicode characters
114
+ * and no NUL characters. Names are unique ignoring case within the project.
115
+ */
116
+ name: string;
117
+ }
118
+
119
+ export interface LabelListParams {
120
+ /**
121
+ * Pagination cursor. Pass the nextCursor from the previous response to fetch the
122
+ * next page. Omit to start from the first page.
123
+ */
124
+ cursor?: string;
125
+
126
+ /**
127
+ * Maximum number of results to return.
128
+ */
129
+ limit?: number;
130
+ }
131
+
132
+ export declare namespace Labels {
133
+ export {
134
+ type Label as Label,
135
+ type LabelListResponse as LabelListResponse,
136
+ type LabelCreateParams as LabelCreateParams,
137
+ type LabelUpdateParams as LabelUpdateParams,
138
+ type LabelListParams as LabelListParams,
139
+ };
140
+ }
@@ -11,9 +11,12 @@ export {
11
11
  type SessionCreateResponse,
12
12
  type SessionRetrieveResponse,
13
13
  type SessionListResponse,
14
+ type SessionSetLabelsResponse,
14
15
  type SessionCreateParams,
16
+ type SessionRetrieveParams,
15
17
  type SessionUpdateParams,
16
18
  type SessionListParams,
17
19
  type SessionDebugParams,
20
+ type SessionSetLabelsParams,
18
21
  } from './sessions';
19
22
  export { Uploads, type UploadCreateResponse, type UploadCreateParams } from './uploads';
@@ -3,6 +3,7 @@
3
3
  import { APIResource } from '../../resource';
4
4
  import { isRequestOptions } from '../../core';
5
5
  import * as Core from '../../core';
6
+ import * as LabelsAPI from '../labels';
6
7
  import * as DownloadsAPI from './downloads';
7
8
  import { Downloads } from './downloads';
8
9
  import * as LogsAPI from './logs';
@@ -40,8 +41,21 @@ export class Sessions extends APIResource {
40
41
  /**
41
42
  * Get a Session
42
43
  */
43
- retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<SessionRetrieveResponse> {
44
- return this._client.get(`/v1/sessions/${id}`, options);
44
+ retrieve(
45
+ id: string,
46
+ query?: SessionRetrieveParams,
47
+ options?: Core.RequestOptions,
48
+ ): Core.APIPromise<SessionRetrieveResponse>;
49
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<SessionRetrieveResponse>;
50
+ retrieve(
51
+ id: string,
52
+ query: SessionRetrieveParams | Core.RequestOptions = {},
53
+ options?: Core.RequestOptions,
54
+ ): Core.APIPromise<SessionRetrieveResponse> {
55
+ if (isRequestOptions(query)) {
56
+ return this.retrieve(id, {}, query);
57
+ }
58
+ return this._client.get(`/v1/sessions/${id}`, { query, ...options });
45
59
  }
46
60
 
47
61
  /**
@@ -85,6 +99,18 @@ export class Sessions extends APIResource {
85
99
  }
86
100
  return this._client.get(`/v1/sessions/${id}/debug`, { query, ...options });
87
101
  }
102
+
103
+ /**
104
+ * Atomically replace a session's labels. Returns the response after the assignment
105
+ * commits.
106
+ */
107
+ setLabels(
108
+ id: string,
109
+ body: SessionSetLabelsParams,
110
+ options?: Core.RequestOptions,
111
+ ): Core.APIPromise<SessionSetLabelsResponse> {
112
+ return this._client.put(`/v1/sessions/${id}/labels`, { body, ...options });
113
+ }
88
114
  }
89
115
 
90
116
  export interface Session {
@@ -183,6 +209,12 @@ export interface SessionRetrieveResponse extends Session {
183
209
  */
184
210
  connectUrl?: string;
185
211
 
212
+ /**
213
+ * Browserbase returns label IDs and current names only when includeLabels is true.
214
+ * An empty array means the session has no labels.
215
+ */
216
+ labels?: Array<SessionRetrieveResponse.Label>;
217
+
186
218
  /**
187
219
  * HTTP URL to connect to the Session.
188
220
  */
@@ -194,8 +226,29 @@ export interface SessionRetrieveResponse extends Session {
194
226
  signingKey?: string;
195
227
  }
196
228
 
229
+ export namespace SessionRetrieveResponse {
230
+ /**
231
+ * A project-owned session label.
232
+ */
233
+ export interface Label {
234
+ /**
235
+ * Stable identifier of the label.
236
+ */
237
+ id: string;
238
+
239
+ /**
240
+ * Display name, unique ignoring case within the project.
241
+ */
242
+ name: string;
243
+ }
244
+ }
245
+
197
246
  export type SessionListResponse = Array<Session>;
198
247
 
248
+ export interface SessionSetLabelsResponse {
249
+ labels: Array<LabelsAPI.Label>;
250
+ }
251
+
199
252
  export interface SessionCreateParams {
200
253
  browserSettings?: SessionCreateParams.BrowserSettings;
201
254
 
@@ -211,6 +264,12 @@ export interface SessionCreateParams {
211
264
  */
212
265
  keepAlive?: boolean;
213
266
 
267
+ /**
268
+ * Label names to assign after creation. Creates missing labels automatically.
269
+ * Assignment is best-effort and does not delay or fail session creation.
270
+ */
271
+ labels?: Array<string>;
272
+
214
273
  /**
215
274
  * The Project ID. Can be found in
216
275
  * [Settings](https://www.browserbase.com/settings). Optional - if not provided,
@@ -386,6 +445,12 @@ export namespace SessionCreateParams {
386
445
  * Geographic location for the proxy. Optional.
387
446
  */
388
447
  geolocation?: BrowserbaseProxyConfig.Geolocation;
448
+
449
+ /**
450
+ * ID of a managed static proxy assigned to your organization. Cannot be combined
451
+ * with geolocation.
452
+ */
453
+ proxyId?: string;
389
454
  }
390
455
 
391
456
  export namespace BrowserbaseProxyConfig {
@@ -462,6 +527,13 @@ export namespace SessionCreateParams {
462
527
  }
463
528
  }
464
529
 
530
+ export interface SessionRetrieveParams {
531
+ /**
532
+ * Include the session's label IDs and current names.
533
+ */
534
+ includeLabels?: boolean;
535
+ }
536
+
465
537
  export interface SessionUpdateParams {
466
538
  /**
467
539
  * Set to `REQUEST_RELEASE` to request that the session complete. Use before
@@ -496,6 +568,14 @@ export interface SessionDebugParams {
496
568
  expiresIn?: number;
497
569
  }
498
570
 
571
+ export interface SessionSetLabelsParams {
572
+ /**
573
+ * Complete replacement set of label names. Empty clears assignments; missing names
574
+ * create labels.
575
+ */
576
+ labels: Array<string>;
577
+ }
578
+
499
579
  Sessions.Downloads = Downloads;
500
580
  Sessions.Logs = Logs;
501
581
  Sessions.Recording = Recording;
@@ -509,10 +589,13 @@ export declare namespace Sessions {
509
589
  type SessionCreateResponse as SessionCreateResponse,
510
590
  type SessionRetrieveResponse as SessionRetrieveResponse,
511
591
  type SessionListResponse as SessionListResponse,
592
+ type SessionSetLabelsResponse as SessionSetLabelsResponse,
512
593
  type SessionCreateParams as SessionCreateParams,
594
+ type SessionRetrieveParams as SessionRetrieveParams,
513
595
  type SessionUpdateParams as SessionUpdateParams,
514
596
  type SessionListParams as SessionListParams,
515
597
  type SessionDebugParams as SessionDebugParams,
598
+ type SessionSetLabelsParams as SessionSetLabelsParams,
516
599
  };
517
600
 
518
601
  export { Downloads as Downloads };
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '2.25.0'; // x-release-please-version
1
+ export const VERSION = '2.27.0'; // x-release-please-version
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.25.0";
1
+ export declare const VERSION = "2.27.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.25.0'; // x-release-please-version
4
+ exports.VERSION = '2.27.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.25.0'; // x-release-please-version
1
+ export const VERSION = '2.27.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map