@cloudflare/workers-types 0.20221111.0 → 0.20230115.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 +126 -7
- package/2021-11-03/index.ts +126 -7
- package/2022-01-31/index.d.ts +126 -7
- package/2022-01-31/index.ts +126 -7
- package/2022-03-21/index.d.ts +126 -7
- package/2022-03-21/index.ts +126 -7
- package/2022-08-04/index.d.ts +126 -7
- package/2022-08-04/index.ts +126 -7
- package/README.md +8 -7
- package/experimental/index.d.ts +126 -7
- package/experimental/index.ts +126 -7
- package/index.d.ts +126 -7
- package/index.ts +126 -7
- package/oldest/index.d.ts +126 -7
- package/oldest/index.ts +126 -7
- package/package.json +1 -1
package/2021-11-03/index.d.ts
CHANGED
|
@@ -280,7 +280,7 @@ declare const crypto: Crypto;
|
|
|
280
280
|
declare const caches: CacheStorage;
|
|
281
281
|
declare const scheduler: Scheduler;
|
|
282
282
|
declare interface ExecutionContext {
|
|
283
|
-
waitUntil(promise:
|
|
283
|
+
waitUntil(promise: Promise<any>): void;
|
|
284
284
|
passThroughOnException(): void;
|
|
285
285
|
}
|
|
286
286
|
declare type ExportedHandlerFetchHandler<Env = unknown> = (
|
|
@@ -335,13 +335,20 @@ declare interface DurableObjectNamespace {
|
|
|
335
335
|
): DurableObjectId;
|
|
336
336
|
idFromName(name: string): DurableObjectId;
|
|
337
337
|
idFromString(id: string): DurableObjectId;
|
|
338
|
-
get(
|
|
338
|
+
get(
|
|
339
|
+
id: DurableObjectId,
|
|
340
|
+
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
341
|
+
): DurableObjectStub;
|
|
342
|
+
jurisdiction(jurisdiction: string): DurableObjectNamespace;
|
|
339
343
|
}
|
|
340
344
|
declare interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
341
345
|
jurisdiction?: string;
|
|
342
346
|
}
|
|
347
|
+
declare interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
348
|
+
locationHint?: string;
|
|
349
|
+
}
|
|
343
350
|
declare interface DurableObjectState {
|
|
344
|
-
waitUntil(promise:
|
|
351
|
+
waitUntil(promise: Promise<any>): void;
|
|
345
352
|
readonly id: DurableObjectId;
|
|
346
353
|
readonly storage: DurableObjectStorage;
|
|
347
354
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
@@ -543,7 +550,7 @@ declare interface SchedulerWaitOptions {
|
|
|
543
550
|
signal?: AbortSignal;
|
|
544
551
|
}
|
|
545
552
|
declare abstract class ExtendableEvent extends Event {
|
|
546
|
-
waitUntil(promise:
|
|
553
|
+
waitUntil(promise: Promise<any>): void;
|
|
547
554
|
}
|
|
548
555
|
declare class Blob {
|
|
549
556
|
constructor(
|
|
@@ -982,9 +989,9 @@ declare interface ResponseInit {
|
|
|
982
989
|
encodeBody?: "automatic" | "manual";
|
|
983
990
|
}
|
|
984
991
|
declare type RequestInfo = Request | string | URL;
|
|
985
|
-
declare class Request extends Body {
|
|
992
|
+
declare class Request<CfHostMetadata = unknown> extends Body {
|
|
986
993
|
constructor(input: RequestInfo, init?: RequestInit);
|
|
987
|
-
clone(): Request
|
|
994
|
+
clone(): Request<CfHostMetadata>;
|
|
988
995
|
/** Returns request's HTTP method, which is "GET" by default. */
|
|
989
996
|
readonly method: string;
|
|
990
997
|
/** Returns the URL of request as a string. */
|
|
@@ -996,7 +1003,7 @@ declare class Request extends Body {
|
|
|
996
1003
|
readonly fetcher: Fetcher | null;
|
|
997
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. */
|
|
998
1005
|
readonly signal: AbortSignal;
|
|
999
|
-
readonly cf?: IncomingRequestCfProperties
|
|
1006
|
+
readonly cf?: IncomingRequestCfProperties<CfHostMetadata>;
|
|
1000
1007
|
}
|
|
1001
1008
|
declare interface RequestInit<
|
|
1002
1009
|
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
@@ -1165,9 +1172,41 @@ declare abstract class R2Bucket {
|
|
|
1165
1172
|
| Blob,
|
|
1166
1173
|
options?: R2PutOptions
|
|
1167
1174
|
): Promise<R2Object>;
|
|
1175
|
+
put(
|
|
1176
|
+
key: string,
|
|
1177
|
+
value:
|
|
1178
|
+
| ReadableStream
|
|
1179
|
+
| ArrayBuffer
|
|
1180
|
+
| ArrayBufferView
|
|
1181
|
+
| string
|
|
1182
|
+
| null
|
|
1183
|
+
| Blob,
|
|
1184
|
+
options?: R2PutOptions & {
|
|
1185
|
+
onlyIf: R2Conditional | Headers;
|
|
1186
|
+
}
|
|
1187
|
+
): Promise<R2Object | null>;
|
|
1188
|
+
createMultipartUpload(
|
|
1189
|
+
key: string,
|
|
1190
|
+
options?: R2MultipartOptions
|
|
1191
|
+
): Promise<R2MultipartUpload>;
|
|
1192
|
+
resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;
|
|
1168
1193
|
delete(keys: string | string[]): Promise<void>;
|
|
1169
1194
|
list(options?: R2ListOptions): Promise<R2Objects>;
|
|
1170
1195
|
}
|
|
1196
|
+
declare interface R2MultipartUpload {
|
|
1197
|
+
readonly key: string;
|
|
1198
|
+
readonly uploadId: string;
|
|
1199
|
+
uploadPart(
|
|
1200
|
+
partNumber: number,
|
|
1201
|
+
value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob
|
|
1202
|
+
): Promise<R2UploadedPart>;
|
|
1203
|
+
abort(): Promise<void>;
|
|
1204
|
+
complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
|
|
1205
|
+
}
|
|
1206
|
+
declare interface R2UploadedPart {
|
|
1207
|
+
partNumber: number;
|
|
1208
|
+
etag: string;
|
|
1209
|
+
}
|
|
1171
1210
|
declare abstract class R2Object {
|
|
1172
1211
|
readonly key: string;
|
|
1173
1212
|
readonly version: string;
|
|
@@ -1222,6 +1261,10 @@ declare interface R2PutOptions {
|
|
|
1222
1261
|
sha384?: ArrayBuffer | string;
|
|
1223
1262
|
sha512?: ArrayBuffer | string;
|
|
1224
1263
|
}
|
|
1264
|
+
declare interface R2MultipartOptions {
|
|
1265
|
+
httpMetadata?: R2HTTPMetadata | Headers;
|
|
1266
|
+
customMetadata?: Record<string, string>;
|
|
1267
|
+
}
|
|
1225
1268
|
declare interface R2Checksums {
|
|
1226
1269
|
readonly md5?: ArrayBuffer;
|
|
1227
1270
|
readonly sha1?: ArrayBuffer;
|
|
@@ -1340,6 +1383,7 @@ declare type ReadableStreamReadResult<R = any> =
|
|
|
1340
1383
|
};
|
|
1341
1384
|
/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */
|
|
1342
1385
|
declare interface ReadableStream<R = any> {
|
|
1386
|
+
readonly locked: boolean;
|
|
1343
1387
|
cancel(reason?: any): Promise<void>;
|
|
1344
1388
|
getReader(): ReadableStreamDefaultReader<R>;
|
|
1345
1389
|
getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
|
|
@@ -1524,6 +1568,9 @@ declare interface TraceItem {
|
|
|
1524
1568
|
| TraceItemFetchEventInfo
|
|
1525
1569
|
| TraceItemScheduledEventInfo
|
|
1526
1570
|
| TraceItemAlarmEventInfo
|
|
1571
|
+
| TraceItemQueueEventInfo
|
|
1572
|
+
| TraceItemEmailEventInfo
|
|
1573
|
+
| TraceItemCustomEventInfo
|
|
1527
1574
|
)
|
|
1528
1575
|
| null;
|
|
1529
1576
|
readonly eventTimestamp: number | null;
|
|
@@ -1531,15 +1578,26 @@ declare interface TraceItem {
|
|
|
1531
1578
|
readonly exceptions: TraceException[];
|
|
1532
1579
|
readonly scriptName: string | null;
|
|
1533
1580
|
readonly dispatchNamespace?: string;
|
|
1581
|
+
readonly scriptTags?: string[];
|
|
1534
1582
|
readonly outcome: string;
|
|
1535
1583
|
}
|
|
1536
1584
|
declare interface TraceItemAlarmEventInfo {
|
|
1537
1585
|
readonly scheduledTime: Date;
|
|
1538
1586
|
}
|
|
1587
|
+
declare interface TraceItemCustomEventInfo {}
|
|
1539
1588
|
declare interface TraceItemScheduledEventInfo {
|
|
1540
1589
|
readonly scheduledTime: number;
|
|
1541
1590
|
readonly cron: string;
|
|
1542
1591
|
}
|
|
1592
|
+
declare interface TraceItemQueueEventInfo {
|
|
1593
|
+
readonly queue: string;
|
|
1594
|
+
readonly batchSize: number;
|
|
1595
|
+
}
|
|
1596
|
+
declare interface TraceItemEmailEventInfo {
|
|
1597
|
+
readonly mailFrom: string;
|
|
1598
|
+
readonly rcptTo: string;
|
|
1599
|
+
readonly rawSize: number;
|
|
1600
|
+
}
|
|
1543
1601
|
declare interface TraceItemFetchEventInfo {
|
|
1544
1602
|
readonly response?: TraceItemFetchEventInfoResponse;
|
|
1545
1603
|
readonly request: TraceItemFetchEventInfoRequest;
|
|
@@ -2663,6 +2721,52 @@ declare abstract class D1PreparedStatement {
|
|
|
2663
2721
|
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2664
2722
|
raw<T = unknown>(): Promise<T[]>;
|
|
2665
2723
|
}
|
|
2724
|
+
/**
|
|
2725
|
+
* A email message that is sent to a consumer Worker.
|
|
2726
|
+
*/
|
|
2727
|
+
declare interface EmailMessage<Body = unknown> {
|
|
2728
|
+
/**
|
|
2729
|
+
* Envelope From attribute of the email message.
|
|
2730
|
+
*/
|
|
2731
|
+
readonly from: string;
|
|
2732
|
+
/**
|
|
2733
|
+
* Envelope To attribute of the email message.
|
|
2734
|
+
*/
|
|
2735
|
+
readonly to: string;
|
|
2736
|
+
/**
|
|
2737
|
+
* A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2738
|
+
*/
|
|
2739
|
+
readonly headers: Headers;
|
|
2740
|
+
/**
|
|
2741
|
+
* Stream of the email message content.
|
|
2742
|
+
*/
|
|
2743
|
+
readonly raw: ReadableStream;
|
|
2744
|
+
/**
|
|
2745
|
+
* Size of the email message content.
|
|
2746
|
+
*/
|
|
2747
|
+
readonly rawSize: number;
|
|
2748
|
+
/**
|
|
2749
|
+
* Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
|
|
2750
|
+
* @param reason The reject reason.
|
|
2751
|
+
* @returns void
|
|
2752
|
+
*/
|
|
2753
|
+
setReject(reason: string): void;
|
|
2754
|
+
/**
|
|
2755
|
+
* Forward this email message to a verified destination address of the account.
|
|
2756
|
+
* @param rcptTo Verified destination address.
|
|
2757
|
+
* @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2758
|
+
* @returns A promise that resolves when the email message is forwarded.
|
|
2759
|
+
*/
|
|
2760
|
+
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2761
|
+
}
|
|
2762
|
+
declare abstract class EmailEvent extends ExtendableEvent {
|
|
2763
|
+
readonly message: EmailMessage;
|
|
2764
|
+
}
|
|
2765
|
+
declare type EmailExportedHandler<Env = unknown> = (
|
|
2766
|
+
message: EmailMessage,
|
|
2767
|
+
env: Env,
|
|
2768
|
+
ctx: ExecutionContext
|
|
2769
|
+
) => void | Promise<void>;
|
|
2666
2770
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2667
2771
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2668
2772
|
request: Request;
|
|
@@ -2743,6 +2847,15 @@ declare interface MessageBatch<Body = unknown> {
|
|
|
2743
2847
|
*/
|
|
2744
2848
|
retryAll(): void;
|
|
2745
2849
|
}
|
|
2850
|
+
/**
|
|
2851
|
+
* A wrapper class used to structure message batches.
|
|
2852
|
+
*/
|
|
2853
|
+
declare type MessageSendRequest<Body = unknown> = {
|
|
2854
|
+
/**
|
|
2855
|
+
* The body of the message.
|
|
2856
|
+
*/
|
|
2857
|
+
body: Body;
|
|
2858
|
+
};
|
|
2746
2859
|
/**
|
|
2747
2860
|
* A binding that allows a producer to send messages to a Queue.
|
|
2748
2861
|
*/
|
|
@@ -2753,4 +2866,10 @@ declare interface Queue<Body = any> {
|
|
|
2753
2866
|
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2754
2867
|
*/
|
|
2755
2868
|
send(message: Body): Promise<void>;
|
|
2869
|
+
/**
|
|
2870
|
+
* Sends a batch of messages to the Queue.
|
|
2871
|
+
* @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.
|
|
2872
|
+
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2873
|
+
*/
|
|
2874
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2756
2875
|
}
|
package/2021-11-03/index.ts
CHANGED
|
@@ -282,7 +282,7 @@ export declare const crypto: Crypto;
|
|
|
282
282
|
export declare const caches: CacheStorage;
|
|
283
283
|
export declare const scheduler: Scheduler;
|
|
284
284
|
export interface ExecutionContext {
|
|
285
|
-
waitUntil(promise:
|
|
285
|
+
waitUntil(promise: Promise<any>): void;
|
|
286
286
|
passThroughOnException(): void;
|
|
287
287
|
}
|
|
288
288
|
export type ExportedHandlerFetchHandler<Env = unknown> = (
|
|
@@ -337,13 +337,20 @@ export interface DurableObjectNamespace {
|
|
|
337
337
|
): DurableObjectId;
|
|
338
338
|
idFromName(name: string): DurableObjectId;
|
|
339
339
|
idFromString(id: string): DurableObjectId;
|
|
340
|
-
get(
|
|
340
|
+
get(
|
|
341
|
+
id: DurableObjectId,
|
|
342
|
+
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
343
|
+
): DurableObjectStub;
|
|
344
|
+
jurisdiction(jurisdiction: string): DurableObjectNamespace;
|
|
341
345
|
}
|
|
342
346
|
export interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
343
347
|
jurisdiction?: string;
|
|
344
348
|
}
|
|
349
|
+
export interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
350
|
+
locationHint?: string;
|
|
351
|
+
}
|
|
345
352
|
export interface DurableObjectState {
|
|
346
|
-
waitUntil(promise:
|
|
353
|
+
waitUntil(promise: Promise<any>): void;
|
|
347
354
|
readonly id: DurableObjectId;
|
|
348
355
|
readonly storage: DurableObjectStorage;
|
|
349
356
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
@@ -545,7 +552,7 @@ export interface SchedulerWaitOptions {
|
|
|
545
552
|
signal?: AbortSignal;
|
|
546
553
|
}
|
|
547
554
|
export declare abstract class ExtendableEvent extends Event {
|
|
548
|
-
waitUntil(promise:
|
|
555
|
+
waitUntil(promise: Promise<any>): void;
|
|
549
556
|
}
|
|
550
557
|
export declare class Blob {
|
|
551
558
|
constructor(
|
|
@@ -984,9 +991,9 @@ export interface ResponseInit {
|
|
|
984
991
|
encodeBody?: "automatic" | "manual";
|
|
985
992
|
}
|
|
986
993
|
export type RequestInfo = Request | string | URL;
|
|
987
|
-
export declare class Request extends Body {
|
|
994
|
+
export declare class Request<CfHostMetadata = unknown> extends Body {
|
|
988
995
|
constructor(input: RequestInfo, init?: RequestInit);
|
|
989
|
-
clone(): Request
|
|
996
|
+
clone(): Request<CfHostMetadata>;
|
|
990
997
|
/** Returns request's HTTP method, which is "GET" by default. */
|
|
991
998
|
readonly method: string;
|
|
992
999
|
/** Returns the URL of request as a string. */
|
|
@@ -998,7 +1005,7 @@ export declare class Request extends Body {
|
|
|
998
1005
|
readonly fetcher: Fetcher | null;
|
|
999
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. */
|
|
1000
1007
|
readonly signal: AbortSignal;
|
|
1001
|
-
readonly cf?: IncomingRequestCfProperties
|
|
1008
|
+
readonly cf?: IncomingRequestCfProperties<CfHostMetadata>;
|
|
1002
1009
|
}
|
|
1003
1010
|
export interface RequestInit<
|
|
1004
1011
|
CfType = IncomingRequestCfProperties | RequestInitCfProperties
|
|
@@ -1167,9 +1174,41 @@ export declare abstract class R2Bucket {
|
|
|
1167
1174
|
| Blob,
|
|
1168
1175
|
options?: R2PutOptions
|
|
1169
1176
|
): Promise<R2Object>;
|
|
1177
|
+
put(
|
|
1178
|
+
key: string,
|
|
1179
|
+
value:
|
|
1180
|
+
| ReadableStream
|
|
1181
|
+
| ArrayBuffer
|
|
1182
|
+
| ArrayBufferView
|
|
1183
|
+
| string
|
|
1184
|
+
| null
|
|
1185
|
+
| Blob,
|
|
1186
|
+
options?: R2PutOptions & {
|
|
1187
|
+
onlyIf: R2Conditional | Headers;
|
|
1188
|
+
}
|
|
1189
|
+
): Promise<R2Object | null>;
|
|
1190
|
+
createMultipartUpload(
|
|
1191
|
+
key: string,
|
|
1192
|
+
options?: R2MultipartOptions
|
|
1193
|
+
): Promise<R2MultipartUpload>;
|
|
1194
|
+
resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;
|
|
1170
1195
|
delete(keys: string | string[]): Promise<void>;
|
|
1171
1196
|
list(options?: R2ListOptions): Promise<R2Objects>;
|
|
1172
1197
|
}
|
|
1198
|
+
export interface R2MultipartUpload {
|
|
1199
|
+
readonly key: string;
|
|
1200
|
+
readonly uploadId: string;
|
|
1201
|
+
uploadPart(
|
|
1202
|
+
partNumber: number,
|
|
1203
|
+
value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob
|
|
1204
|
+
): Promise<R2UploadedPart>;
|
|
1205
|
+
abort(): Promise<void>;
|
|
1206
|
+
complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
|
|
1207
|
+
}
|
|
1208
|
+
export interface R2UploadedPart {
|
|
1209
|
+
partNumber: number;
|
|
1210
|
+
etag: string;
|
|
1211
|
+
}
|
|
1173
1212
|
export declare abstract class R2Object {
|
|
1174
1213
|
readonly key: string;
|
|
1175
1214
|
readonly version: string;
|
|
@@ -1224,6 +1263,10 @@ export interface R2PutOptions {
|
|
|
1224
1263
|
sha384?: ArrayBuffer | string;
|
|
1225
1264
|
sha512?: ArrayBuffer | string;
|
|
1226
1265
|
}
|
|
1266
|
+
export interface R2MultipartOptions {
|
|
1267
|
+
httpMetadata?: R2HTTPMetadata | Headers;
|
|
1268
|
+
customMetadata?: Record<string, string>;
|
|
1269
|
+
}
|
|
1227
1270
|
export interface R2Checksums {
|
|
1228
1271
|
readonly md5?: ArrayBuffer;
|
|
1229
1272
|
readonly sha1?: ArrayBuffer;
|
|
@@ -1342,6 +1385,7 @@ export type ReadableStreamReadResult<R = any> =
|
|
|
1342
1385
|
};
|
|
1343
1386
|
/** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */
|
|
1344
1387
|
export interface ReadableStream<R = any> {
|
|
1388
|
+
readonly locked: boolean;
|
|
1345
1389
|
cancel(reason?: any): Promise<void>;
|
|
1346
1390
|
getReader(): ReadableStreamDefaultReader<R>;
|
|
1347
1391
|
getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;
|
|
@@ -1529,6 +1573,9 @@ export interface TraceItem {
|
|
|
1529
1573
|
| TraceItemFetchEventInfo
|
|
1530
1574
|
| TraceItemScheduledEventInfo
|
|
1531
1575
|
| TraceItemAlarmEventInfo
|
|
1576
|
+
| TraceItemQueueEventInfo
|
|
1577
|
+
| TraceItemEmailEventInfo
|
|
1578
|
+
| TraceItemCustomEventInfo
|
|
1532
1579
|
)
|
|
1533
1580
|
| null;
|
|
1534
1581
|
readonly eventTimestamp: number | null;
|
|
@@ -1536,15 +1583,26 @@ export interface TraceItem {
|
|
|
1536
1583
|
readonly exceptions: TraceException[];
|
|
1537
1584
|
readonly scriptName: string | null;
|
|
1538
1585
|
readonly dispatchNamespace?: string;
|
|
1586
|
+
readonly scriptTags?: string[];
|
|
1539
1587
|
readonly outcome: string;
|
|
1540
1588
|
}
|
|
1541
1589
|
export interface TraceItemAlarmEventInfo {
|
|
1542
1590
|
readonly scheduledTime: Date;
|
|
1543
1591
|
}
|
|
1592
|
+
export interface TraceItemCustomEventInfo {}
|
|
1544
1593
|
export interface TraceItemScheduledEventInfo {
|
|
1545
1594
|
readonly scheduledTime: number;
|
|
1546
1595
|
readonly cron: string;
|
|
1547
1596
|
}
|
|
1597
|
+
export interface TraceItemQueueEventInfo {
|
|
1598
|
+
readonly queue: string;
|
|
1599
|
+
readonly batchSize: number;
|
|
1600
|
+
}
|
|
1601
|
+
export interface TraceItemEmailEventInfo {
|
|
1602
|
+
readonly mailFrom: string;
|
|
1603
|
+
readonly rcptTo: string;
|
|
1604
|
+
readonly rawSize: number;
|
|
1605
|
+
}
|
|
1548
1606
|
export interface TraceItemFetchEventInfo {
|
|
1549
1607
|
readonly response?: TraceItemFetchEventInfoResponse;
|
|
1550
1608
|
readonly request: TraceItemFetchEventInfoRequest;
|
|
@@ -2668,6 +2726,52 @@ export declare abstract class D1PreparedStatement {
|
|
|
2668
2726
|
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2669
2727
|
raw<T = unknown>(): Promise<T[]>;
|
|
2670
2728
|
}
|
|
2729
|
+
/**
|
|
2730
|
+
* A email message that is sent to a consumer Worker.
|
|
2731
|
+
*/
|
|
2732
|
+
export interface EmailMessage<Body = unknown> {
|
|
2733
|
+
/**
|
|
2734
|
+
* Envelope From attribute of the email message.
|
|
2735
|
+
*/
|
|
2736
|
+
readonly from: string;
|
|
2737
|
+
/**
|
|
2738
|
+
* Envelope To attribute of the email message.
|
|
2739
|
+
*/
|
|
2740
|
+
readonly to: string;
|
|
2741
|
+
/**
|
|
2742
|
+
* A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2743
|
+
*/
|
|
2744
|
+
readonly headers: Headers;
|
|
2745
|
+
/**
|
|
2746
|
+
* Stream of the email message content.
|
|
2747
|
+
*/
|
|
2748
|
+
readonly raw: ReadableStream;
|
|
2749
|
+
/**
|
|
2750
|
+
* Size of the email message content.
|
|
2751
|
+
*/
|
|
2752
|
+
readonly rawSize: number;
|
|
2753
|
+
/**
|
|
2754
|
+
* Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
|
|
2755
|
+
* @param reason The reject reason.
|
|
2756
|
+
* @returns void
|
|
2757
|
+
*/
|
|
2758
|
+
setReject(reason: string): void;
|
|
2759
|
+
/**
|
|
2760
|
+
* Forward this email message to a verified destination address of the account.
|
|
2761
|
+
* @param rcptTo Verified destination address.
|
|
2762
|
+
* @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2763
|
+
* @returns A promise that resolves when the email message is forwarded.
|
|
2764
|
+
*/
|
|
2765
|
+
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2766
|
+
}
|
|
2767
|
+
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
2768
|
+
readonly message: EmailMessage;
|
|
2769
|
+
}
|
|
2770
|
+
export type EmailExportedHandler<Env = unknown> = (
|
|
2771
|
+
message: EmailMessage,
|
|
2772
|
+
env: Env,
|
|
2773
|
+
ctx: ExecutionContext
|
|
2774
|
+
) => void | Promise<void>;
|
|
2671
2775
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2672
2776
|
export type EventContext<Env, P extends string, Data> = {
|
|
2673
2777
|
request: Request;
|
|
@@ -2745,6 +2849,15 @@ export interface MessageBatch<Body = unknown> {
|
|
|
2745
2849
|
*/
|
|
2746
2850
|
retryAll(): void;
|
|
2747
2851
|
}
|
|
2852
|
+
/**
|
|
2853
|
+
* A wrapper class used to structure message batches.
|
|
2854
|
+
*/
|
|
2855
|
+
export type MessageSendRequest<Body = unknown> = {
|
|
2856
|
+
/**
|
|
2857
|
+
* The body of the message.
|
|
2858
|
+
*/
|
|
2859
|
+
body: Body;
|
|
2860
|
+
};
|
|
2748
2861
|
/**
|
|
2749
2862
|
* A binding that allows a producer to send messages to a Queue.
|
|
2750
2863
|
*/
|
|
@@ -2755,4 +2868,10 @@ export interface Queue<Body = any> {
|
|
|
2755
2868
|
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2756
2869
|
*/
|
|
2757
2870
|
send(message: Body): Promise<void>;
|
|
2871
|
+
/**
|
|
2872
|
+
* Sends a batch of messages to the Queue.
|
|
2873
|
+
* @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.
|
|
2874
|
+
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2875
|
+
*/
|
|
2876
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2758
2877
|
}
|