wrangler 0.0.0-e043479 → 0.0.0-e0850ad1

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