wrangler 0.0.0-e88a54e → 0.0.0-e8df68ee

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