@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/2021-11-03/index.d.ts
CHANGED
|
@@ -227,7 +227,6 @@ declare 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
|
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
|
|
233
232
|
type: Type,
|
|
@@ -280,9 +279,8 @@ declare const self: ServiceWorkerGlobalScope;
|
|
|
280
279
|
declare const crypto: Crypto;
|
|
281
280
|
declare const caches: CacheStorage;
|
|
282
281
|
declare const scheduler: Scheduler;
|
|
283
|
-
declare function connect(address: string, options?: SocketOptions): Socket;
|
|
284
282
|
declare interface ExecutionContext {
|
|
285
|
-
waitUntil(promise:
|
|
283
|
+
waitUntil(promise: Promise<any>): void;
|
|
286
284
|
passThroughOnException(): void;
|
|
287
285
|
}
|
|
288
286
|
declare type ExportedHandlerFetchHandler<Env = unknown> = (
|
|
@@ -337,13 +335,20 @@ declare interface DurableObjectNamespace {
|
|
|
337
335
|
): DurableObjectId;
|
|
338
336
|
idFromName(name: string): DurableObjectId;
|
|
339
337
|
idFromString(id: string): DurableObjectId;
|
|
340
|
-
get(
|
|
338
|
+
get(
|
|
339
|
+
id: DurableObjectId,
|
|
340
|
+
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
341
|
+
): DurableObjectStub;
|
|
342
|
+
jurisdiction(jurisdiction: string): DurableObjectNamespace;
|
|
341
343
|
}
|
|
342
344
|
declare interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
343
345
|
jurisdiction?: string;
|
|
344
346
|
}
|
|
347
|
+
declare interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
348
|
+
locationHint?: string;
|
|
349
|
+
}
|
|
345
350
|
declare interface DurableObjectState {
|
|
346
|
-
waitUntil(promise:
|
|
351
|
+
waitUntil(promise: Promise<any>): void;
|
|
347
352
|
readonly id: DurableObjectId;
|
|
348
353
|
readonly storage: DurableObjectStorage;
|
|
349
354
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
@@ -545,7 +550,7 @@ declare interface SchedulerWaitOptions {
|
|
|
545
550
|
signal?: AbortSignal;
|
|
546
551
|
}
|
|
547
552
|
declare abstract class ExtendableEvent extends Event {
|
|
548
|
-
waitUntil(promise:
|
|
553
|
+
waitUntil(promise: Promise<any>): void;
|
|
549
554
|
}
|
|
550
555
|
declare class Blob {
|
|
551
556
|
constructor(
|
|
@@ -999,6 +1004,10 @@ declare class Request<CfHostMetadata = unknown> extends Body {
|
|
|
999
1004
|
/** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. */
|
|
1000
1005
|
readonly signal: AbortSignal;
|
|
1001
1006
|
readonly cf?: IncomingRequestCfProperties<CfHostMetadata>;
|
|
1007
|
+
/** 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] */
|
|
1008
|
+
readonly integrity: string;
|
|
1009
|
+
/** Returns a boolean indicating whether or not request can outlive the global in which it was created. */
|
|
1010
|
+
readonly keepalive: boolean;
|
|
1002
1011
|
}
|
|
1003
1012
|
declare interface RequestInit<
|
|
1004
1013
|
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
@@ -1013,6 +1022,8 @@ declare interface RequestInit<
|
|
|
1013
1022
|
redirect?: string;
|
|
1014
1023
|
fetcher?: Fetcher | null;
|
|
1015
1024
|
cf?: CfType;
|
|
1025
|
+
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1026
|
+
integrity?: string;
|
|
1016
1027
|
/** An AbortSignal to set request's signal. */
|
|
1017
1028
|
signal?: AbortSignal | null;
|
|
1018
1029
|
}
|
|
@@ -1021,7 +1032,6 @@ declare abstract class Fetcher {
|
|
|
1021
1032
|
input: RequestInfo,
|
|
1022
1033
|
init?: RequestInit<RequestInitCfProperties>
|
|
1023
1034
|
): Promise<Response>;
|
|
1024
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
1025
1035
|
}
|
|
1026
1036
|
declare interface FetcherPutOptions {
|
|
1027
1037
|
expiration?: number;
|
|
@@ -1065,11 +1075,11 @@ declare interface KVNamespace<Key extends string = string> {
|
|
|
1065
1075
|
get(
|
|
1066
1076
|
key: Key,
|
|
1067
1077
|
options?: KVNamespaceGetOptions<"arrayBuffer">
|
|
1068
|
-
): Promise<
|
|
1078
|
+
): Promise<ArrayBuffer | null>;
|
|
1069
1079
|
get(
|
|
1070
1080
|
key: Key,
|
|
1071
1081
|
options?: KVNamespaceGetOptions<"stream">
|
|
1072
|
-
): Promise<
|
|
1082
|
+
): Promise<ReadableStream | null>;
|
|
1073
1083
|
list<Metadata = unknown>(
|
|
1074
1084
|
options?: KVNamespaceListOptions
|
|
1075
1085
|
): Promise<KVNamespaceListResult<Metadata, Key>>;
|
|
@@ -1168,6 +1178,19 @@ declare abstract class R2Bucket {
|
|
|
1168
1178
|
| Blob,
|
|
1169
1179
|
options?: R2PutOptions
|
|
1170
1180
|
): Promise<R2Object>;
|
|
1181
|
+
put(
|
|
1182
|
+
key: string,
|
|
1183
|
+
value:
|
|
1184
|
+
| ReadableStream
|
|
1185
|
+
| ArrayBuffer
|
|
1186
|
+
| ArrayBufferView
|
|
1187
|
+
| string
|
|
1188
|
+
| null
|
|
1189
|
+
| Blob,
|
|
1190
|
+
options?: R2PutOptions & {
|
|
1191
|
+
onlyIf: R2Conditional | Headers;
|
|
1192
|
+
}
|
|
1193
|
+
): Promise<R2Object | null>;
|
|
1171
1194
|
createMultipartUpload(
|
|
1172
1195
|
key: string,
|
|
1173
1196
|
options?: R2MultipartOptions
|
|
@@ -1551,6 +1574,8 @@ declare interface TraceItem {
|
|
|
1551
1574
|
| TraceItemFetchEventInfo
|
|
1552
1575
|
| TraceItemScheduledEventInfo
|
|
1553
1576
|
| TraceItemAlarmEventInfo
|
|
1577
|
+
| TraceItemQueueEventInfo
|
|
1578
|
+
| TraceItemEmailEventInfo
|
|
1554
1579
|
| TraceItemCustomEventInfo
|
|
1555
1580
|
)
|
|
1556
1581
|
| null;
|
|
@@ -1559,6 +1584,7 @@ declare interface TraceItem {
|
|
|
1559
1584
|
readonly exceptions: TraceException[];
|
|
1560
1585
|
readonly scriptName: string | null;
|
|
1561
1586
|
readonly dispatchNamespace?: string;
|
|
1587
|
+
readonly scriptTags?: string[];
|
|
1562
1588
|
readonly outcome: string;
|
|
1563
1589
|
}
|
|
1564
1590
|
declare interface TraceItemAlarmEventInfo {
|
|
@@ -1569,6 +1595,15 @@ declare interface TraceItemScheduledEventInfo {
|
|
|
1569
1595
|
readonly scheduledTime: number;
|
|
1570
1596
|
readonly cron: string;
|
|
1571
1597
|
}
|
|
1598
|
+
declare interface TraceItemQueueEventInfo {
|
|
1599
|
+
readonly queue: string;
|
|
1600
|
+
readonly batchSize: number;
|
|
1601
|
+
}
|
|
1602
|
+
declare interface TraceItemEmailEventInfo {
|
|
1603
|
+
readonly mailFrom: string;
|
|
1604
|
+
readonly rcptTo: string;
|
|
1605
|
+
readonly rawSize: number;
|
|
1606
|
+
}
|
|
1572
1607
|
declare interface TraceItemFetchEventInfo {
|
|
1573
1608
|
readonly response?: TraceItemFetchEventInfoResponse;
|
|
1574
1609
|
readonly request: TraceItemFetchEventInfoRequest;
|
|
@@ -1748,15 +1783,6 @@ declare const WebSocketPair: {
|
|
|
1748
1783
|
1: WebSocket;
|
|
1749
1784
|
};
|
|
1750
1785
|
};
|
|
1751
|
-
declare interface Socket {
|
|
1752
|
-
readonly readable: ReadableStream;
|
|
1753
|
-
readonly writable: WritableStream;
|
|
1754
|
-
readonly closed: Promise<void>;
|
|
1755
|
-
close(): Promise<void>;
|
|
1756
|
-
}
|
|
1757
|
-
declare interface SocketOptions {
|
|
1758
|
-
tsl: boolean;
|
|
1759
|
-
}
|
|
1760
1786
|
declare interface BasicImageTransformations {
|
|
1761
1787
|
/**
|
|
1762
1788
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2701,6 +2727,52 @@ declare abstract class D1PreparedStatement {
|
|
|
2701
2727
|
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2702
2728
|
raw<T = unknown>(): Promise<T[]>;
|
|
2703
2729
|
}
|
|
2730
|
+
/**
|
|
2731
|
+
* A email message that is sent to a consumer Worker.
|
|
2732
|
+
*/
|
|
2733
|
+
declare interface EmailMessage<Body = unknown> {
|
|
2734
|
+
/**
|
|
2735
|
+
* Envelope From attribute of the email message.
|
|
2736
|
+
*/
|
|
2737
|
+
readonly from: string;
|
|
2738
|
+
/**
|
|
2739
|
+
* Envelope To attribute of the email message.
|
|
2740
|
+
*/
|
|
2741
|
+
readonly to: string;
|
|
2742
|
+
/**
|
|
2743
|
+
* A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2744
|
+
*/
|
|
2745
|
+
readonly headers: Headers;
|
|
2746
|
+
/**
|
|
2747
|
+
* Stream of the email message content.
|
|
2748
|
+
*/
|
|
2749
|
+
readonly raw: ReadableStream;
|
|
2750
|
+
/**
|
|
2751
|
+
* Size of the email message content.
|
|
2752
|
+
*/
|
|
2753
|
+
readonly rawSize: number;
|
|
2754
|
+
/**
|
|
2755
|
+
* Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
|
|
2756
|
+
* @param reason The reject reason.
|
|
2757
|
+
* @returns void
|
|
2758
|
+
*/
|
|
2759
|
+
setReject(reason: string): void;
|
|
2760
|
+
/**
|
|
2761
|
+
* Forward this email message to a verified destination address of the account.
|
|
2762
|
+
* @param rcptTo Verified destination address.
|
|
2763
|
+
* @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2764
|
+
* @returns A promise that resolves when the email message is forwarded.
|
|
2765
|
+
*/
|
|
2766
|
+
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2767
|
+
}
|
|
2768
|
+
declare abstract class EmailEvent extends ExtendableEvent {
|
|
2769
|
+
readonly message: EmailMessage;
|
|
2770
|
+
}
|
|
2771
|
+
declare type EmailExportedHandler<Env = unknown> = (
|
|
2772
|
+
message: EmailMessage,
|
|
2773
|
+
env: Env,
|
|
2774
|
+
ctx: ExecutionContext
|
|
2775
|
+
) => void | Promise<void>;
|
|
2704
2776
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2705
2777
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2706
2778
|
request: Request;
|
|
@@ -2747,6 +2819,40 @@ declare type PagesPluginFunction<
|
|
|
2747
2819
|
declare module "assets:*" {
|
|
2748
2820
|
export const onRequest: PagesFunction;
|
|
2749
2821
|
}
|
|
2822
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
2823
|
+
// PubSubMessage represents an incoming PubSub message.
|
|
2824
|
+
// The message includes metadata about the broker, the client, and the payload
|
|
2825
|
+
// itself.
|
|
2826
|
+
declare interface PubSubMessage {
|
|
2827
|
+
// Message ID
|
|
2828
|
+
readonly mid: number;
|
|
2829
|
+
// MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
|
|
2830
|
+
readonly broker: string;
|
|
2831
|
+
// The MQTT topic the message was sent on.
|
|
2832
|
+
readonly topic: string;
|
|
2833
|
+
// The client ID of the client that published this message.
|
|
2834
|
+
readonly clientId: string;
|
|
2835
|
+
// The unique identifier (JWT ID) used by the client to authenticate, if token
|
|
2836
|
+
// auth was used.
|
|
2837
|
+
readonly jti?: string;
|
|
2838
|
+
// A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
|
|
2839
|
+
// received the message from the client.
|
|
2840
|
+
readonly receivedAt: number;
|
|
2841
|
+
// An (optional) string with the MIME type of the payload, if set by the
|
|
2842
|
+
// client.
|
|
2843
|
+
readonly contentType: string;
|
|
2844
|
+
// Set to 1 when the payload is a UTF-8 string
|
|
2845
|
+
// https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
|
|
2846
|
+
readonly payloadFormatIndicator: number;
|
|
2847
|
+
// Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
|
|
2848
|
+
// You can use payloadFormatIndicator to inspect this before decoding.
|
|
2849
|
+
payload: string | Uint8Array;
|
|
2850
|
+
}
|
|
2851
|
+
// JsonWebKey extended by kid parameter
|
|
2852
|
+
declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
2853
|
+
// Key Identifier of the JWK
|
|
2854
|
+
readonly kid: string;
|
|
2855
|
+
}
|
|
2750
2856
|
/**
|
|
2751
2857
|
* A message that is sent to a consumer Worker.
|
|
2752
2858
|
*/
|
|
@@ -2763,6 +2869,14 @@ declare interface Message<Body = unknown> {
|
|
|
2763
2869
|
* The body of the message.
|
|
2764
2870
|
*/
|
|
2765
2871
|
readonly body: Body;
|
|
2872
|
+
/**
|
|
2873
|
+
* Marks message to be retried.
|
|
2874
|
+
*/
|
|
2875
|
+
retry(): void;
|
|
2876
|
+
/**
|
|
2877
|
+
* Marks message acknowledged.
|
|
2878
|
+
*/
|
|
2879
|
+
ack(): void;
|
|
2766
2880
|
}
|
|
2767
2881
|
/**
|
|
2768
2882
|
* A batch of messages that are sent to a consumer Worker.
|
|
@@ -2780,7 +2894,20 @@ declare interface MessageBatch<Body = unknown> {
|
|
|
2780
2894
|
* Marks every message to be retried in the next batch.
|
|
2781
2895
|
*/
|
|
2782
2896
|
retryAll(): void;
|
|
2897
|
+
/**
|
|
2898
|
+
* Marks every message acknowledged in the batch.
|
|
2899
|
+
*/
|
|
2900
|
+
ackAll(): void;
|
|
2783
2901
|
}
|
|
2902
|
+
/**
|
|
2903
|
+
* A wrapper class used to structure message batches.
|
|
2904
|
+
*/
|
|
2905
|
+
declare type MessageSendRequest<Body = unknown> = {
|
|
2906
|
+
/**
|
|
2907
|
+
* The body of the message.
|
|
2908
|
+
*/
|
|
2909
|
+
body: Body;
|
|
2910
|
+
};
|
|
2784
2911
|
/**
|
|
2785
2912
|
* A binding that allows a producer to send messages to a Queue.
|
|
2786
2913
|
*/
|
|
@@ -2791,4 +2918,10 @@ declare interface Queue<Body = any> {
|
|
|
2791
2918
|
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2792
2919
|
*/
|
|
2793
2920
|
send(message: Body): Promise<void>;
|
|
2921
|
+
/**
|
|
2922
|
+
* Sends a batch of messages to the Queue.
|
|
2923
|
+
* @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.
|
|
2924
|
+
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2925
|
+
*/
|
|
2926
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2794
2927
|
}
|
package/2021-11-03/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
|
}
|