@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.
package/index.ts CHANGED
@@ -709,7 +709,7 @@ export interface DurableObjectState<Props = unknown> {
709
709
  setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
710
710
  getHibernatableWebSocketEventTimeout(): number | null;
711
711
  getTags(ws: WebSocket): string[];
712
- abort(reason?: string): void;
712
+ abort(reason?: string, options?: DurableObjectAbortOptions): void;
713
713
  }
714
714
  export interface DurableObjectTransaction {
715
715
  get<T = unknown>(
@@ -783,6 +783,9 @@ export interface DurableObjectStorage {
783
783
  getBookmarkForTime(timestamp: number | Date): Promise<string>;
784
784
  onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
785
785
  }
786
+ export interface DurableObjectAbortOptions {
787
+ retryAlarm?: boolean;
788
+ }
786
789
  export interface DurableObjectListOptions {
787
790
  start?: string;
788
791
  startAfter?: string;
@@ -3997,10 +4000,15 @@ export interface ContainerDirectorySnapshotOptions {
3997
4000
  dir: string;
3998
4001
  name?: string;
3999
4002
  }
4000
- export interface ContainerDirectorySnapshotRestoreParams {
4001
- snapshot: ContainerDirectorySnapshot;
4002
- mountPoint?: string;
4003
- }
4003
+ export type ContainerDirectorySnapshotRestoreParams =
4004
+ | {
4005
+ snapshot: ContainerDirectorySnapshot;
4006
+ mountPoint?: string;
4007
+ }
4008
+ | {
4009
+ snapshot?: undefined;
4010
+ mountPoint: string;
4011
+ };
4004
4012
  export interface ContainerSnapshot {
4005
4013
  id: string;
4006
4014
  size: number;
@@ -12449,10 +12457,30 @@ export type BrowserRunLinksOptions = BrowserRunCommonOptions & {
12449
12457
  /** When true, exclude links pointing to external domains. @default false */
12450
12458
  excludeExternalLinks?: boolean;
12451
12459
  };
12460
+ export type BrowserRunSnapshotFormat =
12461
+ "content" | "screenshot" | "markdown" | "accessibilityTree";
12452
12462
  export type BrowserRunSnapshotOptions = BrowserRunCommonOptions & {
12463
+ /** Which representations of the page to return. At least two distinct formats
12464
+ * are required; request a single format from its dedicated action instead.
12465
+ * @default ["content","screenshot"]
12466
+ */
12467
+ formats?: BrowserRunSnapshotFormat[];
12453
12468
  /** @see https://pptr.dev/api/puppeteer.screenshotoptions */
12454
12469
  screenshotOptions?: Omit<BrowserRunPuppeteerScreenshotOptions, "encoding">;
12455
12470
  };
12471
+ /** Options for the `accessibilityTree` quick action. */
12472
+ export type BrowserRunAccessibilityTreeOptions = BrowserRunCommonOptions & {
12473
+ /** When true, prune nodes that carry no semantic meaning, such as generic
12474
+ * containers. Defaults to true, or to false when `root` is set so that the
12475
+ * requested subtree is returned as-is.
12476
+ */
12477
+ interestingOnly?: boolean;
12478
+ /** CSS selector limiting the tree to the matching element's subtree.
12479
+ * A selector that matches nothing yields `accessibilityTree: null` with
12480
+ * HTTP 200; a malformed selector is an error.
12481
+ */
12482
+ root?: string;
12483
+ };
12456
12484
  export interface BrowserRunJsonBaseOptions {
12457
12485
  /** Custom AI models to try in order. Max 3. Falls back to next on error. */
12458
12486
  custom_ai?: Array<{
@@ -12490,6 +12518,58 @@ export type BrowserRunResponseMeta = {
12490
12518
  /** Page title */
12491
12519
  title: string;
12492
12520
  };
12521
+ /**
12522
+ * A node in the page's accessibility tree, as exposed to assistive technology.
12523
+ * `role` is the only field always present; the rest are populated when the
12524
+ * underlying element defines them.
12525
+ * @see https://pptr.dev/api/puppeteer.serializedaxnode
12526
+ */
12527
+ export interface BrowserRunSerializedAXNode {
12528
+ /** The ARIA role, e.g. `"button"`, `"heading"`, `"RootWebArea"`. */
12529
+ role: string;
12530
+ /** The `aria-autocomplete` value. */
12531
+ autocomplete?: string;
12532
+ /** Checked state of a checkbox, radio, or menu item. */
12533
+ checked?: boolean | "mixed";
12534
+ /** Accessible description, typically from `aria-describedby` or `title`. */
12535
+ description?: string;
12536
+ disabled?: boolean;
12537
+ expanded?: boolean;
12538
+ /** Whether the element currently holds keyboard focus. */
12539
+ focused?: boolean;
12540
+ /** The kind of popup the element triggers, e.g. `"menu"`, `"dialog"`. */
12541
+ haspopup?: string;
12542
+ /** The `aria-invalid` value. */
12543
+ invalid?: string;
12544
+ /** Keyboard shortcuts bound to the element, from `aria-keyshortcuts`. */
12545
+ keyshortcuts?: string;
12546
+ /** Hierarchical level, e.g. the heading level of an `<h2>`. */
12547
+ level?: number;
12548
+ /** Whether the element is a modal dialog. */
12549
+ modal?: boolean;
12550
+ /** Whether a text input accepts multiple lines. */
12551
+ multiline?: boolean;
12552
+ /** Whether more than one option can be selected. */
12553
+ multiselectable?: boolean;
12554
+ /** Accessible name, e.g. a button's label or an image's alt text. */
12555
+ name?: string;
12556
+ orientation?: string;
12557
+ /** Pressed state of a toggle button. */
12558
+ pressed?: boolean | "mixed";
12559
+ readonly?: boolean;
12560
+ required?: boolean;
12561
+ /** Author-supplied role description, from `aria-roledescription`. */
12562
+ roledescription?: string;
12563
+ selected?: boolean;
12564
+ /** Current value of an input or range element. */
12565
+ value?: string | number;
12566
+ valuemax?: number;
12567
+ valuemin?: number;
12568
+ /** Human-readable form of `value`, from `aria-valuetext`. */
12569
+ valuetext?: string;
12570
+ /** Child nodes. Absent for leaf nodes. */
12571
+ children?: BrowserRunSerializedAXNode[];
12572
+ }
12493
12573
  /** Success response for `content` action. */
12494
12574
  export type BrowserRunContentSuccessResponse = {
12495
12575
  success: true;
@@ -12533,14 +12613,31 @@ export type BrowserRunScrapeSuccessResponse = {
12533
12613
  }>;
12534
12614
  }>;
12535
12615
  };
12536
- /** Success response for `snapshot` action. */
12616
+ /** Success response for `snapshot` action. Each field is present only when the
12617
+ * corresponding entry was requested in `formats`.
12618
+ */
12537
12619
  export type BrowserRunSnapshotSuccessResponse = {
12538
12620
  success: true;
12539
12621
  result: {
12540
12622
  /** HTML content of the page. */
12541
- content: string;
12623
+ content?: string;
12542
12624
  /** Base64-encoded screenshot image. */
12543
- screenshot: string;
12625
+ screenshot?: string;
12626
+ /** Markdown content. Prefixed with YAML frontmatter (e.g. `title`) when the
12627
+ * page provides that metadata.
12628
+ */
12629
+ markdown?: string;
12630
+ /** Root of the page's accessibility tree. */
12631
+ accessibilityTree?: BrowserRunSerializedAXNode;
12632
+ };
12633
+ meta: BrowserRunResponseMeta;
12634
+ };
12635
+ /** Success response for `accessibilityTree` action. */
12636
+ export type BrowserRunAccessibilityTreeSuccessResponse = {
12637
+ success: true;
12638
+ result: {
12639
+ /** Root of the accessibility tree, or `null` when `root` matched no element. */
12640
+ accessibilityTree: BrowserRunSerializedAXNode | null;
12544
12641
  };
12545
12642
  meta: BrowserRunResponseMeta;
12546
12643
  };
@@ -12676,9 +12773,10 @@ export declare abstract class BrowserRun {
12676
12773
  options: BrowserRunLinksOptions,
12677
12774
  ): Promise<Response>;
12678
12775
  /**
12679
- * Get both the HTML content and a base64-encoded screenshot of a web page.
12776
+ * Get several representations of a web page in one request.
12680
12777
  * @param action - Must be `'snapshot'`.
12681
- * @param options - Snapshot options including screenshot settings (encoding is always base64).
12778
+ * @param options - Snapshot options including the `formats` to return and
12779
+ * screenshot settings (encoding is always base64).
12682
12780
  * @returns A `Response` containing one of:
12683
12781
  *
12684
12782
  * **Success (HTTP 200):**
@@ -12735,6 +12833,29 @@ export declare abstract class BrowserRun {
12735
12833
  action: "markdown",
12736
12834
  options: BrowserRunMarkdownOptions,
12737
12835
  ): Promise<Response>;
12836
+ /**
12837
+ * Get the accessibility tree of a web page.
12838
+ * @param action - Must be `'accessibilityTree'`.
12839
+ * @param options - Options to scope the tree to a subtree and to control
12840
+ * whether semantically uninteresting nodes are pruned.
12841
+ * @returns A `Response` containing one of:
12842
+ *
12843
+ * **Success (HTTP 200):**
12844
+ * - `BrowserRunAccessibilityTreeSuccessResponse` JSON with `Content-Type: application/json`
12845
+ * - `result.accessibilityTree` is `null` when `root` matched no element
12846
+ *
12847
+ * **Error:**
12848
+ * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
12849
+ * - HTTP 422 for a malformed `root` selector
12850
+ * - HTTP 500 with code `2017` or `2018` when the tree could not be built
12851
+ *
12852
+ * **Headers:**
12853
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
12854
+ */
12855
+ quickAction(
12856
+ action: "accessibilityTree",
12857
+ options: BrowserRunAccessibilityTreeOptions,
12858
+ ): Promise<Response>;
12738
12859
  }
12739
12860
  /**
12740
12861
  * In addition to the properties you can set in the RequestInit dict
@@ -14409,6 +14530,27 @@ export type ImageInfoResponse =
14409
14530
  width: number;
14410
14531
  height: number;
14411
14532
  };
14533
+ /**
14534
+ * Parameters for rasterizing text into an image.
14535
+ */
14536
+ export type TextRasterize = {
14537
+ /** The text content to render */
14538
+ content: string;
14539
+ /** rasterization options for the text **/
14540
+ options: TextOptions;
14541
+ };
14542
+ export type TextOptions = {
14543
+ /** Font configuration */
14544
+ font: {
14545
+ /** URL to a font file in TrueType (.ttf), OpenType (.otf), WOFF (.woff), or WOFF2 (.woff2) format */
14546
+ url: string;
14547
+ };
14548
+ /** Font size in points (pt) */
14549
+ size?: number;
14550
+ /** Text color in CSS format: hex (#RRGGBB or #RRGGBBAA), rgb(r,g,b), rgba(r,g,b,a), or named colors */
14551
+ color?: string;
14552
+ };
14553
+ export type ImageSource = ReadableStream<Uint8Array> | TextRasterize;
14412
14554
  export type ImageTransform = {
14413
14555
  width?: number;
14414
14556
  height?: number;
@@ -14520,6 +14662,9 @@ export interface ImageUploadOptions {
14520
14662
  requireSignedURLs?: boolean;
14521
14663
  metadata?: Record<string, unknown>;
14522
14664
  creator?: string;
14665
+ /**
14666
+ * If 'base64', the input data will be decoded from base64 before processing
14667
+ */
14523
14668
  encoding?: "base64";
14524
14669
  }
14525
14670
  export interface ImageUpdateOptions {
@@ -14527,11 +14672,41 @@ export interface ImageUpdateOptions {
14527
14672
  metadata?: Record<string, unknown>;
14528
14673
  creator?: string;
14529
14674
  }
14675
+ export type ImageMetadataFilterOperators = {
14676
+ eq?: string | number | boolean;
14677
+ in?: string[] | number[];
14678
+ gt?: number;
14679
+ gte?: number;
14680
+ lt?: number;
14681
+ lte?: number;
14682
+ };
14683
+ export type ImageMetadataFilterValue =
14684
+ string | number | boolean | ImageMetadataFilterOperators;
14685
+ export interface ImageListFilter {
14686
+ metadata?: Record<string, ImageMetadataFilterValue>;
14687
+ }
14530
14688
  export interface ImageListOptions {
14531
14689
  limit?: number;
14532
14690
  cursor?: string;
14533
14691
  sortOrder?: "asc" | "desc";
14534
14692
  creator?: string;
14693
+ filter?: ImageListFilter;
14694
+ }
14695
+ export interface ImageSignedUrlOptions {
14696
+ variant: string;
14697
+ expiresIn?: number;
14698
+ keyName?: string;
14699
+ }
14700
+ export interface ImageDirectUploadOptions {
14701
+ id?: string;
14702
+ requireSignedURLs?: boolean;
14703
+ metadata?: Record<string, unknown>;
14704
+ creator?: string;
14705
+ expiresIn?: number;
14706
+ }
14707
+ export interface ImageDirectUploadResult {
14708
+ id: string;
14709
+ uploadURL: string;
14535
14710
  }
14536
14711
  export interface ImageList {
14537
14712
  images: ImageMetadata[];
@@ -14549,6 +14724,13 @@ export interface ImageHandle {
14549
14724
  * @returns ReadableStream of image bytes, or null if not found
14550
14725
  */
14551
14726
  bytes(): Promise<ReadableStream<Uint8Array> | null>;
14727
+ /**
14728
+ * Generate a signed delivery URL for this hosted image.
14729
+ * @param options Signing configuration
14730
+ * @returns A signed image delivery URL
14731
+ * @throws {@link ImagesError} if signing fails
14732
+ */
14733
+ signedUrl(options: ImageSignedUrlOptions): Promise<string>;
14552
14734
  /**
14553
14735
  * Update hosted image metadata
14554
14736
  * @param options Properties to update
@@ -14587,6 +14769,16 @@ export interface HostedImagesBinding {
14587
14769
  * @throws {@link ImagesError} if list fails
14588
14770
  */
14589
14771
  list(options?: ImageListOptions): Promise<ImageList>;
14772
+ /**
14773
+ * Create a Direct Creator Upload link, letting an end user upload an
14774
+ * image straight to Cloudflare without exposing an API token
14775
+ * @param options Upload link configuration
14776
+ * @returns The new image ID and the upload URL to hand to the end user
14777
+ * @throws {@link ImagesError} if creation fails
14778
+ */
14779
+ createDirectUpload(
14780
+ options?: ImageDirectUploadOptions,
14781
+ ): Promise<ImageDirectUploadResult>;
14590
14782
  }
14591
14783
  export interface ImagesBinding {
14592
14784
  /**
@@ -14607,6 +14799,13 @@ export interface ImagesBinding {
14607
14799
  stream: ReadableStream<Uint8Array>,
14608
14800
  options?: ImageInputOptions,
14609
14801
  ): ImageTransformer;
14802
+ /**
14803
+ * Begin applying a series of transformations to text
14804
+ * @param content string to be rendered
14805
+ * @param options font, optional color and size to use in rendering text
14806
+ * @returns A transform handle
14807
+ */
14808
+ text(content: string, options: TextOptions): ImageTransformer;
14610
14809
  /**
14611
14810
  * Access hosted images CRUD operations
14612
14811
  */
@@ -16236,7 +16435,8 @@ export declare namespace TailStream {
16236
16435
  | "responseStreamDisconnected"
16237
16436
  | "scriptNotFound"
16238
16437
  | "internalError"
16239
- | "exceededWallTime";
16438
+ | "exceededWallTime"
16439
+ | "aborted";
16240
16440
  interface ScriptVersion {
16241
16441
  readonly id: string;
16242
16442
  readonly tag?: string;
@@ -16863,6 +17063,20 @@ export type WorkflowDurationLabel =
16863
17063
  export type WorkflowSleepDuration =
16864
17064
  `${number} ${WorkflowDurationLabel}${"s" | ""}` | number;
16865
17065
  export type WorkflowRetentionDuration = WorkflowSleepDuration;
17066
+ /** Geographic regions supported when creating a Workflow instance.
17067
+ * Location hints are best-effort placement preferences. */
17068
+ export type WorkflowInstanceLocationHint =
17069
+ | "wnam"
17070
+ | "enam"
17071
+ | "sam"
17072
+ | "weur"
17073
+ | "eeur"
17074
+ | "apac"
17075
+ | "apac-ne"
17076
+ | "apac-se"
17077
+ | "oc"
17078
+ | "afr"
17079
+ | "me";
16866
17080
  export interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
16867
17081
  /**
16868
17082
  * An id for your Workflow instance. Must be unique within the Workflow.
@@ -16880,6 +17094,9 @@ export interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
16880
17094
  successRetention?: WorkflowRetentionDuration;
16881
17095
  errorRetention?: WorkflowRetentionDuration;
16882
17096
  };
17097
+ /** A best-effort geographic placement preference for the Workflow instance.
17098
+ * See `WorkflowInstanceLocationHint` for supported regions. */
17099
+ locationHint?: WorkflowInstanceLocationHint;
16883
17100
  }
16884
17101
  export type InstanceStatus = {
16885
17102
  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.20260819.1"
10
+ "version": "5.20260821.1"
11
11
  }