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 package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hyperbrowser/sdk",
"version": "1.5.6",
"version": "1.5.7",
"description": "Node SDK for Hyperbrowser API",
"author": "",
"repository": {
Expand Down
2 changes: 2 additions & 0 deletions src/types/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -274,6 +275,7 @@ export interface CreateSessionParams {
liveViewTtlSeconds?: number;
replaceNativeElements?: boolean;
disablePostQuantumKeyAgreement?: boolean;
disableSoftwareWebGL?: boolean;
browserMemorySize?: BrowserMemorySize;
startFromSnapshot?: StartSessionFromSnapshotParams;
/**
Expand Down
4 changes: 3 additions & 1 deletion src/types/web/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Country, State } from "../constants";
import { Country, OperatingSystem, State } from "../constants";
import { ScreenConfig } from "../session";
import { BrandingProfile } from "./branding";

Expand Down Expand Up @@ -104,6 +104,8 @@ export interface FetchBrowserOptions {
screen?: ScreenConfig;
profileId?: string;
solveCaptchas?: boolean;
operatingSystem?: OperatingSystem;
disableSoftwareWebGL?: boolean;
location?: FetchBrowserLocationOptions;
}

Expand Down
28 changes: 27 additions & 1 deletion tests/unit/public-types-contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ import type {
ComputerActionResponseDataCursorPosition,
CompleteSandboxImageBuildParams,
CreateSandboxImageBuildParams,
CreateSessionParams,
CreateSessionProfile,
FetchBrowserOptions,
OperatingSystem,
GetBatchScrapeJobParams,
GetWebCrawlJobParams,
PageData,
SessionLaunchState,
Sandbox,
SandboxExecParams,
SandboxImageBuildInputFormat,
Expand Down Expand Up @@ -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<Omit<Sandbox, "containsSecrets">>().toExtend<Sandbox>();
expectTypeOf<Omit<SandboxSnapshotSummary, "containsSecrets">>().toExtend<SandboxSnapshotSummary>();
expectTypeOf<
Omit<SandboxSnapshotSummary, "containsSecrets">
>().toExtend<SandboxSnapshotSummary>();
});

test("exports cursor-position requests and typed coordinates with optional pointer modifiers", () => {
Expand Down Expand Up @@ -183,6 +189,26 @@ describe("public type compatibility", () => {
expectTypeOf<PageData["finalUrl"]>().toEqualTypeOf<string | undefined>();
});

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<FetchBrowserOptions["operatingSystem"]>().toEqualTypeOf<
OperatingSystem | undefined
>();
expectTypeOf<FetchBrowserOptions["disableSoftwareWebGL"]>().toEqualTypeOf<
boolean | undefined
>();
expectTypeOf<CreateSessionParams["disableSoftwareWebGL"]>().toEqualTypeOf<
boolean | undefined
>();
expectTypeOf<SessionLaunchState["disableSoftwareWebGL"]>().toEqualTypeOf<boolean | undefined>();
});

test("includes public server region and status values", () => {
const region: SessionRegion = "us";
const status: SessionStatus = "close-error";
Expand Down