@workers-community/workers-types 4.20250724.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.
- package/index.d.ts +89 -19
- package/index.ts +88 -19
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1366,6 +1366,47 @@ interface ErrorEventErrorEventInit {
|
|
|
1366
1366
|
colno?: number;
|
|
1367
1367
|
error?: any;
|
|
1368
1368
|
}
|
|
1369
|
+
/**
|
|
1370
|
+
* A message received by a target object.
|
|
1371
|
+
*
|
|
1372
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
|
|
1373
|
+
*/
|
|
1374
|
+
declare class MessageEvent extends Event {
|
|
1375
|
+
constructor(type: string, initializer: MessageEventInit);
|
|
1376
|
+
/**
|
|
1377
|
+
* Returns the data of the message.
|
|
1378
|
+
*
|
|
1379
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
|
|
1380
|
+
*/
|
|
1381
|
+
readonly data: any;
|
|
1382
|
+
/**
|
|
1383
|
+
* Returns the origin of the message, for server-sent events and cross-document messaging.
|
|
1384
|
+
*
|
|
1385
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)
|
|
1386
|
+
*/
|
|
1387
|
+
readonly origin: string | null;
|
|
1388
|
+
/**
|
|
1389
|
+
* Returns the last event ID string, for server-sent events.
|
|
1390
|
+
*
|
|
1391
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)
|
|
1392
|
+
*/
|
|
1393
|
+
readonly lastEventId: string;
|
|
1394
|
+
/**
|
|
1395
|
+
* Returns the WindowProxy of the source window, for cross-document messaging, and the MessagePort being attached, in the connect event fired at SharedWorkerGlobalScope objects.
|
|
1396
|
+
*
|
|
1397
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)
|
|
1398
|
+
*/
|
|
1399
|
+
readonly source: MessagePort | null;
|
|
1400
|
+
/**
|
|
1401
|
+
* Returns the MessagePort array sent with the message, for cross-document messaging and channel messaging.
|
|
1402
|
+
*
|
|
1403
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)
|
|
1404
|
+
*/
|
|
1405
|
+
readonly ports: MessagePort[];
|
|
1406
|
+
}
|
|
1407
|
+
interface MessageEventInit {
|
|
1408
|
+
data: ArrayBuffer | string;
|
|
1409
|
+
}
|
|
1369
1410
|
/**
|
|
1370
1411
|
* 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".
|
|
1371
1412
|
*
|
|
@@ -1717,8 +1758,19 @@ interface RequestInit<Cf = CfProperties> {
|
|
|
1717
1758
|
signal?: AbortSignal | null;
|
|
1718
1759
|
encodeResponseBody?: "automatic" | "manual";
|
|
1719
1760
|
}
|
|
1720
|
-
type Service<
|
|
1721
|
-
|
|
1761
|
+
type Service<
|
|
1762
|
+
T extends
|
|
1763
|
+
| (new (...args: any[]) => Rpc.WorkerEntrypointBranded)
|
|
1764
|
+
| Rpc.WorkerEntrypointBranded
|
|
1765
|
+
| ExportedHandler<any, any, any>
|
|
1766
|
+
| undefined = undefined,
|
|
1767
|
+
> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded
|
|
1768
|
+
? Fetcher<InstanceType<T>>
|
|
1769
|
+
: T extends Rpc.WorkerEntrypointBranded
|
|
1770
|
+
? Fetcher<T>
|
|
1771
|
+
: T extends Exclude<Rpc.EntrypointBranded, Rpc.WorkerEntrypointBranded>
|
|
1772
|
+
? never
|
|
1773
|
+
: Fetcher<undefined>;
|
|
1722
1774
|
type Fetcher<
|
|
1723
1775
|
T extends Rpc.EntrypointBranded | undefined = undefined,
|
|
1724
1776
|
Reserved extends string = never,
|
|
@@ -2804,23 +2856,6 @@ interface CloseEventInit {
|
|
|
2804
2856
|
reason?: string;
|
|
2805
2857
|
wasClean?: boolean;
|
|
2806
2858
|
}
|
|
2807
|
-
/**
|
|
2808
|
-
* A message received by a target object.
|
|
2809
|
-
*
|
|
2810
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
|
|
2811
|
-
*/
|
|
2812
|
-
declare class MessageEvent extends Event {
|
|
2813
|
-
constructor(type: string, initializer: MessageEventInit);
|
|
2814
|
-
/**
|
|
2815
|
-
* Returns the data of the message.
|
|
2816
|
-
*
|
|
2817
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
|
|
2818
|
-
*/
|
|
2819
|
-
readonly data: ArrayBuffer | string;
|
|
2820
|
-
}
|
|
2821
|
-
interface MessageEventInit {
|
|
2822
|
-
data: ArrayBuffer | string;
|
|
2823
|
-
}
|
|
2824
2859
|
type WebSocketEventMap = {
|
|
2825
2860
|
close: CloseEvent;
|
|
2826
2861
|
message: MessageEvent;
|
|
@@ -3014,6 +3049,41 @@ interface ContainerStartupOptions {
|
|
|
3014
3049
|
enableInternet: boolean;
|
|
3015
3050
|
env?: Record<string, string>;
|
|
3016
3051
|
}
|
|
3052
|
+
/**
|
|
3053
|
+
* 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.
|
|
3054
|
+
*
|
|
3055
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
|
|
3056
|
+
*/
|
|
3057
|
+
interface MessagePort extends EventTarget {
|
|
3058
|
+
/**
|
|
3059
|
+
* 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.
|
|
3060
|
+
*
|
|
3061
|
+
* Throws a "DataCloneError" DOMException if transfer contains duplicate objects or port, or if message could not be cloned.
|
|
3062
|
+
*
|
|
3063
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
|
|
3064
|
+
*/
|
|
3065
|
+
postMessage(
|
|
3066
|
+
data?: any,
|
|
3067
|
+
options?: any[] | MessagePortPostMessageOptions,
|
|
3068
|
+
): void;
|
|
3069
|
+
/**
|
|
3070
|
+
* Disconnects the port, so that it is no longer active.
|
|
3071
|
+
*
|
|
3072
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
|
|
3073
|
+
*/
|
|
3074
|
+
close(): void;
|
|
3075
|
+
/**
|
|
3076
|
+
* Begins dispatching messages received on the port.
|
|
3077
|
+
*
|
|
3078
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
|
|
3079
|
+
*/
|
|
3080
|
+
start(): void;
|
|
3081
|
+
get onmessage(): any | null;
|
|
3082
|
+
set onmessage(value: any | null);
|
|
3083
|
+
}
|
|
3084
|
+
interface MessagePortPostMessageOptions {
|
|
3085
|
+
transfer?: any[];
|
|
3086
|
+
}
|
|
3017
3087
|
type AiImageClassificationInput = {
|
|
3018
3088
|
image: number[];
|
|
3019
3089
|
};
|
package/index.ts
CHANGED
|
@@ -1371,6 +1371,47 @@ export interface ErrorEventErrorEventInit {
|
|
|
1371
1371
|
colno?: number;
|
|
1372
1372
|
error?: any;
|
|
1373
1373
|
}
|
|
1374
|
+
/**
|
|
1375
|
+
* A message received by a target object.
|
|
1376
|
+
*
|
|
1377
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
|
|
1378
|
+
*/
|
|
1379
|
+
export declare class MessageEvent extends Event {
|
|
1380
|
+
constructor(type: string, initializer: MessageEventInit);
|
|
1381
|
+
/**
|
|
1382
|
+
* Returns the data of the message.
|
|
1383
|
+
*
|
|
1384
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
|
|
1385
|
+
*/
|
|
1386
|
+
readonly data: any;
|
|
1387
|
+
/**
|
|
1388
|
+
* Returns the origin of the message, for server-sent events and cross-document messaging.
|
|
1389
|
+
*
|
|
1390
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)
|
|
1391
|
+
*/
|
|
1392
|
+
readonly origin: string | null;
|
|
1393
|
+
/**
|
|
1394
|
+
* Returns the last event ID string, for server-sent events.
|
|
1395
|
+
*
|
|
1396
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)
|
|
1397
|
+
*/
|
|
1398
|
+
readonly lastEventId: string;
|
|
1399
|
+
/**
|
|
1400
|
+
* Returns the WindowProxy of the source window, for cross-document messaging, and the MessagePort being attached, in the connect event fired at SharedWorkerGlobalScope objects.
|
|
1401
|
+
*
|
|
1402
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)
|
|
1403
|
+
*/
|
|
1404
|
+
readonly source: MessagePort | null;
|
|
1405
|
+
/**
|
|
1406
|
+
* Returns the MessagePort array sent with the message, for cross-document messaging and channel messaging.
|
|
1407
|
+
*
|
|
1408
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)
|
|
1409
|
+
*/
|
|
1410
|
+
readonly ports: MessagePort[];
|
|
1411
|
+
}
|
|
1412
|
+
export interface MessageEventInit {
|
|
1413
|
+
data: ArrayBuffer | string;
|
|
1414
|
+
}
|
|
1374
1415
|
/**
|
|
1375
1416
|
* 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".
|
|
1376
1417
|
*
|
|
@@ -1726,8 +1767,18 @@ export interface RequestInit<Cf = CfProperties> {
|
|
|
1726
1767
|
encodeResponseBody?: "automatic" | "manual";
|
|
1727
1768
|
}
|
|
1728
1769
|
export type Service<
|
|
1729
|
-
T extends
|
|
1730
|
-
|
|
1770
|
+
T extends
|
|
1771
|
+
| (new (...args: any[]) => Rpc.WorkerEntrypointBranded)
|
|
1772
|
+
| Rpc.WorkerEntrypointBranded
|
|
1773
|
+
| ExportedHandler<any, any, any>
|
|
1774
|
+
| undefined = undefined,
|
|
1775
|
+
> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded
|
|
1776
|
+
? Fetcher<InstanceType<T>>
|
|
1777
|
+
: T extends Rpc.WorkerEntrypointBranded
|
|
1778
|
+
? Fetcher<T>
|
|
1779
|
+
: T extends Exclude<Rpc.EntrypointBranded, Rpc.WorkerEntrypointBranded>
|
|
1780
|
+
? never
|
|
1781
|
+
: Fetcher<undefined>;
|
|
1731
1782
|
export type Fetcher<
|
|
1732
1783
|
T extends Rpc.EntrypointBranded | undefined = undefined,
|
|
1733
1784
|
Reserved extends string = never,
|
|
@@ -2816,23 +2867,6 @@ export interface CloseEventInit {
|
|
|
2816
2867
|
reason?: string;
|
|
2817
2868
|
wasClean?: boolean;
|
|
2818
2869
|
}
|
|
2819
|
-
/**
|
|
2820
|
-
* A message received by a target object.
|
|
2821
|
-
*
|
|
2822
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)
|
|
2823
|
-
*/
|
|
2824
|
-
export declare class MessageEvent extends Event {
|
|
2825
|
-
constructor(type: string, initializer: MessageEventInit);
|
|
2826
|
-
/**
|
|
2827
|
-
* Returns the data of the message.
|
|
2828
|
-
*
|
|
2829
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)
|
|
2830
|
-
*/
|
|
2831
|
-
readonly data: ArrayBuffer | string;
|
|
2832
|
-
}
|
|
2833
|
-
export interface MessageEventInit {
|
|
2834
|
-
data: ArrayBuffer | string;
|
|
2835
|
-
}
|
|
2836
2870
|
export type WebSocketEventMap = {
|
|
2837
2871
|
close: CloseEvent;
|
|
2838
2872
|
message: MessageEvent;
|
|
@@ -3026,6 +3060,41 @@ export interface ContainerStartupOptions {
|
|
|
3026
3060
|
enableInternet: boolean;
|
|
3027
3061
|
env?: Record<string, string>;
|
|
3028
3062
|
}
|
|
3063
|
+
/**
|
|
3064
|
+
* 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.
|
|
3065
|
+
*
|
|
3066
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)
|
|
3067
|
+
*/
|
|
3068
|
+
export interface MessagePort extends EventTarget {
|
|
3069
|
+
/**
|
|
3070
|
+
* 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.
|
|
3071
|
+
*
|
|
3072
|
+
* Throws a "DataCloneError" DOMException if transfer contains duplicate objects or port, or if message could not be cloned.
|
|
3073
|
+
*
|
|
3074
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
|
|
3075
|
+
*/
|
|
3076
|
+
postMessage(
|
|
3077
|
+
data?: any,
|
|
3078
|
+
options?: any[] | MessagePortPostMessageOptions,
|
|
3079
|
+
): void;
|
|
3080
|
+
/**
|
|
3081
|
+
* Disconnects the port, so that it is no longer active.
|
|
3082
|
+
*
|
|
3083
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)
|
|
3084
|
+
*/
|
|
3085
|
+
close(): void;
|
|
3086
|
+
/**
|
|
3087
|
+
* Begins dispatching messages received on the port.
|
|
3088
|
+
*
|
|
3089
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)
|
|
3090
|
+
*/
|
|
3091
|
+
start(): void;
|
|
3092
|
+
get onmessage(): any | null;
|
|
3093
|
+
set onmessage(value: any | null);
|
|
3094
|
+
}
|
|
3095
|
+
export interface MessagePortPostMessageOptions {
|
|
3096
|
+
transfer?: any[];
|
|
3097
|
+
}
|
|
3029
3098
|
export type AiImageClassificationInput = {
|
|
3030
3099
|
image: number[];
|
|
3031
3100
|
};
|