void 0.1.6 → 0.7.1

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 (333) hide show
  1. package/AGENT_PROMPT.md +15 -0
  2. package/README.md +62 -123
  3. package/dist/auth-BdsJ0Aff.d.mts +43 -0
  4. package/dist/auth-cmd-DVKi6dzh.mjs +43 -0
  5. package/dist/auth-migrations-BAtAck2g.mjs +117 -0
  6. package/dist/better-auth-shared-C9_GHSkR.d.mts +71 -0
  7. package/dist/better-auth-shared-CdYmQGry.mjs +163 -0
  8. package/dist/cache-B0BgSTZi.mjs +47 -0
  9. package/dist/cancel-deploy-D9OFt5gA.mjs +59 -0
  10. package/dist/cf-access-Dee5cXxL.mjs +22 -0
  11. package/dist/chunk-DJd-R1mw.mjs +34 -0
  12. package/dist/cli/cli.d.mts +1 -0
  13. package/dist/cli/cli.mjs +1814 -0
  14. package/dist/client-BUdfE3QJ.mjs +622 -0
  15. package/dist/collect-CjeZgz5D.mjs +55 -0
  16. package/dist/config-BIa9HwVX.mjs +573 -0
  17. package/dist/config-BzM9Dy7T.mjs +37 -0
  18. package/dist/config-CvHtTM0q.mjs +30 -0
  19. package/dist/create-project-CN1pF-OQ.mjs +90 -0
  20. package/dist/db-BIP2kuEt.mjs +895 -0
  21. package/dist/defer-DcxEsVH1.mjs +49 -0
  22. package/dist/delete-DJTvwbr-.mjs +64 -0
  23. package/dist/deploy-BqXz1ycW.mjs +2723 -0
  24. package/dist/discover-B7FkXBLB.mjs +40 -0
  25. package/dist/dist-DUyXJLkq.mjs +2667 -0
  26. package/dist/dist-Dayj3gCK.mjs +1287 -0
  27. package/dist/domain-B-fIU3VE.mjs +79 -0
  28. package/dist/dotenv-DwO4ti0Z.mjs +173 -0
  29. package/dist/drizzle-NnudE_UN.mjs +232 -0
  30. package/dist/env-BwbZJd2x.mjs +301 -0
  31. package/dist/env-helpers-Dr9Y7RnE.d.mts +52 -0
  32. package/dist/env-raw-BDL4TvdN.mjs +32 -0
  33. package/dist/env-types-DknSA4SO.mjs +64 -0
  34. package/dist/env-validation-DJKjR_8q.mjs +163 -0
  35. package/dist/fetch-error-BQ8sZ5Nd.mjs +266 -0
  36. package/dist/fetch-error-CVZ5CGA-.d.mts +20 -0
  37. package/dist/gen-U0Ktr4Zd.mjs +761 -0
  38. package/dist/handler-B0ds0OHJ.d.mts +269 -0
  39. package/dist/head-P-egrtFE.d.mts +45 -0
  40. package/dist/headers-DCXc7mDs.mjs +279 -0
  41. package/dist/index.d.mts +32 -0
  42. package/dist/index.mjs +4695 -0
  43. package/dist/init-Bb_Qsdq6.mjs +2625 -0
  44. package/dist/link-D4d26PCm.mjs +49 -0
  45. package/dist/list-bQc1eQCZ.mjs +113 -0
  46. package/dist/log-DXdqnmhF.mjs +26 -0
  47. package/dist/login-RWUDCfdx.mjs +72 -0
  48. package/dist/logs-DrkTklop.mjs +98 -0
  49. package/dist/magic-string.es-D6g9UnIy.mjs +1011 -0
  50. package/dist/mcp-kZ4zg13a.mjs +373 -0
  51. package/dist/node-DDfXj10V.mjs +54 -0
  52. package/dist/output-BwlcIYSR.mjs +139 -0
  53. package/dist/pages/client.d.mts +198 -0
  54. package/dist/pages/client.mjs +980 -0
  55. package/dist/pages/head-client.d.mts +15 -0
  56. package/dist/pages/head-client.mjs +90 -0
  57. package/dist/pages/head.d.mts +2 -0
  58. package/dist/pages/head.mjs +112 -0
  59. package/dist/pages/index.d.mts +38 -0
  60. package/dist/pages/index.mjs +76 -0
  61. package/dist/pages/islands-plugin.d.mts +50 -0
  62. package/dist/pages/islands-plugin.mjs +195 -0
  63. package/dist/pages/prefetch.d.mts +31 -0
  64. package/dist/pages/prefetch.mjs +90 -0
  65. package/dist/pages/protocol.d.mts +3 -0
  66. package/dist/pages/protocol.mjs +193 -0
  67. package/dist/pages/serialize.d.mts +10 -0
  68. package/dist/pages/serialize.mjs +14 -0
  69. package/dist/pathe.M-eThtNZ-D-kmWkCS.mjs +150 -0
  70. package/dist/plugin-inference-oZ6Ybu2_.mjs +2447 -0
  71. package/dist/prepare-BAtWufvm.mjs +99 -0
  72. package/dist/preset-D4I73kT4.mjs +221 -0
  73. package/dist/project-TqORyHn8.mjs +72 -0
  74. package/dist/project-cmd-ATFi3kRm.mjs +67 -0
  75. package/dist/project-slug-CKam8lF9.mjs +11 -0
  76. package/dist/project-tsconfig-DfkESbDL.mjs +63 -0
  77. package/dist/protocol-BWzXs2A2.d.mts +34 -0
  78. package/dist/providers-B3aMxWzP.mjs +67 -0
  79. package/dist/resolve-project-Br5BR03U.mjs +29 -0
  80. package/dist/rollback-BSyita3C.mjs +92 -0
  81. package/dist/route-types-DReF1gUY.mjs +255 -0
  82. package/dist/routes-stub.d.mts +55 -0
  83. package/dist/routes-stub.mjs +1 -0
  84. package/dist/runner-6Ep3fNQu.mjs +123 -0
  85. package/dist/runner-pg-D0wWHYnr.mjs +57 -0
  86. package/dist/runtime/ai.d.mts +127 -0
  87. package/dist/runtime/ai.mjs +348 -0
  88. package/dist/runtime/auth-client-react.d.mts +8 -0
  89. package/dist/runtime/auth-client-react.mjs +6 -0
  90. package/dist/runtime/auth-client-solid.d.mts +8 -0
  91. package/dist/runtime/auth-client-solid.mjs +6 -0
  92. package/dist/runtime/auth-client-svelte.d.mts +8 -0
  93. package/dist/runtime/auth-client-svelte.mjs +6 -0
  94. package/dist/runtime/auth-client-vue.d.mts +8 -0
  95. package/dist/runtime/auth-client-vue.mjs +6 -0
  96. package/dist/runtime/auth-client.d.mts +8 -0
  97. package/dist/runtime/auth-client.mjs +6 -0
  98. package/dist/runtime/auth.d.mts +2 -0
  99. package/dist/runtime/auth.mjs +22 -0
  100. package/dist/runtime/better-auth-pg.d.mts +11 -0
  101. package/dist/runtime/better-auth-pg.mjs +51 -0
  102. package/dist/runtime/better-auth.d.mts +11 -0
  103. package/dist/runtime/better-auth.mjs +33 -0
  104. package/dist/runtime/client.d.mts +6 -0
  105. package/dist/runtime/client.mjs +5 -0
  106. package/dist/runtime/db-pg.d.mts +2 -0
  107. package/dist/runtime/db-pg.mjs +1 -0
  108. package/dist/runtime/db.d.mts +17 -0
  109. package/dist/runtime/db.mjs +30 -0
  110. package/dist/runtime/drizzle-arktype.d.mts +1 -0
  111. package/dist/runtime/drizzle-arktype.mjs +2 -0
  112. package/dist/runtime/drizzle-valibot.d.mts +1 -0
  113. package/dist/runtime/drizzle-valibot.mjs +2 -0
  114. package/dist/runtime/drizzle-zod.d.mts +1 -0
  115. package/dist/runtime/drizzle-zod.mjs +2 -0
  116. package/dist/runtime/env-helpers.d.mts +2 -0
  117. package/dist/runtime/env-helpers.mjs +173 -0
  118. package/dist/runtime/env-public-client.d.mts +22 -0
  119. package/dist/runtime/env-public-client.mjs +54 -0
  120. package/dist/runtime/env-public.d.mts +143 -0
  121. package/dist/runtime/env-public.mjs +366 -0
  122. package/dist/runtime/env.d.mts +13 -0
  123. package/dist/runtime/env.mjs +51 -0
  124. package/dist/runtime/fetch-stream.d.mts +51 -0
  125. package/dist/runtime/fetch-stream.mjs +81 -0
  126. package/dist/runtime/fetch.d.mts +59 -0
  127. package/dist/runtime/fetch.mjs +18 -0
  128. package/dist/runtime/handler.d.mts +3 -0
  129. package/dist/runtime/handler.mjs +85 -0
  130. package/dist/runtime/isr.d.mts +26 -0
  131. package/dist/runtime/isr.mjs +43 -0
  132. package/dist/runtime/kv.d.mts +48 -0
  133. package/dist/runtime/kv.mjs +106 -0
  134. package/dist/runtime/log.d.mts +24 -0
  135. package/dist/runtime/log.mjs +31 -0
  136. package/dist/runtime/migration-handler-pg.d.mts +6 -0
  137. package/dist/runtime/migration-handler-pg.mjs +85 -0
  138. package/dist/runtime/migration-handler.d.mts +19 -0
  139. package/dist/runtime/migration-handler.mjs +92 -0
  140. package/dist/runtime/queues.d.mts +7 -0
  141. package/dist/runtime/queues.mjs +8 -0
  142. package/dist/runtime/remote/binding-handler.d.mts +15 -0
  143. package/dist/runtime/remote/binding-handler.mjs +208 -0
  144. package/dist/runtime/remote/index.d.mts +8 -0
  145. package/dist/runtime/remote/index.mjs +461 -0
  146. package/dist/runtime/response.d.mts +14 -0
  147. package/dist/runtime/response.mjs +30 -0
  148. package/dist/runtime/sandbox.d.mts +17 -0
  149. package/dist/runtime/sandbox.mjs +19 -0
  150. package/dist/runtime/schema-d1.d.mts +1 -0
  151. package/dist/runtime/schema-d1.mjs +2 -0
  152. package/dist/runtime/schema-pg.d.mts +1 -0
  153. package/dist/runtime/schema-pg.mjs +2 -0
  154. package/dist/runtime/seed.d.mts +30 -0
  155. package/dist/runtime/seed.mjs +6 -0
  156. package/dist/runtime/storage.d.mts +7 -0
  157. package/dist/runtime/storage.mjs +14 -0
  158. package/dist/runtime/validator.d.mts +2 -0
  159. package/dist/runtime/validator.mjs +72 -0
  160. package/dist/runtime/ws-server.d.mts +26 -0
  161. package/dist/runtime/ws-server.mjs +296 -0
  162. package/dist/runtime/ws.d.mts +123 -0
  163. package/dist/runtime/ws.mjs +103 -0
  164. package/dist/scan-Ba4hFwlH.mjs +324 -0
  165. package/dist/scan-C6HMEIdW.mjs +318 -0
  166. package/dist/secret-DmjBDxB1.mjs +109 -0
  167. package/dist/skills-ipldjlKE.mjs +62 -0
  168. package/dist/standard-schema-9CRjx-uR.d.mts +42 -0
  169. package/dist/subcommand-prompt-BKjuNAPb.mjs +349 -0
  170. package/dist/sveltekit.d.mts +20 -0
  171. package/dist/sveltekit.mjs +61 -0
  172. package/dist/types-mHOEwpW4.d.mts +57 -0
  173. package/dist/validate-CaMavMxu.mjs +146 -0
  174. package/dist/yarn-pnp-BFqMV_bl.mjs +196 -0
  175. package/getting-started-prompt.txt +26 -0
  176. package/package.json +322 -30
  177. package/schema.json +364 -0
  178. package/skills/migrate-vite-cloudflare-to-void/SKILL.md +175 -0
  179. package/skills/void/SKILL.md +75 -0
  180. package/skills/void/command/void.md +7 -0
  181. package/skills/void/docs/guide/ai.md +235 -0
  182. package/skills/void/docs/guide/app-types.md +103 -0
  183. package/skills/void/docs/guide/auth.md +257 -0
  184. package/skills/void/docs/guide/database/d1.md +106 -0
  185. package/skills/void/docs/guide/database/postgresql.md +106 -0
  186. package/skills/void/docs/guide/database.md +418 -0
  187. package/skills/void/docs/guide/deployment.md +98 -0
  188. package/skills/void/docs/guide/edge/headers.md +79 -0
  189. package/skills/void/docs/guide/edge/prerendering.md +83 -0
  190. package/skills/void/docs/guide/edge/redirects.md +116 -0
  191. package/skills/void/docs/guide/edge/revalidation.md +131 -0
  192. package/skills/void/docs/guide/edge/rewrites.md +354 -0
  193. package/skills/void/docs/guide/edge/static-assets.md +72 -0
  194. package/skills/void/docs/guide/env-vars.md +298 -0
  195. package/skills/void/docs/guide/index.md +80 -0
  196. package/skills/void/docs/guide/jobs.md +91 -0
  197. package/skills/void/docs/guide/kv.md +107 -0
  198. package/skills/void/docs/guide/pages-routing/actions-and-forms.md +419 -0
  199. package/skills/void/docs/guide/pages-routing/head.md +130 -0
  200. package/skills/void/docs/guide/pages-routing/islands.md +405 -0
  201. package/skills/void/docs/guide/pages-routing/layouts.md +362 -0
  202. package/skills/void/docs/guide/pages-routing/loaders.md +267 -0
  203. package/skills/void/docs/guide/pages-routing/markdown.md +625 -0
  204. package/skills/void/docs/guide/pages-routing/overview.md +236 -0
  205. package/skills/void/docs/guide/pages-routing/view-transitions.md +140 -0
  206. package/skills/void/docs/guide/queues.md +140 -0
  207. package/skills/void/docs/guide/quickstart.md +233 -0
  208. package/skills/void/docs/guide/remote-dev.md +67 -0
  209. package/skills/void/docs/guide/sandboxes.md +82 -0
  210. package/skills/void/docs/guide/server-routing.md +246 -0
  211. package/skills/void/docs/guide/ssg.md +74 -0
  212. package/skills/void/docs/guide/ssr.md +105 -0
  213. package/skills/void/docs/guide/storage.md +67 -0
  214. package/skills/void/docs/guide/type-safety.md +179 -0
  215. package/skills/void/docs/guide/typed-fetch.md +113 -0
  216. package/skills/void/docs/guide/websockets.md +190 -0
  217. package/skills/void/docs/index.md +48 -0
  218. package/skills/void/docs/integrations/agents.md +84 -0
  219. package/skills/void/docs/integrations/cloudflare.md +284 -0
  220. package/skills/void/docs/integrations/frameworks/analog.md +182 -0
  221. package/skills/void/docs/integrations/frameworks/astro.md +197 -0
  222. package/skills/void/docs/integrations/frameworks/nuxt.md +164 -0
  223. package/skills/void/docs/integrations/frameworks/overview.md +136 -0
  224. package/skills/void/docs/integrations/frameworks/react-router.md +137 -0
  225. package/skills/void/docs/integrations/frameworks/sveltekit.md +191 -0
  226. package/skills/void/docs/integrations/frameworks/tanstack-start.md +140 -0
  227. package/skills/void/docs/integrations/hono.md +97 -0
  228. package/skills/void/docs/integrations/nodejs-bun-deno.md +210 -0
  229. package/skills/void/docs/node_modules/@iconify/vue/README.md +408 -0
  230. package/skills/void/docs/node_modules/@iconify/vue/offline/readme.md +5 -0
  231. package/skills/void/docs/node_modules/@voidzero-dev/vitepress-theme/README.md +103 -0
  232. package/skills/void/docs/node_modules/oxc-minify/README.md +78 -0
  233. package/skills/void/docs/node_modules/reka-ui/README.md +80 -0
  234. package/skills/void/docs/node_modules/vitepress/README.md +28 -0
  235. package/skills/void/docs/node_modules/vitepress/template/api-examples.md +49 -0
  236. package/skills/void/docs/node_modules/vitepress/template/index.md +28 -0
  237. package/skills/void/docs/node_modules/vitepress/template/markdown-examples.md +85 -0
  238. package/skills/void/docs/node_modules/vitepress-plugin-group-icons/README.md +101 -0
  239. package/skills/void/docs/node_modules/void/AGENTS.md +204 -0
  240. package/skills/void/docs/node_modules/void/AGENT_PROMPT.md +15 -0
  241. package/skills/void/docs/node_modules/void/README.md +89 -0
  242. package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/CHANGELOG.md +591 -0
  243. package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/README.md +375 -0
  244. package/skills/void/docs/node_modules/void/node_modules/@cloudflare/sandbox/README.md +174 -0
  245. package/skills/void/docs/node_modules/void/node_modules/@cloudflare/vite-plugin/README.md +37 -0
  246. package/skills/void/docs/node_modules/void/node_modules/@cloudflare/workers-types/README.md +135 -0
  247. package/skills/void/docs/node_modules/void/node_modules/@electric-sql/pglite/README.md +189 -0
  248. package/skills/void/docs/node_modules/void/node_modules/@hono/oauth-providers/CHANGELOG.md +143 -0
  249. package/skills/void/docs/node_modules/void/node_modules/@hono/oauth-providers/README.md +1272 -0
  250. package/skills/void/docs/node_modules/void/node_modules/@napi-rs/keyring/README.md +19 -0
  251. package/skills/void/docs/node_modules/void/node_modules/@types/better-sqlite3/README.md +15 -0
  252. package/skills/void/docs/node_modules/void/node_modules/@types/node/README.md +15 -0
  253. package/skills/void/docs/node_modules/void/node_modules/@types/pg/README.md +15 -0
  254. package/skills/void/docs/node_modules/void/node_modules/@typescript/native-preview/README.md +22 -0
  255. package/skills/void/docs/node_modules/void/node_modules/@typescript/native-preview/vendor/vscode-jsonrpc/README.md +69 -0
  256. package/skills/void/docs/node_modules/void/node_modules/@void/md/README.md +152 -0
  257. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@shikijs/engine-javascript/README.md +9 -0
  258. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@shikijs/transformers/README.md +9 -0
  259. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@types/node/README.md +15 -0
  260. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/gray-matter/CHANGELOG.md +24 -0
  261. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/gray-matter/README.md +565 -0
  262. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-exit/README.md +124 -0
  263. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-anchor/README.md +600 -0
  264. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-attrs/README.md +386 -0
  265. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-container/README.md +95 -0
  266. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-emoji/README.md +101 -0
  267. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/pathe/README.md +73 -0
  268. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/shiki/README.md +15 -0
  269. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tinyglobby/README.md +25 -0
  270. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tsdown/README.md +55 -0
  271. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite/LICENSE.md +2230 -0
  272. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite/README.md +20 -0
  273. package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vue/README.md +58 -0
  274. package/skills/void/docs/node_modules/void/node_modules/arktype/README.md +165 -0
  275. package/skills/void/docs/node_modules/void/node_modules/better-auth/LICENSE.md +20 -0
  276. package/skills/void/docs/node_modules/void/node_modules/better-auth/README.md +32 -0
  277. package/skills/void/docs/node_modules/void/node_modules/better-sqlite3/README.md +99 -0
  278. package/skills/void/docs/node_modules/void/node_modules/blake3-jit/README.md +108 -0
  279. package/skills/void/docs/node_modules/void/node_modules/drizzle-arktype/README.md +51 -0
  280. package/skills/void/docs/node_modules/void/node_modules/drizzle-kit/README.md +79 -0
  281. package/skills/void/docs/node_modules/void/node_modules/drizzle-orm/README.md +44 -0
  282. package/skills/void/docs/node_modules/void/node_modules/drizzle-valibot/README.md +51 -0
  283. package/skills/void/docs/node_modules/void/node_modules/drizzle-zod/README.md +65 -0
  284. package/skills/void/docs/node_modules/void/node_modules/es-module-lexer/README.md +390 -0
  285. package/skills/void/docs/node_modules/void/node_modules/estree-walker/README.md +48 -0
  286. package/skills/void/docs/node_modules/void/node_modules/hono/README.md +85 -0
  287. package/skills/void/docs/node_modules/void/node_modules/ignore/README.md +452 -0
  288. package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/CHANGELOG.md +76 -0
  289. package/{LICENSE → skills/void/docs/node_modules/void/node_modules/jsonc-parser/LICENSE.md} +21 -21
  290. package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/README.md +364 -0
  291. package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/SECURITY.md +41 -0
  292. package/skills/void/docs/node_modules/void/node_modules/magic-string/README.md +325 -0
  293. package/skills/void/docs/node_modules/void/node_modules/ofetch/README.md +398 -0
  294. package/skills/void/docs/node_modules/void/node_modules/pathe/README.md +73 -0
  295. package/skills/void/docs/node_modules/void/node_modules/pg/README.md +95 -0
  296. package/skills/void/docs/node_modules/void/node_modules/pglite-server/LICENSE.md +21 -0
  297. package/skills/void/docs/node_modules/void/node_modules/pglite-server/README.md +135 -0
  298. package/skills/void/docs/node_modules/void/node_modules/picocolors/README.md +21 -0
  299. package/skills/void/docs/node_modules/void/node_modules/tinyglobby/README.md +25 -0
  300. package/skills/void/docs/node_modules/void/node_modules/tsdown/README.md +55 -0
  301. package/skills/void/docs/node_modules/void/node_modules/valibot/LICENSE.md +9 -0
  302. package/skills/void/docs/node_modules/void/node_modules/valibot/README.md +94 -0
  303. package/skills/void/docs/node_modules/void/node_modules/vite/LICENSE.md +2230 -0
  304. package/skills/void/docs/node_modules/void/node_modules/vite/README.md +20 -0
  305. package/skills/void/docs/node_modules/void/node_modules/wrangler/README.md +63 -0
  306. package/skills/void/docs/node_modules/void/node_modules/zod/README.md +191 -0
  307. package/skills/void/docs/node_modules/void/skills/migrate-vite-cloudflare-to-void/SKILL.md +175 -0
  308. package/skills/void/docs/node_modules/void/skills/void/SKILL.md +75 -0
  309. package/skills/void/docs/node_modules/void/skills/void/command/void.md +7 -0
  310. package/skills/void/docs/reference/api.md +917 -0
  311. package/skills/void/docs/reference/cli.md +564 -0
  312. package/skills/void/docs/reference/config.md +408 -0
  313. package/skills/void/docs/reference/resource-inference.md +149 -0
  314. package/skills/void/docs/reference/structure.md +176 -0
  315. package/.npmignore +0 -29
  316. package/.travis.yml +0 -9
  317. package/favicon.ico +0 -0
  318. package/index.js +0 -14
  319. package/lib/Job.js +0 -150
  320. package/lib/Void.js +0 -99
  321. package/lib/scan.js +0 -19
  322. package/test/credentials.js +0 -20
  323. package/test/job.js +0 -64
  324. package/test/static/dir1/test6.html +0 -0
  325. package/test/static/dir2/test7.html +0 -0
  326. package/test/static/dir2/test8.html +0 -0
  327. package/test/static/dir2/test9.html +0 -0
  328. package/test/static/test1.html +0 -0
  329. package/test/static/test2.html +0 -0
  330. package/test/static/test3.html +0 -0
  331. package/test/void.js +0 -31
  332. /package/{test/static/dir1/test4.html → skills/void/docs/integrations/auth-providers.md} +0 -0
  333. /package/{test/static/dir1/test5.html → skills/void/docs/integrations/payment-processors.md} +0 -0
@@ -0,0 +1,622 @@
1
+ import { n as __exportAll } from "./chunk-DJd-R1mw.mjs";
2
+ import { a as join } from "./pathe.M-eThtNZ-D-kmWkCS.mjs";
3
+ import { s as import_picocolors } from "./output-BwlcIYSR.mjs";
4
+ import { t as isVoidInternalStaging } from "./project-TqORyHn8.mjs";
5
+ import { t as cfAccessHeaders } from "./cf-access-Dee5cXxL.mjs";
6
+ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
7
+ import { homedir } from "node:os";
8
+ import { Entry } from "@napi-rs/keyring";
9
+ import { spawnSync } from "node:child_process";
10
+ //#region src/cli/auth.ts
11
+ const CONFIG_DIR = join(homedir(), ".void");
12
+ const CONFIG_PATH = join(CONFIG_DIR, "config.json");
13
+ const KEYRING_SERVICE = "dev.void.cli";
14
+ function keyringGet(account) {
15
+ try {
16
+ return new Entry(KEYRING_SERVICE, account).getPassword();
17
+ } catch {
18
+ return null;
19
+ }
20
+ }
21
+ function keyringSet(account, password) {
22
+ try {
23
+ new Entry(KEYRING_SERVICE, account).setPassword(password);
24
+ return true;
25
+ } catch {
26
+ return false;
27
+ }
28
+ }
29
+ function keyringDelete(account) {
30
+ try {
31
+ new Entry(KEYRING_SERVICE, account).deletePassword();
32
+ return true;
33
+ } catch {
34
+ return false;
35
+ }
36
+ }
37
+ function readConfig() {
38
+ try {
39
+ return JSON.parse(readFileSync(CONFIG_PATH, "utf-8"));
40
+ } catch {
41
+ return {};
42
+ }
43
+ }
44
+ function writeConfig(config) {
45
+ mkdirSync(CONFIG_DIR, { recursive: true });
46
+ writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2) + "\n", { mode: 384 });
47
+ }
48
+ function isStagingMode(root = process.cwd()) {
49
+ return isVoidInternalStaging(root);
50
+ }
51
+ function getSiteDomain(root = process.cwd()) {
52
+ return isStagingMode(root) ? "staging.void.app" : "void.app";
53
+ }
54
+ /**
55
+ * Read the deploy token.
56
+ * Priority: VOID_TOKEN env var > system keychain > ~/.void/config.json (auto-migrated)
57
+ */
58
+ function getToken(root = process.cwd()) {
59
+ const envToken = process.env.VOID_TOKEN;
60
+ if (envToken) return envToken;
61
+ const account = isStagingMode(root) ? "stagingToken" : "token";
62
+ const keyringToken = keyringGet(account);
63
+ if (keyringToken) return keyringToken;
64
+ const config = readConfig();
65
+ const fileToken = config[account];
66
+ if (fileToken) {
67
+ if (keyringSet(account, fileToken)) {
68
+ delete config[account];
69
+ try {
70
+ writeConfig(config);
71
+ } catch {}
72
+ }
73
+ return fileToken;
74
+ }
75
+ return null;
76
+ }
77
+ function getTokenSource() {
78
+ return process.env.VOID_TOKEN ? "ci" : "manual";
79
+ }
80
+ function saveToken(token, root = process.cwd()) {
81
+ const account = isStagingMode(root) ? "stagingToken" : "token";
82
+ if (keyringSet(account, token)) return;
83
+ console.warn(import_picocolors.default.yellow("System keychain unavailable, storing token in ~/.void/config.json"));
84
+ const config = readConfig();
85
+ config[account] = token;
86
+ writeConfig(config);
87
+ }
88
+ function removeToken(root = process.cwd()) {
89
+ const account = isStagingMode(root) ? "stagingToken" : "token";
90
+ let removed = false;
91
+ if (keyringDelete(account)) removed = true;
92
+ try {
93
+ const config = readConfig();
94
+ if (config[account]) {
95
+ delete config[account];
96
+ writeConfig(config);
97
+ removed = true;
98
+ }
99
+ } catch {}
100
+ return removed;
101
+ }
102
+ const DEFAULT_API_URL = "https://api.void.cloud";
103
+ const STAGING_API_URL = "https://api.staging.void.cloud";
104
+ /**
105
+ * Read the API URL from environment or config file.
106
+ * Priority: VOID_API_URL env var > ~/.void/config.json > default
107
+ */
108
+ function getApiUrl(root = process.cwd()) {
109
+ return process.env.VOID_API_URL ?? readConfig().api ?? (isStagingMode(root) ? STAGING_API_URL : DEFAULT_API_URL);
110
+ }
111
+ function page(title, message) {
112
+ return `<!DOCTYPE html>
113
+ <html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
114
+ <title>${title} - Void</title>
115
+ <style>:root{color-scheme:light dark}*{margin:0;padding:0;box-sizing:border-box}body{font-family:system-ui,-apple-system,sans-serif;min-height:100vh;display:flex;align-items:center;justify-content:center;background:#fafafa;color:#111}.card{text-align:center;padding:3rem}h1{font-size:1.5rem;font-weight:600;margin-bottom:.75rem}p{color:#666;font-size:1rem}@media (prefers-color-scheme:dark){body{background:#0a0a0a;color:#fafafa}p{color:#a3a3a3}}</style>
116
+ </head><body><div class="card"><h1>${title}</h1><p>${message}</p></div></body></html>`;
117
+ }
118
+ function openBrowser(url, exec) {
119
+ if (process.platform === "win32") {
120
+ exec(`start "" "${url}"`);
121
+ return;
122
+ }
123
+ if (process.platform === "darwin") {
124
+ exec(`open "${url}"`);
125
+ return;
126
+ }
127
+ if (process.env.WSL_DISTRO_NAME || process.env.WSL_INTEROP) {
128
+ exec(`wslview "${url}" 2>/dev/null || cmd.exe /c start "" "${url}" 2>/dev/null`);
129
+ return;
130
+ }
131
+ exec(`xdg-open "${url}"`);
132
+ }
133
+ /**
134
+ * Start a local HTTP server, open the browser to the platform login page,
135
+ * and wait for the OAuth callback with a JWT token.
136
+ *
137
+ * `onUrl` is invoked with the login URL once the local server is listening,
138
+ * so callers can show the URL to the user as a manual fallback when the
139
+ * browser fails to open (common on WSL2, headless SSH, Docker, etc.).
140
+ */
141
+ async function runLogin(root = process.cwd(), provider = "github", onUrl) {
142
+ const http = await import("node:http");
143
+ const { exec } = await import("node:child_process");
144
+ const apiUrl = getApiUrl(root);
145
+ return new Promise((resolve, reject) => {
146
+ const server = http.createServer((req, res) => {
147
+ const url = new URL(req.url, `http://localhost`);
148
+ if (url.pathname !== "/callback") {
149
+ res.writeHead(404);
150
+ res.end("Not found");
151
+ return;
152
+ }
153
+ if (url.searchParams.get("error") === "signup_restricted") {
154
+ res.writeHead(403, { "Content-Type": "text/html" });
155
+ res.end(page("Signup restricted", "Your email is not on the approved list for this environment."));
156
+ server.close();
157
+ reject(/* @__PURE__ */ new Error("Signup restricted: your email is not on the approved list for this environment."));
158
+ return;
159
+ }
160
+ const token = url.searchParams.get("token");
161
+ if (!token) {
162
+ res.writeHead(400, { "Content-Type": "text/html" });
163
+ res.end(page("Login failed", "No token received. Please try again."));
164
+ server.close();
165
+ reject(/* @__PURE__ */ new Error("auth: No token received from callback. Try logging in again."));
166
+ return;
167
+ }
168
+ res.writeHead(200, { "Content-Type": "text/html" });
169
+ res.end(page("Login successful!", "You can close this tab and return to the terminal."));
170
+ server.close();
171
+ resolve(token);
172
+ });
173
+ server.on("connection", (socket) => socket.unref());
174
+ server.listen(0, "127.0.0.1", () => {
175
+ const addr = server.address();
176
+ if (!addr || typeof addr === "string") {
177
+ reject(/* @__PURE__ */ new Error("auth: Failed to start local callback server."));
178
+ return;
179
+ }
180
+ const redirect = `http://localhost:${addr.port}/callback`;
181
+ const loginUrl = `${apiUrl}/auth/login?redirect=${encodeURIComponent(redirect)}&provider=${provider}`;
182
+ onUrl?.(loginUrl);
183
+ openBrowser(loginUrl, exec);
184
+ });
185
+ setTimeout(() => {
186
+ server.close();
187
+ reject(/* @__PURE__ */ new Error("auth: Login timed out after 5 minutes. Try again."));
188
+ }, 300 * 1e3).unref();
189
+ });
190
+ }
191
+ //#endregion
192
+ //#region src/cli/cf-access.ts
193
+ const probedHosts = /* @__PURE__ */ new Set();
194
+ /**
195
+ * If the CLI is about to talk to a Cloudflare-Access-gated staging host,
196
+ * probe the locally-installed `cloudflared` binary for a cached user JWT
197
+ * and export it as `CF_ACCESS_TOKEN`. On interactive shells with no cached
198
+ * token, open a browser login flow to populate the cache, then re-read it.
199
+ *
200
+ * Cached per-host so that an early non-gated call (e.g. prod) does not
201
+ * permanently disable the probe for a later gated call (e.g. staging) in
202
+ * the same process. Noop when:
203
+ * - a service-token pair is already set (CI path)
204
+ * - `CF_ACCESS_TOKEN` is already set (manual override or prior probe)
205
+ * - the target host is not gated
206
+ * - `cloudflared` is not installed
207
+ */
208
+ function ensureCloudflaredToken(apiUrl) {
209
+ if (process.env.CF_ACCESS_CLIENT_ID && process.env.CF_ACCESS_CLIENT_SECRET) return;
210
+ if (process.env.CF_ACCESS_TOKEN) return;
211
+ if (!isGatedHost(apiUrl)) return;
212
+ const host = new URL(apiUrl).hostname;
213
+ if (probedHosts.has(host)) return;
214
+ probedHosts.add(host);
215
+ let token = runCloudflared([
216
+ "access",
217
+ "token",
218
+ `-app=${apiUrl}`
219
+ ]);
220
+ if (!token && process.stdin.isTTY && process.stdout.isTTY) {
221
+ runCloudflared([
222
+ "access",
223
+ "login",
224
+ apiUrl
225
+ ], {
226
+ inherit: true,
227
+ timeoutMs: 12e4
228
+ });
229
+ token = runCloudflared([
230
+ "access",
231
+ "token",
232
+ `-app=${apiUrl}`
233
+ ]);
234
+ }
235
+ if (token) process.env.CF_ACCESS_TOKEN = token;
236
+ }
237
+ function runCloudflared(args, opts) {
238
+ try {
239
+ const result = spawnSync("cloudflared", args, {
240
+ encoding: "utf-8",
241
+ stdio: opts?.inherit ? "inherit" : [
242
+ "ignore",
243
+ "pipe",
244
+ "pipe"
245
+ ],
246
+ timeout: opts?.timeoutMs ?? 5e3
247
+ });
248
+ if (result.error || result.status !== 0) return null;
249
+ const out = (result.stdout ?? "").trim();
250
+ return out.length > 0 ? out : null;
251
+ } catch {
252
+ return null;
253
+ }
254
+ }
255
+ function isGatedHost(apiUrl) {
256
+ try {
257
+ const host = new URL(apiUrl).hostname;
258
+ return host.endsWith(".staging.void.cloud") || host.endsWith(".staging.void.app");
259
+ } catch {
260
+ return false;
261
+ }
262
+ }
263
+ //#endregion
264
+ //#region src/cli/client.ts
265
+ var client_exports = /* @__PURE__ */ __exportAll({
266
+ PlatformApiError: () => PlatformApiError,
267
+ PlatformClient: () => PlatformClient,
268
+ isExpiredTokenError: () => isExpiredTokenError,
269
+ parsePlatformErrorBody: () => parsePlatformErrorBody
270
+ });
271
+ function parsePlatformErrorBody(body) {
272
+ try {
273
+ const parsed = JSON.parse(body);
274
+ if (!parsed || typeof parsed !== "object") return null;
275
+ return parsed;
276
+ } catch {
277
+ return null;
278
+ }
279
+ }
280
+ var PlatformApiError = class extends Error {
281
+ status;
282
+ body;
283
+ code;
284
+ constructor(action, status, body) {
285
+ super(`${action}: ${status} ${body}`);
286
+ this.name = "PlatformApiError";
287
+ this.status = status;
288
+ this.body = body;
289
+ const parsed = parsePlatformErrorBody(body);
290
+ this.code = parsed?.error ?? parsed?.message;
291
+ }
292
+ };
293
+ async function throwPlatformApiError(action, res) {
294
+ throw new PlatformApiError(action, res.status, await res.text());
295
+ }
296
+ function isExpiredTokenError(error) {
297
+ if (error instanceof PlatformApiError) return error.status === 401 && error.code === "invalid or expired token";
298
+ return false;
299
+ }
300
+ /**
301
+ * HTTP client for the Void platform API.
302
+ */
303
+ var PlatformClient = class {
304
+ baseUrl;
305
+ authHeaders;
306
+ cliLog;
307
+ constructor(token, options) {
308
+ if (typeof options === "string") this.baseUrl = options;
309
+ else {
310
+ this.baseUrl = options?.apiUrl ?? getApiUrl(options?.root);
311
+ this.cliLog = options?.cliLog;
312
+ }
313
+ ensureCloudflaredToken(this.baseUrl);
314
+ this.authHeaders = {
315
+ Authorization: `Bearer ${token}`,
316
+ ...cfAccessHeaders(process.env)
317
+ };
318
+ }
319
+ async whoami() {
320
+ const res = await fetch(`${this.baseUrl}/me`, { headers: { ...this.authHeaders } });
321
+ if (!res.ok) await throwPlatformApiError("Failed to fetch user info", res);
322
+ return res.json();
323
+ }
324
+ async listProjects() {
325
+ const res = await fetch(`${this.baseUrl}/projects`, { headers: { ...this.authHeaders } });
326
+ if (!res.ok) await throwPlatformApiError("Failed to list projects", res);
327
+ return res.json();
328
+ }
329
+ async listDeployments(projectId) {
330
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/deployments`, { headers: { ...this.authHeaders } });
331
+ if (!res.ok) await throwPlatformApiError("Failed to list deployments", res);
332
+ return res.json();
333
+ }
334
+ async rollback(projectId, deploymentId, options) {
335
+ const body = { deploymentId };
336
+ if (options?.allowDestructive && options.allowDestructive.length > 0) body.allowDestructive = options.allowDestructive;
337
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/rollback`, {
338
+ method: "POST",
339
+ headers: {
340
+ "Content-Type": "application/json",
341
+ ...this.authHeaders
342
+ },
343
+ body: JSON.stringify(body)
344
+ });
345
+ if (!res.ok) await throwPlatformApiError("Rollback failed", res);
346
+ return res.json();
347
+ }
348
+ async cancelDeployment(projectId, deploymentId) {
349
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/deployments/${deploymentId}/cancel`, {
350
+ method: "POST",
351
+ headers: { ...this.authHeaders }
352
+ });
353
+ if (!res.ok) await throwPlatformApiError("Cancel deployment failed", res);
354
+ return res.json();
355
+ }
356
+ async createProject(slug) {
357
+ const res = await fetch(`${this.baseUrl}/projects`, {
358
+ method: "POST",
359
+ headers: {
360
+ "Content-Type": "application/json",
361
+ ...this.authHeaders
362
+ },
363
+ body: JSON.stringify({ slug })
364
+ });
365
+ if (!res.ok) await throwPlatformApiError("Failed to create project", res);
366
+ return res.json();
367
+ }
368
+ async preflight(projectId, assetManifest, hasWorker) {
369
+ const total = Object.keys(assetManifest).length;
370
+ try {
371
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/deploy/preflight`, {
372
+ method: "POST",
373
+ headers: {
374
+ "Content-Type": "application/json",
375
+ ...this.authHeaders
376
+ },
377
+ body: JSON.stringify({
378
+ assetManifest,
379
+ ...hasWorker && { hasWorker }
380
+ })
381
+ });
382
+ if (!res.ok) {
383
+ const error = new PlatformApiError("Preflight failed", res.status, await res.text());
384
+ if (isExpiredTokenError(error)) throw error;
385
+ return {
386
+ needed: Object.keys(assetManifest),
387
+ total,
388
+ skipped: 0
389
+ };
390
+ }
391
+ return res.json();
392
+ } catch (error) {
393
+ if (isExpiredTokenError(error)) throw error;
394
+ return {
395
+ needed: Object.keys(assetManifest),
396
+ total,
397
+ skipped: 0
398
+ };
399
+ }
400
+ }
401
+ async *deploy(projectId, formData) {
402
+ const cliLog = this.cliLog;
403
+ const url = `${this.baseUrl}/projects/${projectId}/deploy`;
404
+ cliLog?.info("deploy_post", { url });
405
+ let res;
406
+ try {
407
+ res = await fetch(url, {
408
+ method: "POST",
409
+ headers: { ...this.authHeaders },
410
+ body: formData
411
+ });
412
+ } catch (err) {
413
+ cliLog?.error("deploy_fetch_rejected", err, { url });
414
+ throw err;
415
+ }
416
+ const cfRay = res.headers.get("cf-ray");
417
+ const cfCacheStatus = res.headers.get("cf-cache-status");
418
+ cliLog?.info("deploy_response", {
419
+ status: res.status,
420
+ cfRay,
421
+ cfCacheStatus,
422
+ contentType: res.headers.get("content-type")
423
+ });
424
+ if (!res.ok) await throwPlatformApiError("Deploy failed", res);
425
+ const reader = res.body.getReader();
426
+ const decoder = new TextDecoder();
427
+ let buffer = "";
428
+ let bytesRead = 0;
429
+ let firstByteAt = null;
430
+ const startedAt = Date.now();
431
+ let eventCount = 0;
432
+ let lastEventName = "<none>";
433
+ try {
434
+ while (true) {
435
+ const { done, value } = await reader.read();
436
+ if (done) {
437
+ cliLog?.info("deploy_stream_eof", {
438
+ bytesRead,
439
+ eventCount,
440
+ lastEvent: lastEventName
441
+ });
442
+ break;
443
+ }
444
+ if (firstByteAt === null) {
445
+ firstByteAt = Date.now() - startedAt;
446
+ cliLog?.info("deploy_stream_ttfb", { ttfbMs: firstByteAt });
447
+ }
448
+ bytesRead += value.byteLength;
449
+ buffer += decoder.decode(value, { stream: true });
450
+ let newlineIdx;
451
+ while ((newlineIdx = buffer.indexOf("\n")) !== -1) {
452
+ const line = buffer.slice(0, newlineIdx);
453
+ buffer = buffer.slice(newlineIdx + 1);
454
+ if (line.trim()) {
455
+ const event = JSON.parse(line);
456
+ eventCount++;
457
+ lastEventName = event.event ?? "<no-event-field>";
458
+ cliLog?.info("deploy_event", {
459
+ eventCount,
460
+ event: lastEventName,
461
+ raw: line.slice(0, 200)
462
+ });
463
+ yield event;
464
+ }
465
+ }
466
+ }
467
+ } catch (err) {
468
+ cliLog?.error("deploy_stream_error", err, {
469
+ bytesRead,
470
+ eventCount,
471
+ lastEvent: lastEventName
472
+ });
473
+ throw err;
474
+ }
475
+ }
476
+ async listSecrets(projectId) {
477
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/secrets`, { headers: { ...this.authHeaders } });
478
+ if (!res.ok) await throwPlatformApiError("Failed to list secrets", res);
479
+ return res.json();
480
+ }
481
+ async setSecret(projectId, name, value) {
482
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/secrets/${encodeURIComponent(name)}`, {
483
+ method: "PUT",
484
+ headers: {
485
+ "Content-Type": "application/json",
486
+ ...this.authHeaders
487
+ },
488
+ body: JSON.stringify({ value })
489
+ });
490
+ if (!res.ok) await throwPlatformApiError("Failed to set secret", res);
491
+ return res.json();
492
+ }
493
+ async deleteProject(projectId) {
494
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}`, {
495
+ method: "DELETE",
496
+ headers: { ...this.authHeaders }
497
+ });
498
+ if (!res.ok) await throwPlatformApiError("Failed to delete project", res);
499
+ return res.json();
500
+ }
501
+ async getMigrationStatus(projectId) {
502
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/migrations`, { headers: { ...this.authHeaders } });
503
+ if (!res.ok) await throwPlatformApiError("Failed to get migration status", res);
504
+ return res.json();
505
+ }
506
+ async applyRemoteMigrations(projectId, migrations) {
507
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/migrations/apply`, {
508
+ method: "POST",
509
+ headers: {
510
+ "Content-Type": "application/json",
511
+ ...this.authHeaders
512
+ },
513
+ body: JSON.stringify({ migrations })
514
+ });
515
+ if (!res.ok) await throwPlatformApiError("Failed to apply remote migrations", res);
516
+ return res.json();
517
+ }
518
+ async renameMigrations(projectId, renames) {
519
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/migrations/rename`, {
520
+ method: "POST",
521
+ headers: {
522
+ "Content-Type": "application/json",
523
+ ...this.authHeaders
524
+ },
525
+ body: JSON.stringify({ renames })
526
+ });
527
+ if (!res.ok) await throwPlatformApiError("Failed to rename remote migrations", res);
528
+ return res.json();
529
+ }
530
+ async addDomain(projectId, hostname) {
531
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/domains`, {
532
+ method: "POST",
533
+ headers: {
534
+ "Content-Type": "application/json",
535
+ ...this.authHeaders
536
+ },
537
+ body: JSON.stringify({ hostname })
538
+ });
539
+ if (!res.ok) await throwPlatformApiError("Failed to add domain", res);
540
+ return res.json();
541
+ }
542
+ async listDomains(projectId) {
543
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/domains`, { headers: { ...this.authHeaders } });
544
+ if (!res.ok) await throwPlatformApiError("Failed to list domains", res);
545
+ return res.json();
546
+ }
547
+ async getDomainStatus(projectId, domainId) {
548
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/domains/${domainId}`, { headers: { ...this.authHeaders } });
549
+ if (!res.ok) await throwPlatformApiError("Failed to get domain status", res);
550
+ return res.json();
551
+ }
552
+ async removeDomain(projectId, domainId) {
553
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/domains/${domainId}`, {
554
+ method: "DELETE",
555
+ headers: { ...this.authHeaders }
556
+ });
557
+ if (!res.ok) await throwPlatformApiError("Failed to remove domain", res);
558
+ return res.json();
559
+ }
560
+ async deleteSecret(projectId, name) {
561
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/secrets/${encodeURIComponent(name)}`, {
562
+ method: "DELETE",
563
+ headers: { ...this.authHeaders }
564
+ });
565
+ if (!res.ok) await throwPlatformApiError("Failed to delete secret", res);
566
+ return res.json();
567
+ }
568
+ async getResources(projectId) {
569
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/resources`, { headers: { ...this.authHeaders } });
570
+ if (!res.ok) await throwPlatformApiError("Failed to get resources", res);
571
+ return res.json();
572
+ }
573
+ async provisionDatabase(projectId, connectionString) {
574
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/database`, {
575
+ method: "POST",
576
+ headers: {
577
+ "Content-Type": "application/json",
578
+ ...this.authHeaders
579
+ },
580
+ body: JSON.stringify({ connectionString })
581
+ });
582
+ if (!res.ok) await throwPlatformApiError("Failed to provision database", res);
583
+ return res.json();
584
+ }
585
+ async setDatabaseUrl(projectId, connectionString) {
586
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/database-url`, {
587
+ method: "PUT",
588
+ headers: {
589
+ "Content-Type": "application/json",
590
+ ...this.authHeaders
591
+ },
592
+ body: JSON.stringify({ connectionString })
593
+ });
594
+ if (!res.ok) await throwPlatformApiError("Failed to update database URL", res);
595
+ return res.json();
596
+ }
597
+ async purgeCache(projectId) {
598
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/revalidate`, {
599
+ method: "POST",
600
+ headers: {
601
+ "Content-Type": "application/json",
602
+ ...this.authHeaders
603
+ },
604
+ body: JSON.stringify({ all: true })
605
+ });
606
+ if (!res.ok) await throwPlatformApiError("Cache purge failed", res);
607
+ return res.json();
608
+ }
609
+ async getLogs(projectId, since, limit = 200, deploymentId, level) {
610
+ const params = new URLSearchParams({
611
+ since,
612
+ limit: String(limit)
613
+ });
614
+ if (deploymentId) params.set("deploymentId", deploymentId);
615
+ if (level && level !== "all") params.set("level", level);
616
+ const res = await fetch(`${this.baseUrl}/projects/${projectId}/logs?${params}`, { headers: { ...this.authHeaders } });
617
+ if (!res.ok) await throwPlatformApiError("Failed to fetch logs", res);
618
+ return (await res.json()).data;
619
+ }
620
+ };
621
+ //#endregion
622
+ export { parsePlatformErrorBody as a, getTokenSource as c, runLogin as d, saveToken as f, isExpiredTokenError as i, isStagingMode as l, PlatformClient as n, getSiteDomain as o, client_exports as r, getToken as s, PlatformApiError as t, removeToken as u };
@@ -0,0 +1,55 @@
1
+ import { n as __exportAll } from "./chunk-DJd-R1mw.mjs";
2
+ import { a as join, n as dirname } from "./pathe.M-eThtNZ-D-kmWkCS.mjs";
3
+ import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
4
+ //#region src/migrations/collect.ts
5
+ var collect_exports = /* @__PURE__ */ __exportAll({
6
+ collectMigrations: () => collectMigrations,
7
+ readJournal: () => readJournal,
8
+ stripSqlExt: () => stripSqlExt,
9
+ writeJournal: () => writeJournal
10
+ });
11
+ /**
12
+ * Collect all .sql migration files from the migrations directory,
13
+ * sorted by filename (lexicographic order).
14
+ */
15
+ function collectMigrations(migrationsDir) {
16
+ if (!existsSync(migrationsDir)) return [];
17
+ return readdirSync(migrationsDir).filter((f) => f.endsWith(".sql") && f !== "seed.sql").sort().map((name) => ({
18
+ name,
19
+ sql: readFileSync(join(migrationsDir, name), "utf-8")
20
+ }));
21
+ }
22
+ /**
23
+ * Read `db/migrations/meta/_journal.json` if it exists. Drizzle maintains
24
+ * this file whenever `drizzle-kit generate` runs; every `.sql` migration
25
+ * under `db/migrations/` should correspond to an entry whose `tag` is the
26
+ * filename without the `.sql` suffix.
27
+ */
28
+ function readJournal(migrationsDir) {
29
+ const journalPath = join(migrationsDir, "meta", "_journal.json");
30
+ if (!existsSync(journalPath)) return;
31
+ try {
32
+ return JSON.parse(readFileSync(journalPath, "utf-8"));
33
+ } catch (err) {
34
+ throw new Error(`db: Failed to parse db/migrations/meta/_journal.json: '${err.message}'.`);
35
+ }
36
+ }
37
+ /**
38
+ * Write `db/migrations/meta/_journal.json` with pretty-printed JSON and a
39
+ * trailing newline, matching the format Drizzle itself emits. Creates the
40
+ * `meta/` directory if it does not yet exist.
41
+ */
42
+ function writeJournal(migrationsDir, journal) {
43
+ const journalPath = join(migrationsDir, "meta", "_journal.json");
44
+ mkdirSync(dirname(journalPath), { recursive: true });
45
+ writeFileSync(journalPath, JSON.stringify(journal, null, 2) + "\n");
46
+ }
47
+ /**
48
+ * Drop the `.sql` extension from a migration filename, leaving any other
49
+ * suffix untouched. Used to line filenames up with journal `tag` values.
50
+ */
51
+ function stripSqlExt(name) {
52
+ return name.endsWith(".sql") ? name.slice(0, -4) : name;
53
+ }
54
+ //#endregion
55
+ export { writeJournal as a, stripSqlExt as i, collect_exports as n, readJournal as r, collectMigrations as t };