wrangler 0.0.0-e9c2b04a → 0.0.0-e9f8a2fa
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/config-schema.json +2939 -0
- package/package.json +38 -29
- package/templates/checked-fetch.js +1 -1
- package/templates/facade.d.ts +7 -5
- package/templates/gitignore +0 -5
- package/templates/init-tests/test-vitest-new-worker.js +1 -1
- package/templates/init-tests/test-vitest-new-worker.ts +1 -1
- package/templates/middleware/loader-modules.ts +93 -97
- package/templates/middleware/loader-sw.ts +4 -3
- package/templates/middleware/middleware-ensure-req-body-drained.ts +18 -0
- package/templates/middleware/middleware-miniflare3-json-error.ts +0 -1
- package/templates/middleware/middleware-serve-static-assets.ts +5 -5
- package/templates/pages-dev-pipeline.ts +2 -1
- package/templates/pages-template-plugin.ts +2 -2
- package/templates/pages-template-worker.ts +1 -1
- package/templates/startDevWorker/InspectorProxyWorker.ts +17 -5
- package/templates/startDevWorker/ProxyWorker.ts +122 -40
- package/wrangler-dist/InspectorProxyWorker.js +4 -0
- package/wrangler-dist/InspectorProxyWorker.js.map +1 -1
- package/wrangler-dist/ProxyWorker.js +78 -24
- package/wrangler-dist/ProxyWorker.js.map +1 -1
- package/wrangler-dist/cli.d.ts +772 -248
- package/wrangler-dist/cli.js +79134 -32915
- package/templates/middleware/middleware-d1-beta.d.ts +0 -3
- package/templates/middleware/middleware-multiworker-dev.d.ts +0 -4
- package/templates/middleware/middleware-multiworker-dev.ts +0 -68
package/wrangler-dist/cli.d.ts
CHANGED
|
@@ -6,24 +6,30 @@ 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 { IncomingMessage } from 'http';
|
|
10
|
+
import type { IncomingRequestCfProperties } from '@cloudflare/workers-types/experimental';
|
|
9
11
|
import { IpcNetConnectOpts } from 'net';
|
|
10
12
|
import type { Json } from 'miniflare';
|
|
13
|
+
import type { MessagePort as MessagePort_2 } from 'worker_threads';
|
|
11
14
|
import type { Metafile } from 'esbuild';
|
|
12
15
|
import { Miniflare } from 'miniflare';
|
|
13
16
|
import type { MiniflareOptions } from 'miniflare';
|
|
17
|
+
import type { ModuleRule as ModuleRule_2 } from 'miniflare';
|
|
14
18
|
import { Mutex } from 'miniflare';
|
|
15
19
|
import { Readable } from 'stream';
|
|
16
|
-
import { ReadableStream
|
|
17
|
-
import type { Request as
|
|
18
|
-
import { Response as
|
|
19
|
-
import {
|
|
20
|
+
import { ReadableStream } from 'stream/web';
|
|
21
|
+
import type { Request as Request_2 } from 'miniflare';
|
|
22
|
+
import { Response as Response_2 } from 'miniflare';
|
|
23
|
+
import type { Server } from 'node:http';
|
|
24
|
+
import { ServerResponse } from 'http';
|
|
25
|
+
import { Socket } from 'net';
|
|
20
26
|
import { TcpNetConnectOpts } from 'net';
|
|
21
|
-
import { TlsOptions as TlsOptions_2 } from 'tls';
|
|
22
27
|
import { TLSSocket } from 'tls';
|
|
23
28
|
import { URL as URL_2 } from 'url';
|
|
24
29
|
import { UrlObject } from 'url';
|
|
25
30
|
import { URLSearchParams as URLSearchParams_2 } from 'url';
|
|
26
|
-
import { WebSocket as
|
|
31
|
+
import { WebSocket as WebSocket_2 } from 'miniflare';
|
|
32
|
+
import type { WorkerOptions } from 'miniflare';
|
|
27
33
|
import { Writable } from 'stream';
|
|
28
34
|
|
|
29
35
|
declare type AbortSignal_2 = unknown;
|
|
@@ -47,7 +53,7 @@ declare class Agent extends Dispatcher{
|
|
|
47
53
|
declare namespace Agent {
|
|
48
54
|
interface Options extends Pool.Options {
|
|
49
55
|
/** Default: `(origin, opts) => new Pool(origin, opts)`. */
|
|
50
|
-
factory?(origin: URL_2, opts: Object): Dispatcher;
|
|
56
|
+
factory?(origin: string | URL_2, opts: Object): Dispatcher;
|
|
51
57
|
/** Integer. Default: `0` */
|
|
52
58
|
maxRedirections?: number;
|
|
53
59
|
|
|
@@ -68,10 +74,10 @@ declare type ApiCredentials = {
|
|
|
68
74
|
};
|
|
69
75
|
|
|
70
76
|
declare class BalancedPool extends Dispatcher {
|
|
71
|
-
constructor(url: string | URL_2 |
|
|
77
|
+
constructor(url: string | string[] | URL_2 | URL_2[], options?: Pool.Options);
|
|
72
78
|
|
|
73
|
-
addUpstream(upstream: string): BalancedPool;
|
|
74
|
-
removeUpstream(upstream: string): BalancedPool;
|
|
79
|
+
addUpstream(upstream: string | URL_2): BalancedPool;
|
|
80
|
+
removeUpstream(upstream: string | URL_2): BalancedPool;
|
|
75
81
|
upstreams: Array<string>;
|
|
76
82
|
|
|
77
83
|
/** `true` after `pool.close()` has been called. */
|
|
@@ -133,16 +139,26 @@ declare type Binding = {
|
|
|
133
139
|
[key: string]: unknown;
|
|
134
140
|
};
|
|
135
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Result of the `getBindingsProxy` utility
|
|
144
|
+
*/
|
|
145
|
+
export declare type BindingsProxy<Bindings = Record<string, unknown>, CfProperties extends Record<string, unknown> = IncomingRequestCfProperties> = Omit<PlatformProxy<Bindings, CfProperties>, "env"> & {
|
|
146
|
+
/**
|
|
147
|
+
* Object containing the various proxies
|
|
148
|
+
*/
|
|
149
|
+
bindings: Bindings;
|
|
150
|
+
};
|
|
151
|
+
|
|
136
152
|
declare interface BlobPropertyBag {
|
|
137
153
|
type?: string
|
|
138
154
|
endings?: 'native' | 'transparent'
|
|
139
155
|
}
|
|
140
156
|
|
|
141
|
-
declare type
|
|
157
|
+
declare type BodyInit =
|
|
142
158
|
| ArrayBuffer
|
|
143
159
|
| AsyncIterable<Uint8Array>
|
|
144
160
|
| Blob_2
|
|
145
|
-
|
|
|
161
|
+
| FormData
|
|
146
162
|
| Iterable<Uint8Array>
|
|
147
163
|
| NodeJS.ArrayBufferView
|
|
148
164
|
| URLSearchParams_2
|
|
@@ -150,12 +166,12 @@ declare type BodyInit_2 =
|
|
|
150
166
|
| string
|
|
151
167
|
|
|
152
168
|
declare interface BodyMixin {
|
|
153
|
-
readonly body:
|
|
169
|
+
readonly body: ReadableStream | null
|
|
154
170
|
readonly bodyUsed: boolean
|
|
155
171
|
|
|
156
172
|
readonly arrayBuffer: () => Promise<ArrayBuffer>
|
|
157
173
|
readonly blob: () => Promise<Blob_2>
|
|
158
|
-
readonly formData: () => Promise<
|
|
174
|
+
readonly formData: () => Promise<FormData>
|
|
159
175
|
readonly json: () => Promise<unknown>
|
|
160
176
|
readonly text: () => Promise<string>
|
|
161
177
|
}
|
|
@@ -175,7 +191,7 @@ declare class BodyReadable extends Readable {
|
|
|
175
191
|
/** Consumes and returns the body as a JavaScript Object
|
|
176
192
|
* https://fetch.spec.whatwg.org/#dom-body-json
|
|
177
193
|
*/
|
|
178
|
-
json(): Promise<
|
|
194
|
+
json(): Promise<unknown>
|
|
179
195
|
|
|
180
196
|
/** Consumes and returns the body as a Blob
|
|
181
197
|
* https://fetch.spec.whatwg.org/#dom-body-blob
|
|
@@ -221,6 +237,7 @@ declare function buildConnector (options?: buildConnector.BuildOptions): buildCo
|
|
|
221
237
|
|
|
222
238
|
declare namespace buildConnector {
|
|
223
239
|
type BuildOptions = (ConnectionOptions | TcpNetConnectOpts | IpcNetConnectOpts) & {
|
|
240
|
+
allowH2?: boolean;
|
|
224
241
|
maxCachedSessions?: number | null;
|
|
225
242
|
socketPath?: string | null;
|
|
226
243
|
timeout?: number | null;
|
|
@@ -236,19 +253,13 @@ declare namespace buildConnector {
|
|
|
236
253
|
port: string
|
|
237
254
|
servername?: string
|
|
238
255
|
localAddress?: string | null
|
|
239
|
-
httpSocket?:
|
|
256
|
+
httpSocket?: Socket
|
|
240
257
|
}
|
|
241
258
|
|
|
242
259
|
type Callback = (...args: CallbackArgs) => void
|
|
243
|
-
type CallbackArgs = [null,
|
|
244
|
-
|
|
245
|
-
type connector = connectorAsync | connectorSync
|
|
260
|
+
type CallbackArgs = [null, Socket | TLSSocket] | [Error, null]
|
|
246
261
|
|
|
247
|
-
interface
|
|
248
|
-
(options: buildConnector.Options): Socket_2 | TLSSocket
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
interface connectorAsync {
|
|
262
|
+
interface connector {
|
|
252
263
|
(options: buildConnector.Options, callback: buildConnector.Callback): void
|
|
253
264
|
}
|
|
254
265
|
}
|
|
@@ -266,7 +277,7 @@ declare class BundlerController extends Controller {
|
|
|
266
277
|
emitBundleCompletetEvent(data: BundleCompleteEvent): void;
|
|
267
278
|
on(event: "bundleStart", listener: (_: BundleStartEvent) => void): this;
|
|
268
279
|
on(event: "bundleComplete", listener: (_: BundleCompleteEvent) => void): this;
|
|
269
|
-
on(event: "error", listener: (_:
|
|
280
|
+
on(event: "error", listener: (_: ErrorEvent) => void): this;
|
|
270
281
|
once: typeof BundlerController.on;
|
|
271
282
|
}
|
|
272
283
|
|
|
@@ -275,6 +286,82 @@ declare type BundleStartEvent = {
|
|
|
275
286
|
config: StartDevWorkerOptions;
|
|
276
287
|
};
|
|
277
288
|
|
|
289
|
+
declare interface Cache {
|
|
290
|
+
match (request: RequestInfo, options?: CacheQueryOptions): Promise<Response | undefined>,
|
|
291
|
+
matchAll (request?: RequestInfo, options?: CacheQueryOptions): Promise<readonly Response[]>,
|
|
292
|
+
add (request: RequestInfo): Promise<undefined>,
|
|
293
|
+
addAll (requests: RequestInfo[]): Promise<undefined>,
|
|
294
|
+
put (request: RequestInfo, response: Response): Promise<undefined>,
|
|
295
|
+
delete (request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>,
|
|
296
|
+
keys (request?: RequestInfo, options?: CacheQueryOptions): Promise<readonly Request[]>
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* No-op implementation of Cache
|
|
301
|
+
*/
|
|
302
|
+
declare class Cache_2 {
|
|
303
|
+
delete(request: CacheRequest, options?: CacheQueryOptions_2): Promise<boolean>;
|
|
304
|
+
match(request: CacheRequest, options?: CacheQueryOptions_2): Promise<CacheResponse | undefined>;
|
|
305
|
+
put(request: CacheRequest, response: CacheResponse): Promise<void>;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
declare interface CacheQueryOptions {
|
|
309
|
+
ignoreSearch?: boolean,
|
|
310
|
+
ignoreMethod?: boolean,
|
|
311
|
+
ignoreVary?: boolean
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
declare type CacheQueryOptions_2 = {
|
|
315
|
+
ignoreMethod?: boolean;
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
declare type CacheRequest = any;
|
|
319
|
+
|
|
320
|
+
declare type CacheResponse = any;
|
|
321
|
+
|
|
322
|
+
declare const caches: CacheStorage;
|
|
323
|
+
|
|
324
|
+
declare interface CacheStorage {
|
|
325
|
+
match (request: RequestInfo, options?: MultiCacheQueryOptions): Promise<Response | undefined>,
|
|
326
|
+
has (cacheName: string): Promise<boolean>,
|
|
327
|
+
open (cacheName: string): Promise<Cache>,
|
|
328
|
+
delete (cacheName: string): Promise<boolean>,
|
|
329
|
+
keys (): Promise<string[]>
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
declare const CacheStorage: {
|
|
333
|
+
prototype: CacheStorage
|
|
334
|
+
new(): CacheStorage
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Note about this file:
|
|
339
|
+
*
|
|
340
|
+
* Here we are providing a no-op implementation of the runtime Cache API instead of using
|
|
341
|
+
* the miniflare implementation (via `mf.getCaches()`).
|
|
342
|
+
*
|
|
343
|
+
* We are not using miniflare's implementation because that would require the user to provide
|
|
344
|
+
* miniflare-specific Request objects and they would receive back miniflare-specific Response
|
|
345
|
+
* objects, this (in particular the Request part) is not really suitable for `getPlatformProxy`
|
|
346
|
+
* as people would ideally interact with their bindings in a very production-like manner and
|
|
347
|
+
* requiring them to deal with miniflare-specific classes defeats a bit the purpose of the utility.
|
|
348
|
+
*
|
|
349
|
+
* Similarly the Request and Response types here are set to `undefined` as not to use specific ones
|
|
350
|
+
* that would require us to make a choice right now or the user to adapt their code in order to work
|
|
351
|
+
* with the api.
|
|
352
|
+
*
|
|
353
|
+
* We need to find a better/generic manner in which we can reuse the miniflare cache implementation,
|
|
354
|
+
* but until then the no-op implementation below will have to do.
|
|
355
|
+
*/
|
|
356
|
+
/**
|
|
357
|
+
* No-op implementation of CacheStorage
|
|
358
|
+
*/
|
|
359
|
+
declare class CacheStorage_2 {
|
|
360
|
+
constructor();
|
|
361
|
+
open(cacheName: string): Promise<Cache_2>;
|
|
362
|
+
get default(): Cache_2;
|
|
363
|
+
}
|
|
364
|
+
|
|
278
365
|
/**
|
|
279
366
|
* A Cloudflare account.
|
|
280
367
|
*/
|
|
@@ -291,6 +378,16 @@ declare interface CfAccount {
|
|
|
291
378
|
accountId: string;
|
|
292
379
|
}
|
|
293
380
|
|
|
381
|
+
/**
|
|
382
|
+
* A Durable Object.
|
|
383
|
+
*/
|
|
384
|
+
declare interface CfDurableObject {
|
|
385
|
+
name: string;
|
|
386
|
+
class_name: string;
|
|
387
|
+
script_name?: string;
|
|
388
|
+
environment?: string;
|
|
389
|
+
}
|
|
390
|
+
|
|
294
391
|
/**
|
|
295
392
|
* An imported module.
|
|
296
393
|
*/
|
|
@@ -333,14 +430,16 @@ declare interface CfModule {
|
|
|
333
430
|
/**
|
|
334
431
|
* A module type.
|
|
335
432
|
*/
|
|
336
|
-
declare type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer";
|
|
433
|
+
declare type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer" | "python" | "python-requirement";
|
|
337
434
|
|
|
338
435
|
/**
|
|
339
436
|
* The type of Worker
|
|
340
437
|
*/
|
|
341
438
|
declare type CfScriptFormat = "modules" | "service-worker";
|
|
342
439
|
|
|
343
|
-
/**
|
|
440
|
+
/**
|
|
441
|
+
* A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default.
|
|
442
|
+
*/
|
|
344
443
|
declare class Client extends Dispatcher {
|
|
345
444
|
constructor(url: string | URL_2, options?: Client.Options);
|
|
346
445
|
/** Property to get and set the pipelining factor. */
|
|
@@ -352,39 +451,71 @@ declare class Client extends Dispatcher {
|
|
|
352
451
|
}
|
|
353
452
|
|
|
354
453
|
declare namespace Client {
|
|
454
|
+
interface OptionsInterceptors {
|
|
455
|
+
Client: readonly Dispatcher.DispatchInterceptor[];
|
|
456
|
+
}
|
|
355
457
|
interface Options {
|
|
356
|
-
/**
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
|
|
458
|
+
/** TODO */
|
|
459
|
+
interceptors?: OptionsInterceptors;
|
|
460
|
+
/** The maximum length of request headers in bytes. Default: Node.js' `--max-http-header-size` or `16384` (16KiB). */
|
|
461
|
+
maxHeaderSize?: number;
|
|
462
|
+
/** 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). */
|
|
463
|
+
headersTimeout?: number;
|
|
464
|
+
/** @deprecated unsupported socketTimeout, use headersTimeout & bodyTimeout instead */
|
|
465
|
+
socketTimeout?: never;
|
|
466
|
+
/** @deprecated unsupported requestTimeout, use headersTimeout & bodyTimeout instead */
|
|
467
|
+
requestTimeout?: never;
|
|
468
|
+
/** TODO */
|
|
469
|
+
connectTimeout?: number;
|
|
368
470
|
/** 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
|
|
370
|
-
/**
|
|
371
|
-
|
|
471
|
+
bodyTimeout?: number;
|
|
472
|
+
/** @deprecated unsupported idleTimeout, use keepAliveTimeout instead */
|
|
473
|
+
idleTimeout?: never;
|
|
474
|
+
/** @deprecated unsupported keepAlive, use pipelining=0 instead */
|
|
475
|
+
keepAlive?: never;
|
|
476
|
+
/** 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). */
|
|
477
|
+
keepAliveTimeout?: number;
|
|
478
|
+
/** @deprecated unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead */
|
|
479
|
+
maxKeepAliveTimeout?: never;
|
|
480
|
+
/** the maximum allowed `idleTimeout`, in milliseconds, when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */
|
|
481
|
+
keepAliveMaxTimeout?: number;
|
|
482
|
+
/** 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). */
|
|
483
|
+
keepAliveTimeoutThreshold?: number;
|
|
484
|
+
/** TODO */
|
|
485
|
+
socketPath?: string;
|
|
486
|
+
/** 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`. */
|
|
487
|
+
pipelining?: number;
|
|
488
|
+
/** @deprecated use the connect option instead */
|
|
489
|
+
tls?: never;
|
|
372
490
|
/** If `true`, an error is thrown when the request content-length header doesn't match the length of the request body. Default: `true`. */
|
|
373
491
|
strictContentLength?: boolean;
|
|
374
|
-
/**
|
|
375
|
-
|
|
376
|
-
/** */
|
|
492
|
+
/** TODO */
|
|
493
|
+
maxCachedSessions?: number;
|
|
494
|
+
/** TODO */
|
|
495
|
+
maxRedirections?: number;
|
|
496
|
+
/** TODO */
|
|
497
|
+
connect?: buildConnector.BuildOptions | buildConnector.connector;
|
|
498
|
+
/** TODO */
|
|
377
499
|
maxRequestsPerClient?: number;
|
|
500
|
+
/** TODO */
|
|
501
|
+
localAddress?: string;
|
|
378
502
|
/** Max response body size in bytes, -1 is disabled */
|
|
379
|
-
maxResponseSize?: number
|
|
503
|
+
maxResponseSize?: number;
|
|
380
504
|
/** Enables a family autodetection algorithm that loosely implements section 5 of RFC 8305. */
|
|
381
505
|
autoSelectFamily?: boolean;
|
|
382
506
|
/** 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
507
|
autoSelectFamilyAttemptTimeout?: number;
|
|
384
|
-
|
|
385
|
-
|
|
508
|
+
/**
|
|
509
|
+
* @description Enables support for H2 if the server has assigned bigger priority to it through ALPN negotiation.
|
|
510
|
+
* @default false
|
|
511
|
+
*/
|
|
512
|
+
allowH2?: boolean;
|
|
513
|
+
/**
|
|
514
|
+
* @description Dictates the maximum number of concurrent streams for a single H2 session. It can be overridden by a SETTINGS remote frame.
|
|
515
|
+
* @default 100
|
|
516
|
+
*/
|
|
517
|
+
maxConcurrentStreams?: number
|
|
386
518
|
}
|
|
387
|
-
|
|
388
519
|
interface SocketInfo {
|
|
389
520
|
localAddress?: string
|
|
390
521
|
localPort?: number
|
|
@@ -395,27 +526,33 @@ declare namespace Client {
|
|
|
395
526
|
bytesWritten?: number
|
|
396
527
|
bytesRead?: number
|
|
397
528
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
529
|
}
|
|
401
530
|
|
|
402
|
-
declare interface
|
|
531
|
+
declare interface CloseEvent extends Event_2 {
|
|
403
532
|
readonly code: number
|
|
404
533
|
readonly reason: string
|
|
405
534
|
readonly wasClean: boolean
|
|
406
535
|
}
|
|
407
536
|
|
|
408
|
-
declare const
|
|
409
|
-
prototype:
|
|
410
|
-
new (type: string, eventInitDict?:
|
|
537
|
+
declare const CloseEvent: {
|
|
538
|
+
prototype: CloseEvent
|
|
539
|
+
new (type: string, eventInitDict?: CloseEventInit): CloseEvent
|
|
411
540
|
};
|
|
412
541
|
|
|
413
|
-
declare interface
|
|
542
|
+
declare interface CloseEventInit extends EventInit {
|
|
414
543
|
code?: number
|
|
415
544
|
reason?: string
|
|
416
545
|
wasClean?: boolean
|
|
417
546
|
}
|
|
418
547
|
|
|
548
|
+
/**
|
|
549
|
+
* Configuration in wrangler for Cloudchamber
|
|
550
|
+
*/
|
|
551
|
+
declare type CloudchamberConfig = {
|
|
552
|
+
vcpu?: number;
|
|
553
|
+
memory?: string;
|
|
554
|
+
};
|
|
555
|
+
|
|
419
556
|
declare class ConfigController extends EventEmitter_2 {
|
|
420
557
|
config?: StartDevWorkerOptions;
|
|
421
558
|
setOptions(_: StartDevWorkerOptions): void;
|
|
@@ -423,7 +560,7 @@ declare class ConfigController extends EventEmitter_2 {
|
|
|
423
560
|
teardown(): Promise<void>;
|
|
424
561
|
emitConfigUpdateEvent(data: ConfigUpdateEvent): void;
|
|
425
562
|
on(event: "configUpdate", listener: (_: ConfigUpdateEvent) => void): this;
|
|
426
|
-
on(event: "error", listener: (_:
|
|
563
|
+
on(event: "error", listener: (_: ErrorEvent) => void): this;
|
|
427
564
|
once: typeof ConfigController.on;
|
|
428
565
|
}
|
|
429
566
|
|
|
@@ -454,7 +591,7 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
|
|
|
454
591
|
*
|
|
455
592
|
* More details at https://developers.cloudflare.com/workers/learning/using-durable-objects#configuring-durable-object-classes-with-migrations
|
|
456
593
|
*
|
|
457
|
-
* @default
|
|
594
|
+
* @default []
|
|
458
595
|
*/
|
|
459
596
|
migrations: {
|
|
460
597
|
/** A unique identifier for this migration. */
|
|
@@ -498,7 +635,7 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
|
|
|
498
635
|
* items will be uploaded. Example: include = ["upload_dir"]
|
|
499
636
|
*
|
|
500
637
|
* @optional
|
|
501
|
-
* @default
|
|
638
|
+
* @default []
|
|
502
639
|
*/
|
|
503
640
|
include?: string[];
|
|
504
641
|
/**
|
|
@@ -507,7 +644,7 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
|
|
|
507
644
|
* uploads. Example: exclude = ["ignore_dir"]
|
|
508
645
|
*
|
|
509
646
|
* @optional
|
|
510
|
-
* @default
|
|
647
|
+
* @default []
|
|
511
648
|
*/
|
|
512
649
|
exclude?: string[];
|
|
513
650
|
} | undefined;
|
|
@@ -562,7 +699,7 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
|
|
|
562
699
|
/**
|
|
563
700
|
* The possible types for a `Rule`.
|
|
564
701
|
*/
|
|
565
|
-
declare type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data";
|
|
702
|
+
declare type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data" | "PythonModule" | "PythonRequirement";
|
|
566
703
|
|
|
567
704
|
declare type ConfigUpdateEvent = {
|
|
568
705
|
type: "configUpdate";
|
|
@@ -609,7 +746,7 @@ declare type DeferredPromise<T> = {
|
|
|
609
746
|
};
|
|
610
747
|
|
|
611
748
|
declare function deleteCookie (
|
|
612
|
-
headers:
|
|
749
|
+
headers: Headers,
|
|
613
750
|
name: string,
|
|
614
751
|
attributes?: { name?: string, domain?: string }
|
|
615
752
|
): void
|
|
@@ -619,10 +756,10 @@ attributes?: { name?: string, domain?: string }
|
|
|
619
756
|
* NOTE: You will need the `CLOUDFLARE_API_KEY` environment
|
|
620
757
|
* variable set
|
|
621
758
|
*/
|
|
622
|
-
declare function deploy({ directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, }: PagesDeployOptions): Promise<{
|
|
759
|
+
declare function deploy({ directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, args, }: PagesDeployOptions): Promise<{
|
|
623
760
|
url: string;
|
|
624
|
-
environment: "production" | "preview";
|
|
625
761
|
id: string;
|
|
762
|
+
environment: "production" | "preview";
|
|
626
763
|
project_id: string;
|
|
627
764
|
project_name: string;
|
|
628
765
|
build_config: {
|
|
@@ -661,7 +798,6 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
|
|
|
661
798
|
build_image_major_version: number;
|
|
662
799
|
kv_namespaces?: any;
|
|
663
800
|
source?: {
|
|
664
|
-
type: "github" | "gitlab";
|
|
665
801
|
config: {
|
|
666
802
|
owner: string;
|
|
667
803
|
repo_name: string;
|
|
@@ -673,6 +809,7 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
|
|
|
673
809
|
preview_branch_includes?: string[] | undefined;
|
|
674
810
|
preview_branch_excludes?: string[] | undefined;
|
|
675
811
|
};
|
|
812
|
+
type: "github" | "gitlab";
|
|
676
813
|
} | undefined;
|
|
677
814
|
env_vars?: any;
|
|
678
815
|
durable_object_namespaces?: any;
|
|
@@ -717,7 +854,7 @@ declare interface DeprecatedUpload {
|
|
|
717
854
|
*/
|
|
718
855
|
format?: "modules" | "service-worker";
|
|
719
856
|
/**
|
|
720
|
-
* The directory you wish to upload your
|
|
857
|
+
* The directory you wish to upload your Worker from,
|
|
721
858
|
* relative to the wrangler.toml file.
|
|
722
859
|
*
|
|
723
860
|
* Defaults to the directory containing the wrangler.toml file.
|
|
@@ -741,35 +878,34 @@ declare interface DevConfig {
|
|
|
741
878
|
/**
|
|
742
879
|
* IP address for the local dev server to listen on,
|
|
743
880
|
*
|
|
744
|
-
* @default
|
|
881
|
+
* @default localhost
|
|
745
882
|
*/
|
|
746
883
|
ip: string;
|
|
747
884
|
/**
|
|
748
885
|
* Port for the local dev server to listen on
|
|
749
886
|
*
|
|
750
|
-
* @default
|
|
887
|
+
* @default 8787
|
|
751
888
|
*/
|
|
752
889
|
port: number | undefined;
|
|
753
890
|
/**
|
|
754
891
|
* Port for the local dev server's inspector to listen on
|
|
755
892
|
*
|
|
756
|
-
* @default
|
|
893
|
+
* @default 9229
|
|
757
894
|
*/
|
|
758
895
|
inspector_port: number | undefined;
|
|
759
896
|
/**
|
|
760
897
|
* Protocol that local wrangler dev server listens to requests on.
|
|
761
898
|
*
|
|
762
|
-
* @default
|
|
899
|
+
* @default http
|
|
763
900
|
*/
|
|
764
901
|
local_protocol: "http" | "https";
|
|
765
902
|
/**
|
|
766
903
|
* Protocol that wrangler dev forwards requests on
|
|
767
904
|
*
|
|
768
|
-
* Setting this to `http` is not currently implemented.
|
|
905
|
+
* Setting this to `http` is not currently implemented for remote mode.
|
|
769
906
|
* See https://github.com/cloudflare/workers-sdk/issues/583
|
|
770
907
|
*
|
|
771
|
-
* @default
|
|
772
|
-
* @todo this needs to be implemented https://github.com/cloudflare/workers-sdk/issues/583
|
|
908
|
+
* @default https
|
|
773
909
|
*/
|
|
774
910
|
upstream_protocol: "https" | "http";
|
|
775
911
|
/**
|
|
@@ -838,20 +974,20 @@ declare namespace DiagnosticsChannel {
|
|
|
838
974
|
interface ClientSendHeadersMessage {
|
|
839
975
|
request: Request;
|
|
840
976
|
headers: string;
|
|
841
|
-
socket:
|
|
977
|
+
socket: Socket;
|
|
842
978
|
}
|
|
843
979
|
interface ClientBeforeConnectMessage {
|
|
844
980
|
connectParams: ConnectParams;
|
|
845
981
|
connector: Connector;
|
|
846
982
|
}
|
|
847
983
|
interface ClientConnectedMessage {
|
|
848
|
-
socket:
|
|
984
|
+
socket: Socket;
|
|
849
985
|
connectParams: ConnectParams;
|
|
850
986
|
connector: Connector;
|
|
851
987
|
}
|
|
852
988
|
interface ClientConnectErrorMessage {
|
|
853
989
|
error: Error;
|
|
854
|
-
socket:
|
|
990
|
+
socket: Socket;
|
|
855
991
|
connectParams: ConnectParams;
|
|
856
992
|
connector: Connector;
|
|
857
993
|
}
|
|
@@ -944,7 +1080,7 @@ declare namespace Dispatcher {
|
|
|
944
1080
|
path: string;
|
|
945
1081
|
method: HttpMethod;
|
|
946
1082
|
/** Default: `null` */
|
|
947
|
-
body?: string | Buffer | Uint8Array | Readable | null |
|
|
1083
|
+
body?: string | Buffer | Uint8Array | Readable | null | FormData;
|
|
948
1084
|
/** Default: `null` */
|
|
949
1085
|
headers?: IncomingHttpHeaders | string[] | null;
|
|
950
1086
|
/** Query string params to be embedded in the request URL. Default: `null` */
|
|
@@ -955,7 +1091,7 @@ declare namespace Dispatcher {
|
|
|
955
1091
|
blocking?: boolean;
|
|
956
1092
|
/** Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`. Default: `method === 'CONNECT' || null`. */
|
|
957
1093
|
upgrade?: boolean | string | null;
|
|
958
|
-
/** The amount of time the parser will wait to receive the complete HTTP headers. Defaults to 300 seconds. */
|
|
1094
|
+
/** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers. Defaults to 300 seconds. */
|
|
959
1095
|
headersTimeout?: number | null;
|
|
960
1096
|
/** 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
1097
|
bodyTimeout?: number | null;
|
|
@@ -963,6 +1099,8 @@ declare namespace Dispatcher {
|
|
|
963
1099
|
reset?: boolean;
|
|
964
1100
|
/** Whether Undici should throw an error upon receiving a 4xx or 5xx response from the server. Defaults to false */
|
|
965
1101
|
throwOnError?: boolean;
|
|
1102
|
+
/** For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server*/
|
|
1103
|
+
expectContinue?: boolean;
|
|
966
1104
|
}
|
|
967
1105
|
interface ConnectOptions {
|
|
968
1106
|
path: string;
|
|
@@ -988,6 +1126,8 @@ declare namespace Dispatcher {
|
|
|
988
1126
|
onInfo?: (info: { statusCode: number, headers: Record<string, string | string[]> }) => void;
|
|
989
1127
|
/** Default: `null` */
|
|
990
1128
|
responseHeader?: 'raw' | null;
|
|
1129
|
+
/** Default: `64 KiB` */
|
|
1130
|
+
highWaterMark?: number;
|
|
991
1131
|
}
|
|
992
1132
|
interface PipelineOptions extends RequestOptions {
|
|
993
1133
|
/** `true` if the `handler` will return an object stream. Default: `false` */
|
|
@@ -1053,7 +1193,7 @@ declare namespace Dispatcher {
|
|
|
1053
1193
|
/** Invoked when request is upgraded either due to a `Upgrade` header or `CONNECT` method. */
|
|
1054
1194
|
onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex): void;
|
|
1055
1195
|
/** 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;
|
|
1196
|
+
onHeaders?(statusCode: number, headers: Buffer[] | string[] | null, resume: () => void, statusText: string): boolean;
|
|
1057
1197
|
/** Invoked when response payload data is received. */
|
|
1058
1198
|
onData?(chunk: Buffer): boolean;
|
|
1059
1199
|
/** Invoked when response payload and trailers have been received and the request has completed. */
|
|
@@ -1073,7 +1213,7 @@ declare namespace Dispatcher {
|
|
|
1073
1213
|
arrayBuffer(): Promise<ArrayBuffer>;
|
|
1074
1214
|
blob(): Promise<Blob_2>;
|
|
1075
1215
|
formData(): Promise<never>;
|
|
1076
|
-
json(): Promise<
|
|
1216
|
+
json(): Promise<unknown>;
|
|
1077
1217
|
text(): Promise<string>;
|
|
1078
1218
|
}
|
|
1079
1219
|
|
|
@@ -1087,11 +1227,11 @@ declare interface DispatchNamespaceOutbound {
|
|
|
1087
1227
|
service: string;
|
|
1088
1228
|
/** (Optional) Name of the environment handling the outbound requests. */
|
|
1089
1229
|
environment?: string;
|
|
1090
|
-
/** (Optional) List of parameter names, for sending context from your dispatch
|
|
1230
|
+
/** (Optional) List of parameter names, for sending context from your dispatch Worker to the outbound handler */
|
|
1091
1231
|
parameters?: string[];
|
|
1092
1232
|
}
|
|
1093
1233
|
|
|
1094
|
-
declare type
|
|
1234
|
+
declare type DOMException = typeof globalThis extends { DOMException: infer T }
|
|
1095
1235
|
? T
|
|
1096
1236
|
: any
|
|
1097
1237
|
|
|
@@ -1100,7 +1240,7 @@ declare type DurableObjectBindings = {
|
|
|
1100
1240
|
name: string;
|
|
1101
1241
|
/** The exported class name of the Durable Object */
|
|
1102
1242
|
class_name: string;
|
|
1103
|
-
/** The script where the Durable Object is defined (if it's external to this
|
|
1243
|
+
/** The script where the Durable Object is defined (if it's external to this Worker) */
|
|
1104
1244
|
script_name?: string;
|
|
1105
1245
|
/** The service environment of the script_name to bind to */
|
|
1106
1246
|
environment?: string;
|
|
@@ -1158,7 +1298,7 @@ declare interface EnvironmentDeprecated {
|
|
|
1158
1298
|
*/
|
|
1159
1299
|
"kv-namespaces"?: string;
|
|
1160
1300
|
/**
|
|
1161
|
-
* A list of services that your
|
|
1301
|
+
* A list of services that your Worker should be bound to.
|
|
1162
1302
|
*
|
|
1163
1303
|
* @default `[]`
|
|
1164
1304
|
* @deprecated DO NOT USE. We'd added this to test the new service binding system, but the proper way to test experimental features is to use `unsafe.bindings` configuration.
|
|
@@ -1179,7 +1319,7 @@ declare interface EnvironmentDeprecated {
|
|
|
1179
1319
|
*/
|
|
1180
1320
|
declare interface EnvironmentInheritable {
|
|
1181
1321
|
/**
|
|
1182
|
-
* The name of your
|
|
1322
|
+
* The name of your Worker. Alphanumeric + dashes only.
|
|
1183
1323
|
*
|
|
1184
1324
|
* @inheritable
|
|
1185
1325
|
*/
|
|
@@ -1209,58 +1349,73 @@ declare interface EnvironmentInheritable {
|
|
|
1209
1349
|
*
|
|
1210
1350
|
* More details at https://developers.cloudflare.com/workers/platform/compatibility-dates
|
|
1211
1351
|
*
|
|
1352
|
+
* @default `[]`
|
|
1212
1353
|
* @inheritable
|
|
1213
1354
|
*/
|
|
1214
1355
|
compatibility_flags: string[];
|
|
1215
1356
|
/**
|
|
1216
1357
|
* The entrypoint/path to the JavaScript file that will be executed.
|
|
1358
|
+
*
|
|
1359
|
+
* @inheritable
|
|
1217
1360
|
*/
|
|
1218
1361
|
main: string | undefined;
|
|
1219
1362
|
/**
|
|
1220
1363
|
* If true then Wrangler will traverse the file tree below `base_dir`;
|
|
1221
|
-
* Any files that match `rules` will be included in the deployed
|
|
1364
|
+
* Any files that match `rules` will be included in the deployed Worker.
|
|
1222
1365
|
* Defaults to true if `no_bundle` is true, otherwise false.
|
|
1223
1366
|
*
|
|
1224
1367
|
* @inheritable
|
|
1225
1368
|
*/
|
|
1226
1369
|
find_additional_modules: boolean | undefined;
|
|
1227
1370
|
/**
|
|
1228
|
-
*
|
|
1229
|
-
*
|
|
1371
|
+
* Determines whether Wrangler will preserve bundled file names.
|
|
1372
|
+
* Defaults to false.
|
|
1373
|
+
* If left unset, files will be named using the pattern ${fileHash}-${basename},
|
|
1374
|
+
* for example, `34de60b44167af5c5a709e62a4e20c4f18c9e3b6-favicon.ico`.
|
|
1375
|
+
*
|
|
1376
|
+
* @inheritable
|
|
1377
|
+
*/
|
|
1378
|
+
preserve_file_names: boolean | undefined;
|
|
1379
|
+
/**
|
|
1380
|
+
* The directory in which module rules should be evaluated when including additional files into a Worker deployment.
|
|
1381
|
+
* This defaults to the directory containing the `main` entry point of the Worker if not specified.
|
|
1230
1382
|
*
|
|
1231
1383
|
* @inheritable
|
|
1232
1384
|
*/
|
|
1233
1385
|
base_dir: string | undefined;
|
|
1234
1386
|
/**
|
|
1235
1387
|
* Whether we use <name>.<subdomain>.workers.dev to
|
|
1236
|
-
* test and deploy your
|
|
1388
|
+
* test and deploy your Worker.
|
|
1237
1389
|
*
|
|
1390
|
+
* // Carmen according to our tests the default is undefined
|
|
1238
1391
|
* @default `true` (This is a breaking change from Wrangler v1)
|
|
1239
1392
|
* @breaking
|
|
1240
1393
|
* @inheritable
|
|
1241
1394
|
*/
|
|
1242
1395
|
workers_dev: boolean | undefined;
|
|
1243
1396
|
/**
|
|
1244
|
-
* A list of routes that your
|
|
1397
|
+
* A list of routes that your Worker should be published to.
|
|
1245
1398
|
* Only one of `routes` or `route` is required.
|
|
1246
1399
|
*
|
|
1247
|
-
* Only required when workers_dev is false, and there's no scheduled
|
|
1400
|
+
* Only required when workers_dev is false, and there's no scheduled Worker (see `triggers`)
|
|
1248
1401
|
*
|
|
1249
1402
|
* @inheritable
|
|
1250
1403
|
*/
|
|
1251
1404
|
routes: Route[] | undefined;
|
|
1252
1405
|
/**
|
|
1253
|
-
* A route that your
|
|
1406
|
+
* A route that your Worker should be published to. Literally
|
|
1254
1407
|
* the same as routes, but only one.
|
|
1255
1408
|
* Only one of `routes` or `route` is required.
|
|
1256
1409
|
*
|
|
1257
|
-
* Only required when workers_dev is false, and there's no scheduled
|
|
1410
|
+
* Only required when workers_dev is false, and there's no scheduled Worker
|
|
1258
1411
|
*
|
|
1259
1412
|
* @inheritable
|
|
1260
1413
|
*/
|
|
1261
1414
|
route: Route | undefined;
|
|
1262
1415
|
/**
|
|
1263
1416
|
* Path to a custom tsconfig
|
|
1417
|
+
*
|
|
1418
|
+
* @inheritable
|
|
1264
1419
|
*/
|
|
1265
1420
|
tsconfig: string | undefined;
|
|
1266
1421
|
/**
|
|
@@ -1278,9 +1433,9 @@ declare interface EnvironmentInheritable {
|
|
|
1278
1433
|
*/
|
|
1279
1434
|
jsx_fragment: string;
|
|
1280
1435
|
/**
|
|
1281
|
-
* "Cron" definitions to trigger a
|
|
1436
|
+
* "Cron" definitions to trigger a Worker's "scheduled" function.
|
|
1282
1437
|
*
|
|
1283
|
-
* Lets you call
|
|
1438
|
+
* Lets you call Workers periodically, much like a cron job.
|
|
1284
1439
|
*
|
|
1285
1440
|
* More details here https://developers.cloudflare.com/workers/platform/cron-triggers
|
|
1286
1441
|
*
|
|
@@ -1324,7 +1479,7 @@ declare interface EnvironmentInheritable {
|
|
|
1324
1479
|
* Refer to the [custom builds documentation](https://developers.cloudflare.com/workers/cli-wrangler/configuration#build)
|
|
1325
1480
|
* for more details.
|
|
1326
1481
|
*
|
|
1327
|
-
* @default {}
|
|
1482
|
+
* @default {watch_dir:"./src"}
|
|
1328
1483
|
*/
|
|
1329
1484
|
build: {
|
|
1330
1485
|
/** The command used to build your Worker. On Linux and macOS, the command is executed in the `sh` shell and the `cmd` shell for Windows. The `&&` and `||` shell operators may be used. */
|
|
@@ -1355,24 +1510,9 @@ declare interface EnvironmentInheritable {
|
|
|
1355
1510
|
*/
|
|
1356
1511
|
node_compat: boolean | undefined;
|
|
1357
1512
|
/**
|
|
1358
|
-
*
|
|
1513
|
+
* Designates this Worker as an internal-only "first-party" Worker.
|
|
1359
1514
|
*
|
|
1360
|
-
*
|
|
1361
|
-
* and so must be specified in every named environment.
|
|
1362
|
-
*
|
|
1363
|
-
* @default `[]`
|
|
1364
|
-
* @nonInheritable
|
|
1365
|
-
*/
|
|
1366
|
-
dispatch_namespaces: {
|
|
1367
|
-
/** The binding name used to refer to the bound service. */
|
|
1368
|
-
binding: string;
|
|
1369
|
-
/** The namespace to bind to. */
|
|
1370
|
-
namespace: string;
|
|
1371
|
-
/** Details about the outbound worker which will handle outbound requests from your namespace */
|
|
1372
|
-
outbound?: DispatchNamespaceOutbound;
|
|
1373
|
-
}[];
|
|
1374
|
-
/**
|
|
1375
|
-
* Designates this worker as an internal-only "first-party" worker.
|
|
1515
|
+
* @inheritable
|
|
1376
1516
|
*/
|
|
1377
1517
|
first_party_worker: boolean | undefined;
|
|
1378
1518
|
/**
|
|
@@ -1397,7 +1537,7 @@ declare interface EnvironmentInheritable {
|
|
|
1397
1537
|
}[];
|
|
1398
1538
|
};
|
|
1399
1539
|
/**
|
|
1400
|
-
* Send Trace Events from this
|
|
1540
|
+
* Send Trace Events from this Worker to Workers Logpush.
|
|
1401
1541
|
*
|
|
1402
1542
|
* This will not configure a corresponding Logpush job automatically.
|
|
1403
1543
|
*
|
|
@@ -1408,9 +1548,16 @@ declare interface EnvironmentInheritable {
|
|
|
1408
1548
|
*/
|
|
1409
1549
|
logpush: boolean | undefined;
|
|
1410
1550
|
/**
|
|
1411
|
-
*
|
|
1551
|
+
* Include source maps when uploading this worker.
|
|
1552
|
+
* @inheritable
|
|
1553
|
+
*/
|
|
1554
|
+
upload_source_maps: boolean | undefined;
|
|
1555
|
+
/**
|
|
1556
|
+
* Specify how the Worker should be located to minimize round-trip time.
|
|
1412
1557
|
*
|
|
1413
1558
|
* More details: https://developers.cloudflare.com/workers/platform/smart-placement/
|
|
1559
|
+
*
|
|
1560
|
+
* @inheritable
|
|
1414
1561
|
*/
|
|
1415
1562
|
placement: {
|
|
1416
1563
|
mode: "off" | "smart";
|
|
@@ -1428,7 +1575,7 @@ declare interface EnvironmentMap {
|
|
|
1428
1575
|
*
|
|
1429
1576
|
* For more information, see the documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration#environments
|
|
1430
1577
|
*
|
|
1431
|
-
* @default
|
|
1578
|
+
* @default {}
|
|
1432
1579
|
*/
|
|
1433
1580
|
env?: {
|
|
1434
1581
|
[envName: string]: RawEnvironment;
|
|
@@ -1444,7 +1591,7 @@ declare interface EnvironmentMap {
|
|
|
1444
1591
|
*/
|
|
1445
1592
|
declare interface EnvironmentNonInheritable {
|
|
1446
1593
|
/**
|
|
1447
|
-
* A map of values to substitute when deploying your
|
|
1594
|
+
* A map of values to substitute when deploying your Worker.
|
|
1448
1595
|
*
|
|
1449
1596
|
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1450
1597
|
* and so must be specified in every named environment.
|
|
@@ -1454,7 +1601,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
1454
1601
|
*/
|
|
1455
1602
|
define: Record<string, string>;
|
|
1456
1603
|
/**
|
|
1457
|
-
* A map of environment variables to set when deploying your
|
|
1604
|
+
* A map of environment variables to set when deploying your Worker.
|
|
1458
1605
|
*
|
|
1459
1606
|
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1460
1607
|
* and so must be specified in every named environment.
|
|
@@ -1464,7 +1611,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
1464
1611
|
*/
|
|
1465
1612
|
vars: Record<string, string | Json>;
|
|
1466
1613
|
/**
|
|
1467
|
-
* A list of durable objects that your
|
|
1614
|
+
* A list of durable objects that your Worker should be bound to.
|
|
1468
1615
|
*
|
|
1469
1616
|
* For more information about Durable Objects, see the documentation at
|
|
1470
1617
|
* https://developers.cloudflare.com/workers/learning/using-durable-objects
|
|
@@ -1478,6 +1625,16 @@ declare interface EnvironmentNonInheritable {
|
|
|
1478
1625
|
durable_objects: {
|
|
1479
1626
|
bindings: DurableObjectBindings;
|
|
1480
1627
|
};
|
|
1628
|
+
/**
|
|
1629
|
+
* Cloudchamber configuration
|
|
1630
|
+
*
|
|
1631
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1632
|
+
* and so must be specified in every named environment.
|
|
1633
|
+
*
|
|
1634
|
+
* @default `{}`
|
|
1635
|
+
* @nonInheritable
|
|
1636
|
+
*/
|
|
1637
|
+
cloudchamber: CloudchamberConfig;
|
|
1481
1638
|
/**
|
|
1482
1639
|
* These specify any Workers KV Namespaces you want to
|
|
1483
1640
|
* access from inside your Worker.
|
|
@@ -1522,21 +1679,25 @@ declare interface EnvironmentNonInheritable {
|
|
|
1522
1679
|
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1523
1680
|
* and so must be specified in every named environment.
|
|
1524
1681
|
*
|
|
1525
|
-
* @default `{}`
|
|
1682
|
+
* @default `{consumers:[],producers:[]}`
|
|
1526
1683
|
* @nonInheritable
|
|
1527
1684
|
*/
|
|
1528
1685
|
queues: {
|
|
1529
1686
|
/** Producer bindings */
|
|
1530
1687
|
producers?: {
|
|
1531
|
-
/** The binding name used to refer to the Queue in the
|
|
1688
|
+
/** The binding name used to refer to the Queue in the Worker. */
|
|
1532
1689
|
binding: string;
|
|
1533
1690
|
/** The name of this Queue. */
|
|
1534
1691
|
queue: string;
|
|
1692
|
+
/** The number of seconds to wait before delivering a message */
|
|
1693
|
+
delivery_delay?: number;
|
|
1535
1694
|
}[];
|
|
1536
1695
|
/** Consumer configuration */
|
|
1537
1696
|
consumers?: {
|
|
1538
|
-
/** The name of the queue from which this
|
|
1697
|
+
/** The name of the queue from which this consumer should consume. */
|
|
1539
1698
|
queue: string;
|
|
1699
|
+
/** The consumer type, e.g., worker, http-pull, r2-bucket, etc. Default is worker. */
|
|
1700
|
+
type?: string;
|
|
1540
1701
|
/** The maximum number of messages per batch */
|
|
1541
1702
|
max_batch_size?: number;
|
|
1542
1703
|
/** The maximum number of seconds to wait to fill a batch with messages. */
|
|
@@ -1547,6 +1708,10 @@ declare interface EnvironmentNonInheritable {
|
|
|
1547
1708
|
dead_letter_queue?: string;
|
|
1548
1709
|
/** The maximum number of concurrent consumer Worker invocations. Leaving this unset will allow your consumer to scale to the maximum concurrency needed to keep up with the message backlog. */
|
|
1549
1710
|
max_concurrency?: number | null;
|
|
1711
|
+
/** The number of milliseconds to wait for pulled messages to become visible again */
|
|
1712
|
+
visibility_timeout_ms?: number;
|
|
1713
|
+
/** The number of seconds to wait before retrying a message */
|
|
1714
|
+
retry_delay?: number;
|
|
1550
1715
|
}[];
|
|
1551
1716
|
};
|
|
1552
1717
|
/**
|
|
@@ -1559,7 +1724,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
1559
1724
|
* @nonInheritable
|
|
1560
1725
|
*/
|
|
1561
1726
|
r2_buckets: {
|
|
1562
|
-
/** The binding name used to refer to the R2 bucket in the
|
|
1727
|
+
/** The binding name used to refer to the R2 bucket in the Worker. */
|
|
1563
1728
|
binding: string;
|
|
1564
1729
|
/** The name of this R2 bucket at the edge. */
|
|
1565
1730
|
bucket_name: string;
|
|
@@ -1578,7 +1743,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
1578
1743
|
* @nonInheritable
|
|
1579
1744
|
*/
|
|
1580
1745
|
d1_databases: {
|
|
1581
|
-
/** The binding name used to refer to the D1 database in the
|
|
1746
|
+
/** The binding name used to refer to the D1 database in the Worker. */
|
|
1582
1747
|
binding: string;
|
|
1583
1748
|
/** The name of this D1 database. */
|
|
1584
1749
|
database_name: string;
|
|
@@ -1603,7 +1768,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
1603
1768
|
* @nonInheritable
|
|
1604
1769
|
*/
|
|
1605
1770
|
vectorize: {
|
|
1606
|
-
/** The binding name used to refer to the Vectorize index in the
|
|
1771
|
+
/** The binding name used to refer to the Vectorize index in the Worker. */
|
|
1607
1772
|
binding: string;
|
|
1608
1773
|
/** The name of the index. */
|
|
1609
1774
|
index_name: string;
|
|
@@ -1618,7 +1783,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
1618
1783
|
* @nonInheritable
|
|
1619
1784
|
*/
|
|
1620
1785
|
constellation: {
|
|
1621
|
-
/** The binding name used to refer to the project in the
|
|
1786
|
+
/** The binding name used to refer to the project in the Worker. */
|
|
1622
1787
|
binding: string;
|
|
1623
1788
|
/** The id of the project. */
|
|
1624
1789
|
project_id: string;
|
|
@@ -1633,7 +1798,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
1633
1798
|
* @nonInheritable
|
|
1634
1799
|
*/
|
|
1635
1800
|
hyperdrive: {
|
|
1636
|
-
/** The binding name used to refer to the project in the
|
|
1801
|
+
/** The binding name used to refer to the project in the Worker. */
|
|
1637
1802
|
binding: string;
|
|
1638
1803
|
/** The id of the database. */
|
|
1639
1804
|
id: string;
|
|
@@ -1641,7 +1806,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
1641
1806
|
localConnectionString?: string;
|
|
1642
1807
|
}[];
|
|
1643
1808
|
/**
|
|
1644
|
-
* Specifies service bindings (
|
|
1809
|
+
* Specifies service bindings (Worker-to-Worker) that are bound to this Worker environment.
|
|
1645
1810
|
*
|
|
1646
1811
|
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1647
1812
|
* and so must be specified in every named environment.
|
|
@@ -1656,6 +1821,8 @@ declare interface EnvironmentNonInheritable {
|
|
|
1656
1821
|
service: string;
|
|
1657
1822
|
/** The environment of the service (e.g. production, staging, etc). */
|
|
1658
1823
|
environment?: string;
|
|
1824
|
+
/** Optionally, the entrypoint (named export) of the service to bind to. */
|
|
1825
|
+
entrypoint?: string;
|
|
1659
1826
|
}[] | undefined;
|
|
1660
1827
|
/**
|
|
1661
1828
|
* Specifies analytics engine datasets that are bound to this Worker environment.
|
|
@@ -1667,22 +1834,41 @@ declare interface EnvironmentNonInheritable {
|
|
|
1667
1834
|
* @nonInheritable
|
|
1668
1835
|
*/
|
|
1669
1836
|
analytics_engine_datasets: {
|
|
1670
|
-
/** The binding name used to refer to the dataset in the
|
|
1837
|
+
/** The binding name used to refer to the dataset in the Worker. */
|
|
1671
1838
|
binding: string;
|
|
1672
1839
|
/** The name of this dataset to write to. */
|
|
1673
1840
|
dataset?: string;
|
|
1674
1841
|
}[];
|
|
1675
1842
|
/**
|
|
1676
|
-
* A browser that will be usable from the
|
|
1843
|
+
* A browser that will be usable from the Worker.
|
|
1844
|
+
*
|
|
1845
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1846
|
+
* and so must be specified in every named environment.
|
|
1847
|
+
*
|
|
1848
|
+
* @default `{}`
|
|
1849
|
+
* @nonInheritable
|
|
1677
1850
|
*/
|
|
1678
1851
|
browser: {
|
|
1679
1852
|
binding: string;
|
|
1680
1853
|
} | undefined;
|
|
1681
1854
|
/**
|
|
1682
1855
|
* Binding to the AI project.
|
|
1856
|
+
*
|
|
1857
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1858
|
+
* and so must be specified in every named environment.
|
|
1859
|
+
*
|
|
1860
|
+
* @default `{}`
|
|
1861
|
+
* @nonInheritable
|
|
1683
1862
|
*/
|
|
1684
1863
|
ai: {
|
|
1685
1864
|
binding: string;
|
|
1865
|
+
staging?: boolean;
|
|
1866
|
+
} | undefined;
|
|
1867
|
+
/**
|
|
1868
|
+
* Binding to the Worker Version's metadata
|
|
1869
|
+
*/
|
|
1870
|
+
version_metadata: {
|
|
1871
|
+
binding: string;
|
|
1686
1872
|
} | undefined;
|
|
1687
1873
|
/**
|
|
1688
1874
|
* "Unsafe" tables for features that aren't directly supported by wrangler.
|
|
@@ -1690,6 +1876,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
1690
1876
|
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1691
1877
|
* and so must be specified in every named environment.
|
|
1692
1878
|
*
|
|
1879
|
+
* @default `{}`
|
|
1693
1880
|
* @nonInheritable
|
|
1694
1881
|
*/
|
|
1695
1882
|
unsafe: {
|
|
@@ -1708,7 +1895,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
1708
1895
|
* here will always be applied to metadata last, so can add new or override existing fields.
|
|
1709
1896
|
*/
|
|
1710
1897
|
metadata?: {
|
|
1711
|
-
[key: string]:
|
|
1898
|
+
[key: string]: unknown;
|
|
1712
1899
|
};
|
|
1713
1900
|
/**
|
|
1714
1901
|
* Used for internal capnp uploads for the Workers runtime
|
|
@@ -1723,22 +1910,60 @@ declare interface EnvironmentNonInheritable {
|
|
|
1723
1910
|
compiled_schema: string;
|
|
1724
1911
|
};
|
|
1725
1912
|
};
|
|
1913
|
+
/**
|
|
1914
|
+
* Specifies a list of mTLS certificates that are bound to this Worker environment.
|
|
1915
|
+
*
|
|
1916
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1917
|
+
* and so must be specified in every named environment.
|
|
1918
|
+
*
|
|
1919
|
+
* @default `[]`
|
|
1920
|
+
* @nonInheritable
|
|
1921
|
+
*/
|
|
1726
1922
|
mtls_certificates: {
|
|
1727
|
-
/** The binding name used to refer to the certificate in the
|
|
1923
|
+
/** The binding name used to refer to the certificate in the Worker */
|
|
1728
1924
|
binding: string;
|
|
1729
1925
|
/** The uuid of the uploaded mTLS certificate */
|
|
1730
1926
|
certificate_id: string;
|
|
1731
1927
|
}[];
|
|
1928
|
+
/**
|
|
1929
|
+
* Specifies a list of Tail Workers that are bound to this Worker environment
|
|
1930
|
+
*
|
|
1931
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1932
|
+
* and so must be specified in every named environment.
|
|
1933
|
+
*
|
|
1934
|
+
* @default `[]`
|
|
1935
|
+
* @nonInheritable
|
|
1936
|
+
*/
|
|
1732
1937
|
tail_consumers?: TailConsumer[];
|
|
1938
|
+
/**
|
|
1939
|
+
* Specifies namespace bindings that are bound to this Worker environment.
|
|
1940
|
+
*
|
|
1941
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1942
|
+
* and so must be specified in every named environment.
|
|
1943
|
+
*
|
|
1944
|
+
* @default `[]`
|
|
1945
|
+
* @nonInheritable
|
|
1946
|
+
*/
|
|
1947
|
+
dispatch_namespaces: {
|
|
1948
|
+
/** The binding name used to refer to the bound service. */
|
|
1949
|
+
binding: string;
|
|
1950
|
+
/** The namespace to bind to. */
|
|
1951
|
+
namespace: string;
|
|
1952
|
+
/** Details about the outbound Worker which will handle outbound requests from your namespace */
|
|
1953
|
+
outbound?: DispatchNamespaceOutbound;
|
|
1954
|
+
}[];
|
|
1733
1955
|
}
|
|
1734
1956
|
|
|
1735
|
-
declare type
|
|
1957
|
+
declare type ErrorEvent = BaseErrorEvent<"ConfigController" | "BundlerController" | "LocalRuntimeController" | "RemoteRuntimeController" | "ProxyWorker" | "InspectorProxyWorker"> | BaseErrorEvent<"ProxyController", {
|
|
1736
1958
|
config?: StartDevWorkerOptions;
|
|
1737
1959
|
bundle?: EsbuildBundle;
|
|
1738
1960
|
}>;
|
|
1739
1961
|
|
|
1740
1962
|
declare namespace Errors {
|
|
1741
|
-
class UndiciError extends Error {
|
|
1963
|
+
class UndiciError extends Error {
|
|
1964
|
+
name: string;
|
|
1965
|
+
code: string;
|
|
1966
|
+
}
|
|
1742
1967
|
|
|
1743
1968
|
/** Connect timeout error. */
|
|
1744
1969
|
class ConnectTimeoutError extends UndiciError {
|
|
@@ -1765,6 +1990,12 @@ declare namespace Errors {
|
|
|
1765
1990
|
}
|
|
1766
1991
|
|
|
1767
1992
|
class ResponseStatusCodeError extends UndiciError {
|
|
1993
|
+
constructor (
|
|
1994
|
+
message?: string,
|
|
1995
|
+
statusCode?: number,
|
|
1996
|
+
headers?: IncomingHttpHeaders | string[] | null,
|
|
1997
|
+
body?: null | Record<string, any> | string
|
|
1998
|
+
);
|
|
1768
1999
|
name: 'ResponseStatusCodeError';
|
|
1769
2000
|
code: 'UND_ERR_RESPONSE_STATUS_CODE';
|
|
1770
2001
|
body: null | Record<string, any> | string
|
|
@@ -1885,17 +2116,17 @@ declare type Event_2 = typeof globalThis extends { Event: infer T }
|
|
|
1885
2116
|
readonly type: string
|
|
1886
2117
|
}
|
|
1887
2118
|
|
|
1888
|
-
declare interface
|
|
2119
|
+
declare interface EventInit {
|
|
1889
2120
|
bubbles?: boolean
|
|
1890
2121
|
cancelable?: boolean
|
|
1891
2122
|
composed?: boolean
|
|
1892
2123
|
}
|
|
1893
2124
|
|
|
1894
|
-
declare interface
|
|
2125
|
+
declare interface EventListener {
|
|
1895
2126
|
(evt: Event_2): void
|
|
1896
2127
|
}
|
|
1897
2128
|
|
|
1898
|
-
declare interface
|
|
2129
|
+
declare interface EventListenerObject {
|
|
1899
2130
|
handleEvent (object: Event_2): void
|
|
1900
2131
|
}
|
|
1901
2132
|
|
|
@@ -1903,7 +2134,7 @@ declare interface EventListenerOptions {
|
|
|
1903
2134
|
capture?: boolean
|
|
1904
2135
|
}
|
|
1905
2136
|
|
|
1906
|
-
declare type
|
|
2137
|
+
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject
|
|
1907
2138
|
|
|
1908
2139
|
declare type _EventMethods = keyof ProtocolMapping.Events;
|
|
1909
2140
|
|
|
@@ -1923,12 +2154,17 @@ declare type EventTarget_2 = typeof globalThis extends { EventTarget: infer T }
|
|
|
1923
2154
|
): void
|
|
1924
2155
|
}
|
|
1925
2156
|
|
|
1926
|
-
declare
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
2157
|
+
declare class ExecutionContext {
|
|
2158
|
+
waitUntil(promise: Promise<any>): void;
|
|
2159
|
+
passThroughOnException(): void;
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
declare function fetch (
|
|
2163
|
+
input: RequestInfo,
|
|
2164
|
+
init?: RequestInit
|
|
2165
|
+
): Promise<Response>
|
|
1930
2166
|
|
|
1931
|
-
declare class
|
|
2167
|
+
declare class File extends Blob_2 {
|
|
1932
2168
|
/**
|
|
1933
2169
|
* Creates a new File instance.
|
|
1934
2170
|
*
|
|
@@ -1951,7 +2187,7 @@ declare class File_2 extends Blob_2 {
|
|
|
1951
2187
|
readonly [Symbol.toStringTag]: string
|
|
1952
2188
|
}
|
|
1953
2189
|
|
|
1954
|
-
declare type
|
|
2190
|
+
declare type File_2<Contents = string> = {
|
|
1955
2191
|
path: string;
|
|
1956
2192
|
} | {
|
|
1957
2193
|
contents: Contents;
|
|
@@ -1989,7 +2225,7 @@ declare class FileReader {
|
|
|
1989
2225
|
|
|
1990
2226
|
readonly result: string | ArrayBuffer | null
|
|
1991
2227
|
|
|
1992
|
-
readonly error:
|
|
2228
|
+
readonly error: DOMException | null
|
|
1993
2229
|
|
|
1994
2230
|
onloadstart: null | ((this: FileReader, event: ProgressEvent) => void)
|
|
1995
2231
|
onprogress: null | ((this: FileReader, event: ProgressEvent) => void)
|
|
@@ -2002,7 +2238,7 @@ declare class FileReader {
|
|
|
2002
2238
|
/**
|
|
2003
2239
|
* Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using fetch().
|
|
2004
2240
|
*/
|
|
2005
|
-
declare class
|
|
2241
|
+
declare class FormData {
|
|
2006
2242
|
/**
|
|
2007
2243
|
* Appends a new value onto an existing key inside a FormData object,
|
|
2008
2244
|
* or adds the key if it does not already exist.
|
|
@@ -2067,7 +2303,7 @@ declare class FormData_2 {
|
|
|
2067
2303
|
* Executes given callback function for each field of the FormData instance
|
|
2068
2304
|
*/
|
|
2069
2305
|
forEach: (
|
|
2070
|
-
callbackfn: (value: FormDataEntryValue, key: string, iterable:
|
|
2306
|
+
callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData) => void,
|
|
2071
2307
|
thisArg?: unknown
|
|
2072
2308
|
) => void
|
|
2073
2309
|
|
|
@@ -2100,18 +2336,71 @@ declare class FormData_2 {
|
|
|
2100
2336
|
/**
|
|
2101
2337
|
* A `string` or `File` that represents a single value from a set of `FormData` key-value pairs.
|
|
2102
2338
|
*/
|
|
2103
|
-
declare type FormDataEntryValue = string |
|
|
2339
|
+
declare type FormDataEntryValue = string | File
|
|
2340
|
+
|
|
2341
|
+
/**
|
|
2342
|
+
* By reading from a `wrangler.toml` file this function generates proxy binding objects that can be
|
|
2343
|
+
* used to simulate the interaction with bindings during local development in a Node.js environment
|
|
2344
|
+
*
|
|
2345
|
+
* @deprecated use `getPlatformProxy` instead
|
|
2346
|
+
*
|
|
2347
|
+
* @param options The various options that can tweak this function's behavior
|
|
2348
|
+
* @returns An Object containing the generated proxies alongside other related utilities
|
|
2349
|
+
*/
|
|
2350
|
+
export declare function getBindingsProxy<Bindings = Record<string, unknown>, CfProperties extends Record<string, unknown> = IncomingRequestCfProperties>(options?: GetBindingsProxyOptions): Promise<BindingsProxy<Bindings, CfProperties>>;
|
|
2351
|
+
|
|
2352
|
+
/** Options for the `getBindingsProxy` utility */
|
|
2353
|
+
export declare type GetBindingsProxyOptions = GetPlatformProxyOptions;
|
|
2104
2354
|
|
|
2105
|
-
declare function getCookies (headers:
|
|
2355
|
+
declare function getCookies (headers: Headers): Record<string, string>
|
|
2106
2356
|
|
|
2107
2357
|
declare function getGlobalDispatcher(): Dispatcher;
|
|
2108
2358
|
|
|
2109
2359
|
declare function getGlobalOrigin(): URL | undefined;
|
|
2110
2360
|
|
|
2111
|
-
|
|
2361
|
+
/**
|
|
2362
|
+
* By reading from a `wrangler.toml` file this function generates proxy objects that can be
|
|
2363
|
+
* used to simulate the interaction with the Cloudflare platform during local development
|
|
2364
|
+
* in a Node.js environment
|
|
2365
|
+
*
|
|
2366
|
+
* @param options The various options that can tweak this function's behavior
|
|
2367
|
+
* @returns An Object containing the generated proxies alongside other related utilities
|
|
2368
|
+
*/
|
|
2369
|
+
export declare function getPlatformProxy<Env = Record<string, unknown>, CfProperties extends Record<string, unknown> = IncomingRequestCfProperties>(options?: GetPlatformProxyOptions): Promise<PlatformProxy<Env, CfProperties>>;
|
|
2370
|
+
|
|
2371
|
+
/**
|
|
2372
|
+
* Options for the `getPlatformProxy` utility
|
|
2373
|
+
*/
|
|
2374
|
+
export declare type GetPlatformProxyOptions = {
|
|
2375
|
+
/**
|
|
2376
|
+
* The name of the environment to use
|
|
2377
|
+
*/
|
|
2378
|
+
environment?: string;
|
|
2379
|
+
/**
|
|
2380
|
+
* The path to the config object to use (default `wrangler.toml`)
|
|
2381
|
+
*/
|
|
2382
|
+
configPath?: string;
|
|
2383
|
+
/**
|
|
2384
|
+
* Flag to indicate the utility to read a json config file (`wrangler.json`)
|
|
2385
|
+
* instead of the toml one (`wrangler.toml`)
|
|
2386
|
+
*
|
|
2387
|
+
* Note: this feature is experimental
|
|
2388
|
+
*/
|
|
2389
|
+
experimentalJsonConfig?: boolean;
|
|
2390
|
+
/**
|
|
2391
|
+
* Indicates if and where to persist the bindings data, if not present or `true` it defaults to the same location
|
|
2392
|
+
* used by wrangler v3: `.wrangler/state/v3` (so that the same data can be easily used by the caller and wrangler).
|
|
2393
|
+
* If `false` is specified no data is persisted on the filesystem.
|
|
2394
|
+
*/
|
|
2395
|
+
persist?: boolean | {
|
|
2396
|
+
path: string;
|
|
2397
|
+
};
|
|
2398
|
+
};
|
|
2399
|
+
|
|
2400
|
+
declare function getSetCookies (headers: Headers): Cookie[]
|
|
2112
2401
|
|
|
2113
|
-
declare class
|
|
2114
|
-
constructor (init?:
|
|
2402
|
+
declare class Headers implements SpecIterable<[string, string]> {
|
|
2403
|
+
constructor (init?: HeadersInit)
|
|
2115
2404
|
readonly append: (name: string, value: string) => void
|
|
2116
2405
|
readonly delete: (name: string) => void
|
|
2117
2406
|
readonly get: (name: string) => string | null
|
|
@@ -2119,7 +2408,7 @@ declare class Headers_2 implements SpecIterable<[string, string]> {
|
|
|
2119
2408
|
readonly set: (name: string, value: string) => void
|
|
2120
2409
|
readonly getSetCookie: () => string[]
|
|
2121
2410
|
readonly forEach: (
|
|
2122
|
-
callbackfn: (value: string, key: string, iterable:
|
|
2411
|
+
callbackfn: (value: string, key: string, iterable: Headers) => void,
|
|
2123
2412
|
thisArg?: unknown
|
|
2124
2413
|
) => void
|
|
2125
2414
|
|
|
@@ -2129,10 +2418,17 @@ declare class Headers_2 implements SpecIterable<[string, string]> {
|
|
|
2129
2418
|
readonly [Symbol.iterator]: () => SpecIterator<[string, string]>
|
|
2130
2419
|
}
|
|
2131
2420
|
|
|
2132
|
-
declare type
|
|
2421
|
+
declare type HeadersInit = string[][] | Record<string, string | ReadonlyArray<string>> | Headers
|
|
2133
2422
|
|
|
2134
2423
|
declare type Hook<T, Args extends unknown[] = unknown[]> = T | Promise<T> | ((...args: Args) => T | Promise<T>);
|
|
2135
2424
|
|
|
2425
|
+
/**
|
|
2426
|
+
* @property terminate Terminates HTTP server.
|
|
2427
|
+
*/
|
|
2428
|
+
declare type HttpTerminator = {
|
|
2429
|
+
readonly terminate: () => Promise<void>;
|
|
2430
|
+
};
|
|
2431
|
+
|
|
2136
2432
|
/**
|
|
2137
2433
|
* The header type declaration of `undici`.
|
|
2138
2434
|
*/
|
|
@@ -2170,12 +2466,12 @@ declare type LogLevel = "debug" | "info" | "log" | "warn" | "error" | "none";
|
|
|
2170
2466
|
|
|
2171
2467
|
declare type MaybePromise<T> = T | Promise<T>;
|
|
2172
2468
|
|
|
2173
|
-
declare interface
|
|
2469
|
+
declare interface MessageEvent<T = any> extends Event_2 {
|
|
2174
2470
|
readonly data: T
|
|
2175
2471
|
readonly lastEventId: string
|
|
2176
2472
|
readonly origin: string
|
|
2177
|
-
readonly ports: ReadonlyArray<typeof
|
|
2178
|
-
readonly source: typeof
|
|
2473
|
+
readonly ports: ReadonlyArray<typeof MessagePort_2>
|
|
2474
|
+
readonly source: typeof MessagePort_2 | null
|
|
2179
2475
|
initMessageEvent(
|
|
2180
2476
|
type: string,
|
|
2181
2477
|
bubbles?: boolean,
|
|
@@ -2183,22 +2479,22 @@ declare interface MessageEvent_2<T = any> extends Event_2 {
|
|
|
2183
2479
|
data?: any,
|
|
2184
2480
|
origin?: string,
|
|
2185
2481
|
lastEventId?: string,
|
|
2186
|
-
source?: typeof
|
|
2187
|
-
ports?: (typeof
|
|
2482
|
+
source?: typeof MessagePort_2 | null,
|
|
2483
|
+
ports?: (typeof MessagePort_2)[]
|
|
2188
2484
|
): void;
|
|
2189
2485
|
}
|
|
2190
2486
|
|
|
2191
|
-
declare const
|
|
2192
|
-
prototype:
|
|
2193
|
-
new<T>(type: string, eventInitDict?:
|
|
2487
|
+
declare const MessageEvent: {
|
|
2488
|
+
prototype: MessageEvent
|
|
2489
|
+
new<T>(type: string, eventInitDict?: MessageEventInit<T>): MessageEvent<T>
|
|
2194
2490
|
};
|
|
2195
2491
|
|
|
2196
|
-
declare interface
|
|
2492
|
+
declare interface MessageEventInit<T = any> extends EventInit {
|
|
2197
2493
|
data?: T
|
|
2198
2494
|
lastEventId?: string
|
|
2199
2495
|
origin?: string
|
|
2200
|
-
ports?: (typeof
|
|
2201
|
-
source?: typeof
|
|
2496
|
+
ports?: (typeof MessagePort_2)[]
|
|
2497
|
+
source?: typeof MessagePort_2 | null
|
|
2202
2498
|
}
|
|
2203
2499
|
|
|
2204
2500
|
declare interface MIMEType {
|
|
@@ -2326,8 +2622,8 @@ declare namespace MockInterceptor {
|
|
|
2326
2622
|
path: string;
|
|
2327
2623
|
origin: string;
|
|
2328
2624
|
method: string;
|
|
2329
|
-
body?:
|
|
2330
|
-
headers:
|
|
2625
|
+
body?: BodyInit | Dispatcher.DispatchOptions['body'];
|
|
2626
|
+
headers: Headers | Record<string, string>;
|
|
2331
2627
|
maxRedirections: number;
|
|
2332
2628
|
}
|
|
2333
2629
|
|
|
@@ -2376,6 +2672,32 @@ declare interface ModuleRule {
|
|
|
2376
2672
|
fallthrough?: boolean;
|
|
2377
2673
|
}
|
|
2378
2674
|
|
|
2675
|
+
declare interface MultiCacheQueryOptions extends CacheQueryOptions {
|
|
2676
|
+
cacheName?: string
|
|
2677
|
+
}
|
|
2678
|
+
|
|
2679
|
+
declare interface PagesConfigFields {
|
|
2680
|
+
/**
|
|
2681
|
+
* The directory of static assets to serve.
|
|
2682
|
+
*
|
|
2683
|
+
* The presence of this field in `wrangler.toml` indicates a Pages project,
|
|
2684
|
+
* and will prompt the handling of the configuration file according to the
|
|
2685
|
+
* Pages-specific validation rules.
|
|
2686
|
+
*/
|
|
2687
|
+
pages_build_output_dir?: string;
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2690
|
+
declare interface PagesConfigFields {
|
|
2691
|
+
/**
|
|
2692
|
+
* The directory of static assets to serve.
|
|
2693
|
+
*
|
|
2694
|
+
* The presence of this field in `wrangler.toml` indicates a Pages project,
|
|
2695
|
+
* and will prompt the handling of the configuration file according to the
|
|
2696
|
+
* Pages-specific validation rules.
|
|
2697
|
+
*/
|
|
2698
|
+
pages_build_output_dir?: string;
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2379
2701
|
declare interface PagesDeployOptions {
|
|
2380
2702
|
/**
|
|
2381
2703
|
* Path to static assets to deploy to Pages
|
|
@@ -2422,6 +2744,10 @@ declare interface PagesDeployOptions {
|
|
|
2422
2744
|
* Default: true
|
|
2423
2745
|
*/
|
|
2424
2746
|
bundle?: boolean;
|
|
2747
|
+
/**
|
|
2748
|
+
* Command line args passed to the `pages deploy` cmd
|
|
2749
|
+
*/
|
|
2750
|
+
args?: Record<string, unknown>;
|
|
2425
2751
|
}
|
|
2426
2752
|
|
|
2427
2753
|
declare type _Params<ParamsArray extends [unknown?]> = ParamsArray extends [infer P] ? P : undefined;
|
|
@@ -2448,6 +2774,32 @@ options: { dispatcher?: Dispatcher } & Omit<Dispatcher.PipelineOptions, 'origin'
|
|
|
2448
2774
|
handler: Dispatcher.PipelineHandler
|
|
2449
2775
|
): Duplex;
|
|
2450
2776
|
|
|
2777
|
+
/**
|
|
2778
|
+
* Result of the `getPlatformProxy` utility
|
|
2779
|
+
*/
|
|
2780
|
+
export declare type PlatformProxy<Env = Record<string, unknown>, CfProperties extends Record<string, unknown> = IncomingRequestCfProperties> = {
|
|
2781
|
+
/**
|
|
2782
|
+
* Environment object containing the various Cloudflare bindings
|
|
2783
|
+
*/
|
|
2784
|
+
env: Env;
|
|
2785
|
+
/**
|
|
2786
|
+
* Mock of the context object that Workers received in their request handler, all the object's methods are no-op
|
|
2787
|
+
*/
|
|
2788
|
+
cf: CfProperties;
|
|
2789
|
+
/**
|
|
2790
|
+
* Mock of the context object that Workers received in their request handler, all the object's methods are no-op
|
|
2791
|
+
*/
|
|
2792
|
+
ctx: ExecutionContext;
|
|
2793
|
+
/**
|
|
2794
|
+
* Caches object emulating the Workers Cache runtime API
|
|
2795
|
+
*/
|
|
2796
|
+
caches: CacheStorage_2;
|
|
2797
|
+
/**
|
|
2798
|
+
* Function used to dispose of the child process providing the bindings implementation
|
|
2799
|
+
*/
|
|
2800
|
+
dispose: () => Promise<void>;
|
|
2801
|
+
};
|
|
2802
|
+
|
|
2451
2803
|
declare class Pool extends Dispatcher {
|
|
2452
2804
|
constructor(url: string | URL_2, options?: Pool.Options)
|
|
2453
2805
|
/** `true` after `pool.close()` has been called. */
|
|
@@ -2501,7 +2853,7 @@ declare class ProgressEvent {
|
|
|
2501
2853
|
readonly total: number
|
|
2502
2854
|
}
|
|
2503
2855
|
|
|
2504
|
-
declare interface ProgressEventInit extends
|
|
2856
|
+
declare interface ProgressEventInit extends EventInit {
|
|
2505
2857
|
lengthComputable?: boolean
|
|
2506
2858
|
loaded?: number
|
|
2507
2859
|
total?: number
|
|
@@ -22767,6 +23119,7 @@ declare namespace ProxyAgent {
|
|
|
22767
23119
|
headers?: IncomingHttpHeaders;
|
|
22768
23120
|
requestTls?: buildConnector.BuildOptions;
|
|
22769
23121
|
proxyTls?: buildConnector.BuildOptions;
|
|
23122
|
+
clientFactory?(origin: URL, opts: object): Dispatcher;
|
|
22770
23123
|
}
|
|
22771
23124
|
}
|
|
22772
23125
|
|
|
@@ -22774,12 +23127,12 @@ declare class ProxyController extends EventEmitter_2 {
|
|
|
22774
23127
|
ready: DeferredPromise<ReadyEvent>;
|
|
22775
23128
|
proxyWorker?: Miniflare;
|
|
22776
23129
|
proxyWorkerOptions?: MiniflareOptions;
|
|
22777
|
-
inspectorProxyWorkerWebSocket?: DeferredPromise<
|
|
23130
|
+
inspectorProxyWorkerWebSocket?: DeferredPromise<WebSocket_2>;
|
|
22778
23131
|
protected latestConfig?: StartDevWorkerOptions;
|
|
22779
23132
|
protected latestBundle?: EsbuildBundle;
|
|
22780
23133
|
secret: `${string}-${string}-${string}-${string}-${string}`;
|
|
22781
23134
|
protected createProxyWorker(): void;
|
|
22782
|
-
reconnectInspectorProxyWorker(): Promise<
|
|
23135
|
+
reconnectInspectorProxyWorker(): Promise<WebSocket_2 | undefined>;
|
|
22783
23136
|
runtimeMessageMutex: Mutex;
|
|
22784
23137
|
sendMessageToProxyWorker(message: ProxyWorkerIncomingRequestBody, retries?: number): Promise<void>;
|
|
22785
23138
|
sendMessageToInspectorProxyWorker(message: InspectorProxyWorkerIncomingWebSocketMessage, retries?: number): Promise<void>;
|
|
@@ -22789,7 +23142,7 @@ declare class ProxyController extends EventEmitter_2 {
|
|
|
22789
23142
|
onReloadComplete(data: ReloadCompleteEvent): void;
|
|
22790
23143
|
onProxyWorkerMessage(message: ProxyWorkerOutgoingRequestBody): void;
|
|
22791
23144
|
onInspectorProxyWorkerMessage(message: InspectorProxyWorkerOutgoingWebsocketMessage): void;
|
|
22792
|
-
onInspectorProxyWorkerRequest(message: InspectorProxyWorkerOutgoingRequestBody): Promise<
|
|
23145
|
+
onInspectorProxyWorkerRequest(message: InspectorProxyWorkerOutgoingRequestBody): Promise<Response_2>;
|
|
22793
23146
|
_torndown: boolean;
|
|
22794
23147
|
teardown(): Promise<void>;
|
|
22795
23148
|
emitReadyEvent(proxyWorker: Miniflare): void;
|
|
@@ -22797,7 +23150,7 @@ declare class ProxyController extends EventEmitter_2 {
|
|
|
22797
23150
|
emitErrorEvent(reason: string, cause: Error | SerializedError): void;
|
|
22798
23151
|
on(event: "ready", listener: (_: ReadyEvent) => void): this;
|
|
22799
23152
|
on(event: "previewTokenExpired", listener: (_: PreviewTokenExpiredEvent) => void): this;
|
|
22800
|
-
on(event: "error", listener: (_:
|
|
23153
|
+
on(event: "error", listener: (_: ErrorEvent) => void): this;
|
|
22801
23154
|
once: typeof ProxyController.on;
|
|
22802
23155
|
}
|
|
22803
23156
|
|
|
@@ -22805,9 +23158,11 @@ declare type ProxyData = {
|
|
|
22805
23158
|
userWorkerUrl: UrlOriginParts;
|
|
22806
23159
|
userWorkerInspectorUrl: UrlOriginAndPathnameParts;
|
|
22807
23160
|
userWorkerInnerUrlOverrides: Partial<UrlOriginParts>;
|
|
22808
|
-
headers: Record<string, string
|
|
23161
|
+
headers: Record<string, string>;
|
|
22809
23162
|
liveReload?: boolean;
|
|
22810
23163
|
proxyLogsToController?: boolean;
|
|
23164
|
+
internalDurableObjects?: CfDurableObject[];
|
|
23165
|
+
entrypointAddresses: WorkerEntrypointsDefinition | undefined;
|
|
22811
23166
|
};
|
|
22812
23167
|
|
|
22813
23168
|
declare type ProxyWorkerIncomingRequestBody = {
|
|
@@ -22828,7 +23183,9 @@ declare type ProxyWorkerOutgoingRequestBody = {
|
|
|
22828
23183
|
args: Parameters<typeof console.debug>;
|
|
22829
23184
|
};
|
|
22830
23185
|
|
|
22831
|
-
declare type RawConfig = Partial<ConfigFields<RawDevConfig>> & RawEnvironment & DeprecatedConfigFields & EnvironmentMap
|
|
23186
|
+
declare type RawConfig = Partial<ConfigFields<RawDevConfig>> & PagesConfigFields & RawEnvironment & DeprecatedConfigFields & EnvironmentMap & {
|
|
23187
|
+
$schema?: string;
|
|
23188
|
+
};
|
|
22832
23189
|
|
|
22833
23190
|
declare type RawDevConfig = Partial<DevConfig>;
|
|
22834
23191
|
|
|
@@ -22875,19 +23232,13 @@ declare type ReloadStartEvent = {
|
|
|
22875
23232
|
bundle: EsbuildBundle;
|
|
22876
23233
|
};
|
|
22877
23234
|
|
|
22878
|
-
|
|
22879
|
-
|
|
22880
|
-
url: string | URL_2 | UrlObject,
|
|
22881
|
-
options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.RequestOptions, 'origin' | 'path' | 'method'> & Partial<Pick<Dispatcher.RequestOptions, 'method'>>,
|
|
22882
|
-
): Promise<Dispatcher.ResponseData>;
|
|
22883
|
-
|
|
22884
|
-
declare class Request_2 implements BodyMixin {
|
|
22885
|
-
constructor (input: RequestInfo_2, init?: RequestInit_2)
|
|
23235
|
+
declare class Request implements BodyMixin {
|
|
23236
|
+
constructor (input: RequestInfo, init?: RequestInit)
|
|
22886
23237
|
|
|
22887
23238
|
readonly cache: RequestCache
|
|
22888
23239
|
readonly credentials: RequestCredentials
|
|
22889
23240
|
readonly destination: RequestDestination
|
|
22890
|
-
readonly headers:
|
|
23241
|
+
readonly headers: Headers
|
|
22891
23242
|
readonly integrity: string
|
|
22892
23243
|
readonly method: string
|
|
22893
23244
|
readonly mode: RequestMode
|
|
@@ -22899,18 +23250,24 @@ declare class Request_2 implements BodyMixin {
|
|
|
22899
23250
|
readonly signal: AbortSignal
|
|
22900
23251
|
readonly duplex: RequestDuplex
|
|
22901
23252
|
|
|
22902
|
-
readonly body:
|
|
23253
|
+
readonly body: ReadableStream | null
|
|
22903
23254
|
readonly bodyUsed: boolean
|
|
22904
23255
|
|
|
22905
23256
|
readonly arrayBuffer: () => Promise<ArrayBuffer>
|
|
22906
23257
|
readonly blob: () => Promise<Blob_2>
|
|
22907
|
-
readonly formData: () => Promise<
|
|
23258
|
+
readonly formData: () => Promise<FormData>
|
|
22908
23259
|
readonly json: () => Promise<unknown>
|
|
22909
23260
|
readonly text: () => Promise<string>
|
|
22910
23261
|
|
|
22911
|
-
readonly clone: () =>
|
|
23262
|
+
readonly clone: () => Request
|
|
22912
23263
|
}
|
|
22913
23264
|
|
|
23265
|
+
/** Performs an HTTP request. */
|
|
23266
|
+
declare function request(
|
|
23267
|
+
url: string | URL_2 | UrlObject,
|
|
23268
|
+
options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.RequestOptions, 'origin' | 'path' | 'method'> & Partial<Pick<Dispatcher.RequestOptions, 'method'>>,
|
|
23269
|
+
): Promise<Dispatcher.ResponseData>;
|
|
23270
|
+
|
|
22914
23271
|
declare type RequestCache =
|
|
22915
23272
|
| 'default'
|
|
22916
23273
|
| 'force-cache'
|
|
@@ -22943,16 +23300,16 @@ declare type RequestDestination =
|
|
|
22943
23300
|
|
|
22944
23301
|
declare type RequestDuplex = 'half'
|
|
22945
23302
|
|
|
22946
|
-
declare type
|
|
23303
|
+
declare type RequestInfo = string | URL_2 | Request
|
|
22947
23304
|
|
|
22948
|
-
declare interface
|
|
23305
|
+
declare interface RequestInit {
|
|
22949
23306
|
method?: string
|
|
22950
23307
|
keepalive?: boolean
|
|
22951
|
-
headers?:
|
|
22952
|
-
body?:
|
|
23308
|
+
headers?: HeadersInit
|
|
23309
|
+
body?: BodyInit
|
|
22953
23310
|
redirect?: RequestRedirect
|
|
22954
23311
|
integrity?: string
|
|
22955
|
-
signal?: AbortSignal
|
|
23312
|
+
signal?: AbortSignal | null
|
|
22956
23313
|
credentials?: RequestCredentials
|
|
22957
23314
|
mode?: RequestMode
|
|
22958
23315
|
referrer?: string
|
|
@@ -22966,10 +23323,10 @@ declare type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin'
|
|
|
22966
23323
|
|
|
22967
23324
|
declare type RequestRedirect = 'error' | 'follow' | 'manual'
|
|
22968
23325
|
|
|
22969
|
-
declare class
|
|
22970
|
-
constructor (body?:
|
|
23326
|
+
declare class Response implements BodyMixin {
|
|
23327
|
+
constructor (body?: BodyInit, init?: ResponseInit)
|
|
22971
23328
|
|
|
22972
|
-
readonly headers:
|
|
23329
|
+
readonly headers: Headers
|
|
22973
23330
|
readonly ok: boolean
|
|
22974
23331
|
readonly status: number
|
|
22975
23332
|
readonly statusText: string
|
|
@@ -22977,26 +23334,26 @@ declare class Response_2 implements BodyMixin {
|
|
|
22977
23334
|
readonly url: string
|
|
22978
23335
|
readonly redirected: boolean
|
|
22979
23336
|
|
|
22980
|
-
readonly body:
|
|
23337
|
+
readonly body: ReadableStream | null
|
|
22981
23338
|
readonly bodyUsed: boolean
|
|
22982
23339
|
|
|
22983
23340
|
readonly arrayBuffer: () => Promise<ArrayBuffer>
|
|
22984
23341
|
readonly blob: () => Promise<Blob_2>
|
|
22985
|
-
readonly formData: () => Promise<
|
|
23342
|
+
readonly formData: () => Promise<FormData>
|
|
22986
23343
|
readonly json: () => Promise<unknown>
|
|
22987
23344
|
readonly text: () => Promise<string>
|
|
22988
23345
|
|
|
22989
|
-
readonly clone: () =>
|
|
23346
|
+
readonly clone: () => Response
|
|
22990
23347
|
|
|
22991
|
-
static error ():
|
|
22992
|
-
static json(data: any, init?:
|
|
22993
|
-
static redirect (url: string | URL_2, status: ResponseRedirectStatus):
|
|
23348
|
+
static error (): Response
|
|
23349
|
+
static json(data: any, init?: ResponseInit): Response
|
|
23350
|
+
static redirect (url: string | URL_2, status: ResponseRedirectStatus): Response
|
|
22994
23351
|
}
|
|
22995
23352
|
|
|
22996
|
-
declare interface
|
|
23353
|
+
declare interface ResponseInit {
|
|
22997
23354
|
readonly status?: number
|
|
22998
23355
|
readonly statusText?: string
|
|
22999
|
-
readonly headers?:
|
|
23356
|
+
readonly headers?: HeadersInit
|
|
23000
23357
|
}
|
|
23001
23358
|
|
|
23002
23359
|
declare type ResponseRedirectStatus = 301 | 302 | 303 | 307 | 308
|
|
@@ -23009,6 +23366,119 @@ declare type ResponseType =
|
|
|
23009
23366
|
| 'opaque'
|
|
23010
23367
|
| 'opaqueredirect'
|
|
23011
23368
|
|
|
23369
|
+
declare class RetryHandler implements Dispatcher.DispatchHandlers {
|
|
23370
|
+
constructor(
|
|
23371
|
+
options: Dispatcher.DispatchOptions & {
|
|
23372
|
+
retryOptions?: RetryHandler.RetryOptions;
|
|
23373
|
+
},
|
|
23374
|
+
retryHandlers: RetryHandler.RetryHandlers
|
|
23375
|
+
);
|
|
23376
|
+
}
|
|
23377
|
+
|
|
23378
|
+
declare namespace RetryHandler {
|
|
23379
|
+
type RetryState = { counter: number; currentTimeout: number };
|
|
23380
|
+
|
|
23381
|
+
type RetryContext = {
|
|
23382
|
+
state: RetryState;
|
|
23383
|
+
opts: Dispatcher.DispatchOptions & {
|
|
23384
|
+
retryOptions?: RetryHandler.RetryOptions;
|
|
23385
|
+
};
|
|
23386
|
+
}
|
|
23387
|
+
|
|
23388
|
+
type OnRetryCallback = (result?: Error | null) => void;
|
|
23389
|
+
|
|
23390
|
+
type RetryCallback = (
|
|
23391
|
+
err: Error,
|
|
23392
|
+
context: {
|
|
23393
|
+
state: RetryState;
|
|
23394
|
+
opts: Dispatcher.DispatchOptions & {
|
|
23395
|
+
retryOptions?: RetryHandler.RetryOptions;
|
|
23396
|
+
};
|
|
23397
|
+
},
|
|
23398
|
+
callback: OnRetryCallback
|
|
23399
|
+
) => number | null;
|
|
23400
|
+
|
|
23401
|
+
interface RetryOptions {
|
|
23402
|
+
/**
|
|
23403
|
+
* Callback to be invoked on every retry iteration.
|
|
23404
|
+
* It receives the error, current state of the retry object and the options object
|
|
23405
|
+
* passed when instantiating the retry handler.
|
|
23406
|
+
*
|
|
23407
|
+
* @type {RetryCallback}
|
|
23408
|
+
* @memberof RetryOptions
|
|
23409
|
+
*/
|
|
23410
|
+
retry?: RetryCallback;
|
|
23411
|
+
/**
|
|
23412
|
+
* Maximum number of retries to allow.
|
|
23413
|
+
*
|
|
23414
|
+
* @type {number}
|
|
23415
|
+
* @memberof RetryOptions
|
|
23416
|
+
* @default 5
|
|
23417
|
+
*/
|
|
23418
|
+
maxRetries?: number;
|
|
23419
|
+
/**
|
|
23420
|
+
* Max number of milliseconds allow between retries
|
|
23421
|
+
*
|
|
23422
|
+
* @type {number}
|
|
23423
|
+
* @memberof RetryOptions
|
|
23424
|
+
* @default 30000
|
|
23425
|
+
*/
|
|
23426
|
+
maxTimeout?: number;
|
|
23427
|
+
/**
|
|
23428
|
+
* Initial number of milliseconds to wait before retrying for the first time.
|
|
23429
|
+
*
|
|
23430
|
+
* @type {number}
|
|
23431
|
+
* @memberof RetryOptions
|
|
23432
|
+
* @default 500
|
|
23433
|
+
*/
|
|
23434
|
+
minTimeout?: number;
|
|
23435
|
+
/**
|
|
23436
|
+
* Factior to multiply the timeout factor between retries.
|
|
23437
|
+
*
|
|
23438
|
+
* @type {number}
|
|
23439
|
+
* @memberof RetryOptions
|
|
23440
|
+
* @default 2
|
|
23441
|
+
*/
|
|
23442
|
+
timeoutFactor?: number;
|
|
23443
|
+
/**
|
|
23444
|
+
* It enables to automatically infer timeout between retries based on the `Retry-After` header.
|
|
23445
|
+
*
|
|
23446
|
+
* @type {boolean}
|
|
23447
|
+
* @memberof RetryOptions
|
|
23448
|
+
* @default true
|
|
23449
|
+
*/
|
|
23450
|
+
retryAfter?: boolean;
|
|
23451
|
+
/**
|
|
23452
|
+
* HTTP methods to retry.
|
|
23453
|
+
*
|
|
23454
|
+
* @type {Dispatcher.HttpMethod[]}
|
|
23455
|
+
* @memberof RetryOptions
|
|
23456
|
+
* @default ['GET', 'HEAD', 'OPTIONS', 'PUT', 'DELETE', 'TRACE'],
|
|
23457
|
+
*/
|
|
23458
|
+
methods?: Dispatcher.HttpMethod[];
|
|
23459
|
+
/**
|
|
23460
|
+
* Error codes to be retried. e.g. `ECONNRESET`, `ENOTFOUND`, `ETIMEDOUT`, `ECONNREFUSED`, etc.
|
|
23461
|
+
*
|
|
23462
|
+
* @type {string[]}
|
|
23463
|
+
* @default ['ECONNRESET','ECONNREFUSED','ENOTFOUND','ENETDOWN','ENETUNREACH','EHOSTDOWN','EHOSTUNREACH','EPIPE']
|
|
23464
|
+
*/
|
|
23465
|
+
errorCodes?: string[];
|
|
23466
|
+
/**
|
|
23467
|
+
* HTTP status codes to be retried.
|
|
23468
|
+
*
|
|
23469
|
+
* @type {number[]}
|
|
23470
|
+
* @memberof RetryOptions
|
|
23471
|
+
* @default [500, 502, 503, 504, 429],
|
|
23472
|
+
*/
|
|
23473
|
+
statusCodes?: number[];
|
|
23474
|
+
}
|
|
23475
|
+
|
|
23476
|
+
interface RetryHandlers {
|
|
23477
|
+
dispatch: Dispatcher["dispatch"];
|
|
23478
|
+
handler: Dispatcher.DispatchHandlers;
|
|
23479
|
+
}
|
|
23480
|
+
}
|
|
23481
|
+
|
|
23012
23482
|
declare type Route = SimpleRoute | ZoneIdRoute | ZoneNameRoute | CustomDomainRoute;
|
|
23013
23483
|
|
|
23014
23484
|
/**
|
|
@@ -23029,7 +23499,7 @@ declare abstract class RuntimeController extends Controller {
|
|
|
23029
23499
|
abstract emitReloadCompletetEvent(data: ReloadCompleteEvent): void;
|
|
23030
23500
|
on(event: "reloadStart", listener: (_: ReloadStartEvent) => void): this;
|
|
23031
23501
|
on(event: "reloadComplete", listener: (_: ReloadCompleteEvent) => void): this;
|
|
23032
|
-
on(event: "error", listener: (_:
|
|
23502
|
+
on(event: "error", listener: (_: ErrorEvent) => void): this;
|
|
23033
23503
|
once: typeof RuntimeController.on;
|
|
23034
23504
|
}
|
|
23035
23505
|
|
|
@@ -23051,9 +23521,9 @@ declare interface ServiceDesignator {
|
|
|
23051
23521
|
env?: string;
|
|
23052
23522
|
}
|
|
23053
23523
|
|
|
23054
|
-
declare type ServiceFetch = (request:
|
|
23524
|
+
declare type ServiceFetch = (request: Request_2) => Promise<Response_2>;
|
|
23055
23525
|
|
|
23056
|
-
declare function setCookie (headers:
|
|
23526
|
+
declare function setCookie (headers: Headers, cookie: Cookie): void
|
|
23057
23527
|
|
|
23058
23528
|
declare function setGlobalDispatcher<DispatcherImplementation extends Dispatcher>(dispatcher: DispatcherImplementation): void;
|
|
23059
23529
|
|
|
@@ -23061,6 +23531,10 @@ declare function setGlobalOrigin(origin: string | URL | undefined): void;
|
|
|
23061
23531
|
|
|
23062
23532
|
declare type SimpleRoute = string;
|
|
23063
23533
|
|
|
23534
|
+
export declare type SourcelessWorkerOptions = Omit<WorkerOptions, "script" | "scriptPath" | "modules" | "modulesRoot"> & {
|
|
23535
|
+
modulesRules?: ModuleRule_2[];
|
|
23536
|
+
};
|
|
23537
|
+
|
|
23064
23538
|
/**
|
|
23065
23539
|
* Information about Wrangler's bundling process that needs passed through
|
|
23066
23540
|
* for DevTools sourcemap transformation
|
|
@@ -23090,9 +23564,9 @@ declare interface StartDevWorkerOptions {
|
|
|
23090
23564
|
* This is the `main` property of a wrangler.toml.
|
|
23091
23565
|
* You can specify a file path or provide the contents directly.
|
|
23092
23566
|
*/
|
|
23093
|
-
script:
|
|
23567
|
+
script: File_2<string>;
|
|
23094
23568
|
/** The configuration of the worker. */
|
|
23095
|
-
config?:
|
|
23569
|
+
config?: File_2<string | RawConfig> & {
|
|
23096
23570
|
env?: string;
|
|
23097
23571
|
};
|
|
23098
23572
|
/** The compatibility date for the workerd runtime. */
|
|
@@ -23156,6 +23630,8 @@ declare interface StartDevWorkerOptions {
|
|
|
23156
23630
|
hostname?: string;
|
|
23157
23631
|
port?: number;
|
|
23158
23632
|
secure?: boolean;
|
|
23633
|
+
httpsKeyPath?: string;
|
|
23634
|
+
httpsCertPath?: string;
|
|
23159
23635
|
};
|
|
23160
23636
|
/** Controls what request.url looks like inside the worker. */
|
|
23161
23637
|
urlOverrides?: {
|
|
@@ -23218,6 +23694,7 @@ declare namespace Undici {
|
|
|
23218
23694
|
var Pool: Pool;
|
|
23219
23695
|
var RedirectHandler: RedirectHandler
|
|
23220
23696
|
var DecoratorHandler: DecoratorHandler
|
|
23697
|
+
var RetryHandler: RetryHandler
|
|
23221
23698
|
var createRedirectInterceptor: createRedirectInterceptor
|
|
23222
23699
|
var BalancedPool: BalancedPool;
|
|
23223
23700
|
var Client: Client;
|
|
@@ -23235,11 +23712,19 @@ declare namespace Undici {
|
|
|
23235
23712
|
var MockPool: MockPool;
|
|
23236
23713
|
var MockAgent: MockAgent;
|
|
23237
23714
|
var mockErrors: MockErrors;
|
|
23238
|
-
var fetch:
|
|
23715
|
+
var fetch: fetch;
|
|
23716
|
+
var Headers: Headers;
|
|
23717
|
+
var Response: Response;
|
|
23718
|
+
var Request: Request;
|
|
23719
|
+
var FormData: FormData;
|
|
23720
|
+
var File: File;
|
|
23721
|
+
var FileReader: FileReader;
|
|
23722
|
+
var caches: caches;
|
|
23239
23723
|
}
|
|
23240
23724
|
|
|
23241
23725
|
declare namespace undici {
|
|
23242
23726
|
export {
|
|
23727
|
+
Undici as default,
|
|
23243
23728
|
Interceptable,
|
|
23244
23729
|
Dispatcher,
|
|
23245
23730
|
BalancedPool,
|
|
@@ -23264,53 +23749,59 @@ declare namespace undici {
|
|
|
23264
23749
|
ProxyAgent,
|
|
23265
23750
|
RedirectHandler,
|
|
23266
23751
|
DecoratorHandler,
|
|
23267
|
-
|
|
23752
|
+
RetryHandler,
|
|
23268
23753
|
deleteCookie,
|
|
23269
23754
|
getCookies,
|
|
23270
23755
|
getSetCookies,
|
|
23271
23756
|
setCookie,
|
|
23272
23757
|
Cookie,
|
|
23273
|
-
|
|
23274
|
-
|
|
23275
|
-
|
|
23758
|
+
fetch,
|
|
23759
|
+
RequestInfo,
|
|
23760
|
+
BodyInit,
|
|
23276
23761
|
BodyMixin,
|
|
23277
23762
|
SpecIterator,
|
|
23278
23763
|
SpecIterableIterator,
|
|
23279
23764
|
SpecIterable,
|
|
23280
|
-
|
|
23281
|
-
|
|
23765
|
+
HeadersInit,
|
|
23766
|
+
Headers,
|
|
23282
23767
|
RequestCache,
|
|
23283
23768
|
RequestCredentials,
|
|
23284
23769
|
RequestDestination,
|
|
23285
|
-
|
|
23770
|
+
RequestInit,
|
|
23286
23771
|
ReferrerPolicy,
|
|
23287
23772
|
RequestMode,
|
|
23288
23773
|
RequestRedirect,
|
|
23289
23774
|
RequestDuplex,
|
|
23290
|
-
|
|
23291
|
-
|
|
23775
|
+
Request,
|
|
23776
|
+
ResponseInit,
|
|
23292
23777
|
ResponseType,
|
|
23293
23778
|
ResponseRedirectStatus,
|
|
23294
|
-
|
|
23779
|
+
Response,
|
|
23295
23780
|
BlobPropertyBag,
|
|
23296
23781
|
FilePropertyBag,
|
|
23297
|
-
|
|
23782
|
+
File,
|
|
23298
23783
|
FileReader,
|
|
23299
23784
|
ProgressEventInit,
|
|
23300
23785
|
ProgressEvent,
|
|
23301
23786
|
FormDataEntryValue,
|
|
23302
|
-
|
|
23787
|
+
FormData,
|
|
23303
23788
|
DiagnosticsChannel,
|
|
23304
23789
|
BinaryType,
|
|
23305
|
-
|
|
23306
|
-
|
|
23307
|
-
|
|
23308
|
-
|
|
23309
|
-
|
|
23310
|
-
|
|
23790
|
+
WebSocketEventMap,
|
|
23791
|
+
WebSocket,
|
|
23792
|
+
CloseEventInit,
|
|
23793
|
+
CloseEvent,
|
|
23794
|
+
MessageEventInit,
|
|
23795
|
+
MessageEvent,
|
|
23796
|
+
WebSocketInit,
|
|
23311
23797
|
parseMIMEType,
|
|
23312
23798
|
serializeAMimeType,
|
|
23313
|
-
MIMEType
|
|
23799
|
+
MIMEType,
|
|
23800
|
+
CacheStorage,
|
|
23801
|
+
Cache,
|
|
23802
|
+
CacheQueryOptions,
|
|
23803
|
+
MultiCacheQueryOptions,
|
|
23804
|
+
caches
|
|
23314
23805
|
}
|
|
23315
23806
|
}
|
|
23316
23807
|
|
|
@@ -23335,13 +23826,29 @@ export declare class unstable_DevEnv extends EventEmitter_2 {
|
|
|
23335
23826
|
proxy?: ProxyController | undefined;
|
|
23336
23827
|
});
|
|
23337
23828
|
teardown(): Promise<void>;
|
|
23338
|
-
emitErrorEvent(ev:
|
|
23829
|
+
emitErrorEvent(ev: ErrorEvent): void;
|
|
23339
23830
|
}
|
|
23340
23831
|
|
|
23832
|
+
export declare function unstable_getMiniflareWorkerOptions(configPath: string, environment?: string): {
|
|
23833
|
+
workerOptions: SourcelessWorkerOptions;
|
|
23834
|
+
define: Record<string, string>;
|
|
23835
|
+
main?: string;
|
|
23836
|
+
};
|
|
23837
|
+
|
|
23341
23838
|
export declare const unstable_pages: {
|
|
23342
23839
|
deploy: typeof deploy;
|
|
23343
23840
|
};
|
|
23344
23841
|
|
|
23842
|
+
/**
|
|
23843
|
+
* Split an SQLQuery into an array of statements
|
|
23844
|
+
*/
|
|
23845
|
+
export declare function unstable_splitSqlQuery(sql: string): string[];
|
|
23846
|
+
|
|
23847
|
+
export declare function unstable_startWorkerRegistryServer(port: number): Promise<{
|
|
23848
|
+
server: Server<IncomingMessage, ServerResponse>;
|
|
23849
|
+
terminator: HttpTerminator;
|
|
23850
|
+
}>;
|
|
23851
|
+
|
|
23345
23852
|
export declare interface UnstableDevOptions {
|
|
23346
23853
|
config?: string;
|
|
23347
23854
|
env?: string;
|
|
@@ -23350,6 +23857,8 @@ export declare interface UnstableDevOptions {
|
|
|
23350
23857
|
bundle?: boolean;
|
|
23351
23858
|
inspectorPort?: number;
|
|
23352
23859
|
localProtocol?: "http" | "https";
|
|
23860
|
+
httpsKeyPath?: string;
|
|
23861
|
+
httpsCertPath?: string;
|
|
23353
23862
|
assets?: string;
|
|
23354
23863
|
site?: string;
|
|
23355
23864
|
siteInclude?: string[];
|
|
@@ -23375,6 +23884,7 @@ export declare interface UnstableDevOptions {
|
|
|
23375
23884
|
binding: string;
|
|
23376
23885
|
service: string;
|
|
23377
23886
|
environment?: string | undefined;
|
|
23887
|
+
entrypoint?: string | undefined;
|
|
23378
23888
|
}[];
|
|
23379
23889
|
r2?: {
|
|
23380
23890
|
binding: string;
|
|
@@ -23384,6 +23894,9 @@ export declare interface UnstableDevOptions {
|
|
|
23384
23894
|
ai?: {
|
|
23385
23895
|
binding: string;
|
|
23386
23896
|
};
|
|
23897
|
+
version_metadata?: {
|
|
23898
|
+
binding: string;
|
|
23899
|
+
};
|
|
23387
23900
|
moduleRoot?: string;
|
|
23388
23901
|
rules?: Rule[];
|
|
23389
23902
|
logLevel?: "none" | "info" | "error" | "log" | "warn" | "debug";
|
|
@@ -23412,7 +23925,7 @@ export declare interface UnstableDevWorker {
|
|
|
23412
23925
|
address: string;
|
|
23413
23926
|
proxyData: ProxyData;
|
|
23414
23927
|
stop: () => Promise<void>;
|
|
23415
|
-
fetch: (input?:
|
|
23928
|
+
fetch: (input?: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
23416
23929
|
waitUntilExit: () => Promise<void>;
|
|
23417
23930
|
}
|
|
23418
23931
|
|
|
@@ -23427,71 +23940,82 @@ declare type UrlOriginAndPathnameParts = Pick<URL, "protocol" | "hostname" | "po
|
|
|
23427
23940
|
declare type UrlOriginParts = Pick<URL, "protocol" | "hostname" | "port">;
|
|
23428
23941
|
|
|
23429
23942
|
declare interface UserLimits {
|
|
23430
|
-
/** Maximum allowed CPU time for a
|
|
23943
|
+
/** Maximum allowed CPU time for a Worker's invocation in milliseconds */
|
|
23431
23944
|
cpu_ms: number;
|
|
23432
23945
|
}
|
|
23433
23946
|
|
|
23434
|
-
declare interface
|
|
23947
|
+
declare interface WebSocket extends EventTarget_2 {
|
|
23435
23948
|
binaryType: BinaryType
|
|
23436
23949
|
|
|
23437
23950
|
readonly bufferedAmount: number
|
|
23438
23951
|
readonly extensions: string
|
|
23439
23952
|
|
|
23440
|
-
onclose: ((this:
|
|
23441
|
-
onerror: ((this:
|
|
23442
|
-
onmessage: ((this:
|
|
23443
|
-
onopen: ((this:
|
|
23953
|
+
onclose: ((this: WebSocket, ev: WebSocketEventMap['close']) => any) | null
|
|
23954
|
+
onerror: ((this: WebSocket, ev: WebSocketEventMap['error']) => any) | null
|
|
23955
|
+
onmessage: ((this: WebSocket, ev: WebSocketEventMap['message']) => any) | null
|
|
23956
|
+
onopen: ((this: WebSocket, ev: WebSocketEventMap['open']) => any) | null
|
|
23444
23957
|
|
|
23445
23958
|
readonly protocol: string
|
|
23446
23959
|
readonly readyState: number
|
|
23447
23960
|
readonly url: string
|
|
23448
23961
|
|
|
23449
23962
|
close(code?: number, reason?: string): void
|
|
23450
|
-
send(data: string | ArrayBufferLike |
|
|
23963
|
+
send(data: string | ArrayBufferLike | Blob_2 | ArrayBufferView): void
|
|
23451
23964
|
|
|
23452
23965
|
readonly CLOSED: number
|
|
23453
23966
|
readonly CLOSING: number
|
|
23454
23967
|
readonly CONNECTING: number
|
|
23455
23968
|
readonly OPEN: number
|
|
23456
23969
|
|
|
23457
|
-
addEventListener<K extends keyof
|
|
23970
|
+
addEventListener<K extends keyof WebSocketEventMap>(
|
|
23458
23971
|
type: K,
|
|
23459
|
-
listener: (this:
|
|
23972
|
+
listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any,
|
|
23460
23973
|
options?: boolean | AddEventListenerOptions
|
|
23461
23974
|
): void
|
|
23462
23975
|
addEventListener(
|
|
23463
23976
|
type: string,
|
|
23464
|
-
listener:
|
|
23977
|
+
listener: EventListenerOrEventListenerObject,
|
|
23465
23978
|
options?: boolean | AddEventListenerOptions
|
|
23466
23979
|
): void
|
|
23467
|
-
removeEventListener<K extends keyof
|
|
23980
|
+
removeEventListener<K extends keyof WebSocketEventMap>(
|
|
23468
23981
|
type: K,
|
|
23469
|
-
listener: (this:
|
|
23982
|
+
listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any,
|
|
23470
23983
|
options?: boolean | EventListenerOptions
|
|
23471
23984
|
): void
|
|
23472
23985
|
removeEventListener(
|
|
23473
23986
|
type: string,
|
|
23474
|
-
listener:
|
|
23987
|
+
listener: EventListenerOrEventListenerObject,
|
|
23475
23988
|
options?: boolean | EventListenerOptions
|
|
23476
23989
|
): void
|
|
23477
23990
|
}
|
|
23478
23991
|
|
|
23479
|
-
declare const
|
|
23480
|
-
prototype:
|
|
23481
|
-
new (url: string | URL, protocols?: string | string[]):
|
|
23992
|
+
declare const WebSocket: {
|
|
23993
|
+
prototype: WebSocket
|
|
23994
|
+
new (url: string | URL, protocols?: string | string[] | WebSocketInit): WebSocket
|
|
23482
23995
|
readonly CLOSED: number
|
|
23483
23996
|
readonly CLOSING: number
|
|
23484
23997
|
readonly CONNECTING: number
|
|
23485
23998
|
readonly OPEN: number
|
|
23486
23999
|
};
|
|
23487
24000
|
|
|
23488
|
-
declare interface
|
|
23489
|
-
close:
|
|
24001
|
+
declare interface WebSocketEventMap {
|
|
24002
|
+
close: CloseEvent
|
|
23490
24003
|
error: Event_2
|
|
23491
|
-
message:
|
|
24004
|
+
message: MessageEvent
|
|
23492
24005
|
open: Event_2
|
|
23493
24006
|
}
|
|
23494
24007
|
|
|
24008
|
+
declare interface WebSocketInit {
|
|
24009
|
+
protocols?: string | string[],
|
|
24010
|
+
dispatcher?: Dispatcher,
|
|
24011
|
+
headers?: HeadersInit
|
|
24012
|
+
}
|
|
24013
|
+
|
|
24014
|
+
declare type WorkerEntrypointsDefinition = Record<"default" | string, {
|
|
24015
|
+
host: string;
|
|
24016
|
+
port: number;
|
|
24017
|
+
} | undefined>;
|
|
24018
|
+
|
|
23495
24019
|
declare type ZoneIdRoute = {
|
|
23496
24020
|
pattern: string;
|
|
23497
24021
|
zone_id: string;
|