wrangler 0.0.0-e492c10 → 0.0.0-e4aff81a

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