@cloudflare/workers-types 5.20260819.1 → 5.20260821.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.
@@ -715,7 +715,7 @@ interface DurableObjectState<Props = unknown> {
715
715
  setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
716
716
  getHibernatableWebSocketEventTimeout(): number | null;
717
717
  getTags(ws: WebSocket): string[];
718
- abort(reason?: string): void;
718
+ abort(reason?: string, options?: DurableObjectAbortOptions): void;
719
719
  configureReadReplication(
720
720
  options: DurableObjectReadReplicationOptions,
721
721
  ): Promise<void>;
@@ -799,6 +799,9 @@ interface DurableObjectStorage {
799
799
  /** @deprecated Use `ctx.configureReadReplication()` instead. */
800
800
  disableReplicas(): void;
801
801
  }
802
+ interface DurableObjectAbortOptions {
803
+ retryAlarm?: boolean;
804
+ }
802
805
  interface DurableObjectReadReplicationOptions {
803
806
  mode: "auto" | "disabled";
804
807
  }
@@ -4078,10 +4081,15 @@ interface ContainerDirectorySnapshotOptions {
4078
4081
  dir: string;
4079
4082
  name?: string;
4080
4083
  }
4081
- interface ContainerDirectorySnapshotRestoreParams {
4082
- snapshot: ContainerDirectorySnapshot;
4083
- mountPoint?: string;
4084
- }
4084
+ type ContainerDirectorySnapshotRestoreParams =
4085
+ | {
4086
+ snapshot: ContainerDirectorySnapshot;
4087
+ mountPoint?: string;
4088
+ }
4089
+ | {
4090
+ snapshot?: undefined;
4091
+ mountPoint: string;
4092
+ };
4085
4093
  interface ContainerSnapshot {
4086
4094
  id: string;
4087
4095
  size: number;
@@ -12710,10 +12718,30 @@ type BrowserRunLinksOptions = BrowserRunCommonOptions & {
12710
12718
  /** When true, exclude links pointing to external domains. @default false */
12711
12719
  excludeExternalLinks?: boolean;
12712
12720
  };
12721
+ type BrowserRunSnapshotFormat =
12722
+ "content" | "screenshot" | "markdown" | "accessibilityTree";
12713
12723
  type BrowserRunSnapshotOptions = BrowserRunCommonOptions & {
12724
+ /** Which representations of the page to return. At least two distinct formats
12725
+ * are required; request a single format from its dedicated action instead.
12726
+ * @default ["content","screenshot"]
12727
+ */
12728
+ formats?: BrowserRunSnapshotFormat[];
12714
12729
  /** @see https://pptr.dev/api/puppeteer.screenshotoptions */
12715
12730
  screenshotOptions?: Omit<BrowserRunPuppeteerScreenshotOptions, "encoding">;
12716
12731
  };
12732
+ /** Options for the `accessibilityTree` quick action. */
12733
+ type BrowserRunAccessibilityTreeOptions = BrowserRunCommonOptions & {
12734
+ /** When true, prune nodes that carry no semantic meaning, such as generic
12735
+ * containers. Defaults to true, or to false when `root` is set so that the
12736
+ * requested subtree is returned as-is.
12737
+ */
12738
+ interestingOnly?: boolean;
12739
+ /** CSS selector limiting the tree to the matching element's subtree.
12740
+ * A selector that matches nothing yields `accessibilityTree: null` with
12741
+ * HTTP 200; a malformed selector is an error.
12742
+ */
12743
+ root?: string;
12744
+ };
12717
12745
  interface BrowserRunJsonBaseOptions {
12718
12746
  /** Custom AI models to try in order. Max 3. Falls back to next on error. */
12719
12747
  custom_ai?: Array<{
@@ -12751,6 +12779,58 @@ type BrowserRunResponseMeta = {
12751
12779
  /** Page title */
12752
12780
  title: string;
12753
12781
  };
12782
+ /**
12783
+ * A node in the page's accessibility tree, as exposed to assistive technology.
12784
+ * `role` is the only field always present; the rest are populated when the
12785
+ * underlying element defines them.
12786
+ * @see https://pptr.dev/api/puppeteer.serializedaxnode
12787
+ */
12788
+ interface BrowserRunSerializedAXNode {
12789
+ /** The ARIA role, e.g. `"button"`, `"heading"`, `"RootWebArea"`. */
12790
+ role: string;
12791
+ /** The `aria-autocomplete` value. */
12792
+ autocomplete?: string;
12793
+ /** Checked state of a checkbox, radio, or menu item. */
12794
+ checked?: boolean | "mixed";
12795
+ /** Accessible description, typically from `aria-describedby` or `title`. */
12796
+ description?: string;
12797
+ disabled?: boolean;
12798
+ expanded?: boolean;
12799
+ /** Whether the element currently holds keyboard focus. */
12800
+ focused?: boolean;
12801
+ /** The kind of popup the element triggers, e.g. `"menu"`, `"dialog"`. */
12802
+ haspopup?: string;
12803
+ /** The `aria-invalid` value. */
12804
+ invalid?: string;
12805
+ /** Keyboard shortcuts bound to the element, from `aria-keyshortcuts`. */
12806
+ keyshortcuts?: string;
12807
+ /** Hierarchical level, e.g. the heading level of an `<h2>`. */
12808
+ level?: number;
12809
+ /** Whether the element is a modal dialog. */
12810
+ modal?: boolean;
12811
+ /** Whether a text input accepts multiple lines. */
12812
+ multiline?: boolean;
12813
+ /** Whether more than one option can be selected. */
12814
+ multiselectable?: boolean;
12815
+ /** Accessible name, e.g. a button's label or an image's alt text. */
12816
+ name?: string;
12817
+ orientation?: string;
12818
+ /** Pressed state of a toggle button. */
12819
+ pressed?: boolean | "mixed";
12820
+ readonly?: boolean;
12821
+ required?: boolean;
12822
+ /** Author-supplied role description, from `aria-roledescription`. */
12823
+ roledescription?: string;
12824
+ selected?: boolean;
12825
+ /** Current value of an input or range element. */
12826
+ value?: string | number;
12827
+ valuemax?: number;
12828
+ valuemin?: number;
12829
+ /** Human-readable form of `value`, from `aria-valuetext`. */
12830
+ valuetext?: string;
12831
+ /** Child nodes. Absent for leaf nodes. */
12832
+ children?: BrowserRunSerializedAXNode[];
12833
+ }
12754
12834
  /** Success response for `content` action. */
12755
12835
  type BrowserRunContentSuccessResponse = {
12756
12836
  success: true;
@@ -12794,14 +12874,31 @@ type BrowserRunScrapeSuccessResponse = {
12794
12874
  }>;
12795
12875
  }>;
12796
12876
  };
12797
- /** Success response for `snapshot` action. */
12877
+ /** Success response for `snapshot` action. Each field is present only when the
12878
+ * corresponding entry was requested in `formats`.
12879
+ */
12798
12880
  type BrowserRunSnapshotSuccessResponse = {
12799
12881
  success: true;
12800
12882
  result: {
12801
12883
  /** HTML content of the page. */
12802
- content: string;
12884
+ content?: string;
12803
12885
  /** Base64-encoded screenshot image. */
12804
- screenshot: string;
12886
+ screenshot?: string;
12887
+ /** Markdown content. Prefixed with YAML frontmatter (e.g. `title`) when the
12888
+ * page provides that metadata.
12889
+ */
12890
+ markdown?: string;
12891
+ /** Root of the page's accessibility tree. */
12892
+ accessibilityTree?: BrowserRunSerializedAXNode;
12893
+ };
12894
+ meta: BrowserRunResponseMeta;
12895
+ };
12896
+ /** Success response for `accessibilityTree` action. */
12897
+ type BrowserRunAccessibilityTreeSuccessResponse = {
12898
+ success: true;
12899
+ result: {
12900
+ /** Root of the accessibility tree, or `null` when `root` matched no element. */
12901
+ accessibilityTree: BrowserRunSerializedAXNode | null;
12805
12902
  };
12806
12903
  meta: BrowserRunResponseMeta;
12807
12904
  };
@@ -12937,9 +13034,10 @@ declare abstract class BrowserRun {
12937
13034
  options: BrowserRunLinksOptions,
12938
13035
  ): Promise<Response>;
12939
13036
  /**
12940
- * Get both the HTML content and a base64-encoded screenshot of a web page.
13037
+ * Get several representations of a web page in one request.
12941
13038
  * @param action - Must be `'snapshot'`.
12942
- * @param options - Snapshot options including screenshot settings (encoding is always base64).
13039
+ * @param options - Snapshot options including the `formats` to return and
13040
+ * screenshot settings (encoding is always base64).
12943
13041
  * @returns A `Response` containing one of:
12944
13042
  *
12945
13043
  * **Success (HTTP 200):**
@@ -12996,6 +13094,29 @@ declare abstract class BrowserRun {
12996
13094
  action: "markdown",
12997
13095
  options: BrowserRunMarkdownOptions,
12998
13096
  ): Promise<Response>;
13097
+ /**
13098
+ * Get the accessibility tree of a web page.
13099
+ * @param action - Must be `'accessibilityTree'`.
13100
+ * @param options - Options to scope the tree to a subtree and to control
13101
+ * whether semantically uninteresting nodes are pruned.
13102
+ * @returns A `Response` containing one of:
13103
+ *
13104
+ * **Success (HTTP 200):**
13105
+ * - `BrowserRunAccessibilityTreeSuccessResponse` JSON with `Content-Type: application/json`
13106
+ * - `result.accessibilityTree` is `null` when `root` matched no element
13107
+ *
13108
+ * **Error:**
13109
+ * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
13110
+ * - HTTP 422 for a malformed `root` selector
13111
+ * - HTTP 500 with code `2017` or `2018` when the tree could not be built
13112
+ *
13113
+ * **Headers:**
13114
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
13115
+ */
13116
+ quickAction(
13117
+ action: "accessibilityTree",
13118
+ options: BrowserRunAccessibilityTreeOptions,
13119
+ ): Promise<Response>;
12999
13120
  }
13000
13121
  /**
13001
13122
  * In addition to the properties you can set in the RequestInit dict
@@ -14667,6 +14788,27 @@ type ImageInfoResponse =
14667
14788
  width: number;
14668
14789
  height: number;
14669
14790
  };
14791
+ /**
14792
+ * Parameters for rasterizing text into an image.
14793
+ */
14794
+ type TextRasterize = {
14795
+ /** The text content to render */
14796
+ content: string;
14797
+ /** rasterization options for the text **/
14798
+ options: TextOptions;
14799
+ };
14800
+ type TextOptions = {
14801
+ /** Font configuration */
14802
+ font: {
14803
+ /** URL to a font file in TrueType (.ttf), OpenType (.otf), WOFF (.woff), or WOFF2 (.woff2) format */
14804
+ url: string;
14805
+ };
14806
+ /** Font size in points (pt) */
14807
+ size?: number;
14808
+ /** Text color in CSS format: hex (#RRGGBB or #RRGGBBAA), rgb(r,g,b), rgba(r,g,b,a), or named colors */
14809
+ color?: string;
14810
+ };
14811
+ type ImageSource = ReadableStream<Uint8Array> | TextRasterize;
14670
14812
  type ImageTransform = {
14671
14813
  width?: number;
14672
14814
  height?: number;
@@ -14778,6 +14920,9 @@ interface ImageUploadOptions {
14778
14920
  requireSignedURLs?: boolean;
14779
14921
  metadata?: Record<string, unknown>;
14780
14922
  creator?: string;
14923
+ /**
14924
+ * If 'base64', the input data will be decoded from base64 before processing
14925
+ */
14781
14926
  encoding?: "base64";
14782
14927
  }
14783
14928
  interface ImageUpdateOptions {
@@ -14785,11 +14930,41 @@ interface ImageUpdateOptions {
14785
14930
  metadata?: Record<string, unknown>;
14786
14931
  creator?: string;
14787
14932
  }
14933
+ type ImageMetadataFilterOperators = {
14934
+ eq?: string | number | boolean;
14935
+ in?: string[] | number[];
14936
+ gt?: number;
14937
+ gte?: number;
14938
+ lt?: number;
14939
+ lte?: number;
14940
+ };
14941
+ type ImageMetadataFilterValue =
14942
+ string | number | boolean | ImageMetadataFilterOperators;
14943
+ interface ImageListFilter {
14944
+ metadata?: Record<string, ImageMetadataFilterValue>;
14945
+ }
14788
14946
  interface ImageListOptions {
14789
14947
  limit?: number;
14790
14948
  cursor?: string;
14791
14949
  sortOrder?: "asc" | "desc";
14792
14950
  creator?: string;
14951
+ filter?: ImageListFilter;
14952
+ }
14953
+ interface ImageSignedUrlOptions {
14954
+ variant: string;
14955
+ expiresIn?: number;
14956
+ keyName?: string;
14957
+ }
14958
+ interface ImageDirectUploadOptions {
14959
+ id?: string;
14960
+ requireSignedURLs?: boolean;
14961
+ metadata?: Record<string, unknown>;
14962
+ creator?: string;
14963
+ expiresIn?: number;
14964
+ }
14965
+ interface ImageDirectUploadResult {
14966
+ id: string;
14967
+ uploadURL: string;
14793
14968
  }
14794
14969
  interface ImageList {
14795
14970
  images: ImageMetadata[];
@@ -14807,6 +14982,13 @@ interface ImageHandle {
14807
14982
  * @returns ReadableStream of image bytes, or null if not found
14808
14983
  */
14809
14984
  bytes(): Promise<ReadableStream<Uint8Array> | null>;
14985
+ /**
14986
+ * Generate a signed delivery URL for this hosted image.
14987
+ * @param options Signing configuration
14988
+ * @returns A signed image delivery URL
14989
+ * @throws {@link ImagesError} if signing fails
14990
+ */
14991
+ signedUrl(options: ImageSignedUrlOptions): Promise<string>;
14810
14992
  /**
14811
14993
  * Update hosted image metadata
14812
14994
  * @param options Properties to update
@@ -14845,6 +15027,16 @@ interface HostedImagesBinding {
14845
15027
  * @throws {@link ImagesError} if list fails
14846
15028
  */
14847
15029
  list(options?: ImageListOptions): Promise<ImageList>;
15030
+ /**
15031
+ * Create a Direct Creator Upload link, letting an end user upload an
15032
+ * image straight to Cloudflare without exposing an API token
15033
+ * @param options Upload link configuration
15034
+ * @returns The new image ID and the upload URL to hand to the end user
15035
+ * @throws {@link ImagesError} if creation fails
15036
+ */
15037
+ createDirectUpload(
15038
+ options?: ImageDirectUploadOptions,
15039
+ ): Promise<ImageDirectUploadResult>;
14848
15040
  }
14849
15041
  interface ImagesBinding {
14850
15042
  /**
@@ -14865,6 +15057,13 @@ interface ImagesBinding {
14865
15057
  stream: ReadableStream<Uint8Array>,
14866
15058
  options?: ImageInputOptions,
14867
15059
  ): ImageTransformer;
15060
+ /**
15061
+ * Begin applying a series of transformations to text
15062
+ * @param content string to be rendered
15063
+ * @param options font, optional color and size to use in rendering text
15064
+ * @returns A transform handle
15065
+ */
15066
+ text(content: string, options: TextOptions): ImageTransformer;
14868
15067
  /**
14869
15068
  * Access hosted images CRUD operations
14870
15069
  */
@@ -16553,7 +16752,8 @@ declare namespace TailStream {
16553
16752
  | "responseStreamDisconnected"
16554
16753
  | "scriptNotFound"
16555
16754
  | "internalError"
16556
- | "exceededWallTime";
16755
+ | "exceededWallTime"
16756
+ | "aborted";
16557
16757
  interface ScriptVersion {
16558
16758
  readonly id: string;
16559
16759
  readonly tag?: string;
@@ -17189,6 +17389,20 @@ type WorkflowDurationLabel =
17189
17389
  type WorkflowSleepDuration =
17190
17390
  `${number} ${WorkflowDurationLabel}${"s" | ""}` | number;
17191
17391
  type WorkflowRetentionDuration = WorkflowSleepDuration;
17392
+ /** Geographic regions supported when creating a Workflow instance.
17393
+ * Location hints are best-effort placement preferences. */
17394
+ type WorkflowInstanceLocationHint =
17395
+ | "wnam"
17396
+ | "enam"
17397
+ | "sam"
17398
+ | "weur"
17399
+ | "eeur"
17400
+ | "apac"
17401
+ | "apac-ne"
17402
+ | "apac-se"
17403
+ | "oc"
17404
+ | "afr"
17405
+ | "me";
17192
17406
  interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
17193
17407
  /**
17194
17408
  * An id for your Workflow instance. Must be unique within the Workflow.
@@ -17206,6 +17420,9 @@ interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
17206
17420
  successRetention?: WorkflowRetentionDuration;
17207
17421
  errorRetention?: WorkflowRetentionDuration;
17208
17422
  };
17423
+ /** A best-effort geographic placement preference for the Workflow instance.
17424
+ * See `WorkflowInstanceLocationHint` for supported regions. */
17425
+ locationHint?: WorkflowInstanceLocationHint;
17209
17426
  }
17210
17427
  type InstanceStatus = {
17211
17428
  status: