wrangler 0.0.0-e6733a3 → 0.0.0-e6e1daba

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