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