@cloudflare/workers-types 0.20230307.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
  };
@@ -287,8 +288,11 @@ declare interface ExecutionContext {
287
288
  waitUntil(promise: Promise<any>): void;
288
289
  passThroughOnException(): void;
289
290
  }
290
- declare type ExportedHandlerFetchHandler<Env = unknown> = (
291
- request: Request,
291
+ declare type ExportedHandlerFetchHandler<
292
+ Env = unknown,
293
+ CfHostMetadata = unknown
294
+ > = (
295
+ request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
292
296
  env: Env,
293
297
  ctx: ExecutionContext
294
298
  ) => Response | Promise<Response>;
@@ -312,12 +316,16 @@ declare type ExportedHandlerTestHandler<Env = unknown> = (
312
316
  env: Env,
313
317
  ctx: ExecutionContext
314
318
  ) => void | Promise<void>;
315
- declare interface ExportedHandler<Env = unknown, QueueMessage = unknown> {
316
- fetch?: ExportedHandlerFetchHandler<Env>;
319
+ declare interface ExportedHandler<
320
+ Env = unknown,
321
+ QueueMessage = unknown,
322
+ CfHostMetadata = unknown
323
+ > {
324
+ fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
317
325
  trace?: ExportedHandlerTraceHandler<Env>;
318
326
  scheduled?: ExportedHandlerScheduledHandler<Env>;
319
327
  test?: ExportedHandlerTestHandler<Env>;
320
- queue?: ExportedHandlerQueueHandler<Env, QueueMessage>;
328
+ queue?: ExportedHandlerQueueHandler<Env, Message>;
321
329
  }
322
330
  declare interface StructuredSerializeOptions {
323
331
  transfer?: any[];
@@ -352,13 +360,24 @@ declare interface DurableObjectNamespace {
352
360
  id: DurableObjectId,
353
361
  options?: DurableObjectNamespaceGetDurableObjectOptions
354
362
  ): DurableObjectStub;
355
- jurisdiction(jurisdiction: string): DurableObjectNamespace;
363
+ jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace;
356
364
  }
365
+ declare type DurableObjectJurisdiction = "eu" | "fedramp";
357
366
  declare interface DurableObjectNamespaceNewUniqueIdOptions {
358
- jurisdiction?: string;
359
- }
367
+ jurisdiction?: DurableObjectJurisdiction;
368
+ }
369
+ declare type DurableObjectLocationHint =
370
+ | "wnam"
371
+ | "enam"
372
+ | "sam"
373
+ | "weur"
374
+ | "eeur"
375
+ | "apac"
376
+ | "oc"
377
+ | "afr"
378
+ | "me";
360
379
  declare interface DurableObjectNamespaceGetDurableObjectOptions {
361
- locationHint?: string;
380
+ locationHint?: DurableObjectLocationHint;
362
381
  }
363
382
  declare interface DurableObjectState {
364
383
  waitUntil(promise: Promise<any>): void;
@@ -988,23 +1007,27 @@ declare interface ResponseInit {
988
1007
  webSocket?: WebSocket | null;
989
1008
  encodeBody?: "automatic" | "manual";
990
1009
  }
991
- declare type RequestInfo = Request | string | URL;
992
- declare class Request<CfHostMetadata = unknown> extends Body {
993
- constructor(input: RequestInfo, init?: RequestInit);
994
- clone(): Request<CfHostMetadata>;
1010
+ declare type RequestInfo<
1011
+ CfHostMetadata = unknown,
1012
+ Cf = CfProperties<CfHostMetadata>
1013
+ > = Request<CfHostMetadata, Cf> | string | URL;
1014
+ declare class Request<
1015
+ CfHostMetadata = unknown,
1016
+ Cf = CfProperties<CfHostMetadata>
1017
+ > extends Body {
1018
+ constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
1019
+ clone(): Request<CfHostMetadata, Cf>;
995
1020
  get method(): string;
996
1021
  get url(): string;
997
1022
  get headers(): Headers;
998
1023
  get redirect(): string;
999
1024
  get fetcher(): Fetcher | null;
1000
1025
  get signal(): AbortSignal;
1001
- get cf(): IncomingRequestCfProperties<CfHostMetadata> | undefined;
1026
+ get cf(): Cf | undefined;
1002
1027
  get integrity(): string;
1003
1028
  get keepalive(): boolean;
1004
1029
  }
1005
- declare interface RequestInit<
1006
- CfType = IncomingRequestCfProperties | RequestInitCfProperties
1007
- > {
1030
+ declare interface RequestInit<Cf = CfProperties> {
1008
1031
  /** A string to set request's method. */
1009
1032
  method?: string;
1010
1033
  /** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
@@ -1014,17 +1037,14 @@ declare interface RequestInit<
1014
1037
  /** 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. */
1015
1038
  redirect?: string;
1016
1039
  fetcher?: Fetcher | null;
1017
- cf?: CfType;
1040
+ cf?: Cf;
1018
1041
  /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1019
1042
  integrity?: string;
1020
1043
  /** An AbortSignal to set request's signal. */
1021
1044
  signal?: AbortSignal | null;
1022
1045
  }
1023
1046
  declare abstract class Fetcher {
1024
- fetch(
1025
- input: RequestInfo,
1026
- init?: RequestInit<RequestInitCfProperties>
1027
- ): Promise<Response>;
1047
+ fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
1028
1048
  }
1029
1049
  declare interface FetcherPutOptions {
1030
1050
  expiration?: number;
@@ -1137,6 +1157,33 @@ declare interface KVNamespaceGetWithMetadataResult<Value, Metadata> {
1137
1157
  value: Value | null;
1138
1158
  metadata: Metadata | null;
1139
1159
  }
1160
+ declare interface Queue<Body> {
1161
+ send(message: Body): Promise<void>;
1162
+ sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
1163
+ }
1164
+ declare interface QueueSendOptions {}
1165
+ declare interface MessageSendRequest<Body = unknown> {
1166
+ body: Body;
1167
+ }
1168
+ declare interface Message<Body = unknown> {
1169
+ readonly id: string;
1170
+ readonly timestamp: Date;
1171
+ readonly body: Body;
1172
+ retry(): void;
1173
+ ack(): void;
1174
+ }
1175
+ declare interface QueueEvent<Body = unknown> extends ExtendableEvent {
1176
+ readonly messages: readonly Message<Body>[];
1177
+ readonly queue: string;
1178
+ retryAll(): void;
1179
+ ackAll(): void;
1180
+ }
1181
+ declare interface MessageBatch<Body = unknown> {
1182
+ readonly messages: readonly Message<Body>[];
1183
+ readonly queue: string;
1184
+ retryAll(): void;
1185
+ ackAll(): void;
1186
+ }
1140
1187
  declare interface R2Error extends Error {
1141
1188
  readonly name: string;
1142
1189
  readonly code: number;
@@ -1287,12 +1334,18 @@ declare interface R2HTTPMetadata {
1287
1334
  cacheControl?: string;
1288
1335
  cacheExpiry?: Date;
1289
1336
  }
1290
- declare interface R2Objects {
1337
+ declare type R2Objects = {
1291
1338
  objects: R2Object[];
1292
- truncated: boolean;
1293
- cursor?: string;
1294
1339
  delimitedPrefixes: string[];
1295
- }
1340
+ } & (
1341
+ | {
1342
+ truncated: true;
1343
+ cursor: string;
1344
+ }
1345
+ | {
1346
+ truncated: false;
1347
+ }
1348
+ );
1296
1349
  declare abstract class ScheduledEvent extends ExtendableEvent {
1297
1350
  readonly scheduledTime: number;
1298
1351
  readonly cron: string;
@@ -1503,13 +1556,19 @@ declare class TransformStream<I = any, O = any> {
1503
1556
  get writable(): WritableStream<I>;
1504
1557
  }
1505
1558
  declare class FixedLengthStream extends IdentityTransformStream {
1506
- constructor(expectedLength: number | bigint);
1559
+ constructor(
1560
+ expectedLength: number | bigint,
1561
+ queuingStrategy?: IdentityTransformStreamQueuingStrategy
1562
+ );
1507
1563
  }
1508
1564
  declare class IdentityTransformStream extends TransformStream<
1509
1565
  ArrayBuffer | ArrayBufferView,
1510
1566
  Uint8Array
1511
1567
  > {
1512
- constructor();
1568
+ constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);
1569
+ }
1570
+ declare interface IdentityTransformStreamQueuingStrategy {
1571
+ highWaterMark?: number | bigint;
1513
1572
  }
1514
1573
  declare interface ReadableStreamValuesOptions {
1515
1574
  preventCancel?: boolean;
@@ -1862,7 +1921,7 @@ declare interface BasicImageTransformationsGravityCoordinates {
1862
1921
  * Note: Currently, these properties cannot be tested in the
1863
1922
  * playground.
1864
1923
  */
1865
- declare interface RequestInitCfProperties {
1924
+ declare interface RequestInitCfProperties extends Record<string, unknown> {
1866
1925
  cacheEverything?: boolean;
1867
1926
  /**
1868
1927
  * A request's cache key is what determines if two requests are
@@ -2032,6 +2091,49 @@ declare interface RequestInitCfPropertiesImage
2032
2091
  * the origin.
2033
2092
  */
2034
2093
  "origin-auth"?: "share-publicly";
2094
+ /**
2095
+ * Adds a border around the image. The border is added after resizing. Border
2096
+ * width takes dpr into account, and can be specified either using a single
2097
+ * width property, or individually for each side.
2098
+ */
2099
+ border?:
2100
+ | {
2101
+ color: string;
2102
+ width: number;
2103
+ }
2104
+ | {
2105
+ color: string;
2106
+ top: number;
2107
+ right: number;
2108
+ bottom: number;
2109
+ left: number;
2110
+ };
2111
+ /**
2112
+ * Increase brightness by a factor. A value of 1.0 equals no change, a value
2113
+ * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
2114
+ * 0 is ignored.
2115
+ */
2116
+ brightness?: number;
2117
+ /**
2118
+ * Increase contrast by a factor. A value of 1.0 equals no change, a value of
2119
+ * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
2120
+ * ignored.
2121
+ */
2122
+ contrast?: number;
2123
+ /**
2124
+ * Increase exposure by a factor. A value of 1.0 equals no change, a value of
2125
+ * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
2126
+ */
2127
+ gamma?: number;
2128
+ /**
2129
+ * Slightly reduces latency on a cache miss by selecting a
2130
+ * quickest-to-compress file format, at a cost of increased file size and
2131
+ * lower image quality. It will usually override the format option and choose
2132
+ * JPEG over WebP or AVIF. We do not recommend using this option, except in
2133
+ * unusual circumstances like resizing uncacheable dynamically-generated
2134
+ * images.
2135
+ */
2136
+ compression?: "fast";
2035
2137
  }
2036
2138
  declare interface RequestInitCfPropertiesImageMinify {
2037
2139
  javascript?: boolean;
@@ -2047,7 +2149,8 @@ declare type IncomingRequestCfProperties<HostMetadata = unknown> =
2047
2149
  IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> &
2048
2150
  IncomingRequestCfPropertiesGeographicInformation &
2049
2151
  IncomingRequestCfPropertiesCloudflareAccessOrApiShield;
2050
- declare interface IncomingRequestCfPropertiesBase {
2152
+ declare interface IncomingRequestCfPropertiesBase
2153
+ extends Record<string, unknown> {
2051
2154
  /**
2052
2155
  * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.
2053
2156
  *
@@ -2128,8 +2231,7 @@ declare interface IncomingRequestCfPropertiesBase {
2128
2231
  declare interface IncomingRequestCfPropertiesBotManagementBase {
2129
2232
  /**
2130
2233
  * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,
2131
- * represented as an integer percentage between `1` (almost certainly human)
2132
- * and `99` (almost certainly a bot).
2234
+ * represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).
2133
2235
  *
2134
2236
  * @example 54
2135
2237
  */
@@ -2240,86 +2342,82 @@ declare interface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {
2240
2342
  /**
2241
2343
  * Geographic data about the request's origin.
2242
2344
  */
2243
- declare type IncomingRequestCfPropertiesGeographicInformation =
2244
- | {}
2245
- | {
2246
- /** The country code `"T1"` is used for requests originating on TOR */
2247
- country: "T1";
2248
- }
2249
- | {
2250
- /**
2251
- * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
2252
- *
2253
- * 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.
2254
- *
2255
- * If Cloudflare is unable to determine where the request originated this property is omitted.
2256
- *
2257
- * @example "GB"
2258
- */
2259
- country: Iso3166Alpha2Code;
2260
- /**
2261
- * If present, this property indicates that the request originated in the EU
2262
- *
2263
- * @example "1"
2264
- */
2265
- isEUCountry?: "1";
2266
- /**
2267
- * A two-letter code indicating the continent the request originated from.
2268
- *
2269
- * @example "AN"
2270
- */
2271
- continent: ContinentCode;
2272
- /**
2273
- * The city the request originated from
2274
- *
2275
- * @example "Austin"
2276
- */
2277
- city?: string;
2278
- /**
2279
- * Postal code of the incoming request
2280
- *
2281
- * @example "78701"
2282
- */
2283
- postalCode?: string;
2284
- /**
2285
- * Latitude of the incoming request
2286
- *
2287
- * @example "30.27130"
2288
- */
2289
- latitude?: string;
2290
- /**
2291
- * Longitude of the incoming request
2292
- *
2293
- * @example "-97.74260"
2294
- */
2295
- longitude?: string;
2296
- /**
2297
- * Timezone of the incoming request
2298
- *
2299
- * @example "America/Chicago"
2300
- */
2301
- timezone?: string;
2302
- /**
2303
- * If known, the ISO 3166-2 name for the first level region associated with
2304
- * the IP address of the incoming request
2305
- *
2306
- * @example "Texas"
2307
- */
2308
- region?: string;
2309
- /**
2310
- * If known, the ISO 3166-2 code for the first-level region associated with
2311
- * the IP address of the incoming request
2312
- *
2313
- * @example "TX"
2314
- */
2315
- regionCode?: string;
2316
- /**
2317
- * Metro code (DMA) of the incoming request
2318
- *
2319
- * @example "635"
2320
- */
2321
- metroCode?: string;
2322
- };
2345
+ declare interface IncomingRequestCfPropertiesGeographicInformation {
2346
+ /**
2347
+ * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.
2348
+ *
2349
+ * 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.
2350
+ *
2351
+ * If Cloudflare is unable to determine where the request originated this property is omitted.
2352
+ *
2353
+ * The country code `"T1"` is used for requests originating on TOR.
2354
+ *
2355
+ * @example "GB"
2356
+ */
2357
+ country?: Iso3166Alpha2Code | "T1";
2358
+ /**
2359
+ * If present, this property indicates that the request originated in the EU
2360
+ *
2361
+ * @example "1"
2362
+ */
2363
+ isEUCountry?: "1";
2364
+ /**
2365
+ * A two-letter code indicating the continent the request originated from.
2366
+ *
2367
+ * @example "AN"
2368
+ */
2369
+ continent?: ContinentCode;
2370
+ /**
2371
+ * The city the request originated from
2372
+ *
2373
+ * @example "Austin"
2374
+ */
2375
+ city?: string;
2376
+ /**
2377
+ * Postal code of the incoming request
2378
+ *
2379
+ * @example "78701"
2380
+ */
2381
+ postalCode?: string;
2382
+ /**
2383
+ * Latitude of the incoming request
2384
+ *
2385
+ * @example "30.27130"
2386
+ */
2387
+ latitude?: string;
2388
+ /**
2389
+ * Longitude of the incoming request
2390
+ *
2391
+ * @example "-97.74260"
2392
+ */
2393
+ longitude?: string;
2394
+ /**
2395
+ * Timezone of the incoming request
2396
+ *
2397
+ * @example "America/Chicago"
2398
+ */
2399
+ timezone?: string;
2400
+ /**
2401
+ * If known, the ISO 3166-2 name for the first level region associated with
2402
+ * the IP address of the incoming request
2403
+ *
2404
+ * @example "Texas"
2405
+ */
2406
+ region?: string;
2407
+ /**
2408
+ * If known, the ISO 3166-2 code for the first-level region associated with
2409
+ * the IP address of the incoming request
2410
+ *
2411
+ * @example "TX"
2412
+ */
2413
+ regionCode?: string;
2414
+ /**
2415
+ * Metro code (DMA) of the incoming request
2416
+ *
2417
+ * @example "635"
2418
+ */
2419
+ metroCode?: string;
2420
+ }
2323
2421
  /** Data about the incoming request's TLS certificate */
2324
2422
  declare interface IncomingRequestCfPropertiesTLSClientAuth {
2325
2423
  /** Always `"1"`, indicating that the certificate was presented */
@@ -2712,6 +2810,9 @@ declare type Iso3166Alpha2Code =
2712
2810
  | "ZW";
2713
2811
  /** The 2-letter continent codes Cloudflare uses */
2714
2812
  declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
2813
+ declare type CfProperties<HostMetadata = unknown> =
2814
+ | IncomingRequestCfProperties<HostMetadata>
2815
+ | RequestInitCfProperties;
2715
2816
  declare interface D1Result<T = unknown> {
2716
2817
  results?: T[];
2717
2818
  success: boolean;
@@ -2732,7 +2833,7 @@ declare abstract class D1PreparedStatement {
2732
2833
  raw<T = unknown>(): Promise<T[]>;
2733
2834
  }
2734
2835
  /**
2735
- * A email message that is sent to a consumer Worker.
2836
+ * An email message that can be sent from a Worker.
2736
2837
  */
2737
2838
  declare interface EmailMessage {
2738
2839
  /**
@@ -2743,14 +2844,19 @@ declare interface EmailMessage {
2743
2844
  * Envelope To attribute of the email message.
2744
2845
  */
2745
2846
  readonly to: string;
2746
- /**
2747
- * A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
2748
- */
2749
- readonly headers: Headers;
2847
+ }
2848
+ /**
2849
+ * An email message that is sent to a consumer Worker and can be rejected/forwarded.
2850
+ */
2851
+ declare interface ForwardableEmailMessage extends EmailMessage {
2750
2852
  /**
2751
2853
  * Stream of the email message content.
2752
2854
  */
2753
2855
  readonly raw: ReadableStream;
2856
+ /**
2857
+ * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
2858
+ */
2859
+ readonly headers: Headers;
2754
2860
  /**
2755
2861
  * Size of the email message content.
2756
2862
  */
@@ -2769,14 +2875,27 @@ declare interface EmailMessage {
2769
2875
  */
2770
2876
  forward(rcptTo: string, headers?: Headers): Promise<void>;
2771
2877
  }
2878
+ /**
2879
+ * A binding that allows a Worker to send email messages.
2880
+ */
2881
+ declare interface SendEmail {
2882
+ send(message: EmailMessage): Promise<void>;
2883
+ }
2772
2884
  declare abstract class EmailEvent extends ExtendableEvent {
2773
- readonly message: EmailMessage;
2885
+ readonly message: ForwardableEmailMessage;
2774
2886
  }
2775
2887
  declare type EmailExportedHandler<Env = unknown> = (
2776
- message: EmailMessage,
2888
+ message: ForwardableEmailMessage,
2777
2889
  env: Env,
2778
2890
  ctx: ExecutionContext
2779
2891
  ) => void | Promise<void>;
2892
+ declare module "cloudflare:email" {
2893
+ let _EmailMessage: {
2894
+ prototype: EmailMessage;
2895
+ new (from: string, to: string, raw: ReadableStream | string): EmailMessage;
2896
+ };
2897
+ export { _EmailMessage as EmailMessage };
2898
+ }
2780
2899
  declare type Params<P extends string = any> = Record<P, string | string[]>;
2781
2900
  declare type EventContext<Env, P extends string, Data> = {
2782
2901
  request: Request;
@@ -2857,75 +2976,12 @@ declare interface JsonWebKeyWithKid extends JsonWebKey {
2857
2976
  // Key Identifier of the JWK
2858
2977
  readonly kid: string;
2859
2978
  }
2860
- /**
2861
- * A message that is sent to a consumer Worker.
2862
- */
2863
- declare interface Message<Body = unknown> {
2864
- /**
2865
- * A unique, system-generated ID for the message.
2866
- */
2867
- readonly id: string;
2868
- /**
2869
- * A timestamp when the message was sent.
2870
- */
2871
- readonly timestamp: Date;
2872
- /**
2873
- * The body of the message.
2874
- */
2875
- readonly body: Body;
2876
- /**
2877
- * Marks message to be retried.
2878
- */
2879
- retry(): void;
2880
- /**
2881
- * Marks message acknowledged.
2882
- */
2883
- ack(): void;
2884
- }
2885
- /**
2886
- * A batch of messages that are sent to a consumer Worker.
2887
- */
2888
- declare interface MessageBatch<Body = unknown> {
2889
- /**
2890
- * The name of the Queue that belongs to this batch.
2891
- */
2892
- readonly queue: string;
2893
- /**
2894
- * An array of messages in the batch. Ordering of messages is not guaranteed.
2895
- */
2896
- readonly messages: readonly Message<Body>[];
2979
+ // https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/
2980
+ declare interface DispatchNamespace {
2897
2981
  /**
2898
- * Marks every message to be retried in the next batch.
2982
+ * @param name Name of the Worker script.
2983
+ * @returns A Fetcher object that allows you to send requests to the Worker script.
2984
+ * @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.
2899
2985
  */
2900
- retryAll(): void;
2901
- /**
2902
- * Marks every message acknowledged in the batch.
2903
- */
2904
- ackAll(): void;
2905
- }
2906
- /**
2907
- * A wrapper class used to structure message batches.
2908
- */
2909
- declare type MessageSendRequest<Body = unknown> = {
2910
- /**
2911
- * The body of the message.
2912
- */
2913
- body: Body;
2914
- };
2915
- /**
2916
- * A binding that allows a producer to send messages to a Queue.
2917
- */
2918
- declare interface Queue<Body = any> {
2919
- /**
2920
- * Sends a message to the Queue.
2921
- * @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.
2922
- * @returns A promise that resolves when the message is confirmed to be written to disk.
2923
- */
2924
- send(message: Body): Promise<void>;
2925
- /**
2926
- * Sends a batch of messages to the Queue.
2927
- * @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.
2928
- * @returns A promise that resolves when the messages are confirmed to be written to disk.
2929
- */
2930
- sendBatch(messages: Iterable<MessageSendRequest<Body>>): Promise<void>;
2986
+ get(name: string): Fetcher;
2931
2987
  }