@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-03-21/index.d.ts
CHANGED
|
@@ -229,7 +229,6 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
229
229
|
FixedLengthStream: typeof FixedLengthStream;
|
|
230
230
|
IdentityTransformStream: typeof IdentityTransformStream;
|
|
231
231
|
HTMLRewriter: typeof HTMLRewriter;
|
|
232
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
233
232
|
}
|
|
234
233
|
declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
|
|
235
234
|
type: Type,
|
|
@@ -283,9 +282,8 @@ declare const crypto: Crypto;
|
|
|
283
282
|
declare const caches: CacheStorage;
|
|
284
283
|
declare const scheduler: Scheduler;
|
|
285
284
|
declare const navigator: Navigator;
|
|
286
|
-
declare function connect(address: string, options?: SocketOptions): Socket;
|
|
287
285
|
declare interface ExecutionContext {
|
|
288
|
-
waitUntil(promise:
|
|
286
|
+
waitUntil(promise: Promise<any>): void;
|
|
289
287
|
passThroughOnException(): void;
|
|
290
288
|
}
|
|
291
289
|
declare type ExportedHandlerFetchHandler<Env = unknown> = (
|
|
@@ -343,13 +341,20 @@ declare interface DurableObjectNamespace {
|
|
|
343
341
|
): DurableObjectId;
|
|
344
342
|
idFromName(name: string): DurableObjectId;
|
|
345
343
|
idFromString(id: string): DurableObjectId;
|
|
346
|
-
get(
|
|
344
|
+
get(
|
|
345
|
+
id: DurableObjectId,
|
|
346
|
+
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
347
|
+
): DurableObjectStub;
|
|
348
|
+
jurisdiction(jurisdiction: string): DurableObjectNamespace;
|
|
347
349
|
}
|
|
348
350
|
declare interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
349
351
|
jurisdiction?: string;
|
|
350
352
|
}
|
|
353
|
+
declare interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
354
|
+
locationHint?: string;
|
|
355
|
+
}
|
|
351
356
|
declare interface DurableObjectState {
|
|
352
|
-
waitUntil(promise:
|
|
357
|
+
waitUntil(promise: Promise<any>): void;
|
|
353
358
|
readonly id: DurableObjectId;
|
|
354
359
|
readonly storage: DurableObjectStorage;
|
|
355
360
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
@@ -539,7 +544,7 @@ declare interface SchedulerWaitOptions {
|
|
|
539
544
|
signal?: AbortSignal;
|
|
540
545
|
}
|
|
541
546
|
declare abstract class ExtendableEvent extends Event {
|
|
542
|
-
waitUntil(promise:
|
|
547
|
+
waitUntil(promise: Promise<any>): void;
|
|
543
548
|
}
|
|
544
549
|
declare class Blob {
|
|
545
550
|
constructor(
|
|
@@ -1009,7 +1014,6 @@ declare abstract class Fetcher {
|
|
|
1009
1014
|
input: RequestInfo,
|
|
1010
1015
|
init?: RequestInit<RequestInitCfProperties>
|
|
1011
1016
|
): Promise<Response>;
|
|
1012
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
1013
1017
|
}
|
|
1014
1018
|
declare interface FetcherPutOptions {
|
|
1015
1019
|
expiration?: number;
|
|
@@ -1156,6 +1160,19 @@ declare abstract class R2Bucket {
|
|
|
1156
1160
|
| Blob,
|
|
1157
1161
|
options?: R2PutOptions
|
|
1158
1162
|
): Promise<R2Object>;
|
|
1163
|
+
put(
|
|
1164
|
+
key: string,
|
|
1165
|
+
value:
|
|
1166
|
+
| ReadableStream
|
|
1167
|
+
| ArrayBuffer
|
|
1168
|
+
| ArrayBufferView
|
|
1169
|
+
| string
|
|
1170
|
+
| null
|
|
1171
|
+
| Blob,
|
|
1172
|
+
options?: R2PutOptions & {
|
|
1173
|
+
onlyIf: R2Conditional | Headers;
|
|
1174
|
+
}
|
|
1175
|
+
): Promise<R2Object | null>;
|
|
1159
1176
|
createMultipartUpload(
|
|
1160
1177
|
key: string,
|
|
1161
1178
|
options?: R2MultipartOptions
|
|
@@ -1539,6 +1556,8 @@ declare interface TraceItem {
|
|
|
1539
1556
|
| TraceItemFetchEventInfo
|
|
1540
1557
|
| TraceItemScheduledEventInfo
|
|
1541
1558
|
| TraceItemAlarmEventInfo
|
|
1559
|
+
| TraceItemQueueEventInfo
|
|
1560
|
+
| TraceItemEmailEventInfo
|
|
1542
1561
|
| TraceItemCustomEventInfo
|
|
1543
1562
|
)
|
|
1544
1563
|
| null;
|
|
@@ -1547,6 +1566,7 @@ declare interface TraceItem {
|
|
|
1547
1566
|
readonly exceptions: TraceException[];
|
|
1548
1567
|
readonly scriptName: string | null;
|
|
1549
1568
|
readonly dispatchNamespace?: string;
|
|
1569
|
+
readonly scriptTags?: string[];
|
|
1550
1570
|
readonly outcome: string;
|
|
1551
1571
|
}
|
|
1552
1572
|
declare interface TraceItemAlarmEventInfo {
|
|
@@ -1557,6 +1577,15 @@ declare interface TraceItemScheduledEventInfo {
|
|
|
1557
1577
|
readonly scheduledTime: number;
|
|
1558
1578
|
readonly cron: string;
|
|
1559
1579
|
}
|
|
1580
|
+
declare interface TraceItemQueueEventInfo {
|
|
1581
|
+
readonly queue: string;
|
|
1582
|
+
readonly batchSize: number;
|
|
1583
|
+
}
|
|
1584
|
+
declare interface TraceItemEmailEventInfo {
|
|
1585
|
+
readonly mailFrom: string;
|
|
1586
|
+
readonly rcptTo: string;
|
|
1587
|
+
readonly rawSize: number;
|
|
1588
|
+
}
|
|
1560
1589
|
declare interface TraceItemFetchEventInfo {
|
|
1561
1590
|
readonly response?: TraceItemFetchEventInfoResponse;
|
|
1562
1591
|
readonly request: TraceItemFetchEventInfoRequest;
|
|
@@ -1742,15 +1771,6 @@ declare const WebSocketPair: {
|
|
|
1742
1771
|
1: WebSocket;
|
|
1743
1772
|
};
|
|
1744
1773
|
};
|
|
1745
|
-
declare interface Socket {
|
|
1746
|
-
readonly readable: ReadableStream;
|
|
1747
|
-
readonly writable: WritableStream;
|
|
1748
|
-
readonly closed: Promise<void>;
|
|
1749
|
-
close(): Promise<void>;
|
|
1750
|
-
}
|
|
1751
|
-
declare interface SocketOptions {
|
|
1752
|
-
tsl: boolean;
|
|
1753
|
-
}
|
|
1754
1774
|
declare interface BasicImageTransformations {
|
|
1755
1775
|
/**
|
|
1756
1776
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2695,6 +2715,52 @@ declare abstract class D1PreparedStatement {
|
|
|
2695
2715
|
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2696
2716
|
raw<T = unknown>(): Promise<T[]>;
|
|
2697
2717
|
}
|
|
2718
|
+
/**
|
|
2719
|
+
* A email message that is sent to a consumer Worker.
|
|
2720
|
+
*/
|
|
2721
|
+
declare interface EmailMessage<Body = unknown> {
|
|
2722
|
+
/**
|
|
2723
|
+
* Envelope From attribute of the email message.
|
|
2724
|
+
*/
|
|
2725
|
+
readonly from: string;
|
|
2726
|
+
/**
|
|
2727
|
+
* Envelope To attribute of the email message.
|
|
2728
|
+
*/
|
|
2729
|
+
readonly to: string;
|
|
2730
|
+
/**
|
|
2731
|
+
* A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2732
|
+
*/
|
|
2733
|
+
readonly headers: Headers;
|
|
2734
|
+
/**
|
|
2735
|
+
* Stream of the email message content.
|
|
2736
|
+
*/
|
|
2737
|
+
readonly raw: ReadableStream;
|
|
2738
|
+
/**
|
|
2739
|
+
* Size of the email message content.
|
|
2740
|
+
*/
|
|
2741
|
+
readonly rawSize: number;
|
|
2742
|
+
/**
|
|
2743
|
+
* Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
|
|
2744
|
+
* @param reason The reject reason.
|
|
2745
|
+
* @returns void
|
|
2746
|
+
*/
|
|
2747
|
+
setReject(reason: string): void;
|
|
2748
|
+
/**
|
|
2749
|
+
* Forward this email message to a verified destination address of the account.
|
|
2750
|
+
* @param rcptTo Verified destination address.
|
|
2751
|
+
* @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2752
|
+
* @returns A promise that resolves when the email message is forwarded.
|
|
2753
|
+
*/
|
|
2754
|
+
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2755
|
+
}
|
|
2756
|
+
declare abstract class EmailEvent extends ExtendableEvent {
|
|
2757
|
+
readonly message: EmailMessage;
|
|
2758
|
+
}
|
|
2759
|
+
declare type EmailExportedHandler<Env = unknown> = (
|
|
2760
|
+
message: EmailMessage,
|
|
2761
|
+
env: Env,
|
|
2762
|
+
ctx: ExecutionContext
|
|
2763
|
+
) => void | Promise<void>;
|
|
2698
2764
|
declare type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2699
2765
|
declare type EventContext<Env, P extends string, Data> = {
|
|
2700
2766
|
request: Request;
|
|
@@ -2741,6 +2807,40 @@ declare type PagesPluginFunction<
|
|
|
2741
2807
|
declare module "assets:*" {
|
|
2742
2808
|
export const onRequest: PagesFunction;
|
|
2743
2809
|
}
|
|
2810
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
2811
|
+
// PubSubMessage represents an incoming PubSub message.
|
|
2812
|
+
// The message includes metadata about the broker, the client, and the payload
|
|
2813
|
+
// itself.
|
|
2814
|
+
declare interface PubSubMessage {
|
|
2815
|
+
// Message ID
|
|
2816
|
+
readonly mid: number;
|
|
2817
|
+
// MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
|
|
2818
|
+
readonly broker: string;
|
|
2819
|
+
// The MQTT topic the message was sent on.
|
|
2820
|
+
readonly topic: string;
|
|
2821
|
+
// The client ID of the client that published this message.
|
|
2822
|
+
readonly clientId: string;
|
|
2823
|
+
// The unique identifier (JWT ID) used by the client to authenticate, if token
|
|
2824
|
+
// auth was used.
|
|
2825
|
+
readonly jti?: string;
|
|
2826
|
+
// A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
|
|
2827
|
+
// received the message from the client.
|
|
2828
|
+
readonly receivedAt: number;
|
|
2829
|
+
// An (optional) string with the MIME type of the payload, if set by the
|
|
2830
|
+
// client.
|
|
2831
|
+
readonly contentType: string;
|
|
2832
|
+
// Set to 1 when the payload is a UTF-8 string
|
|
2833
|
+
// https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
|
|
2834
|
+
readonly payloadFormatIndicator: number;
|
|
2835
|
+
// Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
|
|
2836
|
+
// You can use payloadFormatIndicator to inspect this before decoding.
|
|
2837
|
+
payload: string | Uint8Array;
|
|
2838
|
+
}
|
|
2839
|
+
// JsonWebKey extended by kid parameter
|
|
2840
|
+
declare interface JsonWebKeyWithKid extends JsonWebKey {
|
|
2841
|
+
// Key Identifier of the JWK
|
|
2842
|
+
readonly kid: string;
|
|
2843
|
+
}
|
|
2744
2844
|
/**
|
|
2745
2845
|
* A message that is sent to a consumer Worker.
|
|
2746
2846
|
*/
|
|
@@ -2775,6 +2875,15 @@ declare interface MessageBatch<Body = unknown> {
|
|
|
2775
2875
|
*/
|
|
2776
2876
|
retryAll(): void;
|
|
2777
2877
|
}
|
|
2878
|
+
/**
|
|
2879
|
+
* A wrapper class used to structure message batches.
|
|
2880
|
+
*/
|
|
2881
|
+
declare type MessageSendRequest<Body = unknown> = {
|
|
2882
|
+
/**
|
|
2883
|
+
* The body of the message.
|
|
2884
|
+
*/
|
|
2885
|
+
body: Body;
|
|
2886
|
+
};
|
|
2778
2887
|
/**
|
|
2779
2888
|
* A binding that allows a producer to send messages to a Queue.
|
|
2780
2889
|
*/
|
|
@@ -2785,4 +2894,10 @@ declare interface Queue<Body = any> {
|
|
|
2785
2894
|
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2786
2895
|
*/
|
|
2787
2896
|
send(message: Body): Promise<void>;
|
|
2897
|
+
/**
|
|
2898
|
+
* Sends a batch of messages to the Queue.
|
|
2899
|
+
* @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.
|
|
2900
|
+
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2901
|
+
*/
|
|
2902
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2788
2903
|
}
|
package/2022-03-21/index.ts
CHANGED
|
@@ -229,7 +229,6 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
229
229
|
FixedLengthStream: typeof FixedLengthStream;
|
|
230
230
|
IdentityTransformStream: typeof IdentityTransformStream;
|
|
231
231
|
HTMLRewriter: typeof HTMLRewriter;
|
|
232
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
233
232
|
}
|
|
234
233
|
export declare function addEventListener<
|
|
235
234
|
Type extends keyof WorkerGlobalScopeEventMap
|
|
@@ -285,12 +284,8 @@ export declare const crypto: Crypto;
|
|
|
285
284
|
export declare const caches: CacheStorage;
|
|
286
285
|
export declare const scheduler: Scheduler;
|
|
287
286
|
export declare const navigator: Navigator;
|
|
288
|
-
export declare function connect(
|
|
289
|
-
address: string,
|
|
290
|
-
options?: SocketOptions
|
|
291
|
-
): Socket;
|
|
292
287
|
export interface ExecutionContext {
|
|
293
|
-
waitUntil(promise:
|
|
288
|
+
waitUntil(promise: Promise<any>): void;
|
|
294
289
|
passThroughOnException(): void;
|
|
295
290
|
}
|
|
296
291
|
export type ExportedHandlerFetchHandler<Env = unknown> = (
|
|
@@ -348,13 +343,20 @@ export interface DurableObjectNamespace {
|
|
|
348
343
|
): DurableObjectId;
|
|
349
344
|
idFromName(name: string): DurableObjectId;
|
|
350
345
|
idFromString(id: string): DurableObjectId;
|
|
351
|
-
get(
|
|
346
|
+
get(
|
|
347
|
+
id: DurableObjectId,
|
|
348
|
+
options?: DurableObjectNamespaceGetDurableObjectOptions
|
|
349
|
+
): DurableObjectStub;
|
|
350
|
+
jurisdiction(jurisdiction: string): DurableObjectNamespace;
|
|
352
351
|
}
|
|
353
352
|
export interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
354
353
|
jurisdiction?: string;
|
|
355
354
|
}
|
|
355
|
+
export interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
356
|
+
locationHint?: string;
|
|
357
|
+
}
|
|
356
358
|
export interface DurableObjectState {
|
|
357
|
-
waitUntil(promise:
|
|
359
|
+
waitUntil(promise: Promise<any>): void;
|
|
358
360
|
readonly id: DurableObjectId;
|
|
359
361
|
readonly storage: DurableObjectStorage;
|
|
360
362
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
@@ -544,7 +546,7 @@ export interface SchedulerWaitOptions {
|
|
|
544
546
|
signal?: AbortSignal;
|
|
545
547
|
}
|
|
546
548
|
export declare abstract class ExtendableEvent extends Event {
|
|
547
|
-
waitUntil(promise:
|
|
549
|
+
waitUntil(promise: Promise<any>): void;
|
|
548
550
|
}
|
|
549
551
|
export declare class Blob {
|
|
550
552
|
constructor(
|
|
@@ -1014,7 +1016,6 @@ export declare abstract class Fetcher {
|
|
|
1014
1016
|
input: RequestInfo,
|
|
1015
1017
|
init?: RequestInit<RequestInitCfProperties>
|
|
1016
1018
|
): Promise<Response>;
|
|
1017
|
-
connect(address: string, options?: SocketOptions): Socket;
|
|
1018
1019
|
}
|
|
1019
1020
|
export interface FetcherPutOptions {
|
|
1020
1021
|
expiration?: number;
|
|
@@ -1161,6 +1162,19 @@ export declare abstract class R2Bucket {
|
|
|
1161
1162
|
| Blob,
|
|
1162
1163
|
options?: R2PutOptions
|
|
1163
1164
|
): Promise<R2Object>;
|
|
1165
|
+
put(
|
|
1166
|
+
key: string,
|
|
1167
|
+
value:
|
|
1168
|
+
| ReadableStream
|
|
1169
|
+
| ArrayBuffer
|
|
1170
|
+
| ArrayBufferView
|
|
1171
|
+
| string
|
|
1172
|
+
| null
|
|
1173
|
+
| Blob,
|
|
1174
|
+
options?: R2PutOptions & {
|
|
1175
|
+
onlyIf: R2Conditional | Headers;
|
|
1176
|
+
}
|
|
1177
|
+
): Promise<R2Object | null>;
|
|
1164
1178
|
createMultipartUpload(
|
|
1165
1179
|
key: string,
|
|
1166
1180
|
options?: R2MultipartOptions
|
|
@@ -1547,6 +1561,8 @@ export interface TraceItem {
|
|
|
1547
1561
|
| TraceItemFetchEventInfo
|
|
1548
1562
|
| TraceItemScheduledEventInfo
|
|
1549
1563
|
| TraceItemAlarmEventInfo
|
|
1564
|
+
| TraceItemQueueEventInfo
|
|
1565
|
+
| TraceItemEmailEventInfo
|
|
1550
1566
|
| TraceItemCustomEventInfo
|
|
1551
1567
|
)
|
|
1552
1568
|
| null;
|
|
@@ -1555,6 +1571,7 @@ export interface TraceItem {
|
|
|
1555
1571
|
readonly exceptions: TraceException[];
|
|
1556
1572
|
readonly scriptName: string | null;
|
|
1557
1573
|
readonly dispatchNamespace?: string;
|
|
1574
|
+
readonly scriptTags?: string[];
|
|
1558
1575
|
readonly outcome: string;
|
|
1559
1576
|
}
|
|
1560
1577
|
export interface TraceItemAlarmEventInfo {
|
|
@@ -1565,6 +1582,15 @@ export interface TraceItemScheduledEventInfo {
|
|
|
1565
1582
|
readonly scheduledTime: number;
|
|
1566
1583
|
readonly cron: string;
|
|
1567
1584
|
}
|
|
1585
|
+
export interface TraceItemQueueEventInfo {
|
|
1586
|
+
readonly queue: string;
|
|
1587
|
+
readonly batchSize: number;
|
|
1588
|
+
}
|
|
1589
|
+
export interface TraceItemEmailEventInfo {
|
|
1590
|
+
readonly mailFrom: string;
|
|
1591
|
+
readonly rcptTo: string;
|
|
1592
|
+
readonly rawSize: number;
|
|
1593
|
+
}
|
|
1568
1594
|
export interface TraceItemFetchEventInfo {
|
|
1569
1595
|
readonly response?: TraceItemFetchEventInfoResponse;
|
|
1570
1596
|
readonly request: TraceItemFetchEventInfoRequest;
|
|
@@ -1750,15 +1776,6 @@ export declare const WebSocketPair: {
|
|
|
1750
1776
|
1: WebSocket;
|
|
1751
1777
|
};
|
|
1752
1778
|
};
|
|
1753
|
-
export interface Socket {
|
|
1754
|
-
readonly readable: ReadableStream;
|
|
1755
|
-
readonly writable: WritableStream;
|
|
1756
|
-
readonly closed: Promise<void>;
|
|
1757
|
-
close(): Promise<void>;
|
|
1758
|
-
}
|
|
1759
|
-
export interface SocketOptions {
|
|
1760
|
-
tsl: boolean;
|
|
1761
|
-
}
|
|
1762
1779
|
export interface BasicImageTransformations {
|
|
1763
1780
|
/**
|
|
1764
1781
|
* Maximum width in image pixels. The value must be an integer.
|
|
@@ -2703,6 +2720,52 @@ export declare abstract class D1PreparedStatement {
|
|
|
2703
2720
|
all<T = unknown>(): Promise<D1Result<T>>;
|
|
2704
2721
|
raw<T = unknown>(): Promise<T[]>;
|
|
2705
2722
|
}
|
|
2723
|
+
/**
|
|
2724
|
+
* A email message that is sent to a consumer Worker.
|
|
2725
|
+
*/
|
|
2726
|
+
export interface EmailMessage<Body = unknown> {
|
|
2727
|
+
/**
|
|
2728
|
+
* Envelope From attribute of the email message.
|
|
2729
|
+
*/
|
|
2730
|
+
readonly from: string;
|
|
2731
|
+
/**
|
|
2732
|
+
* Envelope To attribute of the email message.
|
|
2733
|
+
*/
|
|
2734
|
+
readonly to: string;
|
|
2735
|
+
/**
|
|
2736
|
+
* A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2737
|
+
*/
|
|
2738
|
+
readonly headers: Headers;
|
|
2739
|
+
/**
|
|
2740
|
+
* Stream of the email message content.
|
|
2741
|
+
*/
|
|
2742
|
+
readonly raw: ReadableStream;
|
|
2743
|
+
/**
|
|
2744
|
+
* Size of the email message content.
|
|
2745
|
+
*/
|
|
2746
|
+
readonly rawSize: number;
|
|
2747
|
+
/**
|
|
2748
|
+
* Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
|
|
2749
|
+
* @param reason The reject reason.
|
|
2750
|
+
* @returns void
|
|
2751
|
+
*/
|
|
2752
|
+
setReject(reason: string): void;
|
|
2753
|
+
/**
|
|
2754
|
+
* Forward this email message to a verified destination address of the account.
|
|
2755
|
+
* @param rcptTo Verified destination address.
|
|
2756
|
+
* @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
|
|
2757
|
+
* @returns A promise that resolves when the email message is forwarded.
|
|
2758
|
+
*/
|
|
2759
|
+
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
2760
|
+
}
|
|
2761
|
+
export declare abstract class EmailEvent extends ExtendableEvent {
|
|
2762
|
+
readonly message: EmailMessage;
|
|
2763
|
+
}
|
|
2764
|
+
export type EmailExportedHandler<Env = unknown> = (
|
|
2765
|
+
message: EmailMessage,
|
|
2766
|
+
env: Env,
|
|
2767
|
+
ctx: ExecutionContext
|
|
2768
|
+
) => void | Promise<void>;
|
|
2706
2769
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
2707
2770
|
export type EventContext<Env, P extends string, Data> = {
|
|
2708
2771
|
request: Request;
|
|
@@ -2746,6 +2809,40 @@ export type PagesPluginFunction<
|
|
|
2746
2809
|
> = (
|
|
2747
2810
|
context: EventPluginContext<Env, Params, Data, PluginArgs>
|
|
2748
2811
|
) => Response | Promise<Response>;
|
|
2812
|
+
// https://developers.cloudflare.com/pub-sub/
|
|
2813
|
+
// PubSubMessage represents an incoming PubSub message.
|
|
2814
|
+
// The message includes metadata about the broker, the client, and the payload
|
|
2815
|
+
// itself.
|
|
2816
|
+
export interface PubSubMessage {
|
|
2817
|
+
// Message ID
|
|
2818
|
+
readonly mid: number;
|
|
2819
|
+
// MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT
|
|
2820
|
+
readonly broker: string;
|
|
2821
|
+
// The MQTT topic the message was sent on.
|
|
2822
|
+
readonly topic: string;
|
|
2823
|
+
// The client ID of the client that published this message.
|
|
2824
|
+
readonly clientId: string;
|
|
2825
|
+
// The unique identifier (JWT ID) used by the client to authenticate, if token
|
|
2826
|
+
// auth was used.
|
|
2827
|
+
readonly jti?: string;
|
|
2828
|
+
// A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker
|
|
2829
|
+
// received the message from the client.
|
|
2830
|
+
readonly receivedAt: number;
|
|
2831
|
+
// An (optional) string with the MIME type of the payload, if set by the
|
|
2832
|
+
// client.
|
|
2833
|
+
readonly contentType: string;
|
|
2834
|
+
// Set to 1 when the payload is a UTF-8 string
|
|
2835
|
+
// https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063
|
|
2836
|
+
readonly payloadFormatIndicator: number;
|
|
2837
|
+
// Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.
|
|
2838
|
+
// You can use payloadFormatIndicator to inspect this before decoding.
|
|
2839
|
+
payload: string | Uint8Array;
|
|
2840
|
+
}
|
|
2841
|
+
// JsonWebKey extended by kid parameter
|
|
2842
|
+
export interface JsonWebKeyWithKid extends JsonWebKey {
|
|
2843
|
+
// Key Identifier of the JWK
|
|
2844
|
+
readonly kid: string;
|
|
2845
|
+
}
|
|
2749
2846
|
/**
|
|
2750
2847
|
* A message that is sent to a consumer Worker.
|
|
2751
2848
|
*/
|
|
@@ -2780,6 +2877,15 @@ export interface MessageBatch<Body = unknown> {
|
|
|
2780
2877
|
*/
|
|
2781
2878
|
retryAll(): void;
|
|
2782
2879
|
}
|
|
2880
|
+
/**
|
|
2881
|
+
* A wrapper class used to structure message batches.
|
|
2882
|
+
*/
|
|
2883
|
+
export type MessageSendRequest<Body = unknown> = {
|
|
2884
|
+
/**
|
|
2885
|
+
* The body of the message.
|
|
2886
|
+
*/
|
|
2887
|
+
body: Body;
|
|
2888
|
+
};
|
|
2783
2889
|
/**
|
|
2784
2890
|
* A binding that allows a producer to send messages to a Queue.
|
|
2785
2891
|
*/
|
|
@@ -2790,4 +2896,10 @@ export interface Queue<Body = any> {
|
|
|
2790
2896
|
* @returns A promise that resolves when the message is confirmed to be written to disk.
|
|
2791
2897
|
*/
|
|
2792
2898
|
send(message: Body): Promise<void>;
|
|
2899
|
+
/**
|
|
2900
|
+
* Sends a batch of messages to the Queue.
|
|
2901
|
+
* @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.
|
|
2902
|
+
* @returns A promise that resolves when the messages are confirmed to be written to disk.
|
|
2903
|
+
*/
|
|
2904
|
+
sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
|
|
2793
2905
|
}
|