@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
  };
@@ -279,12 +280,16 @@ declare const self: ServiceWorkerGlobalScope;
279
280
  declare const crypto: Crypto;
280
281
  declare const caches: CacheStorage;
281
282
  declare const scheduler: Scheduler;
283
+ declare interface TestController {}
282
284
  declare interface ExecutionContext {
283
285
  waitUntil(promise: Promise<any>): void;
284
286
  passThroughOnException(): void;
285
287
  }
286
- declare type ExportedHandlerFetchHandler<Env = unknown> = (
287
- request: Request,
288
+ declare type ExportedHandlerFetchHandler<
289
+ Env = unknown,
290
+ CfHostMetadata = unknown
291
+ > = (
292
+ request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
288
293
  env: Env,
289
294
  ctx: ExecutionContext
290
295
  ) => Response | Promise<Response>;
@@ -303,11 +308,21 @@ declare type ExportedHandlerQueueHandler<Env = unknown, Message = unknown> = (
303
308
  env: Env,
304
309
  ctx: ExecutionContext
305
310
  ) => void | Promise<void>;
306
- declare interface ExportedHandler<Env = unknown, QueueMessage = unknown> {
307
- fetch?: ExportedHandlerFetchHandler<Env>;
311
+ declare type ExportedHandlerTestHandler<Env = unknown> = (
312
+ controller: TestController,
313
+ env: Env,
314
+ ctx: ExecutionContext
315
+ ) => void | Promise<void>;
316
+ declare interface ExportedHandler<
317
+ Env = unknown,
318
+ QueueMessage = unknown,
319
+ CfHostMetadata = unknown
320
+ > {
321
+ fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
308
322
  trace?: ExportedHandlerTraceHandler<Env>;
309
323
  scheduled?: ExportedHandlerScheduledHandler<Env>;
310
- queue?: ExportedHandlerQueueHandler<Env, QueueMessage>;
324
+ test?: ExportedHandlerTestHandler<Env>;
325
+ queue?: ExportedHandlerQueueHandler<Env, Message>;
311
326
  }
312
327
  declare interface StructuredSerializeOptions {
313
328
  transfer?: any[];
@@ -339,13 +354,24 @@ declare interface DurableObjectNamespace {
339
354
  id: DurableObjectId,
340
355
  options?: DurableObjectNamespaceGetDurableObjectOptions
341
356
  ): DurableObjectStub;
342
- jurisdiction(jurisdiction: string): DurableObjectNamespace;
357
+ jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
343
358
  }
359
+ declare type DurableObjectJurisdiction = "eu" | "fedramp";
344
360
  declare interface DurableObjectNamespaceNewUniqueIdOptions {
345
- jurisdiction?: string;
346
- }
361
+ jurisdiction?: DurableObjectJurisdiction;
362
+ }
363
+ declare type DurableObjectLocationHint =
364
+ | "wnam"
365
+ | "enam"
366
+ | "sam"
367
+ | "weur"
368
+ | "eeur"
369
+ | "apac"
370
+ | "oc"
371
+ | "afr"
372
+ | "me";
347
373
  declare interface DurableObjectNamespaceGetDurableObjectOptions {
348
- locationHint?: string;
374
+ locationHint?: DurableObjectLocationHint;
349
375
  }
350
376
  declare interface DurableObjectState {
351
377
  waitUntil(promise: Promise<any>): void;
@@ -975,23 +1001,27 @@ declare interface ResponseInit {
975
1001
  webSocket?: WebSocket | null;
976
1002
  encodeBody?: "automatic" | "manual";
977
1003
  }
978
- declare type RequestInfo = Request | string | URL;
979
- declare class Request<CfHostMetadata = unknown> extends Body {
980
- constructor(input: RequestInfo, init?: RequestInit);
981
- clone(): Request<CfHostMetadata>;
1004
+ declare type RequestInfo<
1005
+ CfHostMetadata = unknown,
1006
+ Cf = CfProperties<CfHostMetadata>
1007
+ > = Request<CfHostMetadata, Cf> | string | URL;
1008
+ declare class Request<
1009
+ CfHostMetadata = unknown,
1010
+ Cf = CfProperties<CfHostMetadata>
1011
+ > extends Body {
1012
+ constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
1013
+ clone(): Request<CfHostMetadata, Cf>;
982
1014
  get method(): string;
983
1015
  get url(): string;
984
1016
  get headers(): Headers;
985
1017
  get redirect(): string;
986
1018
  get fetcher(): Fetcher | null;
987
1019
  get signal(): AbortSignal;
988
- get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
1020
+ get cf(): Cf | undefined;
989
1021
  get integrity(): string;
990
1022
  get keepalive(): boolean;
991
1023
  }
992
- declare interface RequestInit<
993
- CfType = IncomingRequestCfProperties | RequestInitCfProperties
994
- > {
1024
+ declare interface RequestInit<Cf = CfProperties> {
995
1025
  /** A string to set request's method. */
996
1026
  method?: string;
997
1027
  /** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
@@ -1001,17 +1031,14 @@ declare interface RequestInit<
1001
1031
  /** 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. */
1002
1032
  redirect?: string;
1003
1033
  fetcher?: Fetcher | null;
1004
- cf?: CfType;
1034
+ cf?: Cf;
1005
1035
  /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1006
1036
  integrity?: string;
1007
1037
  /** An AbortSignal to set request's signal. */
1008
1038
  signal?: AbortSignal | null;
1009
1039
  }
1010
1040
  declare abstract class Fetcher {
1011
- fetch(
1012
- input: RequestInfo,
1013
- init?: RequestInit<RequestInitCfProperties>
1014
- ): Promise<Response>;
1041
+ fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1015
1042
  }
1016
1043
  declare interface FetcherPutOptions {
1017
1044
  expiration?: number;
@@ -1124,6 +1151,33 @@ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
1124
1151
  value: Value | null;
1125
1152
  metadata: Metadata | null;
1126
1153
  }
1154
+ declare interface Queue<Body> {
1155
+ send(message: Body): Promise<void>;
1156
+ sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
1157
+ }
1158
+ declare interface QueueSendOptions {}
1159
+ declare interface MessageSendRequest<Body = unknown> {
1160
+ body: Body;
1161
+ }
1162
+ declare interface Message<Body = unknown> {
1163
+ readonly id: string;
1164
+ readonly timestamp: Date;
1165
+ readonly body: Body;
1166
+ retry(): void;
1167
+ ack(): void;
1168
+ }
1169
+ declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
1170
+ readonly messages: readonly Message<Body>[];
1171
+ readonly queue: string;
1172
+ retryAll(): void;
1173
+ ackAll(): void;
1174
+ }
1175
+ declare interface MessageBatch<Body = unknown> {
1176
+ readonly messages: readonly Message<Body>[];
1177
+ readonly queue: string;
1178
+ retryAll(): void;
1179
+ ackAll(): void;
1180
+ }
1127
1181
  declare interface R2Error extends Error {
1128
1182
  readonly name: string;
1129
1183
  readonly code: number;
@@ -1274,12 +1328,18 @@ declare interface R2HTTPMetadata {
1274
1328
  cacheControl?: string;
1275
1329
  cacheExpiry?: Date;
1276
1330
  }
1277
- declare interface R2Objects {
1331
+ declare type R2Objects = {
1278
1332
  objects: R2Object[];
1279
- truncated: boolean;
1280
- cursor?: string;
1281
1333
  delimitedPrefixes: string[];
1282
- }
1334
+ } & (
1335
+ | {
1336
+ truncated: true;
1337
+ cursor: string;
1338
+ }
1339
+ | {
1340
+ truncated: false;
1341
+ }
1342
+ );
1283
1343
  declare abstract class ScheduledEvent extends ExtendableEvent {
1284
1344
  readonly scheduledTime: number;
1285
1345
  readonly cron: string;
@@ -1490,13 +1550,19 @@ declare class TransformStream<I = any, O = any> {
1490
1550
  get writable(): WritableStream<I>;
1491
1551
  }
1492
1552
  declare class FixedLengthStream extends IdentityTransformStream {
1493
- constructor(expectedLength: number | bigint);
1553
+ constructor(
1554
+ expectedLength: number | bigint,
1555
+ queuingStrategy?: IdentityTransformStreamQueuingStrategy
1556
+ );
1494
1557
  }
1495
1558
  declare class IdentityTransformStream extends TransformStream<
1496
1559
  ArrayBuffer | ArrayBufferView,
1497
1560
  Uint8Array
1498
1561
  > {
1499
- constructor();
1562
+ constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
1563
+ }
1564
+ declare interface IdentityTransformStreamQueuingStrategy {
1565
+ highWaterMark?: number | bigint;
1500
1566
  }
1501
1567
  declare interface ReadableStreamValuesOptions {
1502
1568
  preventCancel?: boolean;
@@ -1505,13 +1571,13 @@ declare class CompressionStream extends TransformStream<
1505
1571
  ArrayBuffer | ArrayBufferView,
1506
1572
  Uint8Array
1507
1573
  > {
1508
- constructor(format: "gzip" | "deflate");
1574
+ constructor(format: "gzip" | "deflate" | "deflate-raw");
1509
1575
  }
1510
1576
  declare class DecompressionStream extends TransformStream<
1511
1577
  ArrayBuffer | ArrayBufferView,
1512
1578
  Uint8Array
1513
1579
  > {
1514
- constructor(format: "gzip" | "deflate");
1580
+ constructor(format: "gzip" | "deflate" | "deflate-raw");
1515
1581
  }
1516
1582
  declare class TextEncoderStream extends TransformStream<string, Uint8Array> {
1517
1583
  constructor();
@@ -1650,6 +1716,7 @@ declare class URLSearchParams {
1650
1716
  | Record<string, string>
1651
1717
  | [key: string, value: string][]
1652
1718
  );
1719
+ get size(): number;
1653
1720
  append(name: string, value: string): void;
1654
1721
  delete(name: string): void;
1655
1722
  get(name: string): string | null;
@@ -1848,7 +1915,7 @@ declare interface BasicImageTransformationsGravityCoordinates {
1848
1915
  * Note: Currently, these properties cannot be tested in the
1849
1916
  * playground.
1850
1917
  */
1851
- declare interface RequestInitCfProperties {
1918
+ declare interface RequestInitCfProperties extends Record<string, unknown> {
1852
1919
  cacheEverything?: boolean;
1853
1920
  /**
1854
1921
  * A request's cache key is what determines if two requests are
@@ -2018,6 +2085,49 @@ declare interface RequestInitCfPropertiesImage
2018
2085
  * the origin.
2019
2086
  */
2020
2087
  "origin-auth"?: "share-publicly";
2088
+ /**
2089
+ * Adds a border around the image. The border is added after resizing. Border
2090
+ * width takes dpr into account, and can be specified either using a single
2091
+ * width property, or individually for each side.
2092
+ */
2093
+ border?:
2094
+ | {
2095
+ color: string;
2096
+ width: number;
2097
+ }
2098
+ | {
2099
+ color: string;
2100
+ top: number;
2101
+ right: number;
2102
+ bottom: number;
2103
+ left: number;
2104
+ };
2105
+ /**
2106
+ * Increase brightness by a factor. A value of 1.0 equals no change, a value
2107
+ * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
2108
+ * 0 is ignored.
2109
+ */
2110
+ brightness?: number;
2111
+ /**
2112
+ * Increase contrast by a factor. A value of 1.0 equals no change, a value of
2113
+ * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
2114
+ * ignored.
2115
+ */
2116
+ contrast?: number;
2117
+ /**
2118
+ * Increase exposure by a factor. A value of 1.0 equals no change, a value of
2119
+ * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
2120
+ */
2121
+ gamma?: number;
2122
+ /**
2123
+ * Slightly reduces latency on a cache miss by selecting a
2124
+ * quickest-to-compress file format, at a cost of increased file size and
2125
+ * lower image quality. It will usually override the format option and choose
2126
+ * JPEG over WebP or AVIF. We do not recommend using this option, except in
2127
+ * unusual circumstances like resizing uncacheable dynamically-generated
2128
+ * images.
2129
+ */
2130
+ compression?: "fast";
2021
2131
  }
2022
2132
  declare interface RequestInitCfPropertiesImageMinify {
2023
2133
  javascript?: boolean;
@@ -2033,7 +2143,8 @@ declare type IncomingRequestCfProperties<HostMetadata = unknown> =
2033
2143
  IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
2034
2144
  IncomingRequestCfPropertiesGeographicInformation &
2035
2145
  IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
2036
- declare interface IncomingRequestCfPropertiesBase {
2146
+ declare interface IncomingRequestCfPropertiesBase
2147
+ extends Record<string, unknown> {
2037
2148
  /**
2038
2149
  * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
2039
2150
  *
@@ -2114,8 +2225,7 @@ declare interface IncomingRequestCfPropertiesBase {
2114
2225
  declare interface IncomingRequestCfPropertiesBotManagementBase {
2115
2226
  /**
2116
2227
  * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
2117
- * represented as an integer percentage between `1` (almost certainly human)
2118
- * and `99` (almost certainly a bot).
2228
+ * represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
2119
2229
  *
2120
2230
  * @example 54
2121
2231
  */
@@ -2134,6 +2244,10 @@ declare interface IncomingRequestCfPropertiesBotManagementBase {
2134
2244
  * 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.
2135
2245
  */
2136
2246
  staticResource: boolean;
2247
+ /**
2248
+ * 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).
2249
+ */
2250
+ detectionIds: number[];
2137
2251
  }
2138
2252
  declare interface IncomingRequestCfPropertiesBotManagement {
2139
2253
  /**
@@ -2222,86 +2336,82 @@ declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
2222
2336
  /**
2223
2337
  * Geographic data about the request's origin.
2224
2338
  */
2225
- declare type IncomingRequestCfPropertiesGeographicInformation =
2226
- | {}
2227
- | {
2228
- /** The country code `"T1"` is used for requests originating on TOR */
2229
- country: "T1";
2230
- }
2231
- | {
2232
- /**
2233
- * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
2234
- *
2235
- * 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.
2236
- *
2237
- * If Cloudflare is unable to determine where the request originated this property is omitted.
2238
- *
2239
- * @example "GB"
2240
- */
2241
- country: Iso3166Alpha2Code;
2242
- /**
2243
- * If present, this property indicates that the request originated in the EU
2244
- *
2245
- * @example "1"
2246
- */
2247
- isEUCountry?: "1";
2248
- /**
2249
- * A two-letter code indicating the continent the request originated from.
2250
- *
2251
- * @example "AN"
2252
- */
2253
- continent: ContinentCode;
2254
- /**
2255
- * The city the request originated from
2256
- *
2257
- * @example "Austin"
2258
- */
2259
- city?: string;
2260
- /**
2261
- * Postal code of the incoming request
2262
- *
2263
- * @example "78701"
2264
- */
2265
- postalCode?: string;
2266
- /**
2267
- * Latitude of the incoming request
2268
- *
2269
- * @example "30.27130"
2270
- */
2271
- latitude?: string;
2272
- /**
2273
- * Longitude of the incoming request
2274
- *
2275
- * @example "-97.74260"
2276
- */
2277
- longitude?: string;
2278
- /**
2279
- * Timezone of the incoming request
2280
- *
2281
- * @example "America/Chicago"
2282
- */
2283
- timezone?: string;
2284
- /**
2285
- * If known, the ISO 3166-2 name for the first level region associated with
2286
- * the IP address of the incoming request
2287
- *
2288
- * @example "Texas"
2289
- */
2290
- region?: string;
2291
- /**
2292
- * If known, the ISO 3166-2 code for the first-level region associated with
2293
- * the IP address of the incoming request
2294
- *
2295
- * @example "TX"
2296
- */
2297
- regionCode?: string;
2298
- /**
2299
- * Metro code (DMA) of the incoming request
2300
- *
2301
- * @example "635"
2302
- */
2303
- metroCode?: string;
2304
- };
2339
+ declare interface IncomingRequestCfPropertiesGeographicInformation {
2340
+ /**
2341
+ * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
2342
+ *
2343
+ * 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.
2344
+ *
2345
+ * If Cloudflare is unable to determine where the request originated this property is omitted.
2346
+ *
2347
+ * The country code `"T1"` is used for requests originating on TOR.
2348
+ *
2349
+ * @example "GB"
2350
+ */
2351
+ country?: Iso3166Alpha2Code | "T1";
2352
+ /**
2353
+ * If present, this property indicates that the request originated in the EU
2354
+ *
2355
+ * @example "1"
2356
+ */
2357
+ isEUCountry?: "1";
2358
+ /**
2359
+ * A two-letter code indicating the continent the request originated from.
2360
+ *
2361
+ * @example "AN"
2362
+ */
2363
+ continent?: ContinentCode;
2364
+ /**
2365
+ * The city the request originated from
2366
+ *
2367
+ * @example "Austin"
2368
+ */
2369
+ city?: string;
2370
+ /**
2371
+ * Postal code of the incoming request
2372
+ *
2373
+ * @example "78701"
2374
+ */
2375
+ postalCode?: string;
2376
+ /**
2377
+ * Latitude of the incoming request
2378
+ *
2379
+ * @example "30.27130"
2380
+ */
2381
+ latitude?: string;
2382
+ /**
2383
+ * Longitude of the incoming request
2384
+ *
2385
+ * @example "-97.74260"
2386
+ */
2387
+ longitude?: string;
2388
+ /**
2389
+ * Timezone of the incoming request
2390
+ *
2391
+ * @example "America/Chicago"
2392
+ */
2393
+ timezone?: string;
2394
+ /**
2395
+ * If known, the ISO 3166-2 name for the first level region associated with
2396
+ * the IP address of the incoming request
2397
+ *
2398
+ * @example "Texas"
2399
+ */
2400
+ region?: string;
2401
+ /**
2402
+ * If known, the ISO 3166-2 code for the first-level region associated with
2403
+ * the IP address of the incoming request
2404
+ *
2405
+ * @example "TX"
2406
+ */
2407
+ regionCode?: string;
2408
+ /**
2409
+ * Metro code (DMA) of the incoming request
2410
+ *
2411
+ * @example "635"
2412
+ */
2413
+ metroCode?: string;
2414
+ }
2305
2415
  /** Data about the incoming request's TLS certificate */
2306
2416
  declare interface IncomingRequestCfPropertiesTLSClientAuth {
2307
2417
  /** Always `"1"`, indicating that the certificate was presented */
@@ -2694,6 +2804,9 @@ declare type Iso3166Alpha2Code =
2694
2804
  | "ZW";
2695
2805
  /** The 2-letter continent codes Cloudflare uses */
2696
2806
  declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
2807
+ declare type CfProperties<HostMetadata = unknown> =
2808
+ | IncomingRequestCfProperties<HostMetadata>
2809
+ | RequestInitCfProperties;
2697
2810
  declare interface D1Result<T = unknown> {
2698
2811
  results?: T[];
2699
2812
  success: boolean;
@@ -2714,9 +2827,9 @@ declare abstract class D1PreparedStatement {
2714
2827
  raw<T = unknown>(): Promise<T[]>;
2715
2828
  }
2716
2829
  /**
2717
- * A email message that is sent to a consumer Worker.
2830
+ * An email message that can be sent from a Worker.
2718
2831
  */
2719
- declare interface EmailMessage<Body = unknown> {
2832
+ declare interface EmailMessage {
2720
2833
  /**
2721
2834
  * Envelope From attribute of the email message.
2722
2835
  */
@@ -2725,14 +2838,19 @@ declare interface EmailMessage<Body = unknown> {
2725
2838
  * Envelope To attribute of the email message.
2726
2839
  */
2727
2840
  readonly to: string;
2728
- /**
2729
- * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
2730
- */
2731
- readonly headers: Headers;
2841
+ }
2842
+ /**
2843
+ * An email message that is sent to a consumer Worker and can be rejected/forwarded.
2844
+ */
2845
+ declare interface ForwardableEmailMessage extends EmailMessage {
2732
2846
  /**
2733
2847
  * Stream of the email message content.
2734
2848
  */
2735
2849
  readonly raw: ReadableStream;
2850
+ /**
2851
+ * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
2852
+ */
2853
+ readonly headers: Headers;
2736
2854
  /**
2737
2855
  * Size of the email message content.
2738
2856
  */
@@ -2751,14 +2869,27 @@ declare interface EmailMessage<Body = unknown> {
2751
2869
  */
2752
2870
  forward(rcptTo: string, headers?: Headers): Promise<void>;
2753
2871
  }
2872
+ /**
2873
+ * A binding that allows a Worker to send email messages.
2874
+ */
2875
+ declare interface SendEmail {
2876
+ send(message: EmailMessage): Promise<void>;
2877
+ }
2754
2878
  declare abstract class EmailEvent extends ExtendableEvent {
2755
- readonly message: EmailMessage;
2879
+ readonly message: ForwardableEmailMessage;
2756
2880
  }
2757
2881
  declare type EmailExportedHandler<Env = unknown> = (
2758
- message: EmailMessage,
2882
+ message: ForwardableEmailMessage,
2759
2883
  env: Env,
2760
2884
  ctx: ExecutionContext
2761
2885
  ) => void | Promise<void>;
2886
+ declare module "cloudflare:email" {
2887
+ let _EmailMessage: {
2888
+ prototype: EmailMessage;
2889
+ new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
2890
+ };
2891
+ export { _EmailMessage as EmailMessage };
2892
+ }
2762
2893
  declare type Params<P extends string = any> = Record<P, string | string[]>;
2763
2894
  declare type EventContext<Env, P extends string, Data> = {
2764
2895
  request: Request;
@@ -2839,75 +2970,12 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
2839
2970
  // Key Identifier of the JWK
2840
2971
  readonly kid: string;
2841
2972
  }
2842
- /**
2843
- * A message that is sent to a consumer Worker.
2844
- */
2845
- declare interface Message<Body = unknown> {
2973
+ // https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
2974
+ declare interface DispatchNamespace {
2846
2975
  /**
2847
- * A unique, system-generated ID for the message.
2976
+ * @param name Name of the Worker script.
2977
+ * @returns A Fetcher object that allows you to send requests to the Worker script.
2978
+ * @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
2848
2979
  */
2849
- readonly id: string;
2850
- /**
2851
- * A timestamp when the message was sent.
2852
- */
2853
- readonly timestamp: Date;
2854
- /**
2855
- * The body of the message.
2856
- */
2857
- readonly body: Body;
2858
- /**
2859
- * Marks message to be retried.
2860
- */
2861
- retry(): void;
2862
- /**
2863
- * Marks message acknowledged.
2864
- */
2865
- ack(): void;
2866
- }
2867
- /**
2868
- * A batch of messages that are sent to a consumer Worker.
2869
- */
2870
- declare interface MessageBatch<Body = unknown> {
2871
- /**
2872
- * The name of the Queue that belongs to this batch.
2873
- */
2874
- readonly queue: string;
2875
- /**
2876
- * An array of messages in the batch. Ordering of messages is not guaranteed.
2877
- */
2878
- readonly messages: readonly Message<Body>[];
2879
- /**
2880
- * Marks every message to be retried in the next batch.
2881
- */
2882
- retryAll(): void;
2883
- /**
2884
- * Marks every message acknowledged in the batch.
2885
- */
2886
- ackAll(): void;
2887
- }
2888
- /**
2889
- * A wrapper class used to structure message batches.
2890
- */
2891
- declare type MessageSendRequest<Body = unknown> = {
2892
- /**
2893
- * The body of the message.
2894
- */
2895
- body: Body;
2896
- };
2897
- /**
2898
- * A binding that allows a producer to send messages to a Queue.
2899
- */
2900
- declare interface Queue<Body = any> {
2901
- /**
2902
- * Sends a message to the Queue.
2903
- * @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.
2904
- * @returns A promise that resolves when the message is confirmed to be written to disk.
2905
- */
2906
- send(message: Body): Promise<void>;
2907
- /**
2908
- * Sends a batch of messages to the Queue.
2909
- * @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.
2910
- * @returns A promise that resolves when the messages are confirmed to be written to disk.
2911
- */
2912
- sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
2980
+ get(name: string): Fetcher;
2913
2981
  }