@cloudflare/workers-types 4.20221111.1 → 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/README.md CHANGED
@@ -30,33 +30,43 @@ The following is a minimal `tsconfig.json` for use alongside this package:
30
30
 
31
31
  ### Compatibility dates
32
32
 
33
- The Cloudflare Workers runtime manages backwards compatibility through the use of [Compatibility Dates](https://developers.cloudflare.com/workers/platform/compatibility-dates/). Using different compatibility dates affects the runtime types available to your Worker, and so it's important you specify the correct entrypoint to the `workers-types` package to match your compatibility date (which is usually set in your `wrangler.toml` configuration file). `workers-types` currently exposes 7 entrypoints to choose from:
33
+ ![Entrypoints for compatibility dates](./entrypoints.svg)
34
+
35
+ The Cloudflare Workers runtime manages backwards compatibility through the use of [Compatibility Dates](https://developers.cloudflare.com/workers/platform/compatibility-dates/). Using different compatibility dates affects the runtime types available to your Worker, and so it's important you specify the correct entrypoint to the `workers-types` package to match your compatibility date (which is usually set in your `wrangler.toml` configuration file). `workers-types` currently exposes the following entrypoints to choose from:
34
36
 
35
37
  - `@cloudflare/workers-types`
36
38
 
37
- The default entrypoint exposes the runtime types for a compatibility date of `2021-01-01` or before.
39
+ The default entrypoint exposes the runtime types for a compatibility date before `2021-11-03`.
38
40
 
39
41
  - `@cloudflare/workers-types/2021-11-03`
40
42
 
41
- This entrypoint exposes the runtime types for a compatibility date between `2021-01-01` and `2021-11-03`.
43
+ This entrypoint exposes the runtime types for a compatibility date between `2021-11-03` and `2022-01-31`.
42
44
 
43
45
  - `@cloudflare/workers-types/2022-01-31`
44
46
 
45
- This entrypoint exposes the runtime types for a compatibility date between `2021-11-03` and `2022-01-31`.
47
+ This entrypoint exposes the runtime types for a compatibility date between `2022-01-31` and `2022-03-21`.
46
48
 
47
49
  - `@cloudflare/workers-types/2022-03-21`
48
50
 
49
- This entrypoint exposes the runtime types for a compatibility date between `2022-01-31` and `2022-03-21`.
51
+ This entrypoint exposes the runtime types for a compatibility date between `2022-03-21` and `2022-08-04`.
50
52
 
51
53
  - `@cloudflare/workers-types/2022-08-04`
52
54
 
53
- This entrypoint exposes the runtime types for a compatibility date between `2022-03-21` and `2022-08-04`.
55
+ This entrypoint exposes the runtime types for a compatibility date between `2022-08-04` and `2022-10-31`.
56
+
57
+ - `@cloudflare/workers-types/2022-10-31`
58
+
59
+ This entrypoint exposes the runtime types for a compatibility date between `2022-10-31` and `2022-11-30`.
60
+
61
+ - `@cloudflare/workers-types/2022-11-30`
62
+
63
+ This entrypoint exposes the runtime types for a compatibility date after `2022-11-30`.
54
64
 
55
65
  - `@cloudflare/workers-types/experimental`
56
66
 
57
67
  This entrypoint exposes the runtime types for the latest compatibility date. The types exposed by this entrypoint will change over time to always reflect the latest version of the Workers runtime.
58
68
 
59
- To use one of these entrypoints, you need to specify them in your `tsconfig.json`. For example, this is a sample `tsconfig.json` for using the `experimental` entrypoint.
69
+ To use one of these entrypoints, you need to specify them in your `tsconfig.json`. For example, this is a sample `tsconfig.json` for using the `2022-08-04` entrypoint.
60
70
 
61
71
  ```json
62
72
  {
@@ -64,7 +74,7 @@ To use one of these entrypoints, you need to specify them in your `tsconfig.json
64
74
  "target": "esnext",
65
75
  "module": "esnext",
66
76
  "lib": ["esnext"],
67
- "types": ["@cloudflare/workers-types/experimental"]
77
+ "types": ["@cloudflare/workers-types/2022-08-04"]
68
78
  }
69
79
  }
70
80
  ```
@@ -0,0 +1,53 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <svg viewBox="0 0 540 280" width="540px" height="280px" xmlns="http://www.w3.org/2000/svg">
3
+ <rect width="540" height="280" style="fill: rgb(255, 255, 255);"/>
4
+ <g transform="matrix(1, 0, 0, 1, 61.018997, -319.418854)">
5
+ <rect x="128.981" y="349.42" width="340" height="30" style="fill: rgb(238, 238, 238);"/>
6
+ <text style="font-family: monospace; font-size: 14px; white-space: pre;" x="135.709" y="369.298">@cloudflare/workers-types</text>
7
+ </g>
8
+ <g transform="matrix(1, 0, 0, 1, 61.018997, -289.418793)">
9
+ <rect x="128.981" y="349.42" width="340" height="30" style="fill: rgb(221, 221, 221);"/>
10
+ <text style="font-family: monospace; font-size: 14px; white-space: pre;"><tspan x="135.709" y="369.298">@cloudflare/workers-types/</tspan><tspan style="fill: rgb(0, 85, 220); font-weight: 700;">2021-11-03</tspan></text>
11
+ </g>
12
+ <g transform="matrix(1, 0, 0, 1, 61.018997, -259.418793)">
13
+ <rect x="128.981" y="349.42" width="340" height="30" style="fill: rgb(238, 238, 238);"/>
14
+ <text style="font-family: monospace; font-size: 14px; white-space: pre;"><tspan x="135.709" y="369.298">@cloudflare/workers-types/</tspan><tspan style="fill: rgb(0, 54, 130); font-weight: 700;">2022-01-31</tspan></text>
15
+ </g>
16
+ <g transform="matrix(1, 0, 0, 1, 61.018997, -229.418869)">
17
+ <rect x="128.981" y="349.42" width="340" height="30" style="fill: rgb(221, 221, 221);"/>
18
+ <text style="font-family: monospace; font-size: 14px; white-space: pre;"><tspan x="135.709" y="369.298">@cloudflare/workers-types/</tspan><tspan style="fill: rgb(0, 85, 220); font-weight: 700;">2022-03-21</tspan></text>
19
+ </g>
20
+ <g transform="matrix(1, 0, 0, 1, 61.018997, -199.418839)">
21
+ <rect x="128.981" y="349.42" width="340" height="30" style="fill: rgb(238, 238, 238);"/>
22
+ <text style="font-family: monospace; font-size: 14px; white-space: pre;"><tspan x="135.709" y="369.298">@cloudflare/workers-types/</tspan><tspan style="fill: rgb(0, 54, 130); font-weight: 700;">2022-08-04</tspan></text>
23
+ </g>
24
+ <g transform="matrix(1, 0, 0, 1, 61.018997, -169.418839)">
25
+ <rect x="128.981" y="349.42" width="340" height="30" style="fill: rgb(221, 221, 221);"/>
26
+ <text style="font-family: monospace; font-size: 14px; white-space: pre;"><tspan x="135.709" y="369.298">@cloudflare/workers-types/</tspan><tspan style="fill: rgb(0, 85, 220); font-weight: 700;">2022-10-31</tspan></text>
27
+ </g>
28
+ <g transform="matrix(1, 0, 0, 1, 61.017925, -139.418854)">
29
+ <rect x="128.981" y="349.42" width="340" height="30" style="fill: rgb(238, 238, 238);"/>
30
+ <text style="font-family: monospace; font-size: 14px; white-space: pre;"><tspan x="135.709" y="369.298">@cloudflare/workers-types/</tspan><tspan style="fill: rgb(0, 54, 130); font-weight: 700;">2022-11-30</tspan></text>
31
+ </g>
32
+ <g transform="matrix(1, 0, 0, 1, 61.017925, -109.418816)">
33
+ <rect x="128.981" y="349.42" width="340" height="30" style="fill: rgb(221, 221, 221);"/>
34
+ <text style="font-family: monospace; font-size: 14px; white-space: pre;" x="135.709" y="369.298">@cloudflare/workers-types/experimental</text>
35
+ </g>
36
+ <line style="fill: rgb(216, 216, 216); stroke: rgb(0, 0, 0);" x1="160" y1="60" x2="190" y2="60"/>
37
+ <line style="fill: rgb(216, 216, 216); stroke: rgb(0, 0, 0);" x1="160" y1="90" x2="190" y2="90"/>
38
+ <line style="fill: rgb(216, 216, 216); stroke: rgb(0, 0, 0);" x1="160" y1="120" x2="190" y2="120"/>
39
+ <line style="fill: rgb(216, 216, 216); stroke: rgb(0, 0, 0);" x1="160" y1="150" x2="190" y2="150"/>
40
+ <line style="fill: rgb(216, 216, 216); stroke: rgb(0, 0, 0);" x1="160" y1="180" x2="190" y2="180"/>
41
+ <line style="fill: rgb(216, 216, 216); stroke: rgb(0, 0, 0);" x1="160" y1="210" x2="190" y2="210"/>
42
+ <line style="fill: rgb(216, 216, 216); stroke: rgb(0, 0, 0);" x1="175" y1="60" x2="175" y2="240"/>
43
+ <line style="fill: rgb(216, 216, 216); stroke: rgb(0, 0, 0); stroke-dasharray: 2px;" x1="175" y1="30" x2="175" y2="60"/>
44
+ <line style="fill: rgb(216, 216, 216); stroke: rgb(0, 0, 0); stroke-dasharray: 2px;" x1="175" y1="240" x2="175" y2="270"/>
45
+ <text style="fill: rgb(51, 51, 51); font-family: monospace; font-size: 14px; font-weight: 700; text-anchor: middle; white-space: pre;" transform="matrix(1, 0, 0, 1, 307.347992, -77.253761)"><tspan x="52.652" y="98.052">types Entrypoint</tspan></text>
46
+ <text style="fill: rgb(51, 51, 51); font-family: monospace; font-size: 14px; font-weight: 700; text-anchor: end; white-space: pre;" x="157.185" y="20.798">compatibility_date</text>
47
+ <text style="fill: rgb(0, 85, 220); font-family: monospace; font-size: 14px; font-weight: 700; text-anchor: end; white-space: pre;" x="153.994" y="64.798">2021-11-03</text>
48
+ <text style="fill: rgb(0, 54, 130); font-family: monospace; font-size: 14px; font-weight: 700; text-anchor: end; white-space: pre;" x="153.994" y="94.798">2022-01-31</text>
49
+ <text style="fill: rgb(0, 85, 220); font-family: monospace; font-size: 14px; font-weight: 700; text-anchor: end; white-space: pre;" x="153.994" y="124.798">2022-03-21</text>
50
+ <text style="fill: rgb(0, 54, 130); font-family: monospace; font-size: 14px; font-weight: 700; text-anchor: end; white-space: pre;" x="153.994" y="154.798">2022-08-04</text>
51
+ <text style="fill: rgb(0, 85, 220); font-family: monospace; font-size: 14px; font-weight: 700; text-anchor: end; white-space: pre;" x="153.994" y="184.798">2022-10-31</text>
52
+ <text style="fill: rgb(0, 54, 130); font-family: monospace; font-size: 14px; font-weight: 700; text-anchor: end; white-space: pre;" x="153.994" y="214.798">2022-11-30</text>
53
+ </svg>
@@ -233,7 +233,6 @@ declare interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
233
233
  FixedLengthStream: typeof FixedLengthStream;
234
234
  IdentityTransformStream: typeof IdentityTransformStream;
235
235
  HTMLRewriter: typeof HTMLRewriter;
236
- connect(address: string, options?: SocketOptions): Socket;
237
236
  }
238
237
  declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
239
238
  type: Type,
@@ -287,9 +286,8 @@ declare const crypto: Crypto;
287
286
  declare const caches: CacheStorage;
288
287
  declare const scheduler: Scheduler;
289
288
  declare const navigator: Navigator;
290
- declare function connect(address: string, options?: SocketOptions): Socket;
291
289
  declare interface ExecutionContext {
292
- waitUntil(promise: void | Promise<void>): void;
290
+ waitUntil(promise: Promise<any>): void;
293
291
  passThroughOnException(): void;
294
292
  }
295
293
  declare type ExportedHandlerFetchHandler<Env = unknown> = (
@@ -347,13 +345,20 @@ declare interface DurableObjectNamespace {
347
345
  ): DurableObjectId;
348
346
  idFromName(name: string): DurableObjectId;
349
347
  idFromString(id: string): DurableObjectId;
350
- get(id: DurableObjectId): DurableObjectStub;
348
+ get(
349
+ id: DurableObjectId,
350
+ options?: DurableObjectNamespaceGetDurableObjectOptions
351
+ ): DurableObjectStub;
352
+ jurisdiction(jurisdiction: string): DurableObjectNamespace;
351
353
  }
352
354
  declare interface DurableObjectNamespaceNewUniqueIdOptions {
353
355
  jurisdiction?: string;
354
356
  }
357
+ declare interface DurableObjectNamespaceGetDurableObjectOptions {
358
+ locationHint?: string;
359
+ }
355
360
  declare interface DurableObjectState {
356
- waitUntil(promise: void | Promise<void>): void;
361
+ waitUntil(promise: Promise<any>): void;
357
362
  readonly id: DurableObjectId;
358
363
  readonly storage: DurableObjectStorage;
359
364
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
@@ -543,7 +548,7 @@ declare interface SchedulerWaitOptions {
543
548
  signal?: AbortSignal;
544
549
  }
545
550
  declare abstract class ExtendableEvent extends Event {
546
- waitUntil(promise: void | Promise<void>): void;
551
+ waitUntil(promise: Promise<any>): void;
547
552
  }
548
553
  declare class Blob {
549
554
  constructor(
@@ -1013,7 +1018,6 @@ declare abstract class Fetcher {
1013
1018
  input: RequestInfo,
1014
1019
  init?: RequestInit<RequestInitCfProperties>
1015
1020
  ): Promise<Response>;
1016
- connect(address: string, options?: SocketOptions): Socket;
1017
1021
  }
1018
1022
  declare interface FetcherPutOptions {
1019
1023
  expiration?: number;
@@ -1161,6 +1165,19 @@ declare abstract class R2Bucket {
1161
1165
  | Blob,
1162
1166
  options?: R2PutOptions
1163
1167
  ): Promise<R2Object>;
1168
+ put(
1169
+ key: string,
1170
+ value:
1171
+ | ReadableStream
1172
+ | ArrayBuffer
1173
+ | ArrayBufferView
1174
+ | string
1175
+ | null
1176
+ | Blob,
1177
+ options?: R2PutOptions & {
1178
+ onlyIf: R2Conditional | Headers;
1179
+ }
1180
+ ): Promise<R2Object | null>;
1164
1181
  createMultipartUpload(
1165
1182
  key: string,
1166
1183
  options?: R2MultipartOptions
@@ -1543,6 +1560,8 @@ declare interface TraceItem {
1543
1560
  | TraceItemFetchEventInfo
1544
1561
  | TraceItemScheduledEventInfo
1545
1562
  | TraceItemAlarmEventInfo
1563
+ | TraceItemQueueEventInfo
1564
+ | TraceItemEmailEventInfo
1546
1565
  | TraceItemCustomEventInfo
1547
1566
  )
1548
1567
  | null;
@@ -1551,6 +1570,7 @@ declare interface TraceItem {
1551
1570
  readonly exceptions: TraceException[];
1552
1571
  readonly scriptName: string | null;
1553
1572
  readonly dispatchNamespace?: string;
1573
+ readonly scriptTags?: string[];
1554
1574
  readonly outcome: string;
1555
1575
  }
1556
1576
  declare interface TraceItemAlarmEventInfo {
@@ -1561,6 +1581,15 @@ declare interface TraceItemScheduledEventInfo {
1561
1581
  readonly scheduledTime: number;
1562
1582
  readonly cron: string;
1563
1583
  }
1584
+ declare interface TraceItemQueueEventInfo {
1585
+ readonly queue: string;
1586
+ readonly batchSize: number;
1587
+ }
1588
+ declare interface TraceItemEmailEventInfo {
1589
+ readonly mailFrom: string;
1590
+ readonly rcptTo: string;
1591
+ readonly rawSize: number;
1592
+ }
1564
1593
  declare interface TraceItemFetchEventInfo {
1565
1594
  readonly response?: TraceItemFetchEventInfoResponse;
1566
1595
  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
  }
@@ -233,7 +233,6 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
233
233
  FixedLengthStream: typeof FixedLengthStream;
234
234
  IdentityTransformStream: typeof IdentityTransformStream;
235
235
  HTMLRewriter: typeof HTMLRewriter;
236
- connect(address: string, options?: SocketOptions): Socket;
237
236
  }
238
237
  export declare function addEventListener<
239
238
  Type extends keyof WorkerGlobalScopeEventMap
@@ -289,12 +288,8 @@ export declare const crypto: Crypto;
289
288
  export declare const caches: CacheStorage;
290
289
  export declare const scheduler: Scheduler;
291
290
  export declare const navigator: Navigator;
292
- export declare function connect(
293
- address: string,
294
- options?: SocketOptions
295
- ): Socket;
296
291
  export interface ExecutionContext {
297
- waitUntil(promise: void | Promise<void>): void;
292
+ waitUntil(promise: Promise<any>): void;
298
293
  passThroughOnException(): void;
299
294
  }
300
295
  export type ExportedHandlerFetchHandler<Env = unknown> = (
@@ -352,13 +347,20 @@ export interface DurableObjectNamespace {
352
347
  ): DurableObjectId;
353
348
  idFromName(name: string): DurableObjectId;
354
349
  idFromString(id: string): DurableObjectId;
355
- get(id: DurableObjectId): DurableObjectStub;
350
+ get(
351
+ id: DurableObjectId,
352
+ options?: DurableObjectNamespaceGetDurableObjectOptions
353
+ ): DurableObjectStub;
354
+ jurisdiction(jurisdiction: string): DurableObjectNamespace;
356
355
  }
357
356
  export interface DurableObjectNamespaceNewUniqueIdOptions {
358
357
  jurisdiction?: string;
359
358
  }
359
+ export interface DurableObjectNamespaceGetDurableObjectOptions {
360
+ locationHint?: string;
361
+ }
360
362
  export interface DurableObjectState {
361
- waitUntil(promise: void | Promise<void>): void;
363
+ waitUntil(promise: Promise<any>): void;
362
364
  readonly id: DurableObjectId;
363
365
  readonly storage: DurableObjectStorage;
364
366
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
@@ -548,7 +550,7 @@ export interface SchedulerWaitOptions {
548
550
  signal?: AbortSignal;
549
551
  }
550
552
  export declare abstract class ExtendableEvent extends Event {
551
- waitUntil(promise: void | Promise<void>): void;
553
+ waitUntil(promise: Promise<any>): void;
552
554
  }
553
555
  export declare class Blob {
554
556
  constructor(
@@ -1018,7 +1020,6 @@ export declare abstract class Fetcher {
1018
1020
  input: RequestInfo,
1019
1021
  init?: RequestInit<RequestInitCfProperties>
1020
1022
  ): Promise<Response>;
1021
- connect(address: string, options?: SocketOptions): Socket;
1022
1023
  }
1023
1024
  export interface FetcherPutOptions {
1024
1025
  expiration?: number;
@@ -1166,6 +1167,19 @@ export declare abstract class R2Bucket {
1166
1167
  | Blob,
1167
1168
  options?: R2PutOptions
1168
1169
  ): Promise<R2Object>;
1170
+ put(
1171
+ key: string,
1172
+ value:
1173
+ | ReadableStream
1174
+ | ArrayBuffer
1175
+ | ArrayBufferView
1176
+ | string
1177
+ | null
1178
+ | Blob,
1179
+ options?: R2PutOptions & {
1180
+ onlyIf: R2Conditional | Headers;
1181
+ }
1182
+ ): Promise<R2Object | null>;
1169
1183
  createMultipartUpload(
1170
1184
  key: string,
1171
1185
  options?: R2MultipartOptions
@@ -1551,6 +1565,8 @@ export interface TraceItem {
1551
1565
  | TraceItemFetchEventInfo
1552
1566
  | TraceItemScheduledEventInfo
1553
1567
  | TraceItemAlarmEventInfo
1568
+ | TraceItemQueueEventInfo
1569
+ | TraceItemEmailEventInfo
1554
1570
  | TraceItemCustomEventInfo
1555
1571
  )
1556
1572
  | null;
@@ -1559,6 +1575,7 @@ export interface TraceItem {
1559
1575
  readonly exceptions: TraceException[];
1560
1576
  readonly scriptName: string | null;
1561
1577
  readonly dispatchNamespace?: string;
1578
+ readonly scriptTags?: string[];
1562
1579
  readonly outcome: string;
1563
1580
  }
1564
1581
  export interface TraceItemAlarmEventInfo {
@@ -1569,6 +1586,15 @@ export interface TraceItemScheduledEventInfo {
1569
1586
  readonly scheduledTime: number;
1570
1587
  readonly cron: string;
1571
1588
  }
1589
+ export interface TraceItemQueueEventInfo {
1590
+ readonly queue: string;
1591
+ readonly batchSize: number;
1592
+ }
1593
+ export interface TraceItemEmailEventInfo {
1594
+ readonly mailFrom: string;
1595
+ readonly rcptTo: string;
1596
+ readonly rawSize: number;
1597
+ }
1572
1598
  export interface TraceItemFetchEventInfo {
1573
1599
  readonly response?: TraceItemFetchEventInfoResponse;
1574
1600
  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
  }