Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ yarn-error.log
codegen.log
Brewfile.lock.json
dist
/deno
dist-deno
/*.tgz
.idea/

Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.0.0"
".": "2.0.1"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 18
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-b341dd9d5bb77c4f217b94b186763e730fd798fbb773a5e90bb4e2a8d4a2c822.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-7f88912695bab2b98cb73137e6f36125d02fdfaf8eed4532ee1c82385609a259.yml
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Changelog

## 2.0.1 (2024-11-19)

Full Changelog: [v2.0.0...v2.0.1](https://github.com/browserbase/sdk-node/compare/v2.0.0...v2.0.1)

### Features

* **api:** api update ([#40](https://github.com/browserbase/sdk-node/issues/40)) ([97dddaa](https://github.com/browserbase/sdk-node/commit/97dddaa2729f64c4d1dbf20bebf7c243e3fb723b))
* **api:** api update ([#42](https://github.com/browserbase/sdk-node/issues/42)) ([2ad71d8](https://github.com/browserbase/sdk-node/commit/2ad71d8e96157370ec64619568d185805dcc97a2))
* various codegen changes ([7615211](https://github.com/browserbase/sdk-node/commit/7615211d48d953fe0833d35a3986f24673659840))


### Bug Fixes

* update example ([#38](https://github.com/browserbase/sdk-node/issues/38)) ([242167d](https://github.com/browserbase/sdk-node/commit/242167d2a82a6239fda100ad014436c9ee77a1de))


### Chores

* rebuild project due to codegen change ([#44](https://github.com/browserbase/sdk-node/issues/44)) ([804a9ec](https://github.com/browserbase/sdk-node/commit/804a9ec93ae35b48c6c7d89948a4146abf5ab8cc))
* rebuild project due to codegen change ([#45](https://github.com/browserbase/sdk-node/issues/45)) ([889bd8d](https://github.com/browserbase/sdk-node/commit/889bd8d94a245a1f9e26dc6877b045fc5bcbae0a))
* rebuild project due to codegen change ([#47](https://github.com/browserbase/sdk-node/issues/47)) ([4d08a25](https://github.com/browserbase/sdk-node/commit/4d08a25596cf991be1576d10fa9801cb057b157b))
* rebuild project due to codegen change ([#48](https://github.com/browserbase/sdk-node/issues/48)) ([189b64f](https://github.com/browserbase/sdk-node/commit/189b64fca8fe9ee76ff0b888108cd276f0387ad3))

## 2.0.0 (2024-10-29)

🆕 fully-featured SDK for Browserbase's API
201 changes: 0 additions & 201 deletions LICENSE

This file was deleted.

43 changes: 25 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const client = new Browserbase({
});

async function main() {
const session = await client.sessions.create({ projectId: 'your_project_id', proxies: true });
const session = await client.sessions.create({ projectId: 'your_project_id' });

console.log(session.id);
}
Expand All @@ -48,7 +48,7 @@ const client = new Browserbase({
});

async function main() {
const params: Browserbase.SessionCreateParams = { projectId: 'your_project_id', proxies: true };
const params: Browserbase.SessionCreateParams = { projectId: 'your_project_id' };
const session: Browserbase.SessionCreateResponse = await client.sessions.create(params);
}

Expand All @@ -66,17 +66,15 @@ a subclass of `APIError` will be thrown:
<!-- prettier-ignore -->
```ts
async function main() {
const session = await client.sessions
.create({ projectId: 'your_project_id', proxies: true })
.catch(async (err) => {
if (err instanceof Browserbase.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
const session = await client.sessions.create({ projectId: 'your_project_id' }).catch(async (err) => {
if (err instanceof Browserbase.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
}

main();
Expand Down Expand Up @@ -111,7 +109,7 @@ const client = new Browserbase({
});

// Or, configure per-request:
await client.sessions.create({ projectId: 'your_project_id', proxies: true }, {
await client.sessions.create({ projectId: 'your_project_id' }, {
maxRetries: 5,
});
```
Expand All @@ -128,7 +126,7 @@ const client = new Browserbase({
});

// Override per-request:
await client.sessions.create({ projectId: 'your_project_id', proxies: true }, {
await client.sessions.create({ projectId: 'your_project_id' }, {
timeout: 5 * 1000,
});
```
Expand All @@ -149,12 +147,12 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
```ts
const client = new Browserbase();

const response = await client.sessions.create({ projectId: 'your_project_id', proxies: true }).asResponse();
const response = await client.sessions.create({ projectId: 'your_project_id' }).asResponse();
console.log(response.headers.get('X-My-Header'));
console.log(response.statusText); // access the underlying Response object

const { data: session, response: raw } = await client.sessions
.create({ projectId: 'your_project_id', proxies: true })
.create({ projectId: 'your_project_id' })
.withResponse();
console.log(raw.headers.get('X-My-Header'));
console.log(session.id);
Expand Down Expand Up @@ -262,7 +260,7 @@ const client = new Browserbase({

// Override per-request:
await client.sessions.create(
{ projectId: 'your_project_id', proxies: true },
{ projectId: 'your_project_id' },
{
httpAgent: new http.Agent({ keepAlive: false }),
},
Expand All @@ -287,6 +285,15 @@ TypeScript >= 4.5 is supported.

The following runtimes are supported:

- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)
- Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
- Deno v1.28.0 or higher, using `import Browserbase from "npm:@browserbasehq/sdk"`.
- Bun 1.0 or later.
- Cloudflare Workers.
- Vercel Edge Runtime.
- Jest 28 or greater with the `"node"` environment (`"jsdom"` is not supported at this time).
- Nitro v2.6 or greater.

Note that React Native is not supported at this time.

If you are interested in other runtime environments, please open or upvote an issue on GitHub.
Expand Down
2 changes: 1 addition & 1 deletion examples/playwright-basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const bb = new Browserbase({
const browser = await chromium.connectOverCDP(session.connectUrl);

// Getting the default context to ensure the sessions are recorded.
const defaultContext = browser.contexts()[0];
const [defaultContext] = browser.contexts();
const page = defaultContext?.pages()[0];

await page?.goto('https://browserbase.com/');
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@browserbasehq/sdk",
"version": "2.0.0",
"version": "2.0.1",
"description": "The official Node.js library for the Browserbase API",
"author": "Browserbase <[email protected]>",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -50,7 +50,6 @@
"puppeteer-core": "^19.7.2",
"selenium-webdriver": "^4.2.0",
"ts-jest": "^29.1.0",
"ts-morph": "^19.0.0",
"ts-node": "^10.5.0",
"tsc-multi": "^1.1.0",
"tsconfig-paths": "^4.0.0",
Expand Down
Loading