wrangler 0.0.0-e9ab55a → 0.0.0-e9fae558

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.
Files changed (115) hide show
  1. package/Cloudflare_CA.pem +18 -0
  2. package/README.md +47 -16
  3. package/bin/wrangler.js +117 -31
  4. package/kv-asset-handler.js +1 -0
  5. package/package.json +194 -125
  6. package/templates/__tests__/pages-dev-util.test.ts +128 -0
  7. package/templates/__tests__/tsconfig-sanity.ts +12 -0
  8. package/templates/__tests__/tsconfig.json +8 -0
  9. package/templates/checked-fetch.js +30 -0
  10. package/templates/facade.d.ts +17 -0
  11. package/templates/gitignore +172 -0
  12. package/templates/init-tests/test-jest-new-worker.js +23 -0
  13. package/templates/init-tests/test-vitest-new-worker.js +24 -0
  14. package/templates/init-tests/test-vitest-new-worker.ts +25 -0
  15. package/templates/middleware/common.ts +67 -0
  16. package/templates/middleware/loader-modules.ts +137 -0
  17. package/templates/middleware/loader-sw.ts +228 -0
  18. package/templates/middleware/middleware-d1-beta.d.ts +3 -0
  19. package/templates/middleware/middleware-miniflare3-json-error.ts +33 -0
  20. package/templates/middleware/middleware-multiworker-dev.d.ts +4 -0
  21. package/templates/middleware/middleware-multiworker-dev.ts +59 -0
  22. package/templates/middleware/middleware-pretty-error.ts +40 -0
  23. package/templates/middleware/middleware-scheduled.ts +15 -0
  24. package/templates/middleware/middleware-serve-static-assets.d.ts +6 -0
  25. package/templates/middleware/middleware-serve-static-assets.ts +56 -0
  26. package/templates/new-worker-scheduled.js +17 -0
  27. package/templates/new-worker-scheduled.ts +32 -0
  28. package/templates/new-worker.js +15 -0
  29. package/templates/new-worker.ts +33 -0
  30. package/templates/no-op-worker.js +10 -0
  31. package/templates/pages-dev-pipeline.ts +31 -0
  32. package/templates/pages-dev-util.ts +55 -0
  33. package/templates/pages-shim.ts +9 -0
  34. package/templates/pages-template-plugin.ts +190 -0
  35. package/templates/pages-template-worker.ts +198 -0
  36. package/templates/tsconfig-sanity.ts +11 -0
  37. package/templates/tsconfig.init.json +105 -0
  38. package/templates/tsconfig.json +8 -0
  39. package/wrangler-dist/cli.d.ts +1732 -0
  40. package/wrangler-dist/cli.js +141470 -110893
  41. package/wrangler-dist/wasm-sync.wasm +0 -0
  42. package/import_meta_url.js +0 -3
  43. package/miniflare-config-stubs/.env.empty +0 -0
  44. package/miniflare-config-stubs/package.empty.json +0 -1
  45. package/miniflare-config-stubs/wrangler.empty.toml +0 -0
  46. package/pages/functions/buildWorker.ts +0 -62
  47. package/pages/functions/filepath-routing.test.ts +0 -39
  48. package/pages/functions/filepath-routing.ts +0 -228
  49. package/pages/functions/identifiers.ts +0 -78
  50. package/pages/functions/routes.ts +0 -158
  51. package/pages/functions/template-worker.ts +0 -136
  52. package/src/__tests__/clipboardy-mock.js +0 -4
  53. package/src/__tests__/dev.test.tsx +0 -67
  54. package/src/__tests__/index.test.ts +0 -287
  55. package/src/__tests__/jest.setup.ts +0 -22
  56. package/src/__tests__/kv.test.ts +0 -1126
  57. package/src/__tests__/mock-cfetch.ts +0 -171
  58. package/src/__tests__/mock-dialogs.ts +0 -65
  59. package/src/__tests__/publish.test.ts +0 -102
  60. package/src/__tests__/run-in-tmp.ts +0 -19
  61. package/src/__tests__/run-wrangler.ts +0 -32
  62. package/src/api/form_data.ts +0 -131
  63. package/src/api/preview.ts +0 -128
  64. package/src/api/worker.ts +0 -155
  65. package/src/cfetch/index.ts +0 -102
  66. package/src/cfetch/internal.ts +0 -69
  67. package/src/cli.ts +0 -9
  68. package/src/config.ts +0 -646
  69. package/src/dev.tsx +0 -784
  70. package/src/dialogs.tsx +0 -77
  71. package/src/index.tsx +0 -1928
  72. package/src/inspect.ts +0 -543
  73. package/src/kv.tsx +0 -276
  74. package/src/module-collection.ts +0 -64
  75. package/src/pages.tsx +0 -1040
  76. package/src/proxy.ts +0 -302
  77. package/src/publish.ts +0 -382
  78. package/src/sites.tsx +0 -118
  79. package/src/tail.tsx +0 -73
  80. package/src/user.tsx +0 -1027
  81. package/static-asset-facade.js +0 -47
  82. package/vendor/@cloudflare/kv-asset-handler/CHANGELOG.md +0 -332
  83. package/vendor/@cloudflare/kv-asset-handler/LICENSE_APACHE +0 -176
  84. package/vendor/@cloudflare/kv-asset-handler/LICENSE_MIT +0 -25
  85. package/vendor/@cloudflare/kv-asset-handler/README.md +0 -245
  86. package/vendor/@cloudflare/kv-asset-handler/dist/index.d.ts +0 -32
  87. package/vendor/@cloudflare/kv-asset-handler/dist/index.js +0 -354
  88. package/vendor/@cloudflare/kv-asset-handler/dist/mocks.d.ts +0 -13
  89. package/vendor/@cloudflare/kv-asset-handler/dist/mocks.js +0 -148
  90. package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.d.ts +0 -1
  91. package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.js +0 -436
  92. package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.d.ts +0 -1
  93. package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.js +0 -40
  94. package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.d.ts +0 -1
  95. package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.js +0 -42
  96. package/vendor/@cloudflare/kv-asset-handler/dist/types.d.ts +0 -26
  97. package/vendor/@cloudflare/kv-asset-handler/dist/types.js +0 -31
  98. package/vendor/@cloudflare/kv-asset-handler/package.json +0 -52
  99. package/vendor/@cloudflare/kv-asset-handler/src/index.ts +0 -296
  100. package/vendor/@cloudflare/kv-asset-handler/src/mocks.ts +0 -136
  101. package/vendor/@cloudflare/kv-asset-handler/src/test/getAssetFromKV.ts +0 -464
  102. package/vendor/@cloudflare/kv-asset-handler/src/test/mapRequestToAsset.ts +0 -33
  103. package/vendor/@cloudflare/kv-asset-handler/src/test/serveSinglePageApp.ts +0 -42
  104. package/vendor/@cloudflare/kv-asset-handler/src/types.ts +0 -39
  105. package/vendor/wrangler-mime/CHANGELOG.md +0 -289
  106. package/vendor/wrangler-mime/LICENSE +0 -21
  107. package/vendor/wrangler-mime/Mime.js +0 -97
  108. package/vendor/wrangler-mime/README.md +0 -187
  109. package/vendor/wrangler-mime/cli.js +0 -46
  110. package/vendor/wrangler-mime/index.js +0 -4
  111. package/vendor/wrangler-mime/lite.js +0 -4
  112. package/vendor/wrangler-mime/package.json +0 -52
  113. package/vendor/wrangler-mime/types/other.js +0 -1
  114. package/vendor/wrangler-mime/types/standard.js +0 -1
  115. package/wrangler-dist/cli.js.map +0 -7
@@ -0,0 +1,1732 @@
1
+ /// <reference types="node" />
2
+
3
+ import { Blob as Blob_2 } from 'buffer';
4
+ import { ConnectionOptions } from 'tls';
5
+ import { Duplex } from 'stream';
6
+ import { EventEmitter } from 'events';
7
+ import { IpcNetConnectOpts } from 'net';
8
+ import type { Json } from 'miniflare';
9
+ import { Readable } from 'stream';
10
+ import { ReadableStream as ReadableStream_2 } from 'stream/web';
11
+ import { Socket as Socket_2 } from 'net';
12
+ import { TcpNetConnectOpts } from 'net';
13
+ import { TlsOptions as TlsOptions_2 } from 'tls';
14
+ import { TLSSocket } from 'tls';
15
+ import { URL as URL_2 } from 'url';
16
+ import { URLSearchParams as URLSearchParams_2 } from 'url';
17
+ import { Writable } from 'stream';
18
+
19
+ declare type AbortSignal_2 = unknown;
20
+
21
+ declare interface BlobPropertyBag {
22
+ type?: string
23
+ endings?: 'native' | 'transparent'
24
+ }
25
+
26
+ declare type BodyInit_2 =
27
+ | ArrayBuffer
28
+ | AsyncIterable<Uint8Array>
29
+ | Blob_2
30
+ | FormData_2
31
+ | Iterable<Uint8Array>
32
+ | NodeJS.ArrayBufferView
33
+ | URLSearchParams_2
34
+ | null
35
+ | string
36
+
37
+ declare interface BodyMixin {
38
+ readonly body: ReadableStream_2 | null
39
+ readonly bodyUsed: boolean
40
+
41
+ readonly arrayBuffer: () => Promise<ArrayBuffer>
42
+ readonly blob: () => Promise<Blob_2>
43
+ readonly formData: () => Promise<FormData_2>
44
+ readonly json: () => Promise<unknown>
45
+ readonly text: () => Promise<string>
46
+ }
47
+
48
+ declare class BodyReadable extends Readable {
49
+ constructor(
50
+ resume?: (this: Readable, size: number) => void | null,
51
+ abort?: () => void | null,
52
+ contentType?: string
53
+ )
54
+
55
+ /** Consumes and returns the body as a string
56
+ * https://fetch.spec.whatwg.org/#dom-body-text
57
+ */
58
+ text(): Promise<string>
59
+
60
+ /** Consumes and returns the body as a JavaScript Object
61
+ * https://fetch.spec.whatwg.org/#dom-body-json
62
+ */
63
+ json(): Promise<any>
64
+
65
+ /** Consumes and returns the body as a Blob
66
+ * https://fetch.spec.whatwg.org/#dom-body-blob
67
+ */
68
+ blob(): Promise<Blob_2>
69
+
70
+ /** Consumes and returns the body as an ArrayBuffer
71
+ * https://fetch.spec.whatwg.org/#dom-body-arraybuffer
72
+ */
73
+ arrayBuffer(): Promise<ArrayBuffer>
74
+
75
+ /** Not implemented
76
+ *
77
+ * https://fetch.spec.whatwg.org/#dom-body-formdata
78
+ */
79
+ formData(): Promise<never>
80
+
81
+ /** Returns true if the body is not null and the body has been consumed
82
+ *
83
+ * Otherwise, returns false
84
+ *
85
+ * https://fetch.spec.whatwg.org/#dom-body-bodyused
86
+ */
87
+ readonly bodyUsed: boolean
88
+
89
+ /** Throws on node 16.6.0
90
+ *
91
+ * If body is null, it should return null as the body
92
+ *
93
+ * If body is not null, should return the body as a ReadableStream
94
+ *
95
+ * https://fetch.spec.whatwg.org/#dom-body-body
96
+ */
97
+ readonly body: never | undefined
98
+
99
+ /** Dumps the response body by reading `limit` number of bytes.
100
+ * @param opts.limit Number of bytes to read (optional) - Default: 262144
101
+ */
102
+ dump(opts?: { limit: number }): Promise<void>
103
+ }
104
+
105
+ declare function buildConnector (options?: buildConnector.BuildOptions): buildConnector.connector
106
+
107
+ declare namespace buildConnector {
108
+ type BuildOptions = (ConnectionOptions | TcpNetConnectOpts | IpcNetConnectOpts) & {
109
+ maxCachedSessions?: number | null;
110
+ socketPath?: string | null;
111
+ timeout?: number | null;
112
+ port?: number;
113
+ keepAlive?: boolean | null;
114
+ keepAliveInitialDelay?: number | null;
115
+ }
116
+
117
+ interface Options {
118
+ hostname: string
119
+ host?: string
120
+ protocol: string
121
+ port: string
122
+ servername?: string
123
+ localAddress?: string | null
124
+ httpSocket?: Socket_2
125
+ }
126
+
127
+ type Callback = (...args: CallbackArgs) => void
128
+ type CallbackArgs = [null, Socket_2 | TLSSocket] | [Error, null]
129
+
130
+ type connector = connectorAsync | connectorSync
131
+
132
+ interface connectorSync {
133
+ (options: buildConnector.Options): Socket_2 | TLSSocket
134
+ }
135
+
136
+ interface connectorAsync {
137
+ (options: buildConnector.Options, callback: buildConnector.Callback): void
138
+ }
139
+ }
140
+
141
+ /**
142
+ * An imported module.
143
+ */
144
+ declare interface CfModule {
145
+ /**
146
+ * The module name.
147
+ *
148
+ * @example
149
+ * './src/index.js'
150
+ */
151
+ name: string;
152
+ /**
153
+ * The module content, usually JavaScript or WASM code.
154
+ *
155
+ * @example
156
+ * export default {
157
+ * async fetch(request) {
158
+ * return new Response('Ok')
159
+ * }
160
+ * }
161
+ */
162
+ content: string | Buffer;
163
+ /**
164
+ * The module type.
165
+ *
166
+ * If absent, will default to the main module's type.
167
+ */
168
+ type?: CfModuleType;
169
+ }
170
+
171
+ /**
172
+ * A module type.
173
+ */
174
+ declare type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer";
175
+
176
+ /** A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default. */
177
+ declare class Client extends Dispatcher {
178
+ constructor(url: string | URL_2, options?: Client.Options);
179
+ /** Property to get and set the pipelining factor. */
180
+ pipelining: number;
181
+ /** `true` after `client.close()` has been called. */
182
+ closed: boolean;
183
+ /** `true` after `client.destroyed()` has been called or `client.close()` has been called and the client shutdown has completed. */
184
+ destroyed: boolean;
185
+ }
186
+
187
+ declare namespace Client {
188
+ interface Options {
189
+ /** the timeout after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. Default: `4e3` milliseconds (4s). */
190
+ keepAliveTimeout?: number | null;
191
+ /** the maximum allowed `idleTimeout` when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */
192
+ keepAliveMaxTimeout?: number | null;
193
+ /** A number subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */
194
+ keepAliveTimeoutThreshold?: number | null;
195
+ /** 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`. */
196
+ pipelining?: number | null;
197
+ /** **/
198
+ connect?: buildConnector.BuildOptions | buildConnector.connector | null;
199
+ /** The maximum length of request headers in bytes. Default: `16384` (16KiB). */
200
+ maxHeaderSize?: number | null;
201
+ /** 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). */
202
+ bodyTimeout?: number | null;
203
+ /** The amount of time the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */
204
+ headersTimeout?: number | null;
205
+ /** If `true`, an error is thrown when the request content-length header doesn't match the length of the request body. Default: `true`. */
206
+ strictContentLength?: boolean;
207
+ /** @deprecated use the connect option instead */
208
+ tls?: TlsOptions_2 | null;
209
+ /** */
210
+ maxRequestsPerClient?: number;
211
+ /** Max response body size in bytes, -1 is disabled */
212
+ maxResponseSize?: number | null;
213
+ /** Enables a family autodetection algorithm that loosely implements section 5 of RFC 8305. */
214
+ autoSelectFamily?: boolean;
215
+ /** The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. */
216
+ autoSelectFamilyAttemptTimeout?: number;
217
+
218
+ interceptors?: {Client: readonly Dispatcher[] | undefined}
219
+ }
220
+
221
+ interface SocketInfo {
222
+ localAddress?: string
223
+ localPort?: number
224
+ remoteAddress?: string
225
+ remotePort?: number
226
+ remoteFamily?: string
227
+ timeout?: number
228
+ bytesWritten?: number
229
+ bytesRead?: number
230
+ }
231
+
232
+
233
+ }
234
+
235
+ /**
236
+ * The possible types for a `Rule`.
237
+ */
238
+ declare type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data";
239
+
240
+ declare type CustomDomainRoute = {
241
+ pattern: string;
242
+ custom_domain: boolean;
243
+ };
244
+
245
+ export declare function deleteMTlsCertificate(accountId: string, certificateId: string): Promise<unknown>;
246
+
247
+ /**
248
+ * Publish a directory to an account/project.
249
+ * NOTE: You will need the `CLOUDFLARE_API_KEY` environment
250
+ * variable set
251
+ */
252
+ declare function deploy({ directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, }: PagesDeployOptions): Promise<{
253
+ url: string;
254
+ environment: "production" | "preview";
255
+ id: string;
256
+ project_id: string;
257
+ project_name: string;
258
+ build_config: {
259
+ build_command: string;
260
+ destination_dir: string;
261
+ root_dir: string;
262
+ web_analytics_tag?: string | undefined;
263
+ web_analytics_token?: string | undefined;
264
+ fast_builds?: boolean | undefined;
265
+ };
266
+ created_on: string;
267
+ production_branch: string;
268
+ deployment_trigger: {
269
+ type: string;
270
+ metadata: {
271
+ branch: string;
272
+ commit_hash: string;
273
+ commit_message: string;
274
+ };
275
+ };
276
+ latest_stage: {
277
+ name: "build" | "deploy" | "queued" | "initialize" | "clone_repo";
278
+ status: "active" | "idle" | "canceled" | "success" | "failure" | "skipped";
279
+ started_on: string | null;
280
+ ended_on: string | null;
281
+ };
282
+ stages: {
283
+ name: "build" | "deploy" | "queued" | "initialize" | "clone_repo";
284
+ status: "active" | "idle" | "canceled" | "success" | "failure" | "skipped";
285
+ started_on: string | null;
286
+ ended_on: string | null;
287
+ }[];
288
+ aliases: string[];
289
+ modified_on: string;
290
+ short_id: string;
291
+ build_image_major_version: number;
292
+ kv_namespaces?: any;
293
+ source?: {
294
+ type: "github" | "gitlab";
295
+ config: {
296
+ owner: string;
297
+ repo_name: string;
298
+ production_branch?: string | undefined;
299
+ pr_comments_enabled?: boolean | undefined;
300
+ deployments_enabled?: boolean | undefined;
301
+ production_deployments_enabled?: boolean | undefined;
302
+ preview_deployment_setting?: "none" | "all" | "custom" | undefined;
303
+ preview_branch_includes?: string[] | undefined;
304
+ preview_branch_excludes?: string[] | undefined;
305
+ };
306
+ } | undefined;
307
+ env_vars?: any;
308
+ durable_object_namespaces?: any;
309
+ is_skipped?: boolean | undefined;
310
+ files?: {
311
+ [x: string]: string | undefined;
312
+ } | undefined;
313
+ }>;
314
+
315
+ /**
316
+ * Deprecated upload configuration.
317
+ */
318
+ declare interface DeprecatedUpload {
319
+ /**
320
+ * The format of the Worker script.
321
+ *
322
+ * @deprecated We infer the format automatically now.
323
+ */
324
+ format?: "modules" | "service-worker";
325
+ /**
326
+ * The directory you wish to upload your worker from,
327
+ * relative to the wrangler.toml file.
328
+ *
329
+ * Defaults to the directory containing the wrangler.toml file.
330
+ *
331
+ * @deprecated
332
+ */
333
+ dir?: string;
334
+ /**
335
+ * The path to the Worker script, relative to `upload.dir`.
336
+ *
337
+ * @deprecated This will be replaced by a command line argument.
338
+ */
339
+ main?: string;
340
+ /**
341
+ * @deprecated This is now defined at the top level `rules` field.
342
+ */
343
+ rules?: Environment["rules"];
344
+ }
345
+
346
+ /** Dispatcher is the core API used to dispatch requests. */
347
+ declare class Dispatcher extends EventEmitter {
348
+ /** Dispatches a request. This API is expected to evolve through semver-major versions and is less stable than the preceding higher level APIs. It is primarily intended for library developers who implement higher level APIs on top of this. */
349
+ dispatch(options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean;
350
+ /** Starts two-way communications with the requested resource. */
351
+ connect(options: Dispatcher.ConnectOptions): Promise<Dispatcher.ConnectData>;
352
+ connect(options: Dispatcher.ConnectOptions, callback: (err: Error | null, data: Dispatcher.ConnectData) => void): void;
353
+ /** Performs an HTTP request. */
354
+ request(options: Dispatcher.RequestOptions): Promise<Dispatcher.ResponseData>;
355
+ request(options: Dispatcher.RequestOptions, callback: (err: Error | null, data: Dispatcher.ResponseData) => void): void;
356
+ /** For easy use with `stream.pipeline`. */
357
+ pipeline(options: Dispatcher.PipelineOptions, handler: Dispatcher.PipelineHandler): Duplex;
358
+ /** A faster version of `Dispatcher.request`. */
359
+ stream(options: Dispatcher.RequestOptions, factory: Dispatcher.StreamFactory): Promise<Dispatcher.StreamData>;
360
+ stream(options: Dispatcher.RequestOptions, factory: Dispatcher.StreamFactory, callback: (err: Error | null, data: Dispatcher.StreamData) => void): void;
361
+ /** Upgrade to a different protocol. */
362
+ upgrade(options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>;
363
+ upgrade(options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void;
364
+ /** Closes the client and gracefully waits for enqueued requests to complete before invoking the callback (or returning a promise if no callback is provided). */
365
+ close(): Promise<void>;
366
+ close(callback: () => void): void;
367
+ /** Destroy the client abruptly with the given err. All the pending and running requests will be asynchronously aborted and error. Waits until socket is closed before invoking the callback (or returning a promise if no callback is provided). Since this operation is asynchronously dispatched there might still be some progress on dispatched requests. */
368
+ destroy(): Promise<void>;
369
+ destroy(err: Error | null): Promise<void>;
370
+ destroy(callback: () => void): void;
371
+ destroy(err: Error | null, callback: () => void): void;
372
+
373
+ on(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
374
+ on(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
375
+ on(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
376
+ on(eventName: 'drain', callback: (origin: URL_2) => void): this;
377
+
378
+
379
+ once(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
380
+ once(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
381
+ once(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
382
+ once(eventName: 'drain', callback: (origin: URL_2) => void): this;
383
+
384
+
385
+ off(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
386
+ off(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
387
+ off(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
388
+ off(eventName: 'drain', callback: (origin: URL_2) => void): this;
389
+
390
+
391
+ addListener(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
392
+ addListener(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
393
+ addListener(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
394
+ addListener(eventName: 'drain', callback: (origin: URL_2) => void): this;
395
+
396
+ removeListener(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
397
+ removeListener(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
398
+ removeListener(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
399
+ removeListener(eventName: 'drain', callback: (origin: URL_2) => void): this;
400
+
401
+ prependListener(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
402
+ prependListener(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
403
+ prependListener(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
404
+ prependListener(eventName: 'drain', callback: (origin: URL_2) => void): this;
405
+
406
+ prependOnceListener(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
407
+ prependOnceListener(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
408
+ prependOnceListener(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
409
+ prependOnceListener(eventName: 'drain', callback: (origin: URL_2) => void): this;
410
+
411
+ listeners(eventName: 'connect'): ((origin: URL_2, targets: readonly Dispatcher[]) => void)[]
412
+ listeners(eventName: 'disconnect'): ((origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
413
+ listeners(eventName: 'connectionError'): ((origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
414
+ listeners(eventName: 'drain'): ((origin: URL_2) => void)[];
415
+
416
+ rawListeners(eventName: 'connect'): ((origin: URL_2, targets: readonly Dispatcher[]) => void)[]
417
+ rawListeners(eventName: 'disconnect'): ((origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
418
+ rawListeners(eventName: 'connectionError'): ((origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
419
+ rawListeners(eventName: 'drain'): ((origin: URL_2) => void)[];
420
+
421
+ emit(eventName: 'connect', origin: URL_2, targets: readonly Dispatcher[]): boolean;
422
+ emit(eventName: 'disconnect', origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
423
+ emit(eventName: 'connectionError', origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
424
+ emit(eventName: 'drain', origin: URL_2): boolean;
425
+ }
426
+
427
+ declare namespace Dispatcher {
428
+ interface DispatchOptions {
429
+ origin?: string | URL_2;
430
+ path: string;
431
+ method: HttpMethod;
432
+ /** Default: `null` */
433
+ body?: string | Buffer | Uint8Array | Readable | null | FormData_2;
434
+ /** Default: `null` */
435
+ headers?: IncomingHttpHeaders | string[] | null;
436
+ /** Query string params to be embedded in the request URL. Default: `null` */
437
+ query?: Record<string, any>;
438
+ /** Whether the requests can be safely retried or not. If `false` the request won't be sent until all preceding requests in the pipeline have completed. Default: `true` if `method` is `HEAD` or `GET`. */
439
+ idempotent?: boolean;
440
+ /** Whether the response is expected to take a long time and would end up blocking the pipeline. When this is set to `true` further pipelining will be avoided on the same connection until headers have been received. */
441
+ blocking?: boolean;
442
+ /** Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`. Default: `method === 'CONNECT' || null`. */
443
+ upgrade?: boolean | string | null;
444
+ /** The amount of time the parser will wait to receive the complete HTTP headers. Defaults to 300 seconds. */
445
+ headersTimeout?: number | null;
446
+ /** 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. */
447
+ bodyTimeout?: number | null;
448
+ /** Whether the request should stablish a keep-alive or not. Default `false` */
449
+ reset?: boolean;
450
+ /** Whether Undici should throw an error upon receiving a 4xx or 5xx response from the server. Defaults to false */
451
+ throwOnError?: boolean;
452
+ }
453
+ interface ConnectOptions {
454
+ path: string;
455
+ /** Default: `null` */
456
+ headers?: IncomingHttpHeaders | string[] | null;
457
+ /** Default: `null` */
458
+ signal?: AbortSignal_2 | EventEmitter | null;
459
+ /** This argument parameter is passed through to `ConnectData` */
460
+ opaque?: unknown;
461
+ /** Default: 0 */
462
+ maxRedirections?: number;
463
+ /** Default: `null` */
464
+ responseHeader?: 'raw' | null;
465
+ }
466
+ interface RequestOptions extends DispatchOptions {
467
+ /** Default: `null` */
468
+ opaque?: unknown;
469
+ /** Default: `null` */
470
+ signal?: AbortSignal_2 | EventEmitter | null;
471
+ /** Default: 0 */
472
+ maxRedirections?: number;
473
+ /** Default: `null` */
474
+ onInfo?: (info: { statusCode: number, headers: Record<string, string | string[]> }) => void;
475
+ /** Default: `null` */
476
+ responseHeader?: 'raw' | null;
477
+ }
478
+ interface PipelineOptions extends RequestOptions {
479
+ /** `true` if the `handler` will return an object stream. Default: `false` */
480
+ objectMode?: boolean;
481
+ }
482
+ interface UpgradeOptions {
483
+ path: string;
484
+ /** Default: `'GET'` */
485
+ method?: string;
486
+ /** Default: `null` */
487
+ headers?: IncomingHttpHeaders | string[] | null;
488
+ /** A string of comma separated protocols, in descending preference order. Default: `'Websocket'` */
489
+ protocol?: string;
490
+ /** Default: `null` */
491
+ signal?: AbortSignal_2 | EventEmitter | null;
492
+ /** Default: 0 */
493
+ maxRedirections?: number;
494
+ /** Default: `null` */
495
+ responseHeader?: 'raw' | null;
496
+ }
497
+ interface ConnectData {
498
+ statusCode: number;
499
+ headers: IncomingHttpHeaders;
500
+ socket: Duplex;
501
+ opaque: unknown;
502
+ }
503
+ interface ResponseData {
504
+ statusCode: number;
505
+ headers: IncomingHttpHeaders;
506
+ body: BodyReadable & BodyMixin;
507
+ trailers: Record<string, string>;
508
+ opaque: unknown;
509
+ context: object;
510
+ }
511
+ interface PipelineHandlerData {
512
+ statusCode: number;
513
+ headers: IncomingHttpHeaders;
514
+ opaque: unknown;
515
+ body: BodyReadable;
516
+ context: object;
517
+ }
518
+ interface StreamData {
519
+ opaque: unknown;
520
+ trailers: Record<string, string>;
521
+ }
522
+ interface UpgradeData {
523
+ headers: IncomingHttpHeaders;
524
+ socket: Duplex;
525
+ opaque: unknown;
526
+ }
527
+ interface StreamFactoryData {
528
+ statusCode: number;
529
+ headers: IncomingHttpHeaders;
530
+ opaque: unknown;
531
+ context: object;
532
+ }
533
+ type StreamFactory = (data: StreamFactoryData) => Writable;
534
+ interface DispatchHandlers {
535
+ /** Invoked before request is dispatched on socket. May be invoked multiple times when a request is retried when the request at the head of the pipeline fails. */
536
+ onConnect?(abort: () => void): void;
537
+ /** Invoked when an error has occurred. */
538
+ onError?(err: Error): void;
539
+ /** Invoked when request is upgraded either due to a `Upgrade` header or `CONNECT` method. */
540
+ onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex): void;
541
+ /** Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. */
542
+ onHeaders?(statusCode: number, headers: Buffer[] | string[] | null, resume: () => void): boolean;
543
+ /** Invoked when response payload data is received. */
544
+ onData?(chunk: Buffer): boolean;
545
+ /** Invoked when response payload and trailers have been received and the request has completed. */
546
+ onComplete?(trailers: string[] | null): void;
547
+ /** Invoked when a body chunk is sent to the server. May be invoked multiple times for chunked requests */
548
+ onBodySent?(chunkSize: number, totalBytesSent: number): void;
549
+ }
550
+ type PipelineHandler = (data: PipelineHandlerData) => Readable;
551
+ type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH';
552
+
553
+ /**
554
+ * @link https://fetch.spec.whatwg.org/#body-mixin
555
+ */
556
+ interface BodyMixin {
557
+ readonly body?: never; // throws on node v16.6.0
558
+ readonly bodyUsed: boolean;
559
+ arrayBuffer(): Promise<ArrayBuffer>;
560
+ blob(): Promise<Blob_2>;
561
+ formData(): Promise<never>;
562
+ json(): Promise<any>;
563
+ text(): Promise<string>;
564
+ }
565
+
566
+ interface DispatchInterceptor {
567
+ (dispatch: Dispatcher['dispatch']): Dispatcher['dispatch']
568
+ }
569
+ }
570
+
571
+ declare interface DispatchNamespaceOutbound {
572
+ /** Name of the service handling the outbound requests */
573
+ service: string;
574
+ /** (Optional) Name of the environment handling the outbound requests. */
575
+ environment?: string;
576
+ /** (Optional) List of parameter names, for sending context from your dispatch worker to the outbound handler */
577
+ parameters?: string[];
578
+ }
579
+
580
+ declare type DurableObjectBindings = {
581
+ /** The name of the binding used to refer to the Durable Object */
582
+ name: string;
583
+ /** The exported class name of the Durable Object */
584
+ class_name: string;
585
+ /** The script where the Durable Object is defined (if it's external to this worker) */
586
+ script_name?: string;
587
+ /** The service environment of the script_name to bind to */
588
+ environment?: string;
589
+ }[];
590
+
591
+ declare interface EnablePagesAssetsServiceBindingOptions {
592
+ proxyPort?: number;
593
+ directory?: string;
594
+ }
595
+
596
+ /**
597
+ * The `Environment` interface declares all the configuration fields that
598
+ * can be specified for an environment.
599
+ *
600
+ * This could be the top-level default environment, or a specific named environment.
601
+ */
602
+ declare interface Environment extends EnvironmentInheritable, EnvironmentNonInheritable {
603
+ }
604
+
605
+ /**
606
+ * The `EnvironmentInheritable` interface declares all the configuration fields for an environment
607
+ * that can be inherited (and overridden) from the top-level environment.
608
+ */
609
+ declare interface EnvironmentInheritable {
610
+ /**
611
+ * The name of your worker. Alphanumeric + dashes only.
612
+ *
613
+ * @inheritable
614
+ */
615
+ name: string | undefined;
616
+ /**
617
+ * This is the ID of the account associated with your zone.
618
+ * You might have more than one account, so make sure to use
619
+ * the ID of the account associated with the zone/route you
620
+ * provide, if you provide one. It can also be specified through
621
+ * the CLOUDFLARE_ACCOUNT_ID environment variable.
622
+ *
623
+ * @inheritable
624
+ */
625
+ account_id: string | undefined;
626
+ /**
627
+ * A date in the form yyyy-mm-dd, which will be used to determine
628
+ * which version of the Workers runtime is used.
629
+ *
630
+ * More details at https://developers.cloudflare.com/workers/platform/compatibility-dates
631
+ *
632
+ * @inheritable
633
+ */
634
+ compatibility_date: string | undefined;
635
+ /**
636
+ * A list of flags that enable features from upcoming features of
637
+ * the Workers runtime, usually used together with compatibility_flags.
638
+ *
639
+ * More details at https://developers.cloudflare.com/workers/platform/compatibility-dates
640
+ *
641
+ * @inheritable
642
+ */
643
+ compatibility_flags: string[];
644
+ /**
645
+ * The entrypoint/path to the JavaScript file that will be executed.
646
+ */
647
+ main: string | undefined;
648
+ /**
649
+ * The directory in which module rules should be evaluated in a `--no-bundle` worker
650
+ * This defaults to dirname(main) when left undefined
651
+ */
652
+ base_dir: string | undefined;
653
+ /**
654
+ * Whether we use <name>.<subdomain>.workers.dev to
655
+ * test and deploy your worker.
656
+ *
657
+ * @default `true` (This is a breaking change from Wrangler v1)
658
+ * @breaking
659
+ * @inheritable
660
+ */
661
+ workers_dev: boolean | undefined;
662
+ /**
663
+ * A list of routes that your worker should be published to.
664
+ * Only one of `routes` or `route` is required.
665
+ *
666
+ * Only required when workers_dev is false, and there's no scheduled worker (see `triggers`)
667
+ *
668
+ * @inheritable
669
+ */
670
+ routes: Route[] | undefined;
671
+ /**
672
+ * A route that your worker should be published to. Literally
673
+ * the same as routes, but only one.
674
+ * Only one of `routes` or `route` is required.
675
+ *
676
+ * Only required when workers_dev is false, and there's no scheduled worker
677
+ *
678
+ * @inheritable
679
+ */
680
+ route: Route | undefined;
681
+ /**
682
+ * Path to a custom tsconfig
683
+ */
684
+ tsconfig: string | undefined;
685
+ /**
686
+ * The function to use to replace jsx syntax.
687
+ *
688
+ * @default `"React.createElement"`
689
+ * @inheritable
690
+ */
691
+ jsx_factory: string;
692
+ /**
693
+ * The function to use to replace jsx fragment syntax.
694
+ *
695
+ * @default `"React.Fragment"`
696
+ * @inheritable
697
+ */
698
+ jsx_fragment: string;
699
+ /**
700
+ * "Cron" definitions to trigger a worker's "scheduled" function.
701
+ *
702
+ * Lets you call workers periodically, much like a cron job.
703
+ *
704
+ * More details here https://developers.cloudflare.com/workers/platform/cron-triggers
705
+ *
706
+ * @default `{crons:[]}`
707
+ * @inheritable
708
+ */
709
+ triggers: {
710
+ crons: string[];
711
+ };
712
+ /**
713
+ * Specifies the Usage Model for your Worker. There are two options -
714
+ * [bundled](https://developers.cloudflare.com/workers/platform/limits#bundled-usage-model) and
715
+ * [unbound](https://developers.cloudflare.com/workers/platform/limits#unbound-usage-model).
716
+ * For newly created Workers, if the Usage Model is omitted
717
+ * it will be set to the [default Usage Model set on the account](https://dash.cloudflare.com/?account=workers/default-usage-model).
718
+ * For existing Workers, if the Usage Model is omitted, it will be
719
+ * set to the Usage Model configured in the dashboard for that Worker.
720
+ *
721
+ * @inheritable
722
+ */
723
+ usage_model: "bundled" | "unbound" | undefined;
724
+ /**
725
+ * An ordered list of rules that define which modules to import,
726
+ * and what type to import them as. You will need to specify rules
727
+ * to use Text, Data, and CompiledWasm modules, or when you wish to
728
+ * have a .js file be treated as an ESModule instead of CommonJS.
729
+ *
730
+ * @inheritable
731
+ */
732
+ rules: Rule[];
733
+ /**
734
+ * Configures a custom build step to be run by Wrangler when building your Worker.
735
+ *
736
+ * Refer to the [custom builds documentation](https://developers.cloudflare.com/workers/cli-wrangler/configuration#build)
737
+ * for more details.
738
+ *
739
+ * @default {}
740
+ */
741
+ build: {
742
+ /** 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. */
743
+ command?: string;
744
+ /** The directory in which the command is executed. */
745
+ cwd?: string;
746
+ /** The directory to watch for changes while using wrangler dev, defaults to the current working directory */
747
+ watch_dir?: string | string[];
748
+ /**
749
+ * Deprecated field previously used to configure the build and upload of the script.
750
+ * @deprecated
751
+ */
752
+ upload?: DeprecatedUpload;
753
+ };
754
+ /**
755
+ * Skip internal build steps and directly deploy script
756
+ * @inheritable
757
+ */
758
+ no_bundle: boolean | undefined;
759
+ /**
760
+ * Minify the script before uploading.
761
+ * @inheritable
762
+ */
763
+ minify: boolean | undefined;
764
+ /**
765
+ * Add polyfills for node builtin modules and globals
766
+ * @inheritable
767
+ */
768
+ node_compat: boolean | undefined;
769
+ /**
770
+ * Specifies namespace bindings that are bound to this Worker environment.
771
+ *
772
+ * NOTE: This field is not automatically inherited from the top level environment,
773
+ * and so must be specified in every named environment.
774
+ *
775
+ * @default `[]`
776
+ * @nonInheritable
777
+ */
778
+ dispatch_namespaces: {
779
+ /** The binding name used to refer to the bound service. */
780
+ binding: string;
781
+ /** The namespace to bind to. */
782
+ namespace: string;
783
+ /** Details about the outbound worker which will handle outbound requests from your namespace */
784
+ outbound?: DispatchNamespaceOutbound;
785
+ }[];
786
+ /**
787
+ * Designates this worker as an internal-only "first-party" worker.
788
+ */
789
+ first_party_worker: boolean | undefined;
790
+ /**
791
+ * TODO: remove this as it has been deprecated.
792
+ *
793
+ * This is just here for now because the `route` commands use it.
794
+ * So we need to include it in this type so it is available.
795
+ */
796
+ zone_id?: string;
797
+ /**
798
+ * List of bindings that you will send to logfwdr
799
+ *
800
+ * @default `{bindings:[]}`
801
+ * @inheritable
802
+ */
803
+ logfwdr: {
804
+ bindings: {
805
+ /** The binding name used to refer to logfwdr */
806
+ name: string;
807
+ /** The destination for this logged message */
808
+ destination: string;
809
+ }[];
810
+ };
811
+ /**
812
+ * Send Trace Events from this worker to Workers Logpush.
813
+ *
814
+ * This will not configure a corresponding Logpush job automatically.
815
+ *
816
+ * For more information about Workers Logpush, see:
817
+ * https://blog.cloudflare.com/logpush-for-workers/
818
+ *
819
+ * @inheritable
820
+ */
821
+ logpush: boolean | undefined;
822
+ /**
823
+ * Specify how the worker should be located to minimize round-trip time.
824
+ *
825
+ * More details: https://developers.cloudflare.com/workers/platform/smart-placement/
826
+ */
827
+ placement: {
828
+ mode: "off" | "smart";
829
+ } | undefined;
830
+ }
831
+
832
+ /**
833
+ * The `EnvironmentNonInheritable` interface declares all the configuration fields for an environment
834
+ * that cannot be inherited from the top-level environment, and must be defined specifically.
835
+ *
836
+ * If any of these fields are defined at the top-level then they should also be specifically defined
837
+ * for each named environment.
838
+ */
839
+ declare interface EnvironmentNonInheritable {
840
+ /**
841
+ * A map of values to substitute when deploying your worker.
842
+ *
843
+ * NOTE: This field is not automatically inherited from the top level environment,
844
+ * and so must be specified in every named environment.
845
+ *
846
+ * @default `{}`
847
+ * @nonInheritable
848
+ */
849
+ define: Record<string, string>;
850
+ /**
851
+ * A map of environment variables to set when deploying your worker.
852
+ *
853
+ * NOTE: This field is not automatically inherited from the top level environment,
854
+ * and so must be specified in every named environment.
855
+ *
856
+ * @default `{}`
857
+ * @nonInheritable
858
+ */
859
+ vars: Record<string, string | Json>;
860
+ /**
861
+ * A list of durable objects that your worker should be bound to.
862
+ *
863
+ * For more information about Durable Objects, see the documentation at
864
+ * https://developers.cloudflare.com/workers/learning/using-durable-objects
865
+ *
866
+ * NOTE: This field is not automatically inherited from the top level environment,
867
+ * and so must be specified in every named environment.
868
+ *
869
+ * @default `{bindings:[]}`
870
+ * @nonInheritable
871
+ */
872
+ durable_objects: {
873
+ bindings: DurableObjectBindings;
874
+ };
875
+ /**
876
+ * These specify any Workers KV Namespaces you want to
877
+ * access from inside your Worker.
878
+ *
879
+ * To learn more about KV Namespaces,
880
+ * see the documentation at https://developers.cloudflare.com/workers/learning/how-kv-works
881
+ *
882
+ * NOTE: This field is not automatically inherited from the top level environment,
883
+ * and so must be specified in every named environment.
884
+ *
885
+ * @default `[]`
886
+ * @nonInheritable
887
+ */
888
+ kv_namespaces: {
889
+ /** The binding name used to refer to the KV Namespace */
890
+ binding: string;
891
+ /** The ID of the KV namespace */
892
+ id: string;
893
+ /** The ID of the KV namespace used during `wrangler dev` */
894
+ preview_id?: string;
895
+ }[];
896
+ /**
897
+ * These specify bindings to send email from inside your Worker.
898
+ *
899
+ * NOTE: This field is not automatically inherited from the top level environment,
900
+ * and so must be specified in every named environment.
901
+ *
902
+ * @default `[]`
903
+ * @nonInheritable
904
+ */
905
+ send_email: {
906
+ /** The binding name used to refer to the this binding */
907
+ name: string;
908
+ /** If this binding should be restricted to a specific verified address */
909
+ destination_address?: string;
910
+ /** If this binding should be restricted to a set of verified addresses */
911
+ allowed_destination_addresses?: string[];
912
+ }[];
913
+ /**
914
+ * Specifies Queues that are bound to this Worker environment.
915
+ *
916
+ * NOTE: This field is not automatically inherited from the top level environment,
917
+ * and so must be specified in every named environment.
918
+ *
919
+ * @default `{}`
920
+ * @nonInheritable
921
+ */
922
+ queues: {
923
+ /** Producer bindings */
924
+ producers?: {
925
+ /** The binding name used to refer to the Queue in the worker. */
926
+ binding: string;
927
+ /** The name of this Queue. */
928
+ queue: string;
929
+ }[];
930
+ /** Consumer configuration */
931
+ consumers?: {
932
+ /** The name of the queue from which this script should consume. */
933
+ queue: string;
934
+ /** The maximum number of messages per batch */
935
+ max_batch_size?: number;
936
+ /** The maximum number of seconds to wait to fill a batch with messages. */
937
+ max_batch_timeout?: number;
938
+ /** The maximum number of retries for each message. */
939
+ max_retries?: number;
940
+ /** The queue to send messages that failed to be consumed. */
941
+ dead_letter_queue?: string;
942
+ /** 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. */
943
+ max_concurrency?: number | null;
944
+ }[];
945
+ };
946
+ /**
947
+ * Specifies R2 buckets that are bound to this Worker environment.
948
+ *
949
+ * NOTE: This field is not automatically inherited from the top level environment,
950
+ * and so must be specified in every named environment.
951
+ *
952
+ * @default `[]`
953
+ * @nonInheritable
954
+ */
955
+ r2_buckets: {
956
+ /** The binding name used to refer to the R2 bucket in the worker. */
957
+ binding: string;
958
+ /** The name of this R2 bucket at the edge. */
959
+ bucket_name: string;
960
+ /** The preview name of this R2 bucket at the edge. */
961
+ preview_bucket_name?: string;
962
+ }[];
963
+ /**
964
+ * Specifies D1 databases that are bound to this Worker environment.
965
+ *
966
+ * NOTE: This field is not automatically inherited from the top level environment,
967
+ * and so must be specified in every named environment.
968
+ *
969
+ * @default `[]`
970
+ * @nonInheritable
971
+ */
972
+ d1_databases: {
973
+ /** The binding name used to refer to the D1 database in the worker. */
974
+ binding: string;
975
+ /** The name of this D1 database. */
976
+ database_name: string;
977
+ /** The UUID of this D1 database (not required). */
978
+ database_id: string;
979
+ /** The UUID of this D1 database for Wrangler Dev (if specified). */
980
+ preview_database_id?: string;
981
+ /** The name of the migrations table for this D1 database (defaults to 'd1_migrations'). */
982
+ migrations_table?: string;
983
+ /** The path to the directory of migrations for this D1 database (defaults to './migrations'). */
984
+ migrations_dir?: string;
985
+ /** Internal use only. */
986
+ database_internal_env?: string;
987
+ }[];
988
+ /**
989
+ * Specifies Constellation projects that are bound to this Worker environment.
990
+ *
991
+ * NOTE: This field is not automatically inherited from the top level environment,
992
+ * and so must be specified in every named environment.
993
+ *
994
+ * @default `[]`
995
+ * @nonInheritable
996
+ */
997
+ constellation: {
998
+ /** The binding name used to refer to the project in the worker. */
999
+ binding: string;
1000
+ /** The id of the project. */
1001
+ project_id: string;
1002
+ }[];
1003
+ /**
1004
+ * Specifies service bindings (worker-to-worker) that are bound to this Worker environment.
1005
+ *
1006
+ * NOTE: This field is not automatically inherited from the top level environment,
1007
+ * and so must be specified in every named environment.
1008
+ *
1009
+ * @default `[]`
1010
+ * @nonInheritable
1011
+ */
1012
+ services: {
1013
+ /** The binding name used to refer to the bound service. */
1014
+ binding: string;
1015
+ /** The name of the service. */
1016
+ service: string;
1017
+ /** The environment of the service (e.g. production, staging, etc). */
1018
+ environment?: string;
1019
+ }[] | undefined;
1020
+ /**
1021
+ * Specifies analytics engine datasets that are bound to this Worker environment.
1022
+ *
1023
+ * NOTE: This field is not automatically inherited from the top level environment,
1024
+ * and so must be specified in every named environment.
1025
+ *
1026
+ * @default `[]`
1027
+ * @nonInheritable
1028
+ */
1029
+ analytics_engine_datasets: {
1030
+ /** The binding name used to refer to the dataset in the worker. */
1031
+ binding: string;
1032
+ /** The name of this dataset to write to. */
1033
+ dataset?: string;
1034
+ }[];
1035
+ /**
1036
+ * A browser that will be usable from the worker.
1037
+ */
1038
+ browser: {
1039
+ binding: string;
1040
+ } | undefined;
1041
+ /**
1042
+ * "Unsafe" tables for features that aren't directly supported by wrangler.
1043
+ *
1044
+ * NOTE: This field is not automatically inherited from the top level environment,
1045
+ * and so must be specified in every named environment.
1046
+ *
1047
+ * @nonInheritable
1048
+ */
1049
+ unsafe: {
1050
+ /**
1051
+ * A set of bindings that should be put into a Worker's upload metadata without changes. These
1052
+ * can be used to implement bindings for features that haven't released and aren't supported
1053
+ * directly by wrangler or miniflare.
1054
+ */
1055
+ bindings?: {
1056
+ name: string;
1057
+ type: string;
1058
+ [key: string]: unknown;
1059
+ }[];
1060
+ /**
1061
+ * Arbitrary key/value pairs that will be included in the uploaded metadata. Values specified
1062
+ * here will always be applied to metadata last, so can add new or override existing fields.
1063
+ */
1064
+ metadata?: {
1065
+ [key: string]: string;
1066
+ };
1067
+ /**
1068
+ * Used for internal capnp uploads for the Workers runtime
1069
+ */
1070
+ capnp?: {
1071
+ base_path: string;
1072
+ source_schemas: string[];
1073
+ compiled_schema?: never;
1074
+ } | {
1075
+ base_path?: never;
1076
+ source_schemas?: never;
1077
+ compiled_schema: string;
1078
+ };
1079
+ };
1080
+ mtls_certificates: {
1081
+ /** The binding name used to refer to the certificate in the worker */
1082
+ binding: string;
1083
+ /** The uuid of the uploaded mTLS certificate */
1084
+ certificate_id: string;
1085
+ }[];
1086
+ tail_consumers?: TailConsumer[];
1087
+ }
1088
+
1089
+ declare namespace Errors {
1090
+ class UndiciError extends Error { }
1091
+
1092
+ /** Connect timeout error. */
1093
+ class ConnectTimeoutError extends UndiciError {
1094
+ name: 'ConnectTimeoutError';
1095
+ code: 'UND_ERR_CONNECT_TIMEOUT';
1096
+ }
1097
+
1098
+ /** A header exceeds the `headersTimeout` option. */
1099
+ class HeadersTimeoutError extends UndiciError {
1100
+ name: 'HeadersTimeoutError';
1101
+ code: 'UND_ERR_HEADERS_TIMEOUT';
1102
+ }
1103
+
1104
+ /** Headers overflow error. */
1105
+ class HeadersOverflowError extends UndiciError {
1106
+ name: 'HeadersOverflowError'
1107
+ code: 'UND_ERR_HEADERS_OVERFLOW'
1108
+ }
1109
+
1110
+ /** A body exceeds the `bodyTimeout` option. */
1111
+ class BodyTimeoutError extends UndiciError {
1112
+ name: 'BodyTimeoutError';
1113
+ code: 'UND_ERR_BODY_TIMEOUT';
1114
+ }
1115
+
1116
+ class ResponseStatusCodeError extends UndiciError {
1117
+ name: 'ResponseStatusCodeError';
1118
+ code: 'UND_ERR_RESPONSE_STATUS_CODE';
1119
+ body: null | Record<string, any> | string
1120
+ status: number
1121
+ statusCode: number
1122
+ headers: IncomingHttpHeaders | string[] | null;
1123
+ }
1124
+
1125
+ /** Passed an invalid argument. */
1126
+ class InvalidArgumentError extends UndiciError {
1127
+ name: 'InvalidArgumentError';
1128
+ code: 'UND_ERR_INVALID_ARG';
1129
+ }
1130
+
1131
+ /** Returned an invalid value. */
1132
+ class InvalidReturnValueError extends UndiciError {
1133
+ name: 'InvalidReturnValueError';
1134
+ code: 'UND_ERR_INVALID_RETURN_VALUE';
1135
+ }
1136
+
1137
+ /** The request has been aborted by the user. */
1138
+ class RequestAbortedError extends UndiciError {
1139
+ name: 'AbortError';
1140
+ code: 'UND_ERR_ABORTED';
1141
+ }
1142
+
1143
+ /** Expected error with reason. */
1144
+ class InformationalError extends UndiciError {
1145
+ name: 'InformationalError';
1146
+ code: 'UND_ERR_INFO';
1147
+ }
1148
+
1149
+ /** Request body length does not match content-length header. */
1150
+ class RequestContentLengthMismatchError extends UndiciError {
1151
+ name: 'RequestContentLengthMismatchError';
1152
+ code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH';
1153
+ }
1154
+
1155
+ /** Response body length does not match content-length header. */
1156
+ class ResponseContentLengthMismatchError extends UndiciError {
1157
+ name: 'ResponseContentLengthMismatchError';
1158
+ code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH';
1159
+ }
1160
+
1161
+ /** Trying to use a destroyed client. */
1162
+ class ClientDestroyedError extends UndiciError {
1163
+ name: 'ClientDestroyedError';
1164
+ code: 'UND_ERR_DESTROYED';
1165
+ }
1166
+
1167
+ /** Trying to use a closed client. */
1168
+ class ClientClosedError extends UndiciError {
1169
+ name: 'ClientClosedError';
1170
+ code: 'UND_ERR_CLOSED';
1171
+ }
1172
+
1173
+ /** There is an error with the socket. */
1174
+ class SocketError extends UndiciError {
1175
+ name: 'SocketError';
1176
+ code: 'UND_ERR_SOCKET';
1177
+ socket: Client.SocketInfo | null
1178
+ }
1179
+
1180
+ /** Encountered unsupported functionality. */
1181
+ class NotSupportedError extends UndiciError {
1182
+ name: 'NotSupportedError';
1183
+ code: 'UND_ERR_NOT_SUPPORTED';
1184
+ }
1185
+
1186
+ /** No upstream has been added to the BalancedPool. */
1187
+ class BalancedPoolMissingUpstreamError extends UndiciError {
1188
+ name: 'MissingUpstreamError';
1189
+ code: 'UND_ERR_BPL_MISSING_UPSTREAM';
1190
+ }
1191
+
1192
+ class HTTPParserError extends UndiciError {
1193
+ name: 'HTTPParserError';
1194
+ code: string;
1195
+ }
1196
+
1197
+ /** The response exceed the length allowed. */
1198
+ class ResponseExceededMaxSizeError extends UndiciError {
1199
+ name: 'ResponseExceededMaxSizeError';
1200
+ code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE';
1201
+ }
1202
+ }
1203
+
1204
+ declare class File_2 extends Blob_2 {
1205
+ /**
1206
+ * Creates a new File instance.
1207
+ *
1208
+ * @param fileBits An `Array` strings, or [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), [`ArrayBufferView`](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView), [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) objects, or a mix of any of such objects, that will be put inside the [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File).
1209
+ * @param fileName The name of the file.
1210
+ * @param options An options object containing optional attributes for the file.
1211
+ */
1212
+ constructor(fileBits: ReadonlyArray<string | NodeJS.ArrayBufferView | Blob_2>, fileName: string, options?: FilePropertyBag)
1213
+
1214
+ /**
1215
+ * Name of the file referenced by the File object.
1216
+ */
1217
+ readonly name: string
1218
+
1219
+ /**
1220
+ * The last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date.
1221
+ */
1222
+ readonly lastModified: number
1223
+
1224
+ readonly [Symbol.toStringTag]: string
1225
+ }
1226
+
1227
+ declare interface FilePropertyBag extends BlobPropertyBag {
1228
+ /**
1229
+ * The last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date.
1230
+ */
1231
+ lastModified?: number
1232
+ }
1233
+
1234
+ /**
1235
+ * 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().
1236
+ */
1237
+ declare class FormData_2 {
1238
+ /**
1239
+ * Appends a new value onto an existing key inside a FormData object,
1240
+ * or adds the key if it does not already exist.
1241
+ *
1242
+ * The difference between `set()` and `append()` is that if the specified key already exists, `set()` will overwrite all existing values with the new one, whereas `append()` will append the new value onto the end of the existing set of values.
1243
+ *
1244
+ * @param name The name of the field whose data is contained in `value`.
1245
+ * @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
1246
+ or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string.
1247
+ * @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.
1248
+ */
1249
+ append(name: string, value: unknown, fileName?: string): void
1250
+
1251
+ /**
1252
+ * Set a new value for an existing key inside FormData,
1253
+ * or add the new field if it does not already exist.
1254
+ *
1255
+ * @param name The name of the field whose data is contained in `value`.
1256
+ * @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
1257
+ or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string.
1258
+ * @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.
1259
+ *
1260
+ */
1261
+ set(name: string, value: unknown, fileName?: string): void
1262
+
1263
+ /**
1264
+ * Returns the first value associated with a given key from within a `FormData` object.
1265
+ * If you expect multiple values and want all of them, use the `getAll()` method instead.
1266
+ *
1267
+ * @param {string} name A name of the value you want to retrieve.
1268
+ *
1269
+ * @returns A `FormDataEntryValue` containing the value. If the key doesn't exist, the method returns null.
1270
+ */
1271
+ get(name: string): FormDataEntryValue | null
1272
+
1273
+ /**
1274
+ * Returns all the values associated with a given key from within a `FormData` object.
1275
+ *
1276
+ * @param {string} name A name of the value you want to retrieve.
1277
+ *
1278
+ * @returns An array of `FormDataEntryValue` whose key matches the value passed in the `name` parameter. If the key doesn't exist, the method returns an empty list.
1279
+ */
1280
+ getAll(name: string): FormDataEntryValue[]
1281
+
1282
+ /**
1283
+ * Returns a boolean stating whether a `FormData` object contains a certain key.
1284
+ *
1285
+ * @param name A string representing the name of the key you want to test for.
1286
+ *
1287
+ * @return A boolean value.
1288
+ */
1289
+ has(name: string): boolean
1290
+
1291
+ /**
1292
+ * Deletes a key and its value(s) from a `FormData` object.
1293
+ *
1294
+ * @param name The name of the key you want to delete.
1295
+ */
1296
+ delete(name: string): void
1297
+
1298
+ /**
1299
+ * Executes given callback function for each field of the FormData instance
1300
+ */
1301
+ forEach: (
1302
+ callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData_2) => void,
1303
+ thisArg?: unknown
1304
+ ) => void
1305
+
1306
+ /**
1307
+ * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all keys contained in this `FormData` object.
1308
+ * Each key is a `string`.
1309
+ */
1310
+ keys: () => SpecIterableIterator<string>
1311
+
1312
+ /**
1313
+ * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all values contained in this object `FormData` object.
1314
+ * Each value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
1315
+ */
1316
+ values: () => SpecIterableIterator<FormDataEntryValue>
1317
+
1318
+ /**
1319
+ * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through the `FormData` key/value pairs.
1320
+ * The key of each pair is a string; the value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
1321
+ */
1322
+ entries: () => SpecIterableIterator<[string, FormDataEntryValue]>
1323
+
1324
+ /**
1325
+ * An alias for FormData#entries()
1326
+ */
1327
+ [Symbol.iterator]: () => SpecIterableIterator<[string, FormDataEntryValue]>
1328
+
1329
+ readonly [Symbol.toStringTag]: string
1330
+ }
1331
+
1332
+ /**
1333
+ * A `string` or `File` that represents a single value from a set of `FormData` key-value pairs.
1334
+ */
1335
+ declare type FormDataEntryValue = string | File_2
1336
+
1337
+ /**
1338
+ * fetches an mTLS certificate from the account mTLS certificate store by ID
1339
+ */
1340
+ export declare function getMTlsCertificate(accountId: string, id: string): Promise<MTlsCertificateResponse>;
1341
+
1342
+ /**
1343
+ * fetches an mTLS certificate from the account mTLS certificate store by name. will throw an error if no certificates are found, or multiple are found with that name
1344
+ */
1345
+ export declare function getMTlsCertificateByName(accountId: string, name: string): Promise<MTlsCertificateResponse>;
1346
+
1347
+ declare class Headers_2 implements SpecIterable<[string, string]> {
1348
+ constructor (init?: HeadersInit_2)
1349
+ readonly append: (name: string, value: string) => void
1350
+ readonly delete: (name: string) => void
1351
+ readonly get: (name: string) => string | null
1352
+ readonly has: (name: string) => boolean
1353
+ readonly set: (name: string, value: string) => void
1354
+ readonly getSetCookie: () => string[]
1355
+ readonly forEach: (
1356
+ callbackfn: (value: string, key: string, iterable: Headers_2) => void,
1357
+ thisArg?: unknown
1358
+ ) => void
1359
+
1360
+ readonly keys: () => SpecIterableIterator<string>
1361
+ readonly values: () => SpecIterableIterator<string>
1362
+ readonly entries: () => SpecIterableIterator<[string, string]>
1363
+ readonly [Symbol.iterator]: () => SpecIterator<[string, string]>
1364
+ }
1365
+
1366
+ declare type HeadersInit_2 = string[][] | Record<string, string | ReadonlyArray<string>> | Headers_2
1367
+
1368
+ /**
1369
+ * The header type declaration of `undici`.
1370
+ */
1371
+ declare type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
1372
+
1373
+ /**
1374
+ * lists mTLS certificates for an account. filtering by name is supported
1375
+ */
1376
+ export declare function listMTlsCertificates(accountId: string, filter: MTlsCertificateListFilter): Promise<MTlsCertificateResponse[]>;
1377
+
1378
+ /**
1379
+ * details for uploading an mTLS certificate via the ssl api
1380
+ */
1381
+ declare interface MTlsCertificateBody {
1382
+ certificateChain: string;
1383
+ privateKey: string;
1384
+ name?: string;
1385
+ }
1386
+
1387
+ /**
1388
+ * supported filters for listing mTLS certificates via the ssl api
1389
+ */
1390
+ declare interface MTlsCertificateListFilter {
1391
+ name?: string;
1392
+ }
1393
+
1394
+ /**
1395
+ * the representation of an mTLS certificate in the account certificate store
1396
+ */
1397
+ declare interface MTlsCertificateResponse {
1398
+ id: string;
1399
+ name?: string;
1400
+ ca: boolean;
1401
+ certificates: string;
1402
+ expires_on: string;
1403
+ issuer: string;
1404
+ serial_number: string;
1405
+ signature: string;
1406
+ uploaded_on: string;
1407
+ }
1408
+
1409
+ /**
1410
+ * details for uploading an mTLS certificate from disk
1411
+ */
1412
+ declare interface MTlsCertificateUploadDetails {
1413
+ certificateChainFilename: string;
1414
+ privateKeyFilename: string;
1415
+ name?: string;
1416
+ }
1417
+
1418
+ declare interface PagesDeployOptions {
1419
+ /**
1420
+ * Path to static assets to deploy to Pages
1421
+ */
1422
+ directory: string;
1423
+ /**
1424
+ * The Cloudflare Account ID that owns the project that's
1425
+ * being published
1426
+ */
1427
+ accountId: string;
1428
+ /**
1429
+ * The name of the project to be published
1430
+ */
1431
+ projectName: string;
1432
+ /**
1433
+ * Branch name to use. Defaults to production branch
1434
+ */
1435
+ branch?: string;
1436
+ /**
1437
+ * Whether or not to skip local file upload result caching
1438
+ */
1439
+ skipCaching?: boolean;
1440
+ /**
1441
+ * Commit message associated to deployment
1442
+ */
1443
+ commitMessage?: string;
1444
+ /**
1445
+ * Commit hash associated to deployment
1446
+ */
1447
+ commitHash?: string;
1448
+ /**
1449
+ * Whether or not the deployment should be considered to be
1450
+ * in a dirty commit state
1451
+ */
1452
+ commitDirty?: boolean;
1453
+ /**
1454
+ * Path to the project's functions directory. Default uses
1455
+ * the current working directory + /functions since this is
1456
+ * typically called in a CLI
1457
+ */
1458
+ functionsDirectory?: string;
1459
+ /**
1460
+ * Whether to run bundling on `_worker.js` before deploying.
1461
+ * Default: true
1462
+ */
1463
+ bundle?: boolean;
1464
+ }
1465
+
1466
+ declare type ReferrerPolicy =
1467
+ | ''
1468
+ | 'no-referrer'
1469
+ | 'no-referrer-when-downgrade'
1470
+ | 'origin'
1471
+ | 'origin-when-cross-origin'
1472
+ | 'same-origin'
1473
+ | 'strict-origin'
1474
+ | 'strict-origin-when-cross-origin'
1475
+ | 'unsafe-url';
1476
+
1477
+ declare class Request_2 implements BodyMixin {
1478
+ constructor (input: RequestInfo_2, init?: RequestInit_2)
1479
+
1480
+ readonly cache: RequestCache
1481
+ readonly credentials: RequestCredentials
1482
+ readonly destination: RequestDestination
1483
+ readonly headers: Headers_2
1484
+ readonly integrity: string
1485
+ readonly method: string
1486
+ readonly mode: RequestMode
1487
+ readonly redirect: RequestRedirect
1488
+ readonly referrerPolicy: string
1489
+ readonly url: string
1490
+
1491
+ readonly keepalive: boolean
1492
+ readonly signal: AbortSignal
1493
+ readonly duplex: RequestDuplex
1494
+
1495
+ readonly body: ReadableStream_2 | null
1496
+ readonly bodyUsed: boolean
1497
+
1498
+ readonly arrayBuffer: () => Promise<ArrayBuffer>
1499
+ readonly blob: () => Promise<Blob_2>
1500
+ readonly formData: () => Promise<FormData_2>
1501
+ readonly json: () => Promise<unknown>
1502
+ readonly text: () => Promise<string>
1503
+
1504
+ readonly clone: () => Request_2
1505
+ }
1506
+
1507
+ declare type RequestCache =
1508
+ | 'default'
1509
+ | 'force-cache'
1510
+ | 'no-cache'
1511
+ | 'no-store'
1512
+ | 'only-if-cached'
1513
+ | 'reload'
1514
+
1515
+ declare type RequestCredentials = 'omit' | 'include' | 'same-origin'
1516
+
1517
+ declare type RequestDestination =
1518
+ | ''
1519
+ | 'audio'
1520
+ | 'audioworklet'
1521
+ | 'document'
1522
+ | 'embed'
1523
+ | 'font'
1524
+ | 'image'
1525
+ | 'manifest'
1526
+ | 'object'
1527
+ | 'paintworklet'
1528
+ | 'report'
1529
+ | 'script'
1530
+ | 'sharedworker'
1531
+ | 'style'
1532
+ | 'track'
1533
+ | 'video'
1534
+ | 'worker'
1535
+ | 'xslt'
1536
+
1537
+ declare type RequestDuplex = 'half'
1538
+
1539
+ declare type RequestInfo_2 = string | URL_2 | Request_2
1540
+
1541
+ declare interface RequestInit_2 {
1542
+ method?: string
1543
+ keepalive?: boolean
1544
+ headers?: HeadersInit_2
1545
+ body?: BodyInit_2
1546
+ redirect?: RequestRedirect
1547
+ integrity?: string
1548
+ signal?: AbortSignal
1549
+ credentials?: RequestCredentials
1550
+ mode?: RequestMode
1551
+ referrer?: string
1552
+ referrerPolicy?: ReferrerPolicy
1553
+ window?: null
1554
+ dispatcher?: Dispatcher
1555
+ duplex?: RequestDuplex
1556
+ }
1557
+
1558
+ declare type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin'
1559
+
1560
+ declare type RequestRedirect = 'error' | 'follow' | 'manual'
1561
+
1562
+ declare class Response_2 implements BodyMixin {
1563
+ constructor (body?: BodyInit_2, init?: ResponseInit_2)
1564
+
1565
+ readonly headers: Headers_2
1566
+ readonly ok: boolean
1567
+ readonly status: number
1568
+ readonly statusText: string
1569
+ readonly type: ResponseType
1570
+ readonly url: string
1571
+ readonly redirected: boolean
1572
+
1573
+ readonly body: ReadableStream_2 | null
1574
+ readonly bodyUsed: boolean
1575
+
1576
+ readonly arrayBuffer: () => Promise<ArrayBuffer>
1577
+ readonly blob: () => Promise<Blob_2>
1578
+ readonly formData: () => Promise<FormData_2>
1579
+ readonly json: () => Promise<unknown>
1580
+ readonly text: () => Promise<string>
1581
+
1582
+ readonly clone: () => Response_2
1583
+
1584
+ static error (): Response_2
1585
+ static json(data: any, init?: ResponseInit_2): Response_2
1586
+ static redirect (url: string | URL_2, status: ResponseRedirectStatus): Response_2
1587
+ }
1588
+
1589
+ declare interface ResponseInit_2 {
1590
+ readonly status?: number
1591
+ readonly statusText?: string
1592
+ readonly headers?: HeadersInit_2
1593
+ }
1594
+
1595
+ declare type ResponseRedirectStatus = 301 | 302 | 303 | 307 | 308
1596
+
1597
+ declare type ResponseType =
1598
+ | 'basic'
1599
+ | 'cors'
1600
+ | 'default'
1601
+ | 'error'
1602
+ | 'opaque'
1603
+ | 'opaqueredirect'
1604
+
1605
+ declare type Route = SimpleRoute | ZoneIdRoute | ZoneNameRoute | CustomDomainRoute;
1606
+
1607
+ /**
1608
+ * A bundling resolver rule, defining the modules type for paths that match the specified globs.
1609
+ */
1610
+ declare type Rule = {
1611
+ type: ConfigModuleRuleType;
1612
+ globs: string[];
1613
+ fallthrough?: boolean;
1614
+ };
1615
+
1616
+ declare type SimpleRoute = string;
1617
+
1618
+ declare interface SpecIterable<T> {
1619
+ [Symbol.iterator](): SpecIterator<T>;
1620
+ }
1621
+
1622
+ declare interface SpecIterableIterator<T> extends SpecIterator<T> {
1623
+ [Symbol.iterator](): SpecIterableIterator<T>;
1624
+ }
1625
+
1626
+ declare interface SpecIterator<T, TReturn = any, TNext = undefined> {
1627
+ next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
1628
+ }
1629
+
1630
+ declare type TailConsumer = {
1631
+ /** The name of the service tail events will be forwarded to. */
1632
+ service: string;
1633
+ /** (Optional) The environt of the service. */
1634
+ environment?: string;
1635
+ };
1636
+
1637
+ /**
1638
+ * unstable_dev starts a wrangler dev server, and returns a promise that resolves with utility functions to interact with it.
1639
+ */
1640
+ export declare function unstable_dev(script: string, options?: UnstableDevOptions, apiOptions?: unknown): Promise<UnstableDevWorker>;
1641
+
1642
+ export declare const unstable_pages: {
1643
+ deploy: typeof deploy;
1644
+ };
1645
+
1646
+ export declare interface UnstableDevOptions {
1647
+ config?: string;
1648
+ env?: string;
1649
+ ip?: string;
1650
+ port?: number;
1651
+ bundle?: boolean;
1652
+ inspectorPort?: number;
1653
+ localProtocol?: "http" | "https";
1654
+ assets?: string;
1655
+ site?: string;
1656
+ siteInclude?: string[];
1657
+ siteExclude?: string[];
1658
+ nodeCompat?: boolean;
1659
+ compatibilityDate?: string;
1660
+ compatibilityFlags?: string[];
1661
+ persist?: boolean;
1662
+ persistTo?: string;
1663
+ vars?: Record<string, string | Json>;
1664
+ kv?: {
1665
+ binding: string;
1666
+ id: string;
1667
+ preview_id?: string;
1668
+ }[];
1669
+ durableObjects?: {
1670
+ name: string;
1671
+ class_name: string;
1672
+ script_name?: string | undefined;
1673
+ environment?: string | undefined;
1674
+ }[];
1675
+ r2?: {
1676
+ binding: string;
1677
+ bucket_name: string;
1678
+ preview_bucket_name?: string;
1679
+ }[];
1680
+ moduleRoot?: string;
1681
+ rules?: Rule[];
1682
+ logLevel?: "none" | "info" | "error" | "log" | "warn" | "debug";
1683
+ inspect?: boolean;
1684
+ local?: boolean;
1685
+ accountId?: string;
1686
+ experimental?: {
1687
+ processEntrypoint?: boolean;
1688
+ additionalModules?: CfModule[];
1689
+ d1Databases?: Environment["d1_databases"];
1690
+ disableExperimentalWarning?: boolean;
1691
+ disableDevRegistry?: boolean;
1692
+ enablePagesAssetsServiceBinding?: EnablePagesAssetsServiceBindingOptions;
1693
+ forceLocal?: boolean;
1694
+ liveReload?: boolean;
1695
+ showInteractiveDevSession?: boolean;
1696
+ testMode?: boolean;
1697
+ testScheduled?: boolean;
1698
+ watch?: boolean;
1699
+ };
1700
+ }
1701
+
1702
+ export declare interface UnstableDevWorker {
1703
+ port: number;
1704
+ address: string;
1705
+ stop: () => Promise<void>;
1706
+ fetch: (input?: RequestInfo_2, init?: RequestInit_2) => Promise<Response_2>;
1707
+ waitUntilExit: () => Promise<void>;
1708
+ }
1709
+
1710
+ /**
1711
+ * uploads an mTLS certificate and private key pair to the account mTLS certificate store
1712
+ */
1713
+ export declare function uploadMTlsCertificate(accountId: string, body: MTlsCertificateBody): Promise<MTlsCertificateResponse>;
1714
+
1715
+ /**
1716
+ * reads an mTLS certificate and private key pair from disk and uploads it to the account mTLS certificate store
1717
+ */
1718
+ export declare function uploadMTlsCertificateFromFs(accountId: string, details: MTlsCertificateUploadDetails): Promise<MTlsCertificateResponse>;
1719
+
1720
+ declare type ZoneIdRoute = {
1721
+ pattern: string;
1722
+ zone_id: string;
1723
+ custom_domain?: boolean;
1724
+ };
1725
+
1726
+ declare type ZoneNameRoute = {
1727
+ pattern: string;
1728
+ zone_name: string;
1729
+ custom_domain?: boolean;
1730
+ };
1731
+
1732
+ export { }