@cloudflare/workers-types 4.20260701.1 → 5.20260703.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
@@ -342,7 +342,14 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
342
342
  ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;
343
343
  CountQueuingStrategy: typeof CountQueuingStrategy;
344
344
  ErrorEvent: typeof ErrorEvent;
345
+ MessageChannel: typeof MessageChannel;
346
+ MessagePort: typeof MessagePort;
345
347
  EventSource: typeof EventSource;
348
+ ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;
349
+ ReadableStreamDefaultController: typeof ReadableStreamDefaultController;
350
+ ReadableByteStreamController: typeof ReadableByteStreamController;
351
+ WritableStreamDefaultController: typeof WritableStreamDefaultController;
352
+ TransformStreamDefaultController: typeof TransformStreamDefaultController;
346
353
  CompressionStream: typeof CompressionStream;
347
354
  DecompressionStream: typeof DecompressionStream;
348
355
  TextEncoderStream: typeof TextEncoderStream;
@@ -358,6 +365,8 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
358
365
  AbortSignal: typeof AbortSignal;
359
366
  TextDecoder: typeof TextDecoder;
360
367
  TextEncoder: typeof TextEncoder;
368
+ navigator: Navigator;
369
+ Navigator: typeof Navigator;
361
370
  URL: typeof URL;
362
371
  URLSearchParams: typeof URLSearchParams;
363
372
  URLPattern: typeof URLPattern;
@@ -463,10 +472,12 @@ declare const scheduler: Scheduler;
463
472
  declare const performance: Performance;
464
473
  declare const Cloudflare: Cloudflare;
465
474
  declare const origin: string;
475
+ declare const navigator: Navigator;
466
476
  interface TestController {}
467
477
  interface ExecutionContext<Props = unknown> {
468
478
  waitUntil(promise: Promise<any>): void;
469
479
  passThroughOnException(): void;
480
+ readonly exports: Cloudflare.Exports;
470
481
  readonly props: Props;
471
482
  cache?: CacheContext;
472
483
  readonly access?: CloudflareAccessContext;
@@ -539,6 +550,14 @@ interface ExportedHandler<
539
550
  interface StructuredSerializeOptions {
540
551
  transfer?: any[];
541
552
  }
553
+ declare abstract class Navigator {
554
+ sendBeacon(url: string, body?: BodyInit): boolean;
555
+ readonly userAgent: string;
556
+ readonly hardwareConcurrency: number;
557
+ readonly platform: string;
558
+ readonly language: string;
559
+ readonly languages: string[];
560
+ }
542
561
  interface AlarmInvocationInfo {
543
562
  readonly isRetry: boolean;
544
563
  readonly retryCount: number;
@@ -621,7 +640,7 @@ declare abstract class DurableObjectNamespace<
621
640
  jurisdiction: DurableObjectJurisdiction,
622
641
  ): DurableObjectNamespace<T>;
623
642
  }
624
- type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
643
+ type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high" | "us";
625
644
  interface DurableObjectNamespaceNewUniqueIdOptions {
626
645
  jurisdiction?: DurableObjectJurisdiction;
627
646
  }
@@ -647,6 +666,7 @@ interface DurableObjectClass<
647
666
  > {}
648
667
  interface DurableObjectState<Props = unknown> {
649
668
  waitUntil(promise: Promise<any>): void;
669
+ readonly exports: Cloudflare.Exports;
650
670
  readonly props: Props;
651
671
  readonly id: DurableObjectId;
652
672
  readonly storage: DurableObjectStorage;
@@ -803,82 +823,89 @@ declare class Event {
803
823
  *
804
824
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)
805
825
  */
806
- readonly type: string;
826
+ get type(): string;
807
827
  /**
808
828
  * The **`eventPhase`** read-only property of the being evaluated.
809
829
  *
810
830
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)
811
831
  */
812
- readonly eventPhase: number;
832
+ get eventPhase(): number;
813
833
  /**
814
834
  * The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM.
815
835
  *
816
836
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)
817
837
  */
818
- readonly composed: boolean;
838
+ get composed(): boolean;
819
839
  /**
820
840
  * The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not.
821
841
  *
822
842
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)
823
843
  */
824
- readonly bubbles: boolean;
844
+ get bubbles(): boolean;
825
845
  /**
826
846
  * The **`cancelable`** read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened.
827
847
  *
828
848
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)
829
849
  */
830
- readonly cancelable: boolean;
850
+ get cancelable(): boolean;
831
851
  /**
832
852
  * The **`defaultPrevented`** read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event.
833
853
  *
834
854
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)
835
855
  */
836
- readonly defaultPrevented: boolean;
856
+ get defaultPrevented(): boolean;
837
857
  /**
838
858
  * The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not.
839
859
  * @deprecated
840
860
  *
841
861
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)
842
862
  */
843
- readonly returnValue: boolean;
863
+ get returnValue(): boolean;
844
864
  /**
845
865
  * The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached.
846
866
  *
847
867
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)
848
868
  */
849
- readonly currentTarget?: EventTarget;
869
+ get currentTarget(): EventTarget | undefined;
850
870
  /**
851
871
  * The read-only **`target`** property of the dispatched.
852
872
  *
853
873
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)
854
874
  */
855
- readonly target?: EventTarget;
875
+ get target(): EventTarget | undefined;
856
876
  /**
857
877
  * The deprecated **`Event.srcElement`** is an alias for the Event.target property.
858
878
  * @deprecated
859
879
  *
860
880
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)
861
881
  */
862
- readonly srcElement: EventTarget | null;
882
+ get srcElement(): EventTarget | undefined;
863
883
  /**
864
884
  * The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created.
865
885
  *
866
886
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)
867
887
  */
868
- readonly timeStamp: number;
888
+ get timeStamp(): number;
869
889
  /**
870
890
  * The **`isTrusted`** read-only property of the when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and `false` when the event was dispatched via The only exception is the `click` event, which initializes the `isTrusted` property to `false` in user agents.
871
891
  *
872
892
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)
873
893
  */
874
- readonly isTrusted: boolean;
894
+ get isTrusted(): boolean;
875
895
  /**
876
896
  * The **`cancelBubble`** property of the Event interface is deprecated.
877
897
  * @deprecated
878
898
  *
879
899
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
880
900
  */
881
- cancelBubble: boolean;
901
+ get cancelBubble(): boolean;
902
+ /**
903
+ * The **`cancelBubble`** property of the Event interface is deprecated.
904
+ * @deprecated
905
+ *
906
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)
907
+ */
908
+ set cancelBubble(value: boolean);
882
909
  /**
883
910
  * The **`stopImmediatePropagation()`** method of the If several listeners are attached to the same element for the same event type, they are called in the order in which they were added.
884
911
  *
@@ -982,7 +1009,7 @@ declare class AbortController {
982
1009
  *
983
1010
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)
984
1011
  */
985
- readonly signal: AbortSignal;
1012
+ get signal(): AbortSignal;
986
1013
  /**
987
1014
  * The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed.
988
1015
  *
@@ -1019,13 +1046,13 @@ declare abstract class AbortSignal extends EventTarget {
1019
1046
  *
1020
1047
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)
1021
1048
  */
1022
- readonly aborted: boolean;
1049
+ get aborted(): boolean;
1023
1050
  /**
1024
1051
  * The **`reason`** read-only property returns a JavaScript value that indicates the abort reason.
1025
1052
  *
1026
1053
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason)
1027
1054
  */
1028
- readonly reason: any;
1055
+ get reason(): any;
1029
1056
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
1030
1057
  get onabort(): any | null;
1031
1058
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */
@@ -1091,13 +1118,13 @@ declare class Blob {
1091
1118
  *
1092
1119
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size)
1093
1120
  */
1094
- readonly size: number;
1121
+ get size(): number;
1095
1122
  /**
1096
1123
  * The **`type`** read-only property of the Blob interface returns the MIME type of the file.
1097
1124
  *
1098
1125
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type)
1099
1126
  */
1100
- readonly type: string;
1127
+ get type(): string;
1101
1128
  /**
1102
1129
  * The **`slice()`** method of the Blob interface creates and returns a new `Blob` object which contains data from a subset of the blob on which it's called.
1103
1130
  *
@@ -1148,13 +1175,13 @@ declare class File extends Blob {
1148
1175
  *
1149
1176
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)
1150
1177
  */
1151
- readonly name: string;
1178
+ get name(): string;
1152
1179
  /**
1153
1180
  * The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight).
1154
1181
  *
1155
1182
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)
1156
1183
  */
1157
- readonly lastModified: number;
1184
+ get lastModified(): number;
1158
1185
  }
1159
1186
  interface FileOptions {
1160
1187
  type?: string;
@@ -1211,7 +1238,7 @@ declare abstract class Crypto {
1211
1238
  *
1212
1239
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)
1213
1240
  */
1214
- readonly subtle: SubtleCrypto;
1241
+ get subtle(): SubtleCrypto;
1215
1242
  /**
1216
1243
  * The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values.
1217
1244
  *
@@ -1533,9 +1560,9 @@ declare class TextDecoder {
1533
1560
  input?: ArrayBuffer | ArrayBufferView,
1534
1561
  options?: TextDecoderDecodeOptions,
1535
1562
  ): string;
1536
- readonly encoding: string;
1537
- readonly fatal: boolean;
1538
- readonly ignoreBOM: boolean;
1563
+ get encoding(): string;
1564
+ get fatal(): boolean;
1565
+ get ignoreBOM(): boolean;
1539
1566
  }
1540
1567
  /**
1541
1568
  * The **`TextEncoder`** interface takes a stream of code points as input and emits a stream of UTF-8 bytes.
@@ -1556,7 +1583,7 @@ declare class TextEncoder {
1556
1583
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)
1557
1584
  */
1558
1585
  encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;
1559
- readonly encoding: string;
1586
+ get encoding(): string;
1560
1587
  }
1561
1588
  interface TextDecoderConstructorOptions {
1562
1589
  fatal: boolean;
@@ -1710,13 +1737,13 @@ declare class FormData {
1710
1737
  *
1711
1738
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)
1712
1739
  */
1713
- get(name: string): string | null;
1740
+ get(name: string): (File | string) | null;
1714
1741
  /**
1715
1742
  * The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a `FormData` object.
1716
1743
  *
1717
1744
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll)
1718
1745
  */
1719
- getAll(name: string): string[];
1746
+ getAll(name: string): (File | string)[];
1720
1747
  /**
1721
1748
  * The **`has()`** method of the FormData interface returns whether a `FormData` object contains a certain key.
1722
1749
  *
@@ -1742,7 +1769,7 @@ declare class FormData {
1742
1769
  */
1743
1770
  set(name: string, value: Blob, filename?: string): void;
1744
1771
  /* Returns an array of key, value pairs for every entry in the list. */
1745
- entries(): IterableIterator<[key: string, value: string]>;
1772
+ entries(): IterableIterator<[key: string, value: File | string]>;
1746
1773
  /* Returns a list of keys in the list. */
1747
1774
  keys(): IterableIterator<string>;
1748
1775
  /* Returns a list of values in the list. */
@@ -1750,13 +1777,13 @@ declare class FormData {
1750
1777
  forEach<This = unknown>(
1751
1778
  callback: (
1752
1779
  this: This,
1753
- value: string,
1780
+ value: File | string,
1754
1781
  key: string,
1755
1782
  parent: FormData,
1756
1783
  ) => void,
1757
1784
  thisArg?: This,
1758
1785
  ): void;
1759
- [Symbol.iterator](): IterableIterator<[key: string, value: string]>;
1786
+ [Symbol.iterator](): IterableIterator<[key: string, value: File | string]>;
1760
1787
  }
1761
1788
  interface ContentOptions {
1762
1789
  html?: boolean;
@@ -1902,6 +1929,12 @@ declare class Headers {
1902
1929
  */
1903
1930
  get(name: string): string | null;
1904
1931
  getAll(name: string): string[];
1932
+ /**
1933
+ * The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response.
1934
+ *
1935
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)
1936
+ */
1937
+ getSetCookie(): string[];
1905
1938
  /**
1906
1939
  * The **`has()`** method of the Headers interface returns a boolean stating whether a `Headers` object contains a certain header.
1907
1940
  *
@@ -1945,12 +1978,14 @@ type BodyInit =
1945
1978
  | ArrayBufferView
1946
1979
  | Blob
1947
1980
  | URLSearchParams
1948
- | FormData;
1981
+ | FormData
1982
+ | Iterable<ArrayBuffer | ArrayBufferView>
1983
+ | AsyncIterable<ArrayBuffer | ArrayBufferView>;
1949
1984
  declare abstract class Body {
1950
1985
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */
1951
- readonly body: ReadableStream | null;
1986
+ get body(): ReadableStream | null;
1952
1987
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */
1953
- readonly bodyUsed: boolean;
1988
+ get bodyUsed(): boolean;
1954
1989
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */
1955
1990
  arrayBuffer(): Promise<ArrayBuffer>;
1956
1991
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */
@@ -1993,39 +2028,39 @@ interface Response extends Body {
1993
2028
  *
1994
2029
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status)
1995
2030
  */
1996
- readonly status: number;
2031
+ status: number;
1997
2032
  /**
1998
2033
  * The **`statusText`** read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status.
1999
2034
  *
2000
2035
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText)
2001
2036
  */
2002
- readonly statusText: string;
2037
+ statusText: string;
2003
2038
  /**
2004
2039
  * The **`headers`** read-only property of the with the response.
2005
2040
  *
2006
2041
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers)
2007
2042
  */
2008
- readonly headers: Headers;
2043
+ headers: Headers;
2009
2044
  /**
2010
2045
  * The **`ok`** read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not.
2011
2046
  *
2012
2047
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok)
2013
2048
  */
2014
- readonly ok: boolean;
2049
+ ok: boolean;
2015
2050
  /**
2016
2051
  * The **`redirected`** read-only property of the Response interface indicates whether or not the response is the result of a request you made which was redirected.
2017
2052
  *
2018
2053
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected)
2019
2054
  */
2020
- readonly redirected: boolean;
2055
+ redirected: boolean;
2021
2056
  /**
2022
2057
  * The **`url`** read-only property of the Response interface contains the URL of the response.
2023
2058
  *
2024
2059
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url)
2025
2060
  */
2026
- readonly url: string;
2027
- readonly webSocket: WebSocket | null;
2028
- readonly cf?: any;
2061
+ url: string;
2062
+ webSocket: WebSocket | null;
2063
+ cf: any | undefined;
2029
2064
  /**
2030
2065
  * The **`type`** read-only property of the Response interface contains the type of the response.
2031
2066
  *
@@ -2076,45 +2111,51 @@ interface Request<
2076
2111
  *
2077
2112
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
2078
2113
  */
2079
- readonly method: string;
2114
+ method: string;
2080
2115
  /**
2081
2116
  * The **`url`** read-only property of the Request interface contains the URL of the request.
2082
2117
  *
2083
2118
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
2084
2119
  */
2085
- readonly url: string;
2120
+ url: string;
2086
2121
  /**
2087
2122
  * The **`headers`** read-only property of the with the request.
2088
2123
  *
2089
2124
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
2090
2125
  */
2091
- readonly headers: Headers;
2126
+ headers: Headers;
2092
2127
  /**
2093
2128
  * The **`redirect`** read-only property of the Request interface contains the mode for how redirects are handled.
2094
2129
  *
2095
2130
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
2096
2131
  */
2097
- readonly redirect: string;
2098
- readonly fetcher: Fetcher | null;
2132
+ redirect: string;
2133
+ fetcher: Fetcher | null;
2099
2134
  /**
2100
2135
  * The read-only **`signal`** property of the Request interface returns the AbortSignal associated with the request.
2101
2136
  *
2102
2137
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
2103
2138
  */
2104
- readonly signal: AbortSignal;
2105
- readonly cf?: Cf;
2139
+ signal: AbortSignal;
2140
+ cf?: Cf;
2106
2141
  /**
2107
2142
  * The **`integrity`** read-only property of the Request interface contains the subresource integrity value of the request.
2108
2143
  *
2109
2144
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
2110
2145
  */
2111
- readonly integrity: string;
2146
+ integrity: string;
2112
2147
  /**
2113
2148
  * The **`keepalive`** read-only property of the Request interface contains the request's `keepalive` setting (`true` or `false`), which indicates whether the browser will keep the associated request alive if the page that initiated it is unloaded before the request is complete.
2114
2149
  *
2115
2150
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
2116
2151
  */
2117
- readonly keepalive: boolean;
2152
+ keepalive: boolean;
2153
+ /**
2154
+ * The **`cache`** read-only property of the Request interface contains the cache mode of the request.
2155
+ *
2156
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
2157
+ */
2158
+ cache?: "no-store" | "no-cache";
2118
2159
  }
2119
2160
  interface RequestInit<Cf = CfProperties> {
2120
2161
  /* A string to set request's method. */
@@ -2127,6 +2168,8 @@ interface RequestInit<Cf = CfProperties> {
2127
2168
  redirect?: string;
2128
2169
  fetcher?: Fetcher | null;
2129
2170
  cf?: Cf;
2171
+ /* A string indicating how the request will interact with the browser's cache to set request's cache. */
2172
+ cache?: "no-store" | "no-cache";
2130
2173
  /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
2131
2174
  integrity?: string;
2132
2175
  /* An AbortSignal to set request's signal. */
@@ -2155,10 +2198,6 @@ type Fetcher<
2155
2198
  fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
2156
2199
  connect(address: SocketAddress | string, options?: SocketOptions): Socket;
2157
2200
  };
2158
- interface FetcherPutOptions {
2159
- expiration?: number;
2160
- expirationTtl?: number;
2161
- }
2162
2201
  interface KVNamespaceListKey<Metadata, Key extends string = string> {
2163
2202
  name: Key;
2164
2203
  expiration?: number;
@@ -2404,6 +2443,7 @@ interface R2ListOptions {
2404
2443
  cursor?: string;
2405
2444
  delimiter?: string;
2406
2445
  startAfter?: string;
2446
+ include?: ("httpMetadata" | "customMetadata")[];
2407
2447
  }
2408
2448
  interface R2Bucket {
2409
2449
  head(key: string): Promise<R2Object | null>;
@@ -2666,7 +2706,7 @@ interface ReadableStream<R = any> {
2666
2706
  *
2667
2707
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked)
2668
2708
  */
2669
- readonly locked: boolean;
2709
+ get locked(): boolean;
2670
2710
  /**
2671
2711
  * The **`cancel()`** method of the ReadableStream interface returns a Promise that resolves when the stream is canceled.
2672
2712
  *
@@ -2737,7 +2777,7 @@ declare const ReadableStream: {
2737
2777
  */
2738
2778
  declare class ReadableStreamDefaultReader<R = any> {
2739
2779
  constructor(stream: ReadableStream);
2740
- readonly closed: Promise<void>;
2780
+ get closed(): Promise<void>;
2741
2781
  cancel(reason?: any): Promise<void>;
2742
2782
  /**
2743
2783
  * The **`read()`** method of the ReadableStreamDefaultReader interface returns a Promise providing access to the next chunk in the stream's internal queue.
@@ -2759,7 +2799,7 @@ declare class ReadableStreamDefaultReader<R = any> {
2759
2799
  */
2760
2800
  declare class ReadableStreamBYOBReader {
2761
2801
  constructor(stream: ReadableStream);
2762
- readonly closed: Promise<void>;
2802
+ get closed(): Promise<void>;
2763
2803
  cancel(reason?: any): Promise<void>;
2764
2804
  /**
2765
2805
  * The **`read()`** method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream.
@@ -2796,7 +2836,7 @@ interface ReadableStreamGetReaderOptions {
2796
2836
  *
2797
2837
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest)
2798
2838
  */
2799
- interface ReadableStreamBYOBRequest {
2839
+ declare abstract class ReadableStreamBYOBRequest {
2800
2840
  /**
2801
2841
  * The **`view`** getter property of the ReadableStreamBYOBRequest interface returns the current view.
2802
2842
  *
@@ -2822,7 +2862,7 @@ interface ReadableStreamBYOBRequest {
2822
2862
  *
2823
2863
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController)
2824
2864
  */
2825
- interface ReadableStreamDefaultController<R = any> {
2865
+ declare abstract class ReadableStreamDefaultController<R = any> {
2826
2866
  /**
2827
2867
  * The **`desiredSize`** read-only property of the required to fill the stream's internal queue.
2828
2868
  *
@@ -2853,7 +2893,7 @@ interface ReadableStreamDefaultController<R = any> {
2853
2893
  *
2854
2894
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)
2855
2895
  */
2856
- interface ReadableByteStreamController {
2896
+ declare abstract class ReadableByteStreamController {
2857
2897
  /**
2858
2898
  * The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or `null` if there are no pending requests.
2859
2899
  *
@@ -2890,7 +2930,7 @@ interface ReadableByteStreamController {
2890
2930
  *
2891
2931
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)
2892
2932
  */
2893
- interface WritableStreamDefaultController {
2933
+ declare abstract class WritableStreamDefaultController {
2894
2934
  /**
2895
2935
  * The read-only **`signal`** property of the WritableStreamDefaultController interface returns the AbortSignal associated with the controller.
2896
2936
  *
@@ -2909,7 +2949,7 @@ interface WritableStreamDefaultController {
2909
2949
  *
2910
2950
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController)
2911
2951
  */
2912
- interface TransformStreamDefaultController<O = any> {
2952
+ declare abstract class TransformStreamDefaultController<O = any> {
2913
2953
  /**
2914
2954
  * The **`desiredSize`** read-only property of the TransformStreamDefaultController interface returns the desired size to fill the queue of the associated ReadableStream.
2915
2955
  *
@@ -2959,7 +2999,7 @@ declare class WritableStream<W = any> {
2959
2999
  *
2960
3000
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked)
2961
3001
  */
2962
- readonly locked: boolean;
3002
+ get locked(): boolean;
2963
3003
  /**
2964
3004
  * The **`abort()`** method of the WritableStream interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.
2965
3005
  *
@@ -2991,19 +3031,19 @@ declare class WritableStreamDefaultWriter<W = any> {
2991
3031
  *
2992
3032
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed)
2993
3033
  */
2994
- readonly closed: Promise<void>;
3034
+ get closed(): Promise<void>;
2995
3035
  /**
2996
3036
  * The **`ready`** read-only property of the that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.
2997
3037
  *
2998
3038
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready)
2999
3039
  */
3000
- readonly ready: Promise<void>;
3040
+ get ready(): Promise<void>;
3001
3041
  /**
3002
3042
  * The **`desiredSize`** read-only property of the to fill the stream's internal queue.
3003
3043
  *
3004
3044
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize)
3005
3045
  */
3006
- readonly desiredSize: number | null;
3046
+ get desiredSize(): number | null;
3007
3047
  /**
3008
3048
  * The **`abort()`** method of the the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.
3009
3049
  *
@@ -3045,13 +3085,13 @@ declare class TransformStream<I = any, O = any> {
3045
3085
  *
3046
3086
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable)
3047
3087
  */
3048
- readonly readable: ReadableStream<O>;
3088
+ get readable(): ReadableStream<O>;
3049
3089
  /**
3050
3090
  * The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this `TransformStream`.
3051
3091
  *
3052
3092
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable)
3053
3093
  */
3054
- readonly writable: WritableStream<I>;
3094
+ get writable(): WritableStream<I>;
3055
3095
  }
3056
3096
  declare class FixedLengthStream extends IdentityTransformStream {
3057
3097
  constructor(
@@ -3295,86 +3335,170 @@ interface UnsafeTraceMetrics {
3295
3335
  */
3296
3336
  declare class URL {
3297
3337
  constructor(url: string | URL, base?: string | URL);
3338
+ /**
3339
+ * The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL.
3340
+ *
3341
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin)
3342
+ */
3343
+ get origin(): string;
3298
3344
  /**
3299
3345
  * The **`href`** property of the URL interface is a string containing the whole URL.
3300
3346
  *
3301
3347
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)
3302
3348
  */
3303
- href: string;
3349
+ get href(): string;
3304
3350
  /**
3305
- * The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL.
3351
+ * The **`href`** property of the URL interface is a string containing the whole URL.
3306
3352
  *
3307
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin)
3353
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)
3308
3354
  */
3309
- readonly origin: string;
3355
+ set href(value: string);
3310
3356
  /**
3311
3357
  * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.
3312
3358
  *
3313
3359
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)
3314
3360
  */
3315
- protocol: string;
3361
+ get protocol(): string;
3362
+ /**
3363
+ * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.
3364
+ *
3365
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)
3366
+ */
3367
+ set protocol(value: string);
3316
3368
  /**
3317
3369
  * The **`username`** property of the URL interface is a string containing the username component of the URL.
3318
3370
  *
3319
3371
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
3320
3372
  */
3321
- username: string;
3373
+ get username(): string;
3374
+ /**
3375
+ * The **`username`** property of the URL interface is a string containing the username component of the URL.
3376
+ *
3377
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)
3378
+ */
3379
+ set username(value: string);
3322
3380
  /**
3323
3381
  * The **`password`** property of the URL interface is a string containing the password component of the URL.
3324
3382
  *
3325
3383
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
3326
3384
  */
3327
- password: string;
3385
+ get password(): string;
3386
+ /**
3387
+ * The **`password`** property of the URL interface is a string containing the password component of the URL.
3388
+ *
3389
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)
3390
+ */
3391
+ set password(value: string);
3328
3392
  /**
3329
3393
  * The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.
3330
3394
  *
3331
3395
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
3332
3396
  */
3333
- host: string;
3397
+ get host(): string;
3398
+ /**
3399
+ * The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.
3400
+ *
3401
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)
3402
+ */
3403
+ set host(value: string);
3334
3404
  /**
3335
3405
  * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.
3336
3406
  *
3337
3407
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
3338
3408
  */
3339
- hostname: string;
3409
+ get hostname(): string;
3410
+ /**
3411
+ * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.
3412
+ *
3413
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)
3414
+ */
3415
+ set hostname(value: string);
3340
3416
  /**
3341
3417
  * The **`port`** property of the URL interface is a string containing the port number of the URL.
3342
3418
  *
3343
3419
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
3344
3420
  */
3345
- port: string;
3421
+ get port(): string;
3422
+ /**
3423
+ * The **`port`** property of the URL interface is a string containing the port number of the URL.
3424
+ *
3425
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)
3426
+ */
3427
+ set port(value: string);
3428
+ /**
3429
+ * The **`pathname`** property of the URL interface represents a location in a hierarchical structure.
3430
+ *
3431
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
3432
+ */
3433
+ get pathname(): string;
3346
3434
  /**
3347
3435
  * The **`pathname`** property of the URL interface represents a location in a hierarchical structure.
3348
3436
  *
3349
3437
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)
3350
3438
  */
3351
- pathname: string;
3439
+ set pathname(value: string);
3352
3440
  /**
3353
3441
  * The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.
3354
3442
  *
3355
3443
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
3356
3444
  */
3357
- search: string;
3445
+ get search(): string;
3358
3446
  /**
3359
- * The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL.
3447
+ * The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.
3360
3448
  *
3361
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)
3449
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)
3362
3450
  */
3363
- readonly searchParams: URLSearchParams;
3451
+ set search(value: string);
3364
3452
  /**
3365
3453
  * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.
3366
3454
  *
3367
3455
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
3368
3456
  */
3369
- hash: string;
3370
- /*function toString() { [native code] }*/
3371
- toString(): string;
3457
+ get hash(): string;
3458
+ /**
3459
+ * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.
3460
+ *
3461
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)
3462
+ */
3463
+ set hash(value: string);
3464
+ /**
3465
+ * The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL.
3466
+ *
3467
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)
3468
+ */
3469
+ get searchParams(): URLSearchParams;
3372
3470
  /**
3373
3471
  * The **`toJSON()`** method of the URL interface returns a string containing a serialized version of the URL, although in practice it seems to have the same effect as ```js-nolint toJSON() ``` None.
3374
3472
  *
3375
3473
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)
3376
3474
  */
3377
3475
  toJSON(): string;
3476
+ /*function toString() { [native code] }*/
3477
+ toString(): string;
3478
+ /**
3479
+ * The **`URL.canParse()`** static method of the URL interface returns a boolean indicating whether or not an absolute URL, or a relative URL combined with a base URL, are parsable and valid.
3480
+ *
3481
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static)
3482
+ */
3483
+ static canParse(url: string, base?: string): boolean;
3484
+ /**
3485
+ * The **`URL.parse()`** static method of the URL interface returns a newly created URL object representing the URL defined by the parameters.
3486
+ *
3487
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static)
3488
+ */
3489
+ static parse(url: string, base?: string): URL | null;
3490
+ /**
3491
+ * The **`createObjectURL()`** static method of the URL interface creates a string containing a URL representing the object given in the parameter.
3492
+ *
3493
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)
3494
+ */
3495
+ static createObjectURL(object: File | Blob): string;
3496
+ /**
3497
+ * The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling Call this method when you've finished using an object URL to let the browser know not to keep the reference to the file any longer.
3498
+ *
3499
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)
3500
+ */
3501
+ static revokeObjectURL(object_url: string): void;
3378
3502
  }
3379
3503
  /**
3380
3504
  * The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.
@@ -3383,11 +3507,7 @@ declare class URL {
3383
3507
  */
3384
3508
  declare class URLSearchParams {
3385
3509
  constructor(
3386
- init?:
3387
- | URLSearchParams
3388
- | string
3389
- | Record<string, string>
3390
- | [key: string, value: string][],
3510
+ init?: Iterable<Iterable<string>> | Record<string, string> | string,
3391
3511
  );
3392
3512
  /**
3393
3513
  * The **`size`** read-only property of the URLSearchParams interface indicates the total number of search parameter entries.
@@ -3406,7 +3526,7 @@ declare class URLSearchParams {
3406
3526
  *
3407
3527
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)
3408
3528
  */
3409
- delete(name: string): void;
3529
+ delete(name: string, value?: string): void;
3410
3530
  /**
3411
3531
  * The **`get()`** method of the URLSearchParams interface returns the first value associated to the given search parameter.
3412
3532
  *
@@ -3424,7 +3544,7 @@ declare class URLSearchParams {
3424
3544
  *
3425
3545
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)
3426
3546
  */
3427
- has(name: string): boolean;
3547
+ has(name: string, value?: string): boolean;
3428
3548
  /**
3429
3549
  * The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value.
3430
3550
  *
@@ -3470,6 +3590,7 @@ declare class URLPattern {
3470
3590
  get pathname(): string;
3471
3591
  get search(): string;
3472
3592
  get hash(): string;
3593
+ get hasRegExpGroups(): boolean;
3473
3594
  test(input?: string | URLPatternInit, baseURL?: string): boolean;
3474
3595
  exec(
3475
3596
  input?: string | URLPatternInit,
@@ -3585,25 +3706,25 @@ interface WebSocket extends EventTarget<WebSocketEventMap> {
3585
3706
  *
3586
3707
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
3587
3708
  */
3588
- readonly readyState: number;
3709
+ readyState: number;
3589
3710
  /**
3590
3711
  * The **`WebSocket.url`** read-only property returns the absolute URL of the WebSocket as resolved by the constructor.
3591
3712
  *
3592
3713
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
3593
3714
  */
3594
- readonly url: string | null;
3715
+ url: string | null;
3595
3716
  /**
3596
3717
  * The **`WebSocket.protocol`** read-only property returns the name of the sub-protocol the server selected; this will be one of the strings specified in the `protocols` parameter when creating the WebSocket object, or the empty string if no connection is established.
3597
3718
  *
3598
3719
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
3599
3720
  */
3600
- readonly protocol: string | null;
3721
+ protocol: string | null;
3601
3722
  /**
3602
3723
  * The **`WebSocket.extensions`** read-only property returns the extensions selected by the server.
3603
3724
  *
3604
3725
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
3605
3726
  */
3606
- readonly extensions: string | null;
3727
+ extensions: string | null;
3607
3728
  /**
3608
3729
  * The **`WebSocket.binaryType`** property controls the type of binary data being received over the WebSocket connection.
3609
3730
  *
@@ -3837,6 +3958,26 @@ declare abstract class MessagePort extends EventTarget {
3837
3958
  get onmessage(): any | null;
3838
3959
  set onmessage(value: any | null);
3839
3960
  }
3961
+ /**
3962
+ * The **`MessageChannel`** interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties.
3963
+ *
3964
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)
3965
+ */
3966
+ declare class MessageChannel {
3967
+ constructor();
3968
+ /**
3969
+ * The **`port1`** read-only property of the the port attached to the context that originated the channel.
3970
+ *
3971
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
3972
+ */
3973
+ readonly port1: MessagePort;
3974
+ /**
3975
+ * The **`port2`** read-only property of the the port attached to the context at the other end of the channel, which the message is initially sent to.
3976
+ *
3977
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
3978
+ */
3979
+ readonly port2: MessagePort;
3980
+ }
3840
3981
  interface MessagePortPostMessageOptions {
3841
3982
  transfer?: any[];
3842
3983
  }
@@ -13518,6 +13659,13 @@ interface ForwardableEmailMessage extends EmailMessage {
13518
13659
  * @returns A promise that resolves when the email message is replied.
13519
13660
  */
13520
13661
  reply(message: EmailMessage): Promise<EmailSendResult>;
13662
+ /**
13663
+ * Reply to the sender of this email message with a message built from the given
13664
+ * fields. Threading headers (In-Reply-To/References) are set automatically.
13665
+ * @param builder The reply message contents.
13666
+ * @returns A promise that resolves when the email message is replied.
13667
+ */
13668
+ reply(builder: EmailReplyMessageBuilder): Promise<EmailSendResult>;
13521
13669
  }
13522
13670
  /** A file attachment for an email message */
13523
13671
  type EmailAttachment =
@@ -13540,23 +13688,50 @@ interface EmailAddress {
13540
13688
  name: string;
13541
13689
  email: string;
13542
13690
  }
13691
+ /**
13692
+ * Recipient fields for `SendEmail.send()`. At least one of `to`, `cc`, or
13693
+ * `bcc` must be provided.
13694
+ */
13695
+ type EmailDestinations = {
13696
+ to?: string | EmailAddress | (string | EmailAddress)[];
13697
+ cc?: string | EmailAddress | (string | EmailAddress)[];
13698
+ bcc?: string | EmailAddress | (string | EmailAddress)[];
13699
+ } & (
13700
+ | {
13701
+ to: string | EmailAddress | (string | EmailAddress)[];
13702
+ }
13703
+ | {
13704
+ cc: string | EmailAddress | (string | EmailAddress)[];
13705
+ }
13706
+ | {
13707
+ bcc: string | EmailAddress | (string | EmailAddress)[];
13708
+ }
13709
+ );
13710
+ /**
13711
+ * Fields shared by all composed emails (no recipients). Used directly by
13712
+ * `ForwardableEmailMessage.reply()`, which always replies to the original
13713
+ * sender, and extended by `EmailMessageBuilder` for `SendEmail.send()`.
13714
+ */
13715
+ interface EmailReplyMessageBuilder {
13716
+ from: string | EmailAddress;
13717
+ subject: string;
13718
+ replyTo?: string | EmailAddress;
13719
+ headers?: Record<string, string>;
13720
+ text?: string;
13721
+ html?: string;
13722
+ attachments?: EmailAttachment[];
13723
+ }
13724
+ /**
13725
+ * Fields for composing an email without constructing raw MIME, for
13726
+ * `SendEmail.send()`. Requires at least one of `to`, `cc`, or `bcc`.
13727
+ */
13728
+ type EmailMessageBuilder = EmailReplyMessageBuilder & EmailDestinations;
13543
13729
  /**
13544
13730
  * A binding that allows a Worker to send email messages.
13545
13731
  */
13546
13732
  interface SendEmail {
13547
13733
  send(message: EmailMessage): Promise<EmailSendResult>;
13548
- send(builder: {
13549
- from: string | EmailAddress;
13550
- to: string | EmailAddress | (string | EmailAddress)[];
13551
- subject: string;
13552
- replyTo?: string | EmailAddress;
13553
- cc?: string | EmailAddress | (string | EmailAddress)[];
13554
- bcc?: string | EmailAddress | (string | EmailAddress)[];
13555
- headers?: Record<string, string>;
13556
- text?: string;
13557
- html?: string;
13558
- attachments?: EmailAttachment[];
13559
- }): Promise<EmailSendResult>;
13734
+ send(builder: EmailMessageBuilder): Promise<EmailSendResult>;
13560
13735
  }
13561
13736
  declare abstract class EmailEvent extends ExtendableEvent {
13562
13737
  readonly message: ForwardableEmailMessage;
@@ -14567,6 +14742,13 @@ declare namespace CloudflareWorkersModule {
14567
14742
  | `${number} ${WorkflowDurationLabel}${"s" | ""}`
14568
14743
  | number;
14569
14744
  export type WorkflowDelayDuration = WorkflowSleepDuration;
14745
+ export type WorkflowDynamicDelayContext = {
14746
+ ctx: WorkflowStepContext<WorkflowDelayFunction>;
14747
+ error: Error;
14748
+ };
14749
+ export type WorkflowDelayFunction = (
14750
+ input: WorkflowDynamicDelayContext,
14751
+ ) => WorkflowDelayDuration | Promise<WorkflowDelayDuration>;
14570
14752
  export type WorkflowTimeoutDuration = WorkflowSleepDuration;
14571
14753
  export type WorkflowRetentionDuration = WorkflowSleepDuration;
14572
14754
  export type WorkflowBackoff = "constant" | "linear" | "exponential";
@@ -14574,7 +14756,7 @@ declare namespace CloudflareWorkersModule {
14574
14756
  export type WorkflowStepConfig = {
14575
14757
  retries?: {
14576
14758
  limit: number;
14577
- delay: WorkflowDelayDuration | number;
14759
+ delay: WorkflowDelayDuration | number | WorkflowDelayFunction;
14578
14760
  backoff?: WorkflowBackoff;
14579
14761
  };
14580
14762
  timeout?: WorkflowTimeoutDuration | number;
@@ -14603,13 +14785,24 @@ declare namespace CloudflareWorkersModule {
14603
14785
  type: string;
14604
14786
  sensitive?: WorkflowStepSensitivity;
14605
14787
  };
14606
- export type WorkflowStepContext = {
14788
+ export type WorkflowStepContext<Delay = WorkflowDelayDuration | number> = {
14607
14789
  step: {
14608
14790
  name: string;
14609
14791
  count: number;
14610
14792
  };
14611
14793
  attempt: number;
14612
- config: WorkflowStepConfig;
14794
+ config: {
14795
+ retries?: {
14796
+ limit: number;
14797
+ backoff?: WorkflowBackoff;
14798
+ } & (Delay extends WorkflowDelayFunction
14799
+ ? {}
14800
+ : {
14801
+ delay: WorkflowDelayDuration | number;
14802
+ });
14803
+ timeout?: WorkflowTimeoutDuration | number;
14804
+ sensitive?: WorkflowStepSensitivity;
14805
+ };
14613
14806
  };
14614
14807
  export type WorkflowRollbackContext<T = unknown> = {
14615
14808
  ctx: WorkflowStepContext;
@@ -14631,10 +14824,18 @@ declare namespace CloudflareWorkersModule {
14631
14824
  callback: (ctx: WorkflowStepContext) => Promise<T>,
14632
14825
  rollbackOptions?: WorkflowStepRollbackOptions<T>,
14633
14826
  ): Promise<T>;
14634
- do<T extends Rpc.Serializable<T>>(
14827
+ do<T extends Rpc.Serializable<T>, const C extends WorkflowStepConfig>(
14635
14828
  name: string,
14636
- config: WorkflowStepConfig,
14637
- callback: (ctx: WorkflowStepContext) => Promise<T>,
14829
+ config: C,
14830
+ callback: (
14831
+ ctx: WorkflowStepContext<
14832
+ C["retries"] extends {
14833
+ delay: infer D;
14834
+ }
14835
+ ? D
14836
+ : WorkflowDelayDuration | number
14837
+ >,
14838
+ ) => Promise<T>,
14638
14839
  rollbackOptions?: WorkflowStepRollbackOptions<T>,
14639
14840
  ): Promise<T>;
14640
14841
  sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
@@ -15612,6 +15813,7 @@ declare namespace TailStream {
15612
15813
  readonly dispatchNamespace?: string;
15613
15814
  readonly entrypoint?: string;
15614
15815
  readonly executionModel: string;
15816
+ readonly durableObjectId?: string;
15615
15817
  readonly scriptName?: string;
15616
15818
  readonly scriptTags?: string[];
15617
15819
  readonly scriptVersion?: ScriptVersion;
@@ -16248,6 +16450,13 @@ interface WorkflowError {
16248
16450
  code?: number;
16249
16451
  message: string;
16250
16452
  }
16453
+ interface WorkflowInstanceTerminateOptions {
16454
+ /**
16455
+ * If true, run registered rollback handlers before terminating the instance.
16456
+ * Only steps that registered rollback handlers are rolled back.
16457
+ */
16458
+ rollback?: boolean;
16459
+ }
16251
16460
  interface WorkflowInstanceRestartOptions {
16252
16461
  /**
16253
16462
  * Restart from a specific step. If omitted, the instance restarts from the beginning.
@@ -16281,8 +16490,9 @@ declare abstract class WorkflowInstance {
16281
16490
  public resume(): Promise<void>;
16282
16491
  /**
16283
16492
  * Terminate the instance. If it is errored, terminated or complete, an error will be thrown.
16493
+ * @param options Options for termination, including whether registered rollback handlers should run.
16284
16494
  */
16285
- public terminate(): Promise<void>;
16495
+ public terminate(options?: WorkflowInstanceTerminateOptions): Promise<void>;
16286
16496
  /**
16287
16497
  * Restart the instance. Optionally restart from a specific step, preserving
16288
16498
  * cached results for all steps before it.