wrangler 0.0.0-e1d50407 → 0.0.0-e1f2576e

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.
@@ -6,11 +6,14 @@ import type { DispatchFetch } from 'miniflare';
6
6
  import { Duplex } from 'stream';
7
7
  import { EventEmitter } from 'events';
8
8
  import { EventEmitter as EventEmitter_2 } from 'node:events';
9
+ import type { IncomingRequestCfProperties as IncomingRequestCfProperties_2 } from '@cloudflare/workers-types/experimental';
9
10
  import { IpcNetConnectOpts } from 'net';
10
11
  import type { Json } from 'miniflare';
12
+ import type { MessagePort as MessagePort_2 } from 'worker_threads';
11
13
  import type { Metafile } from 'esbuild';
12
14
  import { Miniflare } from 'miniflare';
13
15
  import type { MiniflareOptions } from 'miniflare';
16
+ import type { ModuleRule as ModuleRule_2 } from 'miniflare';
14
17
  import { Mutex } from 'miniflare';
15
18
  import { Readable } from 'stream';
16
19
  import { ReadableStream as ReadableStream_2 } from 'stream/web';
@@ -18,12 +21,12 @@ import type { Request as Request_3 } from 'miniflare';
18
21
  import { Response as Response_3 } from 'miniflare';
19
22
  import { Socket as Socket_2 } from 'net';
20
23
  import { TcpNetConnectOpts } from 'net';
21
- import { TlsOptions as TlsOptions_2 } from 'tls';
22
24
  import { TLSSocket } from 'tls';
23
25
  import { URL as URL_2 } from 'url';
24
26
  import { UrlObject } from 'url';
25
27
  import { URLSearchParams as URLSearchParams_2 } from 'url';
26
28
  import { WebSocket as WebSocket_3 } from 'miniflare';
29
+ import type { WorkerOptions } from 'miniflare';
27
30
  import { Writable } from 'stream';
28
31
 
29
32
  declare type AbortSignal_2 = unknown;
@@ -47,7 +50,7 @@ declare class Agent extends Dispatcher{
47
50
  declare namespace Agent {
48
51
  interface Options extends Pool.Options {
49
52
  /** Default: `(origin, opts) => new Pool(origin, opts)`. */
50
- factory?(origin: URL_2, opts: Object): Dispatcher;
53
+ factory?(origin: string | URL_2, opts: Object): Dispatcher;
51
54
  /** Integer. Default: `0` */
52
55
  maxRedirections?: number;
53
56
 
@@ -68,10 +71,10 @@ declare type ApiCredentials = {
68
71
  };
69
72
 
70
73
  declare class BalancedPool extends Dispatcher {
71
- constructor(url: string | URL_2 | string[], options?: Pool.Options);
74
+ constructor(url: string | string[] | URL_2 | URL_2[], options?: Pool.Options);
72
75
 
73
- addUpstream(upstream: string): BalancedPool;
74
- removeUpstream(upstream: string): BalancedPool;
76
+ addUpstream(upstream: string | URL_2): BalancedPool;
77
+ removeUpstream(upstream: string | URL_2): BalancedPool;
75
78
  upstreams: Array<string>;
76
79
 
77
80
  /** `true` after `pool.close()` has been called. */
@@ -133,6 +136,16 @@ declare type Binding = {
133
136
  [key: string]: unknown;
134
137
  };
135
138
 
139
+ /**
140
+ * Result of the `getBindingsProxy` utility
141
+ */
142
+ export declare type BindingsProxy<Bindings = Record<string, unknown>, CfProperties extends Record<string, unknown> = IncomingRequestCfProperties_2> = Omit<PlatformProxy<Bindings, CfProperties>, "env"> & {
143
+ /**
144
+ * Object containing the various proxies
145
+ */
146
+ bindings: Bindings;
147
+ };
148
+
136
149
  declare interface BlobPropertyBag {
137
150
  type?: string
138
151
  endings?: 'native' | 'transparent'
@@ -175,7 +188,7 @@ declare class BodyReadable extends Readable {
175
188
  /** Consumes and returns the body as a JavaScript Object
176
189
  * https://fetch.spec.whatwg.org/#dom-body-json
177
190
  */
178
- json(): Promise<any>
191
+ json(): Promise<unknown>
179
192
 
180
193
  /** Consumes and returns the body as a Blob
181
194
  * https://fetch.spec.whatwg.org/#dom-body-blob
@@ -221,6 +234,7 @@ declare function buildConnector (options?: buildConnector.BuildOptions): buildCo
221
234
 
222
235
  declare namespace buildConnector {
223
236
  type BuildOptions = (ConnectionOptions | TcpNetConnectOpts | IpcNetConnectOpts) & {
237
+ allowH2?: boolean;
224
238
  maxCachedSessions?: number | null;
225
239
  socketPath?: string | null;
226
240
  timeout?: number | null;
@@ -242,13 +256,7 @@ declare namespace buildConnector {
242
256
  type Callback = (...args: CallbackArgs) => void
243
257
  type CallbackArgs = [null, Socket_2 | TLSSocket] | [Error, null]
244
258
 
245
- type connector = connectorAsync | connectorSync
246
-
247
- interface connectorSync {
248
- (options: buildConnector.Options): Socket_2 | TLSSocket
249
- }
250
-
251
- interface connectorAsync {
259
+ interface connector {
252
260
  (options: buildConnector.Options, callback: buildConnector.Callback): void
253
261
  }
254
262
  }
@@ -275,6 +283,82 @@ declare type BundleStartEvent = {
275
283
  config: StartDevWorkerOptions;
276
284
  };
277
285
 
286
+ declare interface Cache_2 {
287
+ match (request: RequestInfo_2, options?: CacheQueryOptions_2): Promise<Response_2 | undefined>,
288
+ matchAll (request?: RequestInfo_2, options?: CacheQueryOptions_2): Promise<readonly Response_2[]>,
289
+ add (request: RequestInfo_2): Promise<undefined>,
290
+ addAll (requests: RequestInfo_2[]): Promise<undefined>,
291
+ put (request: RequestInfo_2, response: Response_2): Promise<undefined>,
292
+ delete (request: RequestInfo_2, options?: CacheQueryOptions_2): Promise<boolean>,
293
+ keys (request?: RequestInfo_2, options?: CacheQueryOptions_2): Promise<readonly Request_2[]>
294
+ }
295
+
296
+ /**
297
+ * No-op implementation of Cache
298
+ */
299
+ declare class Cache_3 {
300
+ delete(request: CacheRequest, options?: CacheQueryOptions_3): Promise<boolean>;
301
+ match(request: CacheRequest, options?: CacheQueryOptions_3): Promise<CacheResponse | undefined>;
302
+ put(request: CacheRequest, response: CacheResponse): Promise<void>;
303
+ }
304
+
305
+ declare interface CacheQueryOptions_2 {
306
+ ignoreSearch?: boolean,
307
+ ignoreMethod?: boolean,
308
+ ignoreVary?: boolean
309
+ }
310
+
311
+ declare type CacheQueryOptions_3 = {
312
+ ignoreMethod?: boolean;
313
+ };
314
+
315
+ declare type CacheRequest = any;
316
+
317
+ declare type CacheResponse = any;
318
+
319
+ declare const caches_2: CacheStorage_2;
320
+
321
+ declare interface CacheStorage_2 {
322
+ match (request: RequestInfo_2, options?: MultiCacheQueryOptions): Promise<Response_2 | undefined>,
323
+ has (cacheName: string): Promise<boolean>,
324
+ open (cacheName: string): Promise<Cache_2>,
325
+ delete (cacheName: string): Promise<boolean>,
326
+ keys (): Promise<string[]>
327
+ }
328
+
329
+ declare const CacheStorage_2: {
330
+ prototype: CacheStorage_2
331
+ new(): CacheStorage_2
332
+ };
333
+
334
+ /**
335
+ * Note about this file:
336
+ *
337
+ * Here we are providing a no-op implementation of the runtime Cache API instead of using
338
+ * the miniflare implementation (via `mf.getCaches()`).
339
+ *
340
+ * We are not using miniflare's implementation because that would require the user to provide
341
+ * miniflare-specific Request objects and they would receive back miniflare-specific Response
342
+ * objects, this (in particular the Request part) is not really suitable for `getPlatformProxy`
343
+ * as people would ideally interact with their bindings in a very production-like manner and
344
+ * requiring them to deal with miniflare-specific classes defeats a bit the purpose of the utility.
345
+ *
346
+ * Similarly the Request and Response types here are set to `undefined` as not to use specific ones
347
+ * that would require us to make a choice right now or the user to adapt their code in order to work
348
+ * with the api.
349
+ *
350
+ * We need to find a better/generic manner in which we can reuse the miniflare cache implementation,
351
+ * but until then the no-op implementation below will have to do.
352
+ */
353
+ /**
354
+ * No-op implementation of CacheStorage
355
+ */
356
+ declare class CacheStorage_3 {
357
+ constructor();
358
+ open(cacheName: string): Promise<Cache_3>;
359
+ get default(): Cache_3;
360
+ }
361
+
278
362
  /**
279
363
  * A Cloudflare account.
280
364
  */
@@ -291,6 +375,16 @@ declare interface CfAccount {
291
375
  accountId: string;
292
376
  }
293
377
 
378
+ /**
379
+ * A Durable Object.
380
+ */
381
+ declare interface CfDurableObject {
382
+ name: string;
383
+ class_name: string;
384
+ script_name?: string;
385
+ environment?: string;
386
+ }
387
+
294
388
  /**
295
389
  * An imported module.
296
390
  */
@@ -333,14 +427,16 @@ declare interface CfModule {
333
427
  /**
334
428
  * A module type.
335
429
  */
336
- declare type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer";
430
+ declare type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer" | "python" | "python-requirement";
337
431
 
338
432
  /**
339
433
  * The type of Worker
340
434
  */
341
435
  declare type CfScriptFormat = "modules" | "service-worker";
342
436
 
343
- /** A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default. */
437
+ /**
438
+ * A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default.
439
+ */
344
440
  declare class Client extends Dispatcher {
345
441
  constructor(url: string | URL_2, options?: Client.Options);
346
442
  /** Property to get and set the pipelining factor. */
@@ -352,39 +448,71 @@ declare class Client extends Dispatcher {
352
448
  }
353
449
 
354
450
  declare namespace Client {
451
+ interface OptionsInterceptors {
452
+ Client: readonly Dispatcher.DispatchInterceptor[];
453
+ }
355
454
  interface Options {
356
- /** the timeout after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. Default: `4e3` milliseconds (4s). */
357
- keepAliveTimeout?: number | null;
358
- /** the maximum allowed `idleTimeout` when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */
359
- keepAliveMaxTimeout?: number | null;
360
- /** A number subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */
361
- keepAliveTimeoutThreshold?: number | null;
362
- /** The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Default: `1`. */
363
- pipelining?: number | null;
364
- /** **/
365
- connect?: buildConnector.BuildOptions | buildConnector.connector | null;
366
- /** The maximum length of request headers in bytes. Default: `16384` (16KiB). */
367
- maxHeaderSize?: number | null;
455
+ /** TODO */
456
+ interceptors?: OptionsInterceptors;
457
+ /** The maximum length of request headers in bytes. Default: Node.js' `--max-http-header-size` or `16384` (16KiB). */
458
+ maxHeaderSize?: number;
459
+ /** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */
460
+ headersTimeout?: number;
461
+ /** @deprecated unsupported socketTimeout, use headersTimeout & bodyTimeout instead */
462
+ socketTimeout?: never;
463
+ /** @deprecated unsupported requestTimeout, use headersTimeout & bodyTimeout instead */
464
+ requestTimeout?: never;
465
+ /** TODO */
466
+ connectTimeout?: number;
368
467
  /** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Default: `300e3` milliseconds (300s). */
369
- bodyTimeout?: number | null;
370
- /** The amount of time the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */
371
- headersTimeout?: number | null;
468
+ bodyTimeout?: number;
469
+ /** @deprecated unsupported idleTimeout, use keepAliveTimeout instead */
470
+ idleTimeout?: never;
471
+ /** @deprecated unsupported keepAlive, use pipelining=0 instead */
472
+ keepAlive?: never;
473
+ /** the timeout, in milliseconds, after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. Default: `4e3` milliseconds (4s). */
474
+ keepAliveTimeout?: number;
475
+ /** @deprecated unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead */
476
+ maxKeepAliveTimeout?: never;
477
+ /** the maximum allowed `idleTimeout`, in milliseconds, when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */
478
+ keepAliveMaxTimeout?: number;
479
+ /** A number of milliseconds subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */
480
+ keepAliveTimeoutThreshold?: number;
481
+ /** TODO */
482
+ socketPath?: string;
483
+ /** The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Default: `1`. */
484
+ pipelining?: number;
485
+ /** @deprecated use the connect option instead */
486
+ tls?: never;
372
487
  /** If `true`, an error is thrown when the request content-length header doesn't match the length of the request body. Default: `true`. */
373
488
  strictContentLength?: boolean;
374
- /** @deprecated use the connect option instead */
375
- tls?: TlsOptions_2 | null;
376
- /** */
489
+ /** TODO */
490
+ maxCachedSessions?: number;
491
+ /** TODO */
492
+ maxRedirections?: number;
493
+ /** TODO */
494
+ connect?: buildConnector.BuildOptions | buildConnector.connector;
495
+ /** TODO */
377
496
  maxRequestsPerClient?: number;
497
+ /** TODO */
498
+ localAddress?: string;
378
499
  /** Max response body size in bytes, -1 is disabled */
379
- maxResponseSize?: number | null;
500
+ maxResponseSize?: number;
380
501
  /** Enables a family autodetection algorithm that loosely implements section 5 of RFC 8305. */
381
502
  autoSelectFamily?: boolean;
382
503
  /** The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. */
383
504
  autoSelectFamilyAttemptTimeout?: number;
384
-
385
- interceptors?: {Client: readonly Dispatcher[] | undefined}
505
+ /**
506
+ * @description Enables support for H2 if the server has assigned bigger priority to it through ALPN negotiation.
507
+ * @default false
508
+ */
509
+ allowH2?: boolean;
510
+ /**
511
+ * @description Dictates the maximum number of concurrent streams for a single H2 session. It can be overridden by a SETTINGS remote frame.
512
+ * @default 100
513
+ */
514
+ maxConcurrentStreams?: number
386
515
  }
387
-
388
516
  interface SocketInfo {
389
517
  localAddress?: string
390
518
  localPort?: number
@@ -395,8 +523,6 @@ declare namespace Client {
395
523
  bytesWritten?: number
396
524
  bytesRead?: number
397
525
  }
398
-
399
-
400
526
  }
401
527
 
402
528
  declare interface CloseEvent_2 extends Event_2 {
@@ -416,6 +542,14 @@ declare interface CloseEventInit_2 extends EventInit_2 {
416
542
  wasClean?: boolean
417
543
  }
418
544
 
545
+ /**
546
+ * Configuration in wrangler for Cloudchamber
547
+ */
548
+ declare type CloudchamberConfig = {
549
+ vcpu?: number;
550
+ memory?: string;
551
+ };
552
+
419
553
  declare class ConfigController extends EventEmitter_2 {
420
554
  config?: StartDevWorkerOptions;
421
555
  setOptions(_: StartDevWorkerOptions): void;
@@ -562,7 +696,7 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
562
696
  /**
563
697
  * The possible types for a `Rule`.
564
698
  */
565
- declare type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data";
699
+ declare type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data" | "PythonModule" | "PythonRequirement";
566
700
 
567
701
  declare type ConfigUpdateEvent = {
568
702
  type: "configUpdate";
@@ -621,8 +755,8 @@ attributes?: { name?: string, domain?: string }
621
755
  */
622
756
  declare function deploy({ directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, }: PagesDeployOptions): Promise<{
623
757
  url: string;
624
- environment: "production" | "preview";
625
758
  id: string;
759
+ environment: "production" | "preview";
626
760
  project_id: string;
627
761
  project_name: string;
628
762
  build_config: {
@@ -765,11 +899,10 @@ declare interface DevConfig {
765
899
  /**
766
900
  * Protocol that wrangler dev forwards requests on
767
901
  *
768
- * Setting this to `http` is not currently implemented.
902
+ * Setting this to `http` is not currently implemented for remote mode.
769
903
  * See https://github.com/cloudflare/workers-sdk/issues/583
770
904
  *
771
- * @default `https`
772
- * @todo this needs to be implemented https://github.com/cloudflare/workers-sdk/issues/583
905
+ * @default `https` in remote mode; same as local_protocol in local mode.
773
906
  */
774
907
  upstream_protocol: "https" | "http";
775
908
  /**
@@ -955,7 +1088,7 @@ declare namespace Dispatcher {
955
1088
  blocking?: boolean;
956
1089
  /** Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`. Default: `method === 'CONNECT' || null`. */
957
1090
  upgrade?: boolean | string | null;
958
- /** The amount of time the parser will wait to receive the complete HTTP headers. Defaults to 300 seconds. */
1091
+ /** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers. Defaults to 300 seconds. */
959
1092
  headersTimeout?: number | null;
960
1093
  /** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use 0 to disable it entirely. Defaults to 300 seconds. */
961
1094
  bodyTimeout?: number | null;
@@ -963,6 +1096,8 @@ declare namespace Dispatcher {
963
1096
  reset?: boolean;
964
1097
  /** Whether Undici should throw an error upon receiving a 4xx or 5xx response from the server. Defaults to false */
965
1098
  throwOnError?: boolean;
1099
+ /** For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server*/
1100
+ expectContinue?: boolean;
966
1101
  }
967
1102
  interface ConnectOptions {
968
1103
  path: string;
@@ -988,6 +1123,8 @@ declare namespace Dispatcher {
988
1123
  onInfo?: (info: { statusCode: number, headers: Record<string, string | string[]> }) => void;
989
1124
  /** Default: `null` */
990
1125
  responseHeader?: 'raw' | null;
1126
+ /** Default: `64 KiB` */
1127
+ highWaterMark?: number;
991
1128
  }
992
1129
  interface PipelineOptions extends RequestOptions {
993
1130
  /** `true` if the `handler` will return an object stream. Default: `false` */
@@ -1053,7 +1190,7 @@ declare namespace Dispatcher {
1053
1190
  /** Invoked when request is upgraded either due to a `Upgrade` header or `CONNECT` method. */
1054
1191
  onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex): void;
1055
1192
  /** Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. */
1056
- onHeaders?(statusCode: number, headers: Buffer[] | string[] | null, resume: () => void): boolean;
1193
+ onHeaders?(statusCode: number, headers: Buffer[] | string[] | null, resume: () => void, statusText: string): boolean;
1057
1194
  /** Invoked when response payload data is received. */
1058
1195
  onData?(chunk: Buffer): boolean;
1059
1196
  /** Invoked when response payload and trailers have been received and the request has completed. */
@@ -1073,7 +1210,7 @@ declare namespace Dispatcher {
1073
1210
  arrayBuffer(): Promise<ArrayBuffer>;
1074
1211
  blob(): Promise<Blob_2>;
1075
1212
  formData(): Promise<never>;
1076
- json(): Promise<any>;
1213
+ json(): Promise<unknown>;
1077
1214
  text(): Promise<string>;
1078
1215
  }
1079
1216
 
@@ -1224,6 +1361,13 @@ declare interface EnvironmentInheritable {
1224
1361
  * @inheritable
1225
1362
  */
1226
1363
  find_additional_modules: boolean | undefined;
1364
+ /**
1365
+ * Determines whether Wrangler will preserve bundled file names.
1366
+ * Defaults to false.
1367
+ * If left unset, files will be named using the pattern ${fileHash}-${basename},
1368
+ * for example, `34de60b44167af5c5a709e62a4e20c4f18c9e3b6-favicon.ico`.
1369
+ */
1370
+ preserve_file_names: boolean | undefined;
1227
1371
  /**
1228
1372
  * The directory in which module rules should be evaluated when including additional files into a worker deployment.
1229
1373
  * This defaults to the directory containing the `main` entry point of the worker if not specified.
@@ -1478,6 +1622,16 @@ declare interface EnvironmentNonInheritable {
1478
1622
  durable_objects: {
1479
1623
  bindings: DurableObjectBindings;
1480
1624
  };
1625
+ /**
1626
+ * Cloudchamber configuration
1627
+ *
1628
+ * NOTE: This field is not automatically inherited from the top level environment,
1629
+ * and so must be specified in every named environment.
1630
+ *
1631
+ * @default `{}`
1632
+ * @nonInheritable
1633
+ */
1634
+ cloudchamber: CloudchamberConfig;
1481
1635
  /**
1482
1636
  * These specify any Workers KV Namespaces you want to
1483
1637
  * access from inside your Worker.
@@ -1708,7 +1862,7 @@ declare interface EnvironmentNonInheritable {
1708
1862
  * here will always be applied to metadata last, so can add new or override existing fields.
1709
1863
  */
1710
1864
  metadata?: {
1711
- [key: string]: string;
1865
+ [key: string]: unknown;
1712
1866
  };
1713
1867
  /**
1714
1868
  * Used for internal capnp uploads for the Workers runtime
@@ -1738,7 +1892,10 @@ declare type ErrorEvent_2 = BaseErrorEvent<"ConfigController" | "BundlerControll
1738
1892
  }>;
1739
1893
 
1740
1894
  declare namespace Errors {
1741
- class UndiciError extends Error { }
1895
+ class UndiciError extends Error {
1896
+ name: string;
1897
+ code: string;
1898
+ }
1742
1899
 
1743
1900
  /** Connect timeout error. */
1744
1901
  class ConnectTimeoutError extends UndiciError {
@@ -1765,6 +1922,12 @@ declare namespace Errors {
1765
1922
  }
1766
1923
 
1767
1924
  class ResponseStatusCodeError extends UndiciError {
1925
+ constructor (
1926
+ message?: string,
1927
+ statusCode?: number,
1928
+ headers?: IncomingHttpHeaders | string[] | null,
1929
+ body?: null | Record<string, any> | string
1930
+ );
1768
1931
  name: 'ResponseStatusCodeError';
1769
1932
  code: 'UND_ERR_RESPONSE_STATUS_CODE';
1770
1933
  body: null | Record<string, any> | string
@@ -1923,6 +2086,11 @@ declare type EventTarget_2 = typeof globalThis extends { EventTarget: infer T }
1923
2086
  ): void
1924
2087
  }
1925
2088
 
2089
+ declare class ExecutionContext_2 {
2090
+ waitUntil(promise: Promise<any>): void;
2091
+ passThroughOnException(): void;
2092
+ }
2093
+
1926
2094
  declare function fetch_2 (
1927
2095
  input: RequestInfo_2,
1928
2096
  init?: RequestInit_2
@@ -2102,12 +2270,61 @@ declare class FormData_2 {
2102
2270
  */
2103
2271
  declare type FormDataEntryValue = string | File_2
2104
2272
 
2273
+ /**
2274
+ * By reading from a `wrangler.toml` file this function generates proxy binding objects that can be
2275
+ * used to simulate the interaction with bindings during local development in a Node.js environment
2276
+ *
2277
+ * @deprecated use `getPlatformProxy` instead
2278
+ *
2279
+ * @param options The various options that can tweak this function's behavior
2280
+ * @returns An Object containing the generated proxies alongside other related utilities
2281
+ */
2282
+ export declare function getBindingsProxy<Bindings = Record<string, unknown>, CfProperties extends Record<string, unknown> = IncomingRequestCfProperties_2>(options?: GetBindingsProxyOptions): Promise<BindingsProxy<Bindings, CfProperties>>;
2283
+
2284
+ /** Options for the `getBindingsProxy` utility */
2285
+ export declare type GetBindingsProxyOptions = GetPlatformProxyOptions;
2286
+
2105
2287
  declare function getCookies (headers: Headers_2): Record<string, string>
2106
2288
 
2107
2289
  declare function getGlobalDispatcher(): Dispatcher;
2108
2290
 
2109
2291
  declare function getGlobalOrigin(): URL | undefined;
2110
2292
 
2293
+ /**
2294
+ * By reading from a `wrangler.toml` file this function generates proxy objects that can be
2295
+ * used to simulate the interaction with the Cloudflare platform during local development
2296
+ * in a Node.js environment
2297
+ *
2298
+ * @param options The various options that can tweak this function's behavior
2299
+ * @returns An Object containing the generated proxies alongside other related utilities
2300
+ */
2301
+ export declare function getPlatformProxy<Env = Record<string, unknown>, CfProperties extends Record<string, unknown> = IncomingRequestCfProperties_2>(options?: GetPlatformProxyOptions): Promise<PlatformProxy<Env, CfProperties>>;
2302
+
2303
+ /**
2304
+ * Options for the `getPlatformProxy` utility
2305
+ */
2306
+ export declare type GetPlatformProxyOptions = {
2307
+ /**
2308
+ * The path to the config object to use (default `wrangler.toml`)
2309
+ */
2310
+ configPath?: string;
2311
+ /**
2312
+ * Flag to indicate the utility to read a json config file (`wrangler.json`)
2313
+ * instead of the toml one (`wrangler.toml`)
2314
+ *
2315
+ * Note: this feature is experimental
2316
+ */
2317
+ experimentalJsonConfig?: boolean;
2318
+ /**
2319
+ * Indicates if and where to persist the bindings data, if not present or `true` it defaults to the same location
2320
+ * used by wrangler v3: `.wrangler/state/v3` (so that the same data can be easily used by the caller and wrangler).
2321
+ * If `false` is specified no data is persisted on the filesystem.
2322
+ */
2323
+ persist?: boolean | {
2324
+ path: string;
2325
+ };
2326
+ };
2327
+
2111
2328
  declare function getSetCookies (headers: Headers_2): Cookie[]
2112
2329
 
2113
2330
  declare class Headers_2 implements SpecIterable<[string, string]> {
@@ -2174,8 +2391,8 @@ declare interface MessageEvent_2<T = any> extends Event_2 {
2174
2391
  readonly data: T
2175
2392
  readonly lastEventId: string
2176
2393
  readonly origin: string
2177
- readonly ports: ReadonlyArray<typeof MessagePort>
2178
- readonly source: typeof MessagePort | null
2394
+ readonly ports: ReadonlyArray<typeof MessagePort_2>
2395
+ readonly source: typeof MessagePort_2 | null
2179
2396
  initMessageEvent(
2180
2397
  type: string,
2181
2398
  bubbles?: boolean,
@@ -2183,8 +2400,8 @@ declare interface MessageEvent_2<T = any> extends Event_2 {
2183
2400
  data?: any,
2184
2401
  origin?: string,
2185
2402
  lastEventId?: string,
2186
- source?: typeof MessagePort | null,
2187
- ports?: (typeof MessagePort)[]
2403
+ source?: typeof MessagePort_2 | null,
2404
+ ports?: (typeof MessagePort_2)[]
2188
2405
  ): void;
2189
2406
  }
2190
2407
 
@@ -2197,8 +2414,8 @@ declare interface MessageEventInit_2<T = any> extends EventInit_2 {
2197
2414
  data?: T
2198
2415
  lastEventId?: string
2199
2416
  origin?: string
2200
- ports?: (typeof MessagePort)[]
2201
- source?: typeof MessagePort | null
2417
+ ports?: (typeof MessagePort_2)[]
2418
+ source?: typeof MessagePort_2 | null
2202
2419
  }
2203
2420
 
2204
2421
  declare interface MIMEType {
@@ -2376,6 +2593,21 @@ declare interface ModuleRule {
2376
2593
  fallthrough?: boolean;
2377
2594
  }
2378
2595
 
2596
+ declare interface MultiCacheQueryOptions extends CacheQueryOptions_2 {
2597
+ cacheName?: string
2598
+ }
2599
+
2600
+ declare interface PagesConfigFields {
2601
+ /**
2602
+ * The directory of static assets to serve.
2603
+ *
2604
+ * The presence of this field in `wrangler.toml` indicates a Pages project,
2605
+ * and will prompt the handling of the configuration file according to the
2606
+ * Pages-specific validation rules.
2607
+ */
2608
+ pages_build_output_dir?: string;
2609
+ }
2610
+
2379
2611
  declare interface PagesDeployOptions {
2380
2612
  /**
2381
2613
  * Path to static assets to deploy to Pages
@@ -2448,6 +2680,32 @@ options: { dispatcher?: Dispatcher } & Omit<Dispatcher.PipelineOptions, 'origin'
2448
2680
  handler: Dispatcher.PipelineHandler
2449
2681
  ): Duplex;
2450
2682
 
2683
+ /**
2684
+ * Result of the `getPlatformProxy` utility
2685
+ */
2686
+ export declare type PlatformProxy<Env = Record<string, unknown>, CfProperties extends Record<string, unknown> = IncomingRequestCfProperties_2> = {
2687
+ /**
2688
+ * Environment object containing the various Cloudflare bindings
2689
+ */
2690
+ env: Env;
2691
+ /**
2692
+ * Mock of the context object that Workers received in their request handler, all the object's methods are no-op
2693
+ */
2694
+ cf: CfProperties;
2695
+ /**
2696
+ * Mock of the context object that Workers received in their request handler, all the object's methods are no-op
2697
+ */
2698
+ ctx: ExecutionContext_2;
2699
+ /**
2700
+ * Caches object emulating the Workers Cache runtime API
2701
+ */
2702
+ caches: CacheStorage_3;
2703
+ /**
2704
+ * Function used to dispose of the child process providing the bindings implementation
2705
+ */
2706
+ dispose: () => Promise<void>;
2707
+ };
2708
+
2451
2709
  declare class Pool extends Dispatcher {
2452
2710
  constructor(url: string | URL_2, options?: Pool.Options)
2453
2711
  /** `true` after `pool.close()` has been called. */
@@ -22767,6 +23025,7 @@ declare namespace ProxyAgent {
22767
23025
  headers?: IncomingHttpHeaders;
22768
23026
  requestTls?: buildConnector.BuildOptions;
22769
23027
  proxyTls?: buildConnector.BuildOptions;
23028
+ clientFactory?(origin: URL, opts: object): Dispatcher;
22770
23029
  }
22771
23030
  }
22772
23031
 
@@ -22805,9 +23064,10 @@ declare type ProxyData = {
22805
23064
  userWorkerUrl: UrlOriginParts;
22806
23065
  userWorkerInspectorUrl: UrlOriginAndPathnameParts;
22807
23066
  userWorkerInnerUrlOverrides: Partial<UrlOriginParts>;
22808
- headers: Record<string, string | undefined>;
23067
+ headers: Record<string, string>;
22809
23068
  liveReload?: boolean;
22810
23069
  proxyLogsToController?: boolean;
23070
+ internalDurableObjects?: CfDurableObject[];
22811
23071
  };
22812
23072
 
22813
23073
  declare type ProxyWorkerIncomingRequestBody = {
@@ -22828,7 +23088,7 @@ declare type ProxyWorkerOutgoingRequestBody = {
22828
23088
  args: Parameters<typeof console.debug>;
22829
23089
  };
22830
23090
 
22831
- declare type RawConfig = Partial<ConfigFields<RawDevConfig>> & RawEnvironment & DeprecatedConfigFields & EnvironmentMap;
23091
+ declare type RawConfig = Partial<ConfigFields<RawDevConfig>> & PagesConfigFields & RawEnvironment & DeprecatedConfigFields & EnvironmentMap;
22832
23092
 
22833
23093
  declare type RawDevConfig = Partial<DevConfig>;
22834
23094
 
@@ -22952,7 +23212,7 @@ declare interface RequestInit_2 {
22952
23212
  body?: BodyInit_2
22953
23213
  redirect?: RequestRedirect
22954
23214
  integrity?: string
22955
- signal?: AbortSignal
23215
+ signal?: AbortSignal | null
22956
23216
  credentials?: RequestCredentials
22957
23217
  mode?: RequestMode
22958
23218
  referrer?: string
@@ -23009,6 +23269,119 @@ declare type ResponseType =
23009
23269
  | 'opaque'
23010
23270
  | 'opaqueredirect'
23011
23271
 
23272
+ declare class RetryHandler implements Dispatcher.DispatchHandlers {
23273
+ constructor(
23274
+ options: Dispatcher.DispatchOptions & {
23275
+ retryOptions?: RetryHandler.RetryOptions;
23276
+ },
23277
+ retryHandlers: RetryHandler.RetryHandlers
23278
+ );
23279
+ }
23280
+
23281
+ declare namespace RetryHandler {
23282
+ type RetryState = { counter: number; currentTimeout: number };
23283
+
23284
+ type RetryContext = {
23285
+ state: RetryState;
23286
+ opts: Dispatcher.DispatchOptions & {
23287
+ retryOptions?: RetryHandler.RetryOptions;
23288
+ };
23289
+ }
23290
+
23291
+ type OnRetryCallback = (result?: Error | null) => void;
23292
+
23293
+ type RetryCallback = (
23294
+ err: Error,
23295
+ context: {
23296
+ state: RetryState;
23297
+ opts: Dispatcher.DispatchOptions & {
23298
+ retryOptions?: RetryHandler.RetryOptions;
23299
+ };
23300
+ },
23301
+ callback: OnRetryCallback
23302
+ ) => number | null;
23303
+
23304
+ interface RetryOptions {
23305
+ /**
23306
+ * Callback to be invoked on every retry iteration.
23307
+ * It receives the error, current state of the retry object and the options object
23308
+ * passed when instantiating the retry handler.
23309
+ *
23310
+ * @type {RetryCallback}
23311
+ * @memberof RetryOptions
23312
+ */
23313
+ retry?: RetryCallback;
23314
+ /**
23315
+ * Maximum number of retries to allow.
23316
+ *
23317
+ * @type {number}
23318
+ * @memberof RetryOptions
23319
+ * @default 5
23320
+ */
23321
+ maxRetries?: number;
23322
+ /**
23323
+ * Max number of milliseconds allow between retries
23324
+ *
23325
+ * @type {number}
23326
+ * @memberof RetryOptions
23327
+ * @default 30000
23328
+ */
23329
+ maxTimeout?: number;
23330
+ /**
23331
+ * Initial number of milliseconds to wait before retrying for the first time.
23332
+ *
23333
+ * @type {number}
23334
+ * @memberof RetryOptions
23335
+ * @default 500
23336
+ */
23337
+ minTimeout?: number;
23338
+ /**
23339
+ * Factior to multiply the timeout factor between retries.
23340
+ *
23341
+ * @type {number}
23342
+ * @memberof RetryOptions
23343
+ * @default 2
23344
+ */
23345
+ timeoutFactor?: number;
23346
+ /**
23347
+ * It enables to automatically infer timeout between retries based on the `Retry-After` header.
23348
+ *
23349
+ * @type {boolean}
23350
+ * @memberof RetryOptions
23351
+ * @default true
23352
+ */
23353
+ retryAfter?: boolean;
23354
+ /**
23355
+ * HTTP methods to retry.
23356
+ *
23357
+ * @type {Dispatcher.HttpMethod[]}
23358
+ * @memberof RetryOptions
23359
+ * @default ['GET', 'HEAD', 'OPTIONS', 'PUT', 'DELETE', 'TRACE'],
23360
+ */
23361
+ methods?: Dispatcher.HttpMethod[];
23362
+ /**
23363
+ * Error codes to be retried. e.g. `ECONNRESET`, `ENOTFOUND`, `ETIMEDOUT`, `ECONNREFUSED`, etc.
23364
+ *
23365
+ * @type {string[]}
23366
+ * @default ['ECONNRESET','ECONNREFUSED','ENOTFOUND','ENETDOWN','ENETUNREACH','EHOSTDOWN','EHOSTUNREACH','EPIPE']
23367
+ */
23368
+ errorCodes?: string[];
23369
+ /**
23370
+ * HTTP status codes to be retried.
23371
+ *
23372
+ * @type {number[]}
23373
+ * @memberof RetryOptions
23374
+ * @default [500, 502, 503, 504, 429],
23375
+ */
23376
+ statusCodes?: number[];
23377
+ }
23378
+
23379
+ interface RetryHandlers {
23380
+ dispatch: Dispatcher["dispatch"];
23381
+ handler: Dispatcher.DispatchHandlers;
23382
+ }
23383
+ }
23384
+
23012
23385
  declare type Route = SimpleRoute | ZoneIdRoute | ZoneNameRoute | CustomDomainRoute;
23013
23386
 
23014
23387
  /**
@@ -23061,6 +23434,10 @@ declare function setGlobalOrigin(origin: string | URL | undefined): void;
23061
23434
 
23062
23435
  declare type SimpleRoute = string;
23063
23436
 
23437
+ export declare type SourcelessWorkerOptions = Omit<WorkerOptions, "script" | "scriptPath" | "modules" | "modulesRoot"> & {
23438
+ modulesRules?: ModuleRule_2[];
23439
+ };
23440
+
23064
23441
  /**
23065
23442
  * Information about Wrangler's bundling process that needs passed through
23066
23443
  * for DevTools sourcemap transformation
@@ -23156,6 +23533,8 @@ declare interface StartDevWorkerOptions {
23156
23533
  hostname?: string;
23157
23534
  port?: number;
23158
23535
  secure?: boolean;
23536
+ httpsKeyPath?: string;
23537
+ httpsCertPath?: string;
23159
23538
  };
23160
23539
  /** Controls what request.url looks like inside the worker. */
23161
23540
  urlOverrides?: {
@@ -23218,6 +23597,7 @@ declare namespace Undici {
23218
23597
  var Pool: Pool;
23219
23598
  var RedirectHandler: RedirectHandler
23220
23599
  var DecoratorHandler: DecoratorHandler
23600
+ var RetryHandler: RetryHandler
23221
23601
  var createRedirectInterceptor: createRedirectInterceptor
23222
23602
  var BalancedPool: BalancedPool;
23223
23603
  var Client: Client;
@@ -23236,10 +23616,18 @@ declare namespace Undici {
23236
23616
  var MockAgent: MockAgent;
23237
23617
  var mockErrors: MockErrors;
23238
23618
  var fetch: fetch_2;
23619
+ var Headers: Headers_2;
23620
+ var Response: Response_2;
23621
+ var Request: Request_2;
23622
+ var FormData: FormData_2;
23623
+ var File: File_2;
23624
+ var FileReader: FileReader;
23625
+ var caches: caches_2;
23239
23626
  }
23240
23627
 
23241
23628
  declare namespace undici {
23242
23629
  export {
23630
+ Undici as default,
23243
23631
  Interceptable,
23244
23632
  Dispatcher,
23245
23633
  BalancedPool,
@@ -23264,7 +23652,7 @@ declare namespace undici {
23264
23652
  ProxyAgent,
23265
23653
  RedirectHandler,
23266
23654
  DecoratorHandler,
23267
- Undici as default,
23655
+ RetryHandler,
23268
23656
  deleteCookie,
23269
23657
  getCookies,
23270
23658
  getSetCookies,
@@ -23308,9 +23696,15 @@ declare namespace undici {
23308
23696
  CloseEvent_2 as CloseEvent,
23309
23697
  MessageEventInit_2 as MessageEventInit,
23310
23698
  MessageEvent_2 as MessageEvent,
23699
+ WebSocketInit,
23311
23700
  parseMIMEType,
23312
23701
  serializeAMimeType,
23313
- MIMEType
23702
+ MIMEType,
23703
+ CacheStorage_2 as CacheStorage,
23704
+ Cache_2 as Cache,
23705
+ CacheQueryOptions_2 as CacheQueryOptions,
23706
+ MultiCacheQueryOptions,
23707
+ caches_2 as caches
23314
23708
  }
23315
23709
  }
23316
23710
 
@@ -23338,10 +23732,21 @@ export declare class unstable_DevEnv extends EventEmitter_2 {
23338
23732
  emitErrorEvent(ev: ErrorEvent_2): void;
23339
23733
  }
23340
23734
 
23735
+ export declare function unstable_getMiniflareWorkerOptions(configPath: string): {
23736
+ workerOptions: SourcelessWorkerOptions;
23737
+ define: Record<string, string>;
23738
+ main?: string;
23739
+ };
23740
+
23341
23741
  export declare const unstable_pages: {
23342
23742
  deploy: typeof deploy;
23343
23743
  };
23344
23744
 
23745
+ /**
23746
+ * Split an SQLQuery into an array of statements
23747
+ */
23748
+ export declare function unstable_splitSqlQuery(sql: string): string[];
23749
+
23345
23750
  export declare interface UnstableDevOptions {
23346
23751
  config?: string;
23347
23752
  env?: string;
@@ -23350,6 +23755,8 @@ export declare interface UnstableDevOptions {
23350
23755
  bundle?: boolean;
23351
23756
  inspectorPort?: number;
23352
23757
  localProtocol?: "http" | "https";
23758
+ httpsKeyPath?: string;
23759
+ httpsCertPath?: string;
23353
23760
  assets?: string;
23354
23761
  site?: string;
23355
23762
  siteInclude?: string[];
@@ -23447,7 +23854,7 @@ declare interface WebSocket_2 extends EventTarget_2 {
23447
23854
  readonly url: string
23448
23855
 
23449
23856
  close(code?: number, reason?: string): void
23450
- send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void
23857
+ send(data: string | ArrayBufferLike | Blob_2 | ArrayBufferView): void
23451
23858
 
23452
23859
  readonly CLOSED: number
23453
23860
  readonly CLOSING: number
@@ -23478,7 +23885,7 @@ declare interface WebSocket_2 extends EventTarget_2 {
23478
23885
 
23479
23886
  declare const WebSocket_2: {
23480
23887
  prototype: WebSocket_2
23481
- new (url: string | URL, protocols?: string | string[]): WebSocket_2
23888
+ new (url: string | URL, protocols?: string | string[] | WebSocketInit): WebSocket_2
23482
23889
  readonly CLOSED: number
23483
23890
  readonly CLOSING: number
23484
23891
  readonly CONNECTING: number
@@ -23492,6 +23899,12 @@ declare interface WebSocketEventMap_2 {
23492
23899
  open: Event_2
23493
23900
  }
23494
23901
 
23902
+ declare interface WebSocketInit {
23903
+ protocols?: string | string[],
23904
+ dispatcher?: Dispatcher,
23905
+ headers?: HeadersInit_2
23906
+ }
23907
+
23495
23908
  declare type ZoneIdRoute = {
23496
23909
  pattern: string;
23497
23910
  zone_id: string;