void 0.20.2 → 0.21.0
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.
- package/README.md +2 -2
- package/dist/agents-gni4eqBu.mjs +111 -0
- package/dist/auth-3sGB0zJ1.mjs +22 -0
- package/dist/{auth-DPl6kck4.mjs → auth-B9_D6ygs.mjs} +6 -241
- package/dist/auth-CAw7zHqj.mjs +2 -0
- package/dist/auth-client-BWBT8HLp.mjs +6 -0
- package/dist/auth-client-Bawdj38n.d.mts +7 -0
- package/dist/auth-client-react-7GFffu8R.d.mts +7 -0
- package/dist/auth-client-react-CMLwT2xI.mjs +6 -0
- package/dist/auth-client-solid-DyTFL4cq.d.mts +7 -0
- package/dist/auth-client-solid-UoreJWZG.mjs +6 -0
- package/dist/auth-client-svelte-Cv_WvrRk.mjs +6 -0
- package/dist/auth-client-svelte-zetW0KIH.d.mts +7 -0
- package/dist/auth-client-vue-CFk7Xbv3.mjs +6 -0
- package/dist/auth-client-vue-bChShbQP.d.mts +7 -0
- package/dist/{auth-cmd-gniL2fNt.mjs → auth-cmd-MkBG2u1f.mjs} +5 -5
- package/dist/{auth-link-NZdjCmSc.mjs → auth-link-Devmv96E.mjs} +5 -5
- package/dist/{better-auth-shared-DSCeohOK.d.mts → better-auth-shared-BoVwA5Vm.d.mts} +1 -6
- package/dist/{better-auth-shared-CYw1T3k4.mjs → better-auth-shared-syGYYmnY.mjs} +1 -1
- package/dist/{build-cmd-sI18tX_O.mjs → build-cmd-DsBGwtfs.mjs} +6 -4
- package/dist/{cache-IHn5MwBC.mjs → cache-BMw8eMyF.mjs} +6 -4
- package/dist/{cancel-deploy-C5qTOdLi.mjs → cancel-deploy-B3_s9NIN.mjs} +5 -3
- package/dist/cf-access-rAZxzMkL.mjs +181 -0
- package/dist/cf-build-output-CTdlo6Rt.mjs +520 -0
- package/dist/cli/cf-compat.d.mts +1 -0
- package/dist/cli/cf-compat.mjs +934 -0
- package/dist/cli/cli.mjs +61 -38
- package/dist/cli/env-schema-probe.mjs +3 -3
- package/dist/client-DAAivdid.mjs +2 -0
- package/dist/{client-dHfSJvAN.mjs → client-PdAJ-F0t.mjs} +148 -89
- package/dist/{cloudflare-auth-6M5llVPC.mjs → cloudflare-auth-BCmTc1X_.mjs} +13 -44
- package/dist/{cloudflare-cmd-4RPGN3KB.mjs → cloudflare-cmd-D6PrKn7o.mjs} +4 -7
- package/dist/{cloudflare-connect-t1UU5svD.mjs → cloudflare-connect-DloREDlc.mjs} +6 -6
- package/dist/cloudflare-operations-BHNJVDbN.mjs +2 -0
- package/dist/{cloudflare-operations-BzWnlC1_.mjs → cloudflare-operations-CPEdHYhM.mjs} +37 -39
- package/dist/cloudflare-user-output-Q-k0QoNQ.mjs +20 -0
- package/dist/collect-DAUItMDS.mjs +2 -0
- package/dist/collect-DXHNWHcT.mjs +48 -0
- package/dist/config--T87TD8T.mjs +2 -0
- package/dist/{config-NOG_U1aK.mjs → config-BSe70f4T.mjs} +4 -6
- package/dist/config-DDIFxQYx.mjs +2 -0
- package/dist/{config-uNGuFsI2.mjs → config-Dxr6cTXn.mjs} +22 -37
- package/dist/config-DywxBLQC.d.mts +185 -0
- package/dist/config-entry.d.mts +6 -0
- package/dist/config-entry.mjs +7 -0
- package/dist/config-uP7ZDtVZ.mjs +21 -0
- package/dist/config-write-y3CBI_ux.mjs +60 -0
- package/dist/{connect-Bfk31O_8.mjs → connect-BvC9kolB.mjs} +8 -6
- package/dist/{create-project-Bk9Z0-Jg.mjs → create-project-C9lQhRzj.mjs} +9 -25
- package/dist/create-project-CI-17RVJ.mjs +2 -0
- package/dist/database-provider-Cx525bwX.mjs +6 -0
- package/dist/database-provider.mjs +1 -5
- package/dist/{db-BkRoptAt.mjs → db-R7IQgOv5.mjs} +48 -44
- package/dist/{delete-DouASY9P.mjs → delete-CghI_NXn.mjs} +6 -4
- package/dist/deploy-CYPymbtG.mjs +2 -0
- package/dist/{deploy-DTaWUS1S.mjs → deploy-H968Lo4T.mjs} +765 -197
- package/dist/discover-BBzDZe_o.mjs +2 -0
- package/dist/{discover-xvfrgJeo.mjs → discover-C4O6YxVS.mjs} +3 -8
- package/dist/{dist-BrsS7cai.mjs → dist-4WkAWhWx.mjs} +1 -15
- package/dist/{dist-m40_XgNh.mjs → dist-Bn8Kodjp.mjs} +1 -1
- package/dist/dist-C5fND3R0.mjs +2 -0
- package/dist/dist-D7-nEOXi.mjs +2 -0
- package/dist/{output-B0cfNSx5.mjs → dist-Dn6nn2IU.mjs} +3 -926
- package/dist/{domain-1RhhOVrC.mjs → domain-CITt8lC-.mjs} +7 -5
- package/dist/{route-types-Da-DpyUp.mjs → drizzle-Beb2Am5S.mjs} +1 -280
- package/dist/{email-Ce6SQq-i.mjs → email-C5kaZXzJ.mjs} +2 -2
- package/dist/{email-C-lGh51B.mjs → email-_8VmyX7V.mjs} +14 -12
- package/dist/{entry-DU3oDoQ3.mjs → entry-DdRFGK0y.mjs} +2 -2
- package/dist/{env-DJHsPE7Z.mjs → env-DV4r3nHz.mjs} +9 -7
- package/dist/{env-DBKmK4vc.mjs → env-DX_v-Q-v.mjs} +1 -1
- package/dist/env-Yz4HcvHs.mjs +78 -0
- package/dist/env-helpers--wFmQ_5Q.mjs +136 -0
- package/dist/{env-types-BNPhro-M.mjs → env-types-CWDtqHgw.mjs} +6 -2
- package/dist/{env-validation-CF6KvTRf.mjs → env-validation-BsFEXps5.mjs} +19 -28
- package/dist/env-validation-DIDGM7h4.mjs +2 -0
- package/dist/fetch-CXDChK7B.mjs +18 -0
- package/dist/fetch-_SeGZao9.d.mts +57 -0
- package/dist/fetch-stream-AOByI7Ki.mjs +81 -0
- package/dist/fetch-stream-Bjf0hoZb.d.mts +49 -0
- package/dist/gen-BBiIZw6g.mjs +2 -0
- package/dist/{gen-B_wPnVTK.mjs → gen-CFOEEc-t.mjs} +13 -11
- package/dist/{generate-RTK8_kK1.mjs → generate-C0VY6RVf.mjs} +2 -2
- package/dist/{github-cmd-PW7ZnWTp.mjs → github-cmd-jYjha2LO.mjs} +18 -22
- package/dist/{handler-D1hLsObx.d.mts → handler-BXJTXd02.d.mts} +6 -1
- package/dist/handler-DghKr6dU.mjs +150 -0
- package/dist/head-D_QRR5Yd.mjs +112 -0
- package/dist/head-client-DzmJGN4C.mjs +90 -0
- package/dist/{headers-BAHwgHdW.mjs → headers-B_HBMgi0.mjs} +2 -2
- package/dist/{help-CwOX-zmI.mjs → help-C46mnlUS.mjs} +17 -12
- package/dist/help-CS_nAsWu.mjs +2 -0
- package/dist/index.d.mts +2 -20
- package/dist/index.mjs +116 -60
- package/dist/{init-BWZ7q5Z4.mjs → init-CSXmvxKu.mjs} +49 -50
- package/dist/{link-Rmvu2Wl_.mjs → link-DxMOALXk.mjs} +7 -5
- package/dist/{list-DEE2S6mY.mjs → list-0wQs0oYg.mjs} +7 -5
- package/dist/live-CB1y5IuC.mjs +411 -0
- package/dist/live-CKiJilLr.d.mts +105 -0
- package/dist/local-d1-DzykTWY8.mjs +104 -0
- package/dist/{login-Uvferzmm.mjs → login-CKk5NX4d.mjs} +6 -11
- package/dist/login-Ch9cgWRF.mjs +2 -0
- package/dist/{logs-27FenuiC.mjs → logs-hxWBSoej.mjs} +6 -4
- package/dist/migrate-CLty4mZR.mjs +2 -0
- package/dist/migrate-DcW8F2W8.mjs +285 -0
- package/dist/migration-handler-DM4clYj5.d.mts +51 -0
- package/dist/{neon-DHwd2zvC.mjs → neon-n74ta1Pr.mjs} +1 -1
- package/dist/{node-Ez5KW5rn.mjs → node-Cupyf7-s.mjs} +6 -6
- package/dist/{operator-auth-B3e08unv.mjs → operator-auth-BkVgJqv-.mjs} +2 -2
- package/dist/{operator-client-LUZnlnYk.mjs → operator-client-A0iex2yi.mjs} +2 -1
- package/dist/{operator-cmd-CjOTmAYE.mjs → operator-cmd-BEUYhaHB.mjs} +6 -6
- package/dist/output-urU86XeT.mjs +146 -0
- package/dist/{package-json-CPoWX79C.mjs → package-json-iCbMg5XF.mjs} +1 -1
- package/dist/pages/client.d.mts +5 -2
- package/dist/pages/client.mjs +5 -3
- package/dist/pages/head-client.mjs +1 -89
- package/dist/pages/head.mjs +1 -111
- package/dist/pages/index.d.mts +2 -3
- package/dist/pages/index.mjs +7 -7
- package/dist/pages/islands-plugin.mjs +2 -2
- package/dist/pages/prefetch.d.mts +2 -30
- package/dist/pages/prefetch.mjs +1 -89
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +3 -3
- package/dist/pages/serialize.d.mts +2 -9
- package/dist/pages/serialize.mjs +1 -13
- package/dist/plan-BEZ8VJW0.mjs +256 -0
- package/dist/plan-DpuOr14e.mjs +2 -0
- package/dist/{platform-auth-config-DrbQXXiW.mjs → platform-auth-config-Df6yVw-e.mjs} +6 -6
- package/dist/{platform-auth-protection-Bhtvp0B_.mjs → platform-auth-protection-Jb0yftay.mjs} +7 -5
- package/dist/{platform-auth-recovery-CeOKGVeJ.mjs → platform-auth-recovery-DmRyIfW0.mjs} +6 -5
- package/dist/platform-cmd-C9Vt7m-d.mjs +2 -0
- package/dist/{platform-cmd-BFhieCdV.mjs → platform-cmd-DRxCOTwy.mjs} +8 -5
- package/dist/{platform-domain-C74PULqV.mjs → platform-domain-IjiXgrXJ.mjs} +4 -3
- package/dist/{platform-lifecycle-BwAIgz-t.mjs → platform-lifecycle-BquAaU-5.mjs} +263 -56
- package/dist/platform-lifecycle-CuJIZNvA.mjs +2 -0
- package/dist/{platform-management-COogu_Se.mjs → platform-management-CCQKGsq4.mjs} +12 -7
- package/dist/platform-management-Cgyed0WY.mjs +2 -0
- package/dist/{platform-recovery-ewqLefp1.mjs → platform-recovery-DS8ih1SW.mjs} +3 -3
- package/dist/platform-registry-BJbgZLS1.mjs +431 -0
- package/dist/{plugin-inference-BDRfZngg.mjs → plugin-inference-DsvtJLll.mjs} +4 -4
- package/dist/prefetch-Bsc_Pb6c.mjs +90 -0
- package/dist/prefetch-Ce6la4EI.d.mts +31 -0
- package/dist/{prepare-blNRQvQl.mjs → prepare-CaUxODOU.mjs} +3 -2
- package/dist/prepare-D4CkM3_v.mjs +2 -0
- package/dist/{prepare-CtDJjoOj.mjs → prepare-pcWcxSCh.mjs} +13 -11
- package/dist/prerender-render-Cf_WDE9W.mjs +111 -0
- package/dist/prerender-render.mjs +1 -110
- package/dist/{preset-lAy0B0BQ.mjs → preset-Dowh9tTt.mjs} +16 -118
- package/dist/project-BEBFDFLz.mjs +2 -0
- package/dist/project-CWNIPoXc.mjs +209 -0
- package/dist/{project-cmd-DmZK9Hxf.mjs → project-cmd-2lN--YAX.mjs} +18 -16
- package/dist/{project-paths-SK8nMHPp.mjs → project-paths-CKQ-Q5JS.mjs} +47 -14
- package/dist/project-slug-23TpquG4.mjs +8 -0
- package/dist/project-slug-DofjTFd-.mjs +2 -0
- package/dist/{project-team-D8jOJMUJ.mjs → project-team-Dapn9HZn.mjs} +9 -5
- package/dist/{project-token-DA34bf-C.mjs → project-token-C90v9SJK.mjs} +6 -4
- package/dist/{project-tsconfig-Ql2XsSQp.mjs → project-tsconfig-CwfqUnVp.mjs} +2 -2
- package/dist/{protocol-C-pqYJjE.d.mts → protocol-ZH3jP4a7.d.mts} +1 -1
- package/dist/providers-BNKRacMr.d.mts +7 -0
- package/dist/provision-CNgEBkVA.mjs +3 -0
- package/dist/{provision-CSJOjjQk.mjs → provision-Cck2m3jJ.mjs} +11 -25
- package/dist/queues-BWKt1Xo4.d.mts +7 -0
- package/dist/{requests-CUExwGQQ.mjs → requests-CzX46I0i.mjs} +5 -3
- package/dist/resolve-project-BTotl8Nn.mjs +2 -0
- package/dist/{resolve-project--Vxawf7z.mjs → resolve-project-Xvis70DG.mjs} +2 -8
- package/dist/response-Tn7rU0MV.mjs +30 -0
- package/dist/{rollback-CDNGU1gr.mjs → rollback-BEeyc73H.mjs} +6 -4
- package/dist/{rolldown-runtime-rQ84J-ij.mjs → rolldown-runtime-DXIUcv95.mjs} +1 -10
- package/dist/route-types-Id82-veQ.mjs +280 -0
- package/dist/{local-d1-D2I6Ox5F.mjs → runner-BGVsGgkb.mjs} +6 -114
- package/dist/runner-CQs_cDSG.mjs +2 -0
- package/dist/runner-mysql-1o47achK.mjs +2 -0
- package/dist/{runner-mysql-7BPUNGmL.mjs → runner-mysql-BhwMk2Bm.mjs} +2 -9
- package/dist/{runner-pg-BkEza-dX.mjs → runner-pg-CJ_JeGF6.mjs} +2 -9
- package/dist/runner-pg-D7z01mQS.mjs +2 -0
- package/dist/runtime/ai.mjs +1 -1
- package/dist/runtime/auth-client-react.d.mts +2 -6
- package/dist/runtime/auth-client-react.mjs +1 -5
- package/dist/runtime/auth-client-solid.d.mts +2 -6
- package/dist/runtime/auth-client-solid.mjs +1 -5
- package/dist/runtime/auth-client-svelte.d.mts +2 -6
- package/dist/runtime/auth-client-svelte.mjs +1 -5
- package/dist/runtime/auth-client-vue.d.mts +2 -6
- package/dist/runtime/auth-client-vue.mjs +1 -5
- package/dist/runtime/auth-client.d.mts +2 -6
- package/dist/runtime/auth-client.mjs +1 -5
- package/dist/runtime/auth.mjs +1 -21
- package/dist/runtime/better-auth-mysql.d.mts +1 -1
- package/dist/runtime/better-auth-mysql.mjs +1 -1
- package/dist/runtime/better-auth-pg.d.mts +1 -1
- package/dist/runtime/better-auth-pg.mjs +1 -1
- package/dist/runtime/better-auth.d.mts +1 -1
- package/dist/runtime/better-auth.mjs +1 -1
- package/dist/runtime/client-react.d.mts +3 -3
- package/dist/runtime/client-react.mjs +3 -3
- package/dist/runtime/client-solid.d.mts +3 -3
- package/dist/runtime/client-solid.mjs +3 -3
- package/dist/runtime/client-svelte.d.mts +3 -3
- package/dist/runtime/client-svelte.mjs +3 -3
- package/dist/runtime/client-vue.d.mts +3 -3
- package/dist/runtime/client-vue.mjs +3 -3
- package/dist/runtime/client.d.mts +3 -3
- package/dist/runtime/client.mjs +3 -3
- package/dist/runtime/db.mjs +1 -1
- package/dist/runtime/durable.mjs +1 -1
- package/dist/runtime/email/testing.mjs +1 -1
- package/dist/runtime/env-helpers.mjs +1 -135
- package/dist/runtime/env-public-client.mjs +1 -1
- package/dist/runtime/env-public.mjs +2 -2
- package/dist/runtime/env.mjs +1 -77
- package/dist/runtime/fetch-stream.d.mts +2 -49
- package/dist/runtime/fetch-stream.mjs +2 -80
- package/dist/runtime/fetch.d.mts +2 -57
- package/dist/runtime/fetch.mjs +2 -17
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/handler.mjs +1 -149
- package/dist/runtime/kv.mjs +1 -1
- package/dist/runtime/live-client.d.mts +1 -1
- package/dist/runtime/live-server.mjs +2 -2
- package/dist/runtime/live.d.mts +2 -104
- package/dist/runtime/live.mjs +1 -410
- package/dist/runtime/migration-handler-mysql.d.mts +1 -1
- package/dist/runtime/migration-handler-pg.d.mts +1 -1
- package/dist/runtime/migration-handler.d.mts +2 -50
- package/dist/runtime/queues.d.mts +2 -6
- package/dist/runtime/queues.mjs +1 -1
- package/dist/runtime/remote/index.mjs +49 -8
- package/dist/runtime/response.mjs +1 -29
- package/dist/runtime/sandbox.d.mts +4 -56
- package/dist/runtime/sandbox.mjs +82 -221
- package/dist/runtime/sse.mjs +1 -171
- package/dist/runtime/storage.mjs +1 -1
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/validator.mjs +1 -71
- package/dist/runtime/ws-server.d.mts +2 -2
- package/dist/runtime/ws-server.mjs +2 -2
- package/dist/runtime/ws.d.mts +2 -121
- package/dist/{scan-CpK-57ug.mjs → scan-DJbooZm2.mjs} +3 -3
- package/dist/{scan-BMH4rzlv.mjs → scan-DdDvRCU1.mjs} +8 -26
- package/dist/{secret-Bzzi2e9E.mjs → secret-wnTel5Yw.mjs} +8 -6
- package/dist/serialize-BPvnNQuA.mjs +14 -0
- package/dist/serialize-CfSwWfF2.d.mts +10 -0
- package/dist/{skills-C0RvGjeE.mjs → skills-B-690E7h.mjs} +3 -2
- package/dist/sse-BaC1jXko.mjs +172 -0
- package/dist/{subcommand-prompt-Bmyn5Rlc.mjs → subcommand-prompt-Gj3VzLIh.mjs} +2 -1
- package/dist/sveltekit.d.mts +2 -1
- package/dist/sveltekit.mjs +3 -2
- package/dist/validate-DqJ33oHj.mjs +2 -0
- package/dist/validate-qNhV00PD.mjs +180 -0
- package/dist/validator-BTOu0fB0.mjs +72 -0
- package/dist/{wrangler--imS8n0d.mjs → wrangler-D01qs6VB.mjs} +259 -71
- package/dist/ws-BwcqizuH.d.mts +122 -0
- package/dist/{yarn-pnp-DxSInkzL.mjs → yarn-pnp-CVEc3gE7.mjs} +1 -1
- package/package.json +19 -8
- package/skills/void/SKILL.md +7 -5
- package/skills/void/docs/guide/ai.md +3 -3
- package/skills/void/docs/guide/app-types.md +12 -11
- package/skills/void/docs/guide/auth.md +2 -2
- package/skills/void/docs/guide/database/d1.md +1 -1
- package/skills/void/docs/guide/database/mysql.md +1 -1
- package/skills/void/docs/guide/database/postgresql.md +3 -3
- package/skills/void/docs/guide/deployment.md +16 -16
- package/skills/void/docs/guide/durable-state.md +2 -2
- package/skills/void/docs/guide/edge/headers.md +3 -3
- package/skills/void/docs/guide/edge/prerendering.md +1 -1
- package/skills/void/docs/guide/edge/redirects.md +4 -4
- package/skills/void/docs/guide/edge/revalidation.md +6 -6
- package/skills/void/docs/guide/edge/rewrites.md +28 -27
- package/skills/void/docs/guide/edge/static-assets.md +1 -1
- package/skills/void/docs/guide/email.md +27 -25
- package/skills/void/docs/guide/env-migration.md +1 -1
- package/skills/void/docs/guide/index.md +1 -1
- package/skills/void/docs/guide/pages-routing/head.md +1 -1
- package/skills/void/docs/guide/platform/administration/access.md +171 -0
- package/skills/void/docs/guide/platform/administration/email.md +121 -0
- package/skills/void/docs/guide/platform/administration/operations.md +97 -0
- package/skills/void/docs/guide/platform/administration/projects.md +56 -0
- package/skills/void/docs/guide/platform/development/local.md +119 -0
- package/skills/void/docs/guide/platform/development/runtime.md +124 -0
- package/skills/void/docs/guide/platform/development/schema-ci.md +95 -0
- package/skills/void/docs/guide/platform/installation/ci.md +58 -0
- package/skills/void/docs/guide/platform/installation/credentials.md +90 -0
- package/skills/void/docs/guide/platform/installation/domains.md +68 -0
- package/skills/void/docs/guide/platform/installation/first-deployment.md +82 -0
- package/skills/void/docs/guide/platform/installation/maintenance.md +137 -0
- package/skills/void/docs/guide/platform/installation/prerequisites.md +88 -0
- package/skills/void/docs/guide/platform/installation/setup.md +169 -0
- package/skills/void/docs/guide/platform/installation/uninstall.md +54 -0
- package/skills/void/docs/guide/platform-administration.md +6 -414
- package/skills/void/docs/guide/platform-development.md +5 -316
- package/skills/void/docs/guide/project-collaboration.md +1 -1
- package/skills/void/docs/guide/remote-dev.md +2 -2
- package/skills/void/docs/guide/sandboxes.md +10 -25
- package/skills/void/docs/guide/self-hosted-platform.md +11 -694
- package/skills/void/docs/guide/ssg.md +1 -1
- package/skills/void/docs/guide/websockets.md +1 -1
- package/skills/void/docs/integrations/cloudflare.md +86 -84
- package/skills/void/docs/integrations/frameworks/analog.md +14 -9
- package/skills/void/docs/integrations/frameworks/astro.md +14 -10
- package/skills/void/docs/integrations/frameworks/nuxt.md +14 -9
- package/skills/void/docs/integrations/frameworks/overview.md +35 -29
- package/skills/void/docs/integrations/frameworks/react-router.md +1 -1
- package/skills/void/docs/integrations/frameworks/sveltekit.md +33 -30
- package/skills/void/docs/integrations/frameworks/tanstack-start.md +1 -1
- package/skills/void/docs/integrations/nodejs-bun-deno.md +5 -5
- package/skills/void/docs/reference/api.md +55 -38
- package/skills/void/docs/reference/cli.md +60 -34
- package/skills/void/docs/reference/config.md +57 -34
- package/skills/void/docs/reference/resource-inference.md +10 -10
- package/skills/void/docs/reference/structure.md +2 -2
- package/dist/validate-tBBN_dXH.mjs +0 -505
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
//#region src/runtime/sse.ts
|
|
2
|
+
const DEFAULT_KEEP_ALIVE_INTERVAL_MS = 15e3;
|
|
3
|
+
const DEFAULT_KEEP_ALIVE_COMMENT = "keep-alive";
|
|
4
|
+
var SseStreamClosedError = class extends Error {
|
|
5
|
+
constructor(message = "sse: stream is closed.") {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "SseStreamClosedError";
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
function formatSse(message) {
|
|
11
|
+
const textMessage = {
|
|
12
|
+
event: message.event,
|
|
13
|
+
id: message.id,
|
|
14
|
+
retry: message.retry
|
|
15
|
+
};
|
|
16
|
+
if ("data" in message) textMessage.data = serializeData(message.data);
|
|
17
|
+
return formatSseText(textMessage);
|
|
18
|
+
}
|
|
19
|
+
function formatSseText(message) {
|
|
20
|
+
const lines = [];
|
|
21
|
+
if (message.id != null) {
|
|
22
|
+
assertControlField("id", message.id);
|
|
23
|
+
lines.push(`id: ${message.id}`);
|
|
24
|
+
}
|
|
25
|
+
if (message.event != null) {
|
|
26
|
+
assertControlField("event", message.event);
|
|
27
|
+
lines.push(`event: ${message.event}`);
|
|
28
|
+
}
|
|
29
|
+
if (message.retry != null) {
|
|
30
|
+
assertRetry(message.retry);
|
|
31
|
+
lines.push(`retry: ${message.retry}`);
|
|
32
|
+
}
|
|
33
|
+
if ("data" in message) {
|
|
34
|
+
if (typeof message.data !== "string") throw new Error("sse: data must be a string.");
|
|
35
|
+
for (const line of splitLines(message.data)) lines.push(`data: ${line}`);
|
|
36
|
+
}
|
|
37
|
+
return `${lines.join("\n")}\n\n`;
|
|
38
|
+
}
|
|
39
|
+
function getLastEventId(request) {
|
|
40
|
+
return request.headers.get("Last-Event-ID");
|
|
41
|
+
}
|
|
42
|
+
function eventStream(start, options = {}) {
|
|
43
|
+
const encoder = new TextEncoder();
|
|
44
|
+
const { readable, writable } = new TransformStream();
|
|
45
|
+
const writer = writable.getWriter();
|
|
46
|
+
const signalController = new AbortController();
|
|
47
|
+
const headers = buildSseHeaders(options.headers);
|
|
48
|
+
const keepAlive = normalizeKeepAlive(options.keepAlive);
|
|
49
|
+
let keepAliveTimer;
|
|
50
|
+
let closedOnce = false;
|
|
51
|
+
let closeResolve;
|
|
52
|
+
const closed = new Promise((resolve) => {
|
|
53
|
+
closeResolve = resolve;
|
|
54
|
+
});
|
|
55
|
+
const markClosed = () => {
|
|
56
|
+
if (closedOnce) return;
|
|
57
|
+
closedOnce = true;
|
|
58
|
+
if (!signalController.signal.aborted) signalController.abort();
|
|
59
|
+
if (keepAliveTimer != null) {
|
|
60
|
+
clearInterval(keepAliveTimer);
|
|
61
|
+
keepAliveTimer = void 0;
|
|
62
|
+
}
|
|
63
|
+
closeResolve();
|
|
64
|
+
};
|
|
65
|
+
async function close() {
|
|
66
|
+
if (closedOnce) return;
|
|
67
|
+
markClosed();
|
|
68
|
+
await writer.close().catch(() => {});
|
|
69
|
+
}
|
|
70
|
+
async function fail(error) {
|
|
71
|
+
if (closedOnce) return;
|
|
72
|
+
markClosed();
|
|
73
|
+
await writer.abort(error).catch(() => {});
|
|
74
|
+
}
|
|
75
|
+
async function write(text) {
|
|
76
|
+
if (closedOnce) throw new SseStreamClosedError();
|
|
77
|
+
try {
|
|
78
|
+
await writer.write(encoder.encode(text));
|
|
79
|
+
} catch {
|
|
80
|
+
await close();
|
|
81
|
+
throw new SseStreamClosedError();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const stream = {
|
|
85
|
+
signal: signalController.signal,
|
|
86
|
+
closed,
|
|
87
|
+
send(message) {
|
|
88
|
+
return write(formatSse(message));
|
|
89
|
+
},
|
|
90
|
+
comment(text = "") {
|
|
91
|
+
return write(formatComment(text));
|
|
92
|
+
},
|
|
93
|
+
close
|
|
94
|
+
};
|
|
95
|
+
writer.closed.catch(() => {
|
|
96
|
+
close();
|
|
97
|
+
});
|
|
98
|
+
if (options.signal?.aborted) close();
|
|
99
|
+
else options.signal?.addEventListener("abort", () => void close(), { once: true });
|
|
100
|
+
if (keepAlive) keepAliveTimer = setInterval(() => {
|
|
101
|
+
stream.comment(keepAlive.comment).catch(() => close());
|
|
102
|
+
}, keepAlive.intervalMs);
|
|
103
|
+
queueMicrotask(() => {
|
|
104
|
+
(async () => {
|
|
105
|
+
try {
|
|
106
|
+
await start(stream);
|
|
107
|
+
await close();
|
|
108
|
+
} catch (error) {
|
|
109
|
+
await fail(error);
|
|
110
|
+
}
|
|
111
|
+
})();
|
|
112
|
+
});
|
|
113
|
+
return new Response(readable, { headers });
|
|
114
|
+
}
|
|
115
|
+
function buildSseHeaders(headers) {
|
|
116
|
+
const result = new Headers(headers);
|
|
117
|
+
if (!result.has("Content-Type")) result.set("Content-Type", "text/event-stream; charset=utf-8");
|
|
118
|
+
if (!result.has("Cache-Control")) result.set("Cache-Control", "no-cache, no-transform");
|
|
119
|
+
if (!result.has("X-Accel-Buffering")) result.set("X-Accel-Buffering", "no");
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
function normalizeKeepAlive(keepAlive) {
|
|
123
|
+
if (keepAlive === false) return null;
|
|
124
|
+
if (keepAlive === true || keepAlive == null) return {
|
|
125
|
+
intervalMs: DEFAULT_KEEP_ALIVE_INTERVAL_MS,
|
|
126
|
+
comment: DEFAULT_KEEP_ALIVE_COMMENT
|
|
127
|
+
};
|
|
128
|
+
const intervalMs = keepAlive.intervalMs ?? DEFAULT_KEEP_ALIVE_INTERVAL_MS;
|
|
129
|
+
if (!Number.isFinite(intervalMs) || intervalMs <= 0) throw new Error("sse: keepAlive.intervalMs must be a positive finite number.");
|
|
130
|
+
return {
|
|
131
|
+
intervalMs,
|
|
132
|
+
comment: keepAlive.comment ?? DEFAULT_KEEP_ALIVE_COMMENT
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function formatComment(text) {
|
|
136
|
+
if (typeof text !== "string") throw new Error("sse: comment text must be a string.");
|
|
137
|
+
return `${splitLines(text).map((line) => `: ${line}`).join("\n")}\n\n`;
|
|
138
|
+
}
|
|
139
|
+
function assertControlField(name, value) {
|
|
140
|
+
if (typeof value !== "string") throw new Error(`sse: ${name} must be a string.`);
|
|
141
|
+
if (hasControlFieldSeparator(value)) throw new Error(`sse: ${name} must not contain CR, LF, or NUL characters.`);
|
|
142
|
+
}
|
|
143
|
+
function hasControlFieldSeparator(value) {
|
|
144
|
+
return value.includes("\r") || value.includes("\n") || value.includes("\0");
|
|
145
|
+
}
|
|
146
|
+
function assertRetry(value) {
|
|
147
|
+
if (!Number.isInteger(value) || value < 0) throw new Error("sse: retry must be a non-negative integer.");
|
|
148
|
+
}
|
|
149
|
+
function isBinaryData(data) {
|
|
150
|
+
return data instanceof ArrayBuffer || ArrayBuffer.isView(data) || typeof Blob !== "undefined" && data instanceof Blob || typeof File !== "undefined" && data instanceof File;
|
|
151
|
+
}
|
|
152
|
+
function serializeData(data) {
|
|
153
|
+
if (typeof data === "string") return data;
|
|
154
|
+
if (data == null) return data === null ? "null" : throwDataSerializationError(data);
|
|
155
|
+
if (typeof data === "function" || typeof data === "symbol") return throwDataSerializationError(data);
|
|
156
|
+
if (isBinaryData(data)) throw new Error("sse: binary data is not supported.");
|
|
157
|
+
try {
|
|
158
|
+
const serialized = JSON.stringify(data);
|
|
159
|
+
if (typeof serialized !== "string") return throwDataSerializationError(data);
|
|
160
|
+
return serialized;
|
|
161
|
+
} catch (error) {
|
|
162
|
+
throw new Error(`sse: data must be JSON-serializable. ${error instanceof Error ? error.message : String(error)}`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function throwDataSerializationError(data) {
|
|
166
|
+
throw new Error(`sse: unsupported data value ${String(data)}.`);
|
|
167
|
+
}
|
|
168
|
+
function splitLines(value) {
|
|
169
|
+
return value.split(/\r\n|\r|\n/);
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
export { getLastEventId as a, formatSseText as i, eventStream as n, formatSse as r, SseStreamClosedError as t };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as import_picocolors } from "./output-urU86XeT.mjs";
|
|
2
|
+
import { S as S_STEP_SUBMIT, _ as S_RADIO_ACTIVE, c as S_CHECKBOX_INACTIVE, i as S_BAR_END, q as wrapAnsi, r as S_BAR, s as S_CHECKBOX_ACTIVE, v as S_RADIO_INACTIVE, y as S_STEP_ACTIVE } from "./dist-Dn6nn2IU.mjs";
|
|
2
3
|
//#region src/cli/subcommand-prompt.ts
|
|
3
4
|
function promptSubcommand(command, subcommands) {
|
|
4
5
|
return new Promise((resolve) => {
|
package/dist/sveltekit.d.mts
CHANGED
|
@@ -9,7 +9,8 @@ export type VoidSvelteKitTsconfigOptions = {
|
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* Merge Void's generated tsconfig fragment into SvelteKit's generated
|
|
12
|
-
* tsconfig. Use from `
|
|
12
|
+
* tsconfig. Use from `typescript.config` in `sveltekit()` or from
|
|
13
|
+
* `kit.typescript.config` in `svelte.config.js`.
|
|
13
14
|
*/
|
|
14
15
|
export declare function mergeVoidSvelteKitTsconfig(config: Tsconfig, options?: VoidSvelteKitTsconfigOptions): Tsconfig;
|
|
15
16
|
/**
|
package/dist/sveltekit.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as join, i as isAbsolute, l as relative, u as resolve } from "./dist-4WkAWhWx.mjs";
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
//#region src/sveltekit.ts
|
|
4
4
|
/**
|
|
5
5
|
* Merge Void's generated tsconfig fragment into SvelteKit's generated
|
|
6
|
-
* tsconfig. Use from `
|
|
6
|
+
* tsconfig. Use from `typescript.config` in `sveltekit()` or from
|
|
7
|
+
* `kit.typescript.config` in `svelte.config.js`.
|
|
7
8
|
*/
|
|
8
9
|
function mergeVoidSvelteKitTsconfig(config, options = {}) {
|
|
9
10
|
const root = options.root ?? process.cwd();
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { a as join } from "./dist-4WkAWhWx.mjs";
|
|
2
|
+
import { n as readJournal, r as stripSqlExt } from "./collect-DXHNWHcT.mjs";
|
|
3
|
+
import { t as DESTRUCTIVE_PRAGMA, u as tokenizeSql } from "./plan-BEZ8VJW0.mjs";
|
|
4
|
+
import { existsSync, readdirSync } from "node:fs";
|
|
5
|
+
//#region src/migrations/validate.ts
|
|
6
|
+
/**
|
|
7
|
+
* Destructive SQL patterns that are rejected unless the migration
|
|
8
|
+
* contains the `-- void:allow-destructive` pragma comment.
|
|
9
|
+
*/
|
|
10
|
+
const DESTRUCTIVE_PATTERNS = [
|
|
11
|
+
/\bDROP\s+TABLE\b/i,
|
|
12
|
+
/\bDROP\s+VIEW\b/i,
|
|
13
|
+
/\bDROP\s+INDEX\b/i,
|
|
14
|
+
/\bDROP\s+TRIGGER\b/i,
|
|
15
|
+
/\bALTER\s+TABLE\b[\s\S]*\bDROP\s+COLUMN\b/i,
|
|
16
|
+
/\bALTER\s+TABLE\b[\s\S]*\bRENAME\s+TO\b/i,
|
|
17
|
+
/\bALTER\s+TABLE\b[\s\S]*\bRENAME\s+COLUMN\b/i,
|
|
18
|
+
/\bALTER\s+TABLE\b[\s\S]*\bRENAME\b[\s\S]*\bTO\b/i,
|
|
19
|
+
/\bTRUNCATE\b/i,
|
|
20
|
+
/\bINSERT\s+OR\s+REPLACE\b/i
|
|
21
|
+
];
|
|
22
|
+
function splitExecutableStatements(sql) {
|
|
23
|
+
return sql.split(";").map((statement) => statement.trim()).filter(Boolean);
|
|
24
|
+
}
|
|
25
|
+
function hasTopLevelKeyword(statement, keyword) {
|
|
26
|
+
let depth = 0;
|
|
27
|
+
for (let index = 0; index < statement.length; index++) {
|
|
28
|
+
const character = statement[index];
|
|
29
|
+
if (character === "(") {
|
|
30
|
+
depth++;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (character === ")") {
|
|
34
|
+
depth = Math.max(0, depth - 1);
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (depth !== 0) continue;
|
|
38
|
+
if (statement.slice(index, index + keyword.length).toUpperCase() === keyword && !/[A-Z0-9_]/i.test(statement[index - 1] ?? "") && !/[A-Z0-9_]/i.test(statement[index + keyword.length] ?? "")) return true;
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
function hasUnboundedWrite(statement) {
|
|
43
|
+
if (/^(?:CREATE\s+(?:(?:TEMP|TEMPORARY|UNLOGGED)\s+)?|ALTER\s+)TABLE\b/i.test(statement)) return false;
|
|
44
|
+
if (/\bDELETE\s+FROM\b/i.test(statement)) return !hasTopLevelKeyword(statement, "WHERE");
|
|
45
|
+
if (/\bUPDATE\b[\s\S]*\bSET\b/i.test(statement)) return !hasTopLevelKeyword(statement, "WHERE");
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Check if a SQL migration contains destructive operations.
|
|
50
|
+
*/
|
|
51
|
+
function isDestructive(sql) {
|
|
52
|
+
const normalized = sql.replace(/\r\n?/g, "\n");
|
|
53
|
+
let executable = "";
|
|
54
|
+
for (const segment of tokenizeSql(normalized)) if (segment.kind === "sql") executable += normalized.slice(segment.start, segment.end);
|
|
55
|
+
else executable += " ".repeat(segment.end - segment.start);
|
|
56
|
+
return splitExecutableStatements(executable).some((statement) => {
|
|
57
|
+
return DESTRUCTIVE_PATTERNS.some((pattern) => pattern.test(statement)) || hasUnboundedWrite(statement);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function hasDestructivePragma(sql) {
|
|
61
|
+
return sql.replace(/\r\n?/g, "\n").split("\n").some((line) => line.trim() === DESTRUCTIVE_PRAGMA);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Validate migration files. Returns the validated list with destructive flags.
|
|
65
|
+
* Throws if any destructive migration lacks the allow-destructive pragma.
|
|
66
|
+
*/
|
|
67
|
+
function validateMigrations(files) {
|
|
68
|
+
const results = [];
|
|
69
|
+
const errors = [];
|
|
70
|
+
for (const file of files) {
|
|
71
|
+
const destructive = isDestructive(file.sql);
|
|
72
|
+
if (destructive && !hasDestructivePragma(file.sql)) errors.push(file.name);
|
|
73
|
+
results.push({
|
|
74
|
+
name: file.name,
|
|
75
|
+
sql: file.sql,
|
|
76
|
+
destructive
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (errors.length > 0) throw new Error(`Destructive migrations detected without pragma:\n` + errors.map((f) => ` - ${f}`).join("\n") + `\n\nAdd "${DESTRUCTIVE_PRAGMA}" to each file to allow the migration locally and on deploy.`);
|
|
80
|
+
return results;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Enumerate drizzle-kit metadata artifacts in a migrations directory.
|
|
84
|
+
* Returns repo-relative paths like `db/migrations/meta/0000_snapshot.json`
|
|
85
|
+
* and `db/migrations/migrations.js`. Empty when none are present.
|
|
86
|
+
*
|
|
87
|
+
* Shared across `assertJournalCoherence`, `void gen migration`, and
|
|
88
|
+
* `void db rename-migrations` so all three agree on what counts as a
|
|
89
|
+
* "partial drizzle-kit state" (journal gone but other metadata lingering).
|
|
90
|
+
*/
|
|
91
|
+
function listDrizzleArtifacts(migrationsDir) {
|
|
92
|
+
const metaDir = join(migrationsDir, "meta");
|
|
93
|
+
const snapshotFiles = existsSync(metaDir) ? readdirSync(metaDir).filter((f) => f.endsWith("_snapshot.json")) : [];
|
|
94
|
+
const bundledPath = join(migrationsDir, "migrations.js");
|
|
95
|
+
const out = [];
|
|
96
|
+
for (const f of snapshotFiles) out.push(`db/migrations/meta/${f}`);
|
|
97
|
+
if (existsSync(bundledPath)) out.push("db/migrations/migrations.js");
|
|
98
|
+
return out;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Assert that every `.sql` file under `migrationsDir` has a matching entry
|
|
102
|
+
* in `meta/_journal.json`, and vice versa.
|
|
103
|
+
*
|
|
104
|
+
* Drift is a silent footgun: the local/remote runners apply files directly
|
|
105
|
+
* from disk, but `drizzle-kit generate` only sees what's in the journal.
|
|
106
|
+
* An orphan file created by hand (or by a botched scaffold/merge) gets
|
|
107
|
+
* applied to D1 without Drizzle ever acknowledging it, and a failed
|
|
108
|
+
* deploy can leave the database in a state that is impossible to recover
|
|
109
|
+
* from without manual SQL edits.
|
|
110
|
+
*
|
|
111
|
+
* A missing journal is NOT a drift error. The drift check is a diff
|
|
112
|
+
* between disk and `meta/_journal.json`; with no journal, there is nothing
|
|
113
|
+
* to diff against. Bare-legacy projects — hand-written `.sql` files with no
|
|
114
|
+
* `db/schema.ts`, no drizzle-kit, no `meta/` directory — worked long
|
|
115
|
+
* before this check existed, and the local/remote runners still track
|
|
116
|
+
* applied migrations by filename via `_void_migrations`. Gating those
|
|
117
|
+
* projects here would break `void deploy`, `void db migrate`, `void db
|
|
118
|
+
* reset`, and `void db status` for a valid path with no migration path
|
|
119
|
+
* forward (they cannot run `void db generate` because it requires
|
|
120
|
+
* `db/schema.ts`). We skip the check silently and let the filename-based
|
|
121
|
+
* runners take over.
|
|
122
|
+
*
|
|
123
|
+
* Throws a user-facing error when any mismatch is detected between the
|
|
124
|
+
* journal and disk. Returns silently otherwise.
|
|
125
|
+
*/
|
|
126
|
+
function assertJournalCoherence(migrationsDir, collected) {
|
|
127
|
+
const journal = readJournal(migrationsDir);
|
|
128
|
+
const drizzleArtifacts = listDrizzleArtifacts(migrationsDir);
|
|
129
|
+
if (journal === void 0) {
|
|
130
|
+
if (drizzleArtifacts.length > 0) throw new Error([
|
|
131
|
+
"db/migrations/meta/_journal.json is missing, but other drizzle-kit metadata is still present:",
|
|
132
|
+
...drizzleArtifacts.map((p) => ` - ${p}`),
|
|
133
|
+
"",
|
|
134
|
+
"This is a partial drizzle-kit state. Restore _journal.json from version control, or delete the orphaned metadata files above if you intended to revert to hand-written migrations."
|
|
135
|
+
].join("\n"));
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (journal === null || typeof journal !== "object" || Array.isArray(journal) || typeof journal.version !== "string" || typeof journal.dialect !== "string" || !Array.isArray(journal.entries)) throw new Error("db/migrations/meta/_journal.json is malformed: expected an object with string `version`, string `dialect`, and an `entries` array. Restore the file from version control, or delete it if you intended to revert to hand-written migrations.");
|
|
139
|
+
for (let i = 0; i < journal.entries.length; i++) {
|
|
140
|
+
const entry = journal.entries[i];
|
|
141
|
+
if (entry === null || typeof entry !== "object" || typeof entry.idx !== "number" || typeof entry.version !== "string" || typeof entry.tag !== "string" || typeof entry.breakpoints !== "boolean") throw new Error(`db/migrations/meta/_journal.json is malformed: entry at index ${i} is missing required fields (\`idx\`, \`version\`, \`tag\`, \`breakpoints\`). Restore the file from version control, or delete it if you intended to revert to hand-written migrations.`);
|
|
142
|
+
}
|
|
143
|
+
if (journal.entries.length === 0) {
|
|
144
|
+
if (drizzleArtifacts.length === 0) return;
|
|
145
|
+
throw new Error([
|
|
146
|
+
"db/migrations/meta/_journal.json has no entries, but drizzle-kit metadata is still present:",
|
|
147
|
+
...drizzleArtifacts.map((p) => ` - ${p}`),
|
|
148
|
+
"",
|
|
149
|
+
"This is a partial drizzle-kit state. Restore _journal.json from version control (or run `void db generate`), or delete the orphaned metadata files above if you intended to revert to hand-written migrations."
|
|
150
|
+
].join("\n"));
|
|
151
|
+
}
|
|
152
|
+
const tagCounts = /* @__PURE__ */ new Map();
|
|
153
|
+
for (const entry of journal.entries) tagCounts.set(entry.tag, (tagCounts.get(entry.tag) ?? 0) + 1);
|
|
154
|
+
const duplicateTags = [...tagCounts.entries()].filter(([, n]) => n > 1).map(([tag]) => tag);
|
|
155
|
+
if (duplicateTags.length > 0) throw new Error([
|
|
156
|
+
"db/migrations/meta/_journal.json has duplicate migration entries:",
|
|
157
|
+
...duplicateTags.map((t) => ` - ${t} (appears ${tagCounts.get(t)} times)`),
|
|
158
|
+
"",
|
|
159
|
+
"Each migration must have a unique tag. Restore _journal.json from version control, or hand-edit to remove the duplicates."
|
|
160
|
+
].join("\n"));
|
|
161
|
+
const journalTags = new Set(journal.entries.map((e) => e.tag));
|
|
162
|
+
const collectedTags = new Set(collected.map((m) => stripSqlExt(m.name)));
|
|
163
|
+
const orphans = collected.map((m) => m.name).filter((name) => !journalTags.has(stripSqlExt(name)));
|
|
164
|
+
const missing = journal.entries.map((e) => `${e.tag}.sql`).filter((file) => !collectedTags.has(stripSqlExt(file)));
|
|
165
|
+
if (orphans.length === 0 && missing.length === 0) return;
|
|
166
|
+
const lines = ["Migration drift detected between db/migrations/ and db/migrations/meta/_journal.json."];
|
|
167
|
+
if (orphans.length > 0) {
|
|
168
|
+
lines.push("", "These files exist on disk but are not tracked in _journal.json:");
|
|
169
|
+
for (const f of orphans) lines.push(` - db/migrations/${f}`);
|
|
170
|
+
lines.push("", "Delete the orphan file(s), or move their contents into `db/schema.ts` and re-run `void db generate`.");
|
|
171
|
+
}
|
|
172
|
+
if (missing.length > 0) {
|
|
173
|
+
lines.push("", "These entries are in _journal.json but the matching file is missing:");
|
|
174
|
+
for (const f of missing) lines.push(` - db/migrations/${f}`);
|
|
175
|
+
lines.push("", "Restore the missing file(s) from version control, or regenerate migrations.");
|
|
176
|
+
}
|
|
177
|
+
throw new Error(lines.join("\n"));
|
|
178
|
+
}
|
|
179
|
+
//#endregion
|
|
180
|
+
export { validateMigrations as i, isDestructive as n, listDrizzleArtifacts as r, assertJournalCoherence as t };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//#region src/runtime/validator.ts
|
|
2
|
+
function flattenIssues(issues) {
|
|
3
|
+
return Array.from(issues, (issue) => ({
|
|
4
|
+
message: issue.message,
|
|
5
|
+
path: issue.path?.map((p) => typeof p === "object" ? p.key : p).join(".")
|
|
6
|
+
}));
|
|
7
|
+
}
|
|
8
|
+
async function validateSlot(schema, value) {
|
|
9
|
+
const result = await schema["~standard"].validate(value);
|
|
10
|
+
if (result.issues) return {
|
|
11
|
+
ok: false,
|
|
12
|
+
issues: result.issues
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
ok: true,
|
|
16
|
+
value: result.value
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
async function runValidation(validators, c) {
|
|
20
|
+
const input = {};
|
|
21
|
+
const allIssues = [];
|
|
22
|
+
if (validators.params) {
|
|
23
|
+
const raw = c.req.param();
|
|
24
|
+
const result = await validateSlot(validators.params, raw);
|
|
25
|
+
if (result.ok) input.params = result.value;
|
|
26
|
+
else allIssues.push({
|
|
27
|
+
slot: "params",
|
|
28
|
+
issues: flattenIssues(result.issues)
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (validators.query) {
|
|
32
|
+
const url = new URL(c.req.url);
|
|
33
|
+
const raw = {};
|
|
34
|
+
for (const [key, value] of url.searchParams) raw[key] = value;
|
|
35
|
+
const result = await validateSlot(validators.query, raw);
|
|
36
|
+
if (result.ok) input.query = result.value;
|
|
37
|
+
else allIssues.push({
|
|
38
|
+
slot: "query",
|
|
39
|
+
issues: flattenIssues(result.issues)
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (validators.body) {
|
|
43
|
+
let raw;
|
|
44
|
+
try {
|
|
45
|
+
raw = await c.req.json();
|
|
46
|
+
} catch {
|
|
47
|
+
return {
|
|
48
|
+
ok: false,
|
|
49
|
+
response: Response.json({ error: "Invalid JSON body" }, { status: 400 })
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const result = await validateSlot(validators.body, raw);
|
|
53
|
+
if (result.ok) input.body = result.value;
|
|
54
|
+
else allIssues.push({
|
|
55
|
+
slot: "body",
|
|
56
|
+
issues: flattenIssues(result.issues)
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
if (allIssues.length > 0) return {
|
|
60
|
+
ok: false,
|
|
61
|
+
response: Response.json({
|
|
62
|
+
error: "Validation failed",
|
|
63
|
+
issues: allIssues
|
|
64
|
+
}, { status: 400 })
|
|
65
|
+
};
|
|
66
|
+
return {
|
|
67
|
+
ok: true,
|
|
68
|
+
input
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { runValidation as t };
|