@cloudflare/workers-types 4.20260527.1 → 4.20260528.1
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/2021-11-03/index.d.ts +507 -0
- package/2021-11-03/index.ts +507 -0
- package/2022-01-31/index.d.ts +507 -0
- package/2022-01-31/index.ts +507 -0
- package/2022-03-21/index.d.ts +507 -0
- package/2022-03-21/index.ts +507 -0
- package/2022-08-04/index.d.ts +507 -0
- package/2022-08-04/index.ts +507 -0
- package/2022-10-31/index.d.ts +507 -0
- package/2022-10-31/index.ts +507 -0
- package/2022-11-30/index.d.ts +507 -0
- package/2022-11-30/index.ts +507 -0
- package/2023-03-01/index.d.ts +507 -0
- package/2023-03-01/index.ts +507 -0
- package/2023-07-01/index.d.ts +507 -0
- package/2023-07-01/index.ts +507 -0
- package/experimental/index.d.ts +507 -0
- package/experimental/index.ts +507 -0
- package/index.d.ts +507 -0
- package/index.ts +507 -0
- package/latest/index.d.ts +507 -0
- package/latest/index.ts +507 -0
- package/oldest/index.d.ts +507 -0
- package/oldest/index.ts +507 -0
- package/package.json +1 -1
package/experimental/index.d.ts
CHANGED
|
@@ -12143,6 +12143,513 @@ declare abstract class AutoRAG {
|
|
|
12143
12143
|
params: AutoRagAiSearchRequest,
|
|
12144
12144
|
): Promise<AutoRagAiSearchResponse | Response>;
|
|
12145
12145
|
}
|
|
12146
|
+
type BrowserRunLifecycleEvent =
|
|
12147
|
+
| "load"
|
|
12148
|
+
| "domcontentloaded"
|
|
12149
|
+
| "networkidle0"
|
|
12150
|
+
| "networkidle2";
|
|
12151
|
+
type BrowserRunResourceType =
|
|
12152
|
+
| "document"
|
|
12153
|
+
| "stylesheet"
|
|
12154
|
+
| "image"
|
|
12155
|
+
| "media"
|
|
12156
|
+
| "font"
|
|
12157
|
+
| "script"
|
|
12158
|
+
| "texttrack"
|
|
12159
|
+
| "xhr"
|
|
12160
|
+
| "fetch"
|
|
12161
|
+
| "prefetch"
|
|
12162
|
+
| "eventsource"
|
|
12163
|
+
| "websocket"
|
|
12164
|
+
| "manifest"
|
|
12165
|
+
| "signedexchange"
|
|
12166
|
+
| "ping"
|
|
12167
|
+
| "cspviolationreport"
|
|
12168
|
+
| "preflight"
|
|
12169
|
+
| "other";
|
|
12170
|
+
/** Options fields shared by all quick actions. */
|
|
12171
|
+
interface BrowserRunBaseOptions {
|
|
12172
|
+
/** Adds `<script>` tags into the page with the desired URL or content.
|
|
12173
|
+
* @see https://pptr.dev/api/puppeteer.frameaddscripttagoptions
|
|
12174
|
+
*/
|
|
12175
|
+
addScriptTag?: Array<{
|
|
12176
|
+
content?: string;
|
|
12177
|
+
url?: string;
|
|
12178
|
+
type?: string;
|
|
12179
|
+
id?: string;
|
|
12180
|
+
}>;
|
|
12181
|
+
/** Adds `<link rel="stylesheet">` or `<style>` tags into the page.
|
|
12182
|
+
* @see https://pptr.dev/api/puppeteer.frameaddstyletagoptions
|
|
12183
|
+
*/
|
|
12184
|
+
addStyleTag?: Array<{
|
|
12185
|
+
content?: string;
|
|
12186
|
+
url?: string;
|
|
12187
|
+
}>;
|
|
12188
|
+
/** Provide credentials for HTTP authentication. @see https://pptr.dev/api/puppeteer.credentials */
|
|
12189
|
+
authenticate?: {
|
|
12190
|
+
username: string;
|
|
12191
|
+
password: string;
|
|
12192
|
+
};
|
|
12193
|
+
/** Set cookies before navigating. @see https://pptr.dev/api/puppeteer.cookieparam */
|
|
12194
|
+
cookies?: Array<{
|
|
12195
|
+
name: string;
|
|
12196
|
+
value: string;
|
|
12197
|
+
url?: string;
|
|
12198
|
+
domain?: string;
|
|
12199
|
+
path?: string;
|
|
12200
|
+
secure?: boolean;
|
|
12201
|
+
httpOnly?: boolean;
|
|
12202
|
+
sameSite?: "Strict" | "Lax" | "None";
|
|
12203
|
+
expires?: number;
|
|
12204
|
+
priority?: "Low" | "Medium" | "High";
|
|
12205
|
+
sameParty?: boolean;
|
|
12206
|
+
sourceScheme?: "Unset" | "NonSecure" | "Secure";
|
|
12207
|
+
sourcePort?: number;
|
|
12208
|
+
partitionKey?: string;
|
|
12209
|
+
}>;
|
|
12210
|
+
/** Emulate a specific CSS media type (e.g. `"screen"`, `"print"`). */
|
|
12211
|
+
emulateMediaType?: string;
|
|
12212
|
+
/** Navigation options. @see https://pptr.dev/api/puppeteer.gotooptions */
|
|
12213
|
+
gotoOptions?: {
|
|
12214
|
+
/** Navigation timeout in milliseconds (max 60 000). @default 30000 */
|
|
12215
|
+
timeout?: number;
|
|
12216
|
+
/** When to consider navigation complete. @default "domcontentloaded" */
|
|
12217
|
+
waitUntil?: BrowserRunLifecycleEvent | BrowserRunLifecycleEvent[];
|
|
12218
|
+
referer?: string;
|
|
12219
|
+
referrerPolicy?: string;
|
|
12220
|
+
};
|
|
12221
|
+
/** Block requests matching these regex patterns. Mutually exclusive with `allowRequestPattern`. */
|
|
12222
|
+
rejectRequestPattern?: string[];
|
|
12223
|
+
/** Only allow requests matching these regex patterns. Mutually exclusive with `rejectRequestPattern`. */
|
|
12224
|
+
allowRequestPattern?: string[];
|
|
12225
|
+
/** Block requests of these resource types. Mutually exclusive with `allowResourceTypes`. */
|
|
12226
|
+
rejectResourceTypes?: BrowserRunResourceType[];
|
|
12227
|
+
/** Only allow requests of these resource types. Mutually exclusive with `rejectResourceTypes`. */
|
|
12228
|
+
allowResourceTypes?: BrowserRunResourceType[];
|
|
12229
|
+
/** Additional HTTP headers sent with every request. */
|
|
12230
|
+
setExtraHTTPHeaders?: Record<string, string>;
|
|
12231
|
+
/** Whether JavaScript is enabled on the page. */
|
|
12232
|
+
setJavaScriptEnabled?: boolean;
|
|
12233
|
+
/** Override the default user agent string.
|
|
12234
|
+
* @default "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"
|
|
12235
|
+
* */
|
|
12236
|
+
userAgent?: string;
|
|
12237
|
+
/** Set the browser viewport size.
|
|
12238
|
+
* @see https://pptr.dev/api/puppeteer.viewport
|
|
12239
|
+
* @default {width:1920,height:1080}
|
|
12240
|
+
* */
|
|
12241
|
+
viewport?: {
|
|
12242
|
+
width: number;
|
|
12243
|
+
height: number;
|
|
12244
|
+
deviceScaleFactor?: number;
|
|
12245
|
+
isMobile?: boolean;
|
|
12246
|
+
isLandscape?: boolean;
|
|
12247
|
+
hasTouch?: boolean;
|
|
12248
|
+
};
|
|
12249
|
+
/** Wait for a CSS selector to appear in the page before proceeding.
|
|
12250
|
+
* @see https://pptr.dev/api/puppeteer.waitforselectoroptions
|
|
12251
|
+
*/
|
|
12252
|
+
waitForSelector?: {
|
|
12253
|
+
selector: string;
|
|
12254
|
+
hidden?: true;
|
|
12255
|
+
visible?: true;
|
|
12256
|
+
/** Timeout in milliseconds. Max 120000 */
|
|
12257
|
+
timeout?: number;
|
|
12258
|
+
};
|
|
12259
|
+
/** Wait for a fixed delay in milliseconds before proceeding. Max 120000 */
|
|
12260
|
+
waitForTimeout?: number;
|
|
12261
|
+
/** When true, continue on best-effort when awaited events fail or timeout. */
|
|
12262
|
+
bestAttempt?: boolean;
|
|
12263
|
+
/** Maximum duration in milliseconds for the browser action after page load. Max 120000 */
|
|
12264
|
+
actionTimeout?: number;
|
|
12265
|
+
/** Cache time to live in seconds (0-86400). Set to 0 to disable.
|
|
12266
|
+
* @default 5
|
|
12267
|
+
*/
|
|
12268
|
+
cacheTTL?: number;
|
|
12269
|
+
}
|
|
12270
|
+
/** Common options shared by all quick actions. Exactly one of `url` or `html` must be provided.*/
|
|
12271
|
+
type BrowserRunCommonOptions =
|
|
12272
|
+
| (BrowserRunBaseOptions & {
|
|
12273
|
+
/** URL to navigate to, e.g. `"https://example.com"`. */
|
|
12274
|
+
url: string;
|
|
12275
|
+
})
|
|
12276
|
+
| (BrowserRunBaseOptions & {
|
|
12277
|
+
/** Set the HTML content of the page directly. */
|
|
12278
|
+
html: string;
|
|
12279
|
+
});
|
|
12280
|
+
type BrowserRunPuppeteerScreenshotOptions = {
|
|
12281
|
+
/** @default "png" */
|
|
12282
|
+
type?: "png" | "jpeg" | "webp";
|
|
12283
|
+
/** @default "binary" */
|
|
12284
|
+
encoding?: "binary" | "base64";
|
|
12285
|
+
quality?: number;
|
|
12286
|
+
fullPage?: boolean;
|
|
12287
|
+
clip?: {
|
|
12288
|
+
x: number;
|
|
12289
|
+
y: number;
|
|
12290
|
+
width: number;
|
|
12291
|
+
height: number;
|
|
12292
|
+
scale?: number;
|
|
12293
|
+
};
|
|
12294
|
+
omitBackground?: boolean;
|
|
12295
|
+
optimizeForSpeed?: boolean;
|
|
12296
|
+
captureBeyondViewport?: boolean;
|
|
12297
|
+
fromSurface?: boolean;
|
|
12298
|
+
};
|
|
12299
|
+
type BrowserRunScreenshotOptions = BrowserRunCommonOptions & {
|
|
12300
|
+
/** CSS selector of the element to screenshot. */
|
|
12301
|
+
selector?: string;
|
|
12302
|
+
/** When true, scroll the entire page before taking the screenshot. */
|
|
12303
|
+
scrollPage?: boolean;
|
|
12304
|
+
/** @see https://pptr.dev/api/puppeteer.screenshotoptions */
|
|
12305
|
+
screenshotOptions?: BrowserRunPuppeteerScreenshotOptions;
|
|
12306
|
+
};
|
|
12307
|
+
type BrowserRunPDFOptions = BrowserRunCommonOptions & {
|
|
12308
|
+
/** @see https://pptr.dev/api/puppeteer.pdfoptions */
|
|
12309
|
+
pdfOptions?: {
|
|
12310
|
+
/** @default 1 */
|
|
12311
|
+
scale?: number;
|
|
12312
|
+
/** @default false */
|
|
12313
|
+
displayHeaderFooter?: boolean;
|
|
12314
|
+
headerTemplate?: string;
|
|
12315
|
+
footerTemplate?: string;
|
|
12316
|
+
/** @default false */
|
|
12317
|
+
printBackground?: boolean;
|
|
12318
|
+
/** @default false */
|
|
12319
|
+
landscape?: boolean;
|
|
12320
|
+
pageRanges?: string;
|
|
12321
|
+
/** @default "letter" */
|
|
12322
|
+
format?:
|
|
12323
|
+
| "letter"
|
|
12324
|
+
| "legal"
|
|
12325
|
+
| "tabloid"
|
|
12326
|
+
| "ledger"
|
|
12327
|
+
| "a0"
|
|
12328
|
+
| "a1"
|
|
12329
|
+
| "a2"
|
|
12330
|
+
| "a3"
|
|
12331
|
+
| "a4"
|
|
12332
|
+
| "a5"
|
|
12333
|
+
| "a6";
|
|
12334
|
+
width?: string | number;
|
|
12335
|
+
height?: string | number;
|
|
12336
|
+
/** @default false */
|
|
12337
|
+
preferCSSPageSize?: boolean;
|
|
12338
|
+
margin?: {
|
|
12339
|
+
top?: string | number;
|
|
12340
|
+
right?: string | number;
|
|
12341
|
+
bottom?: string | number;
|
|
12342
|
+
left?: string | number;
|
|
12343
|
+
};
|
|
12344
|
+
/** @default false */
|
|
12345
|
+
omitBackground?: boolean;
|
|
12346
|
+
/** @default true */
|
|
12347
|
+
tagged?: boolean;
|
|
12348
|
+
/** @default false */
|
|
12349
|
+
outline?: boolean;
|
|
12350
|
+
/** @default 30000 */
|
|
12351
|
+
timeout?: number;
|
|
12352
|
+
};
|
|
12353
|
+
};
|
|
12354
|
+
type BrowserRunScrapeOptions = BrowserRunCommonOptions & {
|
|
12355
|
+
/** CSS selectors to scrape. At least one element is required. */
|
|
12356
|
+
elements: Array<{
|
|
12357
|
+
selector: string;
|
|
12358
|
+
}>;
|
|
12359
|
+
};
|
|
12360
|
+
type BrowserRunLinksOptions = BrowserRunCommonOptions & {
|
|
12361
|
+
/** When true, only return links that are visible on the page. @default false */
|
|
12362
|
+
visibleLinksOnly?: boolean;
|
|
12363
|
+
/** When true, exclude links pointing to external domains. @default false */
|
|
12364
|
+
excludeExternalLinks?: boolean;
|
|
12365
|
+
};
|
|
12366
|
+
type BrowserRunSnapshotOptions = BrowserRunCommonOptions & {
|
|
12367
|
+
/** @see https://pptr.dev/api/puppeteer.screenshotoptions */
|
|
12368
|
+
screenshotOptions?: Omit<BrowserRunPuppeteerScreenshotOptions, "encoding">;
|
|
12369
|
+
};
|
|
12370
|
+
interface BrowserRunJsonBaseOptions {
|
|
12371
|
+
/** Custom AI models to try in order. Max 3. Falls back to next on error. */
|
|
12372
|
+
custom_ai?: Array<{
|
|
12373
|
+
/** Model ID in `<provider>/<model_name>` format, e.g. `"workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast"`. */
|
|
12374
|
+
model: string;
|
|
12375
|
+
/** Bearer token. Not needed for workers-ai models. */
|
|
12376
|
+
authorization?: string;
|
|
12377
|
+
}>;
|
|
12378
|
+
}
|
|
12379
|
+
/**
|
|
12380
|
+
* Options for the `json` quick action.
|
|
12381
|
+
* At least one of `prompt` or `response_format` must be provided.
|
|
12382
|
+
*/
|
|
12383
|
+
type BrowserRunJsonOptions = BrowserRunCommonOptions &
|
|
12384
|
+
BrowserRunJsonBaseOptions &
|
|
12385
|
+
(
|
|
12386
|
+
| {
|
|
12387
|
+
/** Natural-language prompt describing what data to extract. */
|
|
12388
|
+
prompt: string;
|
|
12389
|
+
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
|
|
12390
|
+
response_format?: AiTextGenerationResponseFormat;
|
|
12391
|
+
}
|
|
12392
|
+
| {
|
|
12393
|
+
/** Natural-language prompt describing what data to extract. */
|
|
12394
|
+
prompt?: string;
|
|
12395
|
+
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
|
|
12396
|
+
response_format: AiTextGenerationResponseFormat;
|
|
12397
|
+
}
|
|
12398
|
+
);
|
|
12399
|
+
type BrowserRunContentOptions = BrowserRunCommonOptions;
|
|
12400
|
+
type BrowserRunMarkdownOptions = BrowserRunCommonOptions;
|
|
12401
|
+
type BrowserRunResponseMeta = {
|
|
12402
|
+
/** HTTP status code of the rendered page */
|
|
12403
|
+
status: number;
|
|
12404
|
+
/** Page title */
|
|
12405
|
+
title: string;
|
|
12406
|
+
};
|
|
12407
|
+
/** Success response for `content` action. */
|
|
12408
|
+
type BrowserRunContentSuccessResponse = {
|
|
12409
|
+
success: true;
|
|
12410
|
+
/** Extracted HTML content */
|
|
12411
|
+
result: string;
|
|
12412
|
+
meta: BrowserRunResponseMeta;
|
|
12413
|
+
};
|
|
12414
|
+
/** Success response for `links` action. */
|
|
12415
|
+
type BrowserRunLinksSuccessResponse = {
|
|
12416
|
+
success: true;
|
|
12417
|
+
/** Extracted links */
|
|
12418
|
+
result: string[];
|
|
12419
|
+
};
|
|
12420
|
+
/** Success response for `scrape` action. */
|
|
12421
|
+
type BrowserRunScrapeSuccessResponse = {
|
|
12422
|
+
success: true;
|
|
12423
|
+
result: Array<{
|
|
12424
|
+
/** The CSS selector used to find elements. */
|
|
12425
|
+
selector: string;
|
|
12426
|
+
/** Array of elements matching the selector. */
|
|
12427
|
+
results: Array<{
|
|
12428
|
+
/** Outer HTML of the element. */
|
|
12429
|
+
html: string;
|
|
12430
|
+
/** Text content of the element. */
|
|
12431
|
+
text: string;
|
|
12432
|
+
/** Width of the element in pixels. */
|
|
12433
|
+
width: number;
|
|
12434
|
+
/** Height of the element in pixels. */
|
|
12435
|
+
height: number;
|
|
12436
|
+
/** Top position of the element relative to the viewport in pixels. */
|
|
12437
|
+
top: number;
|
|
12438
|
+
/** Left position of the element relative to the viewport in pixels. */
|
|
12439
|
+
left: number;
|
|
12440
|
+
/** Array of HTML attributes on the element. */
|
|
12441
|
+
attributes: Array<{
|
|
12442
|
+
/** Attribute name. */
|
|
12443
|
+
name: string;
|
|
12444
|
+
/** Attribute value. */
|
|
12445
|
+
value: string;
|
|
12446
|
+
}>;
|
|
12447
|
+
}>;
|
|
12448
|
+
}>;
|
|
12449
|
+
};
|
|
12450
|
+
/** Success response for `snapshot` action. */
|
|
12451
|
+
type BrowserRunSnapshotSuccessResponse = {
|
|
12452
|
+
success: true;
|
|
12453
|
+
result: {
|
|
12454
|
+
/** HTML content of the page. */
|
|
12455
|
+
content: string;
|
|
12456
|
+
/** Base64-encoded screenshot image. */
|
|
12457
|
+
screenshot: string;
|
|
12458
|
+
};
|
|
12459
|
+
meta: BrowserRunResponseMeta;
|
|
12460
|
+
};
|
|
12461
|
+
/** Success response for `json` action. */
|
|
12462
|
+
type BrowserRunJsonSuccessResponse = {
|
|
12463
|
+
success: true;
|
|
12464
|
+
/** JSON data extracted from the page using an AI model */
|
|
12465
|
+
result: Record<string, unknown>;
|
|
12466
|
+
};
|
|
12467
|
+
/** Success response for `markdown` action. */
|
|
12468
|
+
type BrowserRunMarkdownSuccessResponse = {
|
|
12469
|
+
success: true;
|
|
12470
|
+
/** Extracted markdown content */
|
|
12471
|
+
result: string;
|
|
12472
|
+
};
|
|
12473
|
+
/** Error response for BrowserRun actions. */
|
|
12474
|
+
type BrowserRunErrorResponse = {
|
|
12475
|
+
success: false;
|
|
12476
|
+
errors: {
|
|
12477
|
+
message: string;
|
|
12478
|
+
code?: number;
|
|
12479
|
+
detail?: string;
|
|
12480
|
+
path?: string;
|
|
12481
|
+
}[];
|
|
12482
|
+
};
|
|
12483
|
+
/** Error response for BrowserRun `json` action. */
|
|
12484
|
+
type BrowserRunJsonErrorResponse = BrowserRunErrorResponse & {
|
|
12485
|
+
/** Raw AI response text for debugging */
|
|
12486
|
+
rawAiResponse?: string;
|
|
12487
|
+
};
|
|
12488
|
+
/**
|
|
12489
|
+
* Browser Run API binding for automating headless browsers.
|
|
12490
|
+
* @see https://developers.cloudflare.com/browser-run/
|
|
12491
|
+
*/
|
|
12492
|
+
declare abstract class BrowserRun {
|
|
12493
|
+
/**
|
|
12494
|
+
* Send a raw HTTP request to the Browser Run API.
|
|
12495
|
+
* Used by libraries like `@cloudflare/puppeteer` to acquire and connect to a browser instance.
|
|
12496
|
+
* @see https://developers.cloudflare.com/browser-run/
|
|
12497
|
+
*/
|
|
12498
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
12499
|
+
/**
|
|
12500
|
+
* Take a screenshot of a web page.
|
|
12501
|
+
* @param action - Must be `'screenshot'`.
|
|
12502
|
+
* @param options - Screenshot options including viewport, selectors, and image format.
|
|
12503
|
+
* @returns A `Response` containing one of:
|
|
12504
|
+
*
|
|
12505
|
+
* **Success (HTTP 200):**
|
|
12506
|
+
* - Binary image data with `Content-Type: image/png`, `image/jpeg`, or `image/webp` (when `encoding: 'binary'`, the default)
|
|
12507
|
+
* - Data URI string with `Content-Type: text/plain` (when `encoding: 'base64'`)
|
|
12508
|
+
*
|
|
12509
|
+
* **Error:**
|
|
12510
|
+
* - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
12511
|
+
*
|
|
12512
|
+
* **Headers:**
|
|
12513
|
+
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
|
|
12514
|
+
*/
|
|
12515
|
+
quickAction(
|
|
12516
|
+
action: "screenshot",
|
|
12517
|
+
options: BrowserRunScreenshotOptions,
|
|
12518
|
+
): Promise<Response>;
|
|
12519
|
+
/**
|
|
12520
|
+
* Generate a PDF of a web page.
|
|
12521
|
+
* @param action - Must be `'pdf'`.
|
|
12522
|
+
* @param options - PDF generation options including page size, margins, and headers/footers.
|
|
12523
|
+
* @returns A `Response` containing one of:
|
|
12524
|
+
*
|
|
12525
|
+
* **Success (HTTP 200):**
|
|
12526
|
+
* - Binary PDF data with `Content-Type: application/pdf`
|
|
12527
|
+
*
|
|
12528
|
+
* **Error:**
|
|
12529
|
+
* - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
12530
|
+
*
|
|
12531
|
+
* **Headers:**
|
|
12532
|
+
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
|
|
12533
|
+
*/
|
|
12534
|
+
quickAction(action: "pdf", options: BrowserRunPDFOptions): Promise<Response>;
|
|
12535
|
+
/**
|
|
12536
|
+
* Get the HTML content of a web page.
|
|
12537
|
+
* @param action - Must be `'content'`.
|
|
12538
|
+
* @param options - Navigation and page interaction options.
|
|
12539
|
+
* @returns A `Response` containing one of:
|
|
12540
|
+
*
|
|
12541
|
+
* **Success (HTTP 200):**
|
|
12542
|
+
* - `BrowserRunContentSuccessResponse` JSON with `Content-Type: application/json`
|
|
12543
|
+
*
|
|
12544
|
+
* **Error:**
|
|
12545
|
+
* - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
12546
|
+
*
|
|
12547
|
+
* **Headers:**
|
|
12548
|
+
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
|
|
12549
|
+
*/
|
|
12550
|
+
quickAction(
|
|
12551
|
+
action: "content",
|
|
12552
|
+
options: BrowserRunContentOptions,
|
|
12553
|
+
): Promise<Response>;
|
|
12554
|
+
/**
|
|
12555
|
+
* Scrape elements from a web page by CSS selector.
|
|
12556
|
+
* @param action - Must be `'scrape'`.
|
|
12557
|
+
* @param options - Scrape options with CSS selectors for elements to extract.
|
|
12558
|
+
* @returns A `Response` containing one of:
|
|
12559
|
+
*
|
|
12560
|
+
* **Success (HTTP 200):**
|
|
12561
|
+
* - `BrowserRunScrapeSuccessResponse` JSON with `Content-Type: application/json`
|
|
12562
|
+
*
|
|
12563
|
+
* **Error:**
|
|
12564
|
+
* - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
12565
|
+
*
|
|
12566
|
+
* **Headers:**
|
|
12567
|
+
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
|
|
12568
|
+
*/
|
|
12569
|
+
quickAction(
|
|
12570
|
+
action: "scrape",
|
|
12571
|
+
options: BrowserRunScrapeOptions,
|
|
12572
|
+
): Promise<Response>;
|
|
12573
|
+
/**
|
|
12574
|
+
* Extract all links from a web page.
|
|
12575
|
+
* @param action - Must be `'links'`.
|
|
12576
|
+
* @param options - Options to filter visible or internal links only.
|
|
12577
|
+
* @returns A `Response` containing one of:
|
|
12578
|
+
*
|
|
12579
|
+
* **Success (HTTP 200):**
|
|
12580
|
+
* - `BrowserRunLinksSuccessResponse` JSON with `Content-Type: application/json`
|
|
12581
|
+
*
|
|
12582
|
+
* **Error:**
|
|
12583
|
+
* - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
12584
|
+
*
|
|
12585
|
+
* **Headers:**
|
|
12586
|
+
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
|
|
12587
|
+
*/
|
|
12588
|
+
quickAction(
|
|
12589
|
+
action: "links",
|
|
12590
|
+
options: BrowserRunLinksOptions,
|
|
12591
|
+
): Promise<Response>;
|
|
12592
|
+
/**
|
|
12593
|
+
* Get both the HTML content and a base64-encoded screenshot of a web page.
|
|
12594
|
+
* @param action - Must be `'snapshot'`.
|
|
12595
|
+
* @param options - Snapshot options including screenshot settings (encoding is always base64).
|
|
12596
|
+
* @returns A `Response` containing one of:
|
|
12597
|
+
*
|
|
12598
|
+
* **Success (HTTP 200):**
|
|
12599
|
+
* - `BrowserRunSnapshotSuccessResponse` JSON with `Content-Type: application/json`
|
|
12600
|
+
*
|
|
12601
|
+
* **Error:**
|
|
12602
|
+
* - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
12603
|
+
*
|
|
12604
|
+
* **Headers:**
|
|
12605
|
+
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
|
|
12606
|
+
*/
|
|
12607
|
+
quickAction(
|
|
12608
|
+
action: "snapshot",
|
|
12609
|
+
options: BrowserRunSnapshotOptions,
|
|
12610
|
+
): Promise<Response>;
|
|
12611
|
+
/**
|
|
12612
|
+
* Extract structured JSON data from a web page using AI.
|
|
12613
|
+
* @param action - Must be `'json'`.
|
|
12614
|
+
* @param options - JSON extraction options with prompt or response_format schema.
|
|
12615
|
+
* @returns A `Response` containing one of:
|
|
12616
|
+
*
|
|
12617
|
+
* **Success (HTTP 200):**
|
|
12618
|
+
* - `BrowserRunJsonSuccessResponse` JSON with `Content-Type: application/json`
|
|
12619
|
+
*
|
|
12620
|
+
* **Error:**
|
|
12621
|
+
* - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
12622
|
+
* - HTTP 422 with code `2012` for HTML-to-markdown conversion failures
|
|
12623
|
+
* - HTTP 422/500 for AI extraction failures (may include `rawAiResponse` field)
|
|
12624
|
+
*
|
|
12625
|
+
* **Headers:**
|
|
12626
|
+
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
|
|
12627
|
+
*/
|
|
12628
|
+
quickAction(
|
|
12629
|
+
action: "json",
|
|
12630
|
+
options: BrowserRunJsonOptions,
|
|
12631
|
+
): Promise<Response>;
|
|
12632
|
+
/**
|
|
12633
|
+
* Convert a web page to Markdown.
|
|
12634
|
+
* @param action - Must be `'markdown'`.
|
|
12635
|
+
* @param options - Navigation and page interaction options.
|
|
12636
|
+
* @returns A `Response` containing one of:
|
|
12637
|
+
*
|
|
12638
|
+
* **Success (HTTP 200):**
|
|
12639
|
+
* - `BrowserRunMarkdownSuccessResponse` JSON with `Content-Type: application/json`
|
|
12640
|
+
*
|
|
12641
|
+
* **Error:**
|
|
12642
|
+
* - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
12643
|
+
* - HTTP 422 with code `2012` for HTML-to-markdown conversion failures
|
|
12644
|
+
*
|
|
12645
|
+
* **Headers:**
|
|
12646
|
+
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
|
|
12647
|
+
*/
|
|
12648
|
+
quickAction(
|
|
12649
|
+
action: "markdown",
|
|
12650
|
+
options: BrowserRunMarkdownOptions,
|
|
12651
|
+
): Promise<Response>;
|
|
12652
|
+
}
|
|
12146
12653
|
interface BasicImageTransformations {
|
|
12147
12654
|
/**
|
|
12148
12655
|
* Maximum width in image pixels. The value must be an integer.
|