wrangler 0.0.0-e33294b0 → 0.0.0-e33bb44a

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 (299) hide show
  1. package/README.md +10 -12
  2. package/bin/wrangler.js +10 -76
  3. package/package.json +20 -19
  4. package/templates/__tests__/tsconfig.json +1 -1
  5. package/templates/checked-fetch.js +10 -3
  6. package/templates/facade.d.ts +4 -1
  7. package/templates/gitignore +1 -0
  8. package/templates/middleware/common.ts +9 -4
  9. package/templates/middleware/loader-modules.ts +61 -11
  10. package/templates/middleware/loader-sw.ts +2 -7
  11. package/templates/middleware/middleware-d1-beta.d.ts +3 -0
  12. package/templates/{d1-beta-facade.js → middleware/middleware-d1-beta.ts} +87 -84
  13. package/templates/middleware/middleware-miniflare3-json-error.ts +17 -5
  14. package/templates/middleware/middleware-multiworker-dev.d.ts +4 -0
  15. package/templates/middleware/middleware-multiworker-dev.ts +59 -0
  16. package/templates/middleware/middleware-serve-static-assets.d.ts +6 -0
  17. package/templates/middleware/middleware-serve-static-assets.ts +56 -0
  18. package/templates/new-worker-scheduled.ts +1 -1
  19. package/templates/new-worker.ts +1 -1
  20. package/templates/pages-dev-util.ts +4 -1
  21. package/templates/pages-shim.ts +0 -3
  22. package/templates/pages-template-plugin.ts +19 -5
  23. package/templates/pages-template-worker.ts +11 -2
  24. package/templates/tsconfig.init.json +1 -2
  25. package/templates/tsconfig.json +1 -1
  26. package/wrangler-dist/cli.d.ts +706 -88
  27. package/wrangler-dist/cli.js +86405 -82167
  28. package/import_meta_url.js +0 -3
  29. package/miniflare-config-stubs/.env.empty +0 -0
  30. package/miniflare-config-stubs/package.empty.json +0 -1
  31. package/miniflare-config-stubs/wrangler.empty.toml +0 -0
  32. package/miniflare-dist/index.mjs +0 -6351
  33. package/src/__tests__/access.test.ts +0 -25
  34. package/src/__tests__/api-dev.test.ts +0 -238
  35. package/src/__tests__/api-devregistry.test.js +0 -64
  36. package/src/__tests__/api.test.ts +0 -80
  37. package/src/__tests__/config-cache-without-cache-dir.test.ts +0 -38
  38. package/src/__tests__/config-cache.test.ts +0 -42
  39. package/src/__tests__/configuration.test.ts +0 -4233
  40. package/src/__tests__/d1/d1.test.ts +0 -82
  41. package/src/__tests__/d1/execute.test.ts +0 -64
  42. package/src/__tests__/d1/migrate.test.ts +0 -155
  43. package/src/__tests__/d1/splitter.test.ts +0 -255
  44. package/src/__tests__/delete.test.ts +0 -266
  45. package/src/__tests__/deployments.test.ts +0 -129
  46. package/src/__tests__/dev.test.tsx +0 -1587
  47. package/src/__tests__/generate.test.ts +0 -238
  48. package/src/__tests__/get-host-from-url.test.ts +0 -16
  49. package/src/__tests__/guess-worker-format.test.ts +0 -85
  50. package/src/__tests__/helpers/clipboardy-mock.js +0 -4
  51. package/src/__tests__/helpers/cmd-shim.d.ts +0 -11
  52. package/src/__tests__/helpers/end-event-loop.ts +0 -6
  53. package/src/__tests__/helpers/mock-account-id.ts +0 -48
  54. package/src/__tests__/helpers/mock-auth-domain.ts +0 -20
  55. package/src/__tests__/helpers/mock-bin.ts +0 -36
  56. package/src/__tests__/helpers/mock-console.ts +0 -106
  57. package/src/__tests__/helpers/mock-dialogs.ts +0 -139
  58. package/src/__tests__/helpers/mock-get-pages-upload-token.ts +0 -25
  59. package/src/__tests__/helpers/mock-get-zone-from-host.ts +0 -11
  60. package/src/__tests__/helpers/mock-http-server.ts +0 -46
  61. package/src/__tests__/helpers/mock-istty.ts +0 -74
  62. package/src/__tests__/helpers/mock-known-routes.ts +0 -12
  63. package/src/__tests__/helpers/mock-kv.ts +0 -46
  64. package/src/__tests__/helpers/mock-oauth-flow.ts +0 -263
  65. package/src/__tests__/helpers/mock-process.ts +0 -34
  66. package/src/__tests__/helpers/mock-set-timeout.ts +0 -16
  67. package/src/__tests__/helpers/mock-stdin.ts +0 -108
  68. package/src/__tests__/helpers/mock-web-socket.ts +0 -29
  69. package/src/__tests__/helpers/msw/blob-worker.cjs +0 -19
  70. package/src/__tests__/helpers/msw/handlers/access.ts +0 -13
  71. package/src/__tests__/helpers/msw/handlers/deployments.ts +0 -93
  72. package/src/__tests__/helpers/msw/handlers/namespaces.ts +0 -81
  73. package/src/__tests__/helpers/msw/handlers/oauth.ts +0 -31
  74. package/src/__tests__/helpers/msw/handlers/r2.ts +0 -60
  75. package/src/__tests__/helpers/msw/handlers/script.ts +0 -56
  76. package/src/__tests__/helpers/msw/handlers/user.ts +0 -52
  77. package/src/__tests__/helpers/msw/handlers/zones.ts +0 -20
  78. package/src/__tests__/helpers/msw/index.ts +0 -50
  79. package/src/__tests__/helpers/msw/read-file-sync.js +0 -61
  80. package/src/__tests__/helpers/run-in-tmp.ts +0 -38
  81. package/src/__tests__/helpers/run-wrangler.ts +0 -16
  82. package/src/__tests__/helpers/string-dynamic-values-matcher.ts +0 -28
  83. package/src/__tests__/helpers/worker-scripts/child-wrangler.toml +0 -1
  84. package/src/__tests__/helpers/worker-scripts/hello-world-worker.js +0 -5
  85. package/src/__tests__/helpers/worker-scripts/hello-world-wrangler.toml +0 -1
  86. package/src/__tests__/helpers/worker-scripts/parent-worker.js +0 -8
  87. package/src/__tests__/helpers/worker-scripts/parent-wrangler.toml +0 -5
  88. package/src/__tests__/helpers/write-worker-source.ts +0 -31
  89. package/src/__tests__/helpers/write-wrangler-toml.ts +0 -17
  90. package/src/__tests__/https-options.test.ts +0 -163
  91. package/src/__tests__/index.test.ts +0 -274
  92. package/src/__tests__/init.test.ts +0 -3164
  93. package/src/__tests__/jest.setup.ts +0 -175
  94. package/src/__tests__/kv.test.ts +0 -1799
  95. package/src/__tests__/logger.test.ts +0 -141
  96. package/src/__tests__/logout.test.ts +0 -47
  97. package/src/__tests__/metrics.test.ts +0 -493
  98. package/src/__tests__/middleware.scheduled.test.ts +0 -145
  99. package/src/__tests__/middleware.test.ts +0 -815
  100. package/src/__tests__/mtls-certificates.test.ts +0 -585
  101. package/src/__tests__/package-manager.test.ts +0 -353
  102. package/src/__tests__/pages/deployment-list.test.ts +0 -78
  103. package/src/__tests__/pages/functions-build.test.ts +0 -402
  104. package/src/__tests__/pages/pages.test.ts +0 -81
  105. package/src/__tests__/pages/project-create.test.ts +0 -63
  106. package/src/__tests__/pages/project-list.test.ts +0 -108
  107. package/src/__tests__/pages/project-upload.test.ts +0 -481
  108. package/src/__tests__/pages/publish.test.ts +0 -2745
  109. package/src/__tests__/pages-deployment-tail.test.ts +0 -955
  110. package/src/__tests__/parse.test.ts +0 -436
  111. package/src/__tests__/paths.test.ts +0 -39
  112. package/src/__tests__/publish.test.ts +0 -8148
  113. package/src/__tests__/pubsub.test.ts +0 -493
  114. package/src/__tests__/queues.test.ts +0 -529
  115. package/src/__tests__/r2.test.ts +0 -374
  116. package/src/__tests__/route.test.ts +0 -45
  117. package/src/__tests__/secret.test.ts +0 -693
  118. package/src/__tests__/tail.test.ts +0 -958
  119. package/src/__tests__/test-old-node-version.js +0 -31
  120. package/src/__tests__/tsconfig-sanity.ts +0 -12
  121. package/src/__tests__/tsconfig.json +0 -8
  122. package/src/__tests__/tsconfig.tsbuildinfo +0 -1
  123. package/src/__tests__/type-generation.test.ts +0 -233
  124. package/src/__tests__/user.test.ts +0 -118
  125. package/src/__tests__/utils-collectKeyValues.test.ts +0 -47
  126. package/src/__tests__/validate-dev-props.test.ts +0 -56
  127. package/src/__tests__/version.test.ts +0 -35
  128. package/src/__tests__/whoami.test.tsx +0 -172
  129. package/src/__tests__/worker-namespace.test.ts +0 -339
  130. package/src/abort.d.ts +0 -3
  131. package/src/api/dev.ts +0 -328
  132. package/src/api/index.ts +0 -11
  133. package/src/api/mtls-certificate.ts +0 -148
  134. package/src/api/pages/create-worker-bundle-contents.ts +0 -75
  135. package/src/api/pages/index.ts +0 -5
  136. package/src/api/pages/publish.tsx +0 -368
  137. package/src/bundle-reporter.ts +0 -68
  138. package/src/bundle.ts +0 -876
  139. package/src/cfetch/index.ts +0 -158
  140. package/src/cfetch/internal.ts +0 -258
  141. package/src/cli.ts +0 -28
  142. package/src/config/README.md +0 -107
  143. package/src/config/config.ts +0 -282
  144. package/src/config/diagnostics.ts +0 -80
  145. package/src/config/environment.ts +0 -586
  146. package/src/config/index.ts +0 -375
  147. package/src/config/validation-helpers.ts +0 -597
  148. package/src/config/validation.ts +0 -2198
  149. package/src/config-cache.ts +0 -85
  150. package/src/create-worker-preview.ts +0 -282
  151. package/src/create-worker-upload-form.ts +0 -334
  152. package/src/d1/backups.tsx +0 -215
  153. package/src/d1/constants.ts +0 -2
  154. package/src/d1/create.tsx +0 -64
  155. package/src/d1/delete.ts +0 -53
  156. package/src/d1/execute.tsx +0 -354
  157. package/src/d1/formatTimeAgo.ts +0 -14
  158. package/src/d1/index.ts +0 -100
  159. package/src/d1/list.tsx +0 -60
  160. package/src/d1/migrations/apply.tsx +0 -206
  161. package/src/d1/migrations/create.tsx +0 -76
  162. package/src/d1/migrations/helpers.ts +0 -172
  163. package/src/d1/migrations/index.ts +0 -3
  164. package/src/d1/migrations/list.tsx +0 -92
  165. package/src/d1/migrations/options.ts +0 -23
  166. package/src/d1/options.ts +0 -22
  167. package/src/d1/splitter.ts +0 -161
  168. package/src/d1/types.ts +0 -25
  169. package/src/d1/utils.ts +0 -49
  170. package/src/delete.ts +0 -100
  171. package/src/deployments.ts +0 -116
  172. package/src/deprecated/index.ts +0 -144
  173. package/src/dev/dev-vars.ts +0 -39
  174. package/src/dev/dev.tsx +0 -600
  175. package/src/dev/get-local-persistence-path.ts +0 -31
  176. package/src/dev/local.tsx +0 -923
  177. package/src/dev/remote.tsx +0 -632
  178. package/src/dev/start-server.ts +0 -538
  179. package/src/dev/use-esbuild.ts +0 -205
  180. package/src/dev/validate-dev-props.ts +0 -31
  181. package/src/dev-registry.ts +0 -201
  182. package/src/dev.tsx +0 -914
  183. package/src/dialogs.ts +0 -136
  184. package/src/dispatch-namespace.ts +0 -211
  185. package/src/docs/index.ts +0 -97
  186. package/src/durable.ts +0 -102
  187. package/src/entry.ts +0 -328
  188. package/src/environment-variables/factory.ts +0 -88
  189. package/src/environment-variables/misc-variables.ts +0 -30
  190. package/src/errors.ts +0 -11
  191. package/src/generate/index.ts +0 -298
  192. package/src/git-client.ts +0 -135
  193. package/src/global-wrangler-config-path.ts +0 -26
  194. package/src/https-options.ts +0 -127
  195. package/src/index.ts +0 -705
  196. package/src/init.ts +0 -1022
  197. package/src/inspect.ts +0 -767
  198. package/src/intl-polyfill.d.ts +0 -139
  199. package/src/is-ci.ts +0 -14
  200. package/src/is-interactive.ts +0 -16
  201. package/src/jest.d.ts +0 -4
  202. package/src/kv/helpers.ts +0 -430
  203. package/src/kv/index.ts +0 -594
  204. package/src/logger.ts +0 -104
  205. package/src/metrics/index.ts +0 -5
  206. package/src/metrics/metrics-config.ts +0 -239
  207. package/src/metrics/metrics-dispatcher.ts +0 -96
  208. package/src/metrics/metrics-usage-headers.ts +0 -24
  209. package/src/metrics/send-event.ts +0 -98
  210. package/src/miniflare-cli/README.md +0 -30
  211. package/src/miniflare-cli/assets.ts +0 -250
  212. package/src/miniflare-cli/index.ts +0 -210
  213. package/src/miniflare-cli/request-context.ts +0 -40
  214. package/src/miniflare-cli/tsconfig.json +0 -9
  215. package/src/miniflare-cli/tsconfig.tsbuildinfo +0 -1
  216. package/src/miniflare-cli/types.ts +0 -11
  217. package/src/module-collection.ts +0 -267
  218. package/src/mtls-certificate/cli.ts +0 -155
  219. package/src/open-in-browser.ts +0 -17
  220. package/src/package-manager.ts +0 -219
  221. package/src/pages/build.ts +0 -232
  222. package/src/pages/buildFunctions.ts +0 -130
  223. package/src/pages/constants.ts +0 -18
  224. package/src/pages/deployment-tails.ts +0 -281
  225. package/src/pages/deployments.tsx +0 -86
  226. package/src/pages/dev.ts +0 -716
  227. package/src/pages/errors.ts +0 -66
  228. package/src/pages/functions/buildPlugin.ts +0 -90
  229. package/src/pages/functions/buildWorker.ts +0 -288
  230. package/src/pages/functions/filepath-routing.test.ts +0 -234
  231. package/src/pages/functions/filepath-routing.ts +0 -189
  232. package/src/pages/functions/identifiers.ts +0 -78
  233. package/src/pages/functions/routes-consolidation.test.ts +0 -250
  234. package/src/pages/functions/routes-consolidation.ts +0 -73
  235. package/src/pages/functions/routes-transformation.test.ts +0 -282
  236. package/src/pages/functions/routes-transformation.ts +0 -115
  237. package/src/pages/functions/routes-validation.test.ts +0 -403
  238. package/src/pages/functions/routes-validation.ts +0 -202
  239. package/src/pages/functions/routes.ts +0 -151
  240. package/src/pages/functions/tsconfig.json +0 -8
  241. package/src/pages/functions/tsconfig.tsbuildinfo +0 -1
  242. package/src/pages/functions.ts +0 -86
  243. package/src/pages/hash.ts +0 -13
  244. package/src/pages/index.ts +0 -102
  245. package/src/pages/projects.tsx +0 -162
  246. package/src/pages/prompt-select-project.tsx +0 -31
  247. package/src/pages/publish.tsx +0 -276
  248. package/src/pages/types.ts +0 -46
  249. package/src/pages/upload.tsx +0 -449
  250. package/src/pages/utils.ts +0 -23
  251. package/src/parse.ts +0 -308
  252. package/src/paths.ts +0 -71
  253. package/src/proxy.ts +0 -694
  254. package/src/publish/index.ts +0 -274
  255. package/src/publish/publish.ts +0 -1065
  256. package/src/pubsub/index.ts +0 -286
  257. package/src/pubsub/pubsub-commands.ts +0 -623
  258. package/src/queues/cli/commands/consumer/add.ts +0 -65
  259. package/src/queues/cli/commands/consumer/index.ts +0 -19
  260. package/src/queues/cli/commands/consumer/remove.ts +0 -31
  261. package/src/queues/cli/commands/create.ts +0 -25
  262. package/src/queues/cli/commands/delete.ts +0 -26
  263. package/src/queues/cli/commands/index.ts +0 -35
  264. package/src/queues/cli/commands/list.ts +0 -25
  265. package/src/queues/client.ts +0 -135
  266. package/src/queues/utils.ts +0 -18
  267. package/src/r2/constants.ts +0 -4
  268. package/src/r2/helpers.ts +0 -131
  269. package/src/r2/index.ts +0 -289
  270. package/src/routes.ts +0 -140
  271. package/src/secret/index.ts +0 -375
  272. package/src/selfsigned.d.ts +0 -29
  273. package/src/sites.ts +0 -372
  274. package/src/tail/createTail.ts +0 -406
  275. package/src/tail/filters.ts +0 -277
  276. package/src/tail/index.ts +0 -211
  277. package/src/tail/printing.ts +0 -122
  278. package/src/tsconfig-sanity.ts +0 -16
  279. package/src/type-generation.ts +0 -181
  280. package/src/update-check.ts +0 -19
  281. package/src/user/access.ts +0 -68
  282. package/src/user/auth-variables.ts +0 -113
  283. package/src/user/choose-account.tsx +0 -39
  284. package/src/user/generate-auth-url.ts +0 -33
  285. package/src/user/generate-random-state.ts +0 -16
  286. package/src/user/index.ts +0 -2
  287. package/src/user/user.ts +0 -1233
  288. package/src/utils/collectKeyValues.ts +0 -14
  289. package/src/whoami.ts +0 -135
  290. package/src/worker.ts +0 -257
  291. package/src/yargs-types.ts +0 -37
  292. package/src/zones.ts +0 -191
  293. package/templates/__tests__/tsconfig.tsbuildinfo +0 -1
  294. package/templates/first-party-worker-module-facade.ts +0 -19
  295. package/templates/format-dev-errors.ts +0 -34
  296. package/templates/serve-static-assets.ts +0 -66
  297. package/templates/service-bindings-module-facade.js +0 -55
  298. package/templates/service-bindings-sw-facade.js +0 -42
  299. package/templates/tsconfig.tsbuildinfo +0 -1
@@ -1,10 +1,21 @@
1
1
  /// <reference types="node" />
2
2
 
3
3
  import { Blob as Blob_2 } from 'buffer';
4
- import Dispatcher = require('./dispatcher');
4
+ import { ConnectionOptions } from 'tls';
5
+ import { Duplex } from 'stream';
6
+ import { EventEmitter } from 'events';
7
+ import { IpcNetConnectOpts } from 'net';
8
+ import { Readable } from 'stream';
5
9
  import { ReadableStream } from 'stream/web';
10
+ import { Socket } from 'net';
11
+ import { TcpNetConnectOpts } from 'net';
12
+ import { TlsOptions } from 'tls';
13
+ import { TLSSocket } from 'tls';
6
14
  import { URL as URL_2 } from 'url';
7
15
  import { URLSearchParams as URLSearchParams_2 } from 'url';
16
+ import { Writable } from 'stream';
17
+
18
+ declare type AbortSignal_2 = unknown;
8
19
 
9
20
  declare interface BlobPropertyBag {
10
21
  type?: string
@@ -33,6 +44,193 @@ declare interface BodyMixin {
33
44
  readonly text: () => Promise<string>
34
45
  }
35
46
 
47
+ declare class BodyReadable extends Readable {
48
+ constructor(
49
+ resume?: (this: Readable, size: number) => void | null,
50
+ abort?: () => void | null,
51
+ contentType?: string
52
+ )
53
+
54
+ /** Consumes and returns the body as a string
55
+ * https://fetch.spec.whatwg.org/#dom-body-text
56
+ */
57
+ text(): Promise<string>
58
+
59
+ /** Consumes and returns the body as a JavaScript Object
60
+ * https://fetch.spec.whatwg.org/#dom-body-json
61
+ */
62
+ json(): Promise<any>
63
+
64
+ /** Consumes and returns the body as a Blob
65
+ * https://fetch.spec.whatwg.org/#dom-body-blob
66
+ */
67
+ blob(): Promise<Blob_2>
68
+
69
+ /** Consumes and returns the body as an ArrayBuffer
70
+ * https://fetch.spec.whatwg.org/#dom-body-arraybuffer
71
+ */
72
+ arrayBuffer(): Promise<ArrayBuffer>
73
+
74
+ /** Not implemented
75
+ *
76
+ * https://fetch.spec.whatwg.org/#dom-body-formdata
77
+ */
78
+ formData(): Promise<never>
79
+
80
+ /** Returns true if the body is not null and the body has been consumed
81
+ *
82
+ * Otherwise, returns false
83
+ *
84
+ * https://fetch.spec.whatwg.org/#dom-body-bodyused
85
+ */
86
+ readonly bodyUsed: boolean
87
+
88
+ /** Throws on node 16.6.0
89
+ *
90
+ * If body is null, it should return null as the body
91
+ *
92
+ * If body is not null, should return the body as a ReadableStream
93
+ *
94
+ * https://fetch.spec.whatwg.org/#dom-body-body
95
+ */
96
+ readonly body: never | undefined
97
+
98
+ /** Dumps the response body by reading `limit` number of bytes.
99
+ * @param opts.limit Number of bytes to read (optional) - Default: 262144
100
+ */
101
+ dump(opts?: { limit: number }): Promise<void>
102
+ }
103
+
104
+ declare function buildConnector (options?: buildConnector.BuildOptions): buildConnector.connector
105
+
106
+ declare namespace buildConnector {
107
+ type BuildOptions = (ConnectionOptions | TcpNetConnectOpts | IpcNetConnectOpts) & {
108
+ maxCachedSessions?: number | null;
109
+ socketPath?: string | null;
110
+ timeout?: number | null;
111
+ port?: number;
112
+ keepAlive?: boolean | null;
113
+ keepAliveInitialDelay?: number | null;
114
+ }
115
+
116
+ interface Options {
117
+ hostname: string
118
+ host?: string
119
+ protocol: string
120
+ port: string
121
+ servername?: string
122
+ localAddress?: string | null
123
+ httpSocket?: Socket
124
+ }
125
+
126
+ type Callback = (...args: CallbackArgs) => void
127
+ type CallbackArgs = [null, Socket | TLSSocket] | [Error, null]
128
+
129
+ type connector = connectorAsync | connectorSync
130
+
131
+ interface connectorSync {
132
+ (options: buildConnector.Options): Socket | TLSSocket
133
+ }
134
+
135
+ interface connectorAsync {
136
+ (options: buildConnector.Options, callback: buildConnector.Callback): void
137
+ }
138
+ }
139
+
140
+ /**
141
+ * An imported module.
142
+ */
143
+ declare interface CfModule {
144
+ /**
145
+ * The module name.
146
+ *
147
+ * @example
148
+ * './src/index.js'
149
+ */
150
+ name: string;
151
+ /**
152
+ * The module content, usually JavaScript or WASM code.
153
+ *
154
+ * @example
155
+ * export default {
156
+ * async fetch(request) {
157
+ * return new Response('Ok')
158
+ * }
159
+ * }
160
+ */
161
+ content: string | Buffer;
162
+ /**
163
+ * The module type.
164
+ *
165
+ * If absent, will default to the main module's type.
166
+ */
167
+ type?: CfModuleType;
168
+ }
169
+
170
+ /**
171
+ * A module type.
172
+ */
173
+ declare type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer";
174
+
175
+ /** A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default. */
176
+ declare class Client extends Dispatcher {
177
+ constructor(url: string | URL_2, options?: Client.Options);
178
+ /** Property to get and set the pipelining factor. */
179
+ pipelining: number;
180
+ /** `true` after `client.close()` has been called. */
181
+ closed: boolean;
182
+ /** `true` after `client.destroyed()` has been called or `client.close()` has been called and the client shutdown has completed. */
183
+ destroyed: boolean;
184
+ }
185
+
186
+ declare namespace Client {
187
+ interface Options {
188
+ /** the timeout after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. Default: `4e3` milliseconds (4s). */
189
+ keepAliveTimeout?: number | null;
190
+ /** the maximum allowed `idleTimeout` when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */
191
+ keepAliveMaxTimeout?: number | null;
192
+ /** A number subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */
193
+ keepAliveTimeoutThreshold?: number | null;
194
+ /** The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Default: `1`. */
195
+ pipelining?: number | null;
196
+ /** **/
197
+ connect?: buildConnector.BuildOptions | buildConnector.connector | null;
198
+ /** The maximum length of request headers in bytes. Default: `16384` (16KiB). */
199
+ maxHeaderSize?: number | null;
200
+ /** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Default: `300e3` milliseconds (300s). */
201
+ bodyTimeout?: number | null;
202
+ /** The amount of time the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */
203
+ headersTimeout?: number | null;
204
+ /** If `true`, an error is thrown when the request content-length header doesn't match the length of the request body. Default: `true`. */
205
+ strictContentLength?: boolean;
206
+ /** @deprecated use the connect option instead */
207
+ tls?: TlsOptions | null;
208
+ /** */
209
+ maxRequestsPerClient?: number;
210
+ /** Max response body size in bytes, -1 is disabled */
211
+ maxResponseSize?: number | null;
212
+ /** Enables a family autodetection algorithm that loosely implements section 5 of RFC 8305. */
213
+ autoSelectFamily?: boolean;
214
+ /** The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. */
215
+ autoSelectFamilyAttemptTimeout?: number;
216
+
217
+ interceptors?: {Client: readonly Dispatcher[] | undefined}
218
+ }
219
+
220
+ interface SocketInfo {
221
+ localAddress?: string
222
+ localPort?: number
223
+ remoteAddress?: string
224
+ remotePort?: number
225
+ remoteFamily?: string
226
+ timeout?: number
227
+ bytesWritten?: number
228
+ bytesRead?: number
229
+ }
230
+
231
+
232
+ }
233
+
36
234
  /**
37
235
  * The possible types for a `Rule`.
38
236
  */
@@ -45,6 +243,74 @@ declare type CustomDomainRoute = {
45
243
 
46
244
  export declare function deleteMTlsCertificate(accountId: string, certificateId: string): Promise<unknown>;
47
245
 
246
+ /**
247
+ * Publish a directory to an account/project.
248
+ * NOTE: You will need the `CLOUDFLARE_API_KEY` environment
249
+ * variable set
250
+ */
251
+ declare function deploy({ directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, }: PagesDeployOptions): Promise<{
252
+ environment: "production" | "preview";
253
+ id: string;
254
+ project_id: string;
255
+ url: string;
256
+ project_name: string;
257
+ build_config: {
258
+ build_command: string;
259
+ destination_dir: string;
260
+ root_dir: string;
261
+ web_analytics_tag?: string | undefined;
262
+ web_analytics_token?: string | undefined;
263
+ fast_builds?: boolean | undefined;
264
+ };
265
+ created_on: string;
266
+ production_branch: string;
267
+ deployment_trigger: {
268
+ type: string;
269
+ metadata: {
270
+ branch: string;
271
+ commit_hash: string;
272
+ commit_message: string;
273
+ };
274
+ };
275
+ latest_stage: {
276
+ name: "build" | "deploy" | "queued" | "initialize" | "clone_repo";
277
+ status: "active" | "idle" | "canceled" | "success" | "failure" | "skipped";
278
+ started_on: string | null;
279
+ ended_on: string | null;
280
+ };
281
+ stages: {
282
+ name: "build" | "deploy" | "queued" | "initialize" | "clone_repo";
283
+ status: "active" | "idle" | "canceled" | "success" | "failure" | "skipped";
284
+ started_on: string | null;
285
+ ended_on: string | null;
286
+ }[];
287
+ aliases: string[];
288
+ modified_on: string;
289
+ short_id: string;
290
+ build_image_major_version: number;
291
+ kv_namespaces?: any;
292
+ source?: {
293
+ type: "github" | "gitlab";
294
+ config: {
295
+ owner: string;
296
+ repo_name: string;
297
+ production_branch?: string | undefined;
298
+ pr_comments_enabled?: boolean | undefined;
299
+ deployments_enabled?: boolean | undefined;
300
+ production_deployments_enabled?: boolean | undefined;
301
+ preview_deployment_setting?: "none" | "all" | "custom" | undefined;
302
+ preview_branch_includes?: string[] | undefined;
303
+ preview_branch_excludes?: string[] | undefined;
304
+ };
305
+ } | undefined;
306
+ env_vars?: any;
307
+ durable_object_namespaces?: any;
308
+ is_skipped?: boolean | undefined;
309
+ files?: {
310
+ [x: string]: string | undefined;
311
+ } | undefined;
312
+ }>;
313
+
48
314
  /**
49
315
  * Deprecated upload configuration.
50
316
  */
@@ -76,6 +342,240 @@ declare interface DeprecatedUpload {
76
342
  rules?: Environment["rules"];
77
343
  }
78
344
 
345
+ /** Dispatcher is the core API used to dispatch requests. */
346
+ declare class Dispatcher extends EventEmitter {
347
+ /** Dispatches a request. This API is expected to evolve through semver-major versions and is less stable than the preceding higher level APIs. It is primarily intended for library developers who implement higher level APIs on top of this. */
348
+ dispatch(options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean;
349
+ /** Starts two-way communications with the requested resource. */
350
+ connect(options: Dispatcher.ConnectOptions): Promise<Dispatcher.ConnectData>;
351
+ connect(options: Dispatcher.ConnectOptions, callback: (err: Error | null, data: Dispatcher.ConnectData) => void): void;
352
+ /** Performs an HTTP request. */
353
+ request(options: Dispatcher.RequestOptions): Promise<Dispatcher.ResponseData>;
354
+ request(options: Dispatcher.RequestOptions, callback: (err: Error | null, data: Dispatcher.ResponseData) => void): void;
355
+ /** For easy use with `stream.pipeline`. */
356
+ pipeline(options: Dispatcher.PipelineOptions, handler: Dispatcher.PipelineHandler): Duplex;
357
+ /** A faster version of `Dispatcher.request`. */
358
+ stream(options: Dispatcher.RequestOptions, factory: Dispatcher.StreamFactory): Promise<Dispatcher.StreamData>;
359
+ stream(options: Dispatcher.RequestOptions, factory: Dispatcher.StreamFactory, callback: (err: Error | null, data: Dispatcher.StreamData) => void): void;
360
+ /** Upgrade to a different protocol. */
361
+ upgrade(options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>;
362
+ upgrade(options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void;
363
+ /** Closes the client and gracefully waits for enqueued requests to complete before invoking the callback (or returning a promise if no callback is provided). */
364
+ close(): Promise<void>;
365
+ close(callback: () => void): void;
366
+ /** Destroy the client abruptly with the given err. All the pending and running requests will be asynchronously aborted and error. Waits until socket is closed before invoking the callback (or returning a promise if no callback is provided). Since this operation is asynchronously dispatched there might still be some progress on dispatched requests. */
367
+ destroy(): Promise<void>;
368
+ destroy(err: Error | null): Promise<void>;
369
+ destroy(callback: () => void): void;
370
+ destroy(err: Error | null, callback: () => void): void;
371
+
372
+ on(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
373
+ on(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
374
+ on(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
375
+ on(eventName: 'drain', callback: (origin: URL_2) => void): this;
376
+
377
+
378
+ once(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
379
+ once(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
380
+ once(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
381
+ once(eventName: 'drain', callback: (origin: URL_2) => void): this;
382
+
383
+
384
+ off(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
385
+ off(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
386
+ off(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
387
+ off(eventName: 'drain', callback: (origin: URL_2) => void): this;
388
+
389
+
390
+ addListener(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
391
+ addListener(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
392
+ addListener(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
393
+ addListener(eventName: 'drain', callback: (origin: URL_2) => void): this;
394
+
395
+ removeListener(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
396
+ removeListener(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
397
+ removeListener(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
398
+ removeListener(eventName: 'drain', callback: (origin: URL_2) => void): this;
399
+
400
+ prependListener(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
401
+ prependListener(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
402
+ prependListener(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
403
+ prependListener(eventName: 'drain', callback: (origin: URL_2) => void): this;
404
+
405
+ prependOnceListener(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
406
+ prependOnceListener(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
407
+ prependOnceListener(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
408
+ prependOnceListener(eventName: 'drain', callback: (origin: URL_2) => void): this;
409
+
410
+ listeners(eventName: 'connect'): ((origin: URL_2, targets: readonly Dispatcher[]) => void)[]
411
+ listeners(eventName: 'disconnect'): ((origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
412
+ listeners(eventName: 'connectionError'): ((origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
413
+ listeners(eventName: 'drain'): ((origin: URL_2) => void)[];
414
+
415
+ rawListeners(eventName: 'connect'): ((origin: URL_2, targets: readonly Dispatcher[]) => void)[]
416
+ rawListeners(eventName: 'disconnect'): ((origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
417
+ rawListeners(eventName: 'connectionError'): ((origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
418
+ rawListeners(eventName: 'drain'): ((origin: URL_2) => void)[];
419
+
420
+ emit(eventName: 'connect', origin: URL_2, targets: readonly Dispatcher[]): boolean;
421
+ emit(eventName: 'disconnect', origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
422
+ emit(eventName: 'connectionError', origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
423
+ emit(eventName: 'drain', origin: URL_2): boolean;
424
+ }
425
+
426
+ declare namespace Dispatcher {
427
+ interface DispatchOptions {
428
+ origin?: string | URL_2;
429
+ path: string;
430
+ method: HttpMethod;
431
+ /** Default: `null` */
432
+ body?: string | Buffer | Uint8Array | Readable | null | FormData;
433
+ /** Default: `null` */
434
+ headers?: IncomingHttpHeaders | string[] | null;
435
+ /** Query string params to be embedded in the request URL. Default: `null` */
436
+ query?: Record<string, any>;
437
+ /** Whether the requests can be safely retried or not. If `false` the request won't be sent until all preceding requests in the pipeline have completed. Default: `true` if `method` is `HEAD` or `GET`. */
438
+ idempotent?: boolean;
439
+ /** Whether the response is expected to take a long time and would end up blocking the pipeline. When this is set to `true` further pipelining will be avoided on the same connection until headers have been received. */
440
+ blocking?: boolean;
441
+ /** Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`. Default: `method === 'CONNECT' || null`. */
442
+ upgrade?: boolean | string | null;
443
+ /** The amount of time the parser will wait to receive the complete HTTP headers. Defaults to 300 seconds. */
444
+ headersTimeout?: number | null;
445
+ /** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use 0 to disable it entirely. Defaults to 300 seconds. */
446
+ bodyTimeout?: number | null;
447
+ /** Whether the request should stablish a keep-alive or not. Default `false` */
448
+ reset?: boolean;
449
+ /** Whether Undici should throw an error upon receiving a 4xx or 5xx response from the server. Defaults to false */
450
+ throwOnError?: boolean;
451
+ }
452
+ interface ConnectOptions {
453
+ path: string;
454
+ /** Default: `null` */
455
+ headers?: IncomingHttpHeaders | string[] | null;
456
+ /** Default: `null` */
457
+ signal?: AbortSignal_2 | EventEmitter | null;
458
+ /** This argument parameter is passed through to `ConnectData` */
459
+ opaque?: unknown;
460
+ /** Default: 0 */
461
+ maxRedirections?: number;
462
+ /** Default: `null` */
463
+ responseHeader?: 'raw' | null;
464
+ }
465
+ interface RequestOptions extends DispatchOptions {
466
+ /** Default: `null` */
467
+ opaque?: unknown;
468
+ /** Default: `null` */
469
+ signal?: AbortSignal_2 | EventEmitter | null;
470
+ /** Default: 0 */
471
+ maxRedirections?: number;
472
+ /** Default: `null` */
473
+ onInfo?: (info: { statusCode: number, headers: Record<string, string | string[]> }) => void;
474
+ /** Default: `null` */
475
+ responseHeader?: 'raw' | null;
476
+ }
477
+ interface PipelineOptions extends RequestOptions {
478
+ /** `true` if the `handler` will return an object stream. Default: `false` */
479
+ objectMode?: boolean;
480
+ }
481
+ interface UpgradeOptions {
482
+ path: string;
483
+ /** Default: `'GET'` */
484
+ method?: string;
485
+ /** Default: `null` */
486
+ headers?: IncomingHttpHeaders | string[] | null;
487
+ /** A string of comma separated protocols, in descending preference order. Default: `'Websocket'` */
488
+ protocol?: string;
489
+ /** Default: `null` */
490
+ signal?: AbortSignal_2 | EventEmitter | null;
491
+ /** Default: 0 */
492
+ maxRedirections?: number;
493
+ /** Default: `null` */
494
+ responseHeader?: 'raw' | null;
495
+ }
496
+ interface ConnectData {
497
+ statusCode: number;
498
+ headers: IncomingHttpHeaders;
499
+ socket: Duplex;
500
+ opaque: unknown;
501
+ }
502
+ interface ResponseData {
503
+ statusCode: number;
504
+ headers: IncomingHttpHeaders;
505
+ body: BodyReadable & BodyMixin;
506
+ trailers: Record<string, string>;
507
+ opaque: unknown;
508
+ context: object;
509
+ }
510
+ interface PipelineHandlerData {
511
+ statusCode: number;
512
+ headers: IncomingHttpHeaders;
513
+ opaque: unknown;
514
+ body: BodyReadable;
515
+ context: object;
516
+ }
517
+ interface StreamData {
518
+ opaque: unknown;
519
+ trailers: Record<string, string>;
520
+ }
521
+ interface UpgradeData {
522
+ headers: IncomingHttpHeaders;
523
+ socket: Duplex;
524
+ opaque: unknown;
525
+ }
526
+ interface StreamFactoryData {
527
+ statusCode: number;
528
+ headers: IncomingHttpHeaders;
529
+ opaque: unknown;
530
+ context: object;
531
+ }
532
+ type StreamFactory = (data: StreamFactoryData) => Writable;
533
+ interface DispatchHandlers {
534
+ /** Invoked before request is dispatched on socket. May be invoked multiple times when a request is retried when the request at the head of the pipeline fails. */
535
+ onConnect?(abort: () => void): void;
536
+ /** Invoked when an error has occurred. */
537
+ onError?(err: Error): void;
538
+ /** Invoked when request is upgraded either due to a `Upgrade` header or `CONNECT` method. */
539
+ onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex): void;
540
+ /** Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. */
541
+ onHeaders?(statusCode: number, headers: Buffer[] | string[] | null, resume: () => void): boolean;
542
+ /** Invoked when response payload data is received. */
543
+ onData?(chunk: Buffer): boolean;
544
+ /** Invoked when response payload and trailers have been received and the request has completed. */
545
+ onComplete?(trailers: string[] | null): void;
546
+ /** Invoked when a body chunk is sent to the server. May be invoked multiple times for chunked requests */
547
+ onBodySent?(chunkSize: number, totalBytesSent: number): void;
548
+ }
549
+ type PipelineHandler = (data: PipelineHandlerData) => Readable;
550
+ type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH';
551
+
552
+ /**
553
+ * @link https://fetch.spec.whatwg.org/#body-mixin
554
+ */
555
+ interface BodyMixin {
556
+ readonly body?: never; // throws on node v16.6.0
557
+ readonly bodyUsed: boolean;
558
+ arrayBuffer(): Promise<ArrayBuffer>;
559
+ blob(): Promise<Blob_2>;
560
+ formData(): Promise<never>;
561
+ json(): Promise<any>;
562
+ text(): Promise<string>;
563
+ }
564
+
565
+ interface DispatchInterceptor {
566
+ (dispatch: Dispatcher['dispatch']): Dispatcher['dispatch']
567
+ }
568
+ }
569
+
570
+ declare interface DispatchNamespaceOutbound {
571
+ /** Name of the service handling the outbound requests */
572
+ service: string;
573
+ /** (Optional) Name of the environment handling the outbound requests. */
574
+ environment?: string;
575
+ /** (Optional) List of parameter names, for sending context from your dispatch worker to the outbound handler */
576
+ parameters?: string[];
577
+ }
578
+
79
579
  declare type DurableObjectBindings = {
80
580
  /** The name of the binding used to refer to the Durable Object */
81
581
  name: string;
@@ -144,6 +644,11 @@ declare interface EnvironmentInheritable {
144
644
  * The entrypoint/path to the JavaScript file that will be executed.
145
645
  */
146
646
  main: string | undefined;
647
+ /**
648
+ * The directory in which module rules should be evaluated in a `--no-bundle` worker
649
+ * This defaults to dirname(main) when left undefined
650
+ */
651
+ base_dir: string | undefined;
147
652
  /**
148
653
  * Whether we use <name>.<subdomain>.workers.dev to
149
654
  * test and deploy your worker.
@@ -246,7 +751,7 @@ declare interface EnvironmentInheritable {
246
751
  upload?: DeprecatedUpload;
247
752
  };
248
753
  /**
249
- * Skip internal build steps and directly publish script
754
+ * Skip internal build steps and directly deploy script
250
755
  * @inheritable
251
756
  */
252
757
  no_bundle: boolean | undefined;
@@ -274,6 +779,8 @@ declare interface EnvironmentInheritable {
274
779
  binding: string;
275
780
  /** The namespace to bind to. */
276
781
  namespace: string;
782
+ /** Details about the outbound worker which will handle outbound requests from your namespace */
783
+ outbound?: DispatchNamespaceOutbound;
277
784
  }[];
278
785
  /**
279
786
  * Designates this worker as an internal-only "first-party" worker.
@@ -314,6 +821,14 @@ declare interface EnvironmentInheritable {
314
821
  * @inheritable
315
822
  */
316
823
  logpush: boolean | undefined;
824
+ /**
825
+ * Specify how the worker should be located to minimize round-trip time.
826
+ *
827
+ * More details: https://developers.cloudflare.com/workers/platform/smart-placement/
828
+ */
829
+ placement: {
830
+ mode: "off" | "smart";
831
+ } | undefined;
317
832
  }
318
833
 
319
834
  /**
@@ -382,6 +897,23 @@ declare interface EnvironmentNonInheritable {
382
897
  /** The ID of the KV namespace used during `wrangler dev` */
383
898
  preview_id?: string;
384
899
  }[];
900
+ /**
901
+ * These specify bindings to send email from inside your Worker.
902
+ *
903
+ * NOTE: This field is not automatically inherited from the top level environment,
904
+ * and so must be specified in every named environment.
905
+ *
906
+ * @default `[]`
907
+ * @nonInheritable
908
+ */
909
+ send_email: {
910
+ /** The binding name used to refer to the this binding */
911
+ name: string;
912
+ /** If this binding should be restricted to a specific verified address */
913
+ destination_address?: string;
914
+ /** If this binding should be restricted to a set of verified addresses */
915
+ allowed_destination_addresses?: string[];
916
+ }[];
385
917
  /**
386
918
  * Specifies Queues that are bound to this Worker environment.
387
919
  *
@@ -411,6 +943,8 @@ declare interface EnvironmentNonInheritable {
411
943
  max_retries?: number;
412
944
  /** The queue to send messages that failed to be consumed. */
413
945
  dead_letter_queue?: string;
946
+ /** The maximum number of concurrent consumer Worker invocations. Leaving this unset will allow your consumer to scale to the maximum concurrency needed to keep up with the message backlog. */
947
+ max_concurrency?: number | null;
414
948
  }[];
415
949
  };
416
950
  /**
@@ -455,6 +989,21 @@ declare interface EnvironmentNonInheritable {
455
989
  /** Internal use only. */
456
990
  database_internal_env?: string;
457
991
  }[];
992
+ /**
993
+ * Specifies Constellation projects that are bound to this Worker environment.
994
+ *
995
+ * NOTE: This field is not automatically inherited from the top level environment,
996
+ * and so must be specified in every named environment.
997
+ *
998
+ * @default `[]`
999
+ * @nonInheritable
1000
+ */
1001
+ constellation: {
1002
+ /** The binding name used to refer to the project in the worker. */
1003
+ binding: string;
1004
+ /** The id of the project. */
1005
+ project_id: string;
1006
+ }[];
458
1007
  /**
459
1008
  * Specifies service bindings (worker-to-worker) that are bound to this Worker environment.
460
1009
  *
@@ -487,13 +1036,18 @@ declare interface EnvironmentNonInheritable {
487
1036
  /** The name of this dataset to write to. */
488
1037
  dataset?: string;
489
1038
  }[];
1039
+ /**
1040
+ * A browser that will be usable from the worker.
1041
+ */
1042
+ browser: {
1043
+ binding: string;
1044
+ } | undefined;
490
1045
  /**
491
1046
  * "Unsafe" tables for features that aren't directly supported by wrangler.
492
1047
  *
493
1048
  * NOTE: This field is not automatically inherited from the top level environment,
494
1049
  * and so must be specified in every named environment.
495
1050
  *
496
- * @default `{ bindings: [] }`
497
1051
  * @nonInheritable
498
1052
  */
499
1053
  unsafe: {
@@ -501,14 +1055,19 @@ declare interface EnvironmentNonInheritable {
501
1055
  * A set of bindings that should be put into a Worker's upload metadata without changes. These
502
1056
  * can be used to implement bindings for features that haven't released and aren't supported
503
1057
  * directly by wrangler or miniflare.
504
- *
505
- * @default []
506
1058
  */
507
- bindings: {
1059
+ bindings?: {
508
1060
  name: string;
509
1061
  type: string;
510
1062
  [key: string]: unknown;
511
1063
  }[];
1064
+ /**
1065
+ * Arbitrary key/value pairs that will be included in the uploaded metadata. Values specified
1066
+ * here will always be applied to metadata last, so can add new or override existing fields.
1067
+ */
1068
+ metadata?: {
1069
+ [key: string]: string;
1070
+ };
512
1071
  };
513
1072
  mtls_certificates: {
514
1073
  /** The binding name used to refer to the certificate in the worker */
@@ -516,6 +1075,122 @@ declare interface EnvironmentNonInheritable {
516
1075
  /** The uuid of the uploaded mTLS certificate */
517
1076
  certificate_id: string;
518
1077
  }[];
1078
+ tail_consumers?: TailConsumer[];
1079
+ }
1080
+
1081
+ declare namespace Errors {
1082
+ class UndiciError extends Error { }
1083
+
1084
+ /** Connect timeout error. */
1085
+ class ConnectTimeoutError extends UndiciError {
1086
+ name: 'ConnectTimeoutError';
1087
+ code: 'UND_ERR_CONNECT_TIMEOUT';
1088
+ }
1089
+
1090
+ /** A header exceeds the `headersTimeout` option. */
1091
+ class HeadersTimeoutError extends UndiciError {
1092
+ name: 'HeadersTimeoutError';
1093
+ code: 'UND_ERR_HEADERS_TIMEOUT';
1094
+ }
1095
+
1096
+ /** Headers overflow error. */
1097
+ class HeadersOverflowError extends UndiciError {
1098
+ name: 'HeadersOverflowError'
1099
+ code: 'UND_ERR_HEADERS_OVERFLOW'
1100
+ }
1101
+
1102
+ /** A body exceeds the `bodyTimeout` option. */
1103
+ class BodyTimeoutError extends UndiciError {
1104
+ name: 'BodyTimeoutError';
1105
+ code: 'UND_ERR_BODY_TIMEOUT';
1106
+ }
1107
+
1108
+ class ResponseStatusCodeError extends UndiciError {
1109
+ name: 'ResponseStatusCodeError';
1110
+ code: 'UND_ERR_RESPONSE_STATUS_CODE';
1111
+ body: null | Record<string, any> | string
1112
+ status: number
1113
+ statusCode: number
1114
+ headers: IncomingHttpHeaders | string[] | null;
1115
+ }
1116
+
1117
+ /** Passed an invalid argument. */
1118
+ class InvalidArgumentError extends UndiciError {
1119
+ name: 'InvalidArgumentError';
1120
+ code: 'UND_ERR_INVALID_ARG';
1121
+ }
1122
+
1123
+ /** Returned an invalid value. */
1124
+ class InvalidReturnValueError extends UndiciError {
1125
+ name: 'InvalidReturnValueError';
1126
+ code: 'UND_ERR_INVALID_RETURN_VALUE';
1127
+ }
1128
+
1129
+ /** The request has been aborted by the user. */
1130
+ class RequestAbortedError extends UndiciError {
1131
+ name: 'AbortError';
1132
+ code: 'UND_ERR_ABORTED';
1133
+ }
1134
+
1135
+ /** Expected error with reason. */
1136
+ class InformationalError extends UndiciError {
1137
+ name: 'InformationalError';
1138
+ code: 'UND_ERR_INFO';
1139
+ }
1140
+
1141
+ /** Request body length does not match content-length header. */
1142
+ class RequestContentLengthMismatchError extends UndiciError {
1143
+ name: 'RequestContentLengthMismatchError';
1144
+ code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH';
1145
+ }
1146
+
1147
+ /** Response body length does not match content-length header. */
1148
+ class ResponseContentLengthMismatchError extends UndiciError {
1149
+ name: 'ResponseContentLengthMismatchError';
1150
+ code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH';
1151
+ }
1152
+
1153
+ /** Trying to use a destroyed client. */
1154
+ class ClientDestroyedError extends UndiciError {
1155
+ name: 'ClientDestroyedError';
1156
+ code: 'UND_ERR_DESTROYED';
1157
+ }
1158
+
1159
+ /** Trying to use a closed client. */
1160
+ class ClientClosedError extends UndiciError {
1161
+ name: 'ClientClosedError';
1162
+ code: 'UND_ERR_CLOSED';
1163
+ }
1164
+
1165
+ /** There is an error with the socket. */
1166
+ class SocketError extends UndiciError {
1167
+ name: 'SocketError';
1168
+ code: 'UND_ERR_SOCKET';
1169
+ socket: Client.SocketInfo | null
1170
+ }
1171
+
1172
+ /** Encountered unsupported functionality. */
1173
+ class NotSupportedError extends UndiciError {
1174
+ name: 'NotSupportedError';
1175
+ code: 'UND_ERR_NOT_SUPPORTED';
1176
+ }
1177
+
1178
+ /** No upstream has been added to the BalancedPool. */
1179
+ class BalancedPoolMissingUpstreamError extends UndiciError {
1180
+ name: 'MissingUpstreamError';
1181
+ code: 'UND_ERR_BPL_MISSING_UPSTREAM';
1182
+ }
1183
+
1184
+ class HTTPParserError extends UndiciError {
1185
+ name: 'HTTPParserError';
1186
+ code: string;
1187
+ }
1188
+
1189
+ /** The response exceed the length allowed. */
1190
+ class ResponseExceededMaxSizeError extends UndiciError {
1191
+ name: 'ResponseExceededMaxSizeError';
1192
+ code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE';
1193
+ }
519
1194
  }
520
1195
 
521
1196
  declare class File extends Blob_2 {
@@ -668,6 +1343,7 @@ declare class Headers implements SpecIterable<[string, string]> {
668
1343
  readonly get: (name: string) => string | null
669
1344
  readonly has: (name: string) => boolean
670
1345
  readonly set: (name: string, value: string) => void
1346
+ readonly getSetCookie: () => string[]
671
1347
  readonly forEach: (
672
1348
  callbackfn: (value: string, key: string, iterable: Headers) => void,
673
1349
  thisArg?: unknown
@@ -681,6 +1357,11 @@ declare class Headers implements SpecIterable<[string, string]> {
681
1357
 
682
1358
  declare type HeadersInit = string[][] | Record<string, string | ReadonlyArray<string>> | Headers
683
1359
 
1360
+ /**
1361
+ * The header type declaration of `undici`.
1362
+ */
1363
+ declare type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
1364
+
684
1365
  /**
685
1366
  * lists mTLS certificates for an account. filtering by name is supported
686
1367
  */
@@ -726,9 +1407,9 @@ declare interface MTlsCertificateUploadDetails {
726
1407
  name?: string;
727
1408
  }
728
1409
 
729
- declare interface PagesPublishOptions {
1410
+ declare interface PagesDeployOptions {
730
1411
  /**
731
- * Path to static assets to publish to Pages
1412
+ * Path to static assets to deploy to Pages
732
1413
  */
733
1414
  directory: string;
734
1415
  /**
@@ -769,86 +1450,11 @@ declare interface PagesPublishOptions {
769
1450
  functionsDirectory?: string;
770
1451
  /**
771
1452
  * Whether to run bundling on `_worker.js` before deploying.
772
- * Default: false
1453
+ * Default: true
773
1454
  */
774
1455
  bundle?: boolean;
775
- /**
776
- * Whether to process non-JS module imports or not, such as
777
- * wasm/text/binary, when we run bundling on `functions` or
778
- * `_worker.js`
779
- * Default: false
780
- */
781
- experimentalWorkerBundle?: boolean;
782
1456
  }
783
1457
 
784
- /**
785
- * Publish a directory to an account/project.
786
- * NOTE: You will need the `CLOUDFLARE_API_KEY` environment
787
- * variable set
788
- */
789
- declare function publish({ directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, experimentalWorkerBundle, }: PagesPublishOptions): Promise<{
790
- environment: "production" | "preview";
791
- id: string;
792
- url: string;
793
- project_name: string;
794
- build_config: {
795
- build_command: string;
796
- destination_dir: string;
797
- root_dir: string;
798
- web_analytics_tag?: string | undefined;
799
- web_analytics_token?: string | undefined;
800
- fast_builds?: boolean | undefined;
801
- };
802
- created_on: string;
803
- production_branch: string;
804
- project_id: string;
805
- deployment_trigger: {
806
- type: string;
807
- metadata: {
808
- branch: string;
809
- commit_hash: string;
810
- commit_message: string;
811
- };
812
- };
813
- latest_stage: {
814
- name: "build" | "queued" | "initialize" | "clone_repo" | "deploy";
815
- status: "active" | "canceled" | "success" | "idle" | "failure" | "skipped";
816
- started_on: string | null;
817
- ended_on: string | null;
818
- };
819
- stages: {
820
- name: "build" | "queued" | "initialize" | "clone_repo" | "deploy";
821
- status: "active" | "canceled" | "success" | "idle" | "failure" | "skipped";
822
- started_on: string | null;
823
- ended_on: string | null;
824
- }[];
825
- aliases: string[];
826
- modified_on: string;
827
- short_id: string;
828
- build_image_major_version: number;
829
- kv_namespaces?: any;
830
- source?: {
831
- type: "github" | "gitlab";
832
- config: {
833
- owner: string;
834
- repo_name: string;
835
- production_branch?: string | undefined;
836
- pr_comments_enabled?: boolean | undefined;
837
- deployments_enabled?: boolean | undefined;
838
- production_deployments_enabled?: boolean | undefined;
839
- preview_deployment_setting?: "none" | "all" | "custom" | undefined;
840
- preview_branch_includes?: string[] | undefined;
841
- preview_branch_excludes?: string[] | undefined;
842
- };
843
- } | undefined;
844
- env_vars?: any;
845
- durable_object_namespaces?: any;
846
- is_skipped?: boolean | undefined;
847
- files?: {
848
- [x: string]: string | undefined;
849
- } | undefined;
850
- }>;
851
-
852
1458
  declare type ReferrerPolicy =
853
1459
  | ''
854
1460
  | 'no-referrer'
@@ -876,6 +1482,7 @@ declare class Request implements BodyMixin {
876
1482
 
877
1483
  readonly keepalive: boolean
878
1484
  readonly signal: AbortSignal
1485
+ readonly duplex: RequestDuplex
879
1486
 
880
1487
  readonly body: ReadableStream | null
881
1488
  readonly bodyUsed: boolean
@@ -919,6 +1526,8 @@ declare type RequestDestination =
919
1526
  | 'worker'
920
1527
  | 'xslt'
921
1528
 
1529
+ declare type RequestDuplex = 'half'
1530
+
922
1531
  declare type RequestInfo = string | URL_2 | Request
923
1532
 
924
1533
  declare interface RequestInit {
@@ -935,6 +1544,7 @@ declare interface RequestInit {
935
1544
  referrerPolicy?: ReferrerPolicy
936
1545
  window?: null
937
1546
  dispatcher?: Dispatcher
1547
+ duplex?: RequestDuplex
938
1548
  }
939
1549
 
940
1550
  declare type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin'
@@ -1009,13 +1619,20 @@ declare interface SpecIterator<T, TReturn = any, TNext = undefined> {
1009
1619
  next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
1010
1620
  }
1011
1621
 
1622
+ declare type TailConsumer = {
1623
+ /** The name of the service tail events will be forwarded to. */
1624
+ service: string;
1625
+ /** (Optional) The environt of the service. */
1626
+ environment?: string;
1627
+ };
1628
+
1012
1629
  /**
1013
1630
  * unstable_dev starts a wrangler dev server, and returns a promise that resolves with utility functions to interact with it.
1014
1631
  */
1015
1632
  export declare function unstable_dev(script: string, options?: UnstableDevOptions, apiOptions?: unknown): Promise<UnstableDevWorker>;
1016
1633
 
1017
1634
  export declare const unstable_pages: {
1018
- publish: typeof publish;
1635
+ deploy: typeof deploy;
1019
1636
  };
1020
1637
 
1021
1638
  export declare interface UnstableDevOptions {
@@ -1054,18 +1671,19 @@ export declare interface UnstableDevOptions {
1054
1671
  bucket_name: string;
1055
1672
  preview_bucket_name?: string;
1056
1673
  }[];
1674
+ moduleRoot?: string;
1675
+ rules?: Rule[];
1057
1676
  logLevel?: "none" | "info" | "error" | "log" | "warn" | "debug";
1058
- logPrefix?: string;
1059
1677
  inspect?: boolean;
1060
1678
  local?: boolean;
1061
1679
  accountId?: string;
1062
1680
  experimental?: {
1681
+ processEntrypoint?: boolean;
1682
+ additionalModules?: CfModule[];
1063
1683
  d1Databases?: Environment["d1_databases"];
1064
1684
  disableExperimentalWarning?: boolean;
1065
1685
  disableDevRegistry?: boolean;
1066
1686
  enablePagesAssetsServiceBinding?: EnablePagesAssetsServiceBindingOptions;
1067
- experimentalLocal?: boolean;
1068
- experimentalLocalRemoteKv?: boolean;
1069
1687
  forceLocal?: boolean;
1070
1688
  liveReload?: boolean;
1071
1689
  showInteractiveDevSession?: boolean;