@cloudflare/workers-types 0.20230215.0 → 0.20230404.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.
@@ -49,6 +49,7 @@ declare class DOMException extends Error {
49
49
  declare type WorkerGlobalScopeEventMap = {
50
50
  fetch: FetchEvent;
51
51
  scheduled: ScheduledEvent;
52
+ queue: QueueEvent;
52
53
  unhandledrejection: PromiseRejectionEvent;
53
54
  rejectionhandled: PromiseRejectionEvent;
54
55
  };
@@ -286,12 +287,16 @@ declare const crypto: Crypto;
286
287
  declare const caches: CacheStorage;
287
288
  declare const scheduler: Scheduler;
288
289
  declare const navigator: Navigator;
290
+ declare interface TestController {}
289
291
  declare interface ExecutionContext {
290
292
  waitUntil(promise: Promise<any>): void;
291
293
  passThroughOnException(): void;
292
294
  }
293
- declare type ExportedHandlerFetchHandler<Env = unknown> = (
294
- request: Request,
295
+ declare type ExportedHandlerFetchHandler<
296
+ Env = unknown,
297
+ CfHostMetadata = unknown
298
+ > = (
299
+ request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
295
300
  env: Env,
296
301
  ctx: ExecutionContext
297
302
  ) => Response | Promise<Response>;
@@ -310,11 +315,21 @@ declare type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
310
315
  env: Env,
311
316
  ctx: ExecutionContext
312
317
  ) => void | Promise<void>;
313
- declare interface ExportedHandler<Env = unknown, QueueMessage = unknown> {
314
- fetch?: ExportedHandlerFetchHandler<Env>;
318
+ declare type ExportedHandlerTestHandler<Env = unknown> = (
319
+ controller: TestController,
320
+ env: Env,
321
+ ctx: ExecutionContext
322
+ ) => void | Promise<void>;
323
+ declare interface ExportedHandler<
324
+ Env = unknown,
325
+ QueueMessage = unknown,
326
+ CfHostMetadata = unknown
327
+ > {
328
+ fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
315
329
  trace?: ExportedHandlerTraceHandler<Env>;
316
330
  scheduled?: ExportedHandlerScheduledHandler<Env>;
317
- queue?: ExportedHandlerQueueHandler<Env, QueueMessage>;
331
+ test?: ExportedHandlerTestHandler<Env>;
332
+ queue?: ExportedHandlerQueueHandler<Env, Message>;
318
333
  }
319
334
  declare interface StructuredSerializeOptions {
320
335
  transfer?: any[];
@@ -349,13 +364,24 @@ declare interface DurableObjectNamespace {
349
364
  id: DurableObjectId,
350
365
  options?: DurableObjectNamespaceGetDurableObjectOptions
351
366
  ): DurableObjectStub;
352
- jurisdiction(jurisdiction: string): DurableObjectNamespace;
367
+ jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
353
368
  }
369
+ declare type DurableObjectJurisdiction = "eu" | "fedramp";
354
370
  declare interface DurableObjectNamespaceNewUniqueIdOptions {
355
- jurisdiction?: string;
356
- }
371
+ jurisdiction?: DurableObjectJurisdiction;
372
+ }
373
+ declare type DurableObjectLocationHint =
374
+ | "wnam"
375
+ | "enam"
376
+ | "sam"
377
+ | "weur"
378
+ | "eeur"
379
+ | "apac"
380
+ | "oc"
381
+ | "afr"
382
+ | "me";
357
383
  declare interface DurableObjectNamespaceGetDurableObjectOptions {
358
- locationHint?: string;
384
+ locationHint?: DurableObjectLocationHint;
359
385
  }
360
386
  declare interface DurableObjectState {
361
387
  waitUntil(promise: Promise<any>): void;
@@ -985,23 +1011,27 @@ declare interface ResponseInit {
985
1011
  webSocket?: WebSocket | null;
986
1012
  encodeBody?: "automatic" | "manual";
987
1013
  }
988
- declare type RequestInfo = Request | string | URL;
989
- declare class Request<CfHostMetadata = unknown> extends Body {
990
- constructor(input: RequestInfo, init?: RequestInit);
991
- clone(): Request<CfHostMetadata>;
1014
+ declare type RequestInfo<
1015
+ CfHostMetadata = unknown,
1016
+ Cf = CfProperties<CfHostMetadata>
1017
+ > = Request<CfHostMetadata, Cf> | string | URL;
1018
+ declare class Request<
1019
+ CfHostMetadata = unknown,
1020
+ Cf = CfProperties<CfHostMetadata>
1021
+ > extends Body {
1022
+ constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
1023
+ clone(): Request<CfHostMetadata, Cf>;
992
1024
  get method(): string;
993
1025
  get url(): string;
994
1026
  get headers(): Headers;
995
1027
  get redirect(): string;
996
1028
  get fetcher(): Fetcher | null;
997
1029
  get signal(): AbortSignal;
998
- get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
1030
+ get cf(): Cf | undefined;
999
1031
  get integrity(): string;
1000
1032
  get keepalive(): boolean;
1001
1033
  }
1002
- declare interface RequestInit<
1003
- CfType = IncomingRequestCfProperties | RequestInitCfProperties
1004
- > {
1034
+ declare interface RequestInit<Cf = CfProperties> {
1005
1035
  /** A string to set request's method. */
1006
1036
  method?: string;
1007
1037
  /** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
@@ -1011,17 +1041,14 @@ declare interface RequestInit<
1011
1041
  /** A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */
1012
1042
  redirect?: string;
1013
1043
  fetcher?: Fetcher | null;
1014
- cf?: CfType;
1044
+ cf?: Cf;
1015
1045
  /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1016
1046
  integrity?: string;
1017
1047
  /** An AbortSignal to set request's signal. */
1018
1048
  signal?: AbortSignal | null;
1019
1049
  }
1020
1050
  declare abstract class Fetcher {
1021
- fetch(
1022
- input: RequestInfo,
1023
- init?: RequestInit<RequestInitCfProperties>
1024
- ): Promise<Response>;
1051
+ fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1025
1052
  }
1026
1053
  declare interface FetcherPutOptions {
1027
1054
  expiration?: number;
@@ -1134,6 +1161,33 @@ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
1134
1161
  value: Value | null;
1135
1162
  metadata: Metadata | null;
1136
1163
  }
1164
+ declare interface Queue<Body> {
1165
+ send(message: Body): Promise<void>;
1166
+ sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
1167
+ }
1168
+ declare interface QueueSendOptions {}
1169
+ declare interface MessageSendRequest<Body = unknown> {
1170
+ body: Body;
1171
+ }
1172
+ declare interface Message<Body = unknown> {
1173
+ readonly id: string;
1174
+ readonly timestamp: Date;
1175
+ readonly body: Body;
1176
+ retry(): void;
1177
+ ack(): void;
1178
+ }
1179
+ declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
1180
+ readonly messages: readonly Message<Body>[];
1181
+ readonly queue: string;
1182
+ retryAll(): void;
1183
+ ackAll(): void;
1184
+ }
1185
+ declare interface MessageBatch<Body = unknown> {
1186
+ readonly messages: readonly Message<Body>[];
1187
+ readonly queue: string;
1188
+ retryAll(): void;
1189
+ ackAll(): void;
1190
+ }
1137
1191
  declare interface R2Error extends Error {
1138
1192
  readonly name: string;
1139
1193
  readonly code: number;
@@ -1285,12 +1339,18 @@ declare interface R2HTTPMetadata {
1285
1339
  cacheControl?: string;
1286
1340
  cacheExpiry?: Date;
1287
1341
  }
1288
- declare interface R2Objects {
1342
+ declare type R2Objects = {
1289
1343
  objects: R2Object[];
1290
- truncated: boolean;
1291
- cursor?: string;
1292
1344
  delimitedPrefixes: string[];
1293
- }
1345
+ } & (
1346
+ | {
1347
+ truncated: true;
1348
+ cursor: string;
1349
+ }
1350
+ | {
1351
+ truncated: false;
1352
+ }
1353
+ );
1294
1354
  declare abstract class ScheduledEvent extends ExtendableEvent {
1295
1355
  readonly scheduledTime: number;
1296
1356
  readonly cron: string;
@@ -1500,13 +1560,19 @@ declare class TransformStream<I = any, O = any> {
1500
1560
  get writable(): WritableStream<I>;
1501
1561
  }
1502
1562
  declare class FixedLengthStream extends IdentityTransformStream {
1503
- constructor(expectedLength: number | bigint);
1563
+ constructor(
1564
+ expectedLength: number | bigint,
1565
+ queuingStrategy?: IdentityTransformStreamQueuingStrategy
1566
+ );
1504
1567
  }
1505
1568
  declare class IdentityTransformStream extends TransformStream<
1506
1569
  ArrayBuffer | ArrayBufferView,
1507
1570
  Uint8Array
1508
1571
  > {
1509
- constructor();
1572
+ constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
1573
+ }
1574
+ declare interface IdentityTransformStreamQueuingStrategy {
1575
+ highWaterMark?: number | bigint;
1510
1576
  }
1511
1577
  declare interface ReadableStreamValuesOptions {
1512
1578
  preventCancel?: boolean;
@@ -1515,13 +1581,13 @@ declare class CompressionStream extends TransformStream<
1515
1581
  ArrayBuffer | ArrayBufferView,
1516
1582
  Uint8Array
1517
1583
  > {
1518
- constructor(format: "gzip" | "deflate");
1584
+ constructor(format: "gzip" | "deflate" | "deflate-raw");
1519
1585
  }
1520
1586
  declare class DecompressionStream extends TransformStream<
1521
1587
  ArrayBuffer | ArrayBufferView,
1522
1588
  Uint8Array
1523
1589
  > {
1524
- constructor(format: "gzip" | "deflate");
1590
+ constructor(format: "gzip" | "deflate" | "deflate-raw");
1525
1591
  }
1526
1592
  declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
1527
1593
  constructor();
@@ -1651,11 +1717,13 @@ declare class URL {
1651
1717
  get searchParams(): URLSearchParams;
1652
1718
  toJSON(): string;
1653
1719
  toString(): string;
1720
+ static canParse(url: string, base?: string): boolean;
1654
1721
  }
1655
1722
  declare class URLSearchParams {
1656
1723
  constructor(
1657
1724
  init?: Iterable<Iterable<string>> | Record<string, string> | string
1658
1725
  );
1726
+ get size(): number;
1659
1727
  append(name: string, value: string): void;
1660
1728
  delete(name: string): void;
1661
1729
  get(name: string): string | null;
@@ -1854,7 +1922,7 @@ declare interface BasicImageTransformationsGravityCoordinates {
1854
1922
  * Note: Currently, these properties cannot be tested in the
1855
1923
  * playground.
1856
1924
  */
1857
- declare interface RequestInitCfProperties {
1925
+ declare interface RequestInitCfProperties extends Record<string, unknown> {
1858
1926
  cacheEverything?: boolean;
1859
1927
  /**
1860
1928
  * A request's cache key is what determines if two requests are
@@ -2024,6 +2092,49 @@ declare interface RequestInitCfPropertiesImage
2024
2092
  * the origin.
2025
2093
  */
2026
2094
  "origin-auth"?: "share-publicly";
2095
+ /**
2096
+ * Adds a border around the image. The border is added after resizing. Border
2097
+ * width takes dpr into account, and can be specified either using a single
2098
+ * width property, or individually for each side.
2099
+ */
2100
+ border?:
2101
+ | {
2102
+ color: string;
2103
+ width: number;
2104
+ }
2105
+ | {
2106
+ color: string;
2107
+ top: number;
2108
+ right: number;
2109
+ bottom: number;
2110
+ left: number;
2111
+ };
2112
+ /**
2113
+ * Increase brightness by a factor. A value of 1.0 equals no change, a value
2114
+ * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
2115
+ * 0 is ignored.
2116
+ */
2117
+ brightness?: number;
2118
+ /**
2119
+ * Increase contrast by a factor. A value of 1.0 equals no change, a value of
2120
+ * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
2121
+ * ignored.
2122
+ */
2123
+ contrast?: number;
2124
+ /**
2125
+ * Increase exposure by a factor. A value of 1.0 equals no change, a value of
2126
+ * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
2127
+ */
2128
+ gamma?: number;
2129
+ /**
2130
+ * Slightly reduces latency on a cache miss by selecting a
2131
+ * quickest-to-compress file format, at a cost of increased file size and
2132
+ * lower image quality. It will usually override the format option and choose
2133
+ * JPEG over WebP or AVIF. We do not recommend using this option, except in
2134
+ * unusual circumstances like resizing uncacheable dynamically-generated
2135
+ * images.
2136
+ */
2137
+ compression?: "fast";
2027
2138
  }
2028
2139
  declare interface RequestInitCfPropertiesImageMinify {
2029
2140
  javascript?: boolean;
@@ -2039,7 +2150,8 @@ declare type IncomingRequestCfProperties<HostMetadata = unknown> =
2039
2150
  IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
2040
2151
  IncomingRequestCfPropertiesGeographicInformation &
2041
2152
  IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
2042
- declare interface IncomingRequestCfPropertiesBase {
2153
+ declare interface IncomingRequestCfPropertiesBase
2154
+ extends Record<string, unknown> {
2043
2155
  /**
2044
2156
  * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
2045
2157
  *
@@ -2120,8 +2232,7 @@ declare interface IncomingRequestCfPropertiesBase {
2120
2232
  declare interface IncomingRequestCfPropertiesBotManagementBase {
2121
2233
  /**
2122
2234
  * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
2123
- * represented as an integer percentage between `1` (almost certainly human)
2124
- * and `99` (almost certainly a bot).
2235
+ * represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
2125
2236
  *
2126
2237
  * @example 54
2127
2238
  */
@@ -2140,6 +2251,10 @@ declare interface IncomingRequestCfPropertiesBotManagementBase {
2140
2251
  * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources.
2141
2252
  */
2142
2253
  staticResource: boolean;
2254
+ /**
2255
+ * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request).
2256
+ */
2257
+ detectionIds: number[];
2143
2258
  }
2144
2259
  declare interface IncomingRequestCfPropertiesBotManagement {
2145
2260
  /**
@@ -2228,86 +2343,82 @@ declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
2228
2343
  /**
2229
2344
  * Geographic data about the request's origin.
2230
2345
  */
2231
- declare type IncomingRequestCfPropertiesGeographicInformation =
2232
- | {}
2233
- | {
2234
- /** The country code `"T1"` is used for requests originating on TOR */
2235
- country: "T1";
2236
- }
2237
- | {
2238
- /**
2239
- * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
2240
- *
2241
- * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR.
2242
- *
2243
- * If Cloudflare is unable to determine where the request originated this property is omitted.
2244
- *
2245
- * @example "GB"
2246
- */
2247
- country: Iso3166Alpha2Code;
2248
- /**
2249
- * If present, this property indicates that the request originated in the EU
2250
- *
2251
- * @example "1"
2252
- */
2253
- isEUCountry?: "1";
2254
- /**
2255
- * A two-letter code indicating the continent the request originated from.
2256
- *
2257
- * @example "AN"
2258
- */
2259
- continent: ContinentCode;
2260
- /**
2261
- * The city the request originated from
2262
- *
2263
- * @example "Austin"
2264
- */
2265
- city?: string;
2266
- /**
2267
- * Postal code of the incoming request
2268
- *
2269
- * @example "78701"
2270
- */
2271
- postalCode?: string;
2272
- /**
2273
- * Latitude of the incoming request
2274
- *
2275
- * @example "30.27130"
2276
- */
2277
- latitude?: string;
2278
- /**
2279
- * Longitude of the incoming request
2280
- *
2281
- * @example "-97.74260"
2282
- */
2283
- longitude?: string;
2284
- /**
2285
- * Timezone of the incoming request
2286
- *
2287
- * @example "America/Chicago"
2288
- */
2289
- timezone?: string;
2290
- /**
2291
- * If known, the ISO 3166-2 name for the first level region associated with
2292
- * the IP address of the incoming request
2293
- *
2294
- * @example "Texas"
2295
- */
2296
- region?: string;
2297
- /**
2298
- * If known, the ISO 3166-2 code for the first-level region associated with
2299
- * the IP address of the incoming request
2300
- *
2301
- * @example "TX"
2302
- */
2303
- regionCode?: string;
2304
- /**
2305
- * Metro code (DMA) of the incoming request
2306
- *
2307
- * @example "635"
2308
- */
2309
- metroCode?: string;
2310
- };
2346
+ declare interface IncomingRequestCfPropertiesGeographicInformation {
2347
+ /**
2348
+ * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
2349
+ *
2350
+ * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `"T1"`, indicating a request that originated over TOR.
2351
+ *
2352
+ * If Cloudflare is unable to determine where the request originated this property is omitted.
2353
+ *
2354
+ * The country code `"T1"` is used for requests originating on TOR.
2355
+ *
2356
+ * @example "GB"
2357
+ */
2358
+ country?: Iso3166Alpha2Code | "T1";
2359
+ /**
2360
+ * If present, this property indicates that the request originated in the EU
2361
+ *
2362
+ * @example "1"
2363
+ */
2364
+ isEUCountry?: "1";
2365
+ /**
2366
+ * A two-letter code indicating the continent the request originated from.
2367
+ *
2368
+ * @example "AN"
2369
+ */
2370
+ continent?: ContinentCode;
2371
+ /**
2372
+ * The city the request originated from
2373
+ *
2374
+ * @example "Austin"
2375
+ */
2376
+ city?: string;
2377
+ /**
2378
+ * Postal code of the incoming request
2379
+ *
2380
+ * @example "78701"
2381
+ */
2382
+ postalCode?: string;
2383
+ /**
2384
+ * Latitude of the incoming request
2385
+ *
2386
+ * @example "30.27130"
2387
+ */
2388
+ latitude?: string;
2389
+ /**
2390
+ * Longitude of the incoming request
2391
+ *
2392
+ * @example "-97.74260"
2393
+ */
2394
+ longitude?: string;
2395
+ /**
2396
+ * Timezone of the incoming request
2397
+ *
2398
+ * @example "America/Chicago"
2399
+ */
2400
+ timezone?: string;
2401
+ /**
2402
+ * If known, the ISO 3166-2 name for the first level region associated with
2403
+ * the IP address of the incoming request
2404
+ *
2405
+ * @example "Texas"
2406
+ */
2407
+ region?: string;
2408
+ /**
2409
+ * If known, the ISO 3166-2 code for the first-level region associated with
2410
+ * the IP address of the incoming request
2411
+ *
2412
+ * @example "TX"
2413
+ */
2414
+ regionCode?: string;
2415
+ /**
2416
+ * Metro code (DMA) of the incoming request
2417
+ *
2418
+ * @example "635"
2419
+ */
2420
+ metroCode?: string;
2421
+ }
2311
2422
  /** Data about the incoming request's TLS certificate */
2312
2423
  declare interface IncomingRequestCfPropertiesTLSClientAuth {
2313
2424
  /** Always `"1"`, indicating that the certificate was presented */
@@ -2700,6 +2811,9 @@ declare type Iso3166Alpha2Code =
2700
2811
  | "ZW";
2701
2812
  /** The 2-letter continent codes Cloudflare uses */
2702
2813
  declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
2814
+ declare type CfProperties<HostMetadata = unknown> =
2815
+ | IncomingRequestCfProperties<HostMetadata>
2816
+ | RequestInitCfProperties;
2703
2817
  declare interface D1Result<T = unknown> {
2704
2818
  results?: T[];
2705
2819
  success: boolean;
@@ -2720,9 +2834,9 @@ declare abstract class D1PreparedStatement {
2720
2834
  raw<T = unknown>(): Promise<T[]>;
2721
2835
  }
2722
2836
  /**
2723
- * A email message that is sent to a consumer Worker.
2837
+ * An email message that can be sent from a Worker.
2724
2838
  */
2725
- declare interface EmailMessage<Body = unknown> {
2839
+ declare interface EmailMessage {
2726
2840
  /**
2727
2841
  * Envelope From attribute of the email message.
2728
2842
  */
@@ -2731,14 +2845,19 @@ declare interface EmailMessage<Body = unknown> {
2731
2845
  * Envelope To attribute of the email message.
2732
2846
  */
2733
2847
  readonly to: string;
2734
- /**
2735
- * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
2736
- */
2737
- readonly headers: Headers;
2848
+ }
2849
+ /**
2850
+ * An email message that is sent to a consumer Worker and can be rejected/forwarded.
2851
+ */
2852
+ declare interface ForwardableEmailMessage extends EmailMessage {
2738
2853
  /**
2739
2854
  * Stream of the email message content.
2740
2855
  */
2741
2856
  readonly raw: ReadableStream;
2857
+ /**
2858
+ * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
2859
+ */
2860
+ readonly headers: Headers;
2742
2861
  /**
2743
2862
  * Size of the email message content.
2744
2863
  */
@@ -2757,14 +2876,27 @@ declare interface EmailMessage<Body = unknown> {
2757
2876
  */
2758
2877
  forward(rcptTo: string, headers?: Headers): Promise<void>;
2759
2878
  }
2879
+ /**
2880
+ * A binding that allows a Worker to send email messages.
2881
+ */
2882
+ declare interface SendEmail {
2883
+ send(message: EmailMessage): Promise<void>;
2884
+ }
2760
2885
  declare abstract class EmailEvent extends ExtendableEvent {
2761
- readonly message: EmailMessage;
2886
+ readonly message: ForwardableEmailMessage;
2762
2887
  }
2763
2888
  declare type EmailExportedHandler<Env = unknown> = (
2764
- message: EmailMessage,
2889
+ message: ForwardableEmailMessage,
2765
2890
  env: Env,
2766
2891
  ctx: ExecutionContext
2767
2892
  ) => void | Promise<void>;
2893
+ declare module "cloudflare:email" {
2894
+ let _EmailMessage: {
2895
+ prototype: EmailMessage;
2896
+ new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
2897
+ };
2898
+ export { _EmailMessage as EmailMessage };
2899
+ }
2768
2900
  declare type Params<P extends string = any> = Record<P, string | string[]>;
2769
2901
  declare type EventContext<Env, P extends string, Data> = {
2770
2902
  request: Request;
@@ -2845,75 +2977,12 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
2845
2977
  // Key Identifier of the JWK
2846
2978
  readonly kid: string;
2847
2979
  }
2848
- /**
2849
- * A message that is sent to a consumer Worker.
2850
- */
2851
- declare interface Message<Body = unknown> {
2980
+ // https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
2981
+ declare interface DispatchNamespace {
2852
2982
  /**
2853
- * A unique, system-generated ID for the message.
2983
+ * @param name Name of the Worker script.
2984
+ * @returns A Fetcher object that allows you to send requests to the Worker script.
2985
+ * @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
2854
2986
  */
2855
- readonly id: string;
2856
- /**
2857
- * A timestamp when the message was sent.
2858
- */
2859
- readonly timestamp: Date;
2860
- /**
2861
- * The body of the message.
2862
- */
2863
- readonly body: Body;
2864
- /**
2865
- * Marks message to be retried.
2866
- */
2867
- retry(): void;
2868
- /**
2869
- * Marks message acknowledged.
2870
- */
2871
- ack(): void;
2872
- }
2873
- /**
2874
- * A batch of messages that are sent to a consumer Worker.
2875
- */
2876
- declare interface MessageBatch<Body = unknown> {
2877
- /**
2878
- * The name of the Queue that belongs to this batch.
2879
- */
2880
- readonly queue: string;
2881
- /**
2882
- * An array of messages in the batch. Ordering of messages is not guaranteed.
2883
- */
2884
- readonly messages: readonly Message<Body>[];
2885
- /**
2886
- * Marks every message to be retried in the next batch.
2887
- */
2888
- retryAll(): void;
2889
- /**
2890
- * Marks every message acknowledged in the batch.
2891
- */
2892
- ackAll(): void;
2893
- }
2894
- /**
2895
- * A wrapper class used to structure message batches.
2896
- */
2897
- declare type MessageSendRequest<Body = unknown> = {
2898
- /**
2899
- * The body of the message.
2900
- */
2901
- body: Body;
2902
- };
2903
- /**
2904
- * A binding that allows a producer to send messages to a Queue.
2905
- */
2906
- declare interface Queue<Body = any> {
2907
- /**
2908
- * Sends a message to the Queue.
2909
- * @param message The message can be any type supported by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types), as long as its size is less than 128 KB.
2910
- * @returns A promise that resolves when the message is confirmed to be written to disk.
2911
- */
2912
- send(message: Body): Promise<void>;
2913
- /**
2914
- * Sends a batch of messages to the Queue.
2915
- * @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.
2916
- * @returns A promise that resolves when the messages are confirmed to be written to disk.
2917
- */
2918
- sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
2987
+ get(name: string): Fetcher;
2919
2988
  }