@cloudflare/workers-types 5.20261104.1 → 5.20261107.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.
@@ -1156,39 +1156,6 @@ interface Scheduler {
1156
1156
  interface SchedulerWaitOptions {
1157
1157
  signal?: AbortSignal;
1158
1158
  }
1159
- /**
1160
- * The **`ExtendableEvent`** interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.
1161
- *
1162
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
1163
- */
1164
- declare abstract class ExtendableEvent extends Event {
1165
- /**
1166
- * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing. It can also be used to detect whether that work was successful. In service workers, waitUntil() tells the browser that work is ongoing until the promise settles, and it shouldn't terminate the service worker if it wants that work to complete.
1167
- *
1168
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
1169
- */
1170
- waitUntil(promise: Promise<any>): void;
1171
- }
1172
- /**
1173
- * The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application.
1174
- *
1175
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)
1176
- */
1177
- declare class CustomEvent<T = any> extends Event {
1178
- constructor(type: string, init?: CustomEventCustomEventInit);
1179
- /**
1180
- * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.
1181
- *
1182
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
1183
- */
1184
- get detail(): T;
1185
- }
1186
- interface CustomEventCustomEventInit {
1187
- bubbles?: boolean;
1188
- cancelable?: boolean;
1189
- composed?: boolean;
1190
- detail?: any;
1191
- }
1192
1159
  /**
1193
1160
  * The **`Blob`** interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data.
1194
1161
  *
@@ -1748,6 +1715,39 @@ interface TextEncoderEncodeIntoResult {
1748
1715
  read: number;
1749
1716
  written: number;
1750
1717
  }
1718
+ /**
1719
+ * The **`ExtendableEvent`** interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.
1720
+ *
1721
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
1722
+ */
1723
+ declare abstract class ExtendableEvent extends Event {
1724
+ /**
1725
+ * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing. It can also be used to detect whether that work was successful. In service workers, waitUntil() tells the browser that work is ongoing until the promise settles, and it shouldn't terminate the service worker if it wants that work to complete.
1726
+ *
1727
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
1728
+ */
1729
+ waitUntil(promise: Promise<any>): void;
1730
+ }
1731
+ /**
1732
+ * The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application.
1733
+ *
1734
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)
1735
+ */
1736
+ declare class CustomEvent<T = any> extends Event {
1737
+ constructor(type: string, init?: CustomEventCustomEventInit);
1738
+ /**
1739
+ * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.
1740
+ *
1741
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
1742
+ */
1743
+ get detail(): T;
1744
+ }
1745
+ interface CustomEventCustomEventInit {
1746
+ bubbles?: boolean;
1747
+ cancelable?: boolean;
1748
+ composed?: boolean;
1749
+ detail?: any;
1750
+ }
1751
1751
  /**
1752
1752
  * The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files.
1753
1753
  *
@@ -1863,6 +1863,40 @@ declare abstract class PromiseRejectionEvent extends Event {
1863
1863
  */
1864
1864
  readonly reason: any;
1865
1865
  }
1866
+ /**
1867
+ * A **`CloseEvent`** is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.
1868
+ *
1869
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
1870
+ */
1871
+ declare class CloseEvent extends Event {
1872
+ constructor(type: string, initializer?: CloseEventInit);
1873
+ /**
1874
+ * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.
1875
+ *
1876
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
1877
+ */
1878
+ readonly code: number;
1879
+ /**
1880
+ * The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure.
1881
+ *
1882
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
1883
+ */
1884
+ readonly reason: string;
1885
+ /**
1886
+ * The **`wasClean`** read-only property of the CloseEvent interface returns true if the connection closed cleanly.
1887
+ *
1888
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
1889
+ */
1890
+ readonly wasClean: boolean;
1891
+ }
1892
+ interface CloseEventInit {
1893
+ bubbles?: boolean;
1894
+ cancelable?: boolean;
1895
+ composed?: boolean;
1896
+ code?: number;
1897
+ reason?: string;
1898
+ wasClean?: boolean;
1899
+ }
1866
1900
  /**
1867
1901
  * The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the fetch(), XMLHttpRequest.send() or navigator.sendBeacon() methods. It uses the same format a form would use if the encoding type were set to "multipart/form-data".
1868
1902
  *
@@ -3418,6 +3452,7 @@ interface TraceItem {
3418
3452
  | TraceItemConnectEventInfo
3419
3453
  | TraceItemScheduledEventInfo
3420
3454
  | TraceItemAlarmEventInfo
3455
+ | TraceItemOnHibernateEventInfo
3421
3456
  | TraceItemQueueEventInfo
3422
3457
  | TraceItemEmailEventInfo
3423
3458
  | TraceItemTailEventInfo
@@ -3484,6 +3519,9 @@ interface TraceItemFetchEventInfoResponse {
3484
3519
  interface TraceItemJsRpcEventInfo {
3485
3520
  readonly rpcMethod: string;
3486
3521
  }
3522
+ interface TraceItemOnHibernateEventInfo {
3523
+ readonly reason: "inactive" | "codeUpdated" | "system" | (string & {});
3524
+ }
3487
3525
  interface TraceItemHibernatableWebSocketEventInfo {
3488
3526
  readonly getWebSocketEvent:
3489
3527
  | TraceItemHibernatableWebSocketEventInfoMessage
@@ -3885,40 +3923,6 @@ interface URLPatternResult {
3885
3923
  interface URLPatternOptions {
3886
3924
  ignoreCase?: boolean;
3887
3925
  }
3888
- /**
3889
- * A **`CloseEvent`** is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.
3890
- *
3891
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
3892
- */
3893
- declare class CloseEvent extends Event {
3894
- constructor(type: string, initializer?: CloseEventInit);
3895
- /**
3896
- * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.
3897
- *
3898
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
3899
- */
3900
- readonly code: number;
3901
- /**
3902
- * The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure.
3903
- *
3904
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
3905
- */
3906
- readonly reason: string;
3907
- /**
3908
- * The **`wasClean`** read-only property of the CloseEvent interface returns true if the connection closed cleanly.
3909
- *
3910
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
3911
- */
3912
- readonly wasClean: boolean;
3913
- }
3914
- interface CloseEventInit {
3915
- bubbles?: boolean;
3916
- cancelable?: boolean;
3917
- composed?: boolean;
3918
- code?: number;
3919
- reason?: string;
3920
- wasClean?: boolean;
3921
- }
3922
3926
  type WebSocketEventMap = {
3923
3927
  close: CloseEvent;
3924
3928
  message: MessageEvent;
@@ -4944,6 +4948,11 @@ interface Tracing {
4944
4948
  ): T;
4945
4949
  startSpan(name: string): Span;
4946
4950
  getActiveSpan(): Span | undefined;
4951
+ withActiveSpan<T, A extends unknown[]>(
4952
+ span: Span,
4953
+ callback: (...args: A) => T,
4954
+ ...args: A
4955
+ ): T;
4947
4956
  Span: typeof Span;
4948
4957
  }
4949
4958
  declare abstract class Span {
@@ -16552,6 +16561,12 @@ interface JsonWebKeyWithKid extends JsonWebKey {
16552
16561
  }
16553
16562
  interface RateLimitOptions {
16554
16563
  key: string;
16564
+ /**
16565
+ * Amount to add to the counter for this call. Must be a positive integer;
16566
+ * defaults to `1`. The call is allowed while the counter is below the limit,
16567
+ * even if `delta` takes it past the limit.
16568
+ */
16569
+ delta?: number;
16555
16570
  }
16556
16571
  interface RateLimitOutcome {
16557
16572
  success: boolean;
@@ -17901,6 +17916,10 @@ declare namespace TailStream {
17901
17916
  readonly type: "alarm";
17902
17917
  readonly scheduledTime: Date;
17903
17918
  }
17919
+ interface OnHibernateEventInfo {
17920
+ readonly type: "onHibernate";
17921
+ readonly reason: "inactive" | "codeUpdated" | "system" | (string & {});
17922
+ }
17904
17923
  interface QueueEventInfo {
17905
17924
  readonly type: "queue";
17906
17925
  readonly queueName: string;
@@ -17988,6 +18007,7 @@ declare namespace TailStream {
17988
18007
  | JsRpcEventInfo
17989
18008
  | ScheduledEventInfo
17990
18009
  | AlarmEventInfo
18010
+ | OnHibernateEventInfo
17991
18011
  | QueueEventInfo
17992
18012
  | EmailEventInfo
17993
18013
  | TraceEventInfo
@@ -1157,39 +1157,6 @@ export interface Scheduler {
1157
1157
  export interface SchedulerWaitOptions {
1158
1158
  signal?: AbortSignal;
1159
1159
  }
1160
- /**
1161
- * The **`ExtendableEvent`** interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.
1162
- *
1163
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
1164
- */
1165
- export declare abstract class ExtendableEvent extends Event {
1166
- /**
1167
- * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing. It can also be used to detect whether that work was successful. In service workers, waitUntil() tells the browser that work is ongoing until the promise settles, and it shouldn't terminate the service worker if it wants that work to complete.
1168
- *
1169
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
1170
- */
1171
- waitUntil(promise: Promise<any>): void;
1172
- }
1173
- /**
1174
- * The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application.
1175
- *
1176
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)
1177
- */
1178
- export declare class CustomEvent<T = any> extends Event {
1179
- constructor(type: string, init?: CustomEventCustomEventInit);
1180
- /**
1181
- * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.
1182
- *
1183
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
1184
- */
1185
- get detail(): T;
1186
- }
1187
- export interface CustomEventCustomEventInit {
1188
- bubbles?: boolean;
1189
- cancelable?: boolean;
1190
- composed?: boolean;
1191
- detail?: any;
1192
- }
1193
1160
  /**
1194
1161
  * The **`Blob`** interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data.
1195
1162
  *
@@ -1749,6 +1716,39 @@ export interface TextEncoderEncodeIntoResult {
1749
1716
  read: number;
1750
1717
  written: number;
1751
1718
  }
1719
+ /**
1720
+ * The **`ExtendableEvent`** interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.
1721
+ *
1722
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
1723
+ */
1724
+ export declare abstract class ExtendableEvent extends Event {
1725
+ /**
1726
+ * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing. It can also be used to detect whether that work was successful. In service workers, waitUntil() tells the browser that work is ongoing until the promise settles, and it shouldn't terminate the service worker if it wants that work to complete.
1727
+ *
1728
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
1729
+ */
1730
+ waitUntil(promise: Promise<any>): void;
1731
+ }
1732
+ /**
1733
+ * The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application.
1734
+ *
1735
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)
1736
+ */
1737
+ export declare class CustomEvent<T = any> extends Event {
1738
+ constructor(type: string, init?: CustomEventCustomEventInit);
1739
+ /**
1740
+ * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.
1741
+ *
1742
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
1743
+ */
1744
+ get detail(): T;
1745
+ }
1746
+ export interface CustomEventCustomEventInit {
1747
+ bubbles?: boolean;
1748
+ cancelable?: boolean;
1749
+ composed?: boolean;
1750
+ detail?: any;
1751
+ }
1752
1752
  /**
1753
1753
  * The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files.
1754
1754
  *
@@ -1864,6 +1864,40 @@ export declare abstract class PromiseRejectionEvent extends Event {
1864
1864
  */
1865
1865
  readonly reason: any;
1866
1866
  }
1867
+ /**
1868
+ * A **`CloseEvent`** is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.
1869
+ *
1870
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
1871
+ */
1872
+ export declare class CloseEvent extends Event {
1873
+ constructor(type: string, initializer?: CloseEventInit);
1874
+ /**
1875
+ * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.
1876
+ *
1877
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
1878
+ */
1879
+ readonly code: number;
1880
+ /**
1881
+ * The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure.
1882
+ *
1883
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
1884
+ */
1885
+ readonly reason: string;
1886
+ /**
1887
+ * The **`wasClean`** read-only property of the CloseEvent interface returns true if the connection closed cleanly.
1888
+ *
1889
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
1890
+ */
1891
+ readonly wasClean: boolean;
1892
+ }
1893
+ export interface CloseEventInit {
1894
+ bubbles?: boolean;
1895
+ cancelable?: boolean;
1896
+ composed?: boolean;
1897
+ code?: number;
1898
+ reason?: string;
1899
+ wasClean?: boolean;
1900
+ }
1867
1901
  /**
1868
1902
  * The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the fetch(), XMLHttpRequest.send() or navigator.sendBeacon() methods. It uses the same format a form would use if the encoding type were set to "multipart/form-data".
1869
1903
  *
@@ -3424,6 +3458,7 @@ export interface TraceItem {
3424
3458
  | TraceItemConnectEventInfo
3425
3459
  | TraceItemScheduledEventInfo
3426
3460
  | TraceItemAlarmEventInfo
3461
+ | TraceItemOnHibernateEventInfo
3427
3462
  | TraceItemQueueEventInfo
3428
3463
  | TraceItemEmailEventInfo
3429
3464
  | TraceItemTailEventInfo
@@ -3490,6 +3525,9 @@ export interface TraceItemFetchEventInfoResponse {
3490
3525
  export interface TraceItemJsRpcEventInfo {
3491
3526
  readonly rpcMethod: string;
3492
3527
  }
3528
+ export interface TraceItemOnHibernateEventInfo {
3529
+ readonly reason: "inactive" | "codeUpdated" | "system" | (string & {});
3530
+ }
3493
3531
  export interface TraceItemHibernatableWebSocketEventInfo {
3494
3532
  readonly getWebSocketEvent:
3495
3533
  | TraceItemHibernatableWebSocketEventInfoMessage
@@ -3891,40 +3929,6 @@ export interface URLPatternResult {
3891
3929
  export interface URLPatternOptions {
3892
3930
  ignoreCase?: boolean;
3893
3931
  }
3894
- /**
3895
- * A **`CloseEvent`** is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.
3896
- *
3897
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
3898
- */
3899
- export declare class CloseEvent extends Event {
3900
- constructor(type: string, initializer?: CloseEventInit);
3901
- /**
3902
- * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.
3903
- *
3904
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
3905
- */
3906
- readonly code: number;
3907
- /**
3908
- * The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure.
3909
- *
3910
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
3911
- */
3912
- readonly reason: string;
3913
- /**
3914
- * The **`wasClean`** read-only property of the CloseEvent interface returns true if the connection closed cleanly.
3915
- *
3916
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
3917
- */
3918
- readonly wasClean: boolean;
3919
- }
3920
- export interface CloseEventInit {
3921
- bubbles?: boolean;
3922
- cancelable?: boolean;
3923
- composed?: boolean;
3924
- code?: number;
3925
- reason?: string;
3926
- wasClean?: boolean;
3927
- }
3928
3932
  export type WebSocketEventMap = {
3929
3933
  close: CloseEvent;
3930
3934
  message: MessageEvent;
@@ -4950,6 +4954,11 @@ export interface Tracing {
4950
4954
  ): T;
4951
4955
  startSpan(name: string): Span;
4952
4956
  getActiveSpan(): Span | undefined;
4957
+ withActiveSpan<T, A extends unknown[]>(
4958
+ span: Span,
4959
+ callback: (...args: A) => T,
4960
+ ...args: A
4961
+ ): T;
4953
4962
  Span: typeof Span;
4954
4963
  }
4955
4964
  export declare abstract class Span {
@@ -16462,6 +16471,12 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
16462
16471
  }
16463
16472
  export interface RateLimitOptions {
16464
16473
  key: string;
16474
+ /**
16475
+ * Amount to add to the counter for this call. Must be a positive integer;
16476
+ * defaults to `1`. The call is allowed while the counter is below the limit,
16477
+ * even if `delta` takes it past the limit.
16478
+ */
16479
+ delta?: number;
16465
16480
  }
16466
16481
  export interface RateLimitOutcome {
16467
16482
  success: boolean;
@@ -17801,6 +17816,10 @@ export declare namespace TailStream {
17801
17816
  readonly type: "alarm";
17802
17817
  readonly scheduledTime: Date;
17803
17818
  }
17819
+ interface OnHibernateEventInfo {
17820
+ readonly type: "onHibernate";
17821
+ readonly reason: "inactive" | "codeUpdated" | "system" | (string & {});
17822
+ }
17804
17823
  interface QueueEventInfo {
17805
17824
  readonly type: "queue";
17806
17825
  readonly queueName: string;
@@ -17888,6 +17907,7 @@ export declare namespace TailStream {
17888
17907
  | JsRpcEventInfo
17889
17908
  | ScheduledEventInfo
17890
17909
  | AlarmEventInfo
17910
+ | OnHibernateEventInfo
17891
17911
  | QueueEventInfo
17892
17912
  | EmailEventInfo
17893
17913
  | TraceEventInfo
package/index.d.ts CHANGED
@@ -1111,39 +1111,6 @@ interface Scheduler {
1111
1111
  interface SchedulerWaitOptions {
1112
1112
  signal?: AbortSignal;
1113
1113
  }
1114
- /**
1115
- * The **`ExtendableEvent`** interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.
1116
- *
1117
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
1118
- */
1119
- declare abstract class ExtendableEvent extends Event {
1120
- /**
1121
- * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing. It can also be used to detect whether that work was successful. In service workers, waitUntil() tells the browser that work is ongoing until the promise settles, and it shouldn't terminate the service worker if it wants that work to complete.
1122
- *
1123
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
1124
- */
1125
- waitUntil(promise: Promise<any>): void;
1126
- }
1127
- /**
1128
- * The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application.
1129
- *
1130
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)
1131
- */
1132
- declare class CustomEvent<T = any> extends Event {
1133
- constructor(type: string, init?: CustomEventCustomEventInit);
1134
- /**
1135
- * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.
1136
- *
1137
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
1138
- */
1139
- get detail(): T;
1140
- }
1141
- interface CustomEventCustomEventInit {
1142
- bubbles?: boolean;
1143
- cancelable?: boolean;
1144
- composed?: boolean;
1145
- detail?: any;
1146
- }
1147
1114
  /**
1148
1115
  * The **`Blob`** interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data.
1149
1116
  *
@@ -1646,6 +1613,39 @@ interface TextEncoderEncodeIntoResult {
1646
1613
  read: number;
1647
1614
  written: number;
1648
1615
  }
1616
+ /**
1617
+ * The **`ExtendableEvent`** interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.
1618
+ *
1619
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
1620
+ */
1621
+ declare abstract class ExtendableEvent extends Event {
1622
+ /**
1623
+ * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing. It can also be used to detect whether that work was successful. In service workers, waitUntil() tells the browser that work is ongoing until the promise settles, and it shouldn't terminate the service worker if it wants that work to complete.
1624
+ *
1625
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
1626
+ */
1627
+ waitUntil(promise: Promise<any>): void;
1628
+ }
1629
+ /**
1630
+ * The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application.
1631
+ *
1632
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)
1633
+ */
1634
+ declare class CustomEvent<T = any> extends Event {
1635
+ constructor(type: string, init?: CustomEventCustomEventInit);
1636
+ /**
1637
+ * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.
1638
+ *
1639
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
1640
+ */
1641
+ get detail(): T;
1642
+ }
1643
+ interface CustomEventCustomEventInit {
1644
+ bubbles?: boolean;
1645
+ cancelable?: boolean;
1646
+ composed?: boolean;
1647
+ detail?: any;
1648
+ }
1649
1649
  /**
1650
1650
  * The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files.
1651
1651
  *
@@ -1761,6 +1761,40 @@ declare abstract class PromiseRejectionEvent extends Event {
1761
1761
  */
1762
1762
  readonly reason: any;
1763
1763
  }
1764
+ /**
1765
+ * A **`CloseEvent`** is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.
1766
+ *
1767
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
1768
+ */
1769
+ declare class CloseEvent extends Event {
1770
+ constructor(type: string, initializer?: CloseEventInit);
1771
+ /**
1772
+ * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.
1773
+ *
1774
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
1775
+ */
1776
+ readonly code: number;
1777
+ /**
1778
+ * The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure.
1779
+ *
1780
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
1781
+ */
1782
+ readonly reason: string;
1783
+ /**
1784
+ * The **`wasClean`** read-only property of the CloseEvent interface returns true if the connection closed cleanly.
1785
+ *
1786
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
1787
+ */
1788
+ readonly wasClean: boolean;
1789
+ }
1790
+ interface CloseEventInit {
1791
+ bubbles?: boolean;
1792
+ cancelable?: boolean;
1793
+ composed?: boolean;
1794
+ code?: number;
1795
+ reason?: string;
1796
+ wasClean?: boolean;
1797
+ }
1764
1798
  /**
1765
1799
  * The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the fetch(), XMLHttpRequest.send() or navigator.sendBeacon() methods. It uses the same format a form would use if the encoding type were set to "multipart/form-data".
1766
1800
  *
@@ -3263,6 +3297,7 @@ interface TraceItem {
3263
3297
  | TraceItemConnectEventInfo
3264
3298
  | TraceItemScheduledEventInfo
3265
3299
  | TraceItemAlarmEventInfo
3300
+ | TraceItemOnHibernateEventInfo
3266
3301
  | TraceItemQueueEventInfo
3267
3302
  | TraceItemEmailEventInfo
3268
3303
  | TraceItemTailEventInfo
@@ -3329,6 +3364,9 @@ interface TraceItemFetchEventInfoResponse {
3329
3364
  interface TraceItemJsRpcEventInfo {
3330
3365
  readonly rpcMethod: string;
3331
3366
  }
3367
+ interface TraceItemOnHibernateEventInfo {
3368
+ readonly reason: "inactive" | "codeUpdated" | "system" | (string & {});
3369
+ }
3332
3370
  interface TraceItemHibernatableWebSocketEventInfo {
3333
3371
  readonly getWebSocketEvent:
3334
3372
  | TraceItemHibernatableWebSocketEventInfoMessage
@@ -3730,40 +3768,6 @@ interface URLPatternResult {
3730
3768
  interface URLPatternOptions {
3731
3769
  ignoreCase?: boolean;
3732
3770
  }
3733
- /**
3734
- * A **`CloseEvent`** is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.
3735
- *
3736
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
3737
- */
3738
- declare class CloseEvent extends Event {
3739
- constructor(type: string, initializer?: CloseEventInit);
3740
- /**
3741
- * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.
3742
- *
3743
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
3744
- */
3745
- readonly code: number;
3746
- /**
3747
- * The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure.
3748
- *
3749
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
3750
- */
3751
- readonly reason: string;
3752
- /**
3753
- * The **`wasClean`** read-only property of the CloseEvent interface returns true if the connection closed cleanly.
3754
- *
3755
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
3756
- */
3757
- readonly wasClean: boolean;
3758
- }
3759
- interface CloseEventInit {
3760
- bubbles?: boolean;
3761
- cancelable?: boolean;
3762
- composed?: boolean;
3763
- code?: number;
3764
- reason?: string;
3765
- wasClean?: boolean;
3766
- }
3767
3771
  type WebSocketEventMap = {
3768
3772
  close: CloseEvent;
3769
3773
  message: MessageEvent;
@@ -4583,6 +4587,11 @@ interface Tracing {
4583
4587
  ): T;
4584
4588
  startSpan(name: string): Span;
4585
4589
  getActiveSpan(): Span | undefined;
4590
+ withActiveSpan<T, A extends unknown[]>(
4591
+ span: Span,
4592
+ callback: (...args: A) => T,
4593
+ ...args: A
4594
+ ): T;
4586
4595
  Span: typeof Span;
4587
4596
  }
4588
4597
  declare abstract class Span {
@@ -16191,6 +16200,12 @@ interface JsonWebKeyWithKid extends JsonWebKey {
16191
16200
  }
16192
16201
  interface RateLimitOptions {
16193
16202
  key: string;
16203
+ /**
16204
+ * Amount to add to the counter for this call. Must be a positive integer;
16205
+ * defaults to `1`. The call is allowed while the counter is below the limit,
16206
+ * even if `delta` takes it past the limit.
16207
+ */
16208
+ delta?: number;
16194
16209
  }
16195
16210
  interface RateLimitOutcome {
16196
16211
  success: boolean;
@@ -17540,6 +17555,10 @@ declare namespace TailStream {
17540
17555
  readonly type: "alarm";
17541
17556
  readonly scheduledTime: Date;
17542
17557
  }
17558
+ interface OnHibernateEventInfo {
17559
+ readonly type: "onHibernate";
17560
+ readonly reason: "inactive" | "codeUpdated" | "system" | (string & {});
17561
+ }
17543
17562
  interface QueueEventInfo {
17544
17563
  readonly type: "queue";
17545
17564
  readonly queueName: string;
@@ -17627,6 +17646,7 @@ declare namespace TailStream {
17627
17646
  | JsRpcEventInfo
17628
17647
  | ScheduledEventInfo
17629
17648
  | AlarmEventInfo
17649
+ | OnHibernateEventInfo
17630
17650
  | QueueEventInfo
17631
17651
  | EmailEventInfo
17632
17652
  | TraceEventInfo
package/index.ts CHANGED
@@ -1115,39 +1115,6 @@ export interface Scheduler {
1115
1115
  export interface SchedulerWaitOptions {
1116
1116
  signal?: AbortSignal;
1117
1117
  }
1118
- /**
1119
- * The **`ExtendableEvent`** interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.
1120
- *
1121
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
1122
- */
1123
- export declare abstract class ExtendableEvent extends Event {
1124
- /**
1125
- * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing. It can also be used to detect whether that work was successful. In service workers, waitUntil() tells the browser that work is ongoing until the promise settles, and it shouldn't terminate the service worker if it wants that work to complete.
1126
- *
1127
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
1128
- */
1129
- waitUntil(promise: Promise<any>): void;
1130
- }
1131
- /**
1132
- * The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application.
1133
- *
1134
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)
1135
- */
1136
- export declare class CustomEvent<T = any> extends Event {
1137
- constructor(type: string, init?: CustomEventCustomEventInit);
1138
- /**
1139
- * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.
1140
- *
1141
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
1142
- */
1143
- get detail(): T;
1144
- }
1145
- export interface CustomEventCustomEventInit {
1146
- bubbles?: boolean;
1147
- cancelable?: boolean;
1148
- composed?: boolean;
1149
- detail?: any;
1150
- }
1151
1118
  /**
1152
1119
  * The **`Blob`** interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data.
1153
1120
  *
@@ -1650,6 +1617,39 @@ export interface TextEncoderEncodeIntoResult {
1650
1617
  read: number;
1651
1618
  written: number;
1652
1619
  }
1620
+ /**
1621
+ * The **`ExtendableEvent`** interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries.
1622
+ *
1623
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)
1624
+ */
1625
+ export declare abstract class ExtendableEvent extends Event {
1626
+ /**
1627
+ * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing. It can also be used to detect whether that work was successful. In service workers, waitUntil() tells the browser that work is ongoing until the promise settles, and it shouldn't terminate the service worker if it wants that work to complete.
1628
+ *
1629
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)
1630
+ */
1631
+ waitUntil(promise: Promise<any>): void;
1632
+ }
1633
+ /**
1634
+ * The **`CustomEvent`** interface can be used to attach custom data to an event generated by an application.
1635
+ *
1636
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)
1637
+ */
1638
+ export declare class CustomEvent<T = any> extends Event {
1639
+ constructor(type: string, init?: CustomEventCustomEventInit);
1640
+ /**
1641
+ * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.
1642
+ *
1643
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)
1644
+ */
1645
+ get detail(): T;
1646
+ }
1647
+ export interface CustomEventCustomEventInit {
1648
+ bubbles?: boolean;
1649
+ cancelable?: boolean;
1650
+ composed?: boolean;
1651
+ detail?: any;
1652
+ }
1653
1653
  /**
1654
1654
  * The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files.
1655
1655
  *
@@ -1765,6 +1765,40 @@ export declare abstract class PromiseRejectionEvent extends Event {
1765
1765
  */
1766
1766
  readonly reason: any;
1767
1767
  }
1768
+ /**
1769
+ * A **`CloseEvent`** is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.
1770
+ *
1771
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
1772
+ */
1773
+ export declare class CloseEvent extends Event {
1774
+ constructor(type: string, initializer?: CloseEventInit);
1775
+ /**
1776
+ * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.
1777
+ *
1778
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
1779
+ */
1780
+ readonly code: number;
1781
+ /**
1782
+ * The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure.
1783
+ *
1784
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
1785
+ */
1786
+ readonly reason: string;
1787
+ /**
1788
+ * The **`wasClean`** read-only property of the CloseEvent interface returns true if the connection closed cleanly.
1789
+ *
1790
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
1791
+ */
1792
+ readonly wasClean: boolean;
1793
+ }
1794
+ export interface CloseEventInit {
1795
+ bubbles?: boolean;
1796
+ cancelable?: boolean;
1797
+ composed?: boolean;
1798
+ code?: number;
1799
+ reason?: string;
1800
+ wasClean?: boolean;
1801
+ }
1768
1802
  /**
1769
1803
  * The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the fetch(), XMLHttpRequest.send() or navigator.sendBeacon() methods. It uses the same format a form would use if the encoding type were set to "multipart/form-data".
1770
1804
  *
@@ -3272,6 +3306,7 @@ export interface TraceItem {
3272
3306
  | TraceItemConnectEventInfo
3273
3307
  | TraceItemScheduledEventInfo
3274
3308
  | TraceItemAlarmEventInfo
3309
+ | TraceItemOnHibernateEventInfo
3275
3310
  | TraceItemQueueEventInfo
3276
3311
  | TraceItemEmailEventInfo
3277
3312
  | TraceItemTailEventInfo
@@ -3338,6 +3373,9 @@ export interface TraceItemFetchEventInfoResponse {
3338
3373
  export interface TraceItemJsRpcEventInfo {
3339
3374
  readonly rpcMethod: string;
3340
3375
  }
3376
+ export interface TraceItemOnHibernateEventInfo {
3377
+ readonly reason: "inactive" | "codeUpdated" | "system" | (string & {});
3378
+ }
3341
3379
  export interface TraceItemHibernatableWebSocketEventInfo {
3342
3380
  readonly getWebSocketEvent:
3343
3381
  | TraceItemHibernatableWebSocketEventInfoMessage
@@ -3739,40 +3777,6 @@ export interface URLPatternResult {
3739
3777
  export interface URLPatternOptions {
3740
3778
  ignoreCase?: boolean;
3741
3779
  }
3742
- /**
3743
- * A **`CloseEvent`** is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute.
3744
- *
3745
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)
3746
- */
3747
- export declare class CloseEvent extends Event {
3748
- constructor(type: string, initializer?: CloseEventInit);
3749
- /**
3750
- * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.
3751
- *
3752
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)
3753
- */
3754
- readonly code: number;
3755
- /**
3756
- * The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure.
3757
- *
3758
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)
3759
- */
3760
- readonly reason: string;
3761
- /**
3762
- * The **`wasClean`** read-only property of the CloseEvent interface returns true if the connection closed cleanly.
3763
- *
3764
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)
3765
- */
3766
- readonly wasClean: boolean;
3767
- }
3768
- export interface CloseEventInit {
3769
- bubbles?: boolean;
3770
- cancelable?: boolean;
3771
- composed?: boolean;
3772
- code?: number;
3773
- reason?: string;
3774
- wasClean?: boolean;
3775
- }
3776
3780
  export type WebSocketEventMap = {
3777
3781
  close: CloseEvent;
3778
3782
  message: MessageEvent;
@@ -4592,6 +4596,11 @@ export interface Tracing {
4592
4596
  ): T;
4593
4597
  startSpan(name: string): Span;
4594
4598
  getActiveSpan(): Span | undefined;
4599
+ withActiveSpan<T, A extends unknown[]>(
4600
+ span: Span,
4601
+ callback: (...args: A) => T,
4602
+ ...args: A
4603
+ ): T;
4595
4604
  Span: typeof Span;
4596
4605
  }
4597
4606
  export declare abstract class Span {
@@ -16104,6 +16113,12 @@ export interface JsonWebKeyWithKid extends JsonWebKey {
16104
16113
  }
16105
16114
  export interface RateLimitOptions {
16106
16115
  key: string;
16116
+ /**
16117
+ * Amount to add to the counter for this call. Must be a positive integer;
16118
+ * defaults to `1`. The call is allowed while the counter is below the limit,
16119
+ * even if `delta` takes it past the limit.
16120
+ */
16121
+ delta?: number;
16107
16122
  }
16108
16123
  export interface RateLimitOutcome {
16109
16124
  success: boolean;
@@ -17443,6 +17458,10 @@ export declare namespace TailStream {
17443
17458
  readonly type: "alarm";
17444
17459
  readonly scheduledTime: Date;
17445
17460
  }
17461
+ interface OnHibernateEventInfo {
17462
+ readonly type: "onHibernate";
17463
+ readonly reason: "inactive" | "codeUpdated" | "system" | (string & {});
17464
+ }
17446
17465
  interface QueueEventInfo {
17447
17466
  readonly type: "queue";
17448
17467
  readonly queueName: string;
@@ -17530,6 +17549,7 @@ export declare namespace TailStream {
17530
17549
  | JsRpcEventInfo
17531
17550
  | ScheduledEventInfo
17532
17551
  | AlarmEventInfo
17552
+ | OnHibernateEventInfo
17533
17553
  | QueueEventInfo
17534
17554
  | EmailEventInfo
17535
17555
  | TraceEventInfo
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.20261104.1"
10
+ "version": "5.20261107.1"
11
11
  }