diff --git a/package.json b/package.json index 93ab44d..aa3d43a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hyperbrowser/sdk", - "version": "1.5.6", + "version": "1.5.7", "description": "Node SDK for Hyperbrowser API", "author": "", "repository": { diff --git a/src/types/session.ts b/src/types/session.ts index d7f4f5b..087492c 100644 --- a/src/types/session.ts +++ b/src/types/session.ts @@ -64,6 +64,7 @@ export interface SessionLaunchState { enableAlwaysOpenPdfExternally?: boolean; appendTimestampToDownloads?: boolean; disablePostQuantumKeyAgreement?: boolean; + disableSoftwareWebGL?: boolean; /** @deprecated Discontinued: WebGL fingerprinting was removed from the browser, and the server ignores this option. Kept so existing code still type-checks. */ enableWebglFingerprinting?: boolean; } @@ -274,6 +275,7 @@ export interface CreateSessionParams { liveViewTtlSeconds?: number; replaceNativeElements?: boolean; disablePostQuantumKeyAgreement?: boolean; + disableSoftwareWebGL?: boolean; browserMemorySize?: BrowserMemorySize; startFromSnapshot?: StartSessionFromSnapshotParams; /** diff --git a/src/types/web/common.ts b/src/types/web/common.ts index 76c72ce..bfc9fd8 100644 --- a/src/types/web/common.ts +++ b/src/types/web/common.ts @@ -1,4 +1,4 @@ -import { Country, State } from "../constants"; +import { Country, OperatingSystem, State } from "../constants"; import { ScreenConfig } from "../session"; import { BrandingProfile } from "./branding"; @@ -104,6 +104,8 @@ export interface FetchBrowserOptions { screen?: ScreenConfig; profileId?: string; solveCaptchas?: boolean; + operatingSystem?: OperatingSystem; + disableSoftwareWebGL?: boolean; location?: FetchBrowserLocationOptions; } diff --git a/tests/unit/public-types-contract.test.ts b/tests/unit/public-types-contract.test.ts index d846b85..f9d192f 100644 --- a/tests/unit/public-types-contract.test.ts +++ b/tests/unit/public-types-contract.test.ts @@ -13,10 +13,14 @@ import type { ComputerActionResponseDataCursorPosition, CompleteSandboxImageBuildParams, CreateSandboxImageBuildParams, + CreateSessionParams, CreateSessionProfile, + FetchBrowserOptions, + OperatingSystem, GetBatchScrapeJobParams, GetWebCrawlJobParams, PageData, + SessionLaunchState, Sandbox, SandboxExecParams, SandboxImageBuildInputFormat, @@ -80,7 +84,9 @@ function actionConsumer(params: ComputerActionParams): string { describe("public type compatibility", () => { test("accepts sandbox and snapshot objects created before secrets metadata existed", () => { expectTypeOf>().toExtend(); - expectTypeOf>().toExtend(); + expectTypeOf< + Omit + >().toExtend(); }); test("exports cursor-position requests and typed coordinates with optional pointer modifiers", () => { @@ -183,6 +189,26 @@ describe("public type compatibility", () => { expectTypeOf().toEqualTypeOf(); }); + test("exposes operatingSystem and disableSoftwareWebGL on fetch browser options, session creation and launch state", () => { + const browser: FetchBrowserOptions = { operatingSystem: "macos", disableSoftwareWebGL: true }; + const session: CreateSessionParams = { disableSoftwareWebGL: true }; + const launchState: SessionLaunchState = { disableSoftwareWebGL: true }; + + expect(browser.operatingSystem).toBe("macos"); + expect(session.disableSoftwareWebGL).toBe(true); + expect(launchState.disableSoftwareWebGL).toBe(true); + expectTypeOf().toEqualTypeOf< + OperatingSystem | undefined + >(); + expectTypeOf().toEqualTypeOf< + boolean | undefined + >(); + expectTypeOf().toEqualTypeOf< + boolean | undefined + >(); + expectTypeOf().toEqualTypeOf(); + }); + test("includes public server region and status values", () => { const region: SessionRegion = "us"; const status: SessionStatus = "close-error";