void 0.27.0 → 0.28.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 +3 -1
- package/dist/{account-cmd-l-FM7Ioq.mjs → account-cmd-Ci00cncT.mjs} +5 -5
- package/dist/{agents-B_pX_HmQ.mjs → agents-CuNtT0D_.mjs} +5 -2
- package/dist/{application-analysis-DKy02UY0.mjs → application-analysis-D72ZQfMZ.mjs} +118 -135
- package/dist/{application-routing-DQyUh_5S.mjs → application-routing-Dy589Vgn.mjs} +1 -2
- package/dist/atomic-write-Dq6R0BPN.mjs +18 -0
- package/dist/{auth-Dn2vw-SG.mjs → auth-B6iOCjKI.mjs} +23 -56
- package/dist/{auth-link-vz9Z2kmG.mjs → auth-link-DWr6Afao.mjs} +10 -10
- package/dist/{auth-migrations-BwHgeEsD.mjs → auth-migrations-Cgs0k6lS.mjs} +28 -5
- package/dist/{auth-router-DvsCUVw4.mjs → auth-router-DP14wVkZ.mjs} +4 -4
- package/dist/auth-wn6F8dB8.mjs +2 -0
- package/dist/base64-DVrOndmI.mjs +16 -0
- package/dist/{better-auth-shared-CPvWD3nG.d.mts → better-auth-shared-B74NJIus.d.mts} +8 -13
- package/dist/{better-auth-shared-DPpj8zxc.mjs → better-auth-shared-CMXlZG7W.mjs} +56 -68
- package/dist/{build-cmd-D6we0VjO.mjs → build-cmd-Cr3FJxv0.mjs} +5 -5
- package/dist/{cache-CZRdzKx1.mjs → cache-D0Tt28cn.mjs} +5 -5
- package/dist/{cancel-deploy-CQ3NnMvf.mjs → cancel-deploy-CJKvk7AN.mjs} +4 -4
- package/dist/{cf-access-TWNzXltp.mjs → cf-access-BM9G0lhO.mjs} +4 -3
- package/dist/{cf-access-BcIBSKqG.mjs → cf-access-CWP4avfP.mjs} +3 -7
- package/dist/cf-build-output-2u583yJK.mjs +2 -0
- package/dist/{cf-build-output-DjvB_872.mjs → cf-build-output-Bc8i3dzE.mjs} +2 -2
- package/dist/cf-user-agent-ChjQp2MU.mjs +33 -0
- package/dist/cli/cli.mjs +198 -311
- package/dist/cli/cloudflare-operation-process.mjs +41 -15
- package/dist/cli/env-schema-probe.d.mts +5 -43
- package/dist/cli/env-schema-probe.mjs +14 -80
- package/dist/client-C1BjRn3g.mjs +2 -0
- package/dist/{client-DlDJuY0s.mjs → client-DM9Kcf4e.mjs} +161 -415
- package/dist/{cloudflare-auth-CuxfF6OA.mjs → cloudflare-auth-CqFBDo52.mjs} +12 -39
- package/dist/{cloudflare-cmd-lHqNlJGW.mjs → cloudflare-cmd-CTrn-lXJ.mjs} +6 -5
- package/dist/{cloudflare-config-BmhBv3HV.mjs → cloudflare-config-DV60XFFK.mjs} +16 -28
- package/dist/{cloudflare-connect-2G3rL2rP.mjs → cloudflare-connect-BosmCNlq.mjs} +3 -3
- package/dist/{cloudflare-operations-CwI1bChl.mjs → cloudflare-operations-BKdSfNBN.mjs} +26 -34
- package/dist/{cloudflare-operations-BlYLlowZ.mjs → cloudflare-operations-Ds-lX3Ts.mjs} +1 -1
- package/dist/{cloudflare-process-2-TfIEzB.mjs → cloudflare-process-CeDWJRhj.mjs} +12 -7
- package/dist/collect-NUlJMpLY.mjs +2 -0
- package/dist/{collect-DiTn9yr6.mjs → collect-xjffdCdk.mjs} +1 -1
- package/dist/{config-CSa15FvD.d.mts → config-7qoq2p9v.d.mts} +2 -2
- package/dist/{config-CLYAosnQ.mjs → config-BEm9vRvS.mjs} +11 -5
- package/dist/{config-DiowPT80.mjs → config-Bx_1SpnO.mjs} +87 -177
- package/dist/config-CNnrSMYm.mjs +2 -0
- package/dist/{config-DPByhVck.mjs → config-D0GY5ItR.mjs} +1 -1
- package/dist/config-entry.d.mts +1 -1
- package/dist/{connect-BfPBHHm-.mjs → connect-nukQSoEO.mjs} +8 -8
- package/dist/{create-project-BdXEFKal.mjs → create-project-D4APeBwX.mjs} +7 -7
- package/dist/{create-project-qFDC45zg.mjs → create-project-DL7YXpjj.mjs} +1 -1
- package/dist/{db-Xs80hcaA.mjs → db-27RztQLy.mjs} +173 -263
- package/dist/{delete-d2vuou3j.mjs → delete-BbsZFZIw.mjs} +5 -5
- package/dist/deploy-B06EQq4t.mjs +6009 -0
- package/dist/deploy-Db2ALnQP.mjs +3 -0
- package/dist/deploy-managed-static-CGswbcay.mjs +2277 -0
- package/dist/deploy-transport-BiicfoQW.mjs +180 -0
- package/dist/deploy.d.mts +10 -0
- package/dist/deploy.mjs +82 -0
- package/dist/dev-inbox-Rd6j_8vM.mjs +217 -0
- package/dist/discover-CTUiSsfG.mjs +2 -0
- package/dist/{discover-CkCYv9T_.mjs → discover-D2PGT63u.mjs} +2 -2
- package/dist/{dist-BVqXeR_h.mjs → dist-ipQi0Q8y.mjs} +2 -3
- package/dist/{domain-BsDUBAvt.mjs → domain-Bfq9n03H.mjs} +7 -22
- package/dist/{dotenv-BfU6eqFt.mjs → dotenv-CNazY3-w.mjs} +4 -16
- package/dist/{email-d_Aux1vM.mjs → email-BcjSyAL0.mjs} +4 -20
- package/dist/{email-_lGAHOhp.mjs → email-DIwaQU4P.mjs} +99 -191
- package/dist/email-cloudflare-CH053RxK.mjs +1096 -0
- package/dist/email-protocol-D9nTvhCp.mjs +82 -0
- package/dist/{entry-CMAkqBmU.mjs → entry-ehmBvs5w.mjs} +2 -2
- package/dist/{env-BxocywBB.mjs → env-BJjULvL0.mjs} +2 -2
- package/dist/{env-DMA3cXZt.mjs → env-BhdWMrNy.mjs} +2 -13
- package/dist/{env-C74QepDE.mjs → env-C6ipBLp3.mjs} +8 -8
- package/dist/{env-public-DR7ZM6d-.d.mts → env-public-CCdykygU.d.mts} +6 -23
- package/dist/{env-raw-jZpP5n47.mjs → env-raw-Cklzcde3.mjs} +3 -20
- package/dist/{env-types-CwXgeMgL.mjs → env-types-DS2_y4X8.mjs} +2 -2
- package/dist/{env-validation-CrVNjsPm.mjs → env-validation-CTn-HhG1.mjs} +1 -1
- package/dist/env-validation-cE0zcmzO.mjs +486 -0
- package/dist/{gen-DtkQhvQg.mjs → gen-CnN1Xidx.mjs} +131 -253
- package/dist/gen-F8pSZnhc.mjs +2 -0
- package/dist/{generate-GDbL7sUr.mjs → generate-Dat0UTry.mjs} +38 -4
- package/dist/generate-Rii9klHB.mjs +2 -0
- package/dist/generated-wrangler-config-DeWj5F9Y.mjs +18 -0
- package/dist/{github-cmd-DaDdBbSS.mjs → github-cmd-BdkU4Nhe.mjs} +27 -71
- package/dist/{handler-BHAn2fZJ.mjs → handler-BZ1t7-Rv.mjs} +2 -2
- package/dist/{handler-CNAwjRcW.d.mts → handler-_PqY82xe.d.mts} +1 -1
- package/dist/{headers-DlfR78Nu.mjs → headers-Di1FsD3e.mjs} +26 -81
- package/dist/{help-0bTe_lID.mjs → help-Bug7pyK_.mjs} +18 -10
- package/dist/help-s9q7LTcu.mjs +2 -0
- package/dist/{inbound-PfQDLXc5.mjs → inbound-DmkTQeWp.mjs} +71 -222
- package/dist/{inbound-CH5Mksyy.d.mts → inbound-brj2-TM5.d.mts} +19 -58
- package/dist/index.d.mts +2 -18
- package/dist/index.mjs +200 -496
- package/dist/{info-PYWwkWyt.mjs → info-CujPwtMe.mjs} +5 -5
- package/dist/{init-DaBGmaXC.mjs → init-ZWOJvc-Z.mjs} +179 -388
- package/dist/isr-config-DPjXM8J2.mjs +194 -0
- package/dist/{link-C6fjafep.mjs → link-UEc7bnF4.mjs} +8 -8
- package/dist/{list-BTFBlqKl.mjs → list-CuWeOnzk.mjs} +6 -17
- package/dist/{live-CgQuTpqD.mjs → live-BxLX-JqJ.mjs} +19 -17
- package/dist/{live-Du8jXwOW.d.mts → live-DJONVlQK.d.mts} +1 -1
- package/dist/load-user-env-DD5qveNU.mjs +49 -0
- package/dist/{local-d1-ga5O_idV.mjs → local-d1-BM3p74mm.mjs} +6 -6
- package/dist/{login-GKcNUmtI.mjs → login-CZ2Cqa-D.mjs} +11 -11
- package/dist/login-DhK7o1oJ.mjs +2 -0
- package/dist/{logs-BiMSULmc.mjs → logs-TihRcLTk.mjs} +5 -5
- package/dist/migrate-BgT-hmu8.mjs +2 -0
- package/dist/{migrate-NLsjBbuM.mjs → migrate-uFwojusJ.mjs} +69 -21
- package/dist/migration-handler-Cg0Y4EPu.mjs +470 -0
- package/dist/{migration-handler-DM4clYj5.d.mts → migration-handler-CwlEQUoo.d.mts} +17 -26
- package/dist/{mime-DxCznlJq.mjs → mime-srOklVVv.mjs} +92 -395
- package/dist/{node-DJicPvPj.mjs → node-DoKbo1SZ.mjs} +8 -24
- package/dist/{operator-args-DOBhIaIg.mjs → operator-args-UnE8Y2eK.mjs} +27 -26
- package/dist/{operator-auth-BEZ_u0Cz.mjs → operator-auth-Cr2zCc-J.mjs} +2 -2
- package/dist/{operator-client-DbDv4vtE.mjs → operator-client-C-ROjk1I.mjs} +4 -4
- package/dist/{operator-cmd-BT4hgavL.mjs → operator-cmd-C5lCctnc.mjs} +8 -8
- package/dist/operator-cmd-Cjk5DiRx.mjs +2 -0
- package/dist/{output-C50ag2r3.mjs → output-FNHKw5Ac.mjs} +36 -5
- package/dist/{package-json-DXfiT1jV.mjs → package-json-BjYqR-So.mjs} +1 -1
- package/dist/pages/client.d.mts +1 -1
- package/dist/pages/client.mjs +91 -5
- package/dist/pages/index.d.mts +1 -2
- package/dist/pages/index.mjs +6 -6
- package/dist/pages/islands-plugin.mjs +5 -83
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +1 -1
- package/dist/pages/serialize.mjs +1 -1
- package/dist/{platform-args-DUeXY9Om.mjs → platform-args-C6Mb_I3a.mjs} +34 -58
- package/dist/platform-args-Cm7x-fot.mjs +2 -0
- package/dist/{platform-auth-config-CkSx3usH.mjs → platform-auth-config-CJmNkFT2.mjs} +10 -11
- package/dist/{platform-auth-protection-BJimB_p9.mjs → platform-auth-protection-D5wvsI-Y.mjs} +36 -26
- package/dist/{platform-auth-recovery-BU6izFAU.mjs → platform-auth-recovery-D_0I3n-1.mjs} +8 -9
- package/dist/{platform-cmd-BbmJiq5O.mjs → platform-cmd-Cuj4oUVo.mjs} +1 -1
- package/dist/{platform-cmd-BbY1dWiM.mjs → platform-cmd-DxxZO6e5.mjs} +15 -15
- package/dist/{platform-discovery-DIYz8V63.mjs → platform-discovery-CHhNs8Nn.mjs} +1 -1
- package/dist/{platform-domain-CHVS6cV0.mjs → platform-domain-zLXnW1G_.mjs} +5 -5
- package/dist/{platform-lifecycle-DzCwqhFq.mjs → platform-lifecycle-DOW-wLfx.mjs} +1398 -2043
- package/dist/{platform-lifecycle-ByAlpkhV.mjs → platform-lifecycle-_gfnjUBr.mjs} +1 -1
- package/dist/{platform-management-CBOT4BSM.mjs → platform-management-CYrLvTGH.mjs} +1 -1
- package/dist/{platform-management-CuuVDhyt.mjs → platform-management-t7HKy4-U.mjs} +632 -124
- package/dist/{platform-plans-config-CN-heS4q.mjs → platform-plans-config-CNH6zbPX.mjs} +15 -11
- package/dist/{platform-recovery-CskSJgLh.mjs → platform-recovery-DeucI7A9.mjs} +6 -9
- package/dist/{platform-registry-Cjv2Qf0r.mjs → platform-registry-B9mWX9LO.mjs} +13 -18
- package/dist/{platform-setup-BBxRxmFC.mjs → platform-setup-CTf6MMT9.mjs} +19 -26
- package/dist/{plugin-inference-BlQbOL0P.mjs → plugin-inference-DsARdQKE.mjs} +18 -33
- package/dist/{prepare-Dq9hTIbo.mjs → prepare-C4zfwks4.mjs} +3 -3
- package/dist/{prepare-Do96654b.mjs → prepare-CSH9dKTI.mjs} +11 -13
- package/dist/prepare-dr9uxQSV.mjs +2 -0
- package/dist/{prerender-render-Ct20jftc.mjs → prerender-render-Bfsumdkv.mjs} +8 -2
- package/dist/prerender-render.d.mts +2 -0
- package/dist/prerender-render.mjs +2 -2
- package/dist/project-DiiOBZPF.mjs +2 -0
- package/dist/{project-cmd-DaoRrn-8.mjs → project-cmd-Dq75AXzy.mjs} +19 -19
- package/dist/{project-paths-GgcMozYz.mjs → project-paths-DMvEeSau.mjs} +9 -14
- package/dist/{project-BAm2aB6Q.mjs → project-rqDnVsJN.mjs} +8 -4
- package/dist/{project-team-Q_lCA7Io.mjs → project-team-B3_QcStG.mjs} +6 -6
- package/dist/{project-token-BArgK9o1.mjs → project-token-CvsRvv2I.mjs} +5 -5
- package/dist/{project-tsconfig-CVJhNMxs.mjs → project-tsconfig-bveqhlYA.mjs} +3 -5
- package/dist/{project-zero-trust-KO9Hu2Pq.mjs → project-zero-trust-D1ICiwN_.mjs} +5 -5
- package/dist/{protocol-BPZaNqBo.d.mts → protocol-4H7V_3Os.d.mts} +1 -1
- package/dist/{protocol-CfaUwNs8.mjs → protocol-RNP0u7UY.mjs} +9 -3
- package/dist/{provision-BfaLiWbj.mjs → provision-DDh7ITVS.mjs} +118 -865
- package/dist/{requests-C7Oeoh5u.mjs → requests-3CL3BuZh.mjs} +4 -4
- package/dist/resolve-project-B9Hr0D3n.mjs +2 -0
- package/dist/resolve-project-C_Cu7E8a.mjs +48 -0
- package/dist/{rollback-DVAtrLAl.mjs → rollback-Ce1d_0J9.mjs} +7 -17
- package/dist/{route-types-CbtsIeFn.mjs → route-types-IrBuwJ7u.mjs} +35 -70
- package/dist/routing-assets-VkrKIbxE.mjs +139 -0
- package/dist/{runner-9wjsSZx-.mjs → runner-B5huK2eC.mjs} +1 -1
- package/dist/{runner-DMBKSrRk.mjs → runner-DcVDrzuR.mjs} +7 -28
- package/dist/{runner-mysql-CEzKtmFb.mjs → runner-mysql-CCtyI0p6.mjs} +4 -3
- package/dist/runner-mysql-CaJq-hd6.mjs +2 -0
- package/dist/runner-pg-BJhFZZG4.mjs +2 -0
- package/dist/{runner-pg-DV8p_zjA.mjs → runner-pg-CPd-CB_F.mjs} +1 -1
- package/dist/runtime/ai.mjs +9 -22
- package/dist/runtime/better-auth-mysql.d.mts +2 -5
- package/dist/runtime/better-auth-mysql.mjs +6 -31
- package/dist/runtime/better-auth-pg.d.mts +2 -5
- package/dist/runtime/better-auth-pg.mjs +6 -32
- package/dist/runtime/better-auth.d.mts +2 -4
- package/dist/runtime/better-auth.mjs +9 -19
- package/dist/runtime/db.mjs +1 -1
- package/dist/runtime/durable.d.mts +16 -0
- package/dist/runtime/durable.mjs +26 -2
- package/dist/runtime/email/testing.d.mts +1 -1
- package/dist/runtime/email/testing.mjs +9 -23
- package/dist/runtime/email-protocol.d.mts +12 -0
- package/dist/runtime/email-protocol.mjs +2 -70
- package/dist/runtime/email.d.mts +1 -1
- package/dist/runtime/email.mjs +79 -221
- package/dist/runtime/env-public.d.mts +1 -1
- package/dist/runtime/env-public.mjs +12 -38
- package/dist/runtime/env.d.mts +1 -12
- package/dist/runtime/env.mjs +1 -1
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/handler.mjs +1 -1
- package/dist/runtime/isr.mjs +1 -1
- package/dist/runtime/kv.mjs +1 -1
- package/dist/runtime/live-client.d.mts +1 -1
- package/dist/runtime/live-server.mjs +1 -16
- package/dist/runtime/live.d.mts +1 -1
- package/dist/runtime/live.mjs +1 -1
- package/dist/runtime/migration-handler-mysql.d.mts +2 -2
- package/dist/runtime/migration-handler-mysql.mjs +3 -2
- package/dist/runtime/migration-handler-pg.d.mts +2 -2
- package/dist/runtime/migration-handler-pg.mjs +1 -1
- package/dist/runtime/migration-handler.d.mts +2 -2
- package/dist/runtime/migration-handler.mjs +2 -470
- package/dist/runtime/queues.mjs +1 -1
- package/dist/runtime/remote/binding-handler.mjs +62 -62
- package/dist/runtime/remote/index.mjs +16 -77
- package/dist/runtime/routing.d.mts +1 -4
- package/dist/runtime/routing.mjs +82 -218
- package/dist/runtime/sandbox-container.d.mts +2 -2
- package/dist/runtime/sandbox-container.mjs +2 -2
- package/dist/runtime/sandbox.d.mts +2 -2
- package/dist/runtime/sandbox.mjs +13 -6
- package/dist/runtime/storage.mjs +1 -1
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +2 -3
- package/dist/runtime/ws-server.mjs +6 -28
- package/dist/runtime/ws.d.mts +1 -1
- package/dist/{sandbox-container-Bo0eiFKz.d.mts → sandbox-container-ChQRum-j.d.mts} +3 -1
- package/dist/{sandbox-container-C6ItmVuN.mjs → sandbox-container-DBKIqDEK.mjs} +12 -1
- package/dist/{sandbox-C5LFoJMf.d.mts → sandbox-q3waMc2T.d.mts} +1 -1
- package/dist/{scan-C3uDzz6J.mjs → scan-C0BMdmEd.mjs} +84 -7
- package/dist/{secret-BvtB7IjY.mjs → secret-B5J8bBsI.mjs} +62 -80
- package/dist/{serialize-BPvnNQuA.mjs → serialize-BtQyaYoC.mjs} +10 -4
- package/dist/{skills-BgVMvQdy.mjs → skills-BJsan98C.mjs} +2 -2
- package/dist/{subcommand-prompt-BSlnD1fI.mjs → subcommand-prompt-gQ-NDA-u.mjs} +38 -43
- package/dist/sveltekit.mjs +1 -1
- package/dist/validate-C9xtFOYR.mjs +2 -0
- package/dist/{validate-C9qJArv7.mjs → validate-CheZGRE7.mjs} +4 -8
- package/dist/version-metadata-DIrqEHQo.mjs +73 -0
- package/dist/{wrangler-D9KTuqnv.mjs → wrangler-BYs07Rxy.mjs} +119 -378
- package/dist/{ws-CChrrAU-.d.mts → ws-aKVYB-fA.d.mts} +1 -1
- package/dist/yarn-pnp-DLbEFMT0.mjs +92 -0
- package/docs/guide/auth.md +2 -0
- package/docs/guide/database/postgresql.md +2 -0
- package/docs/guide/database.md +2 -0
- package/docs/guide/durable-state.md +24 -0
- package/docs/guide/platform/administration/access.md +4 -0
- package/docs/guide/platform/administration/connected-apps.md +55 -0
- package/docs/guide/platform/installation/credentials.md +3 -1
- package/docs/guide/quickstart.md +2 -0
- package/docs/guide/sandboxes.md +2 -0
- package/docs/reference/api/deploy.md +23 -0
- package/docs/reference/api/pages.md +2 -0
- package/docs/reference/api.md +2 -1
- package/docs/reference/cli/database.md +9 -3
- package/docs/reference/cli/platform-installation.md +1 -1
- package/docs/reference/cli/setup.md +2 -0
- package/package.json +13 -16
- package/skills/void/SKILL.md +1 -0
- package/dist/auth-LMJcNESe.mjs +0 -2
- package/dist/cf-build-output-H9a97vME.mjs +0 -2
- package/dist/cf-user-agent-lKblH3zU.mjs +0 -17
- package/dist/client-tso2OfcG.mjs +0 -2
- package/dist/collect-DLyFDiKW.mjs +0 -2
- package/dist/config-5r-YpMC-.mjs +0 -2
- package/dist/config-B_ggY-IO.mjs +0 -89
- package/dist/config-BtSFvXZx.mjs +0 -2
- package/dist/config-write-AHGesphx.mjs +0 -61
- package/dist/deploy-Bqe1PYBw.mjs +0 -10458
- package/dist/deploy-VsWsVQkw.mjs +0 -2
- package/dist/dev-inbox-CK-UuPob.mjs +0 -297
- package/dist/discover-EDUf6JJw.mjs +0 -2
- package/dist/dist-_UUlL6bg.mjs +0 -2
- package/dist/env-validation-Dxdx_5wo.mjs +0 -951
- package/dist/gen-dA9hW7AV.mjs +0 -2
- package/dist/head-client-DzmJGN4C.mjs +0 -90
- package/dist/help-DfQYVfGY.mjs +0 -2
- package/dist/login-mx_ydhmp.mjs +0 -2
- package/dist/migrate-BHp07yJE.mjs +0 -2
- package/dist/operator-cmd-CwBB-1yb.mjs +0 -2
- package/dist/pages/head-client.d.mts +0 -13
- package/dist/pages/head-client.mjs +0 -2
- package/dist/platform-args-D4E1PjVw.mjs +0 -2
- package/dist/prepare-DRUV-g3X.mjs +0 -2
- package/dist/project-DedqCp59.mjs +0 -2
- package/dist/provision-Wu9ZBk9L.mjs +0 -2
- package/dist/resolve-project-BIeYs9Cw.mjs +0 -2
- package/dist/resolve-project-CP8rZs_p.mjs +0 -28
- package/dist/runner-mysql-CkFqZ6CE.mjs +0 -2
- package/dist/runner-pg-BGYRFdRp.mjs +0 -2
- package/dist/runtime/env-helpers.d.mts +0 -2
- package/dist/runtime/env-helpers.mjs +0 -2
- package/dist/validate-BJr9LfXy.mjs +0 -2
- package/dist/yarn-pnp-CUX_iTPA.mjs +0 -188
package/dist/runtime/live.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="@cloudflare/workers-types" />
|
|
2
|
-
import { _ as __getLiveBindingName, a as LiveControlErrorCode, b as defineLiveStream, c as LiveControlOptions, d as LiveHookContext, f as LiveLimits, g as LiveSubscribeHookContext, h as LiveStreamOptions, i as LiveControlError, l as LiveControlRequest, m as LiveStream, n as LiveConnectHookContext, o as LiveControlOperation, p as LivePublishOptions, r as LiveConnectOptions, s as LiveControlOperationResult, t as LiveClientEvent, u as LiveControlResponse, v as __setLiveBindingName, y as __setLiveDev } from "../live-
|
|
2
|
+
import { _ as __getLiveBindingName, a as LiveControlErrorCode, b as defineLiveStream, c as LiveControlOptions, d as LiveHookContext, f as LiveLimits, g as LiveSubscribeHookContext, h as LiveStreamOptions, i as LiveControlError, l as LiveControlRequest, m as LiveStream, n as LiveConnectHookContext, o as LiveControlOperation, p as LivePublishOptions, r as LiveConnectOptions, s as LiveControlOperationResult, t as LiveClientEvent, u as LiveControlResponse, v as __setLiveBindingName, y as __setLiveDev } from "../live-DJONVlQK.mjs";
|
|
3
3
|
export { LiveClientEvent, LiveConnectHookContext, LiveConnectOptions, LiveControlError, LiveControlErrorCode, LiveControlOperation, LiveControlOperationResult, LiveControlOptions, LiveControlRequest, LiveControlResponse, LiveHookContext, LiveLimits, LivePublishOptions, LiveStream, LiveStreamOptions, LiveSubscribeHookContext, __getLiveBindingName, __setLiveBindingName, __setLiveDev, defineLiveStream };
|
package/dist/runtime/live.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as defineLiveStream, n as __setLiveBindingName, r as __setLiveDev, t as __getLiveBindingName } from "../live-
|
|
1
|
+
import { i as defineLiveStream, n as __setLiveBindingName, r as __setLiveDev, t as __getLiveBindingName } from "../live-BxLX-JqJ.mjs";
|
|
2
2
|
export { __getLiveBindingName, __setLiveBindingName, __setLiveDev, defineLiveStream };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as MigrationEntry } from "../migration-handler-
|
|
1
|
+
import { t as MigrationEntry } from "../migration-handler-CwlEQUoo.mjs";
|
|
2
2
|
//#region src/runtime/migration-handler-mysql.d.ts
|
|
3
|
-
export declare function createMigrationHandler(env: Record<string, unknown>, migrations: Array<MigrationEntry>,
|
|
3
|
+
export declare function createMigrationHandler(env: Record<string, unknown>, migrations: Array<MigrationEntry>, runAuthMigrations?: () => Promise<void>): (request: Request) => Promise<Response>;
|
|
4
4
|
//#endregion
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { n as splitMigrationSql } from "../migration-handler-Cg0Y4EPu.mjs";
|
|
1
2
|
//#region src/runtime/migration-handler-mysql.ts
|
|
2
|
-
function createMigrationHandler(env, migrations,
|
|
3
|
+
function createMigrationHandler(env, migrations, runAuthMigrations) {
|
|
3
4
|
return async (request) => {
|
|
4
5
|
const token = request.headers.get("x-void-internal");
|
|
5
6
|
if (!token || token !== env.__VOID_PROXY_TOKEN) return Response.json({
|
|
@@ -48,7 +49,7 @@ async function runMySqlMigrations(env, migrations) {
|
|
|
48
49
|
}
|
|
49
50
|
const start = Date.now();
|
|
50
51
|
try {
|
|
51
|
-
await connection.query(
|
|
52
|
+
for (const statement of splitMigrationSql(migration.sql)) await connection.query(statement);
|
|
52
53
|
await connection.query("INSERT INTO `_void_migrations` (`name`, `applied_at`) VALUES (?, ?)", [migration.name, (/* @__PURE__ */ new Date()).toISOString()]);
|
|
53
54
|
results.push({
|
|
54
55
|
name: migration.name,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as MigrationEntry } from "../migration-handler-
|
|
1
|
+
import { t as MigrationEntry } from "../migration-handler-CwlEQUoo.mjs";
|
|
2
2
|
//#region src/runtime/migration-handler-pg.d.ts
|
|
3
|
-
export declare function createMigrationHandler(env: Record<string, unknown>, migrations: Array<MigrationEntry>,
|
|
3
|
+
export declare function createMigrationHandler(env: Record<string, unknown>, migrations: Array<MigrationEntry>, runAuthMigrations?: () => Promise<void>): (request: Request) => Promise<Response>;
|
|
4
4
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as disablePgPassFallback } from "../pg-J2HbZIkX.mjs";
|
|
2
2
|
//#region src/runtime/migration-handler-pg.ts
|
|
3
|
-
function createMigrationHandler(env, migrations,
|
|
3
|
+
function createMigrationHandler(env, migrations, runAuthMigrations) {
|
|
4
4
|
return async (request) => {
|
|
5
5
|
const token = request.headers.get("x-void-internal");
|
|
6
6
|
if (!token || token !== env.__VOID_PROXY_TOKEN) return Response.json({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as createMigrationHandler, n as MigrationResponse, r as MigrationResult, t as MigrationEntry } from "../migration-handler-
|
|
2
|
-
export { MigrationEntry, MigrationResponse, MigrationResult, createMigrationHandler };
|
|
1
|
+
import { a as splitMigrationSql, i as createMigrationHandler, n as MigrationResponse, r as MigrationResult, t as MigrationEntry } from "../migration-handler-CwlEQUoo.mjs";
|
|
2
|
+
export { MigrationEntry, MigrationResponse, MigrationResult, createMigrationHandler, splitMigrationSql };
|
|
@@ -1,470 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const SUPPORTED_CLASSIFIER_VERSION = 1;
|
|
4
|
-
function createMigrationHandler(env, migrations, _dialect, runAuthMigrations, planBundle) {
|
|
5
|
-
return async (request) => {
|
|
6
|
-
const token = request.headers.get("x-void-internal");
|
|
7
|
-
if (!token || token !== env.__VOID_PROXY_TOKEN) return Response.json({
|
|
8
|
-
ok: false,
|
|
9
|
-
error: "unauthorized",
|
|
10
|
-
migrations: []
|
|
11
|
-
}, { status: 401 });
|
|
12
|
-
const url = new URL(request.url);
|
|
13
|
-
try {
|
|
14
|
-
const db = env.DB;
|
|
15
|
-
if (!db) return Response.json({
|
|
16
|
-
ok: false,
|
|
17
|
-
error: "no D1 binding found",
|
|
18
|
-
migrations: []
|
|
19
|
-
}, { status: 500 });
|
|
20
|
-
if (request.method === "GET" && url.pathname === "/__void/migrate/capabilities") {
|
|
21
|
-
const verified = await verifyPlanBundle(migrations ?? [], planBundle);
|
|
22
|
-
return Response.json({
|
|
23
|
-
classifierVersion: verified.classifierVersion,
|
|
24
|
-
destructiveValidation: verified.destructiveValidation,
|
|
25
|
-
dialect: "sqlite",
|
|
26
|
-
endpoints: {
|
|
27
|
-
app: "/__void/migrate/app",
|
|
28
|
-
auth: runAuthMigrations ? "/__void/migrate/auth" : void 0,
|
|
29
|
-
reconcile: "/__void/migrate/app/attempt/:attemptId"
|
|
30
|
-
},
|
|
31
|
-
migrationListHash: verified.migrationListHash,
|
|
32
|
-
protocolVersion: 2
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
if (request.method === "POST" && url.pathname === "/__void/migrate/app") {
|
|
36
|
-
const body = await request.json().catch(() => ({}));
|
|
37
|
-
if (!body.attemptId) return Response.json({
|
|
38
|
-
ok: false,
|
|
39
|
-
protocolVersion: 2,
|
|
40
|
-
error: "attemptId required",
|
|
41
|
-
migrations: []
|
|
42
|
-
}, { status: 400 });
|
|
43
|
-
const result = await runD1AppMigrations(db, migrations ?? [], planBundle, {
|
|
44
|
-
attemptId: body.attemptId,
|
|
45
|
-
deploymentId: body.deploymentId
|
|
46
|
-
});
|
|
47
|
-
const status = result.ok ? 200 : result.error?.startsWith("migration already in progress") ? 409 : 500;
|
|
48
|
-
return Response.json(result, { status });
|
|
49
|
-
}
|
|
50
|
-
if (request.method === "GET" && url.pathname.startsWith("/__void/migrate/app/attempt/")) {
|
|
51
|
-
const result = await reconcileAttempt(db, decodeURIComponent(url.pathname.split("/").pop() ?? ""));
|
|
52
|
-
return Response.json(result, { status: result.ok ? 200 : 409 });
|
|
53
|
-
}
|
|
54
|
-
if (request.method === "POST" && url.pathname === "/__void/migrate/auth") {
|
|
55
|
-
if (runAuthMigrations) await runAuthMigrations();
|
|
56
|
-
return Response.json({
|
|
57
|
-
ok: true,
|
|
58
|
-
protocolVersion: 2
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
const result = await runD1LegacyMigrations(db, migrations ?? []);
|
|
62
|
-
if (result.ok && runAuthMigrations) try {
|
|
63
|
-
await runAuthMigrations();
|
|
64
|
-
} catch (err) {
|
|
65
|
-
return Response.json({
|
|
66
|
-
...result,
|
|
67
|
-
ok: false,
|
|
68
|
-
error: err instanceof Error ? err.message : String(err)
|
|
69
|
-
}, { status: 500 });
|
|
70
|
-
}
|
|
71
|
-
return Response.json(result);
|
|
72
|
-
} catch (err) {
|
|
73
|
-
return Response.json({
|
|
74
|
-
ok: false,
|
|
75
|
-
error: err instanceof Error ? err.message : String(err),
|
|
76
|
-
migrations: []
|
|
77
|
-
}, { status: 500 });
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
async function createTrackingTable(db) {
|
|
82
|
-
await db.prepare(`CREATE TABLE IF NOT EXISTS _void_migrations (
|
|
83
|
-
name TEXT PRIMARY KEY,
|
|
84
|
-
applied_at TEXT NOT NULL
|
|
85
|
-
)`).run();
|
|
86
|
-
}
|
|
87
|
-
async function createAttemptTables(db) {
|
|
88
|
-
await db.batch([
|
|
89
|
-
db.prepare(`CREATE TABLE IF NOT EXISTS _void_migration_attempts (
|
|
90
|
-
attempt_id TEXT PRIMARY KEY,
|
|
91
|
-
deployment_id TEXT,
|
|
92
|
-
migration_list_hash TEXT NOT NULL,
|
|
93
|
-
planned_names_json TEXT NOT NULL,
|
|
94
|
-
plan_hashes_json TEXT NOT NULL,
|
|
95
|
-
status TEXT NOT NULL CHECK (status IN ('running', 'completed', 'failed', 'unknown')),
|
|
96
|
-
started_at TEXT NOT NULL,
|
|
97
|
-
completed_at TEXT,
|
|
98
|
-
error TEXT
|
|
99
|
-
)`),
|
|
100
|
-
db.prepare(`CREATE TABLE IF NOT EXISTS _void_migration_lock (
|
|
101
|
-
name TEXT PRIMARY KEY,
|
|
102
|
-
attempt_id TEXT NOT NULL,
|
|
103
|
-
acquired_at TEXT NOT NULL
|
|
104
|
-
)`),
|
|
105
|
-
db.prepare(`CREATE TABLE IF NOT EXISTS _void_migration_fences (
|
|
106
|
-
attempt_id TEXT PRIMARY KEY,
|
|
107
|
-
owned INTEGER NOT NULL CHECK (owned = 1)
|
|
108
|
-
)`)
|
|
109
|
-
]);
|
|
110
|
-
}
|
|
111
|
-
async function upgradeTrackingTable(db, fencedAttemptId) {
|
|
112
|
-
const { results } = await db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='_migrations'").all();
|
|
113
|
-
if (!results || results.length === 0) return;
|
|
114
|
-
await db.batch([
|
|
115
|
-
...ownershipFence(db, fencedAttemptId),
|
|
116
|
-
db.prepare(`CREATE TABLE IF NOT EXISTS _void_migrations (
|
|
117
|
-
name TEXT PRIMARY KEY,
|
|
118
|
-
applied_at TEXT NOT NULL
|
|
119
|
-
)`),
|
|
120
|
-
db.prepare(`INSERT OR IGNORE INTO _void_migrations (name, applied_at) SELECT name, applied_at FROM _migrations`),
|
|
121
|
-
db.prepare(`DROP TABLE _migrations`)
|
|
122
|
-
]);
|
|
123
|
-
}
|
|
124
|
-
async function readAppliedSet(db) {
|
|
125
|
-
const { results } = await db.prepare("SELECT name FROM _void_migrations").all();
|
|
126
|
-
return new Set((results ?? []).map((row) => row.name));
|
|
127
|
-
}
|
|
128
|
-
async function runD1AppMigrations(db, migrations, planBundle, attempt) {
|
|
129
|
-
const verified = await verifyPlanBundle(migrations, planBundle);
|
|
130
|
-
await createAttemptTables(db);
|
|
131
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
132
|
-
const plannedNames = migrations.map((migration) => migration.name);
|
|
133
|
-
const planHashes = verified.plans.map((plan) => plan.planHash);
|
|
134
|
-
const fenced = verified.plans.every((plan) => plan.kind !== "legacy-unsplit-multi-statement");
|
|
135
|
-
const lock = await acquireAttemptLock(db, attempt.attemptId, now, [db.prepare(`INSERT INTO _void_migration_attempts
|
|
136
|
-
(attempt_id, deployment_id, migration_list_hash, planned_names_json, plan_hashes_json, status, started_at)
|
|
137
|
-
VALUES (?, ?, ?, ?, ?, 'running', ?)`).bind(attempt.attemptId, attempt.deploymentId ?? null, verified.migrationListHash, JSON.stringify(plannedNames), JSON.stringify(planHashes), now), ...fenced ? [db.prepare("INSERT INTO _void_migration_fences (attempt_id, owned) VALUES (?, 1)").bind(attempt.attemptId)] : []]);
|
|
138
|
-
if (lock !== "acquired") return lock;
|
|
139
|
-
const migrationResults = [];
|
|
140
|
-
const confirmedApplied = [];
|
|
141
|
-
const confirmedSkipped = [];
|
|
142
|
-
let warnings = verified.plans.flatMap((plan) => plan.warnings ?? []);
|
|
143
|
-
let stability = "stable";
|
|
144
|
-
try {
|
|
145
|
-
await createTrackingTable(db);
|
|
146
|
-
await upgradeTrackingTable(db, fenced ? attempt.attemptId : void 0);
|
|
147
|
-
const applied = await readAppliedSet(db);
|
|
148
|
-
warnings = verified.plans.flatMap((plan, index) => applied.has(migrations[index].name) ? [] : plan.warnings ?? []);
|
|
149
|
-
for (let index = 0; index < migrations.length; index++) {
|
|
150
|
-
const migration = migrations[index];
|
|
151
|
-
const plan = verified.plans[index];
|
|
152
|
-
if (plan.stability === "legacy") stability = "legacy";
|
|
153
|
-
if (applied.has(migration.name)) {
|
|
154
|
-
confirmedSkipped.push(migration.name);
|
|
155
|
-
migrationResults.push({
|
|
156
|
-
applied: false,
|
|
157
|
-
durationMs: 0,
|
|
158
|
-
name: migration.name,
|
|
159
|
-
stability: plan.stability,
|
|
160
|
-
status: "skipped"
|
|
161
|
-
});
|
|
162
|
-
continue;
|
|
163
|
-
}
|
|
164
|
-
const start = Date.now();
|
|
165
|
-
try {
|
|
166
|
-
await executeMigrationPlan(db, migration, plan, fenced ? attempt.attemptId : void 0);
|
|
167
|
-
applied.add(migration.name);
|
|
168
|
-
confirmedApplied.push(migration.name);
|
|
169
|
-
migrationResults.push({
|
|
170
|
-
applied: true,
|
|
171
|
-
durationMs: Date.now() - start,
|
|
172
|
-
name: migration.name,
|
|
173
|
-
stability: plan.stability,
|
|
174
|
-
status: "applied"
|
|
175
|
-
});
|
|
176
|
-
} catch (err) {
|
|
177
|
-
const error = err instanceof Error ? err.message : String(err);
|
|
178
|
-
migrationResults.push({
|
|
179
|
-
applied: false,
|
|
180
|
-
durationMs: Date.now() - start,
|
|
181
|
-
error,
|
|
182
|
-
name: migration.name,
|
|
183
|
-
stability: plan.stability,
|
|
184
|
-
status: "failed"
|
|
185
|
-
});
|
|
186
|
-
await markAttempt(db, attempt.attemptId, "failed", error);
|
|
187
|
-
await releaseAttemptLock(db, attempt.attemptId);
|
|
188
|
-
return {
|
|
189
|
-
ok: false,
|
|
190
|
-
protocolVersion: 2,
|
|
191
|
-
attemptId: attempt.attemptId,
|
|
192
|
-
confirmedApplied,
|
|
193
|
-
confirmedSkipped,
|
|
194
|
-
error: `migration ${migration.name} failed`,
|
|
195
|
-
migrations: migrationResults,
|
|
196
|
-
stability,
|
|
197
|
-
warnings
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
await markAttempt(db, attempt.attemptId, "completed");
|
|
202
|
-
await releaseAttemptLock(db, attempt.attemptId);
|
|
203
|
-
return {
|
|
204
|
-
ok: true,
|
|
205
|
-
protocolVersion: 2,
|
|
206
|
-
attemptId: attempt.attemptId,
|
|
207
|
-
confirmedApplied,
|
|
208
|
-
confirmedSkipped,
|
|
209
|
-
migrations: migrationResults,
|
|
210
|
-
stability,
|
|
211
|
-
warnings
|
|
212
|
-
};
|
|
213
|
-
} catch (err) {
|
|
214
|
-
const error = err instanceof Error ? err.message : String(err);
|
|
215
|
-
await markAttempt(db, attempt.attemptId, "failed", error).catch(() => {});
|
|
216
|
-
await releaseAttemptLock(db, attempt.attemptId).catch(() => {});
|
|
217
|
-
return {
|
|
218
|
-
ok: false,
|
|
219
|
-
protocolVersion: 2,
|
|
220
|
-
attemptId: attempt.attemptId,
|
|
221
|
-
confirmedApplied,
|
|
222
|
-
confirmedSkipped,
|
|
223
|
-
error,
|
|
224
|
-
migrations: migrationResults,
|
|
225
|
-
stability,
|
|
226
|
-
warnings
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
async function acquireAttemptLock(db, attemptId, acquiredAt, initialize) {
|
|
231
|
-
for (let tries = 0; tries < 2; tries++) try {
|
|
232
|
-
await db.batch([db.prepare("INSERT INTO _void_migration_lock (name, attempt_id, acquired_at) VALUES (?, ?, ?)").bind("app", attemptId, acquiredAt), ...initialize]);
|
|
233
|
-
return "acquired";
|
|
234
|
-
} catch {
|
|
235
|
-
const existing = await db.prepare("SELECT attempt_id FROM _void_migration_lock WHERE name = ?").bind("app").first();
|
|
236
|
-
if (!existing && await readAttempt(db, attemptId)) return reconcileAttempt(db, attemptId, false);
|
|
237
|
-
if (existing?.attempt_id) {
|
|
238
|
-
const row = await readAttempt(db, existing.attempt_id);
|
|
239
|
-
if (row?.status === "completed" || row?.status === "failed") {
|
|
240
|
-
await releaseAttemptLock(db, existing.attempt_id).catch(() => {});
|
|
241
|
-
continue;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
return {
|
|
245
|
-
ok: false,
|
|
246
|
-
protocolVersion: 2,
|
|
247
|
-
attemptId,
|
|
248
|
-
migrations: [],
|
|
249
|
-
error: `migration already in progress for attempt ${existing?.attempt_id ?? "unknown"}`
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
return {
|
|
253
|
-
ok: false,
|
|
254
|
-
protocolVersion: 2,
|
|
255
|
-
attemptId,
|
|
256
|
-
migrations: [],
|
|
257
|
-
error: "migration lock could not be acquired"
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
async function executeMigrationPlan(db, migration, plan, fencedAttemptId) {
|
|
261
|
-
const appliedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
262
|
-
if (plan.kind === "single-statement") {
|
|
263
|
-
await db.batch([
|
|
264
|
-
...ownershipFence(db, fencedAttemptId),
|
|
265
|
-
db.prepare(migration.sql),
|
|
266
|
-
db.prepare("INSERT INTO _void_migrations (name, applied_at) VALUES (?, ?)").bind(migration.name, appliedAt)
|
|
267
|
-
]);
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
if (plan.kind === "breakpoint-framed") {
|
|
271
|
-
await db.batch([
|
|
272
|
-
...ownershipFence(db, fencedAttemptId),
|
|
273
|
-
...plan.statements.map((statement) => db.prepare(statement)),
|
|
274
|
-
db.prepare("INSERT INTO _void_migrations (name, applied_at) VALUES (?, ?)").bind(migration.name, appliedAt)
|
|
275
|
-
]);
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
await runUnsplitMigration(db, migration, appliedAt, fencedAttemptId);
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* D1 `exec()` treats each line as its own statement, so multi-line statements
|
|
282
|
-
* fail there. Run each top-level statement through one batch instead, and keep
|
|
283
|
-
* `exec()` only for SQL the splitter cannot divide safely (trigger bodies).
|
|
284
|
-
*/
|
|
285
|
-
async function runUnsplitMigration(db, migration, appliedAt, fencedAttemptId) {
|
|
286
|
-
const record = db.prepare("INSERT OR IGNORE INTO _void_migrations (name, applied_at) VALUES (?, ?)").bind(migration.name, appliedAt);
|
|
287
|
-
const statements = splitSqlStatements(migration.sql);
|
|
288
|
-
if (statements) {
|
|
289
|
-
await db.batch([
|
|
290
|
-
...ownershipFence(db, fencedAttemptId),
|
|
291
|
-
...statements.map((statement) => db.prepare(statement)),
|
|
292
|
-
record
|
|
293
|
-
]);
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
await db.exec(migration.sql);
|
|
297
|
-
await record.run();
|
|
298
|
-
}
|
|
299
|
-
/** Fail the whole D1 batch if recovery has revoked this executor's ownership. */
|
|
300
|
-
function ownershipFence(db, attemptId) {
|
|
301
|
-
if (!attemptId) return [];
|
|
302
|
-
return [db.prepare(`INSERT INTO _void_migration_fences (attempt_id, owned)
|
|
303
|
-
VALUES (?, EXISTS(SELECT 1 FROM _void_migration_lock WHERE name = 'app' AND attempt_id = ?))
|
|
304
|
-
ON CONFLICT(attempt_id) DO UPDATE SET owned = excluded.owned`).bind(attemptId, attemptId)];
|
|
305
|
-
}
|
|
306
|
-
function attemptUpdate(db, attemptId, status, error) {
|
|
307
|
-
return db.prepare(`UPDATE _void_migration_attempts
|
|
308
|
-
SET status = ?, completed_at = ?, error = ?
|
|
309
|
-
WHERE attempt_id = ? AND status ${status === "completed" ? "IN ('running', 'unknown')" : "= 'running'"}`).bind(status, (/* @__PURE__ */ new Date()).toISOString(), error ?? null, attemptId);
|
|
310
|
-
}
|
|
311
|
-
async function markAttempt(db, attemptId, status, error) {
|
|
312
|
-
await attemptUpdate(db, attemptId, status, error).run();
|
|
313
|
-
}
|
|
314
|
-
async function releaseAttemptLock(db, attemptId) {
|
|
315
|
-
await db.prepare("DELETE FROM _void_migration_lock WHERE name = ? AND attempt_id = ?").bind("app", attemptId).run();
|
|
316
|
-
}
|
|
317
|
-
async function readAttempt(db, attemptId) {
|
|
318
|
-
return db.prepare("SELECT * FROM _void_migration_attempts WHERE attempt_id = ?").bind(attemptId).first();
|
|
319
|
-
}
|
|
320
|
-
async function reconcileAttempt(db, attemptId, recover = true) {
|
|
321
|
-
await createAttemptTables(db);
|
|
322
|
-
await createTrackingTable(db);
|
|
323
|
-
const row = await readAttempt(db, attemptId);
|
|
324
|
-
if (!row) return {
|
|
325
|
-
ok: false,
|
|
326
|
-
protocolVersion: 2,
|
|
327
|
-
attemptId,
|
|
328
|
-
migrations: [],
|
|
329
|
-
error: "migration attempt not found"
|
|
330
|
-
};
|
|
331
|
-
const fenced = await db.prepare("SELECT attempt_id FROM _void_migration_fences WHERE attempt_id = ?").bind(attemptId).first();
|
|
332
|
-
if (recover && fenced) await db.batch([attemptUpdate(db, attemptId, "unknown", "migration outcome unknown"), db.prepare("DELETE FROM _void_migration_lock WHERE name = ? AND attempt_id = ?").bind("app", attemptId)]);
|
|
333
|
-
const plannedNames = JSON.parse(row.planned_names_json);
|
|
334
|
-
const applied = await readAppliedSet(db);
|
|
335
|
-
const confirmed = plannedNames.filter((name) => applied.has(name));
|
|
336
|
-
const complete = confirmed.length === plannedNames.length;
|
|
337
|
-
if (complete && row.status !== "completed") await markAttempt(db, attemptId, "completed").catch(() => {});
|
|
338
|
-
const inProgress = !fenced && !complete && (row.status === "running" || row.status === "unknown");
|
|
339
|
-
if (complete || row.status === "completed" || row.status === "failed") await releaseAttemptLock(db, attemptId);
|
|
340
|
-
return {
|
|
341
|
-
ok: complete,
|
|
342
|
-
protocolVersion: 2,
|
|
343
|
-
attemptId,
|
|
344
|
-
confirmedApplied: [],
|
|
345
|
-
confirmedSkipped: confirmed,
|
|
346
|
-
migrations: plannedNames.map((name) => ({
|
|
347
|
-
applied: false,
|
|
348
|
-
durationMs: 0,
|
|
349
|
-
name,
|
|
350
|
-
status: applied.has(name) ? "skipped" : "failed"
|
|
351
|
-
})),
|
|
352
|
-
error: complete ? void 0 : inProgress ? `migration already in progress for attempt ${attemptId}; wait for this migration to finish before retrying recovery` : row.error ?? "migration outcome unknown",
|
|
353
|
-
stability: "stable"
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
async function verifyPlanBundle(migrations, planBundle) {
|
|
357
|
-
if (!planBundle || planBundle.protocolVersion !== 2) throw new Error("migration protocol v2 execution plans are missing");
|
|
358
|
-
if (planBundle.classifierVersion !== SUPPORTED_CLASSIFIER_VERSION || planBundle.destructiveValidation !== "passed") throw new Error("unsupported migration execution plan metadata");
|
|
359
|
-
if (planBundle.plans.length !== migrations.length) throw new Error("migration execution plan count does not match bundled migrations");
|
|
360
|
-
for (let index = 0; index < migrations.length; index++) {
|
|
361
|
-
const migration = migrations[index];
|
|
362
|
-
const plan = planBundle.plans[index];
|
|
363
|
-
if (plan.name !== migration.name || plan.dialect !== "sqlite" || plan.classifierVersion !== SUPPORTED_CLASSIFIER_VERSION) throw new Error(`invalid migration execution plan for ${migration.name}`);
|
|
364
|
-
const sqlHash = await sha256Hex(canonicalSql(migration.sql));
|
|
365
|
-
if (plan.sqlHash !== sqlHash) throw new Error(`migration SQL hash mismatch for ${migration.name}`);
|
|
366
|
-
const planHash = await hashPlan(plan);
|
|
367
|
-
if (plan.planHash !== planHash) throw new Error(`migration plan hash mismatch for ${migration.name}`);
|
|
368
|
-
}
|
|
369
|
-
const migrationListHash = await sha256Hex(canonicalJson(planBundle.plans.map((plan) => [
|
|
370
|
-
plan.name,
|
|
371
|
-
plan.sqlHash,
|
|
372
|
-
plan.planHash
|
|
373
|
-
])));
|
|
374
|
-
if (planBundle.migrationListHash !== migrationListHash) throw new Error("migration list hash mismatch");
|
|
375
|
-
return planBundle;
|
|
376
|
-
}
|
|
377
|
-
async function sha256Hex(value) {
|
|
378
|
-
const bytes = new TextEncoder().encode(value);
|
|
379
|
-
const hash = await crypto.subtle.digest("SHA-256", bytes);
|
|
380
|
-
return `sha256:${[...new Uint8Array(hash)].map((byte) => byte.toString(16).padStart(2, "0")).join("")}`;
|
|
381
|
-
}
|
|
382
|
-
async function hashPlan(plan) {
|
|
383
|
-
return sha256Hex(canonicalJson(getMigrationPlanHashInput(plan)));
|
|
384
|
-
}
|
|
385
|
-
async function runD1LegacyMigrations(db, migrations) {
|
|
386
|
-
await createTrackingTable(db);
|
|
387
|
-
await upgradeTrackingTable(db);
|
|
388
|
-
const applied = await readAppliedSet(db);
|
|
389
|
-
const migrationResults = [];
|
|
390
|
-
for (const migration of migrations) {
|
|
391
|
-
if (applied.has(migration.name)) {
|
|
392
|
-
migrationResults.push({
|
|
393
|
-
name: migration.name,
|
|
394
|
-
applied: false,
|
|
395
|
-
durationMs: 0
|
|
396
|
-
});
|
|
397
|
-
continue;
|
|
398
|
-
}
|
|
399
|
-
const start = Date.now();
|
|
400
|
-
try {
|
|
401
|
-
const statements = splitMigrationSql(migration.sql);
|
|
402
|
-
if (statements.length === 1) {
|
|
403
|
-
if (isSingleStatement(statements[0])) {
|
|
404
|
-
await db.prepare(statements[0]).run();
|
|
405
|
-
await recordLegacyMigration(db, migration.name);
|
|
406
|
-
} else await runUnsplitMigration(db, migration, (/* @__PURE__ */ new Date()).toISOString());
|
|
407
|
-
} else {
|
|
408
|
-
for (const statement of statements) await db.prepare(statement).run();
|
|
409
|
-
await recordLegacyMigration(db, migration.name);
|
|
410
|
-
}
|
|
411
|
-
migrationResults.push({
|
|
412
|
-
name: migration.name,
|
|
413
|
-
applied: true,
|
|
414
|
-
durationMs: Date.now() - start
|
|
415
|
-
});
|
|
416
|
-
} catch (err) {
|
|
417
|
-
migrationResults.push({
|
|
418
|
-
name: migration.name,
|
|
419
|
-
applied: false,
|
|
420
|
-
durationMs: Date.now() - start,
|
|
421
|
-
error: err instanceof Error ? err.message : String(err)
|
|
422
|
-
});
|
|
423
|
-
return {
|
|
424
|
-
ok: false,
|
|
425
|
-
migrations: migrationResults,
|
|
426
|
-
error: `migration ${migration.name} failed`
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
return {
|
|
431
|
-
ok: true,
|
|
432
|
-
migrations: migrationResults
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
async function recordLegacyMigration(db, name) {
|
|
436
|
-
await db.prepare("INSERT OR IGNORE INTO _void_migrations (name, applied_at) VALUES (?, ?)").bind(name, (/* @__PURE__ */ new Date()).toISOString()).run();
|
|
437
|
-
}
|
|
438
|
-
function splitMigrationSql(sql) {
|
|
439
|
-
const lines = sql.split(/\r?\n/);
|
|
440
|
-
if (!lines.some((line) => isStatementBreakpointLine(line) || hasInlineStatementBreakpoint(line))) return [sql];
|
|
441
|
-
const statements = [];
|
|
442
|
-
const current = [];
|
|
443
|
-
for (const line of lines) {
|
|
444
|
-
if (isStatementBreakpointLine(line)) {
|
|
445
|
-
const statement = current.join("\n").trim();
|
|
446
|
-
if (statement) statements.push(statement);
|
|
447
|
-
current.length = 0;
|
|
448
|
-
continue;
|
|
449
|
-
}
|
|
450
|
-
if (hasInlineStatementBreakpoint(line)) {
|
|
451
|
-
current.push(line.replace(/-->\s*statement-breakpoint\s*$/, ""));
|
|
452
|
-
const statement = current.join("\n").trim();
|
|
453
|
-
if (statement) statements.push(statement);
|
|
454
|
-
current.length = 0;
|
|
455
|
-
continue;
|
|
456
|
-
}
|
|
457
|
-
current.push(line);
|
|
458
|
-
}
|
|
459
|
-
const statement = current.join("\n").trim();
|
|
460
|
-
if (statement) statements.push(statement);
|
|
461
|
-
return statements.length > 0 ? statements : [sql];
|
|
462
|
-
}
|
|
463
|
-
function isStatementBreakpointLine(line) {
|
|
464
|
-
return line.trim() === "--> statement-breakpoint";
|
|
465
|
-
}
|
|
466
|
-
function hasInlineStatementBreakpoint(line) {
|
|
467
|
-
return /;\s*-->\s*statement-breakpoint\s*$/.test(line.trim());
|
|
468
|
-
}
|
|
469
|
-
//#endregion
|
|
470
|
-
export { createMigrationHandler };
|
|
1
|
+
import { n as splitMigrationSql, t as createMigrationHandler } from "../migration-handler-Cg0Y4EPu.mjs";
|
|
2
|
+
export { createMigrationHandler, splitMigrationSql };
|
package/dist/runtime/queues.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as requireRuntimeBinding } from "../env-
|
|
1
|
+
import { a as requireRuntimeBinding } from "../env-BhdWMrNy.mjs";
|
|
2
2
|
//#region src/runtime/queues.ts
|
|
3
3
|
/** Typed queue producers — resolves `QUEUE_*` bindings from the active runtime environment. */
|
|
4
4
|
const queues = new Proxy({}, { get(_, name) {
|