@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/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(
|
|
@@ -1021,7 +1026,6 @@ declare abstract class Fetcher {
|
|
|
1021
1026
|
input: RequestInfo,
|
|
1022
1027
|
init?: RequestInit<RequestInitCfProperties>
|
|
1023
1028
|
): Promise<Response>;
|
|
1024
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
1025
1029
|
}
|
|
1026
1030
|
declare interface FetcherPutOptions {
|
|
1027
1031
|
expiration?: number;
|
|
@@ -1168,6 +1172,19 @@ declare abstract class R2Bucket {
|
|
|
1168
1172
|
| Blob,
|
|
1169
1173
|
options?: R2PutOptions
|
|
1170
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>;
|
|
1171
1188
|
createMultipartUpload(
|
|
1172
1189
|
key: string,
|
|
1173
1190
|
options?: R2MultipartOptions
|
|
@@ -1551,6 +1568,8 @@ declare interface TraceItem {
|
|
|
1551
1568
|
| TraceItemFetchEventInfo
|
|
1552
1569
|
| TraceItemScheduledEventInfo
|
|
1553
1570
|
| TraceItemAlarmEventInfo
|
|
1571
|
+
| TraceItemQueueEventInfo
|
|
1572
|
+
| TraceItemEmailEventInfo
|
|
1554
1573
|
| TraceItemCustomEventInfo
|
|
1555
1574
|
)
|
|
1556
1575
|
| null;
|
|
@@ -1559,6 +1578,7 @@ declare interface TraceItem {
|
|
|
1559
1578
|
readonly exceptions: TraceException[];
|
|
1560
1579
|
readonly scriptName: string | null;
|
|
1561
1580
|
readonly dispatchNamespace?: string;
|
|
1581
|
+
readonly scriptTags?: string[];
|
|
1562
1582
|
readonly outcome: string;
|
|
1563
1583
|
}
|
|
1564
1584
|
declare interface TraceItemAlarmEventInfo {
|
|
@@ -1569,6 +1589,15 @@ declare interface TraceItemScheduledEventInfo {
|
|
|
1569
1589
|
readonly scheduledTime: number;
|
|
1570
1590
|
readonly cron: string;
|
|
1571
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
|
+
}
|
|
1572
1601
|
declare interface TraceItemFetchEventInfo {
|
|
1573
1602
|
readonly response?: TraceItemFetchEventInfoResponse;
|
|
1574
1603
|
readonly request: TraceItemFetchEventInfoRequest;
|
|
@@ -1748,15 +1777,6 @@ declare const WebSocketPair: {
|
|
|
1748
1777
|
1: WebSocket;
|
|
1749
1778
|
};
|
|
1750
1779
|
};
|
|
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
1780
|
declare interface BasicImageTransformations {
|
|
1761
1781
|
/**
|
|
1762
1782
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2701,6 +2721,52 @@ declare abstract class D1PreparedStatement {
|
|
|
2701
2721
|
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2702
2722
|
raw<T = unknown>(): Promise<T[]>;
|
|
2703
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>;
|
|
2704
2770
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2705
2771
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2706
2772
|
request: Request;
|
|
@@ -2747,6 +2813,40 @@ declare type PagesPluginFunction<
|
|
|
2747
2813
|
declare module "assets:*" {
|
|
2748
2814
|
export const onRequest: PagesFunction;
|
|
2749
2815
|
}
|
|
2816
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
2817
|
+
// PubSubMessage represents an incoming PubSub message.
|
|
2818
|
+
// The message includes metadata about the broker, the client, and the payload
|
|
2819
|
+
// itself.
|
|
2820
|
+
declare interface PubSubMessage {
|
|
2821
|
+
// Message ID
|
|
2822
|
+
readonly mid: number;
|
|
2823
|
+
// MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
|
|
2824
|
+
readonly broker: string;
|
|
2825
|
+
// The MQTT topic the message was sent on.
|
|
2826
|
+
readonly topic: string;
|
|
2827
|
+
// The client ID of the client that published this message.
|
|
2828
|
+
readonly clientId: string;
|
|
2829
|
+
// The unique identifier (JWT ID) used by the client to authenticate, if token
|
|
2830
|
+
// auth was used.
|
|
2831
|
+
readonly jti?: string;
|
|
2832
|
+
// A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
|
|
2833
|
+
// received the message from the client.
|
|
2834
|
+
readonly receivedAt: number;
|
|
2835
|
+
// An (optional) string with the MIME type of the payload, if set by the
|
|
2836
|
+
// client.
|
|
2837
|
+
readonly contentType: string;
|
|
2838
|
+
// Set to 1 when the payload is a UTF-8 string
|
|
2839
|
+
// https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
|
|
2840
|
+
readonly payloadFormatIndicator: number;
|
|
2841
|
+
// Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
|
|
2842
|
+
// You can use payloadFormatIndicator to inspect this before decoding.
|
|
2843
|
+
payload: string | Uint8Array;
|
|
2844
|
+
}
|
|
2845
|
+
// JsonWebKey extended by kid parameter
|
|
2846
|
+
declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
2847
|
+
// Key Identifier of the JWK
|
|
2848
|
+
readonly kid: string;
|
|
2849
|
+
}
|
|
2750
2850
|
/**
|
|
2751
2851
|
* A message that is sent to a consumer Worker.
|
|
2752
2852
|
*/
|
|
@@ -2781,6 +2881,15 @@ declare interface MessageBatch<Body = unknown> {
|
|
|
2781
2881
|
*/
|
|
2782
2882
|
retryAll(): void;
|
|
2783
2883
|
}
|
|
2884
|
+
/**
|
|
2885
|
+
* A wrapper class used to structure message batches.
|
|
2886
|
+
*/
|
|
2887
|
+
declare type MessageSendRequest<Body = unknown> = {
|
|
2888
|
+
/**
|
|
2889
|
+
* The body of the message.
|
|
2890
|
+
*/
|
|
2891
|
+
body: Body;
|
|
2892
|
+
};
|
|
2784
2893
|
/**
|
|
2785
2894
|
* A binding that allows a producer to send messages to a Queue.
|
|
2786
2895
|
*/
|
|
@@ -2791,4 +2900,10 @@ declare interface Queue<Body = any> {
|
|
|
2791
2900
|
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2792
2901
|
*/
|
|
2793
2902
|
send(message: Body): Promise<void>;
|
|
2903
|
+
/**
|
|
2904
|
+
* Sends a batch of messages to the Queue.
|
|
2905
|
+
* @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.
|
|
2906
|
+
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2907
|
+
*/
|
|
2908
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2794
2909
|
}
|
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(
|
|
@@ -1026,7 +1028,6 @@ export declare abstract class Fetcher {
|
|
|
1026
1028
|
input: RequestInfo,
|
|
1027
1029
|
init?: RequestInit<RequestInitCfProperties>
|
|
1028
1030
|
): Promise<Response>;
|
|
1029
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
1030
1031
|
}
|
|
1031
1032
|
export interface FetcherPutOptions {
|
|
1032
1033
|
expiration?: number;
|
|
@@ -1173,6 +1174,19 @@ export declare abstract class R2Bucket {
|
|
|
1173
1174
|
| Blob,
|
|
1174
1175
|
options?: R2PutOptions
|
|
1175
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>;
|
|
1176
1190
|
createMultipartUpload(
|
|
1177
1191
|
key: string,
|
|
1178
1192
|
options?: R2MultipartOptions
|
|
@@ -1559,6 +1573,8 @@ export interface TraceItem {
|
|
|
1559
1573
|
| TraceItemFetchEventInfo
|
|
1560
1574
|
| TraceItemScheduledEventInfo
|
|
1561
1575
|
| TraceItemAlarmEventInfo
|
|
1576
|
+
| TraceItemQueueEventInfo
|
|
1577
|
+
| TraceItemEmailEventInfo
|
|
1562
1578
|
| TraceItemCustomEventInfo
|
|
1563
1579
|
)
|
|
1564
1580
|
| null;
|
|
@@ -1567,6 +1583,7 @@ export interface TraceItem {
|
|
|
1567
1583
|
readonly exceptions: TraceException[];
|
|
1568
1584
|
readonly scriptName: string | null;
|
|
1569
1585
|
readonly dispatchNamespace?: string;
|
|
1586
|
+
readonly scriptTags?: string[];
|
|
1570
1587
|
readonly outcome: string;
|
|
1571
1588
|
}
|
|
1572
1589
|
export interface TraceItemAlarmEventInfo {
|
|
@@ -1577,6 +1594,15 @@ export interface TraceItemScheduledEventInfo {
|
|
|
1577
1594
|
readonly scheduledTime: number;
|
|
1578
1595
|
readonly cron: string;
|
|
1579
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
|
+
}
|
|
1580
1606
|
export interface TraceItemFetchEventInfo {
|
|
1581
1607
|
readonly response?: TraceItemFetchEventInfoResponse;
|
|
1582
1608
|
readonly request: TraceItemFetchEventInfoRequest;
|
|
@@ -1756,15 +1782,6 @@ export declare const WebSocketPair: {
|
|
|
1756
1782
|
1: WebSocket;
|
|
1757
1783
|
};
|
|
1758
1784
|
};
|
|
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
1785
|
export interface BasicImageTransformations {
|
|
1769
1786
|
/**
|
|
1770
1787
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2709,6 +2726,52 @@ export declare abstract class D1PreparedStatement {
|
|
|
2709
2726
|
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2710
2727
|
raw<T = unknown>(): Promise<T[]>;
|
|
2711
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>;
|
|
2712
2775
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2713
2776
|
export type EventContext<Env, P extends string, Data> = {
|
|
2714
2777
|
request: Request;
|
|
@@ -2752,6 +2815,40 @@ export type PagesPluginFunction<
|
|
|
2752
2815
|
> = (
|
|
2753
2816
|
context: EventPluginContext<Env, Params, Data, PluginArgs>
|
|
2754
2817
|
) => Response | Promise<Response>;
|
|
2818
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
2819
|
+
// PubSubMessage represents an incoming PubSub message.
|
|
2820
|
+
// The message includes metadata about the broker, the client, and the payload
|
|
2821
|
+
// itself.
|
|
2822
|
+
export interface PubSubMessage {
|
|
2823
|
+
// Message ID
|
|
2824
|
+
readonly mid: number;
|
|
2825
|
+
// MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
|
|
2826
|
+
readonly broker: string;
|
|
2827
|
+
// The MQTT topic the message was sent on.
|
|
2828
|
+
readonly topic: string;
|
|
2829
|
+
// The client ID of the client that published this message.
|
|
2830
|
+
readonly clientId: string;
|
|
2831
|
+
// The unique identifier (JWT ID) used by the client to authenticate, if token
|
|
2832
|
+
// auth was used.
|
|
2833
|
+
readonly jti?: string;
|
|
2834
|
+
// A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
|
|
2835
|
+
// received the message from the client.
|
|
2836
|
+
readonly receivedAt: number;
|
|
2837
|
+
// An (optional) string with the MIME type of the payload, if set by the
|
|
2838
|
+
// client.
|
|
2839
|
+
readonly contentType: string;
|
|
2840
|
+
// Set to 1 when the payload is a UTF-8 string
|
|
2841
|
+
// https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
|
|
2842
|
+
readonly payloadFormatIndicator: number;
|
|
2843
|
+
// Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
|
|
2844
|
+
// You can use payloadFormatIndicator to inspect this before decoding.
|
|
2845
|
+
payload: string | Uint8Array;
|
|
2846
|
+
}
|
|
2847
|
+
// JsonWebKey extended by kid parameter
|
|
2848
|
+
export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
2849
|
+
// Key Identifier of the JWK
|
|
2850
|
+
readonly kid: string;
|
|
2851
|
+
}
|
|
2755
2852
|
/**
|
|
2756
2853
|
* A message that is sent to a consumer Worker.
|
|
2757
2854
|
*/
|
|
@@ -2786,6 +2883,15 @@ export interface MessageBatch<Body = unknown> {
|
|
|
2786
2883
|
*/
|
|
2787
2884
|
retryAll(): void;
|
|
2788
2885
|
}
|
|
2886
|
+
/**
|
|
2887
|
+
* A wrapper class used to structure message batches.
|
|
2888
|
+
*/
|
|
2889
|
+
export type MessageSendRequest<Body = unknown> = {
|
|
2890
|
+
/**
|
|
2891
|
+
* The body of the message.
|
|
2892
|
+
*/
|
|
2893
|
+
body: Body;
|
|
2894
|
+
};
|
|
2789
2895
|
/**
|
|
2790
2896
|
* A binding that allows a producer to send messages to a Queue.
|
|
2791
2897
|
*/
|
|
@@ -2796,4 +2902,10 @@ export interface Queue<Body = any> {
|
|
|
2796
2902
|
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2797
2903
|
*/
|
|
2798
2904
|
send(message: Body): Promise<void>;
|
|
2905
|
+
/**
|
|
2906
|
+
* Sends a batch of messages to the Queue.
|
|
2907
|
+
* @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.
|
|
2908
|
+
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2909
|
+
*/
|
|
2910
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2799
2911
|
}
|