@cloudflare/workers-types 4.20250723.0 → 4.20250725.0

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.
@@ -1337,6 +1337,47 @@ interface ErrorEventErrorEventInit {
1337
1337
  colno?: number;
1338
1338
  error?: any;
1339
1339
  }
1340
+ /**
1341
+ * A message received by a target object.
1342
+ *
1343
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
1344
+ */
1345
+ declare class MessageEvent extends Event {
1346
+ constructor(type: string, initializer: MessageEventInit);
1347
+ /**
1348
+ * Returns the data of the message.
1349
+ *
1350
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
1351
+ */
1352
+ readonly data: any;
1353
+ /**
1354
+ * Returns the origin of the message, for server-sent events and cross-document messaging.
1355
+ *
1356
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)
1357
+ */
1358
+ readonly origin: string | null;
1359
+ /**
1360
+ * Returns the last event ID string, for server-sent events.
1361
+ *
1362
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)
1363
+ */
1364
+ readonly lastEventId: string;
1365
+ /**
1366
+ * Returns the WindowProxy of the source window, for cross-document messaging, and the MessagePort being attached, in the connect event fired at SharedWorkerGlobalScope objects.
1367
+ *
1368
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)
1369
+ */
1370
+ readonly source: MessagePort | null;
1371
+ /**
1372
+ * Returns the MessagePort array sent with the message, for cross-document messaging and channel messaging.
1373
+ *
1374
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)
1375
+ */
1376
+ readonly ports: MessagePort[];
1377
+ }
1378
+ interface MessageEventInit {
1379
+ data: ArrayBuffer | string;
1380
+ }
1340
1381
  /**
1341
1382
  * Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data".
1342
1383
  *
@@ -1686,8 +1727,19 @@ interface RequestInit<Cf = CfProperties> {
1686
1727
  signal?: AbortSignal | null;
1687
1728
  encodeResponseBody?: "automatic" | "manual";
1688
1729
  }
1689
- type Service<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> =
1690
- Fetcher<T>;
1730
+ type Service<
1731
+ T extends
1732
+ | (new (...args: any[]) => Rpc.WorkerEntrypointBranded)
1733
+ | Rpc.WorkerEntrypointBranded
1734
+ | ExportedHandler<any, any, any>
1735
+ | undefined = undefined,
1736
+ > = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded
1737
+ ? Fetcher<InstanceType<T>>
1738
+ : T extends Rpc.WorkerEntrypointBranded
1739
+ ? Fetcher<T>
1740
+ : T extends Exclude<Rpc.EntrypointBranded, Rpc.WorkerEntrypointBranded>
1741
+ ? never
1742
+ : Fetcher<undefined>;
1691
1743
  type Fetcher<
1692
1744
  T extends Rpc.EntrypointBranded | undefined = undefined,
1693
1745
  Reserved extends string = never,
@@ -2748,23 +2800,6 @@ interface CloseEventInit {
2748
2800
  reason?: string;
2749
2801
  wasClean?: boolean;
2750
2802
  }
2751
- /**
2752
- * A message received by a target object.
2753
- *
2754
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
2755
- */
2756
- declare class MessageEvent extends Event {
2757
- constructor(type: string, initializer: MessageEventInit);
2758
- /**
2759
- * Returns the data of the message.
2760
- *
2761
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
2762
- */
2763
- readonly data: ArrayBuffer | string;
2764
- }
2765
- interface MessageEventInit {
2766
- data: ArrayBuffer | string;
2767
- }
2768
2803
  type WebSocketEventMap = {
2769
2804
  close: CloseEvent;
2770
2805
  message: MessageEvent;
@@ -2958,6 +2993,41 @@ interface ContainerStartupOptions {
2958
2993
  enableInternet: boolean;
2959
2994
  env?: Record<string, string>;
2960
2995
  }
2996
+ /**
2997
+ * This Channel Messaging API interface represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
2998
+ *
2999
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
3000
+ */
3001
+ interface MessagePort extends EventTarget {
3002
+ /**
3003
+ * Posts a message through the channel. Objects listed in transfer are transferred, not just cloned, meaning that they are no longer usable on the sending side.
3004
+ *
3005
+ * Throws a "DataCloneError" DOMException if transfer contains duplicate objects or port, or if message could not be cloned.
3006
+ *
3007
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
3008
+ */
3009
+ postMessage(
3010
+ data?: any,
3011
+ options?: any[] | MessagePortPostMessageOptions,
3012
+ ): void;
3013
+ /**
3014
+ * Disconnects the port, so that it is no longer active.
3015
+ *
3016
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
3017
+ */
3018
+ close(): void;
3019
+ /**
3020
+ * Begins dispatching messages received on the port.
3021
+ *
3022
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
3023
+ */
3024
+ start(): void;
3025
+ get onmessage(): any | null;
3026
+ set onmessage(value: any | null);
3027
+ }
3028
+ interface MessagePortPostMessageOptions {
3029
+ transfer?: any[];
3030
+ }
2961
3031
  type AiImageClassificationInput = {
2962
3032
  image: number[];
2963
3033
  };
@@ -1342,6 +1342,47 @@ export interface ErrorEventErrorEventInit {
1342
1342
  colno?: number;
1343
1343
  error?: any;
1344
1344
  }
1345
+ /**
1346
+ * A message received by a target object.
1347
+ *
1348
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
1349
+ */
1350
+ export declare class MessageEvent extends Event {
1351
+ constructor(type: string, initializer: MessageEventInit);
1352
+ /**
1353
+ * Returns the data of the message.
1354
+ *
1355
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
1356
+ */
1357
+ readonly data: any;
1358
+ /**
1359
+ * Returns the origin of the message, for server-sent events and cross-document messaging.
1360
+ *
1361
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)
1362
+ */
1363
+ readonly origin: string | null;
1364
+ /**
1365
+ * Returns the last event ID string, for server-sent events.
1366
+ *
1367
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)
1368
+ */
1369
+ readonly lastEventId: string;
1370
+ /**
1371
+ * Returns the WindowProxy of the source window, for cross-document messaging, and the MessagePort being attached, in the connect event fired at SharedWorkerGlobalScope objects.
1372
+ *
1373
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)
1374
+ */
1375
+ readonly source: MessagePort | null;
1376
+ /**
1377
+ * Returns the MessagePort array sent with the message, for cross-document messaging and channel messaging.
1378
+ *
1379
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)
1380
+ */
1381
+ readonly ports: MessagePort[];
1382
+ }
1383
+ export interface MessageEventInit {
1384
+ data: ArrayBuffer | string;
1385
+ }
1345
1386
  /**
1346
1387
  * Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data".
1347
1388
  *
@@ -1695,8 +1736,18 @@ export interface RequestInit<Cf = CfProperties> {
1695
1736
  encodeResponseBody?: "automatic" | "manual";
1696
1737
  }
1697
1738
  export type Service<
1698
- T extends Rpc.WorkerEntrypointBranded | undefined = undefined,
1699
- > = Fetcher<T>;
1739
+ T extends
1740
+ | (new (...args: any[]) => Rpc.WorkerEntrypointBranded)
1741
+ | Rpc.WorkerEntrypointBranded
1742
+ | ExportedHandler<any, any, any>
1743
+ | undefined = undefined,
1744
+ > = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded
1745
+ ? Fetcher<InstanceType<T>>
1746
+ : T extends Rpc.WorkerEntrypointBranded
1747
+ ? Fetcher<T>
1748
+ : T extends Exclude<Rpc.EntrypointBranded, Rpc.WorkerEntrypointBranded>
1749
+ ? never
1750
+ : Fetcher<undefined>;
1700
1751
  export type Fetcher<
1701
1752
  T extends Rpc.EntrypointBranded | undefined = undefined,
1702
1753
  Reserved extends string = never,
@@ -2760,23 +2811,6 @@ export interface CloseEventInit {
2760
2811
  reason?: string;
2761
2812
  wasClean?: boolean;
2762
2813
  }
2763
- /**
2764
- * A message received by a target object.
2765
- *
2766
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
2767
- */
2768
- export declare class MessageEvent extends Event {
2769
- constructor(type: string, initializer: MessageEventInit);
2770
- /**
2771
- * Returns the data of the message.
2772
- *
2773
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
2774
- */
2775
- readonly data: ArrayBuffer | string;
2776
- }
2777
- export interface MessageEventInit {
2778
- data: ArrayBuffer | string;
2779
- }
2780
2814
  export type WebSocketEventMap = {
2781
2815
  close: CloseEvent;
2782
2816
  message: MessageEvent;
@@ -2970,6 +3004,41 @@ export interface ContainerStartupOptions {
2970
3004
  enableInternet: boolean;
2971
3005
  env?: Record<string, string>;
2972
3006
  }
3007
+ /**
3008
+ * This Channel Messaging API interface represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
3009
+ *
3010
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
3011
+ */
3012
+ export interface MessagePort extends EventTarget {
3013
+ /**
3014
+ * Posts a message through the channel. Objects listed in transfer are transferred, not just cloned, meaning that they are no longer usable on the sending side.
3015
+ *
3016
+ * Throws a "DataCloneError" DOMException if transfer contains duplicate objects or port, or if message could not be cloned.
3017
+ *
3018
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
3019
+ */
3020
+ postMessage(
3021
+ data?: any,
3022
+ options?: any[] | MessagePortPostMessageOptions,
3023
+ ): void;
3024
+ /**
3025
+ * Disconnects the port, so that it is no longer active.
3026
+ *
3027
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
3028
+ */
3029
+ close(): void;
3030
+ /**
3031
+ * Begins dispatching messages received on the port.
3032
+ *
3033
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
3034
+ */
3035
+ start(): void;
3036
+ get onmessage(): any | null;
3037
+ set onmessage(value: any | null);
3038
+ }
3039
+ export interface MessagePortPostMessageOptions {
3040
+ transfer?: any[];
3041
+ }
2973
3042
  export type AiImageClassificationInput = {
2974
3043
  image: number[];
2975
3044
  };
@@ -1343,6 +1343,47 @@ interface ErrorEventErrorEventInit {
1343
1343
  colno?: number;
1344
1344
  error?: any;
1345
1345
  }
1346
+ /**
1347
+ * A message received by a target object.
1348
+ *
1349
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
1350
+ */
1351
+ declare class MessageEvent extends Event {
1352
+ constructor(type: string, initializer: MessageEventInit);
1353
+ /**
1354
+ * Returns the data of the message.
1355
+ *
1356
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
1357
+ */
1358
+ readonly data: any;
1359
+ /**
1360
+ * Returns the origin of the message, for server-sent events and cross-document messaging.
1361
+ *
1362
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)
1363
+ */
1364
+ readonly origin: string | null;
1365
+ /**
1366
+ * Returns the last event ID string, for server-sent events.
1367
+ *
1368
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)
1369
+ */
1370
+ readonly lastEventId: string;
1371
+ /**
1372
+ * Returns the WindowProxy of the source window, for cross-document messaging, and the MessagePort being attached, in the connect event fired at SharedWorkerGlobalScope objects.
1373
+ *
1374
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)
1375
+ */
1376
+ readonly source: MessagePort | null;
1377
+ /**
1378
+ * Returns the MessagePort array sent with the message, for cross-document messaging and channel messaging.
1379
+ *
1380
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)
1381
+ */
1382
+ readonly ports: MessagePort[];
1383
+ }
1384
+ interface MessageEventInit {
1385
+ data: ArrayBuffer | string;
1386
+ }
1346
1387
  /**
1347
1388
  * Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data".
1348
1389
  *
@@ -1692,8 +1733,19 @@ interface RequestInit<Cf = CfProperties> {
1692
1733
  signal?: AbortSignal | null;
1693
1734
  encodeResponseBody?: "automatic" | "manual";
1694
1735
  }
1695
- type Service<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> =
1696
- Fetcher<T>;
1736
+ type Service<
1737
+ T extends
1738
+ | (new (...args: any[]) => Rpc.WorkerEntrypointBranded)
1739
+ | Rpc.WorkerEntrypointBranded
1740
+ | ExportedHandler<any, any, any>
1741
+ | undefined = undefined,
1742
+ > = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded
1743
+ ? Fetcher<InstanceType<T>>
1744
+ : T extends Rpc.WorkerEntrypointBranded
1745
+ ? Fetcher<T>
1746
+ : T extends Exclude<Rpc.EntrypointBranded, Rpc.WorkerEntrypointBranded>
1747
+ ? never
1748
+ : Fetcher<undefined>;
1697
1749
  type Fetcher<
1698
1750
  T extends Rpc.EntrypointBranded | undefined = undefined,
1699
1751
  Reserved extends string = never,
@@ -2774,23 +2826,6 @@ interface CloseEventInit {
2774
2826
  reason?: string;
2775
2827
  wasClean?: boolean;
2776
2828
  }
2777
- /**
2778
- * A message received by a target object.
2779
- *
2780
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
2781
- */
2782
- declare class MessageEvent extends Event {
2783
- constructor(type: string, initializer: MessageEventInit);
2784
- /**
2785
- * Returns the data of the message.
2786
- *
2787
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
2788
- */
2789
- readonly data: ArrayBuffer | string;
2790
- }
2791
- interface MessageEventInit {
2792
- data: ArrayBuffer | string;
2793
- }
2794
2829
  type WebSocketEventMap = {
2795
2830
  close: CloseEvent;
2796
2831
  message: MessageEvent;
@@ -2984,6 +3019,41 @@ interface ContainerStartupOptions {
2984
3019
  enableInternet: boolean;
2985
3020
  env?: Record<string, string>;
2986
3021
  }
3022
+ /**
3023
+ * This Channel Messaging API interface represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
3024
+ *
3025
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
3026
+ */
3027
+ interface MessagePort extends EventTarget {
3028
+ /**
3029
+ * Posts a message through the channel. Objects listed in transfer are transferred, not just cloned, meaning that they are no longer usable on the sending side.
3030
+ *
3031
+ * Throws a "DataCloneError" DOMException if transfer contains duplicate objects or port, or if message could not be cloned.
3032
+ *
3033
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
3034
+ */
3035
+ postMessage(
3036
+ data?: any,
3037
+ options?: any[] | MessagePortPostMessageOptions,
3038
+ ): void;
3039
+ /**
3040
+ * Disconnects the port, so that it is no longer active.
3041
+ *
3042
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
3043
+ */
3044
+ close(): void;
3045
+ /**
3046
+ * Begins dispatching messages received on the port.
3047
+ *
3048
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
3049
+ */
3050
+ start(): void;
3051
+ get onmessage(): any | null;
3052
+ set onmessage(value: any | null);
3053
+ }
3054
+ interface MessagePortPostMessageOptions {
3055
+ transfer?: any[];
3056
+ }
2987
3057
  type AiImageClassificationInput = {
2988
3058
  image: number[];
2989
3059
  };
@@ -1348,6 +1348,47 @@ export interface ErrorEventErrorEventInit {
1348
1348
  colno?: number;
1349
1349
  error?: any;
1350
1350
  }
1351
+ /**
1352
+ * A message received by a target object.
1353
+ *
1354
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
1355
+ */
1356
+ export declare class MessageEvent extends Event {
1357
+ constructor(type: string, initializer: MessageEventInit);
1358
+ /**
1359
+ * Returns the data of the message.
1360
+ *
1361
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
1362
+ */
1363
+ readonly data: any;
1364
+ /**
1365
+ * Returns the origin of the message, for server-sent events and cross-document messaging.
1366
+ *
1367
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)
1368
+ */
1369
+ readonly origin: string | null;
1370
+ /**
1371
+ * Returns the last event ID string, for server-sent events.
1372
+ *
1373
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)
1374
+ */
1375
+ readonly lastEventId: string;
1376
+ /**
1377
+ * Returns the WindowProxy of the source window, for cross-document messaging, and the MessagePort being attached, in the connect event fired at SharedWorkerGlobalScope objects.
1378
+ *
1379
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)
1380
+ */
1381
+ readonly source: MessagePort | null;
1382
+ /**
1383
+ * Returns the MessagePort array sent with the message, for cross-document messaging and channel messaging.
1384
+ *
1385
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)
1386
+ */
1387
+ readonly ports: MessagePort[];
1388
+ }
1389
+ export interface MessageEventInit {
1390
+ data: ArrayBuffer | string;
1391
+ }
1351
1392
  /**
1352
1393
  * Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data".
1353
1394
  *
@@ -1701,8 +1742,18 @@ export interface RequestInit<Cf = CfProperties> {
1701
1742
  encodeResponseBody?: "automatic" | "manual";
1702
1743
  }
1703
1744
  export type Service<
1704
- T extends Rpc.WorkerEntrypointBranded | undefined = undefined,
1705
- > = Fetcher<T>;
1745
+ T extends
1746
+ | (new (...args: any[]) => Rpc.WorkerEntrypointBranded)
1747
+ | Rpc.WorkerEntrypointBranded
1748
+ | ExportedHandler<any, any, any>
1749
+ | undefined = undefined,
1750
+ > = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded
1751
+ ? Fetcher<InstanceType<T>>
1752
+ : T extends Rpc.WorkerEntrypointBranded
1753
+ ? Fetcher<T>
1754
+ : T extends Exclude<Rpc.EntrypointBranded, Rpc.WorkerEntrypointBranded>
1755
+ ? never
1756
+ : Fetcher<undefined>;
1706
1757
  export type Fetcher<
1707
1758
  T extends Rpc.EntrypointBranded | undefined = undefined,
1708
1759
  Reserved extends string = never,
@@ -2786,23 +2837,6 @@ export interface CloseEventInit {
2786
2837
  reason?: string;
2787
2838
  wasClean?: boolean;
2788
2839
  }
2789
- /**
2790
- * A message received by a target object.
2791
- *
2792
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
2793
- */
2794
- export declare class MessageEvent extends Event {
2795
- constructor(type: string, initializer: MessageEventInit);
2796
- /**
2797
- * Returns the data of the message.
2798
- *
2799
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
2800
- */
2801
- readonly data: ArrayBuffer | string;
2802
- }
2803
- export interface MessageEventInit {
2804
- data: ArrayBuffer | string;
2805
- }
2806
2840
  export type WebSocketEventMap = {
2807
2841
  close: CloseEvent;
2808
2842
  message: MessageEvent;
@@ -2996,6 +3030,41 @@ export interface ContainerStartupOptions {
2996
3030
  enableInternet: boolean;
2997
3031
  env?: Record<string, string>;
2998
3032
  }
3033
+ /**
3034
+ * This Channel Messaging API interface represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
3035
+ *
3036
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
3037
+ */
3038
+ export interface MessagePort extends EventTarget {
3039
+ /**
3040
+ * Posts a message through the channel. Objects listed in transfer are transferred, not just cloned, meaning that they are no longer usable on the sending side.
3041
+ *
3042
+ * Throws a "DataCloneError" DOMException if transfer contains duplicate objects or port, or if message could not be cloned.
3043
+ *
3044
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
3045
+ */
3046
+ postMessage(
3047
+ data?: any,
3048
+ options?: any[] | MessagePortPostMessageOptions,
3049
+ ): void;
3050
+ /**
3051
+ * Disconnects the port, so that it is no longer active.
3052
+ *
3053
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
3054
+ */
3055
+ close(): void;
3056
+ /**
3057
+ * Begins dispatching messages received on the port.
3058
+ *
3059
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
3060
+ */
3061
+ start(): void;
3062
+ get onmessage(): any | null;
3063
+ set onmessage(value: any | null);
3064
+ }
3065
+ export interface MessagePortPostMessageOptions {
3066
+ transfer?: any[];
3067
+ }
2999
3068
  export type AiImageClassificationInput = {
3000
3069
  image: number[];
3001
3070
  };
@@ -1361,6 +1361,47 @@ interface ErrorEventErrorEventInit {
1361
1361
  colno?: number;
1362
1362
  error?: any;
1363
1363
  }
1364
+ /**
1365
+ * A message received by a target object.
1366
+ *
1367
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
1368
+ */
1369
+ declare class MessageEvent extends Event {
1370
+ constructor(type: string, initializer: MessageEventInit);
1371
+ /**
1372
+ * Returns the data of the message.
1373
+ *
1374
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
1375
+ */
1376
+ readonly data: any;
1377
+ /**
1378
+ * Returns the origin of the message, for server-sent events and cross-document messaging.
1379
+ *
1380
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)
1381
+ */
1382
+ readonly origin: string | null;
1383
+ /**
1384
+ * Returns the last event ID string, for server-sent events.
1385
+ *
1386
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)
1387
+ */
1388
+ readonly lastEventId: string;
1389
+ /**
1390
+ * Returns the WindowProxy of the source window, for cross-document messaging, and the MessagePort being attached, in the connect event fired at SharedWorkerGlobalScope objects.
1391
+ *
1392
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)
1393
+ */
1394
+ readonly source: MessagePort | null;
1395
+ /**
1396
+ * Returns the MessagePort array sent with the message, for cross-document messaging and channel messaging.
1397
+ *
1398
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)
1399
+ */
1400
+ readonly ports: MessagePort[];
1401
+ }
1402
+ interface MessageEventInit {
1403
+ data: ArrayBuffer | string;
1404
+ }
1364
1405
  /**
1365
1406
  * Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data".
1366
1407
  *
@@ -1710,8 +1751,19 @@ interface RequestInit<Cf = CfProperties> {
1710
1751
  signal?: AbortSignal | null;
1711
1752
  encodeResponseBody?: "automatic" | "manual";
1712
1753
  }
1713
- type Service<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> =
1714
- Fetcher<T>;
1754
+ type Service<
1755
+ T extends
1756
+ | (new (...args: any[]) => Rpc.WorkerEntrypointBranded)
1757
+ | Rpc.WorkerEntrypointBranded
1758
+ | ExportedHandler<any, any, any>
1759
+ | undefined = undefined,
1760
+ > = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded
1761
+ ? Fetcher<InstanceType<T>>
1762
+ : T extends Rpc.WorkerEntrypointBranded
1763
+ ? Fetcher<T>
1764
+ : T extends Exclude<Rpc.EntrypointBranded, Rpc.WorkerEntrypointBranded>
1765
+ ? never
1766
+ : Fetcher<undefined>;
1715
1767
  type Fetcher<
1716
1768
  T extends Rpc.EntrypointBranded | undefined = undefined,
1717
1769
  Reserved extends string = never,
@@ -2792,23 +2844,6 @@ interface CloseEventInit {
2792
2844
  reason?: string;
2793
2845
  wasClean?: boolean;
2794
2846
  }
2795
- /**
2796
- * A message received by a target object.
2797
- *
2798
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
2799
- */
2800
- declare class MessageEvent extends Event {
2801
- constructor(type: string, initializer: MessageEventInit);
2802
- /**
2803
- * Returns the data of the message.
2804
- *
2805
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
2806
- */
2807
- readonly data: ArrayBuffer | string;
2808
- }
2809
- interface MessageEventInit {
2810
- data: ArrayBuffer | string;
2811
- }
2812
2847
  type WebSocketEventMap = {
2813
2848
  close: CloseEvent;
2814
2849
  message: MessageEvent;
@@ -3002,6 +3037,41 @@ interface ContainerStartupOptions {
3002
3037
  enableInternet: boolean;
3003
3038
  env?: Record<string, string>;
3004
3039
  }
3040
+ /**
3041
+ * This Channel Messaging API interface represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.
3042
+ *
3043
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
3044
+ */
3045
+ interface MessagePort extends EventTarget {
3046
+ /**
3047
+ * Posts a message through the channel. Objects listed in transfer are transferred, not just cloned, meaning that they are no longer usable on the sending side.
3048
+ *
3049
+ * Throws a "DataCloneError" DOMException if transfer contains duplicate objects or port, or if message could not be cloned.
3050
+ *
3051
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
3052
+ */
3053
+ postMessage(
3054
+ data?: any,
3055
+ options?: any[] | MessagePortPostMessageOptions,
3056
+ ): void;
3057
+ /**
3058
+ * Disconnects the port, so that it is no longer active.
3059
+ *
3060
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
3061
+ */
3062
+ close(): void;
3063
+ /**
3064
+ * Begins dispatching messages received on the port.
3065
+ *
3066
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
3067
+ */
3068
+ start(): void;
3069
+ get onmessage(): any | null;
3070
+ set onmessage(value: any | null);
3071
+ }
3072
+ interface MessagePortPostMessageOptions {
3073
+ transfer?: any[];
3074
+ }
3005
3075
  type AiImageClassificationInput = {
3006
3076
  image: number[];
3007
3077
  };