devflare 1.0.0-next.14 → 1.0.0-next.16

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 (380) hide show
  1. package/LLM.md +9360 -1784
  2. package/README.md +391 -32
  3. package/bin/devflare.js +17 -7
  4. package/dist/account-0w8wdzjv.js +475 -0
  5. package/dist/account-eygq6qx7.js +475 -0
  6. package/dist/account-fw8nafav.js +475 -0
  7. package/dist/account-pzq69nys.js +475 -0
  8. package/dist/account-s66jb15j.js +475 -0
  9. package/dist/api-d6ekexs5.js +25 -0
  10. package/dist/bridge/index.d.ts +1 -1
  11. package/dist/bridge/index.d.ts.map +1 -1
  12. package/dist/bridge/miniflare.d.ts.map +1 -1
  13. package/dist/bridge/protocol.d.ts +1 -1
  14. package/dist/bridge/protocol.d.ts.map +1 -1
  15. package/dist/bridge/proxy.d.ts +0 -4
  16. package/dist/bridge/proxy.d.ts.map +1 -1
  17. package/dist/bridge/serialization.d.ts.map +1 -1
  18. package/dist/bridge/server.d.ts +1 -1
  19. package/dist/bridge/server.d.ts.map +1 -1
  20. package/dist/browser-shim/handler.d.ts +1 -1
  21. package/dist/browser-shim/handler.d.ts.map +1 -1
  22. package/dist/browser.d.ts +1651 -34
  23. package/dist/browser.d.ts.map +1 -1
  24. package/dist/build-1kmkwqgh.js +53 -0
  25. package/dist/build-506kjhcm.js +53 -0
  26. package/dist/build-66866ahs.js +53 -0
  27. package/dist/build-g1adm3ww.js +53 -0
  28. package/dist/build-p3r3117t.js +53 -0
  29. package/dist/bundler/do-bundler.d.ts.map +1 -1
  30. package/dist/bundler/rolldown-shared.d.ts +24 -0
  31. package/dist/bundler/rolldown-shared.d.ts.map +1 -0
  32. package/dist/bundler/worker-bundler.d.ts +0 -1
  33. package/dist/bundler/worker-bundler.d.ts.map +1 -1
  34. package/dist/cli/command-utils.d.ts +18 -0
  35. package/dist/cli/command-utils.d.ts.map +1 -0
  36. package/dist/cli/commands/account.d.ts +1 -1
  37. package/dist/cli/commands/account.d.ts.map +1 -1
  38. package/dist/cli/commands/build-artifacts.d.ts +27 -0
  39. package/dist/cli/commands/build-artifacts.d.ts.map +1 -0
  40. package/dist/cli/commands/build.d.ts.map +1 -1
  41. package/dist/cli/commands/config.d.ts +4 -0
  42. package/dist/cli/commands/config.d.ts.map +1 -0
  43. package/dist/cli/commands/deploy.d.ts.map +1 -1
  44. package/dist/cli/commands/dev.d.ts.map +1 -1
  45. package/dist/cli/commands/doctor.d.ts.map +1 -1
  46. package/dist/cli/commands/init.d.ts.map +1 -1
  47. package/dist/cli/commands/login.d.ts +4 -0
  48. package/dist/cli/commands/login.d.ts.map +1 -0
  49. package/dist/cli/commands/previews-support/cleanup.d.ts +9 -0
  50. package/dist/cli/commands/previews-support/cleanup.d.ts.map +1 -0
  51. package/dist/cli/commands/previews-support/family.d.ts +10 -0
  52. package/dist/cli/commands/previews-support/family.d.ts.map +1 -0
  53. package/dist/cli/commands/previews-support/render.d.ts +8 -0
  54. package/dist/cli/commands/previews-support/render.d.ts.map +1 -0
  55. package/dist/cli/commands/previews-support/theme.d.ts +10 -0
  56. package/dist/cli/commands/previews-support/theme.d.ts.map +1 -0
  57. package/dist/cli/commands/previews-support/types.d.ts +70 -0
  58. package/dist/cli/commands/previews-support/types.d.ts.map +1 -0
  59. package/dist/cli/commands/previews.d.ts +4 -0
  60. package/dist/cli/commands/previews.d.ts.map +1 -0
  61. package/dist/cli/commands/productions.d.ts +4 -0
  62. package/dist/cli/commands/productions.d.ts.map +1 -0
  63. package/dist/cli/commands/token.d.ts +4 -0
  64. package/dist/cli/commands/token.d.ts.map +1 -0
  65. package/dist/cli/commands/type-generation/discovery.d.ts +7 -0
  66. package/dist/cli/commands/type-generation/discovery.d.ts.map +1 -0
  67. package/dist/cli/commands/type-generation/generator.d.ts +44 -0
  68. package/dist/cli/commands/type-generation/generator.d.ts.map +1 -0
  69. package/dist/cli/commands/type-generation/models.d.ts +27 -0
  70. package/dist/cli/commands/type-generation/models.d.ts.map +1 -0
  71. package/dist/cli/commands/types.d.ts.map +1 -1
  72. package/dist/cli/commands/worker.d.ts +4 -0
  73. package/dist/cli/commands/worker.d.ts.map +1 -0
  74. package/dist/cli/config-path.d.ts +2 -1
  75. package/dist/cli/config-path.d.ts.map +1 -1
  76. package/dist/cli/deploy-strategy.d.ts +17 -0
  77. package/dist/cli/deploy-strategy.d.ts.map +1 -0
  78. package/dist/cli/deploy-target.d.ts +17 -0
  79. package/dist/cli/deploy-target.d.ts.map +1 -0
  80. package/dist/cli/generated-artifacts.d.ts +12 -0
  81. package/dist/cli/generated-artifacts.d.ts.map +1 -0
  82. package/dist/cli/help-pages/pages/account.d.ts +3 -0
  83. package/dist/cli/help-pages/pages/account.d.ts.map +1 -0
  84. package/dist/cli/help-pages/pages/core.d.ts +4 -0
  85. package/dist/cli/help-pages/pages/core.d.ts.map +1 -0
  86. package/dist/cli/help-pages/pages/index.d.ts +3 -0
  87. package/dist/cli/help-pages/pages/index.d.ts.map +1 -0
  88. package/dist/cli/help-pages/pages/misc.d.ts +3 -0
  89. package/dist/cli/help-pages/pages/misc.d.ts.map +1 -0
  90. package/dist/cli/help-pages/pages/previews.d.ts +3 -0
  91. package/dist/cli/help-pages/pages/previews.d.ts.map +1 -0
  92. package/dist/cli/help-pages/pages/productions.d.ts +3 -0
  93. package/dist/cli/help-pages/pages/productions.d.ts.map +1 -0
  94. package/dist/cli/help-pages/render.d.ts +12 -0
  95. package/dist/cli/help-pages/render.d.ts.map +1 -0
  96. package/dist/cli/help-pages/shared.d.ts +15 -0
  97. package/dist/cli/help-pages/shared.d.ts.map +1 -0
  98. package/dist/cli/help-pages/types.d.ts +23 -0
  99. package/dist/cli/help-pages/types.d.ts.map +1 -0
  100. package/dist/cli/help.d.ts +6 -0
  101. package/dist/cli/help.d.ts.map +1 -0
  102. package/dist/cli/index.d.ts +1 -0
  103. package/dist/cli/index.d.ts.map +1 -1
  104. package/dist/cli/preview-bindings.d.ts +42 -0
  105. package/dist/cli/preview-bindings.d.ts.map +1 -0
  106. package/dist/cli/preview.d.ts +11 -0
  107. package/dist/cli/preview.d.ts.map +1 -0
  108. package/dist/cli/ui.d.ts +37 -0
  109. package/dist/cli/ui.d.ts.map +1 -0
  110. package/dist/cli/workspace-build-guard.d.ts +14 -0
  111. package/dist/cli/workspace-build-guard.d.ts.map +1 -0
  112. package/dist/cloudflare/account-core.d.ts +6 -0
  113. package/dist/cloudflare/account-core.d.ts.map +1 -0
  114. package/dist/cloudflare/account-resources.d.ts +40 -0
  115. package/dist/cloudflare/account-resources.d.ts.map +1 -0
  116. package/dist/cloudflare/account-status.d.ts +11 -0
  117. package/dist/cloudflare/account-status.d.ts.map +1 -0
  118. package/dist/cloudflare/account-workers.d.ts +14 -0
  119. package/dist/cloudflare/account-workers.d.ts.map +1 -0
  120. package/dist/cloudflare/account.d.ts +7 -64
  121. package/dist/cloudflare/account.d.ts.map +1 -1
  122. package/dist/cloudflare/api.d.ts +4 -0
  123. package/dist/cloudflare/api.d.ts.map +1 -1
  124. package/dist/cloudflare/index.d.ts +57 -2
  125. package/dist/cloudflare/index.d.ts.map +1 -1
  126. package/dist/cloudflare/kv-namespace.d.ts +3 -0
  127. package/dist/cloudflare/kv-namespace.d.ts.map +1 -0
  128. package/dist/cloudflare/preferences.d.ts.map +1 -1
  129. package/dist/cloudflare/preview-registry-cache.d.ts +6 -0
  130. package/dist/cloudflare/preview-registry-cache.d.ts.map +1 -0
  131. package/dist/cloudflare/preview-registry-records.d.ts +61 -0
  132. package/dist/cloudflare/preview-registry-records.d.ts.map +1 -0
  133. package/dist/cloudflare/preview-registry-store.d.ts +14 -0
  134. package/dist/cloudflare/preview-registry-store.d.ts.map +1 -0
  135. package/dist/cloudflare/preview-registry-types.d.ts +103 -0
  136. package/dist/cloudflare/preview-registry-types.d.ts.map +1 -0
  137. package/dist/cloudflare/preview-registry.d.ts +42 -0
  138. package/dist/cloudflare/preview-registry.d.ts.map +1 -0
  139. package/dist/cloudflare/registry-schema.d.ts +253 -0
  140. package/dist/cloudflare/registry-schema.d.ts.map +1 -0
  141. package/dist/cloudflare/tokens.d.ts +18 -0
  142. package/dist/cloudflare/tokens.d.ts.map +1 -0
  143. package/dist/cloudflare/types.d.ts +122 -5
  144. package/dist/cloudflare/types.d.ts.map +1 -1
  145. package/dist/cloudflare/usage.d.ts.map +1 -1
  146. package/dist/config/compiler.d.ts +4 -0
  147. package/dist/config/compiler.d.ts.map +1 -1
  148. package/dist/config/framework-providers.d.ts +9 -0
  149. package/dist/config/framework-providers.d.ts.map +1 -0
  150. package/dist/config/index.d.ts +5 -3
  151. package/dist/config/index.d.ts.map +1 -1
  152. package/dist/config/loader.d.ts +1 -0
  153. package/dist/config/loader.d.ts.map +1 -1
  154. package/dist/config/preview-resources.d.ts +77 -0
  155. package/dist/config/preview-resources.d.ts.map +1 -0
  156. package/dist/config/preview.d.ts +31 -0
  157. package/dist/config/preview.d.ts.map +1 -0
  158. package/dist/config/ref.d.ts +0 -22
  159. package/dist/config/ref.d.ts.map +1 -1
  160. package/dist/config/resolve.d.ts +1 -0
  161. package/dist/config/resolve.d.ts.map +1 -1
  162. package/dist/config/resource-resolution.d.ts +60 -0
  163. package/dist/config/resource-resolution.d.ts.map +1 -0
  164. package/dist/config/schema-bindings.d.ts +693 -0
  165. package/dist/config/schema-bindings.d.ts.map +1 -0
  166. package/dist/config/schema-build.d.ts +67 -0
  167. package/dist/config/schema-build.d.ts.map +1 -0
  168. package/dist/config/schema-env.d.ts +1341 -0
  169. package/dist/config/schema-env.d.ts.map +1 -0
  170. package/dist/config/schema-normalization.d.ts +64 -0
  171. package/dist/config/schema-normalization.d.ts.map +1 -0
  172. package/dist/config/schema-runtime.d.ts +230 -0
  173. package/dist/config/schema-runtime.d.ts.map +1 -0
  174. package/dist/config/schema.d.ts +640 -3669
  175. package/dist/config/schema.d.ts.map +1 -1
  176. package/dist/config-entry.d.ts +5 -0
  177. package/dist/config-entry.d.ts.map +1 -0
  178. package/dist/config-fjwke42y.js +59 -0
  179. package/dist/config-hwdqjse7.js +59 -0
  180. package/dist/config-pxvewrhv.js +59 -0
  181. package/dist/config-q0g5qdga.js +59 -0
  182. package/dist/decorators/durable-object.d.ts.map +1 -1
  183. package/dist/deploy-7nmzc9r8.js +609 -0
  184. package/dist/deploy-csfhdr64.js +691 -0
  185. package/dist/deploy-ex4g5avz.js +621 -0
  186. package/dist/deploy-jnb0bhka.js +609 -0
  187. package/dist/deploy-tp0g6qdp.js +609 -0
  188. package/dist/deploy-ykpcjkc2.js +690 -0
  189. package/dist/{dev-c1xc1gq9.js → dev-2pd33m28.js} +392 -348
  190. package/dist/dev-7ef5e2j1.js +2409 -0
  191. package/dist/dev-8nssqatr.js +2409 -0
  192. package/dist/dev-grznx8fn.js +2409 -0
  193. package/dist/dev-server/d1-migrations.d.ts +14 -0
  194. package/dist/dev-server/d1-migrations.d.ts.map +1 -0
  195. package/dist/dev-server/gateway-script.d.ts +8 -0
  196. package/dist/dev-server/gateway-script.d.ts.map +1 -0
  197. package/dist/dev-server/runtime-stdio.d.ts.map +1 -1
  198. package/dist/dev-server/server.d.ts.map +1 -1
  199. package/dist/dev-server/vite-process.d.ts +14 -0
  200. package/dist/dev-server/vite-process.d.ts.map +1 -0
  201. package/dist/dev-server/vite-utils.d.ts +1 -1
  202. package/dist/dev-server/vite-utils.d.ts.map +1 -1
  203. package/dist/dev-server/worker-source-watcher.d.ts +11 -0
  204. package/dist/dev-server/worker-source-watcher.d.ts.map +1 -0
  205. package/dist/dev-server/worker-surface-paths.d.ts +6 -0
  206. package/dist/dev-server/worker-surface-paths.d.ts.map +1 -0
  207. package/dist/{doctor-z4ffybce.js → doctor-04ammrrh.js} +67 -31
  208. package/dist/doctor-fmjj65mc.js +245 -0
  209. package/dist/doctor-fzkznce1.js +245 -0
  210. package/dist/doctor-sa5xv1bz.js +245 -0
  211. package/dist/index-091sh1ma.js +1229 -0
  212. package/dist/index-0apbm26n.js +788 -0
  213. package/dist/index-0eqksag4.js +418 -0
  214. package/dist/{index-dr6sbp8d.js → index-0kfzdywd.js} +15 -2
  215. package/dist/index-0w826dsr.js +379 -0
  216. package/dist/{index-rfhx0yd5.js → index-11m5a8wd.js} +110 -32
  217. package/dist/{index-xxwbb2nt.js → index-1sp39f2f.js} +114 -58
  218. package/dist/index-2jnrqbny.js +1301 -0
  219. package/dist/index-2pb7b9mw.js +378 -0
  220. package/dist/{index-0kzg8wed.js → index-2x53aqjm.js} +1071 -890
  221. package/dist/index-3ke5d2vn.js +1229 -0
  222. package/dist/index-43dq8yx8.js +788 -0
  223. package/dist/index-4rrttqj5.js +378 -0
  224. package/dist/index-4v9bc2pc.js +1367 -0
  225. package/dist/index-61jsjnsv.js +280 -0
  226. package/dist/index-6jef5emv.js +176 -0
  227. package/dist/index-6psz1h4c.js +788 -0
  228. package/dist/index-72mve6vh.js +168 -0
  229. package/dist/{index-zbvmtcn2.js → index-74198nxd.js} +179 -77
  230. package/dist/index-7g8zyws4.js +192 -0
  231. package/dist/index-7kcxjhta.js +456 -0
  232. package/dist/index-7v583xan.js +418 -0
  233. package/dist/index-7x0ybbtx.js +133 -0
  234. package/dist/index-816krz9p.js +52 -0
  235. package/dist/index-82f1z98k.js +41 -0
  236. package/dist/index-8t5nb4qx.js +133 -0
  237. package/dist/index-9az6s7ad.js +52 -0
  238. package/dist/{index-59df49vn.js → index-9ba1etyz.js} +29 -51
  239. package/dist/{index-001mw014.js → index-9fbtk7gv.js} +134 -248
  240. package/dist/index-9n6djthj.js +490 -0
  241. package/dist/index-aabgympv.js +39 -0
  242. package/dist/index-b8m6883k.js +74 -0
  243. package/dist/{index-5yxg30va.js → index-cgbvmse6.js} +15 -6
  244. package/dist/index-d8etnfef.js +1229 -0
  245. package/dist/index-e9yw4d6y.js +133 -0
  246. package/dist/index-epw1jxz5.js +1204 -0
  247. package/dist/index-f85s8gj3.js +2649 -0
  248. package/dist/index-fe2ngvh7.js +1229 -0
  249. package/dist/index-fvsadj32.js +192 -0
  250. package/dist/index-gs4y9gdf.js +456 -0
  251. package/dist/{index-fef08w43.js → index-h18pxvzs.js} +7 -6
  252. package/dist/index-hfj1a2c4.js +2649 -0
  253. package/dist/{index-8gtqgb3q.js → index-hjy8ctpc.js} +14 -92
  254. package/dist/index-htzf0py1.js +1204 -0
  255. package/dist/index-j185x270.js +897 -0
  256. package/dist/index-jb75kwa4.js +519 -0
  257. package/dist/index-jwd8pcb2.js +897 -0
  258. package/dist/index-k29yjhv0.js +52 -0
  259. package/dist/index-k6vq6kkt.js +456 -0
  260. package/dist/{index-vky23txa.js → index-m3fmw6mx.js} +2 -2
  261. package/dist/index-maxpsfk8.js +402 -0
  262. package/dist/index-mbdmrner.js +402 -0
  263. package/dist/index-mea5bc45.js +418 -0
  264. package/dist/index-mqekt778.js +185 -0
  265. package/dist/index-na3mnm1k.js +74 -0
  266. package/dist/index-p03n4qet.js +1367 -0
  267. package/dist/index-p296ban8.js +191 -0
  268. package/dist/index-pnbs1b8k.js +280 -0
  269. package/dist/index-q4kaz181.js +1207 -0
  270. package/dist/index-ry131z23.js +378 -0
  271. package/dist/index-sgb7c8nm.js +402 -0
  272. package/dist/index-sqrksgb2.js +133 -0
  273. package/dist/index-stgn34cr.js +148 -0
  274. package/dist/{index-v8vvsn9x.js → index-t08te69w.js} +1 -18
  275. package/dist/index-thna1tkd.js +280 -0
  276. package/dist/index-v5nmqthy.js +74 -0
  277. package/dist/{index-n932ytmq.js → index-vt4yxkmf.js} +2 -2
  278. package/dist/index-wyq6c6yj.js +402 -0
  279. package/dist/index-wztc9stx.js +418 -0
  280. package/dist/index-x9cwdxw5.js +456 -0
  281. package/dist/index-xk9djfjp.js +519 -0
  282. package/dist/index-yc0gcchc.js +418 -0
  283. package/dist/index-yqbxjysa.js +897 -0
  284. package/dist/index-yzddwp02.js +788 -0
  285. package/dist/index-zfhq6s96.js +74 -0
  286. package/dist/index-zt22fe2j.js +54 -0
  287. package/dist/index-zyt5byt6.js +2649 -0
  288. package/dist/index.d.ts +2 -2
  289. package/dist/index.d.ts.map +1 -1
  290. package/dist/{init-na2atvz2.js → init-r4hnxan3.js} +24 -17
  291. package/dist/login-2hnz4m4n.js +77 -0
  292. package/dist/login-5bsxxpvc.js +77 -0
  293. package/dist/login-6tzvczw2.js +77 -0
  294. package/dist/login-bhaw72zc.js +77 -0
  295. package/dist/login-x8tgckqm.js +77 -0
  296. package/dist/previews-3rn8mz2c.js +1168 -0
  297. package/dist/previews-d487qde5.js +1200 -0
  298. package/dist/previews-gm3z0syj.js +1168 -0
  299. package/dist/previews-j9ymq4ys.js +1169 -0
  300. package/dist/previews-q031mx34.js +1168 -0
  301. package/dist/productions-120xg0aq.js +505 -0
  302. package/dist/productions-5ev5qweg.js +505 -0
  303. package/dist/productions-me3tdvr9.js +505 -0
  304. package/dist/productions-p5rbgp2f.js +505 -0
  305. package/dist/productions-x9p0pym1.js +505 -0
  306. package/dist/runtime/context-events.d.ts +13 -0
  307. package/dist/runtime/context-events.d.ts.map +1 -0
  308. package/dist/runtime/context-types.d.ts +82 -0
  309. package/dist/runtime/context-types.d.ts.map +1 -0
  310. package/dist/runtime/context.d.ts +6 -267
  311. package/dist/runtime/context.d.ts.map +1 -1
  312. package/dist/runtime/exports.d.ts +3 -3
  313. package/dist/runtime/index.d.ts +1 -1
  314. package/dist/runtime/index.d.ts.map +1 -1
  315. package/dist/runtime/middleware.d.ts +8 -38
  316. package/dist/runtime/middleware.d.ts.map +1 -1
  317. package/dist/src/browser.js +23 -14
  318. package/dist/src/cli/index.js +3 -1
  319. package/dist/src/cloudflare/index.js +49 -2
  320. package/dist/src/config-entry.js +14 -0
  321. package/dist/src/index.js +33 -20
  322. package/dist/src/runtime/index.js +3 -9
  323. package/dist/src/sveltekit/index.js +10 -7
  324. package/dist/src/test/index.js +16 -18
  325. package/dist/src/vite/index.js +7 -4
  326. package/dist/sveltekit/platform.d.ts +1 -1
  327. package/dist/sveltekit/platform.d.ts.map +1 -1
  328. package/dist/test/cf.d.ts +10 -10
  329. package/dist/test/email.d.ts.map +1 -1
  330. package/dist/test/index.d.ts +1 -6
  331. package/dist/test/index.d.ts.map +1 -1
  332. package/dist/test/queue.d.ts.map +1 -1
  333. package/dist/test/remote-ai.d.ts.map +1 -1
  334. package/dist/test/remote-cloudflare.d.ts +13 -0
  335. package/dist/test/remote-cloudflare.d.ts.map +1 -0
  336. package/dist/test/remote-vectorize.d.ts.map +1 -1
  337. package/dist/test/resolve-service-bindings.d.ts.map +1 -1
  338. package/dist/test/scheduled.d.ts.map +1 -1
  339. package/dist/test/should-skip.d.ts +0 -18
  340. package/dist/test/should-skip.d.ts.map +1 -1
  341. package/dist/test/simple-context-durable-objects.d.ts +6 -0
  342. package/dist/test/simple-context-durable-objects.d.ts.map +1 -0
  343. package/dist/test/simple-context-gateway-script.d.ts +2 -0
  344. package/dist/test/simple-context-gateway-script.d.ts.map +1 -0
  345. package/dist/test/simple-context-paths.d.ts +40 -0
  346. package/dist/test/simple-context-paths.d.ts.map +1 -0
  347. package/dist/test/simple-context.d.ts +1 -23
  348. package/dist/test/simple-context.d.ts.map +1 -1
  349. package/dist/test/tail.d.ts.map +1 -1
  350. package/dist/test/worker.d.ts.map +1 -1
  351. package/dist/token-kedhcret.js +419 -0
  352. package/dist/token-m8jmnjwk.js +419 -0
  353. package/dist/{types-sffr9681.js → types-0sqwkp7x.js} +244 -139
  354. package/dist/types-1gwr2ex6.js +572 -0
  355. package/dist/types-6e5yx6km.js +572 -0
  356. package/dist/types-p0gckpn6.js +572 -0
  357. package/dist/utils/send-email.d.ts.map +1 -1
  358. package/dist/vite/config-file.d.ts.map +1 -1
  359. package/dist/vite/plugin.d.ts.map +1 -1
  360. package/dist/worker-0srh2jfr.js +513 -0
  361. package/dist/worker-4xrfd10a.js +513 -0
  362. package/dist/worker-entry/composed-worker.d.ts +0 -7
  363. package/dist/worker-entry/composed-worker.d.ts.map +1 -1
  364. package/dist/worker-entry/surface-paths.d.ts +15 -0
  365. package/dist/worker-entry/surface-paths.d.ts.map +1 -0
  366. package/dist/worker-qtam8grz.js +513 -0
  367. package/dist/worker-qzm0b7br.js +513 -0
  368. package/dist/worker-y9ha6g44.js +513 -0
  369. package/package.json +17 -10
  370. package/R2.md +0 -200
  371. package/dist/account-8psavtg6.js +0 -420
  372. package/dist/build-n639efmn.js +0 -101
  373. package/dist/deploy-zvnq6xh7.js +0 -117
  374. package/dist/index-2q3pmzrx.js +0 -90
  375. package/dist/index-f4q0jbnj.js +0 -195
  376. package/dist/index-n7rs26ft.js +0 -77
  377. package/dist/index-tfyxa77h.js +0 -850
  378. package/dist/index-wyf3s77s.js +0 -343
  379. package/dist/test/multi-worker-context.d.ts +0 -114
  380. package/dist/test/multi-worker-context.d.ts.map +0 -1
@@ -0,0 +1,456 @@
1
+ import {
2
+ mergeConfigForEnvironment
3
+ } from "./index-0apbm26n.js";
4
+ import {
5
+ createD1Database,
6
+ createKVNamespace,
7
+ createQueue,
8
+ createR2Bucket,
9
+ createVectorizeIndex,
10
+ deleteD1Database,
11
+ deleteHyperdrive,
12
+ deleteKVNamespace,
13
+ deleteQueue,
14
+ deleteR2Bucket,
15
+ deleteVectorizeIndex,
16
+ getEffectiveAccountId,
17
+ getPrimaryAccount,
18
+ listD1Databases,
19
+ listHyperdrives,
20
+ listKVNamespaces,
21
+ listQueues,
22
+ listR2Buckets,
23
+ listVectorizeIndexes
24
+ } from "./index-jb75kwa4.js";
25
+ import {
26
+ isPreviewScopedName,
27
+ materializePreviewScopedConfig,
28
+ materializePreviewScopedString
29
+ } from "./index-6jef5emv.js";
30
+
31
+ // src/config/preview-resources.ts
32
+ var defaultPreviewScopedResourceLifecycleApi = {
33
+ getPrimaryAccount,
34
+ getEffectiveAccountId,
35
+ listKVNamespaces,
36
+ createKVNamespace,
37
+ deleteKVNamespace,
38
+ listD1Databases,
39
+ createD1Database,
40
+ deleteD1Database,
41
+ listR2Buckets,
42
+ createR2Bucket,
43
+ deleteR2Bucket,
44
+ listQueues,
45
+ createQueue,
46
+ deleteQueue,
47
+ listVectorizeIndexes,
48
+ createVectorizeIndex,
49
+ deleteVectorizeIndex,
50
+ listHyperdrives,
51
+ deleteHyperdrive
52
+ };
53
+ function resolvePreviewScopedResourceLifecycleApi(overrides) {
54
+ return {
55
+ ...defaultPreviewScopedResourceLifecycleApi,
56
+ ...overrides ?? {}
57
+ };
58
+ }
59
+ function createEmptyPreviewScopedResourceNames() {
60
+ return {
61
+ kv: [],
62
+ d1: [],
63
+ r2: [],
64
+ queues: [],
65
+ vectorize: [],
66
+ hyperdrive: [],
67
+ analyticsEngine: [],
68
+ browser: []
69
+ };
70
+ }
71
+ function createEmptyPreviewScopedResourcePlan() {
72
+ return {
73
+ kv: [],
74
+ d1: [],
75
+ r2: [],
76
+ queues: [],
77
+ vectorize: [],
78
+ hyperdrive: [],
79
+ analyticsEngine: [],
80
+ browser: []
81
+ };
82
+ }
83
+ function createPreviewScopedResourceRef(value, bindingName, options) {
84
+ if (!isPreviewScopedName(value)) {
85
+ return null;
86
+ }
87
+ const baseName = materializePreviewScopedString(value, {
88
+ env: {}
89
+ });
90
+ const previewName = materializePreviewScopedString(value, options);
91
+ if (!baseName || !previewName || baseName === previewName) {
92
+ return null;
93
+ }
94
+ return {
95
+ ...bindingName ? { bindingName } : {},
96
+ baseName,
97
+ previewName
98
+ };
99
+ }
100
+ function upsertPreviewScopedQueueRef(queueRefs, value, options) {
101
+ const ref = createPreviewScopedResourceRef(value, undefined, options);
102
+ if (!ref) {
103
+ return;
104
+ }
105
+ if (!queueRefs.has(ref.previewName)) {
106
+ queueRefs.set(ref.previewName, ref);
107
+ }
108
+ }
109
+ function applyHyperdriveBindingFallbacks(config, hyperdriveBindingFallbacks) {
110
+ if (!config.bindings?.hyperdrive || Object.keys(hyperdriveBindingFallbacks).length === 0) {
111
+ return config;
112
+ }
113
+ return {
114
+ ...config,
115
+ bindings: {
116
+ ...config.bindings,
117
+ hyperdrive: Object.fromEntries(Object.entries(config.bindings.hyperdrive).map(([bindingName, bindingConfig]) => {
118
+ const fallbackName = hyperdriveBindingFallbacks[bindingName];
119
+ if (!fallbackName || typeof bindingConfig !== "string") {
120
+ return [bindingName, bindingConfig];
121
+ }
122
+ return [bindingName, fallbackName];
123
+ }))
124
+ }
125
+ };
126
+ }
127
+ function resolvePreviewScopedResourceLifecycleWarnings(plan) {
128
+ const warnings = [];
129
+ if (plan.analyticsEngine.length > 0) {
130
+ warnings.push("Workers Analytics Engine datasets are created automatically on first write, so Devflare does not provision or delete preview-scoped analytics datasets.");
131
+ }
132
+ if (plan.browser.length > 0) {
133
+ warnings.push("Browser Rendering bindings do not own account-scoped resources, so Devflare does not provision or delete preview-scoped browser bindings.");
134
+ }
135
+ return warnings;
136
+ }
137
+ function hasPreviewScopedLifecycleResources(plan) {
138
+ return plan.kv.length > 0 || plan.d1.length > 0 || plan.r2.length > 0 || plan.queues.length > 0 || plan.vectorize.length > 0 || plan.hyperdrive.length > 0;
139
+ }
140
+ async function resolveLifecycleAccountId(config, options, cloudflareApi) {
141
+ if (options.accountId?.trim()) {
142
+ return options.accountId.trim();
143
+ }
144
+ if (config.accountId?.trim()) {
145
+ return config.accountId.trim();
146
+ }
147
+ const primaryAccount = await cloudflareApi.getPrimaryAccount();
148
+ if (!primaryAccount) {
149
+ throw new Error("Could not resolve a Cloudflare account for preview-scoped resource lifecycle management. Set accountId in devflare.config.ts, pass --account, or authenticate with Wrangler.");
150
+ }
151
+ const effective = await cloudflareApi.getEffectiveAccountId(primaryAccount.id);
152
+ return effective.accountId;
153
+ }
154
+ async function loadPreviewScopedResourceLifecycleState(accountId, plan, cloudflareApi) {
155
+ const [namespaces, databases, buckets, queues, vectorizeIndexes, hyperdrives] = await Promise.all([
156
+ plan.kv.length > 0 ? cloudflareApi.listKVNamespaces(accountId) : Promise.resolve([]),
157
+ plan.d1.length > 0 ? cloudflareApi.listD1Databases(accountId) : Promise.resolve([]),
158
+ plan.r2.length > 0 ? cloudflareApi.listR2Buckets(accountId) : Promise.resolve([]),
159
+ plan.queues.length > 0 ? cloudflareApi.listQueues(accountId) : Promise.resolve([]),
160
+ plan.vectorize.length > 0 ? cloudflareApi.listVectorizeIndexes(accountId) : Promise.resolve([]),
161
+ plan.hyperdrive.length > 0 ? cloudflareApi.listHyperdrives(accountId) : Promise.resolve([])
162
+ ]);
163
+ return {
164
+ namespaces,
165
+ databases,
166
+ buckets,
167
+ queues,
168
+ vectorizeIndexes,
169
+ hyperdrives
170
+ };
171
+ }
172
+ function createPreviewScopedResourceResolutionCloudflareApi(state) {
173
+ return {
174
+ listKVNamespaces: async () => state.namespaces,
175
+ listD1Databases: async () => state.databases,
176
+ listHyperdrives: async () => state.hyperdrives
177
+ };
178
+ }
179
+ function findVectorizeIndexByName(indexes, name) {
180
+ return indexes.find((index) => index.name === name);
181
+ }
182
+ function findKVNamespaceByName(namespaces, name) {
183
+ return namespaces.find((namespace) => namespace.name === name);
184
+ }
185
+ function findD1DatabaseByName(databases, name) {
186
+ return databases.find((database) => database.name === name);
187
+ }
188
+ function findR2BucketByName(buckets, name) {
189
+ return buckets.find((bucket) => bucket.name === name);
190
+ }
191
+ function findQueueByName(queues, name) {
192
+ return queues.find((queue) => queue.name === name);
193
+ }
194
+ function findHyperdriveByName(hyperdrives, name) {
195
+ return hyperdrives.find((hyperdrive) => hyperdrive.name === name);
196
+ }
197
+ function collectPreviewScopedResourcePlan(config, options = {}) {
198
+ const mergedConfig = mergeConfigForEnvironment(config, options.environment);
199
+ const plan = createEmptyPreviewScopedResourcePlan();
200
+ const bindings = mergedConfig.bindings;
201
+ if (!bindings) {
202
+ return plan;
203
+ }
204
+ if (bindings.kv) {
205
+ plan.kv = Object.entries(bindings.kv).map(([bindingName, bindingConfig]) => {
206
+ return typeof bindingConfig === "string" ? createPreviewScopedResourceRef(bindingConfig, bindingName, options) : null;
207
+ }).filter((ref) => ref !== null);
208
+ }
209
+ if (bindings.d1) {
210
+ plan.d1 = Object.entries(bindings.d1).map(([bindingName, bindingConfig]) => {
211
+ return typeof bindingConfig === "string" ? createPreviewScopedResourceRef(bindingConfig, bindingName, options) : null;
212
+ }).filter((ref) => ref !== null);
213
+ }
214
+ if (bindings.r2) {
215
+ plan.r2 = Object.entries(bindings.r2).map(([bindingName, bindingConfig]) => {
216
+ return createPreviewScopedResourceRef(bindingConfig, bindingName, options);
217
+ }).filter((ref) => ref !== null);
218
+ }
219
+ if (bindings.queues) {
220
+ const queueRefs = new Map;
221
+ for (const queueName of Object.values(bindings.queues.producers ?? {})) {
222
+ upsertPreviewScopedQueueRef(queueRefs, queueName, options);
223
+ }
224
+ for (const consumer of bindings.queues.consumers ?? []) {
225
+ upsertPreviewScopedQueueRef(queueRefs, consumer.queue, options);
226
+ if (consumer.deadLetterQueue) {
227
+ upsertPreviewScopedQueueRef(queueRefs, consumer.deadLetterQueue, options);
228
+ }
229
+ }
230
+ plan.queues = Array.from(queueRefs.values());
231
+ }
232
+ if (bindings.vectorize) {
233
+ plan.vectorize = Object.entries(bindings.vectorize).map(([bindingName, bindingConfig]) => {
234
+ return createPreviewScopedResourceRef(bindingConfig.indexName, bindingName, options);
235
+ }).filter((ref) => ref !== null);
236
+ }
237
+ if (bindings.hyperdrive) {
238
+ plan.hyperdrive = Object.entries(bindings.hyperdrive).map(([bindingName, bindingConfig]) => {
239
+ return typeof bindingConfig === "string" ? createPreviewScopedResourceRef(bindingConfig, bindingName, options) : null;
240
+ }).filter((ref) => ref !== null);
241
+ }
242
+ if (bindings.analyticsEngine) {
243
+ plan.analyticsEngine = Object.entries(bindings.analyticsEngine).map(([bindingName, bindingConfig]) => {
244
+ return createPreviewScopedResourceRef(bindingConfig.dataset, bindingName, options);
245
+ }).filter((ref) => ref !== null);
246
+ }
247
+ if (bindings.browser) {
248
+ plan.browser = Object.entries(bindings.browser).map(([bindingName, bindingConfig]) => {
249
+ return createPreviewScopedResourceRef(bindingConfig, bindingName, options);
250
+ }).filter((ref) => ref !== null);
251
+ }
252
+ return plan;
253
+ }
254
+ async function preparePreviewScopedResourcesForDeploy(config, options = {}) {
255
+ const mergedConfig = mergeConfigForEnvironment(config, options.environment);
256
+ const plan = collectPreviewScopedResourcePlan(config, options);
257
+ const created = createEmptyPreviewScopedResourceNames();
258
+ const existing = createEmptyPreviewScopedResourceNames();
259
+ const warnings = resolvePreviewScopedResourceLifecycleWarnings(plan);
260
+ if (!hasPreviewScopedLifecycleResources(plan)) {
261
+ return {
262
+ config: materializePreviewScopedConfig(mergedConfig, options),
263
+ plan,
264
+ created,
265
+ existing,
266
+ warnings
267
+ };
268
+ }
269
+ const cloudflareApi = resolvePreviewScopedResourceLifecycleApi(options.cloudflare);
270
+ const accountId = await resolveLifecycleAccountId(config, options, cloudflareApi);
271
+ const {
272
+ namespaces,
273
+ databases,
274
+ buckets,
275
+ queues,
276
+ vectorizeIndexes,
277
+ hyperdrives
278
+ } = await loadPreviewScopedResourceLifecycleState(accountId, plan, cloudflareApi);
279
+ for (const ref of plan.kv) {
280
+ if (findKVNamespaceByName(namespaces, ref.previewName)) {
281
+ existing.kv.push(ref.previewName);
282
+ continue;
283
+ }
284
+ const namespace = await cloudflareApi.createKVNamespace(accountId, ref.previewName);
285
+ created.kv.push(ref.previewName);
286
+ namespaces.push(namespace);
287
+ }
288
+ for (const ref of plan.d1) {
289
+ if (findD1DatabaseByName(databases, ref.previewName)) {
290
+ existing.d1.push(ref.previewName);
291
+ continue;
292
+ }
293
+ const database = await cloudflareApi.createD1Database(accountId, ref.previewName);
294
+ created.d1.push(ref.previewName);
295
+ databases.push(database);
296
+ }
297
+ for (const ref of plan.r2) {
298
+ if (findR2BucketByName(buckets, ref.previewName)) {
299
+ existing.r2.push(ref.previewName);
300
+ continue;
301
+ }
302
+ const bucket = await cloudflareApi.createR2Bucket(accountId, ref.previewName);
303
+ created.r2.push(ref.previewName);
304
+ buckets.push(bucket);
305
+ }
306
+ for (const ref of plan.queues) {
307
+ if (findQueueByName(queues, ref.previewName)) {
308
+ existing.queues.push(ref.previewName);
309
+ continue;
310
+ }
311
+ const queue = await cloudflareApi.createQueue(accountId, ref.previewName);
312
+ created.queues.push(ref.previewName);
313
+ queues.push(queue);
314
+ }
315
+ for (const ref of plan.vectorize) {
316
+ if (findVectorizeIndexByName(vectorizeIndexes, ref.previewName)) {
317
+ existing.vectorize.push(ref.previewName);
318
+ continue;
319
+ }
320
+ const baseIndex = findVectorizeIndexByName(vectorizeIndexes, ref.baseName);
321
+ if (!baseIndex) {
322
+ throw new Error(`Could not provision preview Vectorize index "${ref.previewName}" because the base index "${ref.baseName}" was not found.`);
323
+ }
324
+ const createdIndex = await cloudflareApi.createVectorizeIndex(accountId, {
325
+ name: ref.previewName,
326
+ dimensions: baseIndex.dimensions,
327
+ metric: baseIndex.metric,
328
+ description: baseIndex.description
329
+ });
330
+ created.vectorize.push(ref.previewName);
331
+ vectorizeIndexes.push(createdIndex);
332
+ }
333
+ const hyperdriveBindingFallbacks = {};
334
+ for (const ref of plan.hyperdrive) {
335
+ if (findHyperdriveByName(hyperdrives, ref.previewName)) {
336
+ existing.hyperdrive.push(ref.previewName);
337
+ continue;
338
+ }
339
+ if (!findHyperdriveByName(hyperdrives, ref.baseName)) {
340
+ throw new Error(`Could not resolve preview Hyperdrive "${ref.previewName}" because neither the preview config nor the base config "${ref.baseName}" exists in this account.`);
341
+ }
342
+ if (ref.bindingName) {
343
+ hyperdriveBindingFallbacks[ref.bindingName] = ref.baseName;
344
+ }
345
+ warnings.push(`Preview Hyperdrive "${ref.previewName}" is not auto-provisioned because Cloudflare does not expose stored Hyperdrive credentials for cloning. Devflare will reuse the base Hyperdrive "${ref.baseName}" for binding ${ref.bindingName ?? ref.previewName}.`);
346
+ }
347
+ const preparedConfig = applyHyperdriveBindingFallbacks(mergedConfig, hyperdriveBindingFallbacks);
348
+ return {
349
+ accountId,
350
+ config: materializePreviewScopedConfig(preparedConfig, options),
351
+ resourceResolutionCloudflare: createPreviewScopedResourceResolutionCloudflareApi({
352
+ namespaces,
353
+ databases,
354
+ hyperdrives
355
+ }),
356
+ plan,
357
+ created,
358
+ existing,
359
+ warnings
360
+ };
361
+ }
362
+ async function cleanupPreviewScopedResources(config, options = {}) {
363
+ const plan = collectPreviewScopedResourcePlan(config, options);
364
+ const candidates = createEmptyPreviewScopedResourceNames();
365
+ const deleted = createEmptyPreviewScopedResourceNames();
366
+ const warnings = resolvePreviewScopedResourceLifecycleWarnings(plan);
367
+ if (!hasPreviewScopedLifecycleResources(plan)) {
368
+ return {
369
+ plan,
370
+ candidates,
371
+ deleted,
372
+ warnings
373
+ };
374
+ }
375
+ const cloudflareApi = resolvePreviewScopedResourceLifecycleApi(options.cloudflare);
376
+ const accountId = await resolveLifecycleAccountId(config, options, cloudflareApi);
377
+ const apply = options.apply === true;
378
+ const {
379
+ namespaces,
380
+ databases,
381
+ buckets,
382
+ queues,
383
+ vectorizeIndexes,
384
+ hyperdrives
385
+ } = await loadPreviewScopedResourceLifecycleState(accountId, plan, cloudflareApi);
386
+ const kvCandidates = plan.kv.map((ref) => findKVNamespaceByName(namespaces, ref.previewName)).filter((namespace) => namespace !== undefined);
387
+ for (const namespace of kvCandidates) {
388
+ candidates.kv.push(namespace.name);
389
+ if (!apply) {
390
+ continue;
391
+ }
392
+ await cloudflareApi.deleteKVNamespace(accountId, namespace.id);
393
+ deleted.kv.push(namespace.name);
394
+ }
395
+ const d1Candidates = plan.d1.map((ref) => findD1DatabaseByName(databases, ref.previewName)).filter((database) => database !== undefined);
396
+ for (const database of d1Candidates) {
397
+ candidates.d1.push(database.name);
398
+ if (!apply) {
399
+ continue;
400
+ }
401
+ await cloudflareApi.deleteD1Database(accountId, database.id);
402
+ deleted.d1.push(database.name);
403
+ }
404
+ const r2Candidates = plan.r2.map((ref) => findR2BucketByName(buckets, ref.previewName)).filter((bucket) => bucket !== undefined);
405
+ for (const bucket of r2Candidates) {
406
+ candidates.r2.push(bucket.name);
407
+ if (!apply) {
408
+ continue;
409
+ }
410
+ await cloudflareApi.deleteR2Bucket(accountId, bucket.name);
411
+ deleted.r2.push(bucket.name);
412
+ }
413
+ const queueCandidates = plan.queues.map((ref) => findQueueByName(queues, ref.previewName)).filter((queue) => queue !== undefined);
414
+ for (const queue of queueCandidates) {
415
+ candidates.queues.push(queue.name);
416
+ if (!apply) {
417
+ continue;
418
+ }
419
+ if (!queue.id) {
420
+ warnings.push(`Skipping queue deletion for "${queue.name}" because Cloudflare did not return a queue id.`);
421
+ continue;
422
+ }
423
+ await cloudflareApi.deleteQueue(accountId, queue.id);
424
+ deleted.queues.push(queue.name);
425
+ }
426
+ const vectorizeCandidates = plan.vectorize.map((ref) => findVectorizeIndexByName(vectorizeIndexes, ref.previewName)).filter((index) => index !== undefined);
427
+ for (const index of vectorizeCandidates) {
428
+ candidates.vectorize.push(index.name);
429
+ if (!apply) {
430
+ continue;
431
+ }
432
+ await cloudflareApi.deleteVectorizeIndex(accountId, index.name);
433
+ deleted.vectorize.push(index.name);
434
+ }
435
+ const hyperdriveCandidates = plan.hyperdrive.map((ref) => findHyperdriveByName(hyperdrives, ref.previewName)).filter((hyperdrive) => hyperdrive !== undefined);
436
+ for (const hyperdrive of hyperdriveCandidates) {
437
+ candidates.hyperdrive.push(hyperdrive.name);
438
+ if (!apply) {
439
+ continue;
440
+ }
441
+ await cloudflareApi.deleteHyperdrive(accountId, hyperdrive.id);
442
+ deleted.hyperdrive.push(hyperdrive.name);
443
+ }
444
+ if (plan.hyperdrive.length > 0) {
445
+ warnings.push("Preview-scoped Hyperdrive cleanup only deletes preview configs that already exist. Devflare does not auto-provision preview Hyperdrives because Cloudflare does not expose stored Hyperdrive credentials for cloning.");
446
+ }
447
+ return {
448
+ accountId,
449
+ plan,
450
+ candidates,
451
+ deleted,
452
+ warnings
453
+ };
454
+ }
455
+
456
+ export { preparePreviewScopedResourcesForDeploy, cleanupPreviewScopedResources };