wrangler 0.0.0-e3278fa → 0.0.0-e33294b0

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 (322) hide show
  1. package/README.md +24 -4
  2. package/bin/wrangler.js +170 -62
  3. package/kv-asset-handler.js +1 -0
  4. package/miniflare-dist/index.mjs +1499 -34
  5. package/package.json +193 -153
  6. package/src/__tests__/access.test.ts +25 -0
  7. package/src/__tests__/api-dev.test.ts +238 -0
  8. package/src/__tests__/api-devregistry.test.js +64 -0
  9. package/src/__tests__/api.test.ts +80 -0
  10. package/src/__tests__/config-cache-without-cache-dir.test.ts +38 -0
  11. package/src/__tests__/config-cache.test.ts +30 -24
  12. package/src/__tests__/configuration.test.ts +4222 -3397
  13. package/src/__tests__/d1/d1.test.ts +82 -0
  14. package/src/__tests__/d1/execute.test.ts +64 -0
  15. package/src/__tests__/d1/migrate.test.ts +155 -0
  16. package/src/__tests__/d1/splitter.test.ts +255 -0
  17. package/src/__tests__/delete.test.ts +266 -0
  18. package/src/__tests__/deployments.test.ts +129 -0
  19. package/src/__tests__/dev.test.tsx +1560 -956
  20. package/src/__tests__/generate.test.ts +238 -0
  21. package/src/__tests__/get-host-from-url.test.ts +16 -0
  22. package/src/__tests__/guess-worker-format.test.ts +68 -68
  23. package/src/__tests__/helpers/cmd-shim.d.ts +6 -6
  24. package/src/__tests__/helpers/end-event-loop.ts +6 -0
  25. package/src/__tests__/helpers/mock-account-id.ts +24 -24
  26. package/src/__tests__/helpers/mock-auth-domain.ts +20 -0
  27. package/src/__tests__/helpers/mock-bin.ts +20 -20
  28. package/src/__tests__/helpers/mock-console.ts +58 -39
  29. package/src/__tests__/helpers/mock-dialogs.ts +88 -79
  30. package/src/__tests__/helpers/mock-get-pages-upload-token.ts +25 -0
  31. package/src/__tests__/helpers/mock-get-zone-from-host.ts +11 -0
  32. package/src/__tests__/helpers/mock-http-server.ts +30 -30
  33. package/src/__tests__/helpers/mock-istty.ts +65 -18
  34. package/src/__tests__/helpers/mock-known-routes.ts +12 -0
  35. package/src/__tests__/helpers/mock-kv.ts +41 -28
  36. package/src/__tests__/helpers/mock-oauth-flow.ts +241 -233
  37. package/src/__tests__/helpers/mock-process.ts +34 -0
  38. package/src/__tests__/helpers/mock-set-timeout.ts +16 -0
  39. package/src/__tests__/helpers/mock-stdin.ts +82 -77
  40. package/src/__tests__/helpers/mock-web-socket.ts +21 -21
  41. package/src/__tests__/helpers/msw/blob-worker.cjs +19 -0
  42. package/src/__tests__/helpers/msw/handlers/access.ts +13 -0
  43. package/src/__tests__/helpers/msw/handlers/deployments.ts +93 -0
  44. package/src/__tests__/helpers/msw/handlers/namespaces.ts +81 -0
  45. package/src/__tests__/helpers/msw/handlers/oauth.ts +31 -0
  46. package/src/__tests__/helpers/msw/handlers/r2.ts +60 -0
  47. package/src/__tests__/helpers/msw/handlers/script.ts +56 -0
  48. package/src/__tests__/helpers/msw/handlers/user.ts +52 -0
  49. package/src/__tests__/helpers/msw/handlers/zones.ts +20 -0
  50. package/src/__tests__/helpers/msw/index.ts +50 -0
  51. package/src/__tests__/helpers/msw/read-file-sync.js +61 -0
  52. package/src/__tests__/helpers/run-in-tmp.ts +27 -28
  53. package/src/__tests__/helpers/run-wrangler.ts +8 -8
  54. package/src/__tests__/helpers/string-dynamic-values-matcher.ts +28 -0
  55. package/src/__tests__/helpers/worker-scripts/child-wrangler.toml +1 -0
  56. package/src/__tests__/helpers/worker-scripts/hello-world-worker.js +5 -0
  57. package/src/__tests__/helpers/worker-scripts/hello-world-wrangler.toml +1 -0
  58. package/src/__tests__/helpers/worker-scripts/parent-worker.js +8 -0
  59. package/src/__tests__/helpers/worker-scripts/parent-wrangler.toml +5 -0
  60. package/src/__tests__/helpers/write-worker-source.ts +16 -16
  61. package/src/__tests__/helpers/write-wrangler-toml.ts +9 -9
  62. package/src/__tests__/https-options.test.ts +142 -109
  63. package/src/__tests__/index.test.ts +254 -236
  64. package/src/__tests__/init.test.ts +3135 -1608
  65. package/src/__tests__/jest.setup.ts +148 -50
  66. package/src/__tests__/kv.test.ts +1789 -1471
  67. package/src/__tests__/logger.test.ts +100 -74
  68. package/src/__tests__/logout.test.ts +47 -0
  69. package/src/__tests__/metrics.test.ts +493 -0
  70. package/src/__tests__/middleware.scheduled.test.ts +145 -0
  71. package/src/__tests__/middleware.test.ts +815 -0
  72. package/src/__tests__/mtls-certificates.test.ts +585 -0
  73. package/src/__tests__/package-manager.test.ts +303 -303
  74. package/src/__tests__/pages/deployment-list.test.ts +78 -0
  75. package/src/__tests__/pages/functions-build.test.ts +402 -0
  76. package/src/__tests__/pages/pages.test.ts +81 -0
  77. package/src/__tests__/pages/project-create.test.ts +63 -0
  78. package/src/__tests__/pages/project-list.test.ts +108 -0
  79. package/src/__tests__/pages/project-upload.test.ts +481 -0
  80. package/src/__tests__/pages/publish.test.ts +2745 -0
  81. package/src/__tests__/pages-deployment-tail.test.ts +955 -0
  82. package/src/__tests__/parse.test.ts +358 -252
  83. package/src/__tests__/paths.test.ts +39 -0
  84. package/src/__tests__/publish.test.ts +8023 -5629
  85. package/src/__tests__/pubsub.test.ts +493 -0
  86. package/src/__tests__/queues.test.ts +529 -0
  87. package/src/__tests__/r2.test.ts +369 -228
  88. package/src/__tests__/route.test.ts +18 -18
  89. package/src/__tests__/secret.test.ts +681 -469
  90. package/src/__tests__/tail.test.ts +835 -567
  91. package/src/__tests__/test-old-node-version.js +31 -0
  92. package/src/__tests__/tsconfig-sanity.ts +12 -0
  93. package/src/__tests__/tsconfig.json +8 -0
  94. package/src/__tests__/tsconfig.tsbuildinfo +1 -0
  95. package/src/__tests__/type-generation.test.ts +233 -0
  96. package/src/__tests__/user.test.ts +107 -120
  97. package/src/__tests__/utils-collectKeyValues.test.ts +47 -0
  98. package/src/__tests__/validate-dev-props.test.ts +56 -0
  99. package/src/__tests__/version.test.ts +35 -0
  100. package/src/__tests__/whoami.test.tsx +165 -132
  101. package/src/__tests__/worker-namespace.test.ts +339 -0
  102. package/src/abort.d.ts +1 -1
  103. package/src/api/dev.ts +328 -0
  104. package/src/api/index.ts +11 -0
  105. package/src/api/mtls-certificate.ts +148 -0
  106. package/src/api/pages/create-worker-bundle-contents.ts +75 -0
  107. package/src/api/pages/index.ts +5 -0
  108. package/src/api/pages/publish.tsx +368 -0
  109. package/src/bundle-reporter.ts +68 -0
  110. package/src/bundle.ts +839 -160
  111. package/src/cfetch/index.ts +120 -83
  112. package/src/cfetch/internal.ts +208 -92
  113. package/src/cli.ts +23 -8
  114. package/src/config/config.ts +244 -196
  115. package/src/config/diagnostics.ts +61 -61
  116. package/src/config/environment.ts +523 -357
  117. package/src/config/index.ts +346 -196
  118. package/src/config/validation-helpers.ts +379 -366
  119. package/src/config/validation.ts +2026 -1367
  120. package/src/config-cache.ts +81 -41
  121. package/src/create-worker-preview.ts +239 -142
  122. package/src/create-worker-upload-form.ts +318 -238
  123. package/src/d1/backups.tsx +215 -0
  124. package/src/d1/constants.ts +2 -0
  125. package/src/d1/create.tsx +64 -0
  126. package/src/d1/delete.ts +53 -0
  127. package/src/d1/execute.tsx +354 -0
  128. package/src/d1/formatTimeAgo.ts +14 -0
  129. package/src/d1/index.ts +100 -0
  130. package/src/d1/list.tsx +60 -0
  131. package/src/d1/migrations/apply.tsx +206 -0
  132. package/src/d1/migrations/create.tsx +76 -0
  133. package/src/d1/migrations/helpers.ts +172 -0
  134. package/src/d1/migrations/index.ts +3 -0
  135. package/src/d1/migrations/list.tsx +92 -0
  136. package/src/d1/migrations/options.ts +23 -0
  137. package/src/d1/options.ts +22 -0
  138. package/src/d1/splitter.ts +161 -0
  139. package/src/d1/types.ts +25 -0
  140. package/src/d1/utils.ts +49 -0
  141. package/src/delete.ts +100 -0
  142. package/src/deployments.ts +116 -0
  143. package/src/deprecated/index.ts +144 -0
  144. package/src/dev/dev-vars.ts +20 -17
  145. package/src/dev/dev.tsx +533 -345
  146. package/src/dev/get-local-persistence-path.ts +31 -0
  147. package/src/dev/local.tsx +903 -302
  148. package/src/dev/remote.tsx +620 -225
  149. package/src/dev/start-server.ts +538 -0
  150. package/src/dev/use-esbuild.ts +184 -97
  151. package/src/dev/validate-dev-props.ts +31 -0
  152. package/src/dev-registry.ts +201 -0
  153. package/src/dev.tsx +914 -0
  154. package/src/dialogs.ts +136 -0
  155. package/src/dispatch-namespace.ts +211 -0
  156. package/src/docs/index.ts +97 -0
  157. package/src/durable.ts +87 -87
  158. package/src/entry.ts +236 -230
  159. package/src/environment-variables/factory.ts +88 -0
  160. package/src/environment-variables/misc-variables.ts +30 -0
  161. package/src/errors.ts +6 -6
  162. package/src/generate/index.ts +298 -0
  163. package/src/git-client.ts +135 -0
  164. package/src/global-wrangler-config-path.ts +26 -0
  165. package/src/https-options.ts +84 -80
  166. package/src/index.ts +705 -0
  167. package/src/init.ts +1022 -0
  168. package/src/inspect.ts +698 -593
  169. package/src/intl-polyfill.d.ts +123 -123
  170. package/src/is-ci.ts +14 -0
  171. package/src/is-interactive.ts +16 -0
  172. package/src/jest.d.ts +4 -0
  173. package/src/kv/helpers.ts +430 -0
  174. package/src/kv/index.ts +594 -0
  175. package/src/logger.ts +80 -42
  176. package/src/metrics/index.ts +5 -0
  177. package/src/metrics/metrics-config.ts +239 -0
  178. package/src/metrics/metrics-dispatcher.ts +96 -0
  179. package/src/metrics/metrics-usage-headers.ts +24 -0
  180. package/src/metrics/send-event.ts +98 -0
  181. package/src/miniflare-cli/assets.ts +250 -0
  182. package/src/miniflare-cli/index.ts +202 -33
  183. package/src/miniflare-cli/request-context.ts +18 -18
  184. package/src/miniflare-cli/tsconfig.json +9 -0
  185. package/src/miniflare-cli/tsconfig.tsbuildinfo +1 -0
  186. package/src/miniflare-cli/types.ts +11 -0
  187. package/src/module-collection.ts +221 -212
  188. package/src/mtls-certificate/cli.ts +155 -0
  189. package/src/open-in-browser.ts +4 -6
  190. package/src/package-manager.ts +173 -128
  191. package/src/pages/build.ts +232 -0
  192. package/src/pages/buildFunctions.ts +130 -0
  193. package/src/pages/constants.ts +18 -0
  194. package/src/pages/deployment-tails.ts +281 -0
  195. package/src/pages/deployments.tsx +86 -0
  196. package/src/pages/dev.ts +716 -0
  197. package/src/pages/errors.ts +66 -0
  198. package/src/pages/functions/buildPlugin.ts +90 -0
  199. package/src/pages/functions/buildWorker.ts +288 -0
  200. package/{pages → src/pages}/functions/filepath-routing.test.ts +113 -113
  201. package/src/pages/functions/filepath-routing.ts +189 -0
  202. package/src/pages/functions/identifiers.ts +78 -0
  203. package/src/pages/functions/routes-consolidation.test.ts +250 -0
  204. package/src/pages/functions/routes-consolidation.ts +73 -0
  205. package/src/pages/functions/routes-transformation.test.ts +282 -0
  206. package/src/pages/functions/routes-transformation.ts +115 -0
  207. package/src/pages/functions/routes-validation.test.ts +403 -0
  208. package/src/pages/functions/routes-validation.ts +202 -0
  209. package/src/pages/functions/routes.ts +151 -0
  210. package/src/pages/functions/tsconfig.json +8 -0
  211. package/src/pages/functions/tsconfig.tsbuildinfo +1 -0
  212. package/src/pages/functions.ts +86 -0
  213. package/src/pages/hash.ts +13 -0
  214. package/src/pages/index.ts +102 -0
  215. package/src/pages/projects.tsx +162 -0
  216. package/src/pages/prompt-select-project.tsx +31 -0
  217. package/src/pages/publish.tsx +276 -0
  218. package/src/pages/types.ts +46 -0
  219. package/src/pages/upload.tsx +449 -0
  220. package/src/pages/utils.ts +23 -0
  221. package/src/parse.ts +232 -126
  222. package/src/paths.ts +53 -8
  223. package/src/proxy.ts +623 -407
  224. package/src/publish/index.ts +274 -0
  225. package/src/publish/publish.ts +1065 -0
  226. package/src/pubsub/index.ts +286 -0
  227. package/src/pubsub/pubsub-commands.ts +623 -0
  228. package/src/queues/cli/commands/consumer/add.ts +65 -0
  229. package/src/queues/cli/commands/consumer/index.ts +19 -0
  230. package/src/queues/cli/commands/consumer/remove.ts +31 -0
  231. package/src/queues/cli/commands/create.ts +25 -0
  232. package/src/queues/cli/commands/delete.ts +26 -0
  233. package/src/queues/cli/commands/index.ts +35 -0
  234. package/src/queues/cli/commands/list.ts +25 -0
  235. package/src/queues/client.ts +135 -0
  236. package/src/queues/utils.ts +18 -0
  237. package/src/r2/constants.ts +4 -0
  238. package/src/r2/helpers.ts +131 -0
  239. package/src/r2/index.ts +289 -0
  240. package/src/routes.ts +140 -0
  241. package/src/secret/index.ts +375 -0
  242. package/src/selfsigned.d.ts +23 -23
  243. package/src/sites.ts +372 -0
  244. package/src/tail/createTail.ts +406 -0
  245. package/src/tail/filters.ts +109 -111
  246. package/src/tail/index.ts +208 -296
  247. package/src/tail/printing.ts +101 -46
  248. package/src/tsconfig-sanity.ts +16 -0
  249. package/src/type-generation.ts +181 -0
  250. package/src/update-check.ts +11 -11
  251. package/src/user/access.ts +68 -0
  252. package/src/user/auth-variables.ts +113 -0
  253. package/src/user/choose-account.tsx +39 -0
  254. package/src/user/generate-auth-url.ts +33 -0
  255. package/src/user/generate-random-state.ts +16 -0
  256. package/src/user/index.ts +2 -0
  257. package/src/user/user.ts +1233 -0
  258. package/src/utils/collectKeyValues.ts +14 -0
  259. package/src/whoami.ts +135 -0
  260. package/src/worker.ts +183 -107
  261. package/src/yargs-types.ts +37 -0
  262. package/src/zones.ts +158 -40
  263. package/templates/__tests__/pages-dev-util.test.ts +128 -0
  264. package/templates/__tests__/tsconfig-sanity.ts +12 -0
  265. package/templates/__tests__/tsconfig.json +8 -0
  266. package/templates/__tests__/tsconfig.tsbuildinfo +1 -0
  267. package/templates/checked-fetch.js +23 -0
  268. package/templates/d1-beta-facade.js +241 -0
  269. package/templates/facade.d.ts +14 -0
  270. package/templates/first-party-worker-module-facade.ts +19 -0
  271. package/templates/format-dev-errors.ts +34 -0
  272. package/templates/init-tests/test-jest-new-worker.js +23 -0
  273. package/templates/init-tests/test-vitest-new-worker.js +24 -0
  274. package/templates/init-tests/test-vitest-new-worker.ts +25 -0
  275. package/templates/middleware/common.ts +62 -0
  276. package/templates/middleware/loader-modules.ts +84 -0
  277. package/templates/middleware/loader-sw.ts +233 -0
  278. package/templates/middleware/middleware-miniflare3-json-error.ts +20 -0
  279. package/templates/middleware/middleware-pretty-error.ts +40 -0
  280. package/templates/middleware/middleware-scheduled.ts +15 -0
  281. package/templates/new-worker-scheduled.js +3 -3
  282. package/templates/new-worker-scheduled.ts +15 -15
  283. package/templates/new-worker.js +3 -3
  284. package/templates/new-worker.ts +18 -15
  285. package/templates/no-op-worker.js +10 -0
  286. package/templates/pages-dev-pipeline.ts +31 -0
  287. package/templates/pages-dev-util.ts +52 -0
  288. package/templates/pages-shim.ts +12 -0
  289. package/templates/pages-template-plugin.ts +176 -0
  290. package/templates/pages-template-worker.ts +189 -0
  291. package/templates/serve-static-assets.ts +66 -0
  292. package/templates/service-bindings-module-facade.js +55 -0
  293. package/templates/service-bindings-sw-facade.js +42 -0
  294. package/templates/tsconfig-sanity.ts +11 -0
  295. package/templates/tsconfig.init.json +106 -0
  296. package/templates/tsconfig.json +6 -103
  297. package/templates/tsconfig.tsbuildinfo +1 -0
  298. package/wrangler-dist/cli.d.ts +1108 -0
  299. package/wrangler-dist/cli.js +109524 -90537
  300. package/wrangler-dist/wasm-sync.wasm +0 -0
  301. package/pages/functions/buildPlugin.ts +0 -105
  302. package/pages/functions/buildWorker.ts +0 -151
  303. package/pages/functions/filepath-routing.ts +0 -189
  304. package/pages/functions/identifiers.ts +0 -78
  305. package/pages/functions/routes.ts +0 -156
  306. package/pages/functions/template-plugin.ts +0 -147
  307. package/pages/functions/template-worker.ts +0 -143
  308. package/src/__tests__/helpers/faye-websocket.d.ts +0 -6
  309. package/src/__tests__/helpers/mock-cfetch.ts +0 -211
  310. package/src/__tests__/pages.test.ts +0 -754
  311. package/src/dialogs.tsx +0 -135
  312. package/src/environment-variables.ts +0 -35
  313. package/src/index.tsx +0 -2846
  314. package/src/kv.ts +0 -408
  315. package/src/miniflare-cli/enum-keys.ts +0 -17
  316. package/src/pages.tsx +0 -2093
  317. package/src/publish.ts +0 -716
  318. package/src/r2.ts +0 -50
  319. package/src/sites.tsx +0 -326
  320. package/src/user.tsx +0 -1214
  321. package/src/whoami.tsx +0 -71
  322. package/templates/static-asset-facade.js +0 -43
@@ -0,0 +1,1108 @@
1
+ /// <reference types="node" />
2
+
3
+ import { Blob as Blob_2 } from 'buffer';
4
+ import Dispatcher = require('./dispatcher');
5
+ import { ReadableStream } from 'stream/web';
6
+ import { URL as URL_2 } from 'url';
7
+ import { URLSearchParams as URLSearchParams_2 } from 'url';
8
+
9
+ declare interface BlobPropertyBag {
10
+ type?: string
11
+ endings?: 'native' | 'transparent'
12
+ }
13
+
14
+ declare type BodyInit =
15
+ | ArrayBuffer
16
+ | AsyncIterable<Uint8Array>
17
+ | Blob_2
18
+ | FormData
19
+ | Iterable<Uint8Array>
20
+ | NodeJS.ArrayBufferView
21
+ | URLSearchParams_2
22
+ | null
23
+ | string
24
+
25
+ declare interface BodyMixin {
26
+ readonly body: ReadableStream | null
27
+ readonly bodyUsed: boolean
28
+
29
+ readonly arrayBuffer: () => Promise<ArrayBuffer>
30
+ readonly blob: () => Promise<Blob_2>
31
+ readonly formData: () => Promise<FormData>
32
+ readonly json: () => Promise<unknown>
33
+ readonly text: () => Promise<string>
34
+ }
35
+
36
+ /**
37
+ * The possible types for a `Rule`.
38
+ */
39
+ declare type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data";
40
+
41
+ declare type CustomDomainRoute = {
42
+ pattern: string;
43
+ custom_domain: boolean;
44
+ };
45
+
46
+ export declare function deleteMTlsCertificate(accountId: string, certificateId: string): Promise<unknown>;
47
+
48
+ /**
49
+ * Deprecated upload configuration.
50
+ */
51
+ declare interface DeprecatedUpload {
52
+ /**
53
+ * The format of the Worker script.
54
+ *
55
+ * @deprecated We infer the format automatically now.
56
+ */
57
+ format?: "modules" | "service-worker";
58
+ /**
59
+ * The directory you wish to upload your worker from,
60
+ * relative to the wrangler.toml file.
61
+ *
62
+ * Defaults to the directory containing the wrangler.toml file.
63
+ *
64
+ * @deprecated
65
+ */
66
+ dir?: string;
67
+ /**
68
+ * The path to the Worker script, relative to `upload.dir`.
69
+ *
70
+ * @deprecated This will be replaced by a command line argument.
71
+ */
72
+ main?: string;
73
+ /**
74
+ * @deprecated This is now defined at the top level `rules` field.
75
+ */
76
+ rules?: Environment["rules"];
77
+ }
78
+
79
+ declare type DurableObjectBindings = {
80
+ /** The name of the binding used to refer to the Durable Object */
81
+ name: string;
82
+ /** The exported class name of the Durable Object */
83
+ class_name: string;
84
+ /** The script where the Durable Object is defined (if it's external to this worker) */
85
+ script_name?: string;
86
+ /** The service environment of the script_name to bind to */
87
+ environment?: string;
88
+ }[];
89
+
90
+ declare interface EnablePagesAssetsServiceBindingOptions {
91
+ proxyPort?: number;
92
+ directory?: string;
93
+ }
94
+
95
+ /**
96
+ * The `Environment` interface declares all the configuration fields that
97
+ * can be specified for an environment.
98
+ *
99
+ * This could be the top-level default environment, or a specific named environment.
100
+ */
101
+ declare interface Environment extends EnvironmentInheritable, EnvironmentNonInheritable {
102
+ }
103
+
104
+ /**
105
+ * The `EnvironmentInheritable` interface declares all the configuration fields for an environment
106
+ * that can be inherited (and overridden) from the top-level environment.
107
+ */
108
+ declare interface EnvironmentInheritable {
109
+ /**
110
+ * The name of your worker. Alphanumeric + dashes only.
111
+ *
112
+ * @inheritable
113
+ */
114
+ name: string | undefined;
115
+ /**
116
+ * This is the ID of the account associated with your zone.
117
+ * You might have more than one account, so make sure to use
118
+ * the ID of the account associated with the zone/route you
119
+ * provide, if you provide one. It can also be specified through
120
+ * the CLOUDFLARE_ACCOUNT_ID environment variable.
121
+ *
122
+ * @inheritable
123
+ */
124
+ account_id: string | undefined;
125
+ /**
126
+ * A date in the form yyyy-mm-dd, which will be used to determine
127
+ * which version of the Workers runtime is used.
128
+ *
129
+ * More details at https://developers.cloudflare.com/workers/platform/compatibility-dates
130
+ *
131
+ * @inheritable
132
+ */
133
+ compatibility_date: string | undefined;
134
+ /**
135
+ * A list of flags that enable features from upcoming features of
136
+ * the Workers runtime, usually used together with compatibility_flags.
137
+ *
138
+ * More details at https://developers.cloudflare.com/workers/platform/compatibility-dates
139
+ *
140
+ * @inheritable
141
+ */
142
+ compatibility_flags: string[];
143
+ /**
144
+ * The entrypoint/path to the JavaScript file that will be executed.
145
+ */
146
+ main: string | undefined;
147
+ /**
148
+ * Whether we use <name>.<subdomain>.workers.dev to
149
+ * test and deploy your worker.
150
+ *
151
+ * @default `true` (This is a breaking change from Wrangler v1)
152
+ * @breaking
153
+ * @inheritable
154
+ */
155
+ workers_dev: boolean | undefined;
156
+ /**
157
+ * A list of routes that your worker should be published to.
158
+ * Only one of `routes` or `route` is required.
159
+ *
160
+ * Only required when workers_dev is false, and there's no scheduled worker (see `triggers`)
161
+ *
162
+ * @inheritable
163
+ */
164
+ routes: Route[] | undefined;
165
+ /**
166
+ * A route that your worker should be published to. Literally
167
+ * the same as routes, but only one.
168
+ * Only one of `routes` or `route` is required.
169
+ *
170
+ * Only required when workers_dev is false, and there's no scheduled worker
171
+ *
172
+ * @inheritable
173
+ */
174
+ route: Route | undefined;
175
+ /**
176
+ * Path to a custom tsconfig
177
+ */
178
+ tsconfig: string | undefined;
179
+ /**
180
+ * The function to use to replace jsx syntax.
181
+ *
182
+ * @default `"React.createElement"`
183
+ * @inheritable
184
+ */
185
+ jsx_factory: string;
186
+ /**
187
+ * The function to use to replace jsx fragment syntax.
188
+ *
189
+ * @default `"React.Fragment"`
190
+ * @inheritable
191
+ */
192
+ jsx_fragment: string;
193
+ /**
194
+ * "Cron" definitions to trigger a worker's "scheduled" function.
195
+ *
196
+ * Lets you call workers periodically, much like a cron job.
197
+ *
198
+ * More details here https://developers.cloudflare.com/workers/platform/cron-triggers
199
+ *
200
+ * @default `{crons:[]}`
201
+ * @inheritable
202
+ */
203
+ triggers: {
204
+ crons: string[];
205
+ };
206
+ /**
207
+ * Specifies the Usage Model for your Worker. There are two options -
208
+ * [bundled](https://developers.cloudflare.com/workers/platform/limits#bundled-usage-model) and
209
+ * [unbound](https://developers.cloudflare.com/workers/platform/limits#unbound-usage-model).
210
+ * For newly created Workers, if the Usage Model is omitted
211
+ * it will be set to the [default Usage Model set on the account](https://dash.cloudflare.com/?account=workers/default-usage-model).
212
+ * For existing Workers, if the Usage Model is omitted, it will be
213
+ * set to the Usage Model configured in the dashboard for that Worker.
214
+ *
215
+ * @inheritable
216
+ */
217
+ usage_model: "bundled" | "unbound" | undefined;
218
+ /**
219
+ * An ordered list of rules that define which modules to import,
220
+ * and what type to import them as. You will need to specify rules
221
+ * to use Text, Data, and CompiledWasm modules, or when you wish to
222
+ * have a .js file be treated as an ESModule instead of CommonJS.
223
+ *
224
+ * @inheritable
225
+ */
226
+ rules: Rule[];
227
+ /**
228
+ * Configures a custom build step to be run by Wrangler when building your Worker.
229
+ *
230
+ * Refer to the [custom builds documentation](https://developers.cloudflare.com/workers/cli-wrangler/configuration#build)
231
+ * for more details.
232
+ *
233
+ * @default {}
234
+ */
235
+ build: {
236
+ /** 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. */
237
+ command?: string;
238
+ /** The directory in which the command is executed. */
239
+ cwd?: string;
240
+ /** The directory to watch for changes while using wrangler dev, defaults to the current working directory */
241
+ watch_dir?: string | string[];
242
+ /**
243
+ * Deprecated field previously used to configure the build and upload of the script.
244
+ * @deprecated
245
+ */
246
+ upload?: DeprecatedUpload;
247
+ };
248
+ /**
249
+ * Skip internal build steps and directly publish script
250
+ * @inheritable
251
+ */
252
+ no_bundle: boolean | undefined;
253
+ /**
254
+ * Minify the script before uploading.
255
+ * @inheritable
256
+ */
257
+ minify: boolean | undefined;
258
+ /**
259
+ * Add polyfills for node builtin modules and globals
260
+ * @inheritable
261
+ */
262
+ node_compat: boolean | undefined;
263
+ /**
264
+ * Specifies namespace bindings that are bound to this Worker environment.
265
+ *
266
+ * NOTE: This field is not automatically inherited from the top level environment,
267
+ * and so must be specified in every named environment.
268
+ *
269
+ * @default `[]`
270
+ * @nonInheritable
271
+ */
272
+ dispatch_namespaces: {
273
+ /** The binding name used to refer to the bound service. */
274
+ binding: string;
275
+ /** The namespace to bind to. */
276
+ namespace: string;
277
+ }[];
278
+ /**
279
+ * Designates this worker as an internal-only "first-party" worker.
280
+ */
281
+ first_party_worker: boolean | undefined;
282
+ /**
283
+ * TODO: remove this as it has been deprecated.
284
+ *
285
+ * This is just here for now because the `route` commands use it.
286
+ * So we need to include it in this type so it is available.
287
+ */
288
+ zone_id?: string;
289
+ /**
290
+ * Specify a compiled capnp schema to use
291
+ * Then add a binding per field in the top level message that you will send to logfwdr
292
+ *
293
+ * @default `{schema:undefined,bindings:[]}`
294
+ * @inheritable
295
+ */
296
+ logfwdr: {
297
+ /** capnp schema filename */
298
+ schema: string | undefined;
299
+ bindings: {
300
+ /** The binding name used to refer to logfwdr */
301
+ name: string;
302
+ /** The destination for this logged message */
303
+ destination: string;
304
+ }[];
305
+ };
306
+ /**
307
+ * Send Trace Events from this worker to Workers Logpush.
308
+ *
309
+ * This will not configure a corresponding Logpush job automatically.
310
+ *
311
+ * For more information about Workers Logpush, see:
312
+ * https://blog.cloudflare.com/logpush-for-workers/
313
+ *
314
+ * @inheritable
315
+ */
316
+ logpush: boolean | undefined;
317
+ }
318
+
319
+ /**
320
+ * The `EnvironmentNonInheritable` interface declares all the configuration fields for an environment
321
+ * that cannot be inherited from the top-level environment, and must be defined specifically.
322
+ *
323
+ * If any of these fields are defined at the top-level then they should also be specifically defined
324
+ * for each named environment.
325
+ */
326
+ declare interface EnvironmentNonInheritable {
327
+ /**
328
+ * A map of values to substitute when deploying your worker.
329
+ *
330
+ * NOTE: This field is not automatically inherited from the top level environment,
331
+ * and so must be specified in every named environment.
332
+ *
333
+ * @default `{}`
334
+ * @nonInheritable
335
+ */
336
+ define: Record<string, string>;
337
+ /**
338
+ * A map of environment variables to set when deploying your worker.
339
+ *
340
+ * NOTE: This field is not automatically inherited from the top level environment,
341
+ * and so must be specified in every named environment.
342
+ *
343
+ * @default `{}`
344
+ * @nonInheritable
345
+ */
346
+ vars: {
347
+ [key: string]: unknown;
348
+ };
349
+ /**
350
+ * A list of durable objects that your worker should be bound to.
351
+ *
352
+ * For more information about Durable Objects, see the documentation at
353
+ * https://developers.cloudflare.com/workers/learning/using-durable-objects
354
+ *
355
+ * NOTE: This field is not automatically inherited from the top level environment,
356
+ * and so must be specified in every named environment.
357
+ *
358
+ * @default `{bindings:[]}`
359
+ * @nonInheritable
360
+ */
361
+ durable_objects: {
362
+ bindings: DurableObjectBindings;
363
+ };
364
+ /**
365
+ * These specify any Workers KV Namespaces you want to
366
+ * access from inside your Worker.
367
+ *
368
+ * To learn more about KV Namespaces,
369
+ * see the documentation at https://developers.cloudflare.com/workers/learning/how-kv-works
370
+ *
371
+ * NOTE: This field is not automatically inherited from the top level environment,
372
+ * and so must be specified in every named environment.
373
+ *
374
+ * @default `[]`
375
+ * @nonInheritable
376
+ */
377
+ kv_namespaces: {
378
+ /** The binding name used to refer to the KV Namespace */
379
+ binding: string;
380
+ /** The ID of the KV namespace */
381
+ id: string;
382
+ /** The ID of the KV namespace used during `wrangler dev` */
383
+ preview_id?: string;
384
+ }[];
385
+ /**
386
+ * Specifies Queues that are bound to this Worker environment.
387
+ *
388
+ * NOTE: This field is not automatically inherited from the top level environment,
389
+ * and so must be specified in every named environment.
390
+ *
391
+ * @default `{}`
392
+ * @nonInheritable
393
+ */
394
+ queues: {
395
+ /** Producer bindings */
396
+ producers?: {
397
+ /** The binding name used to refer to the Queue in the worker. */
398
+ binding: string;
399
+ /** The name of this Queue. */
400
+ queue: string;
401
+ }[];
402
+ /** Consumer configuration */
403
+ consumers?: {
404
+ /** The name of the queue from which this script should consume. */
405
+ queue: string;
406
+ /** The maximum number of messages per batch */
407
+ max_batch_size?: number;
408
+ /** The maximum number of seconds to wait to fill a batch with messages. */
409
+ max_batch_timeout?: number;
410
+ /** The maximum number of retries for each message. */
411
+ max_retries?: number;
412
+ /** The queue to send messages that failed to be consumed. */
413
+ dead_letter_queue?: string;
414
+ }[];
415
+ };
416
+ /**
417
+ * Specifies R2 buckets that are bound to this Worker environment.
418
+ *
419
+ * NOTE: This field is not automatically inherited from the top level environment,
420
+ * and so must be specified in every named environment.
421
+ *
422
+ * @default `[]`
423
+ * @nonInheritable
424
+ */
425
+ r2_buckets: {
426
+ /** The binding name used to refer to the R2 bucket in the worker. */
427
+ binding: string;
428
+ /** The name of this R2 bucket at the edge. */
429
+ bucket_name: string;
430
+ /** The preview name of this R2 bucket at the edge. */
431
+ preview_bucket_name?: string;
432
+ }[];
433
+ /**
434
+ * Specifies D1 databases that are bound to this Worker environment.
435
+ *
436
+ * NOTE: This field is not automatically inherited from the top level environment,
437
+ * and so must be specified in every named environment.
438
+ *
439
+ * @default `[]`
440
+ * @nonInheritable
441
+ */
442
+ d1_databases: {
443
+ /** The binding name used to refer to the D1 database in the worker. */
444
+ binding: string;
445
+ /** The name of this D1 database. */
446
+ database_name: string;
447
+ /** The UUID of this D1 database (not required). */
448
+ database_id: string;
449
+ /** The UUID of this D1 database for Wrangler Dev (if specified). */
450
+ preview_database_id?: string;
451
+ /** The name of the migrations table for this D1 database (defaults to 'd1_migrations'). */
452
+ migrations_table?: string;
453
+ /** The path to the directory of migrations for this D1 database (defaults to './migrations'). */
454
+ migrations_dir?: string;
455
+ /** Internal use only. */
456
+ database_internal_env?: string;
457
+ }[];
458
+ /**
459
+ * Specifies service bindings (worker-to-worker) that are bound to this Worker environment.
460
+ *
461
+ * NOTE: This field is not automatically inherited from the top level environment,
462
+ * and so must be specified in every named environment.
463
+ *
464
+ * @default `[]`
465
+ * @nonInheritable
466
+ */
467
+ services: {
468
+ /** The binding name used to refer to the bound service. */
469
+ binding: string;
470
+ /** The name of the service. */
471
+ service: string;
472
+ /** The environment of the service (e.g. production, staging, etc). */
473
+ environment?: string;
474
+ }[] | undefined;
475
+ /**
476
+ * Specifies analytics engine datasets that are bound to this Worker environment.
477
+ *
478
+ * NOTE: This field is not automatically inherited from the top level environment,
479
+ * and so must be specified in every named environment.
480
+ *
481
+ * @default `[]`
482
+ * @nonInheritable
483
+ */
484
+ analytics_engine_datasets: {
485
+ /** The binding name used to refer to the dataset in the worker. */
486
+ binding: string;
487
+ /** The name of this dataset to write to. */
488
+ dataset?: string;
489
+ }[];
490
+ /**
491
+ * "Unsafe" tables for features that aren't directly supported by wrangler.
492
+ *
493
+ * NOTE: This field is not automatically inherited from the top level environment,
494
+ * and so must be specified in every named environment.
495
+ *
496
+ * @default `{ bindings: [] }`
497
+ * @nonInheritable
498
+ */
499
+ unsafe: {
500
+ /**
501
+ * A set of bindings that should be put into a Worker's upload metadata without changes. These
502
+ * can be used to implement bindings for features that haven't released and aren't supported
503
+ * directly by wrangler or miniflare.
504
+ *
505
+ * @default []
506
+ */
507
+ bindings: {
508
+ name: string;
509
+ type: string;
510
+ [key: string]: unknown;
511
+ }[];
512
+ };
513
+ mtls_certificates: {
514
+ /** The binding name used to refer to the certificate in the worker */
515
+ binding: string;
516
+ /** The uuid of the uploaded mTLS certificate */
517
+ certificate_id: string;
518
+ }[];
519
+ }
520
+
521
+ declare class File extends Blob_2 {
522
+ /**
523
+ * Creates a new File instance.
524
+ *
525
+ * @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).
526
+ * @param fileName The name of the file.
527
+ * @param options An options object containing optional attributes for the file.
528
+ */
529
+ constructor(fileBits: ReadonlyArray<string | NodeJS.ArrayBufferView | Blob_2>, fileName: string, options?: FilePropertyBag)
530
+
531
+ /**
532
+ * Name of the file referenced by the File object.
533
+ */
534
+ readonly name: string
535
+
536
+ /**
537
+ * 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.
538
+ */
539
+ readonly lastModified: number
540
+
541
+ readonly [Symbol.toStringTag]: string
542
+ }
543
+
544
+ declare interface FilePropertyBag extends BlobPropertyBag {
545
+ /**
546
+ * 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.
547
+ */
548
+ lastModified?: number
549
+ }
550
+
551
+ /**
552
+ * 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().
553
+ */
554
+ declare class FormData {
555
+ /**
556
+ * Appends a new value onto an existing key inside a FormData object,
557
+ * or adds the key if it does not already exist.
558
+ *
559
+ * 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.
560
+ *
561
+ * @param name The name of the field whose data is contained in `value`.
562
+ * @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
563
+ 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.
564
+ * @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.
565
+ */
566
+ append(name: string, value: unknown, fileName?: string): void
567
+
568
+ /**
569
+ * Set a new value for an existing key inside FormData,
570
+ * or add the new field if it does not already exist.
571
+ *
572
+ * @param name The name of the field whose data is contained in `value`.
573
+ * @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
574
+ 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.
575
+ * @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.
576
+ *
577
+ */
578
+ set(name: string, value: unknown, fileName?: string): void
579
+
580
+ /**
581
+ * Returns the first value associated with a given key from within a `FormData` object.
582
+ * If you expect multiple values and want all of them, use the `getAll()` method instead.
583
+ *
584
+ * @param {string} name A name of the value you want to retrieve.
585
+ *
586
+ * @returns A `FormDataEntryValue` containing the value. If the key doesn't exist, the method returns null.
587
+ */
588
+ get(name: string): FormDataEntryValue | null
589
+
590
+ /**
591
+ * Returns all the values associated with a given key from within a `FormData` object.
592
+ *
593
+ * @param {string} name A name of the value you want to retrieve.
594
+ *
595
+ * @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.
596
+ */
597
+ getAll(name: string): FormDataEntryValue[]
598
+
599
+ /**
600
+ * Returns a boolean stating whether a `FormData` object contains a certain key.
601
+ *
602
+ * @param name A string representing the name of the key you want to test for.
603
+ *
604
+ * @return A boolean value.
605
+ */
606
+ has(name: string): boolean
607
+
608
+ /**
609
+ * Deletes a key and its value(s) from a `FormData` object.
610
+ *
611
+ * @param name The name of the key you want to delete.
612
+ */
613
+ delete(name: string): void
614
+
615
+ /**
616
+ * Executes given callback function for each field of the FormData instance
617
+ */
618
+ forEach: (
619
+ callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData) => void,
620
+ thisArg?: unknown
621
+ ) => void
622
+
623
+ /**
624
+ * 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.
625
+ * Each key is a `string`.
626
+ */
627
+ keys: () => SpecIterableIterator<string>
628
+
629
+ /**
630
+ * 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.
631
+ * Each value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
632
+ */
633
+ values: () => SpecIterableIterator<FormDataEntryValue>
634
+
635
+ /**
636
+ * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through the `FormData` key/value pairs.
637
+ * The key of each pair is a string; the value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue).
638
+ */
639
+ entries: () => SpecIterableIterator<[string, FormDataEntryValue]>
640
+
641
+ /**
642
+ * An alias for FormData#entries()
643
+ */
644
+ [Symbol.iterator]: () => SpecIterableIterator<[string, FormDataEntryValue]>
645
+
646
+ readonly [Symbol.toStringTag]: string
647
+ }
648
+
649
+ /**
650
+ * A `string` or `File` that represents a single value from a set of `FormData` key-value pairs.
651
+ */
652
+ declare type FormDataEntryValue = string | File
653
+
654
+ /**
655
+ * fetches an mTLS certificate from the account mTLS certificate store by ID
656
+ */
657
+ export declare function getMTlsCertificate(accountId: string, id: string): Promise<MTlsCertificateResponse>;
658
+
659
+ /**
660
+ * 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
661
+ */
662
+ export declare function getMTlsCertificateByName(accountId: string, name: string): Promise<MTlsCertificateResponse>;
663
+
664
+ declare class Headers implements SpecIterable<[string, string]> {
665
+ constructor (init?: HeadersInit)
666
+ readonly append: (name: string, value: string) => void
667
+ readonly delete: (name: string) => void
668
+ readonly get: (name: string) => string | null
669
+ readonly has: (name: string) => boolean
670
+ readonly set: (name: string, value: string) => void
671
+ readonly forEach: (
672
+ callbackfn: (value: string, key: string, iterable: Headers) => void,
673
+ thisArg?: unknown
674
+ ) => void
675
+
676
+ readonly keys: () => SpecIterableIterator<string>
677
+ readonly values: () => SpecIterableIterator<string>
678
+ readonly entries: () => SpecIterableIterator<[string, string]>
679
+ readonly [Symbol.iterator]: () => SpecIterator<[string, string]>
680
+ }
681
+
682
+ declare type HeadersInit = string[][] | Record<string, string | ReadonlyArray<string>> | Headers
683
+
684
+ /**
685
+ * lists mTLS certificates for an account. filtering by name is supported
686
+ */
687
+ export declare function listMTlsCertificates(accountId: string, filter: MTlsCertificateListFilter): Promise<MTlsCertificateResponse[]>;
688
+
689
+ /**
690
+ * details for uploading an mTLS certificate via the ssl api
691
+ */
692
+ declare interface MTlsCertificateBody {
693
+ certificateChain: string;
694
+ privateKey: string;
695
+ name?: string;
696
+ }
697
+
698
+ /**
699
+ * supported filters for listing mTLS certificates via the ssl api
700
+ */
701
+ declare interface MTlsCertificateListFilter {
702
+ name?: string;
703
+ }
704
+
705
+ /**
706
+ * the representation of an mTLS certificate in the account certificate store
707
+ */
708
+ declare interface MTlsCertificateResponse {
709
+ id: string;
710
+ name?: string;
711
+ ca: boolean;
712
+ certificates: string;
713
+ expires_on: string;
714
+ issuer: string;
715
+ serial_number: string;
716
+ signature: string;
717
+ uploaded_on: string;
718
+ }
719
+
720
+ /**
721
+ * details for uploading an mTLS certificate from disk
722
+ */
723
+ declare interface MTlsCertificateUploadDetails {
724
+ certificateChainFilename: string;
725
+ privateKeyFilename: string;
726
+ name?: string;
727
+ }
728
+
729
+ declare interface PagesPublishOptions {
730
+ /**
731
+ * Path to static assets to publish to Pages
732
+ */
733
+ directory: string;
734
+ /**
735
+ * The Cloudflare Account ID that owns the project that's
736
+ * being published
737
+ */
738
+ accountId: string;
739
+ /**
740
+ * The name of the project to be published
741
+ */
742
+ projectName: string;
743
+ /**
744
+ * Branch name to use. Defaults to production branch
745
+ */
746
+ branch?: string;
747
+ /**
748
+ * Whether or not to skip local file upload result caching
749
+ */
750
+ skipCaching?: boolean;
751
+ /**
752
+ * Commit message associated to deployment
753
+ */
754
+ commitMessage?: string;
755
+ /**
756
+ * Commit hash associated to deployment
757
+ */
758
+ commitHash?: string;
759
+ /**
760
+ * Whether or not the deployment should be considered to be
761
+ * in a dirty commit state
762
+ */
763
+ commitDirty?: boolean;
764
+ /**
765
+ * Path to the project's functions directory. Default uses
766
+ * the current working directory + /functions since this is
767
+ * typically called in a CLI
768
+ */
769
+ functionsDirectory?: string;
770
+ /**
771
+ * Whether to run bundling on `_worker.js` before deploying.
772
+ * Default: false
773
+ */
774
+ 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
+ }
783
+
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
+ declare type ReferrerPolicy =
853
+ | ''
854
+ | 'no-referrer'
855
+ | 'no-referrer-when-downgrade'
856
+ | 'origin'
857
+ | 'origin-when-cross-origin'
858
+ | 'same-origin'
859
+ | 'strict-origin'
860
+ | 'strict-origin-when-cross-origin'
861
+ | 'unsafe-url';
862
+
863
+ declare class Request implements BodyMixin {
864
+ constructor (input: RequestInfo, init?: RequestInit)
865
+
866
+ readonly cache: RequestCache
867
+ readonly credentials: RequestCredentials
868
+ readonly destination: RequestDestination
869
+ readonly headers: Headers
870
+ readonly integrity: string
871
+ readonly method: string
872
+ readonly mode: RequestMode
873
+ readonly redirect: RequestRedirect
874
+ readonly referrerPolicy: string
875
+ readonly url: string
876
+
877
+ readonly keepalive: boolean
878
+ readonly signal: AbortSignal
879
+
880
+ readonly body: ReadableStream | null
881
+ readonly bodyUsed: boolean
882
+
883
+ readonly arrayBuffer: () => Promise<ArrayBuffer>
884
+ readonly blob: () => Promise<Blob_2>
885
+ readonly formData: () => Promise<FormData>
886
+ readonly json: () => Promise<unknown>
887
+ readonly text: () => Promise<string>
888
+
889
+ readonly clone: () => Request
890
+ }
891
+
892
+ declare type RequestCache =
893
+ | 'default'
894
+ | 'force-cache'
895
+ | 'no-cache'
896
+ | 'no-store'
897
+ | 'only-if-cached'
898
+ | 'reload'
899
+
900
+ declare type RequestCredentials = 'omit' | 'include' | 'same-origin'
901
+
902
+ declare type RequestDestination =
903
+ | ''
904
+ | 'audio'
905
+ | 'audioworklet'
906
+ | 'document'
907
+ | 'embed'
908
+ | 'font'
909
+ | 'image'
910
+ | 'manifest'
911
+ | 'object'
912
+ | 'paintworklet'
913
+ | 'report'
914
+ | 'script'
915
+ | 'sharedworker'
916
+ | 'style'
917
+ | 'track'
918
+ | 'video'
919
+ | 'worker'
920
+ | 'xslt'
921
+
922
+ declare type RequestInfo = string | URL_2 | Request
923
+
924
+ declare interface RequestInit {
925
+ method?: string
926
+ keepalive?: boolean
927
+ headers?: HeadersInit
928
+ body?: BodyInit
929
+ redirect?: RequestRedirect
930
+ integrity?: string
931
+ signal?: AbortSignal
932
+ credentials?: RequestCredentials
933
+ mode?: RequestMode
934
+ referrer?: string
935
+ referrerPolicy?: ReferrerPolicy
936
+ window?: null
937
+ dispatcher?: Dispatcher
938
+ }
939
+
940
+ declare type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin'
941
+
942
+ declare type RequestRedirect = 'error' | 'follow' | 'manual'
943
+
944
+ declare class Response implements BodyMixin {
945
+ constructor (body?: BodyInit, init?: ResponseInit)
946
+
947
+ readonly headers: Headers
948
+ readonly ok: boolean
949
+ readonly status: number
950
+ readonly statusText: string
951
+ readonly type: ResponseType
952
+ readonly url: string
953
+ readonly redirected: boolean
954
+
955
+ readonly body: ReadableStream | null
956
+ readonly bodyUsed: boolean
957
+
958
+ readonly arrayBuffer: () => Promise<ArrayBuffer>
959
+ readonly blob: () => Promise<Blob_2>
960
+ readonly formData: () => Promise<FormData>
961
+ readonly json: () => Promise<unknown>
962
+ readonly text: () => Promise<string>
963
+
964
+ readonly clone: () => Response
965
+
966
+ static error (): Response
967
+ static json(data: any, init?: ResponseInit): Response
968
+ static redirect (url: string | URL_2, status: ResponseRedirectStatus): Response
969
+ }
970
+
971
+ declare interface ResponseInit {
972
+ readonly status?: number
973
+ readonly statusText?: string
974
+ readonly headers?: HeadersInit
975
+ }
976
+
977
+ declare type ResponseRedirectStatus = 301 | 302 | 303 | 307 | 308
978
+
979
+ declare type ResponseType =
980
+ | 'basic'
981
+ | 'cors'
982
+ | 'default'
983
+ | 'error'
984
+ | 'opaque'
985
+ | 'opaqueredirect'
986
+
987
+ declare type Route = SimpleRoute | ZoneIdRoute | ZoneNameRoute | CustomDomainRoute;
988
+
989
+ /**
990
+ * A bundling resolver rule, defining the modules type for paths that match the specified globs.
991
+ */
992
+ declare type Rule = {
993
+ type: ConfigModuleRuleType;
994
+ globs: string[];
995
+ fallthrough?: boolean;
996
+ };
997
+
998
+ declare type SimpleRoute = string;
999
+
1000
+ declare interface SpecIterable<T> {
1001
+ [Symbol.iterator](): SpecIterator<T>;
1002
+ }
1003
+
1004
+ declare interface SpecIterableIterator<T> extends SpecIterator<T> {
1005
+ [Symbol.iterator](): SpecIterableIterator<T>;
1006
+ }
1007
+
1008
+ declare interface SpecIterator<T, TReturn = any, TNext = undefined> {
1009
+ next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
1010
+ }
1011
+
1012
+ /**
1013
+ * unstable_dev starts a wrangler dev server, and returns a promise that resolves with utility functions to interact with it.
1014
+ */
1015
+ export declare function unstable_dev(script: string, options?: UnstableDevOptions, apiOptions?: unknown): Promise<UnstableDevWorker>;
1016
+
1017
+ export declare const unstable_pages: {
1018
+ publish: typeof publish;
1019
+ };
1020
+
1021
+ export declare interface UnstableDevOptions {
1022
+ config?: string;
1023
+ env?: string;
1024
+ ip?: string;
1025
+ port?: number;
1026
+ bundle?: boolean;
1027
+ inspectorPort?: number;
1028
+ localProtocol?: "http" | "https";
1029
+ assets?: string;
1030
+ site?: string;
1031
+ siteInclude?: string[];
1032
+ siteExclude?: string[];
1033
+ nodeCompat?: boolean;
1034
+ compatibilityDate?: string;
1035
+ compatibilityFlags?: string[];
1036
+ persist?: boolean;
1037
+ persistTo?: string;
1038
+ vars?: {
1039
+ [key: string]: unknown;
1040
+ };
1041
+ kv?: {
1042
+ binding: string;
1043
+ id: string;
1044
+ preview_id?: string;
1045
+ }[];
1046
+ durableObjects?: {
1047
+ name: string;
1048
+ class_name: string;
1049
+ script_name?: string | undefined;
1050
+ environment?: string | undefined;
1051
+ }[];
1052
+ r2?: {
1053
+ binding: string;
1054
+ bucket_name: string;
1055
+ preview_bucket_name?: string;
1056
+ }[];
1057
+ logLevel?: "none" | "info" | "error" | "log" | "warn" | "debug";
1058
+ logPrefix?: string;
1059
+ inspect?: boolean;
1060
+ local?: boolean;
1061
+ accountId?: string;
1062
+ experimental?: {
1063
+ d1Databases?: Environment["d1_databases"];
1064
+ disableExperimentalWarning?: boolean;
1065
+ disableDevRegistry?: boolean;
1066
+ enablePagesAssetsServiceBinding?: EnablePagesAssetsServiceBindingOptions;
1067
+ experimentalLocal?: boolean;
1068
+ experimentalLocalRemoteKv?: boolean;
1069
+ forceLocal?: boolean;
1070
+ liveReload?: boolean;
1071
+ showInteractiveDevSession?: boolean;
1072
+ testMode?: boolean;
1073
+ testScheduled?: boolean;
1074
+ watch?: boolean;
1075
+ };
1076
+ }
1077
+
1078
+ export declare interface UnstableDevWorker {
1079
+ port: number;
1080
+ address: string;
1081
+ stop: () => Promise<void>;
1082
+ fetch: (input?: RequestInfo, init?: RequestInit) => Promise<Response>;
1083
+ waitUntilExit: () => Promise<void>;
1084
+ }
1085
+
1086
+ /**
1087
+ * uploads an mTLS certificate and private key pair to the account mTLS certificate store
1088
+ */
1089
+ export declare function uploadMTlsCertificate(accountId: string, body: MTlsCertificateBody): Promise<MTlsCertificateResponse>;
1090
+
1091
+ /**
1092
+ * reads an mTLS certificate and private key pair from disk and uploads it to the account mTLS certificate store
1093
+ */
1094
+ export declare function uploadMTlsCertificateFromFs(accountId: string, details: MTlsCertificateUploadDetails): Promise<MTlsCertificateResponse>;
1095
+
1096
+ declare type ZoneIdRoute = {
1097
+ pattern: string;
1098
+ zone_id: string;
1099
+ custom_domain?: boolean;
1100
+ };
1101
+
1102
+ declare type ZoneNameRoute = {
1103
+ pattern: string;
1104
+ zone_name: string;
1105
+ custom_domain?: boolean;
1106
+ };
1107
+
1108
+ export { }