@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.ts CHANGED
@@ -4012,14 +4012,29 @@ export interface ContainerSnapshotRestoreParams {
4012
4012
  export interface ContainerSnapshotOptions {
4013
4013
  name?: string;
4014
4014
  }
4015
- export interface ContainerStartupOptions {
4015
+ export type ContainerStartupOptions = {
4016
4016
  entrypoint?: string[];
4017
4017
  enableInternet: boolean;
4018
4018
  env?: Record<string, string>;
4019
+ instance?:
4020
+ | "lite"
4021
+ | "standard-1"
4022
+ | "standard-2"
4023
+ | "standard-3"
4024
+ | "standard-4"
4025
+ | ContainerStartResources;
4019
4026
  labels?: Record<string, string>;
4020
4027
  directorySnapshots?: ContainerDirectorySnapshotRestoreParams[];
4021
- containerSnapshot?: ContainerSnapshotRestoreParams;
4022
- }
4028
+ } & (
4029
+ | {
4030
+ image: string;
4031
+ containerSnapshot?: never;
4032
+ }
4033
+ | {
4034
+ image?: never;
4035
+ containerSnapshot?: ContainerSnapshotRestoreParams;
4036
+ }
4037
+ );
4023
4038
  export interface ContainerStartResources {
4024
4039
  vcpu: number;
4025
4040
  memoryMib: number;
@@ -12434,10 +12449,30 @@ export type BrowserRunLinksOptions = BrowserRunCommonOptions & {
12434
12449
  /** When true, exclude links pointing to external domains. @default false */
12435
12450
  excludeExternalLinks?: boolean;
12436
12451
  };
12452
+ export type BrowserRunSnapshotFormat =
12453
+ "content" | "screenshot" | "markdown" | "accessibilityTree";
12437
12454
  export type BrowserRunSnapshotOptions = BrowserRunCommonOptions & {
12455
+ /** Which representations of the page to return. At least two distinct formats
12456
+ * are required; request a single format from its dedicated action instead.
12457
+ * @default ["content","screenshot"]
12458
+ */
12459
+ formats?: BrowserRunSnapshotFormat[];
12438
12460
  /** @see https://pptr.dev/api/puppeteer.screenshotoptions */
12439
12461
  screenshotOptions?: Omit<BrowserRunPuppeteerScreenshotOptions, "encoding">;
12440
12462
  };
12463
+ /** Options for the `accessibilityTree` quick action. */
12464
+ export type BrowserRunAccessibilityTreeOptions = BrowserRunCommonOptions & {
12465
+ /** When true, prune nodes that carry no semantic meaning, such as generic
12466
+ * containers. Defaults to true, or to false when `root` is set so that the
12467
+ * requested subtree is returned as-is.
12468
+ */
12469
+ interestingOnly?: boolean;
12470
+ /** CSS selector limiting the tree to the matching element's subtree.
12471
+ * A selector that matches nothing yields `accessibilityTree: null` with
12472
+ * HTTP 200; a malformed selector is an error.
12473
+ */
12474
+ root?: string;
12475
+ };
12441
12476
  export interface BrowserRunJsonBaseOptions {
12442
12477
  /** Custom AI models to try in order. Max 3. Falls back to next on error. */
12443
12478
  custom_ai?: Array<{
@@ -12475,6 +12510,58 @@ export type BrowserRunResponseMeta = {
12475
12510
  /** Page title */
12476
12511
  title: string;
12477
12512
  };
12513
+ /**
12514
+ * A node in the page's accessibility tree, as exposed to assistive technology.
12515
+ * `role` is the only field always present; the rest are populated when the
12516
+ * underlying element defines them.
12517
+ * @see https://pptr.dev/api/puppeteer.serializedaxnode
12518
+ */
12519
+ export interface BrowserRunSerializedAXNode {
12520
+ /** The ARIA role, e.g. `"button"`, `"heading"`, `"RootWebArea"`. */
12521
+ role: string;
12522
+ /** The `aria-autocomplete` value. */
12523
+ autocomplete?: string;
12524
+ /** Checked state of a checkbox, radio, or menu item. */
12525
+ checked?: boolean | "mixed";
12526
+ /** Accessible description, typically from `aria-describedby` or `title`. */
12527
+ description?: string;
12528
+ disabled?: boolean;
12529
+ expanded?: boolean;
12530
+ /** Whether the element currently holds keyboard focus. */
12531
+ focused?: boolean;
12532
+ /** The kind of popup the element triggers, e.g. `"menu"`, `"dialog"`. */
12533
+ haspopup?: string;
12534
+ /** The `aria-invalid` value. */
12535
+ invalid?: string;
12536
+ /** Keyboard shortcuts bound to the element, from `aria-keyshortcuts`. */
12537
+ keyshortcuts?: string;
12538
+ /** Hierarchical level, e.g. the heading level of an `<h2>`. */
12539
+ level?: number;
12540
+ /** Whether the element is a modal dialog. */
12541
+ modal?: boolean;
12542
+ /** Whether a text input accepts multiple lines. */
12543
+ multiline?: boolean;
12544
+ /** Whether more than one option can be selected. */
12545
+ multiselectable?: boolean;
12546
+ /** Accessible name, e.g. a button's label or an image's alt text. */
12547
+ name?: string;
12548
+ orientation?: string;
12549
+ /** Pressed state of a toggle button. */
12550
+ pressed?: boolean | "mixed";
12551
+ readonly?: boolean;
12552
+ required?: boolean;
12553
+ /** Author-supplied role description, from `aria-roledescription`. */
12554
+ roledescription?: string;
12555
+ selected?: boolean;
12556
+ /** Current value of an input or range element. */
12557
+ value?: string | number;
12558
+ valuemax?: number;
12559
+ valuemin?: number;
12560
+ /** Human-readable form of `value`, from `aria-valuetext`. */
12561
+ valuetext?: string;
12562
+ /** Child nodes. Absent for leaf nodes. */
12563
+ children?: BrowserRunSerializedAXNode[];
12564
+ }
12478
12565
  /** Success response for `content` action. */
12479
12566
  export type BrowserRunContentSuccessResponse = {
12480
12567
  success: true;
@@ -12518,14 +12605,31 @@ export type BrowserRunScrapeSuccessResponse = {
12518
12605
  }>;
12519
12606
  }>;
12520
12607
  };
12521
- /** Success response for `snapshot` action. */
12608
+ /** Success response for `snapshot` action. Each field is present only when the
12609
+ * corresponding entry was requested in `formats`.
12610
+ */
12522
12611
  export type BrowserRunSnapshotSuccessResponse = {
12523
12612
  success: true;
12524
12613
  result: {
12525
12614
  /** HTML content of the page. */
12526
- content: string;
12615
+ content?: string;
12527
12616
  /** Base64-encoded screenshot image. */
12528
- screenshot: string;
12617
+ screenshot?: string;
12618
+ /** Markdown content. Prefixed with YAML frontmatter (e.g. `title`) when the
12619
+ * page provides that metadata.
12620
+ */
12621
+ markdown?: string;
12622
+ /** Root of the page's accessibility tree. */
12623
+ accessibilityTree?: BrowserRunSerializedAXNode;
12624
+ };
12625
+ meta: BrowserRunResponseMeta;
12626
+ };
12627
+ /** Success response for `accessibilityTree` action. */
12628
+ export type BrowserRunAccessibilityTreeSuccessResponse = {
12629
+ success: true;
12630
+ result: {
12631
+ /** Root of the accessibility tree, or `null` when `root` matched no element. */
12632
+ accessibilityTree: BrowserRunSerializedAXNode | null;
12529
12633
  };
12530
12634
  meta: BrowserRunResponseMeta;
12531
12635
  };
@@ -12661,9 +12765,10 @@ export declare abstract class BrowserRun {
12661
12765
  options: BrowserRunLinksOptions,
12662
12766
  ): Promise<Response>;
12663
12767
  /**
12664
- * Get both the HTML content and a base64-encoded screenshot of a web page.
12768
+ * Get several representations of a web page in one request.
12665
12769
  * @param action - Must be `'snapshot'`.
12666
- * @param options - Snapshot options including screenshot settings (encoding is always base64).
12770
+ * @param options - Snapshot options including the `formats` to return and
12771
+ * screenshot settings (encoding is always base64).
12667
12772
  * @returns A `Response` containing one of:
12668
12773
  *
12669
12774
  * **Success (HTTP 200):**
@@ -12720,6 +12825,29 @@ export declare abstract class BrowserRun {
12720
12825
  action: "markdown",
12721
12826
  options: BrowserRunMarkdownOptions,
12722
12827
  ): Promise<Response>;
12828
+ /**
12829
+ * Get the accessibility tree of a web page.
12830
+ * @param action - Must be `'accessibilityTree'`.
12831
+ * @param options - Options to scope the tree to a subtree and to control
12832
+ * whether semantically uninteresting nodes are pruned.
12833
+ * @returns A `Response` containing one of:
12834
+ *
12835
+ * **Success (HTTP 200):**
12836
+ * - `BrowserRunAccessibilityTreeSuccessResponse` JSON with `Content-Type: application/json`
12837
+ * - `result.accessibilityTree` is `null` when `root` matched no element
12838
+ *
12839
+ * **Error:**
12840
+ * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
12841
+ * - HTTP 422 for a malformed `root` selector
12842
+ * - HTTP 500 with code `2017` or `2018` when the tree could not be built
12843
+ *
12844
+ * **Headers:**
12845
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
12846
+ */
12847
+ quickAction(
12848
+ action: "accessibilityTree",
12849
+ options: BrowserRunAccessibilityTreeOptions,
12850
+ ): Promise<Response>;
12723
12851
  }
12724
12852
  /**
12725
12853
  * In addition to the properties you can set in the RequestInit dict
@@ -14394,6 +14522,27 @@ export type ImageInfoResponse =
14394
14522
  width: number;
14395
14523
  height: number;
14396
14524
  };
14525
+ /**
14526
+ * Parameters for rasterizing text into an image.
14527
+ */
14528
+ export type TextRasterize = {
14529
+ /** The text content to render */
14530
+ content: string;
14531
+ /** rasterization options for the text **/
14532
+ options: TextOptions;
14533
+ };
14534
+ export type TextOptions = {
14535
+ /** Font configuration */
14536
+ font: {
14537
+ /** URL to a font file in TrueType (.ttf), OpenType (.otf), WOFF (.woff), or WOFF2 (.woff2) format */
14538
+ url: string;
14539
+ };
14540
+ /** Font size in points (pt) */
14541
+ size?: number;
14542
+ /** Text color in CSS format: hex (#RRGGBB or #RRGGBBAA), rgb(r,g,b), rgba(r,g,b,a), or named colors */
14543
+ color?: string;
14544
+ };
14545
+ export type ImageSource = ReadableStream<Uint8Array> | TextRasterize;
14397
14546
  export type ImageTransform = {
14398
14547
  width?: number;
14399
14548
  height?: number;
@@ -14505,6 +14654,9 @@ export interface ImageUploadOptions {
14505
14654
  requireSignedURLs?: boolean;
14506
14655
  metadata?: Record<string, unknown>;
14507
14656
  creator?: string;
14657
+ /**
14658
+ * If 'base64', the input data will be decoded from base64 before processing
14659
+ */
14508
14660
  encoding?: "base64";
14509
14661
  }
14510
14662
  export interface ImageUpdateOptions {
@@ -14512,11 +14664,41 @@ export interface ImageUpdateOptions {
14512
14664
  metadata?: Record<string, unknown>;
14513
14665
  creator?: string;
14514
14666
  }
14667
+ export type ImageMetadataFilterOperators = {
14668
+ eq?: string | number | boolean;
14669
+ in?: string[] | number[];
14670
+ gt?: number;
14671
+ gte?: number;
14672
+ lt?: number;
14673
+ lte?: number;
14674
+ };
14675
+ export type ImageMetadataFilterValue =
14676
+ string | number | boolean | ImageMetadataFilterOperators;
14677
+ export interface ImageListFilter {
14678
+ metadata?: Record<string, ImageMetadataFilterValue>;
14679
+ }
14515
14680
  export interface ImageListOptions {
14516
14681
  limit?: number;
14517
14682
  cursor?: string;
14518
14683
  sortOrder?: "asc" | "desc";
14519
14684
  creator?: string;
14685
+ filter?: ImageListFilter;
14686
+ }
14687
+ export interface ImageSignedUrlOptions {
14688
+ variant: string;
14689
+ expiresIn?: number;
14690
+ keyName?: string;
14691
+ }
14692
+ export interface ImageDirectUploadOptions {
14693
+ id?: string;
14694
+ requireSignedURLs?: boolean;
14695
+ metadata?: Record<string, unknown>;
14696
+ creator?: string;
14697
+ expiresIn?: number;
14698
+ }
14699
+ export interface ImageDirectUploadResult {
14700
+ id: string;
14701
+ uploadURL: string;
14520
14702
  }
14521
14703
  export interface ImageList {
14522
14704
  images: ImageMetadata[];
@@ -14534,6 +14716,13 @@ export interface ImageHandle {
14534
14716
  * @returns ReadableStream of image bytes, or null if not found
14535
14717
  */
14536
14718
  bytes(): Promise<ReadableStream<Uint8Array> | null>;
14719
+ /**
14720
+ * Generate a signed delivery URL for this hosted image.
14721
+ * @param options Signing configuration
14722
+ * @returns A signed image delivery URL
14723
+ * @throws {@link ImagesError} if signing fails
14724
+ */
14725
+ signedUrl(options: ImageSignedUrlOptions): Promise<string>;
14537
14726
  /**
14538
14727
  * Update hosted image metadata
14539
14728
  * @param options Properties to update
@@ -14572,6 +14761,16 @@ export interface HostedImagesBinding {
14572
14761
  * @throws {@link ImagesError} if list fails
14573
14762
  */
14574
14763
  list(options?: ImageListOptions): Promise<ImageList>;
14764
+ /**
14765
+ * Create a Direct Creator Upload link, letting an end user upload an
14766
+ * image straight to Cloudflare without exposing an API token
14767
+ * @param options Upload link configuration
14768
+ * @returns The new image ID and the upload URL to hand to the end user
14769
+ * @throws {@link ImagesError} if creation fails
14770
+ */
14771
+ createDirectUpload(
14772
+ options?: ImageDirectUploadOptions,
14773
+ ): Promise<ImageDirectUploadResult>;
14575
14774
  }
14576
14775
  export interface ImagesBinding {
14577
14776
  /**
@@ -14592,6 +14791,13 @@ export interface ImagesBinding {
14592
14791
  stream: ReadableStream<Uint8Array>,
14593
14792
  options?: ImageInputOptions,
14594
14793
  ): ImageTransformer;
14794
+ /**
14795
+ * Begin applying a series of transformations to text
14796
+ * @param content string to be rendered
14797
+ * @param options font, optional color and size to use in rendering text
14798
+ * @returns A transform handle
14799
+ */
14800
+ text(content: string, options: TextOptions): ImageTransformer;
14595
14801
  /**
14596
14802
  * Access hosted images CRUD operations
14597
14803
  */
@@ -14624,11 +14830,15 @@ export interface ImageTransformer {
14624
14830
  export type ImageTransformationOutputOptions = {
14625
14831
  encoding?: "base64";
14626
14832
  };
14833
+ export type ImageTransformationResponseOptions = {
14834
+ headers?: HeadersInit;
14835
+ };
14627
14836
  export interface ImageTransformationResult {
14628
14837
  /**
14629
14838
  * The image as a response, ready to store in cache or return to users
14839
+ * @param options Options that apply to the returned response, e.g. additional headers
14630
14840
  */
14631
- response(): Response;
14841
+ response(options?: ImageTransformationResponseOptions): Response;
14632
14842
  /**
14633
14843
  * The content type of the returned image
14634
14844
  */
@@ -16844,6 +17054,20 @@ export type WorkflowDurationLabel =
16844
17054
  export type WorkflowSleepDuration =
16845
17055
  `${number} ${WorkflowDurationLabel}${"s" | ""}` | number;
16846
17056
  export type WorkflowRetentionDuration = WorkflowSleepDuration;
17057
+ /** Geographic regions supported when creating a Workflow instance.
17058
+ * Location hints are best-effort placement preferences. */
17059
+ export type WorkflowInstanceLocationHint =
17060
+ | "wnam"
17061
+ | "enam"
17062
+ | "sam"
17063
+ | "weur"
17064
+ | "eeur"
17065
+ | "apac"
17066
+ | "apac-ne"
17067
+ | "apac-se"
17068
+ | "oc"
17069
+ | "afr"
17070
+ | "me";
16847
17071
  export interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
16848
17072
  /**
16849
17073
  * An id for your Workflow instance. Must be unique within the Workflow.
@@ -16861,6 +17085,9 @@ export interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
16861
17085
  successRetention?: WorkflowRetentionDuration;
16862
17086
  errorRetention?: WorkflowRetentionDuration;
16863
17087
  };
17088
+ /** A best-effort geographic placement preference for the Workflow instance.
17089
+ * See `WorkflowInstanceLocationHint` for supported regions. */
17090
+ locationHint?: WorkflowInstanceLocationHint;
16864
17091
  }
16865
17092
  export type InstanceStatus = {
16866
17093
  status:
package/package.json CHANGED
@@ -7,5 +7,5 @@
7
7
  },
8
8
  "author": "Cloudflare Workers DevProd Team <workers-devprod@cloudflare.com> (https://workers.cloudflare.com)",
9
9
  "license": "MIT OR Apache-2.0",
10
- "version": "5.20260818.1"
10
+ "version": "5.20260820.1"
11
11
  }