@cloudflare/workers-types 4.20221111.0 → 4.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 +131 -16
- package/2021-11-03/index.ts +131 -19
- package/2022-01-31/index.d.ts +131 -16
- package/2022-01-31/index.ts +131 -19
- package/2022-03-21/index.d.ts +131 -16
- package/2022-03-21/index.ts +131 -19
- package/2022-08-04/index.d.ts +131 -16
- package/2022-08-04/index.ts +131 -19
- package/2022-10-31/index.d.ts +2900 -0
- package/2022-10-31/index.ts +2902 -0
- package/2022-11-30/index.d.ts +2903 -0
- package/2022-11-30/index.ts +2905 -0
- package/README.md +19 -8
- package/entrypoints.svg +53 -0
- package/experimental/index.d.ts +131 -16
- package/experimental/index.ts +131 -19
- package/index.d.ts +131 -16
- package/index.ts +131 -19
- package/oldest/index.d.ts +131 -16
- package/oldest/index.ts +131 -19
- package/package.json +1 -1
package/2022-01-31/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>;
|
|
@@ -533,7 +538,7 @@ declare interface SchedulerWaitOptions {
|
|
|
533
538
|
signal?: AbortSignal;
|
|
534
539
|
}
|
|
535
540
|
declare abstract class ExtendableEvent extends Event {
|
|
536
|
-
waitUntil(promise:
|
|
541
|
+
waitUntil(promise: Promise<any>): void;
|
|
537
542
|
}
|
|
538
543
|
declare class Blob {
|
|
539
544
|
constructor(
|
|
@@ -1003,7 +1008,6 @@ declare abstract class Fetcher {
|
|
|
1003
1008
|
input: RequestInfo,
|
|
1004
1009
|
init?: RequestInit<RequestInitCfProperties>
|
|
1005
1010
|
): Promise<Response>;
|
|
1006
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
1007
1011
|
}
|
|
1008
1012
|
declare interface FetcherPutOptions {
|
|
1009
1013
|
expiration?: number;
|
|
@@ -1150,6 +1154,19 @@ declare abstract class R2Bucket {
|
|
|
1150
1154
|
| Blob,
|
|
1151
1155
|
options?: R2PutOptions
|
|
1152
1156
|
): Promise<R2Object>;
|
|
1157
|
+
put(
|
|
1158
|
+
key: string,
|
|
1159
|
+
value:
|
|
1160
|
+
| ReadableStream
|
|
1161
|
+
| ArrayBuffer
|
|
1162
|
+
| ArrayBufferView
|
|
1163
|
+
| string
|
|
1164
|
+
| null
|
|
1165
|
+
| Blob,
|
|
1166
|
+
options?: R2PutOptions & {
|
|
1167
|
+
onlyIf: R2Conditional | Headers;
|
|
1168
|
+
}
|
|
1169
|
+
): Promise<R2Object | null>;
|
|
1153
1170
|
createMultipartUpload(
|
|
1154
1171
|
key: string,
|
|
1155
1172
|
options?: R2MultipartOptions
|
|
@@ -1533,6 +1550,8 @@ declare interface TraceItem {
|
|
|
1533
1550
|
| TraceItemFetchEventInfo
|
|
1534
1551
|
| TraceItemScheduledEventInfo
|
|
1535
1552
|
| TraceItemAlarmEventInfo
|
|
1553
|
+
| TraceItemQueueEventInfo
|
|
1554
|
+
| TraceItemEmailEventInfo
|
|
1536
1555
|
| TraceItemCustomEventInfo
|
|
1537
1556
|
)
|
|
1538
1557
|
| null;
|
|
@@ -1541,6 +1560,7 @@ declare interface TraceItem {
|
|
|
1541
1560
|
readonly exceptions: TraceException[];
|
|
1542
1561
|
readonly scriptName: string | null;
|
|
1543
1562
|
readonly dispatchNamespace?: string;
|
|
1563
|
+
readonly scriptTags?: string[];
|
|
1544
1564
|
readonly outcome: string;
|
|
1545
1565
|
}
|
|
1546
1566
|
declare interface TraceItemAlarmEventInfo {
|
|
@@ -1551,6 +1571,15 @@ declare interface TraceItemScheduledEventInfo {
|
|
|
1551
1571
|
readonly scheduledTime: number;
|
|
1552
1572
|
readonly cron: string;
|
|
1553
1573
|
}
|
|
1574
|
+
declare interface TraceItemQueueEventInfo {
|
|
1575
|
+
readonly queue: string;
|
|
1576
|
+
readonly batchSize: number;
|
|
1577
|
+
}
|
|
1578
|
+
declare interface TraceItemEmailEventInfo {
|
|
1579
|
+
readonly mailFrom: string;
|
|
1580
|
+
readonly rcptTo: string;
|
|
1581
|
+
readonly rawSize: number;
|
|
1582
|
+
}
|
|
1554
1583
|
declare interface TraceItemFetchEventInfo {
|
|
1555
1584
|
readonly response?: TraceItemFetchEventInfoResponse;
|
|
1556
1585
|
readonly request: TraceItemFetchEventInfoRequest;
|
|
@@ -1736,15 +1765,6 @@ declare const WebSocketPair: {
|
|
|
1736
1765
|
1: WebSocket;
|
|
1737
1766
|
};
|
|
1738
1767
|
};
|
|
1739
|
-
declare interface Socket {
|
|
1740
|
-
readonly readable: ReadableStream;
|
|
1741
|
-
readonly writable: WritableStream;
|
|
1742
|
-
readonly closed: Promise<void>;
|
|
1743
|
-
close(): Promise<void>;
|
|
1744
|
-
}
|
|
1745
|
-
declare interface SocketOptions {
|
|
1746
|
-
tsl: boolean;
|
|
1747
|
-
}
|
|
1748
1768
|
declare interface BasicImageTransformations {
|
|
1749
1769
|
/**
|
|
1750
1770
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2689,6 +2709,52 @@ declare abstract class D1PreparedStatement {
|
|
|
2689
2709
|
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2690
2710
|
raw<T = unknown>(): Promise<T[]>;
|
|
2691
2711
|
}
|
|
2712
|
+
/**
|
|
2713
|
+
* A email message that is sent to a consumer Worker.
|
|
2714
|
+
*/
|
|
2715
|
+
declare interface EmailMessage<Body = unknown> {
|
|
2716
|
+
/**
|
|
2717
|
+
* Envelope From attribute of the email message.
|
|
2718
|
+
*/
|
|
2719
|
+
readonly from: string;
|
|
2720
|
+
/**
|
|
2721
|
+
* Envelope To attribute of the email message.
|
|
2722
|
+
*/
|
|
2723
|
+
readonly to: string;
|
|
2724
|
+
/**
|
|
2725
|
+
* A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2726
|
+
*/
|
|
2727
|
+
readonly headers: Headers;
|
|
2728
|
+
/**
|
|
2729
|
+
* Stream of the email message content.
|
|
2730
|
+
*/
|
|
2731
|
+
readonly raw: ReadableStream;
|
|
2732
|
+
/**
|
|
2733
|
+
* Size of the email message content.
|
|
2734
|
+
*/
|
|
2735
|
+
readonly rawSize: number;
|
|
2736
|
+
/**
|
|
2737
|
+
* Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
|
|
2738
|
+
* @param reason The reject reason.
|
|
2739
|
+
* @returns void
|
|
2740
|
+
*/
|
|
2741
|
+
setReject(reason: string): void;
|
|
2742
|
+
/**
|
|
2743
|
+
* Forward this email message to a verified destination address of the account.
|
|
2744
|
+
* @param rcptTo Verified destination address.
|
|
2745
|
+
* @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2746
|
+
* @returns A promise that resolves when the email message is forwarded.
|
|
2747
|
+
*/
|
|
2748
|
+
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2749
|
+
}
|
|
2750
|
+
declare abstract class EmailEvent extends ExtendableEvent {
|
|
2751
|
+
readonly message: EmailMessage;
|
|
2752
|
+
}
|
|
2753
|
+
declare type EmailExportedHandler<Env = unknown> = (
|
|
2754
|
+
message: EmailMessage,
|
|
2755
|
+
env: Env,
|
|
2756
|
+
ctx: ExecutionContext
|
|
2757
|
+
) => void | Promise<void>;
|
|
2692
2758
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2693
2759
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2694
2760
|
request: Request;
|
|
@@ -2735,6 +2801,40 @@ declare type PagesPluginFunction<
|
|
|
2735
2801
|
declare module "assets:*" {
|
|
2736
2802
|
export const onRequest: PagesFunction;
|
|
2737
2803
|
}
|
|
2804
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
2805
|
+
// PubSubMessage represents an incoming PubSub message.
|
|
2806
|
+
// The message includes metadata about the broker, the client, and the payload
|
|
2807
|
+
// itself.
|
|
2808
|
+
declare interface PubSubMessage {
|
|
2809
|
+
// Message ID
|
|
2810
|
+
readonly mid: number;
|
|
2811
|
+
// MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
|
|
2812
|
+
readonly broker: string;
|
|
2813
|
+
// The MQTT topic the message was sent on.
|
|
2814
|
+
readonly topic: string;
|
|
2815
|
+
// The client ID of the client that published this message.
|
|
2816
|
+
readonly clientId: string;
|
|
2817
|
+
// The unique identifier (JWT ID) used by the client to authenticate, if token
|
|
2818
|
+
// auth was used.
|
|
2819
|
+
readonly jti?: string;
|
|
2820
|
+
// A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
|
|
2821
|
+
// received the message from the client.
|
|
2822
|
+
readonly receivedAt: number;
|
|
2823
|
+
// An (optional) string with the MIME type of the payload, if set by the
|
|
2824
|
+
// client.
|
|
2825
|
+
readonly contentType: string;
|
|
2826
|
+
// Set to 1 when the payload is a UTF-8 string
|
|
2827
|
+
// https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
|
|
2828
|
+
readonly payloadFormatIndicator: number;
|
|
2829
|
+
// Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
|
|
2830
|
+
// You can use payloadFormatIndicator to inspect this before decoding.
|
|
2831
|
+
payload: string | Uint8Array;
|
|
2832
|
+
}
|
|
2833
|
+
// JsonWebKey extended by kid parameter
|
|
2834
|
+
declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
2835
|
+
// Key Identifier of the JWK
|
|
2836
|
+
readonly kid: string;
|
|
2837
|
+
}
|
|
2738
2838
|
/**
|
|
2739
2839
|
* A message that is sent to a consumer Worker.
|
|
2740
2840
|
*/
|
|
@@ -2769,6 +2869,15 @@ declare interface MessageBatch<Body = unknown> {
|
|
|
2769
2869
|
*/
|
|
2770
2870
|
retryAll(): void;
|
|
2771
2871
|
}
|
|
2872
|
+
/**
|
|
2873
|
+
* A wrapper class used to structure message batches.
|
|
2874
|
+
*/
|
|
2875
|
+
declare type MessageSendRequest<Body = unknown> = {
|
|
2876
|
+
/**
|
|
2877
|
+
* The body of the message.
|
|
2878
|
+
*/
|
|
2879
|
+
body: Body;
|
|
2880
|
+
};
|
|
2772
2881
|
/**
|
|
2773
2882
|
* A binding that allows a producer to send messages to a Queue.
|
|
2774
2883
|
*/
|
|
@@ -2779,4 +2888,10 @@ declare interface Queue<Body = any> {
|
|
|
2779
2888
|
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2780
2889
|
*/
|
|
2781
2890
|
send(message: Body): Promise<void>;
|
|
2891
|
+
/**
|
|
2892
|
+
* Sends a batch of messages to the Queue.
|
|
2893
|
+
* @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.
|
|
2894
|
+
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2895
|
+
*/
|
|
2896
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2782
2897
|
}
|
package/2022-01-31/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>;
|
|
@@ -538,7 +540,7 @@ export interface SchedulerWaitOptions {
|
|
|
538
540
|
signal?: AbortSignal;
|
|
539
541
|
}
|
|
540
542
|
export declare abstract class ExtendableEvent extends Event {
|
|
541
|
-
waitUntil(promise:
|
|
543
|
+
waitUntil(promise: Promise<any>): void;
|
|
542
544
|
}
|
|
543
545
|
export declare class Blob {
|
|
544
546
|
constructor(
|
|
@@ -1008,7 +1010,6 @@ export declare abstract class Fetcher {
|
|
|
1008
1010
|
input: RequestInfo,
|
|
1009
1011
|
init?: RequestInit<RequestInitCfProperties>
|
|
1010
1012
|
): Promise<Response>;
|
|
1011
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
1012
1013
|
}
|
|
1013
1014
|
export interface FetcherPutOptions {
|
|
1014
1015
|
expiration?: number;
|
|
@@ -1155,6 +1156,19 @@ export declare abstract class R2Bucket {
|
|
|
1155
1156
|
| Blob,
|
|
1156
1157
|
options?: R2PutOptions
|
|
1157
1158
|
): Promise<R2Object>;
|
|
1159
|
+
put(
|
|
1160
|
+
key: string,
|
|
1161
|
+
value:
|
|
1162
|
+
| ReadableStream
|
|
1163
|
+
| ArrayBuffer
|
|
1164
|
+
| ArrayBufferView
|
|
1165
|
+
| string
|
|
1166
|
+
| null
|
|
1167
|
+
| Blob,
|
|
1168
|
+
options?: R2PutOptions & {
|
|
1169
|
+
onlyIf: R2Conditional | Headers;
|
|
1170
|
+
}
|
|
1171
|
+
): Promise<R2Object | null>;
|
|
1158
1172
|
createMultipartUpload(
|
|
1159
1173
|
key: string,
|
|
1160
1174
|
options?: R2MultipartOptions
|
|
@@ -1541,6 +1555,8 @@ export interface TraceItem {
|
|
|
1541
1555
|
| TraceItemFetchEventInfo
|
|
1542
1556
|
| TraceItemScheduledEventInfo
|
|
1543
1557
|
| TraceItemAlarmEventInfo
|
|
1558
|
+
| TraceItemQueueEventInfo
|
|
1559
|
+
| TraceItemEmailEventInfo
|
|
1544
1560
|
| TraceItemCustomEventInfo
|
|
1545
1561
|
)
|
|
1546
1562
|
| null;
|
|
@@ -1549,6 +1565,7 @@ export interface TraceItem {
|
|
|
1549
1565
|
readonly exceptions: TraceException[];
|
|
1550
1566
|
readonly scriptName: string | null;
|
|
1551
1567
|
readonly dispatchNamespace?: string;
|
|
1568
|
+
readonly scriptTags?: string[];
|
|
1552
1569
|
readonly outcome: string;
|
|
1553
1570
|
}
|
|
1554
1571
|
export interface TraceItemAlarmEventInfo {
|
|
@@ -1559,6 +1576,15 @@ export interface TraceItemScheduledEventInfo {
|
|
|
1559
1576
|
readonly scheduledTime: number;
|
|
1560
1577
|
readonly cron: string;
|
|
1561
1578
|
}
|
|
1579
|
+
export interface TraceItemQueueEventInfo {
|
|
1580
|
+
readonly queue: string;
|
|
1581
|
+
readonly batchSize: number;
|
|
1582
|
+
}
|
|
1583
|
+
export interface TraceItemEmailEventInfo {
|
|
1584
|
+
readonly mailFrom: string;
|
|
1585
|
+
readonly rcptTo: string;
|
|
1586
|
+
readonly rawSize: number;
|
|
1587
|
+
}
|
|
1562
1588
|
export interface TraceItemFetchEventInfo {
|
|
1563
1589
|
readonly response?: TraceItemFetchEventInfoResponse;
|
|
1564
1590
|
readonly request: TraceItemFetchEventInfoRequest;
|
|
@@ -1744,15 +1770,6 @@ export declare const WebSocketPair: {
|
|
|
1744
1770
|
1: WebSocket;
|
|
1745
1771
|
};
|
|
1746
1772
|
};
|
|
1747
|
-
export interface Socket {
|
|
1748
|
-
readonly readable: ReadableStream;
|
|
1749
|
-
readonly writable: WritableStream;
|
|
1750
|
-
readonly closed: Promise<void>;
|
|
1751
|
-
close(): Promise<void>;
|
|
1752
|
-
}
|
|
1753
|
-
export interface SocketOptions {
|
|
1754
|
-
tsl: boolean;
|
|
1755
|
-
}
|
|
1756
1773
|
export interface BasicImageTransformations {
|
|
1757
1774
|
/**
|
|
1758
1775
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2697,6 +2714,52 @@ export declare abstract class D1PreparedStatement {
|
|
|
2697
2714
|
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2698
2715
|
raw<T = unknown>(): Promise<T[]>;
|
|
2699
2716
|
}
|
|
2717
|
+
/**
|
|
2718
|
+
* A email message that is sent to a consumer Worker.
|
|
2719
|
+
*/
|
|
2720
|
+
export interface EmailMessage<Body = unknown> {
|
|
2721
|
+
/**
|
|
2722
|
+
* Envelope From attribute of the email message.
|
|
2723
|
+
*/
|
|
2724
|
+
readonly from: string;
|
|
2725
|
+
/**
|
|
2726
|
+
* Envelope To attribute of the email message.
|
|
2727
|
+
*/
|
|
2728
|
+
readonly to: string;
|
|
2729
|
+
/**
|
|
2730
|
+
* A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2731
|
+
*/
|
|
2732
|
+
readonly headers: Headers;
|
|
2733
|
+
/**
|
|
2734
|
+
* Stream of the email message content.
|
|
2735
|
+
*/
|
|
2736
|
+
readonly raw: ReadableStream;
|
|
2737
|
+
/**
|
|
2738
|
+
* Size of the email message content.
|
|
2739
|
+
*/
|
|
2740
|
+
readonly rawSize: number;
|
|
2741
|
+
/**
|
|
2742
|
+
* Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
|
|
2743
|
+
* @param reason The reject reason.
|
|
2744
|
+
* @returns void
|
|
2745
|
+
*/
|
|
2746
|
+
setReject(reason: string): void;
|
|
2747
|
+
/**
|
|
2748
|
+
* Forward this email message to a verified destination address of the account.
|
|
2749
|
+
* @param rcptTo Verified destination address.
|
|
2750
|
+
* @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2751
|
+
* @returns A promise that resolves when the email message is forwarded.
|
|
2752
|
+
*/
|
|
2753
|
+
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2754
|
+
}
|
|
2755
|
+
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
2756
|
+
readonly message: EmailMessage;
|
|
2757
|
+
}
|
|
2758
|
+
export type EmailExportedHandler<Env = unknown> = (
|
|
2759
|
+
message: EmailMessage,
|
|
2760
|
+
env: Env,
|
|
2761
|
+
ctx: ExecutionContext
|
|
2762
|
+
) => void | Promise<void>;
|
|
2700
2763
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2701
2764
|
export type EventContext<Env, P extends string, Data> = {
|
|
2702
2765
|
request: Request;
|
|
@@ -2740,6 +2803,40 @@ export type PagesPluginFunction<
|
|
|
2740
2803
|
> = (
|
|
2741
2804
|
context: EventPluginContext<Env, Params, Data, PluginArgs>
|
|
2742
2805
|
) => Response | Promise<Response>;
|
|
2806
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
2807
|
+
// PubSubMessage represents an incoming PubSub message.
|
|
2808
|
+
// The message includes metadata about the broker, the client, and the payload
|
|
2809
|
+
// itself.
|
|
2810
|
+
export interface PubSubMessage {
|
|
2811
|
+
// Message ID
|
|
2812
|
+
readonly mid: number;
|
|
2813
|
+
// MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
|
|
2814
|
+
readonly broker: string;
|
|
2815
|
+
// The MQTT topic the message was sent on.
|
|
2816
|
+
readonly topic: string;
|
|
2817
|
+
// The client ID of the client that published this message.
|
|
2818
|
+
readonly clientId: string;
|
|
2819
|
+
// The unique identifier (JWT ID) used by the client to authenticate, if token
|
|
2820
|
+
// auth was used.
|
|
2821
|
+
readonly jti?: string;
|
|
2822
|
+
// A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
|
|
2823
|
+
// received the message from the client.
|
|
2824
|
+
readonly receivedAt: number;
|
|
2825
|
+
// An (optional) string with the MIME type of the payload, if set by the
|
|
2826
|
+
// client.
|
|
2827
|
+
readonly contentType: string;
|
|
2828
|
+
// Set to 1 when the payload is a UTF-8 string
|
|
2829
|
+
// https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
|
|
2830
|
+
readonly payloadFormatIndicator: number;
|
|
2831
|
+
// Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
|
|
2832
|
+
// You can use payloadFormatIndicator to inspect this before decoding.
|
|
2833
|
+
payload: string | Uint8Array;
|
|
2834
|
+
}
|
|
2835
|
+
// JsonWebKey extended by kid parameter
|
|
2836
|
+
export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
2837
|
+
// Key Identifier of the JWK
|
|
2838
|
+
readonly kid: string;
|
|
2839
|
+
}
|
|
2743
2840
|
/**
|
|
2744
2841
|
* A message that is sent to a consumer Worker.
|
|
2745
2842
|
*/
|
|
@@ -2774,6 +2871,15 @@ export interface MessageBatch<Body = unknown> {
|
|
|
2774
2871
|
*/
|
|
2775
2872
|
retryAll(): void;
|
|
2776
2873
|
}
|
|
2874
|
+
/**
|
|
2875
|
+
* A wrapper class used to structure message batches.
|
|
2876
|
+
*/
|
|
2877
|
+
export type MessageSendRequest<Body = unknown> = {
|
|
2878
|
+
/**
|
|
2879
|
+
* The body of the message.
|
|
2880
|
+
*/
|
|
2881
|
+
body: Body;
|
|
2882
|
+
};
|
|
2777
2883
|
/**
|
|
2778
2884
|
* A binding that allows a producer to send messages to a Queue.
|
|
2779
2885
|
*/
|
|
@@ -2784,4 +2890,10 @@ export interface Queue<Body = any> {
|
|
|
2784
2890
|
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2785
2891
|
*/
|
|
2786
2892
|
send(message: Body): Promise<void>;
|
|
2893
|
+
/**
|
|
2894
|
+
* Sends a batch of messages to the Queue.
|
|
2895
|
+
* @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.
|
|
2896
|
+
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2897
|
+
*/
|
|
2898
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2787
2899
|
}
|