browser-use-sdk 2.0.2 → 2.0.3
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/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/errors/TooManyRequestsError.d.ts +9 -0
- package/dist/cjs/api/errors/TooManyRequestsError.js +52 -0
- package/dist/cjs/api/errors/index.d.ts +1 -0
- package/dist/cjs/api/errors/index.js +1 -0
- package/dist/cjs/api/resources/sessions/client/Client.d.ts +1 -13
- package/dist/cjs/api/resources/sessions/client/Client.js +3 -59
- package/dist/cjs/api/resources/tasks/client/Client.d.ts +1 -0
- package/dist/cjs/api/resources/tasks/client/Client.js +3 -0
- package/dist/cjs/api/types/TooManyConcurrentActiveSessionsError.d.ts +9 -0
- package/dist/cjs/api/types/TooManyConcurrentActiveSessionsError.js +5 -0
- package/dist/cjs/api/types/index.d.ts +1 -0
- package/dist/cjs/api/types/index.js +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/errors/TooManyRequestsError.d.mts +9 -0
- package/dist/esm/api/errors/TooManyRequestsError.mjs +15 -0
- package/dist/esm/api/errors/index.d.mts +1 -0
- package/dist/esm/api/errors/index.mjs +1 -0
- package/dist/esm/api/resources/sessions/client/Client.d.mts +1 -13
- package/dist/esm/api/resources/sessions/client/Client.mjs +3 -59
- package/dist/esm/api/resources/tasks/client/Client.d.mts +1 -0
- package/dist/esm/api/resources/tasks/client/Client.mjs +3 -0
- package/dist/esm/api/types/TooManyConcurrentActiveSessionsError.d.mts +9 -0
- package/dist/esm/api/types/TooManyConcurrentActiveSessionsError.mjs +4 -0
- package/dist/esm/api/types/index.d.mts +1 -0
- package/dist/esm/api/types/index.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +0 -63
package/dist/cjs/Client.js
CHANGED
|
@@ -49,8 +49,8 @@ class BrowserUseClient {
|
|
|
49
49
|
this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
|
|
50
50
|
"X-Fern-Language": "JavaScript",
|
|
51
51
|
"X-Fern-SDK-Name": "browser-use-sdk",
|
|
52
|
-
"X-Fern-SDK-Version": "2.0.
|
|
53
|
-
"User-Agent": "browser-use-sdk/2.0.
|
|
52
|
+
"X-Fern-SDK-Version": "2.0.3",
|
|
53
|
+
"User-Agent": "browser-use-sdk/2.0.3",
|
|
54
54
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
55
55
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
56
56
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as errors from "../../errors/index.js";
|
|
5
|
+
import * as BrowserUse from "../index.js";
|
|
6
|
+
import * as core from "../../core/index.js";
|
|
7
|
+
export declare class TooManyRequestsError extends errors.BrowserUseError {
|
|
8
|
+
constructor(body: BrowserUse.TooManyConcurrentActiveSessionsError, rawResponse?: core.RawResponse);
|
|
9
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.TooManyRequestsError = void 0;
|
|
40
|
+
const errors = __importStar(require("../../errors/index.js"));
|
|
41
|
+
class TooManyRequestsError extends errors.BrowserUseError {
|
|
42
|
+
constructor(body, rawResponse) {
|
|
43
|
+
super({
|
|
44
|
+
message: "TooManyRequestsError",
|
|
45
|
+
statusCode: 429,
|
|
46
|
+
body: body,
|
|
47
|
+
rawResponse: rawResponse,
|
|
48
|
+
});
|
|
49
|
+
Object.setPrototypeOf(this, TooManyRequestsError.prototype);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.TooManyRequestsError = TooManyRequestsError;
|
|
@@ -17,5 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./NotFoundError.js"), exports);
|
|
18
18
|
__exportStar(require("./UnprocessableEntityError.js"), exports);
|
|
19
19
|
__exportStar(require("./BadRequestError.js"), exports);
|
|
20
|
+
__exportStar(require("./TooManyRequestsError.js"), exports);
|
|
20
21
|
__exportStar(require("./InternalServerError.js"), exports);
|
|
21
22
|
__exportStar(require("./PaymentRequiredError.js"), exports);
|
|
@@ -50,6 +50,7 @@ export declare class Sessions {
|
|
|
50
50
|
*
|
|
51
51
|
* @throws {@link BrowserUse.NotFoundError}
|
|
52
52
|
* @throws {@link BrowserUse.UnprocessableEntityError}
|
|
53
|
+
* @throws {@link BrowserUse.TooManyRequestsError}
|
|
53
54
|
*
|
|
54
55
|
* @example
|
|
55
56
|
* await client.sessions.createSession()
|
|
@@ -70,19 +71,6 @@ export declare class Sessions {
|
|
|
70
71
|
*/
|
|
71
72
|
getSession(sessionId: string, requestOptions?: Sessions.RequestOptions): core.HttpResponsePromise<BrowserUse.SessionView>;
|
|
72
73
|
private __getSession;
|
|
73
|
-
/**
|
|
74
|
-
* Permanently delete a session and all associated data.
|
|
75
|
-
*
|
|
76
|
-
* @param {string} sessionId
|
|
77
|
-
* @param {Sessions.RequestOptions} requestOptions - Request-specific configuration.
|
|
78
|
-
*
|
|
79
|
-
* @throws {@link BrowserUse.UnprocessableEntityError}
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* await client.sessions.deleteSession("session_id")
|
|
83
|
-
*/
|
|
84
|
-
deleteSession(sessionId: string, requestOptions?: Sessions.RequestOptions): core.HttpResponsePromise<void>;
|
|
85
|
-
private __deleteSession;
|
|
86
74
|
/**
|
|
87
75
|
* Stop a session and all its running tasks.
|
|
88
76
|
*
|
|
@@ -133,6 +133,7 @@ class Sessions {
|
|
|
133
133
|
*
|
|
134
134
|
* @throws {@link BrowserUse.NotFoundError}
|
|
135
135
|
* @throws {@link BrowserUse.UnprocessableEntityError}
|
|
136
|
+
* @throws {@link BrowserUse.TooManyRequestsError}
|
|
136
137
|
*
|
|
137
138
|
* @example
|
|
138
139
|
* await client.sessions.createSession()
|
|
@@ -165,6 +166,8 @@ class Sessions {
|
|
|
165
166
|
throw new BrowserUse.NotFoundError(_response.error.body, _response.rawResponse);
|
|
166
167
|
case 422:
|
|
167
168
|
throw new BrowserUse.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
169
|
+
case 429:
|
|
170
|
+
throw new BrowserUse.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
168
171
|
default:
|
|
169
172
|
throw new errors.BrowserUseError({
|
|
170
173
|
statusCode: _response.error.statusCode,
|
|
@@ -252,65 +255,6 @@ class Sessions {
|
|
|
252
255
|
}
|
|
253
256
|
});
|
|
254
257
|
}
|
|
255
|
-
/**
|
|
256
|
-
* Permanently delete a session and all associated data.
|
|
257
|
-
*
|
|
258
|
-
* @param {string} sessionId
|
|
259
|
-
* @param {Sessions.RequestOptions} requestOptions - Request-specific configuration.
|
|
260
|
-
*
|
|
261
|
-
* @throws {@link BrowserUse.UnprocessableEntityError}
|
|
262
|
-
*
|
|
263
|
-
* @example
|
|
264
|
-
* await client.sessions.deleteSession("session_id")
|
|
265
|
-
*/
|
|
266
|
-
deleteSession(sessionId, requestOptions) {
|
|
267
|
-
return core.HttpResponsePromise.fromPromise(this.__deleteSession(sessionId, requestOptions));
|
|
268
|
-
}
|
|
269
|
-
__deleteSession(sessionId, requestOptions) {
|
|
270
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
271
|
-
var _a, _b, _c;
|
|
272
|
-
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
273
|
-
const _response = yield core.fetcher({
|
|
274
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.BrowserUseEnvironment.Production, `sessions/${encodeURIComponent(sessionId)}`),
|
|
275
|
-
method: "DELETE",
|
|
276
|
-
headers: _headers,
|
|
277
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
278
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
279
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
280
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
281
|
-
});
|
|
282
|
-
if (_response.ok) {
|
|
283
|
-
return { data: undefined, rawResponse: _response.rawResponse };
|
|
284
|
-
}
|
|
285
|
-
if (_response.error.reason === "status-code") {
|
|
286
|
-
switch (_response.error.statusCode) {
|
|
287
|
-
case 422:
|
|
288
|
-
throw new BrowserUse.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
289
|
-
default:
|
|
290
|
-
throw new errors.BrowserUseError({
|
|
291
|
-
statusCode: _response.error.statusCode,
|
|
292
|
-
body: _response.error.body,
|
|
293
|
-
rawResponse: _response.rawResponse,
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
switch (_response.error.reason) {
|
|
298
|
-
case "non-json":
|
|
299
|
-
throw new errors.BrowserUseError({
|
|
300
|
-
statusCode: _response.error.statusCode,
|
|
301
|
-
body: _response.error.rawBody,
|
|
302
|
-
rawResponse: _response.rawResponse,
|
|
303
|
-
});
|
|
304
|
-
case "timeout":
|
|
305
|
-
throw new errors.BrowserUseTimeoutError("Timeout exceeded when calling DELETE /sessions/{session_id}.");
|
|
306
|
-
case "unknown":
|
|
307
|
-
throw new errors.BrowserUseError({
|
|
308
|
-
message: _response.error.errorMessage,
|
|
309
|
-
rawResponse: _response.rawResponse,
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
258
|
/**
|
|
315
259
|
* Stop a session and all its running tasks.
|
|
316
260
|
*
|
|
@@ -53,6 +53,7 @@ export declare class Tasks {
|
|
|
53
53
|
* @throws {@link BrowserUse.BadRequestError}
|
|
54
54
|
* @throws {@link BrowserUse.NotFoundError}
|
|
55
55
|
* @throws {@link BrowserUse.UnprocessableEntityError}
|
|
56
|
+
* @throws {@link BrowserUse.TooManyRequestsError}
|
|
56
57
|
*
|
|
57
58
|
* @example
|
|
58
59
|
* await client.tasks.createTask({
|
|
@@ -145,6 +145,7 @@ class Tasks {
|
|
|
145
145
|
* @throws {@link BrowserUse.BadRequestError}
|
|
146
146
|
* @throws {@link BrowserUse.NotFoundError}
|
|
147
147
|
* @throws {@link BrowserUse.UnprocessableEntityError}
|
|
148
|
+
* @throws {@link BrowserUse.TooManyRequestsError}
|
|
148
149
|
*
|
|
149
150
|
* @example
|
|
150
151
|
* await client.tasks.createTask({
|
|
@@ -181,6 +182,8 @@ class Tasks {
|
|
|
181
182
|
throw new BrowserUse.NotFoundError(_response.error.body, _response.rawResponse);
|
|
182
183
|
case 422:
|
|
183
184
|
throw new BrowserUse.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
185
|
+
case 429:
|
|
186
|
+
throw new BrowserUse.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
184
187
|
default:
|
|
185
188
|
throw new errors.BrowserUseError({
|
|
186
189
|
statusCode: _response.error.statusCode,
|
|
@@ -33,6 +33,7 @@ export * from "./TaskStatus.js";
|
|
|
33
33
|
export * from "./TaskStepView.js";
|
|
34
34
|
export * from "./TaskUpdateAction.js";
|
|
35
35
|
export * from "./TaskView.js";
|
|
36
|
+
export * from "./TooManyConcurrentActiveSessionsError.js";
|
|
36
37
|
export * from "./UnsupportedContentTypeError.js";
|
|
37
38
|
export * from "./UploadFilePresignedUrlResponse.js";
|
|
38
39
|
export * from "./ValidationError.js";
|
|
@@ -49,6 +49,7 @@ __exportStar(require("./TaskStatus.js"), exports);
|
|
|
49
49
|
__exportStar(require("./TaskStepView.js"), exports);
|
|
50
50
|
__exportStar(require("./TaskUpdateAction.js"), exports);
|
|
51
51
|
__exportStar(require("./TaskView.js"), exports);
|
|
52
|
+
__exportStar(require("./TooManyConcurrentActiveSessionsError.js"), exports);
|
|
52
53
|
__exportStar(require("./UnsupportedContentTypeError.js"), exports);
|
|
53
54
|
__exportStar(require("./UploadFilePresignedUrlResponse.js"), exports);
|
|
54
55
|
__exportStar(require("./ValidationError.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.3";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.mjs
CHANGED
|
@@ -13,8 +13,8 @@ export class BrowserUseClient {
|
|
|
13
13
|
this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
|
|
14
14
|
"X-Fern-Language": "JavaScript",
|
|
15
15
|
"X-Fern-SDK-Name": "browser-use-sdk",
|
|
16
|
-
"X-Fern-SDK-Version": "2.0.
|
|
17
|
-
"User-Agent": "browser-use-sdk/2.0.
|
|
16
|
+
"X-Fern-SDK-Version": "2.0.3",
|
|
17
|
+
"User-Agent": "browser-use-sdk/2.0.3",
|
|
18
18
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
19
19
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
20
20
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as errors from "../../errors/index.mjs";
|
|
5
|
+
import * as BrowserUse from "../index.mjs";
|
|
6
|
+
import * as core from "../../core/index.mjs";
|
|
7
|
+
export declare class TooManyRequestsError extends errors.BrowserUseError {
|
|
8
|
+
constructor(body: BrowserUse.TooManyConcurrentActiveSessionsError, rawResponse?: core.RawResponse);
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as errors from "../../errors/index.mjs";
|
|
5
|
+
export class TooManyRequestsError extends errors.BrowserUseError {
|
|
6
|
+
constructor(body, rawResponse) {
|
|
7
|
+
super({
|
|
8
|
+
message: "TooManyRequestsError",
|
|
9
|
+
statusCode: 429,
|
|
10
|
+
body: body,
|
|
11
|
+
rawResponse: rawResponse,
|
|
12
|
+
});
|
|
13
|
+
Object.setPrototypeOf(this, TooManyRequestsError.prototype);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -50,6 +50,7 @@ export declare class Sessions {
|
|
|
50
50
|
*
|
|
51
51
|
* @throws {@link BrowserUse.NotFoundError}
|
|
52
52
|
* @throws {@link BrowserUse.UnprocessableEntityError}
|
|
53
|
+
* @throws {@link BrowserUse.TooManyRequestsError}
|
|
53
54
|
*
|
|
54
55
|
* @example
|
|
55
56
|
* await client.sessions.createSession()
|
|
@@ -70,19 +71,6 @@ export declare class Sessions {
|
|
|
70
71
|
*/
|
|
71
72
|
getSession(sessionId: string, requestOptions?: Sessions.RequestOptions): core.HttpResponsePromise<BrowserUse.SessionView>;
|
|
72
73
|
private __getSession;
|
|
73
|
-
/**
|
|
74
|
-
* Permanently delete a session and all associated data.
|
|
75
|
-
*
|
|
76
|
-
* @param {string} sessionId
|
|
77
|
-
* @param {Sessions.RequestOptions} requestOptions - Request-specific configuration.
|
|
78
|
-
*
|
|
79
|
-
* @throws {@link BrowserUse.UnprocessableEntityError}
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* await client.sessions.deleteSession("session_id")
|
|
83
|
-
*/
|
|
84
|
-
deleteSession(sessionId: string, requestOptions?: Sessions.RequestOptions): core.HttpResponsePromise<void>;
|
|
85
|
-
private __deleteSession;
|
|
86
74
|
/**
|
|
87
75
|
* Stop a session and all its running tasks.
|
|
88
76
|
*
|
|
@@ -97,6 +97,7 @@ export class Sessions {
|
|
|
97
97
|
*
|
|
98
98
|
* @throws {@link BrowserUse.NotFoundError}
|
|
99
99
|
* @throws {@link BrowserUse.UnprocessableEntityError}
|
|
100
|
+
* @throws {@link BrowserUse.TooManyRequestsError}
|
|
100
101
|
*
|
|
101
102
|
* @example
|
|
102
103
|
* await client.sessions.createSession()
|
|
@@ -129,6 +130,8 @@ export class Sessions {
|
|
|
129
130
|
throw new BrowserUse.NotFoundError(_response.error.body, _response.rawResponse);
|
|
130
131
|
case 422:
|
|
131
132
|
throw new BrowserUse.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
133
|
+
case 429:
|
|
134
|
+
throw new BrowserUse.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
132
135
|
default:
|
|
133
136
|
throw new errors.BrowserUseError({
|
|
134
137
|
statusCode: _response.error.statusCode,
|
|
@@ -216,65 +219,6 @@ export class Sessions {
|
|
|
216
219
|
}
|
|
217
220
|
});
|
|
218
221
|
}
|
|
219
|
-
/**
|
|
220
|
-
* Permanently delete a session and all associated data.
|
|
221
|
-
*
|
|
222
|
-
* @param {string} sessionId
|
|
223
|
-
* @param {Sessions.RequestOptions} requestOptions - Request-specific configuration.
|
|
224
|
-
*
|
|
225
|
-
* @throws {@link BrowserUse.UnprocessableEntityError}
|
|
226
|
-
*
|
|
227
|
-
* @example
|
|
228
|
-
* await client.sessions.deleteSession("session_id")
|
|
229
|
-
*/
|
|
230
|
-
deleteSession(sessionId, requestOptions) {
|
|
231
|
-
return core.HttpResponsePromise.fromPromise(this.__deleteSession(sessionId, requestOptions));
|
|
232
|
-
}
|
|
233
|
-
__deleteSession(sessionId, requestOptions) {
|
|
234
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
235
|
-
var _a, _b, _c;
|
|
236
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
237
|
-
const _response = yield core.fetcher({
|
|
238
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.BrowserUseEnvironment.Production, `sessions/${encodeURIComponent(sessionId)}`),
|
|
239
|
-
method: "DELETE",
|
|
240
|
-
headers: _headers,
|
|
241
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
242
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
243
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
244
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
245
|
-
});
|
|
246
|
-
if (_response.ok) {
|
|
247
|
-
return { data: undefined, rawResponse: _response.rawResponse };
|
|
248
|
-
}
|
|
249
|
-
if (_response.error.reason === "status-code") {
|
|
250
|
-
switch (_response.error.statusCode) {
|
|
251
|
-
case 422:
|
|
252
|
-
throw new BrowserUse.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
253
|
-
default:
|
|
254
|
-
throw new errors.BrowserUseError({
|
|
255
|
-
statusCode: _response.error.statusCode,
|
|
256
|
-
body: _response.error.body,
|
|
257
|
-
rawResponse: _response.rawResponse,
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
switch (_response.error.reason) {
|
|
262
|
-
case "non-json":
|
|
263
|
-
throw new errors.BrowserUseError({
|
|
264
|
-
statusCode: _response.error.statusCode,
|
|
265
|
-
body: _response.error.rawBody,
|
|
266
|
-
rawResponse: _response.rawResponse,
|
|
267
|
-
});
|
|
268
|
-
case "timeout":
|
|
269
|
-
throw new errors.BrowserUseTimeoutError("Timeout exceeded when calling DELETE /sessions/{session_id}.");
|
|
270
|
-
case "unknown":
|
|
271
|
-
throw new errors.BrowserUseError({
|
|
272
|
-
message: _response.error.errorMessage,
|
|
273
|
-
rawResponse: _response.rawResponse,
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
222
|
/**
|
|
279
223
|
* Stop a session and all its running tasks.
|
|
280
224
|
*
|
|
@@ -53,6 +53,7 @@ export declare class Tasks {
|
|
|
53
53
|
* @throws {@link BrowserUse.BadRequestError}
|
|
54
54
|
* @throws {@link BrowserUse.NotFoundError}
|
|
55
55
|
* @throws {@link BrowserUse.UnprocessableEntityError}
|
|
56
|
+
* @throws {@link BrowserUse.TooManyRequestsError}
|
|
56
57
|
*
|
|
57
58
|
* @example
|
|
58
59
|
* await client.tasks.createTask({
|
|
@@ -109,6 +109,7 @@ export class Tasks {
|
|
|
109
109
|
* @throws {@link BrowserUse.BadRequestError}
|
|
110
110
|
* @throws {@link BrowserUse.NotFoundError}
|
|
111
111
|
* @throws {@link BrowserUse.UnprocessableEntityError}
|
|
112
|
+
* @throws {@link BrowserUse.TooManyRequestsError}
|
|
112
113
|
*
|
|
113
114
|
* @example
|
|
114
115
|
* await client.tasks.createTask({
|
|
@@ -145,6 +146,8 @@ export class Tasks {
|
|
|
145
146
|
throw new BrowserUse.NotFoundError(_response.error.body, _response.rawResponse);
|
|
146
147
|
case 422:
|
|
147
148
|
throw new BrowserUse.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
149
|
+
case 429:
|
|
150
|
+
throw new BrowserUse.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
148
151
|
default:
|
|
149
152
|
throw new errors.BrowserUseError({
|
|
150
153
|
statusCode: _response.error.statusCode,
|
|
@@ -33,6 +33,7 @@ export * from "./TaskStatus.mjs";
|
|
|
33
33
|
export * from "./TaskStepView.mjs";
|
|
34
34
|
export * from "./TaskUpdateAction.mjs";
|
|
35
35
|
export * from "./TaskView.mjs";
|
|
36
|
+
export * from "./TooManyConcurrentActiveSessionsError.mjs";
|
|
36
37
|
export * from "./UnsupportedContentTypeError.mjs";
|
|
37
38
|
export * from "./UploadFilePresignedUrlResponse.mjs";
|
|
38
39
|
export * from "./ValidationError.mjs";
|
|
@@ -33,6 +33,7 @@ export * from "./TaskStatus.mjs";
|
|
|
33
33
|
export * from "./TaskStepView.mjs";
|
|
34
34
|
export * from "./TaskUpdateAction.mjs";
|
|
35
35
|
export * from "./TaskView.mjs";
|
|
36
|
+
export * from "./TooManyConcurrentActiveSessionsError.mjs";
|
|
36
37
|
export * from "./UnsupportedContentTypeError.mjs";
|
|
37
38
|
export * from "./UploadFilePresignedUrlResponse.mjs";
|
|
38
39
|
export * from "./ValidationError.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.3";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.3";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -579,69 +579,6 @@ await client.sessions.getSession("session_id");
|
|
|
579
579
|
</dl>
|
|
580
580
|
</details>
|
|
581
581
|
|
|
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
|
-
|
|
645
582
|
<details><summary><code>client.sessions.<a href="/src/api/resources/sessions/client/Client.ts">updateSession</a>(sessionId, { ...params }) -> BrowserUse.SessionView</code></summary>
|
|
646
583
|
<dl>
|
|
647
584
|
<dd>
|