wrangler 0.0.0-e29a241 → 0.0.0-e2a6fa40

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 (166) hide show
  1. package/Cloudflare_CA.pem +18 -0
  2. package/README.md +47 -16
  3. package/bin/wrangler.js +118 -32
  4. package/kv-asset-handler.js +1 -0
  5. package/package.json +138 -83
  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 +3 -3
  29. package/templates/new-worker.ts +22 -4
  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 +6 -103
  39. package/wrangler-dist/cli.d.ts +1734 -0
  40. package/wrangler-dist/cli.js +142808 -133914
  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/miniflare-dist/index.mjs +0 -79
  47. package/miniflare-dist/index.mjs.map +0 -7
  48. package/pages/functions/buildWorker.ts +0 -62
  49. package/pages/functions/filepath-routing.test.ts +0 -223
  50. package/pages/functions/filepath-routing.ts +0 -181
  51. package/pages/functions/identifiers.ts +0 -78
  52. package/pages/functions/routes.ts +0 -151
  53. package/pages/functions/template-worker.ts +0 -130
  54. package/src/__tests__/configuration.test.ts +0 -2754
  55. package/src/__tests__/dev.test.tsx +0 -496
  56. package/src/__tests__/dev2.test.tsx +0 -154
  57. package/src/__tests__/guess-worker-format.test.ts +0 -58
  58. package/src/__tests__/helpers/clipboardy-mock.js +0 -4
  59. package/src/__tests__/helpers/cmd-shim.d.ts +0 -11
  60. package/src/__tests__/helpers/faye-websocket.d.ts +0 -6
  61. package/src/__tests__/helpers/mock-account-id.ts +0 -48
  62. package/src/__tests__/helpers/mock-bin.ts +0 -36
  63. package/src/__tests__/helpers/mock-cfetch.ts +0 -207
  64. package/src/__tests__/helpers/mock-console.ts +0 -70
  65. package/src/__tests__/helpers/mock-dialogs.ts +0 -65
  66. package/src/__tests__/helpers/mock-kv.ts +0 -33
  67. package/src/__tests__/helpers/mock-stdin.ts +0 -103
  68. package/src/__tests__/helpers/mock-web-socket.ts +0 -29
  69. package/src/__tests__/helpers/run-in-tmp.ts +0 -32
  70. package/src/__tests__/helpers/run-wrangler.ts +0 -16
  71. package/src/__tests__/helpers/write-wrangler-toml.ts +0 -17
  72. package/src/__tests__/https-options.test.ts +0 -127
  73. package/src/__tests__/index.test.ts +0 -991
  74. package/src/__tests__/jest.setup.ts +0 -69
  75. package/src/__tests__/kv.test.ts +0 -1382
  76. package/src/__tests__/logout.test.ts +0 -52
  77. package/src/__tests__/package-manager.test.ts +0 -206
  78. package/src/__tests__/pages.test.ts +0 -44
  79. package/src/__tests__/parse.test.ts +0 -322
  80. package/src/__tests__/publish.test.ts +0 -2704
  81. package/src/__tests__/r2.test.ts +0 -198
  82. package/src/__tests__/route.test.ts +0 -45
  83. package/src/__tests__/secret.test.ts +0 -425
  84. package/src/__tests__/sentry.test.ts +0 -146
  85. package/src/__tests__/tail.test.ts +0 -564
  86. package/src/__tests__/whoami.test.tsx +0 -100
  87. package/src/bundle.ts +0 -142
  88. package/src/cfetch/index.ts +0 -104
  89. package/src/cfetch/internal.ts +0 -139
  90. package/src/cli.ts +0 -19
  91. package/src/config/README.md +0 -107
  92. package/src/config/config.ts +0 -274
  93. package/src/config/diagnostics.ts +0 -80
  94. package/src/config/environment.ts +0 -310
  95. package/src/config/index.ts +0 -56
  96. package/src/config/validation-helpers.ts +0 -486
  97. package/src/config/validation.ts +0 -1096
  98. package/src/create-worker-preview.ts +0 -166
  99. package/src/create-worker-upload-form.ts +0 -217
  100. package/src/dev/dev.tsx +0 -364
  101. package/src/dev/local.tsx +0 -226
  102. package/src/dev/remote.tsx +0 -203
  103. package/src/dev/use-esbuild.ts +0 -100
  104. package/src/dialogs.tsx +0 -77
  105. package/src/entry.ts +0 -208
  106. package/src/environment-variables.ts +0 -33
  107. package/src/https-options.ts +0 -122
  108. package/src/index.tsx +0 -2373
  109. package/src/inspect.ts +0 -617
  110. package/src/kv.ts +0 -319
  111. package/src/miniflare-cli/README.md +0 -30
  112. package/src/miniflare-cli/enum-keys.ts +0 -17
  113. package/src/miniflare-cli/index.ts +0 -37
  114. package/src/module-collection.ts +0 -258
  115. package/src/open-in-browser.ts +0 -25
  116. package/src/package-manager.ts +0 -126
  117. package/src/pages.tsx +0 -1045
  118. package/src/parse.ts +0 -183
  119. package/src/paths.ts +0 -26
  120. package/src/proxy.ts +0 -440
  121. package/src/publish.ts +0 -347
  122. package/src/r2.ts +0 -50
  123. package/src/reporting.ts +0 -131
  124. package/src/selfsigned.d.ts +0 -29
  125. package/src/sites.tsx +0 -280
  126. package/src/tail/filters.ts +0 -279
  127. package/src/tail/index.ts +0 -299
  128. package/src/tail/printing.ts +0 -62
  129. package/src/user.tsx +0 -1118
  130. package/src/whoami.tsx +0 -69
  131. package/src/worker.ts +0 -163
  132. package/templates/static-asset-facade.js +0 -47
  133. package/vendor/@cloudflare/kv-asset-handler/CHANGELOG.md +0 -332
  134. package/vendor/@cloudflare/kv-asset-handler/LICENSE_APACHE +0 -176
  135. package/vendor/@cloudflare/kv-asset-handler/LICENSE_MIT +0 -25
  136. package/vendor/@cloudflare/kv-asset-handler/README.md +0 -245
  137. package/vendor/@cloudflare/kv-asset-handler/dist/index.d.ts +0 -32
  138. package/vendor/@cloudflare/kv-asset-handler/dist/index.js +0 -354
  139. package/vendor/@cloudflare/kv-asset-handler/dist/mocks.d.ts +0 -13
  140. package/vendor/@cloudflare/kv-asset-handler/dist/mocks.js +0 -148
  141. package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.d.ts +0 -1
  142. package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.js +0 -436
  143. package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.d.ts +0 -1
  144. package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.js +0 -40
  145. package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.d.ts +0 -1
  146. package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.js +0 -42
  147. package/vendor/@cloudflare/kv-asset-handler/dist/types.d.ts +0 -26
  148. package/vendor/@cloudflare/kv-asset-handler/dist/types.js +0 -31
  149. package/vendor/@cloudflare/kv-asset-handler/package.json +0 -52
  150. package/vendor/@cloudflare/kv-asset-handler/src/index.ts +0 -296
  151. package/vendor/@cloudflare/kv-asset-handler/src/mocks.ts +0 -136
  152. package/vendor/@cloudflare/kv-asset-handler/src/test/getAssetFromKV.ts +0 -464
  153. package/vendor/@cloudflare/kv-asset-handler/src/test/mapRequestToAsset.ts +0 -33
  154. package/vendor/@cloudflare/kv-asset-handler/src/test/serveSinglePageApp.ts +0 -42
  155. package/vendor/@cloudflare/kv-asset-handler/src/types.ts +0 -39
  156. package/vendor/wrangler-mime/CHANGELOG.md +0 -289
  157. package/vendor/wrangler-mime/LICENSE +0 -21
  158. package/vendor/wrangler-mime/Mime.js +0 -97
  159. package/vendor/wrangler-mime/README.md +0 -187
  160. package/vendor/wrangler-mime/cli.js +0 -46
  161. package/vendor/wrangler-mime/index.js +0 -4
  162. package/vendor/wrangler-mime/lite.js +0 -4
  163. package/vendor/wrangler-mime/package.json +0 -52
  164. package/vendor/wrangler-mime/types/other.js +0 -1
  165. package/vendor/wrangler-mime/types/standard.js +0 -1
  166. package/wrangler-dist/cli.js.map +0 -7
@@ -0,0 +1,1734 @@
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
+ /** The jurisdiction that the bucket exists in. Default if not present. */
963
+ jurisdiction?: string;
964
+ }[];
965
+ /**
966
+ * Specifies D1 databases that are bound to this Worker environment.
967
+ *
968
+ * NOTE: This field is not automatically inherited from the top level environment,
969
+ * and so must be specified in every named environment.
970
+ *
971
+ * @default `[]`
972
+ * @nonInheritable
973
+ */
974
+ d1_databases: {
975
+ /** The binding name used to refer to the D1 database in the worker. */
976
+ binding: string;
977
+ /** The name of this D1 database. */
978
+ database_name: string;
979
+ /** The UUID of this D1 database (not required). */
980
+ database_id: string;
981
+ /** The UUID of this D1 database for Wrangler Dev (if specified). */
982
+ preview_database_id?: string;
983
+ /** The name of the migrations table for this D1 database (defaults to 'd1_migrations'). */
984
+ migrations_table?: string;
985
+ /** The path to the directory of migrations for this D1 database (defaults to './migrations'). */
986
+ migrations_dir?: string;
987
+ /** Internal use only. */
988
+ database_internal_env?: string;
989
+ }[];
990
+ /**
991
+ * Specifies Constellation projects that are bound to this Worker environment.
992
+ *
993
+ * NOTE: This field is not automatically inherited from the top level environment,
994
+ * and so must be specified in every named environment.
995
+ *
996
+ * @default `[]`
997
+ * @nonInheritable
998
+ */
999
+ constellation: {
1000
+ /** The binding name used to refer to the project in the worker. */
1001
+ binding: string;
1002
+ /** The id of the project. */
1003
+ project_id: string;
1004
+ }[];
1005
+ /**
1006
+ * Specifies service bindings (worker-to-worker) that are bound to this Worker environment.
1007
+ *
1008
+ * NOTE: This field is not automatically inherited from the top level environment,
1009
+ * and so must be specified in every named environment.
1010
+ *
1011
+ * @default `[]`
1012
+ * @nonInheritable
1013
+ */
1014
+ services: {
1015
+ /** The binding name used to refer to the bound service. */
1016
+ binding: string;
1017
+ /** The name of the service. */
1018
+ service: string;
1019
+ /** The environment of the service (e.g. production, staging, etc). */
1020
+ environment?: string;
1021
+ }[] | undefined;
1022
+ /**
1023
+ * Specifies analytics engine datasets that are bound to this Worker environment.
1024
+ *
1025
+ * NOTE: This field is not automatically inherited from the top level environment,
1026
+ * and so must be specified in every named environment.
1027
+ *
1028
+ * @default `[]`
1029
+ * @nonInheritable
1030
+ */
1031
+ analytics_engine_datasets: {
1032
+ /** The binding name used to refer to the dataset in the worker. */
1033
+ binding: string;
1034
+ /** The name of this dataset to write to. */
1035
+ dataset?: string;
1036
+ }[];
1037
+ /**
1038
+ * A browser that will be usable from the worker.
1039
+ */
1040
+ browser: {
1041
+ binding: string;
1042
+ } | undefined;
1043
+ /**
1044
+ * "Unsafe" tables for features that aren't directly supported by wrangler.
1045
+ *
1046
+ * NOTE: This field is not automatically inherited from the top level environment,
1047
+ * and so must be specified in every named environment.
1048
+ *
1049
+ * @nonInheritable
1050
+ */
1051
+ unsafe: {
1052
+ /**
1053
+ * A set of bindings that should be put into a Worker's upload metadata without changes. These
1054
+ * can be used to implement bindings for features that haven't released and aren't supported
1055
+ * directly by wrangler or miniflare.
1056
+ */
1057
+ bindings?: {
1058
+ name: string;
1059
+ type: string;
1060
+ [key: string]: unknown;
1061
+ }[];
1062
+ /**
1063
+ * Arbitrary key/value pairs that will be included in the uploaded metadata. Values specified
1064
+ * here will always be applied to metadata last, so can add new or override existing fields.
1065
+ */
1066
+ metadata?: {
1067
+ [key: string]: string;
1068
+ };
1069
+ /**
1070
+ * Used for internal capnp uploads for the Workers runtime
1071
+ */
1072
+ capnp?: {
1073
+ base_path: string;
1074
+ source_schemas: string[];
1075
+ compiled_schema?: never;
1076
+ } | {
1077
+ base_path?: never;
1078
+ source_schemas?: never;
1079
+ compiled_schema: string;
1080
+ };
1081
+ };
1082
+ mtls_certificates: {
1083
+ /** The binding name used to refer to the certificate in the worker */
1084
+ binding: string;
1085
+ /** The uuid of the uploaded mTLS certificate */
1086
+ certificate_id: string;
1087
+ }[];
1088
+ tail_consumers?: TailConsumer[];
1089
+ }
1090
+
1091
+ declare namespace Errors {
1092
+ class UndiciError extends Error { }
1093
+
1094
+ /** Connect timeout error. */
1095
+ class ConnectTimeoutError extends UndiciError {
1096
+ name: 'ConnectTimeoutError';
1097
+ code: 'UND_ERR_CONNECT_TIMEOUT';
1098
+ }
1099
+
1100
+ /** A header exceeds the `headersTimeout` option. */
1101
+ class HeadersTimeoutError extends UndiciError {
1102
+ name: 'HeadersTimeoutError';
1103
+ code: 'UND_ERR_HEADERS_TIMEOUT';
1104
+ }
1105
+
1106
+ /** Headers overflow error. */
1107
+ class HeadersOverflowError extends UndiciError {
1108
+ name: 'HeadersOverflowError'
1109
+ code: 'UND_ERR_HEADERS_OVERFLOW'
1110
+ }
1111
+
1112
+ /** A body exceeds the `bodyTimeout` option. */
1113
+ class BodyTimeoutError extends UndiciError {
1114
+ name: 'BodyTimeoutError';
1115
+ code: 'UND_ERR_BODY_TIMEOUT';
1116
+ }
1117
+
1118
+ class ResponseStatusCodeError extends UndiciError {
1119
+ name: 'ResponseStatusCodeError';
1120
+ code: 'UND_ERR_RESPONSE_STATUS_CODE';
1121
+ body: null | Record<string, any> | string
1122
+ status: number
1123
+ statusCode: number
1124
+ headers: IncomingHttpHeaders | string[] | null;
1125
+ }
1126
+
1127
+ /** Passed an invalid argument. */
1128
+ class InvalidArgumentError extends UndiciError {
1129
+ name: 'InvalidArgumentError';
1130
+ code: 'UND_ERR_INVALID_ARG';
1131
+ }
1132
+
1133
+ /** Returned an invalid value. */
1134
+ class InvalidReturnValueError extends UndiciError {
1135
+ name: 'InvalidReturnValueError';
1136
+ code: 'UND_ERR_INVALID_RETURN_VALUE';
1137
+ }
1138
+
1139
+ /** The request has been aborted by the user. */
1140
+ class RequestAbortedError extends UndiciError {
1141
+ name: 'AbortError';
1142
+ code: 'UND_ERR_ABORTED';
1143
+ }
1144
+
1145
+ /** Expected error with reason. */
1146
+ class InformationalError extends UndiciError {
1147
+ name: 'InformationalError';
1148
+ code: 'UND_ERR_INFO';
1149
+ }
1150
+
1151
+ /** Request body length does not match content-length header. */
1152
+ class RequestContentLengthMismatchError extends UndiciError {
1153
+ name: 'RequestContentLengthMismatchError';
1154
+ code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH';
1155
+ }
1156
+
1157
+ /** Response body length does not match content-length header. */
1158
+ class ResponseContentLengthMismatchError extends UndiciError {
1159
+ name: 'ResponseContentLengthMismatchError';
1160
+ code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH';
1161
+ }
1162
+
1163
+ /** Trying to use a destroyed client. */
1164
+ class ClientDestroyedError extends UndiciError {
1165
+ name: 'ClientDestroyedError';
1166
+ code: 'UND_ERR_DESTROYED';
1167
+ }
1168
+
1169
+ /** Trying to use a closed client. */
1170
+ class ClientClosedError extends UndiciError {
1171
+ name: 'ClientClosedError';
1172
+ code: 'UND_ERR_CLOSED';
1173
+ }
1174
+
1175
+ /** There is an error with the socket. */
1176
+ class SocketError extends UndiciError {
1177
+ name: 'SocketError';
1178
+ code: 'UND_ERR_SOCKET';
1179
+ socket: Client.SocketInfo | null
1180
+ }
1181
+
1182
+ /** Encountered unsupported functionality. */
1183
+ class NotSupportedError extends UndiciError {
1184
+ name: 'NotSupportedError';
1185
+ code: 'UND_ERR_NOT_SUPPORTED';
1186
+ }
1187
+
1188
+ /** No upstream has been added to the BalancedPool. */
1189
+ class BalancedPoolMissingUpstreamError extends UndiciError {
1190
+ name: 'MissingUpstreamError';
1191
+ code: 'UND_ERR_BPL_MISSING_UPSTREAM';
1192
+ }
1193
+
1194
+ class HTTPParserError extends UndiciError {
1195
+ name: 'HTTPParserError';
1196
+ code: string;
1197
+ }
1198
+
1199
+ /** The response exceed the length allowed. */
1200
+ class ResponseExceededMaxSizeError extends UndiciError {
1201
+ name: 'ResponseExceededMaxSizeError';
1202
+ code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE';
1203
+ }
1204
+ }
1205
+
1206
+ declare class File_2 extends Blob_2 {
1207
+ /**
1208
+ * Creates a new File instance.
1209
+ *
1210
+ * @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).
1211
+ * @param fileName The name of the file.
1212
+ * @param options An options object containing optional attributes for the file.
1213
+ */
1214
+ constructor(fileBits: ReadonlyArray<string | NodeJS.ArrayBufferView | Blob_2>, fileName: string, options?: FilePropertyBag)
1215
+
1216
+ /**
1217
+ * Name of the file referenced by the File object.
1218
+ */
1219
+ readonly name: string
1220
+
1221
+ /**
1222
+ * 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.
1223
+ */
1224
+ readonly lastModified: number
1225
+
1226
+ readonly [Symbol.toStringTag]: string
1227
+ }
1228
+
1229
+ declare interface FilePropertyBag extends BlobPropertyBag {
1230
+ /**
1231
+ * 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.
1232
+ */
1233
+ lastModified?: number
1234
+ }
1235
+
1236
+ /**
1237
+ * 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().
1238
+ */
1239
+ declare class FormData_2 {
1240
+ /**
1241
+ * Appends a new value onto an existing key inside a FormData object,
1242
+ * or adds the key if it does not already exist.
1243
+ *
1244
+ * 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.
1245
+ *
1246
+ * @param name The name of the field whose data is contained in `value`.
1247
+ * @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
1248
+ 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.
1249
+ * @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.
1250
+ */
1251
+ append(name: string, value: unknown, fileName?: string): void
1252
+
1253
+ /**
1254
+ * Set a new value for an existing key inside FormData,
1255
+ * or add the new field if it does not already exist.
1256
+ *
1257
+ * @param name The name of the field whose data is contained in `value`.
1258
+ * @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
1259
+ 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.
1260
+ * @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.
1261
+ *
1262
+ */
1263
+ set(name: string, value: unknown, fileName?: string): void
1264
+
1265
+ /**
1266
+ * Returns the first value associated with a given key from within a `FormData` object.
1267
+ * If you expect multiple values and want all of them, use the `getAll()` method instead.
1268
+ *
1269
+ * @param {string} name A name of the value you want to retrieve.
1270
+ *
1271
+ * @returns A `FormDataEntryValue` containing the value. If the key doesn't exist, the method returns null.
1272
+ */
1273
+ get(name: string): FormDataEntryValue | null
1274
+
1275
+ /**
1276
+ * Returns all the values associated with a given key from within a `FormData` object.
1277
+ *
1278
+ * @param {string} name A name of the value you want to retrieve.
1279
+ *
1280
+ * @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.
1281
+ */
1282
+ getAll(name: string): FormDataEntryValue[]
1283
+
1284
+ /**
1285
+ * Returns a boolean stating whether a `FormData` object contains a certain key.
1286
+ *
1287
+ * @param name A string representing the name of the key you want to test for.
1288
+ *
1289
+ * @return A boolean value.
1290
+ */
1291
+ has(name: string): boolean
1292
+
1293
+ /**
1294
+ * Deletes a key and its value(s) from a `FormData` object.
1295
+ *
1296
+ * @param name The name of the key you want to delete.
1297
+ */
1298
+ delete(name: string): void
1299
+
1300
+ /**
1301
+ * Executes given callback function for each field of the FormData instance
1302
+ */
1303
+ forEach: (
1304
+ callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData_2) => void,
1305
+ thisArg?: unknown
1306
+ ) => void
1307
+
1308
+ /**
1309
+ * 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.
1310
+ * Each key is a `string`.
1311
+ */
1312
+ keys: () => SpecIterableIterator<string>
1313
+
1314
+ /**
1315
+ * 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.
1316
+ * Each value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
1317
+ */
1318
+ values: () => SpecIterableIterator<FormDataEntryValue>
1319
+
1320
+ /**
1321
+ * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through the `FormData` key/value pairs.
1322
+ * The key of each pair is a string; the value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
1323
+ */
1324
+ entries: () => SpecIterableIterator<[string, FormDataEntryValue]>
1325
+
1326
+ /**
1327
+ * An alias for FormData#entries()
1328
+ */
1329
+ [Symbol.iterator]: () => SpecIterableIterator<[string, FormDataEntryValue]>
1330
+
1331
+ readonly [Symbol.toStringTag]: string
1332
+ }
1333
+
1334
+ /**
1335
+ * A `string` or `File` that represents a single value from a set of `FormData` key-value pairs.
1336
+ */
1337
+ declare type FormDataEntryValue = string | File_2
1338
+
1339
+ /**
1340
+ * fetches an mTLS certificate from the account mTLS certificate store by ID
1341
+ */
1342
+ export declare function getMTlsCertificate(accountId: string, id: string): Promise<MTlsCertificateResponse>;
1343
+
1344
+ /**
1345
+ * 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
1346
+ */
1347
+ export declare function getMTlsCertificateByName(accountId: string, name: string): Promise<MTlsCertificateResponse>;
1348
+
1349
+ declare class Headers_2 implements SpecIterable<[string, string]> {
1350
+ constructor (init?: HeadersInit_2)
1351
+ readonly append: (name: string, value: string) => void
1352
+ readonly delete: (name: string) => void
1353
+ readonly get: (name: string) => string | null
1354
+ readonly has: (name: string) => boolean
1355
+ readonly set: (name: string, value: string) => void
1356
+ readonly getSetCookie: () => string[]
1357
+ readonly forEach: (
1358
+ callbackfn: (value: string, key: string, iterable: Headers_2) => void,
1359
+ thisArg?: unknown
1360
+ ) => void
1361
+
1362
+ readonly keys: () => SpecIterableIterator<string>
1363
+ readonly values: () => SpecIterableIterator<string>
1364
+ readonly entries: () => SpecIterableIterator<[string, string]>
1365
+ readonly [Symbol.iterator]: () => SpecIterator<[string, string]>
1366
+ }
1367
+
1368
+ declare type HeadersInit_2 = string[][] | Record<string, string | ReadonlyArray<string>> | Headers_2
1369
+
1370
+ /**
1371
+ * The header type declaration of `undici`.
1372
+ */
1373
+ declare type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
1374
+
1375
+ /**
1376
+ * lists mTLS certificates for an account. filtering by name is supported
1377
+ */
1378
+ export declare function listMTlsCertificates(accountId: string, filter: MTlsCertificateListFilter): Promise<MTlsCertificateResponse[]>;
1379
+
1380
+ /**
1381
+ * details for uploading an mTLS certificate via the ssl api
1382
+ */
1383
+ declare interface MTlsCertificateBody {
1384
+ certificateChain: string;
1385
+ privateKey: string;
1386
+ name?: string;
1387
+ }
1388
+
1389
+ /**
1390
+ * supported filters for listing mTLS certificates via the ssl api
1391
+ */
1392
+ declare interface MTlsCertificateListFilter {
1393
+ name?: string;
1394
+ }
1395
+
1396
+ /**
1397
+ * the representation of an mTLS certificate in the account certificate store
1398
+ */
1399
+ declare interface MTlsCertificateResponse {
1400
+ id: string;
1401
+ name?: string;
1402
+ ca: boolean;
1403
+ certificates: string;
1404
+ expires_on: string;
1405
+ issuer: string;
1406
+ serial_number: string;
1407
+ signature: string;
1408
+ uploaded_on: string;
1409
+ }
1410
+
1411
+ /**
1412
+ * details for uploading an mTLS certificate from disk
1413
+ */
1414
+ declare interface MTlsCertificateUploadDetails {
1415
+ certificateChainFilename: string;
1416
+ privateKeyFilename: string;
1417
+ name?: string;
1418
+ }
1419
+
1420
+ declare interface PagesDeployOptions {
1421
+ /**
1422
+ * Path to static assets to deploy to Pages
1423
+ */
1424
+ directory: string;
1425
+ /**
1426
+ * The Cloudflare Account ID that owns the project that's
1427
+ * being published
1428
+ */
1429
+ accountId: string;
1430
+ /**
1431
+ * The name of the project to be published
1432
+ */
1433
+ projectName: string;
1434
+ /**
1435
+ * Branch name to use. Defaults to production branch
1436
+ */
1437
+ branch?: string;
1438
+ /**
1439
+ * Whether or not to skip local file upload result caching
1440
+ */
1441
+ skipCaching?: boolean;
1442
+ /**
1443
+ * Commit message associated to deployment
1444
+ */
1445
+ commitMessage?: string;
1446
+ /**
1447
+ * Commit hash associated to deployment
1448
+ */
1449
+ commitHash?: string;
1450
+ /**
1451
+ * Whether or not the deployment should be considered to be
1452
+ * in a dirty commit state
1453
+ */
1454
+ commitDirty?: boolean;
1455
+ /**
1456
+ * Path to the project's functions directory. Default uses
1457
+ * the current working directory + /functions since this is
1458
+ * typically called in a CLI
1459
+ */
1460
+ functionsDirectory?: string;
1461
+ /**
1462
+ * Whether to run bundling on `_worker.js` before deploying.
1463
+ * Default: true
1464
+ */
1465
+ bundle?: boolean;
1466
+ }
1467
+
1468
+ declare type ReferrerPolicy =
1469
+ | ''
1470
+ | 'no-referrer'
1471
+ | 'no-referrer-when-downgrade'
1472
+ | 'origin'
1473
+ | 'origin-when-cross-origin'
1474
+ | 'same-origin'
1475
+ | 'strict-origin'
1476
+ | 'strict-origin-when-cross-origin'
1477
+ | 'unsafe-url';
1478
+
1479
+ declare class Request_2 implements BodyMixin {
1480
+ constructor (input: RequestInfo_2, init?: RequestInit_2)
1481
+
1482
+ readonly cache: RequestCache
1483
+ readonly credentials: RequestCredentials
1484
+ readonly destination: RequestDestination
1485
+ readonly headers: Headers_2
1486
+ readonly integrity: string
1487
+ readonly method: string
1488
+ readonly mode: RequestMode
1489
+ readonly redirect: RequestRedirect
1490
+ readonly referrerPolicy: string
1491
+ readonly url: string
1492
+
1493
+ readonly keepalive: boolean
1494
+ readonly signal: AbortSignal
1495
+ readonly duplex: RequestDuplex
1496
+
1497
+ readonly body: ReadableStream_2 | null
1498
+ readonly bodyUsed: boolean
1499
+
1500
+ readonly arrayBuffer: () => Promise<ArrayBuffer>
1501
+ readonly blob: () => Promise<Blob_2>
1502
+ readonly formData: () => Promise<FormData_2>
1503
+ readonly json: () => Promise<unknown>
1504
+ readonly text: () => Promise<string>
1505
+
1506
+ readonly clone: () => Request_2
1507
+ }
1508
+
1509
+ declare type RequestCache =
1510
+ | 'default'
1511
+ | 'force-cache'
1512
+ | 'no-cache'
1513
+ | 'no-store'
1514
+ | 'only-if-cached'
1515
+ | 'reload'
1516
+
1517
+ declare type RequestCredentials = 'omit' | 'include' | 'same-origin'
1518
+
1519
+ declare type RequestDestination =
1520
+ | ''
1521
+ | 'audio'
1522
+ | 'audioworklet'
1523
+ | 'document'
1524
+ | 'embed'
1525
+ | 'font'
1526
+ | 'image'
1527
+ | 'manifest'
1528
+ | 'object'
1529
+ | 'paintworklet'
1530
+ | 'report'
1531
+ | 'script'
1532
+ | 'sharedworker'
1533
+ | 'style'
1534
+ | 'track'
1535
+ | 'video'
1536
+ | 'worker'
1537
+ | 'xslt'
1538
+
1539
+ declare type RequestDuplex = 'half'
1540
+
1541
+ declare type RequestInfo_2 = string | URL_2 | Request_2
1542
+
1543
+ declare interface RequestInit_2 {
1544
+ method?: string
1545
+ keepalive?: boolean
1546
+ headers?: HeadersInit_2
1547
+ body?: BodyInit_2
1548
+ redirect?: RequestRedirect
1549
+ integrity?: string
1550
+ signal?: AbortSignal
1551
+ credentials?: RequestCredentials
1552
+ mode?: RequestMode
1553
+ referrer?: string
1554
+ referrerPolicy?: ReferrerPolicy
1555
+ window?: null
1556
+ dispatcher?: Dispatcher
1557
+ duplex?: RequestDuplex
1558
+ }
1559
+
1560
+ declare type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin'
1561
+
1562
+ declare type RequestRedirect = 'error' | 'follow' | 'manual'
1563
+
1564
+ declare class Response_2 implements BodyMixin {
1565
+ constructor (body?: BodyInit_2, init?: ResponseInit_2)
1566
+
1567
+ readonly headers: Headers_2
1568
+ readonly ok: boolean
1569
+ readonly status: number
1570
+ readonly statusText: string
1571
+ readonly type: ResponseType
1572
+ readonly url: string
1573
+ readonly redirected: boolean
1574
+
1575
+ readonly body: ReadableStream_2 | null
1576
+ readonly bodyUsed: boolean
1577
+
1578
+ readonly arrayBuffer: () => Promise<ArrayBuffer>
1579
+ readonly blob: () => Promise<Blob_2>
1580
+ readonly formData: () => Promise<FormData_2>
1581
+ readonly json: () => Promise<unknown>
1582
+ readonly text: () => Promise<string>
1583
+
1584
+ readonly clone: () => Response_2
1585
+
1586
+ static error (): Response_2
1587
+ static json(data: any, init?: ResponseInit_2): Response_2
1588
+ static redirect (url: string | URL_2, status: ResponseRedirectStatus): Response_2
1589
+ }
1590
+
1591
+ declare interface ResponseInit_2 {
1592
+ readonly status?: number
1593
+ readonly statusText?: string
1594
+ readonly headers?: HeadersInit_2
1595
+ }
1596
+
1597
+ declare type ResponseRedirectStatus = 301 | 302 | 303 | 307 | 308
1598
+
1599
+ declare type ResponseType =
1600
+ | 'basic'
1601
+ | 'cors'
1602
+ | 'default'
1603
+ | 'error'
1604
+ | 'opaque'
1605
+ | 'opaqueredirect'
1606
+
1607
+ declare type Route = SimpleRoute | ZoneIdRoute | ZoneNameRoute | CustomDomainRoute;
1608
+
1609
+ /**
1610
+ * A bundling resolver rule, defining the modules type for paths that match the specified globs.
1611
+ */
1612
+ declare type Rule = {
1613
+ type: ConfigModuleRuleType;
1614
+ globs: string[];
1615
+ fallthrough?: boolean;
1616
+ };
1617
+
1618
+ declare type SimpleRoute = string;
1619
+
1620
+ declare interface SpecIterable<T> {
1621
+ [Symbol.iterator](): SpecIterator<T>;
1622
+ }
1623
+
1624
+ declare interface SpecIterableIterator<T> extends SpecIterator<T> {
1625
+ [Symbol.iterator](): SpecIterableIterator<T>;
1626
+ }
1627
+
1628
+ declare interface SpecIterator<T, TReturn = any, TNext = undefined> {
1629
+ next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
1630
+ }
1631
+
1632
+ declare type TailConsumer = {
1633
+ /** The name of the service tail events will be forwarded to. */
1634
+ service: string;
1635
+ /** (Optional) The environt of the service. */
1636
+ environment?: string;
1637
+ };
1638
+
1639
+ /**
1640
+ * unstable_dev starts a wrangler dev server, and returns a promise that resolves with utility functions to interact with it.
1641
+ */
1642
+ export declare function unstable_dev(script: string, options?: UnstableDevOptions, apiOptions?: unknown): Promise<UnstableDevWorker>;
1643
+
1644
+ export declare const unstable_pages: {
1645
+ deploy: typeof deploy;
1646
+ };
1647
+
1648
+ export declare interface UnstableDevOptions {
1649
+ config?: string;
1650
+ env?: string;
1651
+ ip?: string;
1652
+ port?: number;
1653
+ bundle?: boolean;
1654
+ inspectorPort?: number;
1655
+ localProtocol?: "http" | "https";
1656
+ assets?: string;
1657
+ site?: string;
1658
+ siteInclude?: string[];
1659
+ siteExclude?: string[];
1660
+ nodeCompat?: boolean;
1661
+ compatibilityDate?: string;
1662
+ compatibilityFlags?: string[];
1663
+ persist?: boolean;
1664
+ persistTo?: string;
1665
+ vars?: Record<string, string | Json>;
1666
+ kv?: {
1667
+ binding: string;
1668
+ id: string;
1669
+ preview_id?: string;
1670
+ }[];
1671
+ durableObjects?: {
1672
+ name: string;
1673
+ class_name: string;
1674
+ script_name?: string | undefined;
1675
+ environment?: string | undefined;
1676
+ }[];
1677
+ r2?: {
1678
+ binding: string;
1679
+ bucket_name: string;
1680
+ preview_bucket_name?: string;
1681
+ }[];
1682
+ moduleRoot?: string;
1683
+ rules?: Rule[];
1684
+ logLevel?: "none" | "info" | "error" | "log" | "warn" | "debug";
1685
+ inspect?: boolean;
1686
+ local?: boolean;
1687
+ accountId?: string;
1688
+ experimental?: {
1689
+ processEntrypoint?: boolean;
1690
+ additionalModules?: CfModule[];
1691
+ d1Databases?: Environment["d1_databases"];
1692
+ disableExperimentalWarning?: boolean;
1693
+ disableDevRegistry?: boolean;
1694
+ enablePagesAssetsServiceBinding?: EnablePagesAssetsServiceBindingOptions;
1695
+ forceLocal?: boolean;
1696
+ liveReload?: boolean;
1697
+ showInteractiveDevSession?: boolean;
1698
+ testMode?: boolean;
1699
+ testScheduled?: boolean;
1700
+ watch?: boolean;
1701
+ };
1702
+ }
1703
+
1704
+ export declare interface UnstableDevWorker {
1705
+ port: number;
1706
+ address: string;
1707
+ stop: () => Promise<void>;
1708
+ fetch: (input?: RequestInfo_2, init?: RequestInit_2) => Promise<Response_2>;
1709
+ waitUntilExit: () => Promise<void>;
1710
+ }
1711
+
1712
+ /**
1713
+ * uploads an mTLS certificate and private key pair to the account mTLS certificate store
1714
+ */
1715
+ export declare function uploadMTlsCertificate(accountId: string, body: MTlsCertificateBody): Promise<MTlsCertificateResponse>;
1716
+
1717
+ /**
1718
+ * reads an mTLS certificate and private key pair from disk and uploads it to the account mTLS certificate store
1719
+ */
1720
+ export declare function uploadMTlsCertificateFromFs(accountId: string, details: MTlsCertificateUploadDetails): Promise<MTlsCertificateResponse>;
1721
+
1722
+ declare type ZoneIdRoute = {
1723
+ pattern: string;
1724
+ zone_id: string;
1725
+ custom_domain?: boolean;
1726
+ };
1727
+
1728
+ declare type ZoneNameRoute = {
1729
+ pattern: string;
1730
+ zone_name: string;
1731
+ custom_domain?: boolean;
1732
+ };
1733
+
1734
+ export { }