@browserbasehq/sdk 2.0.0 → 2.3.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.
- package/CHANGELOG.md +226 -0
- package/LICENSE +1 -1
- package/README.md +26 -19
- package/core.d.ts +4 -5
- package/core.d.ts.map +1 -1
- package/core.js +28 -17
- package/core.js.map +1 -1
- package/core.mjs +28 -17
- package/core.mjs.map +1 -1
- package/error.d.ts +18 -24
- package/error.d.ts.map +1 -1
- package/error.js +1 -31
- package/error.js.map +1 -1
- package/error.mjs +1 -31
- package/error.mjs.map +1 -1
- package/index.d.mts +18 -31
- package/index.d.ts +18 -31
- package/index.d.ts.map +1 -1
- package/index.js +27 -11
- package/index.js.map +1 -1
- package/index.mjs +11 -10
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/contexts.d.ts +1 -5
- package/resources/contexts.d.ts.map +1 -1
- package/resources/contexts.js +0 -2
- package/resources/contexts.js.map +1 -1
- package/resources/contexts.mjs +0 -2
- package/resources/contexts.mjs.map +1 -1
- package/resources/extensions.d.ts +1 -3
- package/resources/extensions.d.ts.map +1 -1
- package/resources/extensions.js +0 -2
- package/resources/extensions.js.map +1 -1
- package/resources/extensions.mjs +0 -2
- package/resources/extensions.mjs.map +1 -1
- package/resources/index.d.ts +4 -4
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/projects.d.ts +2 -5
- package/resources/projects.d.ts.map +1 -1
- package/resources/projects.js +1 -3
- package/resources/projects.js.map +1 -1
- package/resources/projects.mjs +1 -3
- package/resources/projects.mjs.map +1 -1
- package/resources/sessions/downloads.d.ts.map +1 -1
- package/resources/sessions/downloads.js +5 -1
- package/resources/sessions/downloads.js.map +1 -1
- package/resources/sessions/downloads.mjs +5 -1
- package/resources/sessions/downloads.mjs.map +1 -1
- package/resources/sessions/index.d.ts +4 -4
- package/resources/sessions/index.d.ts.map +1 -1
- package/resources/sessions/index.js +3 -3
- package/resources/sessions/index.js.map +1 -1
- package/resources/sessions/index.mjs +1 -1
- package/resources/sessions/index.mjs.map +1 -1
- package/resources/sessions/logs.d.ts +7 -10
- package/resources/sessions/logs.d.ts.map +1 -1
- package/resources/sessions/logs.js +0 -2
- package/resources/sessions/logs.js.map +1 -1
- package/resources/sessions/logs.mjs +0 -2
- package/resources/sessions/logs.mjs.map +1 -1
- package/resources/sessions/recording.d.ts +1 -4
- package/resources/sessions/recording.d.ts.map +1 -1
- package/resources/sessions/recording.js +0 -2
- package/resources/sessions/recording.js.map +1 -1
- package/resources/sessions/recording.mjs +0 -2
- package/resources/sessions/recording.mjs.map +1 -1
- package/resources/sessions/sessions.d.ts +34 -18
- package/resources/sessions/sessions.d.ts.map +1 -1
- package/resources/sessions/sessions.js +8 -6
- package/resources/sessions/sessions.js.map +1 -1
- package/resources/sessions/sessions.mjs +8 -6
- package/resources/sessions/sessions.mjs.map +1 -1
- package/resources/sessions/uploads.d.ts +1 -3
- package/resources/sessions/uploads.d.ts.map +1 -1
- package/resources/sessions/uploads.js +0 -2
- package/resources/sessions/uploads.js.map +1 -1
- package/resources/sessions/uploads.mjs +0 -2
- package/resources/sessions/uploads.mjs.map +1 -1
- package/src/core.ts +37 -25
- package/src/error.ts +25 -41
- package/src/index.ts +69 -40
- package/src/resources/contexts.ts +7 -6
- package/src/resources/extensions.ts +2 -4
- package/src/resources/index.ts +13 -13
- package/src/resources/projects.ts +7 -6
- package/src/resources/sessions/downloads.ts +5 -1
- package/src/resources/sessions/index.ts +10 -10
- package/src/resources/sessions/logs.ts +9 -13
- package/src/resources/sessions/recording.ts +5 -6
- package/src/resources/sessions/sessions.ts +65 -19
- package/src/resources/sessions/uploads.ts +2 -4
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/core.ts
CHANGED
|
@@ -163,7 +163,7 @@ export abstract class APIClient {
|
|
|
163
163
|
maxRetries = 2,
|
|
164
164
|
timeout = 60000, // 1 minute
|
|
165
165
|
httpAgent,
|
|
166
|
-
fetch:
|
|
166
|
+
fetch: overriddenFetch,
|
|
167
167
|
}: {
|
|
168
168
|
baseURL: string;
|
|
169
169
|
maxRetries?: number | undefined;
|
|
@@ -176,7 +176,7 @@ export abstract class APIClient {
|
|
|
176
176
|
this.timeout = validatePositiveInteger('timeout', timeout);
|
|
177
177
|
this.httpAgent = httpAgent;
|
|
178
178
|
|
|
179
|
-
this.fetch =
|
|
179
|
+
this.fetch = overriddenFetch ?? fetch;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
protected authHeaders(opts: FinalRequestOptions): Headers {
|
|
@@ -280,6 +280,7 @@ export abstract class APIClient {
|
|
|
280
280
|
options: FinalRequestOptions<Req>,
|
|
281
281
|
{ retryCount = 0 }: { retryCount?: number } = {},
|
|
282
282
|
): { req: RequestInit; url: string; timeout: number } {
|
|
283
|
+
options = { ...options };
|
|
283
284
|
const { method, path, query, headers: headers = {} } = options;
|
|
284
285
|
|
|
285
286
|
const body =
|
|
@@ -292,9 +293,9 @@ export abstract class APIClient {
|
|
|
292
293
|
|
|
293
294
|
const url = this.buildURL(path!, query);
|
|
294
295
|
if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
|
|
295
|
-
|
|
296
|
+
options.timeout = options.timeout ?? this.timeout;
|
|
296
297
|
const httpAgent = options.httpAgent ?? this.httpAgent ?? getDefaultAgent(url);
|
|
297
|
-
const minAgentTimeout = timeout + 1000;
|
|
298
|
+
const minAgentTimeout = options.timeout + 1000;
|
|
298
299
|
if (
|
|
299
300
|
typeof (httpAgent as any)?.options?.timeout === 'number' &&
|
|
300
301
|
minAgentTimeout > ((httpAgent as any).options.timeout ?? 0)
|
|
@@ -323,7 +324,7 @@ export abstract class APIClient {
|
|
|
323
324
|
signal: options.signal ?? null,
|
|
324
325
|
};
|
|
325
326
|
|
|
326
|
-
return { req, url, timeout };
|
|
327
|
+
return { req, url, timeout: options.timeout };
|
|
327
328
|
}
|
|
328
329
|
|
|
329
330
|
private buildHeaders({
|
|
@@ -351,15 +352,22 @@ export abstract class APIClient {
|
|
|
351
352
|
delete reqHeaders['content-type'];
|
|
352
353
|
}
|
|
353
354
|
|
|
354
|
-
// Don't set
|
|
355
|
-
//
|
|
356
|
-
//
|
|
355
|
+
// Don't set theses headers if they were already set or removed through default headers or by the caller.
|
|
356
|
+
// We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to account
|
|
357
|
+
// for the removal case.
|
|
357
358
|
if (
|
|
358
359
|
getHeader(defaultHeaders, 'x-stainless-retry-count') === undefined &&
|
|
359
360
|
getHeader(headers, 'x-stainless-retry-count') === undefined
|
|
360
361
|
) {
|
|
361
362
|
reqHeaders['x-stainless-retry-count'] = String(retryCount);
|
|
362
363
|
}
|
|
364
|
+
if (
|
|
365
|
+
getHeader(defaultHeaders, 'x-stainless-timeout') === undefined &&
|
|
366
|
+
getHeader(headers, 'x-stainless-timeout') === undefined &&
|
|
367
|
+
options.timeout
|
|
368
|
+
) {
|
|
369
|
+
reqHeaders['x-stainless-timeout'] = String(options.timeout);
|
|
370
|
+
}
|
|
363
371
|
|
|
364
372
|
this.validateHeaders(reqHeaders, headers);
|
|
365
373
|
|
|
@@ -396,7 +404,7 @@ export abstract class APIClient {
|
|
|
396
404
|
error: Object | undefined,
|
|
397
405
|
message: string | undefined,
|
|
398
406
|
headers: Headers | undefined,
|
|
399
|
-
) {
|
|
407
|
+
): APIError {
|
|
400
408
|
return APIError.generate(status, error, message, headers);
|
|
401
409
|
}
|
|
402
410
|
|
|
@@ -522,20 +530,24 @@ export abstract class APIClient {
|
|
|
522
530
|
|
|
523
531
|
const timeout = setTimeout(() => controller.abort(), ms);
|
|
524
532
|
|
|
533
|
+
const fetchOptions = {
|
|
534
|
+
signal: controller.signal as any,
|
|
535
|
+
...options,
|
|
536
|
+
};
|
|
537
|
+
if (fetchOptions.method) {
|
|
538
|
+
// Custom methods like 'patch' need to be uppercased
|
|
539
|
+
// See https://github.com/nodejs/undici/issues/2294
|
|
540
|
+
fetchOptions.method = fetchOptions.method.toUpperCase();
|
|
541
|
+
}
|
|
542
|
+
|
|
525
543
|
return (
|
|
526
|
-
this
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
clearTimeout(timeout);
|
|
531
|
-
})
|
|
544
|
+
// use undefined this binding; fetch errors if bound to something else in browser/cloudflare
|
|
545
|
+
this.fetch.call(undefined, url, fetchOptions).finally(() => {
|
|
546
|
+
clearTimeout(timeout);
|
|
547
|
+
})
|
|
532
548
|
);
|
|
533
549
|
}
|
|
534
550
|
|
|
535
|
-
protected getRequestClient(): RequestClient {
|
|
536
|
-
return { fetch: this.fetch };
|
|
537
|
-
}
|
|
538
|
-
|
|
539
551
|
private shouldRetry(response: Response): boolean {
|
|
540
552
|
// Note this is not a standard header.
|
|
541
553
|
const shouldRetryHeader = response.headers.get('x-should-retry');
|
|
@@ -668,9 +680,9 @@ export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
|
|
|
668
680
|
return await this.#client.requestAPIList(this.constructor as any, nextOptions);
|
|
669
681
|
}
|
|
670
682
|
|
|
671
|
-
async *iterPages() {
|
|
683
|
+
async *iterPages(): AsyncGenerator<this> {
|
|
672
684
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
673
|
-
let page:
|
|
685
|
+
let page: this = this;
|
|
674
686
|
yield page;
|
|
675
687
|
while (page.hasNextPage()) {
|
|
676
688
|
page = await page.getNextPage();
|
|
@@ -678,7 +690,7 @@ export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
|
|
|
678
690
|
}
|
|
679
691
|
}
|
|
680
692
|
|
|
681
|
-
async *[Symbol.asyncIterator]() {
|
|
693
|
+
async *[Symbol.asyncIterator](): AsyncGenerator<Item> {
|
|
682
694
|
for await (const page of this.iterPages()) {
|
|
683
695
|
for (const item of page.getPaginatedItems()) {
|
|
684
696
|
yield item;
|
|
@@ -721,7 +733,7 @@ export class PagePromise<
|
|
|
721
733
|
* console.log(item)
|
|
722
734
|
* }
|
|
723
735
|
*/
|
|
724
|
-
async *[Symbol.asyncIterator]() {
|
|
736
|
+
async *[Symbol.asyncIterator](): AsyncGenerator<Item> {
|
|
725
737
|
const page = await this;
|
|
726
738
|
for await (const item of page) {
|
|
727
739
|
yield item;
|
|
@@ -976,8 +988,8 @@ export const safeJSON = (text: string) => {
|
|
|
976
988
|
}
|
|
977
989
|
};
|
|
978
990
|
|
|
979
|
-
// https://
|
|
980
|
-
const startsWithSchemeRegexp =
|
|
991
|
+
// https://url.spec.whatwg.org/#url-scheme-string
|
|
992
|
+
const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
|
|
981
993
|
const isAbsoluteURL = (url: string): boolean => {
|
|
982
994
|
return startsWithSchemeRegexp.test(url);
|
|
983
995
|
};
|
package/src/error.ts
CHANGED
|
@@ -4,17 +4,19 @@ import { castToError, Headers } from './core';
|
|
|
4
4
|
|
|
5
5
|
export class BrowserbaseError extends Error {}
|
|
6
6
|
|
|
7
|
-
export class APIError
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
export class APIError<
|
|
8
|
+
TStatus extends number | undefined = number | undefined,
|
|
9
|
+
THeaders extends Headers | undefined = Headers | undefined,
|
|
10
|
+
TError extends Object | undefined = Object | undefined,
|
|
11
|
+
> extends BrowserbaseError {
|
|
12
|
+
/** HTTP status for the response that caused the error */
|
|
13
|
+
readonly status: TStatus;
|
|
14
|
+
/** HTTP headers for the response that caused the error */
|
|
15
|
+
readonly headers: THeaders;
|
|
16
|
+
/** JSON body of the response that caused the error */
|
|
17
|
+
readonly error: TError;
|
|
18
|
+
|
|
19
|
+
constructor(status: TStatus, error: TError, message: string | undefined, headers: THeaders) {
|
|
18
20
|
super(`${APIError.makeMessage(status, error, message)}`);
|
|
19
21
|
this.status = status;
|
|
20
22
|
this.headers = headers;
|
|
@@ -47,8 +49,8 @@ export class APIError extends BrowserbaseError {
|
|
|
47
49
|
errorResponse: Object | undefined,
|
|
48
50
|
message: string | undefined,
|
|
49
51
|
headers: Headers | undefined,
|
|
50
|
-
) {
|
|
51
|
-
if (!status) {
|
|
52
|
+
): APIError {
|
|
53
|
+
if (!status || !headers) {
|
|
52
54
|
return new APIConnectionError({ message, cause: castToError(errorResponse) });
|
|
53
55
|
}
|
|
54
56
|
|
|
@@ -90,17 +92,13 @@ export class APIError extends BrowserbaseError {
|
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
94
|
|
|
93
|
-
export class APIUserAbortError extends APIError {
|
|
94
|
-
override readonly status: undefined = undefined;
|
|
95
|
-
|
|
95
|
+
export class APIUserAbortError extends APIError<undefined, undefined, undefined> {
|
|
96
96
|
constructor({ message }: { message?: string } = {}) {
|
|
97
97
|
super(undefined, undefined, message || 'Request was aborted.', undefined);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
export class APIConnectionError extends APIError {
|
|
102
|
-
override readonly status: undefined = undefined;
|
|
103
|
-
|
|
101
|
+
export class APIConnectionError extends APIError<undefined, undefined, undefined> {
|
|
104
102
|
constructor({ message, cause }: { message?: string | undefined; cause?: Error | undefined }) {
|
|
105
103
|
super(undefined, undefined, message || 'Connection error.', undefined);
|
|
106
104
|
// in some environments the 'cause' property is already declared
|
|
@@ -115,32 +113,18 @@ export class APIConnectionTimeoutError extends APIConnectionError {
|
|
|
115
113
|
}
|
|
116
114
|
}
|
|
117
115
|
|
|
118
|
-
export class BadRequestError extends APIError {
|
|
119
|
-
override readonly status: 400 = 400;
|
|
120
|
-
}
|
|
116
|
+
export class BadRequestError extends APIError<400, Headers> {}
|
|
121
117
|
|
|
122
|
-
export class AuthenticationError extends APIError {
|
|
123
|
-
override readonly status: 401 = 401;
|
|
124
|
-
}
|
|
118
|
+
export class AuthenticationError extends APIError<401, Headers> {}
|
|
125
119
|
|
|
126
|
-
export class PermissionDeniedError extends APIError {
|
|
127
|
-
override readonly status: 403 = 403;
|
|
128
|
-
}
|
|
120
|
+
export class PermissionDeniedError extends APIError<403, Headers> {}
|
|
129
121
|
|
|
130
|
-
export class NotFoundError extends APIError {
|
|
131
|
-
override readonly status: 404 = 404;
|
|
132
|
-
}
|
|
122
|
+
export class NotFoundError extends APIError<404, Headers> {}
|
|
133
123
|
|
|
134
|
-
export class ConflictError extends APIError {
|
|
135
|
-
override readonly status: 409 = 409;
|
|
136
|
-
}
|
|
124
|
+
export class ConflictError extends APIError<409, Headers> {}
|
|
137
125
|
|
|
138
|
-
export class UnprocessableEntityError extends APIError {
|
|
139
|
-
override readonly status: 422 = 422;
|
|
140
|
-
}
|
|
126
|
+
export class UnprocessableEntityError extends APIError<422, Headers> {}
|
|
141
127
|
|
|
142
|
-
export class RateLimitError extends APIError {
|
|
143
|
-
override readonly status: 429 = 429;
|
|
144
|
-
}
|
|
128
|
+
export class RateLimitError extends APIError<429, Headers> {}
|
|
145
129
|
|
|
146
|
-
export class InternalServerError extends APIError {}
|
|
130
|
+
export class InternalServerError extends APIError<number, Headers> {}
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import * as Errors from './error';
|
|
4
|
-
import * as Uploads from './uploads';
|
|
5
3
|
import { type Agent } from './_shims/index';
|
|
6
4
|
import * as Core from './core';
|
|
5
|
+
import * as Errors from './error';
|
|
6
|
+
import * as Uploads from './uploads';
|
|
7
7
|
import * as API from './resources/index';
|
|
8
|
+
import {
|
|
9
|
+
Context,
|
|
10
|
+
ContextCreateParams,
|
|
11
|
+
ContextCreateResponse,
|
|
12
|
+
ContextUpdateResponse,
|
|
13
|
+
Contexts,
|
|
14
|
+
} from './resources/contexts';
|
|
15
|
+
import { Extension, ExtensionCreateParams, Extensions } from './resources/extensions';
|
|
16
|
+
import { Project, ProjectListResponse, ProjectUsage, Projects } from './resources/projects';
|
|
17
|
+
import {
|
|
18
|
+
Session,
|
|
19
|
+
SessionCreateParams,
|
|
20
|
+
SessionCreateResponse,
|
|
21
|
+
SessionListParams,
|
|
22
|
+
SessionListResponse,
|
|
23
|
+
SessionLiveURLs,
|
|
24
|
+
SessionUpdateParams,
|
|
25
|
+
Sessions,
|
|
26
|
+
} from './resources/sessions/sessions';
|
|
8
27
|
|
|
9
28
|
export interface ClientOptions {
|
|
10
29
|
/**
|
|
@@ -26,7 +45,7 @@ export interface ClientOptions {
|
|
|
26
45
|
* Note that request timeouts are retried by default, so in a worst-case scenario you may wait
|
|
27
46
|
* much longer than this timeout before the promise succeeds or fails.
|
|
28
47
|
*/
|
|
29
|
-
timeout?: number;
|
|
48
|
+
timeout?: number | undefined;
|
|
30
49
|
|
|
31
50
|
/**
|
|
32
51
|
* An HTTP agent used to manage HTTP(S) connections.
|
|
@@ -34,7 +53,7 @@ export interface ClientOptions {
|
|
|
34
53
|
* If not provided, an agent will be constructed by default in the Node.js environment,
|
|
35
54
|
* otherwise no agent is used.
|
|
36
55
|
*/
|
|
37
|
-
httpAgent?: Agent;
|
|
56
|
+
httpAgent?: Agent | undefined;
|
|
38
57
|
|
|
39
58
|
/**
|
|
40
59
|
* Specify a custom `fetch` function implementation.
|
|
@@ -50,7 +69,7 @@ export interface ClientOptions {
|
|
|
50
69
|
*
|
|
51
70
|
* @default 2
|
|
52
71
|
*/
|
|
53
|
-
maxRetries?: number;
|
|
72
|
+
maxRetries?: number | undefined;
|
|
54
73
|
|
|
55
74
|
/**
|
|
56
75
|
* Default headers to include with every request to the API.
|
|
@@ -58,7 +77,7 @@ export interface ClientOptions {
|
|
|
58
77
|
* These can be removed in individual requests by explicitly setting the
|
|
59
78
|
* header to `undefined` or `null` in request options.
|
|
60
79
|
*/
|
|
61
|
-
defaultHeaders?: Core.Headers;
|
|
80
|
+
defaultHeaders?: Core.Headers | undefined;
|
|
62
81
|
|
|
63
82
|
/**
|
|
64
83
|
* Default query parameters to include with every request to the API.
|
|
@@ -66,7 +85,7 @@ export interface ClientOptions {
|
|
|
66
85
|
* These can be removed in individual requests by explicitly setting the
|
|
67
86
|
* param to `undefined` in request options.
|
|
68
87
|
*/
|
|
69
|
-
defaultQuery?: Core.DefaultQuery;
|
|
88
|
+
defaultQuery?: Core.DefaultQuery | undefined;
|
|
70
89
|
}
|
|
71
90
|
|
|
72
91
|
/**
|
|
@@ -160,7 +179,48 @@ export class Browserbase extends Core.APIClient {
|
|
|
160
179
|
static fileFromPath = Uploads.fileFromPath;
|
|
161
180
|
}
|
|
162
181
|
|
|
163
|
-
|
|
182
|
+
Browserbase.Contexts = Contexts;
|
|
183
|
+
Browserbase.Extensions = Extensions;
|
|
184
|
+
Browserbase.Projects = Projects;
|
|
185
|
+
Browserbase.Sessions = Sessions;
|
|
186
|
+
export declare namespace Browserbase {
|
|
187
|
+
export type RequestOptions = Core.RequestOptions;
|
|
188
|
+
|
|
189
|
+
export {
|
|
190
|
+
Contexts as Contexts,
|
|
191
|
+
type Context as Context,
|
|
192
|
+
type ContextCreateResponse as ContextCreateResponse,
|
|
193
|
+
type ContextUpdateResponse as ContextUpdateResponse,
|
|
194
|
+
type ContextCreateParams as ContextCreateParams,
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export {
|
|
198
|
+
Extensions as Extensions,
|
|
199
|
+
type Extension as Extension,
|
|
200
|
+
type ExtensionCreateParams as ExtensionCreateParams,
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export {
|
|
204
|
+
Projects as Projects,
|
|
205
|
+
type Project as Project,
|
|
206
|
+
type ProjectUsage as ProjectUsage,
|
|
207
|
+
type ProjectListResponse as ProjectListResponse,
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export {
|
|
211
|
+
Sessions as Sessions,
|
|
212
|
+
type Session as Session,
|
|
213
|
+
type SessionLiveURLs as SessionLiveURLs,
|
|
214
|
+
type SessionCreateResponse as SessionCreateResponse,
|
|
215
|
+
type SessionListResponse as SessionListResponse,
|
|
216
|
+
type SessionCreateParams as SessionCreateParams,
|
|
217
|
+
type SessionUpdateParams as SessionUpdateParams,
|
|
218
|
+
type SessionListParams as SessionListParams,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export { toFile, fileFromPath } from './uploads';
|
|
223
|
+
export {
|
|
164
224
|
BrowserbaseError,
|
|
165
225
|
APIError,
|
|
166
226
|
APIConnectionError,
|
|
@@ -174,37 +234,6 @@ export const {
|
|
|
174
234
|
InternalServerError,
|
|
175
235
|
PermissionDeniedError,
|
|
176
236
|
UnprocessableEntityError,
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export import toFile = Uploads.toFile;
|
|
180
|
-
export import fileFromPath = Uploads.fileFromPath;
|
|
181
|
-
|
|
182
|
-
export namespace Browserbase {
|
|
183
|
-
export import RequestOptions = Core.RequestOptions;
|
|
184
|
-
|
|
185
|
-
export import Contexts = API.Contexts;
|
|
186
|
-
export import Context = API.Context;
|
|
187
|
-
export import ContextCreateResponse = API.ContextCreateResponse;
|
|
188
|
-
export import ContextUpdateResponse = API.ContextUpdateResponse;
|
|
189
|
-
export import ContextCreateParams = API.ContextCreateParams;
|
|
190
|
-
|
|
191
|
-
export import Extensions = API.Extensions;
|
|
192
|
-
export import Extension = API.Extension;
|
|
193
|
-
export import ExtensionCreateParams = API.ExtensionCreateParams;
|
|
194
|
-
|
|
195
|
-
export import Projects = API.Projects;
|
|
196
|
-
export import Project = API.Project;
|
|
197
|
-
export import ProjectUsage = API.ProjectUsage;
|
|
198
|
-
export import ProjectListResponse = API.ProjectListResponse;
|
|
199
|
-
|
|
200
|
-
export import Sessions = API.Sessions;
|
|
201
|
-
export import Session = API.Session;
|
|
202
|
-
export import SessionLiveURLs = API.SessionLiveURLs;
|
|
203
|
-
export import SessionCreateResponse = API.SessionCreateResponse;
|
|
204
|
-
export import SessionListResponse = API.SessionListResponse;
|
|
205
|
-
export import SessionCreateParams = API.SessionCreateParams;
|
|
206
|
-
export import SessionUpdateParams = API.SessionUpdateParams;
|
|
207
|
-
export import SessionListParams = API.SessionListParams;
|
|
208
|
-
}
|
|
237
|
+
} from './error';
|
|
209
238
|
|
|
210
239
|
export default Browserbase;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../resource';
|
|
4
4
|
import * as Core from '../core';
|
|
5
|
-
import * as ContextsAPI from './contexts';
|
|
6
5
|
|
|
7
6
|
export class Contexts extends APIResource {
|
|
8
7
|
/**
|
|
@@ -100,9 +99,11 @@ export interface ContextCreateParams {
|
|
|
100
99
|
projectId: string;
|
|
101
100
|
}
|
|
102
101
|
|
|
103
|
-
export namespace Contexts {
|
|
104
|
-
export
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
export declare namespace Contexts {
|
|
103
|
+
export {
|
|
104
|
+
type Context as Context,
|
|
105
|
+
type ContextCreateResponse as ContextCreateResponse,
|
|
106
|
+
type ContextUpdateResponse as ContextUpdateResponse,
|
|
107
|
+
type ContextCreateParams as ContextCreateParams,
|
|
108
|
+
};
|
|
108
109
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../resource';
|
|
4
4
|
import * as Core from '../core';
|
|
5
|
-
import * as ExtensionsAPI from './extensions';
|
|
6
5
|
|
|
7
6
|
export class Extensions extends APIResource {
|
|
8
7
|
/**
|
|
@@ -49,7 +48,6 @@ export interface ExtensionCreateParams {
|
|
|
49
48
|
file: Core.Uploadable;
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
export namespace Extensions {
|
|
53
|
-
export
|
|
54
|
-
export import ExtensionCreateParams = ExtensionsAPI.ExtensionCreateParams;
|
|
51
|
+
export declare namespace Extensions {
|
|
52
|
+
export { type Extension as Extension, type ExtensionCreateParams as ExtensionCreateParams };
|
|
55
53
|
}
|
package/src/resources/index.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
export {
|
|
4
|
-
Context,
|
|
5
|
-
ContextCreateResponse,
|
|
6
|
-
ContextUpdateResponse,
|
|
7
|
-
ContextCreateParams,
|
|
8
4
|
Contexts,
|
|
5
|
+
type Context,
|
|
6
|
+
type ContextCreateResponse,
|
|
7
|
+
type ContextUpdateResponse,
|
|
8
|
+
type ContextCreateParams,
|
|
9
9
|
} from './contexts';
|
|
10
|
-
export { Extension, ExtensionCreateParams
|
|
11
|
-
export { Project, ProjectUsage, ProjectListResponse
|
|
10
|
+
export { Extensions, type Extension, type ExtensionCreateParams } from './extensions';
|
|
11
|
+
export { Projects, type Project, type ProjectUsage, type ProjectListResponse } from './projects';
|
|
12
12
|
export {
|
|
13
|
-
Session,
|
|
14
|
-
SessionLiveURLs,
|
|
15
|
-
SessionCreateResponse,
|
|
16
|
-
SessionListResponse,
|
|
17
|
-
SessionCreateParams,
|
|
18
|
-
SessionUpdateParams,
|
|
19
|
-
SessionListParams,
|
|
20
13
|
Sessions,
|
|
14
|
+
type Session,
|
|
15
|
+
type SessionLiveURLs,
|
|
16
|
+
type SessionCreateResponse,
|
|
17
|
+
type SessionListResponse,
|
|
18
|
+
type SessionCreateParams,
|
|
19
|
+
type SessionUpdateParams,
|
|
20
|
+
type SessionListParams,
|
|
21
21
|
} from './sessions/sessions';
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../resource';
|
|
4
4
|
import * as Core from '../core';
|
|
5
|
-
import * as ProjectsAPI from './projects';
|
|
6
5
|
|
|
7
6
|
export class Projects extends APIResource {
|
|
8
7
|
/**
|
|
@@ -13,7 +12,7 @@ export class Projects extends APIResource {
|
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
|
-
* List
|
|
15
|
+
* List projects
|
|
17
16
|
*/
|
|
18
17
|
list(options?: Core.RequestOptions): Core.APIPromise<ProjectListResponse> {
|
|
19
18
|
return this._client.get('/v1/projects', options);
|
|
@@ -49,8 +48,10 @@ export interface ProjectUsage {
|
|
|
49
48
|
|
|
50
49
|
export type ProjectListResponse = Array<Project>;
|
|
51
50
|
|
|
52
|
-
export namespace Projects {
|
|
53
|
-
export
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
export declare namespace Projects {
|
|
52
|
+
export {
|
|
53
|
+
type Project as Project,
|
|
54
|
+
type ProjectUsage as ProjectUsage,
|
|
55
|
+
type ProjectListResponse as ProjectListResponse,
|
|
56
|
+
};
|
|
56
57
|
}
|
|
@@ -9,6 +9,10 @@ export class Downloads extends APIResource {
|
|
|
9
9
|
* Session Downloads
|
|
10
10
|
*/
|
|
11
11
|
list(id: string, options?: Core.RequestOptions): Core.APIPromise<Response> {
|
|
12
|
-
return this._client.get(`/v1/sessions/${id}/downloads`, {
|
|
12
|
+
return this._client.get(`/v1/sessions/${id}/downloads`, {
|
|
13
|
+
...options,
|
|
14
|
+
headers: { Accept: 'application/zip', ...options?.headers },
|
|
15
|
+
__binaryResponse: true,
|
|
16
|
+
});
|
|
13
17
|
}
|
|
14
18
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
export { Downloads } from './downloads';
|
|
4
|
+
export { Logs, type SessionLog, type LogListResponse } from './logs';
|
|
5
|
+
export { Recording, type SessionRecording, type RecordingRetrieveResponse } from './recording';
|
|
4
6
|
export {
|
|
5
|
-
Session,
|
|
6
|
-
SessionLiveURLs,
|
|
7
|
-
SessionCreateResponse,
|
|
8
|
-
SessionListResponse,
|
|
9
|
-
SessionCreateParams,
|
|
10
|
-
SessionUpdateParams,
|
|
11
|
-
SessionListParams,
|
|
12
7
|
Sessions,
|
|
8
|
+
type Session,
|
|
9
|
+
type SessionLiveURLs,
|
|
10
|
+
type SessionCreateResponse,
|
|
11
|
+
type SessionListResponse,
|
|
12
|
+
type SessionCreateParams,
|
|
13
|
+
type SessionUpdateParams,
|
|
14
|
+
type SessionListParams,
|
|
13
15
|
} from './sessions';
|
|
14
|
-
export {
|
|
15
|
-
export { SessionRecording, RecordingRetrieveResponse, Recording } from './recording';
|
|
16
|
-
export { UploadCreateResponse, UploadCreateParams, Uploads } from './uploads';
|
|
16
|
+
export { Uploads, type UploadCreateResponse, type UploadCreateParams } from './uploads';
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../resource';
|
|
4
4
|
import * as Core from '../../core';
|
|
5
|
-
import * as LogsAPI from './logs';
|
|
6
5
|
|
|
7
6
|
export class Logs extends APIResource {
|
|
8
7
|
/**
|
|
@@ -14,19 +13,12 @@ export class Logs extends APIResource {
|
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
export interface SessionLog {
|
|
17
|
-
eventId: string;
|
|
18
|
-
|
|
19
16
|
method: string;
|
|
20
17
|
|
|
21
18
|
pageId: number;
|
|
22
19
|
|
|
23
20
|
sessionId: string;
|
|
24
21
|
|
|
25
|
-
/**
|
|
26
|
-
* milliseconds that have elapsed since the UNIX epoch
|
|
27
|
-
*/
|
|
28
|
-
timestamp: number;
|
|
29
|
-
|
|
30
22
|
frameId?: string;
|
|
31
23
|
|
|
32
24
|
loaderId?: string;
|
|
@@ -34,6 +26,11 @@ export interface SessionLog {
|
|
|
34
26
|
request?: SessionLog.Request;
|
|
35
27
|
|
|
36
28
|
response?: SessionLog.Response;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* milliseconds that have elapsed since the UNIX epoch
|
|
32
|
+
*/
|
|
33
|
+
timestamp?: number;
|
|
37
34
|
}
|
|
38
35
|
|
|
39
36
|
export namespace SessionLog {
|
|
@@ -45,7 +42,7 @@ export namespace SessionLog {
|
|
|
45
42
|
/**
|
|
46
43
|
* milliseconds that have elapsed since the UNIX epoch
|
|
47
44
|
*/
|
|
48
|
-
timestamp
|
|
45
|
+
timestamp?: number;
|
|
49
46
|
}
|
|
50
47
|
|
|
51
48
|
export interface Response {
|
|
@@ -56,13 +53,12 @@ export namespace SessionLog {
|
|
|
56
53
|
/**
|
|
57
54
|
* milliseconds that have elapsed since the UNIX epoch
|
|
58
55
|
*/
|
|
59
|
-
timestamp
|
|
56
|
+
timestamp?: number;
|
|
60
57
|
}
|
|
61
58
|
}
|
|
62
59
|
|
|
63
60
|
export type LogListResponse = Array<SessionLog>;
|
|
64
61
|
|
|
65
|
-
export namespace Logs {
|
|
66
|
-
export
|
|
67
|
-
export import LogListResponse = LogsAPI.LogListResponse;
|
|
62
|
+
export declare namespace Logs {
|
|
63
|
+
export { type SessionLog as SessionLog, type LogListResponse as LogListResponse };
|
|
68
64
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../resource';
|
|
4
4
|
import * as Core from '../../core';
|
|
5
|
-
import * as RecordingAPI from './recording';
|
|
6
5
|
|
|
7
6
|
export class Recording extends APIResource {
|
|
8
7
|
/**
|
|
@@ -14,8 +13,6 @@ export class Recording extends APIResource {
|
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
export interface SessionRecording {
|
|
17
|
-
id: string;
|
|
18
|
-
|
|
19
16
|
/**
|
|
20
17
|
* See
|
|
21
18
|
* [rrweb documentation](https://github.com/rrweb-io/rrweb/blob/master/docs/recipes/dive-into-event.md).
|
|
@@ -34,7 +31,9 @@ export interface SessionRecording {
|
|
|
34
31
|
|
|
35
32
|
export type RecordingRetrieveResponse = Array<SessionRecording>;
|
|
36
33
|
|
|
37
|
-
export namespace Recording {
|
|
38
|
-
export
|
|
39
|
-
|
|
34
|
+
export declare namespace Recording {
|
|
35
|
+
export {
|
|
36
|
+
type SessionRecording as SessionRecording,
|
|
37
|
+
type RecordingRetrieveResponse as RecordingRetrieveResponse,
|
|
38
|
+
};
|
|
40
39
|
}
|