@cloudflare/workers-types 5.20260818.1 → 5.20260820.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/index.d.ts CHANGED
@@ -4003,14 +4003,29 @@ interface ContainerSnapshotRestoreParams {
4003
4003
  interface ContainerSnapshotOptions {
4004
4004
  name?: string;
4005
4005
  }
4006
- interface ContainerStartupOptions {
4006
+ type ContainerStartupOptions = {
4007
4007
  entrypoint?: string[];
4008
4008
  enableInternet: boolean;
4009
4009
  env?: Record<string, string>;
4010
+ instance?:
4011
+ | "lite"
4012
+ | "standard-1"
4013
+ | "standard-2"
4014
+ | "standard-3"
4015
+ | "standard-4"
4016
+ | ContainerStartResources;
4010
4017
  labels?: Record<string, string>;
4011
4018
  directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
4012
- containerSnapshot?: ContainerSnapshotRestoreParams;
4013
- }
4019
+ } & (
4020
+ | {
4021
+ image: string;
4022
+ containerSnapshot?: never;
4023
+ }
4024
+ | {
4025
+ image?: never;
4026
+ containerSnapshot?: ContainerSnapshotRestoreParams;
4027
+ }
4028
+ );
4014
4029
  interface ContainerStartResources {
4015
4030
  vcpu: number;
4016
4031
  memoryMib: number;
@@ -12420,10 +12435,30 @@ type BrowserRunLinksOptions = BrowserRunCommonOptions & {
12420
12435
  /** When true, exclude links pointing to external domains. @default false */
12421
12436
  excludeExternalLinks?: boolean;
12422
12437
  };
12438
+ type BrowserRunSnapshotFormat =
12439
+ "content" | "screenshot" | "markdown" | "accessibilityTree";
12423
12440
  type BrowserRunSnapshotOptions = BrowserRunCommonOptions & {
12441
+ /** Which representations of the page to return. At least two distinct formats
12442
+ * are required; request a single format from its dedicated action instead.
12443
+ * @default ["content","screenshot"]
12444
+ */
12445
+ formats?: BrowserRunSnapshotFormat[];
12424
12446
  /** @see https://pptr.dev/api/puppeteer.screenshotoptions */
12425
12447
  screenshotOptions?: Omit<BrowserRunPuppeteerScreenshotOptions, "encoding">;
12426
12448
  };
12449
+ /** Options for the `accessibilityTree` quick action. */
12450
+ type BrowserRunAccessibilityTreeOptions = BrowserRunCommonOptions & {
12451
+ /** When true, prune nodes that carry no semantic meaning, such as generic
12452
+ * containers. Defaults to true, or to false when `root` is set so that the
12453
+ * requested subtree is returned as-is.
12454
+ */
12455
+ interestingOnly?: boolean;
12456
+ /** CSS selector limiting the tree to the matching element's subtree.
12457
+ * A selector that matches nothing yields `accessibilityTree: null` with
12458
+ * HTTP 200; a malformed selector is an error.
12459
+ */
12460
+ root?: string;
12461
+ };
12427
12462
  interface BrowserRunJsonBaseOptions {
12428
12463
  /** Custom AI models to try in order. Max 3. Falls back to next on error. */
12429
12464
  custom_ai?: Array<{
@@ -12461,6 +12496,58 @@ type BrowserRunResponseMeta = {
12461
12496
  /** Page title */
12462
12497
  title: string;
12463
12498
  };
12499
+ /**
12500
+ * A node in the page's accessibility tree, as exposed to assistive technology.
12501
+ * `role` is the only field always present; the rest are populated when the
12502
+ * underlying element defines them.
12503
+ * @see https://pptr.dev/api/puppeteer.serializedaxnode
12504
+ */
12505
+ interface BrowserRunSerializedAXNode {
12506
+ /** The ARIA role, e.g. `"button"`, `"heading"`, `"RootWebArea"`. */
12507
+ role: string;
12508
+ /** The `aria-autocomplete` value. */
12509
+ autocomplete?: string;
12510
+ /** Checked state of a checkbox, radio, or menu item. */
12511
+ checked?: boolean | "mixed";
12512
+ /** Accessible description, typically from `aria-describedby` or `title`. */
12513
+ description?: string;
12514
+ disabled?: boolean;
12515
+ expanded?: boolean;
12516
+ /** Whether the element currently holds keyboard focus. */
12517
+ focused?: boolean;
12518
+ /** The kind of popup the element triggers, e.g. `"menu"`, `"dialog"`. */
12519
+ haspopup?: string;
12520
+ /** The `aria-invalid` value. */
12521
+ invalid?: string;
12522
+ /** Keyboard shortcuts bound to the element, from `aria-keyshortcuts`. */
12523
+ keyshortcuts?: string;
12524
+ /** Hierarchical level, e.g. the heading level of an `<h2>`. */
12525
+ level?: number;
12526
+ /** Whether the element is a modal dialog. */
12527
+ modal?: boolean;
12528
+ /** Whether a text input accepts multiple lines. */
12529
+ multiline?: boolean;
12530
+ /** Whether more than one option can be selected. */
12531
+ multiselectable?: boolean;
12532
+ /** Accessible name, e.g. a button's label or an image's alt text. */
12533
+ name?: string;
12534
+ orientation?: string;
12535
+ /** Pressed state of a toggle button. */
12536
+ pressed?: boolean | "mixed";
12537
+ readonly?: boolean;
12538
+ required?: boolean;
12539
+ /** Author-supplied role description, from `aria-roledescription`. */
12540
+ roledescription?: string;
12541
+ selected?: boolean;
12542
+ /** Current value of an input or range element. */
12543
+ value?: string | number;
12544
+ valuemax?: number;
12545
+ valuemin?: number;
12546
+ /** Human-readable form of `value`, from `aria-valuetext`. */
12547
+ valuetext?: string;
12548
+ /** Child nodes. Absent for leaf nodes. */
12549
+ children?: BrowserRunSerializedAXNode[];
12550
+ }
12464
12551
  /** Success response for `content` action. */
12465
12552
  type BrowserRunContentSuccessResponse = {
12466
12553
  success: true;
@@ -12504,14 +12591,31 @@ type BrowserRunScrapeSuccessResponse = {
12504
12591
  }>;
12505
12592
  }>;
12506
12593
  };
12507
- /** Success response for `snapshot` action. */
12594
+ /** Success response for `snapshot` action. Each field is present only when the
12595
+ * corresponding entry was requested in `formats`.
12596
+ */
12508
12597
  type BrowserRunSnapshotSuccessResponse = {
12509
12598
  success: true;
12510
12599
  result: {
12511
12600
  /** HTML content of the page. */
12512
- content: string;
12601
+ content?: string;
12513
12602
  /** Base64-encoded screenshot image. */
12514
- screenshot: string;
12603
+ screenshot?: string;
12604
+ /** Markdown content. Prefixed with YAML frontmatter (e.g. `title`) when the
12605
+ * page provides that metadata.
12606
+ */
12607
+ markdown?: string;
12608
+ /** Root of the page's accessibility tree. */
12609
+ accessibilityTree?: BrowserRunSerializedAXNode;
12610
+ };
12611
+ meta: BrowserRunResponseMeta;
12612
+ };
12613
+ /** Success response for `accessibilityTree` action. */
12614
+ type BrowserRunAccessibilityTreeSuccessResponse = {
12615
+ success: true;
12616
+ result: {
12617
+ /** Root of the accessibility tree, or `null` when `root` matched no element. */
12618
+ accessibilityTree: BrowserRunSerializedAXNode | null;
12515
12619
  };
12516
12620
  meta: BrowserRunResponseMeta;
12517
12621
  };
@@ -12647,9 +12751,10 @@ declare abstract class BrowserRun {
12647
12751
  options: BrowserRunLinksOptions,
12648
12752
  ): Promise<Response>;
12649
12753
  /**
12650
- * Get both the HTML content and a base64-encoded screenshot of a web page.
12754
+ * Get several representations of a web page in one request.
12651
12755
  * @param action - Must be `'snapshot'`.
12652
- * @param options - Snapshot options including screenshot settings (encoding is always base64).
12756
+ * @param options - Snapshot options including the `formats` to return and
12757
+ * screenshot settings (encoding is always base64).
12653
12758
  * @returns A `Response` containing one of:
12654
12759
  *
12655
12760
  * **Success (HTTP 200):**
@@ -12706,6 +12811,29 @@ declare abstract class BrowserRun {
12706
12811
  action: "markdown",
12707
12812
  options: BrowserRunMarkdownOptions,
12708
12813
  ): Promise<Response>;
12814
+ /**
12815
+ * Get the accessibility tree of a web page.
12816
+ * @param action - Must be `'accessibilityTree'`.
12817
+ * @param options - Options to scope the tree to a subtree and to control
12818
+ * whether semantically uninteresting nodes are pruned.
12819
+ * @returns A `Response` containing one of:
12820
+ *
12821
+ * **Success (HTTP 200):**
12822
+ * - `BrowserRunAccessibilityTreeSuccessResponse` JSON with `Content-Type: application/json`
12823
+ * - `result.accessibilityTree` is `null` when `root` matched no element
12824
+ *
12825
+ * **Error:**
12826
+ * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
12827
+ * - HTTP 422 for a malformed `root` selector
12828
+ * - HTTP 500 with code `2017` or `2018` when the tree could not be built
12829
+ *
12830
+ * **Headers:**
12831
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
12832
+ */
12833
+ quickAction(
12834
+ action: "accessibilityTree",
12835
+ options: BrowserRunAccessibilityTreeOptions,
12836
+ ): Promise<Response>;
12709
12837
  }
12710
12838
  /**
12711
12839
  * In addition to the properties you can set in the RequestInit dict
@@ -14377,6 +14505,27 @@ type ImageInfoResponse =
14377
14505
  width: number;
14378
14506
  height: number;
14379
14507
  };
14508
+ /**
14509
+ * Parameters for rasterizing text into an image.
14510
+ */
14511
+ type TextRasterize = {
14512
+ /** The text content to render */
14513
+ content: string;
14514
+ /** rasterization options for the text **/
14515
+ options: TextOptions;
14516
+ };
14517
+ type TextOptions = {
14518
+ /** Font configuration */
14519
+ font: {
14520
+ /** URL to a font file in TrueType (.ttf), OpenType (.otf), WOFF (.woff), or WOFF2 (.woff2) format */
14521
+ url: string;
14522
+ };
14523
+ /** Font size in points (pt) */
14524
+ size?: number;
14525
+ /** Text color in CSS format: hex (#RRGGBB or #RRGGBBAA), rgb(r,g,b), rgba(r,g,b,a), or named colors */
14526
+ color?: string;
14527
+ };
14528
+ type ImageSource = ReadableStream<Uint8Array> | TextRasterize;
14380
14529
  type ImageTransform = {
14381
14530
  width?: number;
14382
14531
  height?: number;
@@ -14488,6 +14637,9 @@ interface ImageUploadOptions {
14488
14637
  requireSignedURLs?: boolean;
14489
14638
  metadata?: Record<string, unknown>;
14490
14639
  creator?: string;
14640
+ /**
14641
+ * If 'base64', the input data will be decoded from base64 before processing
14642
+ */
14491
14643
  encoding?: "base64";
14492
14644
  }
14493
14645
  interface ImageUpdateOptions {
@@ -14495,11 +14647,41 @@ interface ImageUpdateOptions {
14495
14647
  metadata?: Record<string, unknown>;
14496
14648
  creator?: string;
14497
14649
  }
14650
+ type ImageMetadataFilterOperators = {
14651
+ eq?: string | number | boolean;
14652
+ in?: string[] | number[];
14653
+ gt?: number;
14654
+ gte?: number;
14655
+ lt?: number;
14656
+ lte?: number;
14657
+ };
14658
+ type ImageMetadataFilterValue =
14659
+ string | number | boolean | ImageMetadataFilterOperators;
14660
+ interface ImageListFilter {
14661
+ metadata?: Record<string, ImageMetadataFilterValue>;
14662
+ }
14498
14663
  interface ImageListOptions {
14499
14664
  limit?: number;
14500
14665
  cursor?: string;
14501
14666
  sortOrder?: "asc" | "desc";
14502
14667
  creator?: string;
14668
+ filter?: ImageListFilter;
14669
+ }
14670
+ interface ImageSignedUrlOptions {
14671
+ variant: string;
14672
+ expiresIn?: number;
14673
+ keyName?: string;
14674
+ }
14675
+ interface ImageDirectUploadOptions {
14676
+ id?: string;
14677
+ requireSignedURLs?: boolean;
14678
+ metadata?: Record<string, unknown>;
14679
+ creator?: string;
14680
+ expiresIn?: number;
14681
+ }
14682
+ interface ImageDirectUploadResult {
14683
+ id: string;
14684
+ uploadURL: string;
14503
14685
  }
14504
14686
  interface ImageList {
14505
14687
  images: ImageMetadata[];
@@ -14517,6 +14699,13 @@ interface ImageHandle {
14517
14699
  * @returns ReadableStream of image bytes, or null if not found
14518
14700
  */
14519
14701
  bytes(): Promise<ReadableStream<Uint8Array> | null>;
14702
+ /**
14703
+ * Generate a signed delivery URL for this hosted image.
14704
+ * @param options Signing configuration
14705
+ * @returns A signed image delivery URL
14706
+ * @throws {@link ImagesError} if signing fails
14707
+ */
14708
+ signedUrl(options: ImageSignedUrlOptions): Promise<string>;
14520
14709
  /**
14521
14710
  * Update hosted image metadata
14522
14711
  * @param options Properties to update
@@ -14555,6 +14744,16 @@ interface HostedImagesBinding {
14555
14744
  * @throws {@link ImagesError} if list fails
14556
14745
  */
14557
14746
  list(options?: ImageListOptions): Promise<ImageList>;
14747
+ /**
14748
+ * Create a Direct Creator Upload link, letting an end user upload an
14749
+ * image straight to Cloudflare without exposing an API token
14750
+ * @param options Upload link configuration
14751
+ * @returns The new image ID and the upload URL to hand to the end user
14752
+ * @throws {@link ImagesError} if creation fails
14753
+ */
14754
+ createDirectUpload(
14755
+ options?: ImageDirectUploadOptions,
14756
+ ): Promise<ImageDirectUploadResult>;
14558
14757
  }
14559
14758
  interface ImagesBinding {
14560
14759
  /**
@@ -14575,6 +14774,13 @@ interface ImagesBinding {
14575
14774
  stream: ReadableStream<Uint8Array>,
14576
14775
  options?: ImageInputOptions,
14577
14776
  ): ImageTransformer;
14777
+ /**
14778
+ * Begin applying a series of transformations to text
14779
+ * @param content string to be rendered
14780
+ * @param options font, optional color and size to use in rendering text
14781
+ * @returns A transform handle
14782
+ */
14783
+ text(content: string, options: TextOptions): ImageTransformer;
14578
14784
  /**
14579
14785
  * Access hosted images CRUD operations
14580
14786
  */
@@ -14607,11 +14813,15 @@ interface ImageTransformer {
14607
14813
  type ImageTransformationOutputOptions = {
14608
14814
  encoding?: "base64";
14609
14815
  };
14816
+ type ImageTransformationResponseOptions = {
14817
+ headers?: HeadersInit;
14818
+ };
14610
14819
  interface ImageTransformationResult {
14611
14820
  /**
14612
14821
  * The image as a response, ready to store in cache or return to users
14822
+ * @param options Options that apply to the returned response, e.g. additional headers
14613
14823
  */
14614
- response(): Response;
14824
+ response(options?: ImageTransformationResponseOptions): Response;
14615
14825
  /**
14616
14826
  * The content type of the returned image
14617
14827
  */
@@ -16895,6 +17105,20 @@ type WorkflowDurationLabel =
16895
17105
  type WorkflowSleepDuration =
16896
17106
  `${number} ${WorkflowDurationLabel}${"s" | ""}` | number;
16897
17107
  type WorkflowRetentionDuration = WorkflowSleepDuration;
17108
+ /** Geographic regions supported when creating a Workflow instance.
17109
+ * Location hints are best-effort placement preferences. */
17110
+ type WorkflowInstanceLocationHint =
17111
+ | "wnam"
17112
+ | "enam"
17113
+ | "sam"
17114
+ | "weur"
17115
+ | "eeur"
17116
+ | "apac"
17117
+ | "apac-ne"
17118
+ | "apac-se"
17119
+ | "oc"
17120
+ | "afr"
17121
+ | "me";
16898
17122
  interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
16899
17123
  /**
16900
17124
  * An id for your Workflow instance. Must be unique within the Workflow.
@@ -16912,6 +17136,9 @@ interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
16912
17136
  successRetention?: WorkflowRetentionDuration;
16913
17137
  errorRetention?: WorkflowRetentionDuration;
16914
17138
  };
17139
+ /** A best-effort geographic placement preference for the Workflow instance.
17140
+ * See `WorkflowInstanceLocationHint` for supported regions. */
17141
+ locationHint?: WorkflowInstanceLocationHint;
16915
17142
  }
16916
17143
  type InstanceStatus = {
16917
17144
  status: