Skip to content

Commit f1b641b

Browse files
committed
Release 2.0.3
1 parent 0c0bc53 commit f1b641b

File tree

12 files changed

+65
-170
lines changed

12 files changed

+65
-170
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "browser-use-sdk",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"private": false,
55
"repository": "github:browser-use/browser-use-node",
66
"type": "commonjs",

reference.md

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -579,69 +579,6 @@ await client.sessions.getSession("session_id");
579579
</dl>
580580
</details>
581581

582-
<details><summary><code>client.sessions.<a href="/src/api/resources/sessions/client/Client.ts">deleteSession</a>(sessionId) -> void</code></summary>
583-
<dl>
584-
<dd>
585-
586-
#### 📝 Description
587-
588-
<dl>
589-
<dd>
590-
591-
<dl>
592-
<dd>
593-
594-
Permanently delete a session and all associated data.
595-
596-
</dd>
597-
</dl>
598-
</dd>
599-
</dl>
600-
601-
#### 🔌 Usage
602-
603-
<dl>
604-
<dd>
605-
606-
<dl>
607-
<dd>
608-
609-
```typescript
610-
await client.sessions.deleteSession("session_id");
611-
```
612-
613-
</dd>
614-
</dl>
615-
</dd>
616-
</dl>
617-
618-
#### ⚙️ Parameters
619-
620-
<dl>
621-
<dd>
622-
623-
<dl>
624-
<dd>
625-
626-
**sessionId:** `string`
627-
628-
</dd>
629-
</dl>
630-
631-
<dl>
632-
<dd>
633-
634-
**requestOptions:** `Sessions.RequestOptions`
635-
636-
</dd>
637-
</dl>
638-
</dd>
639-
</dl>
640-
641-
</dd>
642-
</dl>
643-
</details>
644-
645582
<details><summary><code>client.sessions.<a href="/src/api/resources/sessions/client/Client.ts">updateSession</a>(sessionId, { ...params }) -> BrowserUse.SessionView</code></summary>
646583
<dl>
647584
<dd>

src/Client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export class BrowserUseClient {
5050
{
5151
"X-Fern-Language": "JavaScript",
5252
"X-Fern-SDK-Name": "browser-use-sdk",
53-
"X-Fern-SDK-Version": "2.0.2",
54-
"User-Agent": "browser-use-sdk/2.0.2",
53+
"X-Fern-SDK-Version": "2.0.3",
54+
"User-Agent": "browser-use-sdk/2.0.3",
5555
"X-Fern-Runtime": core.RUNTIME.type,
5656
"X-Fern-Runtime-Version": core.RUNTIME.version,
5757
},
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
5+
import * as errors from "../../errors/index.js";
6+
import * as BrowserUse from "../index.js";
7+
import * as core from "../../core/index.js";
8+
9+
export class TooManyRequestsError extends errors.BrowserUseError {
10+
constructor(body: BrowserUse.TooManyConcurrentActiveSessionsError, rawResponse?: core.RawResponse) {
11+
super({
12+
message: "TooManyRequestsError",
13+
statusCode: 429,
14+
body: body,
15+
rawResponse: rawResponse,
16+
});
17+
Object.setPrototypeOf(this, TooManyRequestsError.prototype);
18+
}
19+
}

src/api/errors/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export * from "./NotFoundError.js";
22
export * from "./UnprocessableEntityError.js";
33
export * from "./BadRequestError.js";
4+
export * from "./TooManyRequestsError.js";
45
export * from "./InternalServerError.js";
56
export * from "./PaymentRequiredError.js";

src/api/resources/sessions/client/Client.ts

Lines changed: 6 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ export class Sessions {
139139
*
140140
* @throws {@link BrowserUse.NotFoundError}
141141
* @throws {@link BrowserUse.UnprocessableEntityError}
142+
* @throws {@link BrowserUse.TooManyRequestsError}
142143
*
143144
* @example
144145
* await client.sessions.createSession()
@@ -189,6 +190,11 @@ export class Sessions {
189190
_response.error.body as unknown,
190191
_response.rawResponse,
191192
);
193+
case 429:
194+
throw new BrowserUse.TooManyRequestsError(
195+
_response.error.body as BrowserUse.TooManyConcurrentActiveSessionsError,
196+
_response.rawResponse,
197+
);
192198
default:
193199
throw new errors.BrowserUseError({
194200
statusCode: _response.error.statusCode,
@@ -296,81 +302,6 @@ export class Sessions {
296302
}
297303
}
298304

299-
/**
300-
* Permanently delete a session and all associated data.
301-
*
302-
* @param {string} sessionId
303-
* @param {Sessions.RequestOptions} requestOptions - Request-specific configuration.
304-
*
305-
* @throws {@link BrowserUse.UnprocessableEntityError}
306-
*
307-
* @example
308-
* await client.sessions.deleteSession("session_id")
309-
*/
310-
public deleteSession(sessionId: string, requestOptions?: Sessions.RequestOptions): core.HttpResponsePromise<void> {
311-
return core.HttpResponsePromise.fromPromise(this.__deleteSession(sessionId, requestOptions));
312-
}
313-
314-
private async __deleteSession(
315-
sessionId: string,
316-
requestOptions?: Sessions.RequestOptions,
317-
): Promise<core.WithRawResponse<void>> {
318-
let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
319-
this._options?.headers,
320-
mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }),
321-
requestOptions?.headers,
322-
);
323-
const _response = await core.fetcher({
324-
url: core.url.join(
325-
(await core.Supplier.get(this._options.baseUrl)) ??
326-
(await core.Supplier.get(this._options.environment)) ??
327-
environments.BrowserUseEnvironment.Production,
328-
`sessions/${encodeURIComponent(sessionId)}`,
329-
),
330-
method: "DELETE",
331-
headers: _headers,
332-
queryParameters: requestOptions?.queryParams,
333-
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
334-
maxRetries: requestOptions?.maxRetries,
335-
abortSignal: requestOptions?.abortSignal,
336-
});
337-
if (_response.ok) {
338-
return { data: undefined, rawResponse: _response.rawResponse };
339-
}
340-
341-
if (_response.error.reason === "status-code") {
342-
switch (_response.error.statusCode) {
343-
case 422:
344-
throw new BrowserUse.UnprocessableEntityError(
345-
_response.error.body as unknown,
346-
_response.rawResponse,
347-
);
348-
default:
349-
throw new errors.BrowserUseError({
350-
statusCode: _response.error.statusCode,
351-
body: _response.error.body,
352-
rawResponse: _response.rawResponse,
353-
});
354-
}
355-
}
356-
357-
switch (_response.error.reason) {
358-
case "non-json":
359-
throw new errors.BrowserUseError({
360-
statusCode: _response.error.statusCode,
361-
body: _response.error.rawBody,
362-
rawResponse: _response.rawResponse,
363-
});
364-
case "timeout":
365-
throw new errors.BrowserUseTimeoutError("Timeout exceeded when calling DELETE /sessions/{session_id}.");
366-
case "unknown":
367-
throw new errors.BrowserUseError({
368-
message: _response.error.errorMessage,
369-
rawResponse: _response.rawResponse,
370-
});
371-
}
372-
}
373-
374305
/**
375306
* Stop a session and all its running tasks.
376307
*

src/api/resources/tasks/client/Client.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ export class Tasks {
154154
* @throws {@link BrowserUse.BadRequestError}
155155
* @throws {@link BrowserUse.NotFoundError}
156156
* @throws {@link BrowserUse.UnprocessableEntityError}
157+
* @throws {@link BrowserUse.TooManyRequestsError}
157158
*
158159
* @example
159160
* await client.tasks.createTask({
@@ -208,6 +209,11 @@ export class Tasks {
208209
_response.error.body as unknown,
209210
_response.rawResponse,
210211
);
212+
case 429:
213+
throw new BrowserUse.TooManyRequestsError(
214+
_response.error.body as BrowserUse.TooManyConcurrentActiveSessionsError,
215+
_response.rawResponse,
216+
);
211217
default:
212218
throw new errors.BrowserUseError({
213219
statusCode: _response.error.statusCode,
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
5+
/**
6+
* Error response when user has too many concurrent active sessions
7+
*/
8+
export interface TooManyConcurrentActiveSessionsError {
9+
detail?: string;
10+
}

src/api/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export * from "./TaskStatus.js";
3333
export * from "./TaskStepView.js";
3434
export * from "./TaskUpdateAction.js";
3535
export * from "./TaskView.js";
36+
export * from "./TooManyConcurrentActiveSessionsError.js";
3637
export * from "./UnsupportedContentTypeError.js";
3738
export * from "./UploadFilePresignedUrlResponse.js";
3839
export * from "./ValidationError.js";

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const SDK_VERSION = "2.0.2";
1+
export const SDK_VERSION = "2.0.3";

0 commit comments

Comments
 (0)