@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.
@@ -718,7 +718,7 @@ export interface DurableObjectState<Props = unknown> {
718
718
  setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
719
719
  getHibernatableWebSocketEventTimeout(): number | null;
720
720
  getTags(ws: WebSocket): string[];
721
- abort(reason?: string): void;
721
+ abort(reason?: string, options?: DurableObjectAbortOptions): void;
722
722
  configureReadReplication(
723
723
  options: DurableObjectReadReplicationOptions,
724
724
  ): Promise<void>;
@@ -802,6 +802,9 @@ export interface DurableObjectStorage {
802
802
  /** @deprecated Use `ctx.configureReadReplication()` instead. */
803
803
  disableReplicas(): void;
804
804
  }
805
+ export interface DurableObjectAbortOptions {
806
+ retryAlarm?: boolean;
807
+ }
805
808
  export interface DurableObjectReadReplicationOptions {
806
809
  mode: "auto" | "disabled";
807
810
  }
@@ -4087,10 +4090,15 @@ export interface ContainerDirectorySnapshotOptions {
4087
4090
  dir: string;
4088
4091
  name?: string;
4089
4092
  }
4090
- export interface ContainerDirectorySnapshotRestoreParams {
4091
- snapshot: ContainerDirectorySnapshot;
4092
- mountPoint?: string;
4093
- }
4093
+ export type ContainerDirectorySnapshotRestoreParams =
4094
+ | {
4095
+ snapshot: ContainerDirectorySnapshot;
4096
+ mountPoint?: string;
4097
+ }
4098
+ | {
4099
+ snapshot?: undefined;
4100
+ mountPoint: string;
4101
+ };
4094
4102
  export interface ContainerSnapshot {
4095
4103
  id: string;
4096
4104
  size: number;
@@ -12724,10 +12732,30 @@ export type BrowserRunLinksOptions = BrowserRunCommonOptions & {
12724
12732
  /** When true, exclude links pointing to external domains. @default false */
12725
12733
  excludeExternalLinks?: boolean;
12726
12734
  };
12735
+ export type BrowserRunSnapshotFormat =
12736
+ "content" | "screenshot" | "markdown" | "accessibilityTree";
12727
12737
  export type BrowserRunSnapshotOptions = BrowserRunCommonOptions & {
12738
+ /** Which representations of the page to return. At least two distinct formats
12739
+ * are required; request a single format from its dedicated action instead.
12740
+ * @default ["content","screenshot"]
12741
+ */
12742
+ formats?: BrowserRunSnapshotFormat[];
12728
12743
  /** @see https://pptr.dev/api/puppeteer.screenshotoptions */
12729
12744
  screenshotOptions?: Omit<BrowserRunPuppeteerScreenshotOptions, "encoding">;
12730
12745
  };
12746
+ /** Options for the `accessibilityTree` quick action. */
12747
+ export type BrowserRunAccessibilityTreeOptions = BrowserRunCommonOptions & {
12748
+ /** When true, prune nodes that carry no semantic meaning, such as generic
12749
+ * containers. Defaults to true, or to false when `root` is set so that the
12750
+ * requested subtree is returned as-is.
12751
+ */
12752
+ interestingOnly?: boolean;
12753
+ /** CSS selector limiting the tree to the matching element's subtree.
12754
+ * A selector that matches nothing yields `accessibilityTree: null` with
12755
+ * HTTP 200; a malformed selector is an error.
12756
+ */
12757
+ root?: string;
12758
+ };
12731
12759
  export interface BrowserRunJsonBaseOptions {
12732
12760
  /** Custom AI models to try in order. Max 3. Falls back to next on error. */
12733
12761
  custom_ai?: Array<{
@@ -12765,6 +12793,58 @@ export type BrowserRunResponseMeta = {
12765
12793
  /** Page title */
12766
12794
  title: string;
12767
12795
  };
12796
+ /**
12797
+ * A node in the page's accessibility tree, as exposed to assistive technology.
12798
+ * `role` is the only field always present; the rest are populated when the
12799
+ * underlying element defines them.
12800
+ * @see https://pptr.dev/api/puppeteer.serializedaxnode
12801
+ */
12802
+ export interface BrowserRunSerializedAXNode {
12803
+ /** The ARIA role, e.g. `"button"`, `"heading"`, `"RootWebArea"`. */
12804
+ role: string;
12805
+ /** The `aria-autocomplete` value. */
12806
+ autocomplete?: string;
12807
+ /** Checked state of a checkbox, radio, or menu item. */
12808
+ checked?: boolean | "mixed";
12809
+ /** Accessible description, typically from `aria-describedby` or `title`. */
12810
+ description?: string;
12811
+ disabled?: boolean;
12812
+ expanded?: boolean;
12813
+ /** Whether the element currently holds keyboard focus. */
12814
+ focused?: boolean;
12815
+ /** The kind of popup the element triggers, e.g. `"menu"`, `"dialog"`. */
12816
+ haspopup?: string;
12817
+ /** The `aria-invalid` value. */
12818
+ invalid?: string;
12819
+ /** Keyboard shortcuts bound to the element, from `aria-keyshortcuts`. */
12820
+ keyshortcuts?: string;
12821
+ /** Hierarchical level, e.g. the heading level of an `<h2>`. */
12822
+ level?: number;
12823
+ /** Whether the element is a modal dialog. */
12824
+ modal?: boolean;
12825
+ /** Whether a text input accepts multiple lines. */
12826
+ multiline?: boolean;
12827
+ /** Whether more than one option can be selected. */
12828
+ multiselectable?: boolean;
12829
+ /** Accessible name, e.g. a button's label or an image's alt text. */
12830
+ name?: string;
12831
+ orientation?: string;
12832
+ /** Pressed state of a toggle button. */
12833
+ pressed?: boolean | "mixed";
12834
+ readonly?: boolean;
12835
+ required?: boolean;
12836
+ /** Author-supplied role description, from `aria-roledescription`. */
12837
+ roledescription?: string;
12838
+ selected?: boolean;
12839
+ /** Current value of an input or range element. */
12840
+ value?: string | number;
12841
+ valuemax?: number;
12842
+ valuemin?: number;
12843
+ /** Human-readable form of `value`, from `aria-valuetext`. */
12844
+ valuetext?: string;
12845
+ /** Child nodes. Absent for leaf nodes. */
12846
+ children?: BrowserRunSerializedAXNode[];
12847
+ }
12768
12848
  /** Success response for `content` action. */
12769
12849
  export type BrowserRunContentSuccessResponse = {
12770
12850
  success: true;
@@ -12808,14 +12888,31 @@ export type BrowserRunScrapeSuccessResponse = {
12808
12888
  }>;
12809
12889
  }>;
12810
12890
  };
12811
- /** Success response for `snapshot` action. */
12891
+ /** Success response for `snapshot` action. Each field is present only when the
12892
+ * corresponding entry was requested in `formats`.
12893
+ */
12812
12894
  export type BrowserRunSnapshotSuccessResponse = {
12813
12895
  success: true;
12814
12896
  result: {
12815
12897
  /** HTML content of the page. */
12816
- content: string;
12898
+ content?: string;
12817
12899
  /** Base64-encoded screenshot image. */
12818
- screenshot: string;
12900
+ screenshot?: string;
12901
+ /** Markdown content. Prefixed with YAML frontmatter (e.g. `title`) when the
12902
+ * page provides that metadata.
12903
+ */
12904
+ markdown?: string;
12905
+ /** Root of the page's accessibility tree. */
12906
+ accessibilityTree?: BrowserRunSerializedAXNode;
12907
+ };
12908
+ meta: BrowserRunResponseMeta;
12909
+ };
12910
+ /** Success response for `accessibilityTree` action. */
12911
+ export type BrowserRunAccessibilityTreeSuccessResponse = {
12912
+ success: true;
12913
+ result: {
12914
+ /** Root of the accessibility tree, or `null` when `root` matched no element. */
12915
+ accessibilityTree: BrowserRunSerializedAXNode | null;
12819
12916
  };
12820
12917
  meta: BrowserRunResponseMeta;
12821
12918
  };
@@ -12951,9 +13048,10 @@ export declare abstract class BrowserRun {
12951
13048
  options: BrowserRunLinksOptions,
12952
13049
  ): Promise<Response>;
12953
13050
  /**
12954
- * Get both the HTML content and a base64-encoded screenshot of a web page.
13051
+ * Get several representations of a web page in one request.
12955
13052
  * @param action - Must be `'snapshot'`.
12956
- * @param options - Snapshot options including screenshot settings (encoding is always base64).
13053
+ * @param options - Snapshot options including the `formats` to return and
13054
+ * screenshot settings (encoding is always base64).
12957
13055
  * @returns A `Response` containing one of:
12958
13056
  *
12959
13057
  * **Success (HTTP 200):**
@@ -13010,6 +13108,29 @@ export declare abstract class BrowserRun {
13010
13108
  action: "markdown",
13011
13109
  options: BrowserRunMarkdownOptions,
13012
13110
  ): Promise<Response>;
13111
+ /**
13112
+ * Get the accessibility tree of a web page.
13113
+ * @param action - Must be `'accessibilityTree'`.
13114
+ * @param options - Options to scope the tree to a subtree and to control
13115
+ * whether semantically uninteresting nodes are pruned.
13116
+ * @returns A `Response` containing one of:
13117
+ *
13118
+ * **Success (HTTP 200):**
13119
+ * - `BrowserRunAccessibilityTreeSuccessResponse` JSON with `Content-Type: application/json`
13120
+ * - `result.accessibilityTree` is `null` when `root` matched no element
13121
+ *
13122
+ * **Error:**
13123
+ * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
13124
+ * - HTTP 422 for a malformed `root` selector
13125
+ * - HTTP 500 with code `2017` or `2018` when the tree could not be built
13126
+ *
13127
+ * **Headers:**
13128
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
13129
+ */
13130
+ quickAction(
13131
+ action: "accessibilityTree",
13132
+ options: BrowserRunAccessibilityTreeOptions,
13133
+ ): Promise<Response>;
13013
13134
  }
13014
13135
  /**
13015
13136
  * In addition to the properties you can set in the RequestInit dict
@@ -14684,6 +14805,27 @@ export type ImageInfoResponse =
14684
14805
  width: number;
14685
14806
  height: number;
14686
14807
  };
14808
+ /**
14809
+ * Parameters for rasterizing text into an image.
14810
+ */
14811
+ export type TextRasterize = {
14812
+ /** The text content to render */
14813
+ content: string;
14814
+ /** rasterization options for the text **/
14815
+ options: TextOptions;
14816
+ };
14817
+ export type TextOptions = {
14818
+ /** Font configuration */
14819
+ font: {
14820
+ /** URL to a font file in TrueType (.ttf), OpenType (.otf), WOFF (.woff), or WOFF2 (.woff2) format */
14821
+ url: string;
14822
+ };
14823
+ /** Font size in points (pt) */
14824
+ size?: number;
14825
+ /** Text color in CSS format: hex (#RRGGBB or #RRGGBBAA), rgb(r,g,b), rgba(r,g,b,a), or named colors */
14826
+ color?: string;
14827
+ };
14828
+ export type ImageSource = ReadableStream<Uint8Array> | TextRasterize;
14687
14829
  export type ImageTransform = {
14688
14830
  width?: number;
14689
14831
  height?: number;
@@ -14795,6 +14937,9 @@ export interface ImageUploadOptions {
14795
14937
  requireSignedURLs?: boolean;
14796
14938
  metadata?: Record<string, unknown>;
14797
14939
  creator?: string;
14940
+ /**
14941
+ * If 'base64', the input data will be decoded from base64 before processing
14942
+ */
14798
14943
  encoding?: "base64";
14799
14944
  }
14800
14945
  export interface ImageUpdateOptions {
@@ -14802,11 +14947,41 @@ export interface ImageUpdateOptions {
14802
14947
  metadata?: Record<string, unknown>;
14803
14948
  creator?: string;
14804
14949
  }
14950
+ export type ImageMetadataFilterOperators = {
14951
+ eq?: string | number | boolean;
14952
+ in?: string[] | number[];
14953
+ gt?: number;
14954
+ gte?: number;
14955
+ lt?: number;
14956
+ lte?: number;
14957
+ };
14958
+ export type ImageMetadataFilterValue =
14959
+ string | number | boolean | ImageMetadataFilterOperators;
14960
+ export interface ImageListFilter {
14961
+ metadata?: Record<string, ImageMetadataFilterValue>;
14962
+ }
14805
14963
  export interface ImageListOptions {
14806
14964
  limit?: number;
14807
14965
  cursor?: string;
14808
14966
  sortOrder?: "asc" | "desc";
14809
14967
  creator?: string;
14968
+ filter?: ImageListFilter;
14969
+ }
14970
+ export interface ImageSignedUrlOptions {
14971
+ variant: string;
14972
+ expiresIn?: number;
14973
+ keyName?: string;
14974
+ }
14975
+ export interface ImageDirectUploadOptions {
14976
+ id?: string;
14977
+ requireSignedURLs?: boolean;
14978
+ metadata?: Record<string, unknown>;
14979
+ creator?: string;
14980
+ expiresIn?: number;
14981
+ }
14982
+ export interface ImageDirectUploadResult {
14983
+ id: string;
14984
+ uploadURL: string;
14810
14985
  }
14811
14986
  export interface ImageList {
14812
14987
  images: ImageMetadata[];
@@ -14824,6 +14999,13 @@ export interface ImageHandle {
14824
14999
  * @returns ReadableStream of image bytes, or null if not found
14825
15000
  */
14826
15001
  bytes(): Promise<ReadableStream<Uint8Array> | null>;
15002
+ /**
15003
+ * Generate a signed delivery URL for this hosted image.
15004
+ * @param options Signing configuration
15005
+ * @returns A signed image delivery URL
15006
+ * @throws {@link ImagesError} if signing fails
15007
+ */
15008
+ signedUrl(options: ImageSignedUrlOptions): Promise<string>;
14827
15009
  /**
14828
15010
  * Update hosted image metadata
14829
15011
  * @param options Properties to update
@@ -14862,6 +15044,16 @@ export interface HostedImagesBinding {
14862
15044
  * @throws {@link ImagesError} if list fails
14863
15045
  */
14864
15046
  list(options?: ImageListOptions): Promise<ImageList>;
15047
+ /**
15048
+ * Create a Direct Creator Upload link, letting an end user upload an
15049
+ * image straight to Cloudflare without exposing an API token
15050
+ * @param options Upload link configuration
15051
+ * @returns The new image ID and the upload URL to hand to the end user
15052
+ * @throws {@link ImagesError} if creation fails
15053
+ */
15054
+ createDirectUpload(
15055
+ options?: ImageDirectUploadOptions,
15056
+ ): Promise<ImageDirectUploadResult>;
14865
15057
  }
14866
15058
  export interface ImagesBinding {
14867
15059
  /**
@@ -14882,6 +15074,13 @@ export interface ImagesBinding {
14882
15074
  stream: ReadableStream<Uint8Array>,
14883
15075
  options?: ImageInputOptions,
14884
15076
  ): ImageTransformer;
15077
+ /**
15078
+ * Begin applying a series of transformations to text
15079
+ * @param content string to be rendered
15080
+ * @param options font, optional color and size to use in rendering text
15081
+ * @returns A transform handle
15082
+ */
15083
+ text(content: string, options: TextOptions): ImageTransformer;
14885
15084
  /**
14886
15085
  * Access hosted images CRUD operations
14887
15086
  */
@@ -16511,7 +16710,8 @@ export declare namespace TailStream {
16511
16710
  | "responseStreamDisconnected"
16512
16711
  | "scriptNotFound"
16513
16712
  | "internalError"
16514
- | "exceededWallTime";
16713
+ | "exceededWallTime"
16714
+ | "aborted";
16515
16715
  interface ScriptVersion {
16516
16716
  readonly id: string;
16517
16717
  readonly tag?: string;
@@ -17138,6 +17338,20 @@ export type WorkflowDurationLabel =
17138
17338
  export type WorkflowSleepDuration =
17139
17339
  `${number} ${WorkflowDurationLabel}${"s" | ""}` | number;
17140
17340
  export type WorkflowRetentionDuration = WorkflowSleepDuration;
17341
+ /** Geographic regions supported when creating a Workflow instance.
17342
+ * Location hints are best-effort placement preferences. */
17343
+ export type WorkflowInstanceLocationHint =
17344
+ | "wnam"
17345
+ | "enam"
17346
+ | "sam"
17347
+ | "weur"
17348
+ | "eeur"
17349
+ | "apac"
17350
+ | "apac-ne"
17351
+ | "apac-se"
17352
+ | "oc"
17353
+ | "afr"
17354
+ | "me";
17141
17355
  export interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
17142
17356
  /**
17143
17357
  * An id for your Workflow instance. Must be unique within the Workflow.
@@ -17155,6 +17369,9 @@ export interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
17155
17369
  successRetention?: WorkflowRetentionDuration;
17156
17370
  errorRetention?: WorkflowRetentionDuration;
17157
17371
  };
17372
+ /** A best-effort geographic placement preference for the Workflow instance.
17373
+ * See `WorkflowInstanceLocationHint` for supported regions. */
17374
+ locationHint?: WorkflowInstanceLocationHint;
17158
17375
  }
17159
17376
  export type InstanceStatus = {
17160
17377
  status: