New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@browserbasehq/sdk

Package Overview
Dependencies
Maintainers
0
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@browserbasehq/sdk - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0

2

package.json
{
"name": "@browserbasehq/sdk",
"version": "1.3.1",
"version": "1.4.0",
"description": "Browserbase JS SDK",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -48,2 +48,6 @@ import puppeteer from 'puppeteer-core'

}
context?: {
id: string;
persist: boolean;
};
}

@@ -374,4 +378,22 @@ keepAlive?: boolean

}
async createContext(): Promise<{ id: string }> {
const response = await fetch(`${this.baseAPIURL}/v1/contexts`, {
method: 'POST',
headers: {
'x-bb-api-key': this.apiKey,
'Content-Type': 'application/json',
},
body: JSON.stringify({ projectId: this.projectId }),
});
if (!response.ok) {
throw new Error('Failed to create context');
}
const data = await response.json();
return data;
}
}
export { Browserbase, BrowserbaseAISDK }
import { describe, it, beforeEach } from 'node:test'
import { expect } from 'chai'
import { Browserbase, BrowserbaseAISDK } from '../src'
import { Browserbase, BrowserbaseAISDK, CreateSessionOptions } from '../src'

@@ -76,2 +76,19 @@ describe('Browserbase', () => {

})
it('should create a session with dynamically created context', async () => {
const createContextResponse = await browserbase.createContext();
const contextId = createContextResponse.id;
// Use the created context ID in session creation
const sessionOptions: CreateSessionOptions = {
browserSettings: {
context: {
id: contextId,
persist: true
}
}
};
const { id } = await browserbase.createSession(sessionOptions);
const session = await browserbase.getSession(id);
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc