@cloudflare/workers-types 4.20221111.1 → 4.20230214.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/2021-11-03/index.d.ts +151 -18
- package/2021-11-03/index.ts +151 -21
- package/2022-01-31/index.d.ts +149 -18
- package/2022-01-31/index.ts +149 -21
- package/2022-03-21/index.d.ts +149 -18
- package/2022-03-21/index.ts +149 -21
- package/2022-08-04/index.d.ts +149 -18
- package/2022-08-04/index.ts +149 -21
- package/2022-10-31/index.d.ts +2916 -0
- package/2022-10-31/index.ts +2918 -0
- package/2022-11-30/index.d.ts +2919 -0
- package/2022-11-30/index.ts +2921 -0
- package/README.md +18 -8
- package/entrypoints.svg +53 -0
- package/experimental/index.d.ts +150 -18
- package/experimental/index.ts +150 -21
- package/index.d.ts +151 -18
- package/index.ts +151 -21
- package/oldest/index.d.ts +151 -18
- package/oldest/index.ts +151 -21
- package/package.json +1 -1
package/oldest/index.ts
CHANGED
|
@@ -227,7 +227,6 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
227
227
|
FixedLengthStream: typeof FixedLengthStream;
|
|
228
228
|
IdentityTransformStream: typeof IdentityTransformStream;
|
|
229
229
|
HTMLRewriter: typeof HTMLRewriter;
|
|
230
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
231
230
|
}
|
|
232
231
|
export declare function addEventListener<
|
|
233
232
|
Type extends keyof WorkerGlobalScopeEventMap
|
|
@@ -282,12 +281,8 @@ export declare const self: ServiceWorkerGlobalScope;
|
|
|
282
281
|
export declare const crypto: Crypto;
|
|
283
282
|
export declare const caches: CacheStorage;
|
|
284
283
|
export declare const scheduler: Scheduler;
|
|
285
|
-
export declare function connect(
|
|
286
|
-
address: string,
|
|
287
|
-
options?: SocketOptions
|
|
288
|
-
): Socket;
|
|
289
284
|
export interface ExecutionContext {
|
|
290
|
-
waitUntil(promise:
|
|
285
|
+
waitUntil(promise: Promise<any>): void;
|
|
291
286
|
passThroughOnException(): void;
|
|
292
287
|
}
|
|
293
288
|
export type ExportedHandlerFetchHandler<Env = unknown> = (
|
|
@@ -342,13 +337,20 @@ export interface DurableObjectNamespace {
|
|
|
342
337
|
): DurableObjectId;
|
|
343
338
|
idFromName(name: string): DurableObjectId;
|
|
344
339
|
idFromString(id: string): DurableObjectId;
|
|
345
|
-
get(
|
|
340
|
+
get(
|
|
341
|
+
id: DurableObjectId,
|
|
342
|
+
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
343
|
+
): DurableObjectStub;
|
|
344
|
+
jurisdiction(jurisdiction: string): DurableObjectNamespace;
|
|
346
345
|
}
|
|
347
346
|
export interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
348
347
|
jurisdiction?: string;
|
|
349
348
|
}
|
|
349
|
+
export interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
350
|
+
locationHint?: string;
|
|
351
|
+
}
|
|
350
352
|
export interface DurableObjectState {
|
|
351
|
-
waitUntil(promise:
|
|
353
|
+
waitUntil(promise: Promise<any>): void;
|
|
352
354
|
readonly id: DurableObjectId;
|
|
353
355
|
readonly storage: DurableObjectStorage;
|
|
354
356
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
@@ -550,7 +552,7 @@ export interface SchedulerWaitOptions {
|
|
|
550
552
|
signal?: AbortSignal;
|
|
551
553
|
}
|
|
552
554
|
export declare abstract class ExtendableEvent extends Event {
|
|
553
|
-
waitUntil(promise:
|
|
555
|
+
waitUntil(promise: Promise<any>): void;
|
|
554
556
|
}
|
|
555
557
|
export declare class Blob {
|
|
556
558
|
constructor(
|
|
@@ -1004,6 +1006,10 @@ export declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
1004
1006
|
/** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */
|
|
1005
1007
|
readonly signal: AbortSignal;
|
|
1006
1008
|
readonly cf?: IncomingRequestCfProperties<CfHostMetadata>;
|
|
1009
|
+
/** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] */
|
|
1010
|
+
readonly integrity: string;
|
|
1011
|
+
/** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
|
|
1012
|
+
readonly keepalive: boolean;
|
|
1007
1013
|
}
|
|
1008
1014
|
export interface RequestInit<
|
|
1009
1015
|
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
@@ -1018,6 +1024,8 @@ export interface RequestInit<
|
|
|
1018
1024
|
redirect?: string;
|
|
1019
1025
|
fetcher?: Fetcher | null;
|
|
1020
1026
|
cf?: CfType;
|
|
1027
|
+
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1028
|
+
integrity?: string;
|
|
1021
1029
|
/** An AbortSignal to set request's signal. */
|
|
1022
1030
|
signal?: AbortSignal | null;
|
|
1023
1031
|
}
|
|
@@ -1026,7 +1034,6 @@ export declare abstract class Fetcher {
|
|
|
1026
1034
|
input: RequestInfo,
|
|
1027
1035
|
init?: RequestInit<RequestInitCfProperties>
|
|
1028
1036
|
): Promise<Response>;
|
|
1029
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
1030
1037
|
}
|
|
1031
1038
|
export interface FetcherPutOptions {
|
|
1032
1039
|
expiration?: number;
|
|
@@ -1070,11 +1077,11 @@ export interface KVNamespace<Key extends string = string> {
|
|
|
1070
1077
|
get(
|
|
1071
1078
|
key: Key,
|
|
1072
1079
|
options?: KVNamespaceGetOptions<"arrayBuffer">
|
|
1073
|
-
): Promise<
|
|
1080
|
+
): Promise<ArrayBuffer | null>;
|
|
1074
1081
|
get(
|
|
1075
1082
|
key: Key,
|
|
1076
1083
|
options?: KVNamespaceGetOptions<"stream">
|
|
1077
|
-
): Promise<
|
|
1084
|
+
): Promise<ReadableStream | null>;
|
|
1078
1085
|
list<Metadata = unknown>(
|
|
1079
1086
|
options?: KVNamespaceListOptions
|
|
1080
1087
|
): Promise<KVNamespaceListResult<Metadata, Key>>;
|
|
@@ -1173,6 +1180,19 @@ export declare abstract class R2Bucket {
|
|
|
1173
1180
|
| Blob,
|
|
1174
1181
|
options?: R2PutOptions
|
|
1175
1182
|
): Promise<R2Object>;
|
|
1183
|
+
put(
|
|
1184
|
+
key: string,
|
|
1185
|
+
value:
|
|
1186
|
+
| ReadableStream
|
|
1187
|
+
| ArrayBuffer
|
|
1188
|
+
| ArrayBufferView
|
|
1189
|
+
| string
|
|
1190
|
+
| null
|
|
1191
|
+
| Blob,
|
|
1192
|
+
options?: R2PutOptions & {
|
|
1193
|
+
onlyIf: R2Conditional | Headers;
|
|
1194
|
+
}
|
|
1195
|
+
): Promise<R2Object | null>;
|
|
1176
1196
|
createMultipartUpload(
|
|
1177
1197
|
key: string,
|
|
1178
1198
|
options?: R2MultipartOptions
|
|
@@ -1559,6 +1579,8 @@ export interface TraceItem {
|
|
|
1559
1579
|
| TraceItemFetchEventInfo
|
|
1560
1580
|
| TraceItemScheduledEventInfo
|
|
1561
1581
|
| TraceItemAlarmEventInfo
|
|
1582
|
+
| TraceItemQueueEventInfo
|
|
1583
|
+
| TraceItemEmailEventInfo
|
|
1562
1584
|
| TraceItemCustomEventInfo
|
|
1563
1585
|
)
|
|
1564
1586
|
| null;
|
|
@@ -1567,6 +1589,7 @@ export interface TraceItem {
|
|
|
1567
1589
|
readonly exceptions: TraceException[];
|
|
1568
1590
|
readonly scriptName: string | null;
|
|
1569
1591
|
readonly dispatchNamespace?: string;
|
|
1592
|
+
readonly scriptTags?: string[];
|
|
1570
1593
|
readonly outcome: string;
|
|
1571
1594
|
}
|
|
1572
1595
|
export interface TraceItemAlarmEventInfo {
|
|
@@ -1577,6 +1600,15 @@ export interface TraceItemScheduledEventInfo {
|
|
|
1577
1600
|
readonly scheduledTime: number;
|
|
1578
1601
|
readonly cron: string;
|
|
1579
1602
|
}
|
|
1603
|
+
export interface TraceItemQueueEventInfo {
|
|
1604
|
+
readonly queue: string;
|
|
1605
|
+
readonly batchSize: number;
|
|
1606
|
+
}
|
|
1607
|
+
export interface TraceItemEmailEventInfo {
|
|
1608
|
+
readonly mailFrom: string;
|
|
1609
|
+
readonly rcptTo: string;
|
|
1610
|
+
readonly rawSize: number;
|
|
1611
|
+
}
|
|
1580
1612
|
export interface TraceItemFetchEventInfo {
|
|
1581
1613
|
readonly response?: TraceItemFetchEventInfoResponse;
|
|
1582
1614
|
readonly request: TraceItemFetchEventInfoRequest;
|
|
@@ -1756,15 +1788,6 @@ export declare const WebSocketPair: {
|
|
|
1756
1788
|
1: WebSocket;
|
|
1757
1789
|
};
|
|
1758
1790
|
};
|
|
1759
|
-
export interface Socket {
|
|
1760
|
-
readonly readable: ReadableStream;
|
|
1761
|
-
readonly writable: WritableStream;
|
|
1762
|
-
readonly closed: Promise<void>;
|
|
1763
|
-
close(): Promise<void>;
|
|
1764
|
-
}
|
|
1765
|
-
export interface SocketOptions {
|
|
1766
|
-
tsl: boolean;
|
|
1767
|
-
}
|
|
1768
1791
|
export interface BasicImageTransformations {
|
|
1769
1792
|
/**
|
|
1770
1793
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2709,6 +2732,52 @@ export declare abstract class D1PreparedStatement {
|
|
|
2709
2732
|
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2710
2733
|
raw<T = unknown>(): Promise<T[]>;
|
|
2711
2734
|
}
|
|
2735
|
+
/**
|
|
2736
|
+
* A email message that is sent to a consumer Worker.
|
|
2737
|
+
*/
|
|
2738
|
+
export interface EmailMessage<Body = unknown> {
|
|
2739
|
+
/**
|
|
2740
|
+
* Envelope From attribute of the email message.
|
|
2741
|
+
*/
|
|
2742
|
+
readonly from: string;
|
|
2743
|
+
/**
|
|
2744
|
+
* Envelope To attribute of the email message.
|
|
2745
|
+
*/
|
|
2746
|
+
readonly to: string;
|
|
2747
|
+
/**
|
|
2748
|
+
* A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2749
|
+
*/
|
|
2750
|
+
readonly headers: Headers;
|
|
2751
|
+
/**
|
|
2752
|
+
* Stream of the email message content.
|
|
2753
|
+
*/
|
|
2754
|
+
readonly raw: ReadableStream;
|
|
2755
|
+
/**
|
|
2756
|
+
* Size of the email message content.
|
|
2757
|
+
*/
|
|
2758
|
+
readonly rawSize: number;
|
|
2759
|
+
/**
|
|
2760
|
+
* Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
|
|
2761
|
+
* @param reason The reject reason.
|
|
2762
|
+
* @returns void
|
|
2763
|
+
*/
|
|
2764
|
+
setReject(reason: string): void;
|
|
2765
|
+
/**
|
|
2766
|
+
* Forward this email message to a verified destination address of the account.
|
|
2767
|
+
* @param rcptTo Verified destination address.
|
|
2768
|
+
* @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2769
|
+
* @returns A promise that resolves when the email message is forwarded.
|
|
2770
|
+
*/
|
|
2771
|
+
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2772
|
+
}
|
|
2773
|
+
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
2774
|
+
readonly message: EmailMessage;
|
|
2775
|
+
}
|
|
2776
|
+
export type EmailExportedHandler<Env = unknown> = (
|
|
2777
|
+
message: EmailMessage,
|
|
2778
|
+
env: Env,
|
|
2779
|
+
ctx: ExecutionContext
|
|
2780
|
+
) => void | Promise<void>;
|
|
2712
2781
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2713
2782
|
export type EventContext<Env, P extends string, Data> = {
|
|
2714
2783
|
request: Request;
|
|
@@ -2752,6 +2821,40 @@ export type PagesPluginFunction<
|
|
|
2752
2821
|
> = (
|
|
2753
2822
|
context: EventPluginContext<Env, Params, Data, PluginArgs>
|
|
2754
2823
|
) => Response | Promise<Response>;
|
|
2824
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
2825
|
+
// PubSubMessage represents an incoming PubSub message.
|
|
2826
|
+
// The message includes metadata about the broker, the client, and the payload
|
|
2827
|
+
// itself.
|
|
2828
|
+
export interface PubSubMessage {
|
|
2829
|
+
// Message ID
|
|
2830
|
+
readonly mid: number;
|
|
2831
|
+
// MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
|
|
2832
|
+
readonly broker: string;
|
|
2833
|
+
// The MQTT topic the message was sent on.
|
|
2834
|
+
readonly topic: string;
|
|
2835
|
+
// The client ID of the client that published this message.
|
|
2836
|
+
readonly clientId: string;
|
|
2837
|
+
// The unique identifier (JWT ID) used by the client to authenticate, if token
|
|
2838
|
+
// auth was used.
|
|
2839
|
+
readonly jti?: string;
|
|
2840
|
+
// A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
|
|
2841
|
+
// received the message from the client.
|
|
2842
|
+
readonly receivedAt: number;
|
|
2843
|
+
// An (optional) string with the MIME type of the payload, if set by the
|
|
2844
|
+
// client.
|
|
2845
|
+
readonly contentType: string;
|
|
2846
|
+
// Set to 1 when the payload is a UTF-8 string
|
|
2847
|
+
// https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
|
|
2848
|
+
readonly payloadFormatIndicator: number;
|
|
2849
|
+
// Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
|
|
2850
|
+
// You can use payloadFormatIndicator to inspect this before decoding.
|
|
2851
|
+
payload: string | Uint8Array;
|
|
2852
|
+
}
|
|
2853
|
+
// JsonWebKey extended by kid parameter
|
|
2854
|
+
export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
2855
|
+
// Key Identifier of the JWK
|
|
2856
|
+
readonly kid: string;
|
|
2857
|
+
}
|
|
2755
2858
|
/**
|
|
2756
2859
|
* A message that is sent to a consumer Worker.
|
|
2757
2860
|
*/
|
|
@@ -2768,6 +2871,14 @@ export interface Message<Body = unknown> {
|
|
|
2768
2871
|
* The body of the message.
|
|
2769
2872
|
*/
|
|
2770
2873
|
readonly body: Body;
|
|
2874
|
+
/**
|
|
2875
|
+
* Marks message to be retried.
|
|
2876
|
+
*/
|
|
2877
|
+
retry(): void;
|
|
2878
|
+
/**
|
|
2879
|
+
* Marks message acknowledged.
|
|
2880
|
+
*/
|
|
2881
|
+
ack(): void;
|
|
2771
2882
|
}
|
|
2772
2883
|
/**
|
|
2773
2884
|
* A batch of messages that are sent to a consumer Worker.
|
|
@@ -2785,7 +2896,20 @@ export interface MessageBatch<Body = unknown> {
|
|
|
2785
2896
|
* Marks every message to be retried in the next batch.
|
|
2786
2897
|
*/
|
|
2787
2898
|
retryAll(): void;
|
|
2899
|
+
/**
|
|
2900
|
+
* Marks every message acknowledged in the batch.
|
|
2901
|
+
*/
|
|
2902
|
+
ackAll(): void;
|
|
2788
2903
|
}
|
|
2904
|
+
/**
|
|
2905
|
+
* A wrapper class used to structure message batches.
|
|
2906
|
+
*/
|
|
2907
|
+
export type MessageSendRequest<Body = unknown> = {
|
|
2908
|
+
/**
|
|
2909
|
+
* The body of the message.
|
|
2910
|
+
*/
|
|
2911
|
+
body: Body;
|
|
2912
|
+
};
|
|
2789
2913
|
/**
|
|
2790
2914
|
* A binding that allows a producer to send messages to a Queue.
|
|
2791
2915
|
*/
|
|
@@ -2796,4 +2920,10 @@ export interface Queue<Body = any> {
|
|
|
2796
2920
|
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2797
2921
|
*/
|
|
2798
2922
|
send(message: Body): Promise<void>;
|
|
2923
|
+
/**
|
|
2924
|
+
* Sends a batch of messages to the Queue.
|
|
2925
|
+
* @param messages Each item in the input must be supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types). A batch can contain up to 100 messages, though items are limited to 128 KB each, and the total size of the array cannot exceed 256 KB.
|
|
2926
|
+
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2927
|
+
*/
|
|
2928
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2799
2929
|
}
|
package/package.json
CHANGED