void 0.21.9 → 0.23.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 +5 -1
- package/dist/{account-cmd-DZZGK80W.mjs → account-cmd-C84Ee8cO.mjs} +5 -5
- package/dist/{scan-ClYmX3sa.mjs → application-analysis-BVsVqc11.mjs} +135 -18
- package/dist/application-routing-B7QEjqSR.mjs +27 -0
- package/dist/{auth-CZuiVsFh.mjs → auth-CCjt0hcq.mjs} +1 -1
- package/dist/{auth-DLNN0D3Z.mjs → auth-CSkdO2Bb.mjs} +4 -47
- package/dist/{auth-link-B_CeugBw.mjs → auth-link-CioEg6uY.mjs} +5 -5
- package/dist/{auth-router-BgEFRuvZ.mjs → auth-router-BsR981d4.mjs} +5 -5
- package/dist/{better-auth-shared-rsBGBvWJ.mjs → better-auth-shared-hy6RPh9W.mjs} +13 -2
- package/dist/{build-cmd-Dpt0jd-x.mjs → build-cmd-LzvNJORH.mjs} +19 -7
- package/dist/{cache-7_UeZdTk.mjs → cache-C4MvnrMH.mjs} +4 -4
- package/dist/{cancel-deploy-D23R1RXT.mjs → cancel-deploy-abUxpP2n.mjs} +4 -4
- package/dist/{cf-build-output-CGT03qCD.mjs → cf-build-output-BPqOT964.mjs} +141 -63
- package/dist/cf-build-output-_0HNWysu.mjs +2 -0
- package/dist/cli/cli.mjs +114 -460
- package/dist/cli/cloudflare-operation-process.mjs +1103 -0
- package/dist/cli/env-schema-probe.d.mts +2 -1
- package/dist/cli/env-schema-probe.mjs +3 -3
- package/dist/client-Cu7jWiF1.mjs +2 -0
- package/dist/{client-QTl6ko_D.mjs → client-RV8NVeB8.mjs} +165 -21
- package/dist/{cloudflare-auth-C4_GPZr0.mjs → cloudflare-auth-Qdc7tw8F.mjs} +41 -43
- package/dist/{cloudflare-cmd-bSmZ1d5L.mjs → cloudflare-cmd-BcrVyTmJ.mjs} +9 -10
- package/dist/cloudflare-config-Bktvwtpf.mjs +182 -0
- package/dist/{cloudflare-connect-jAwacxxP.mjs → cloudflare-connect-B8uPZ4nx.mjs} +4 -4
- package/dist/{cloudflare-operations-BipGMJ5O.mjs → cloudflare-operations-AiWashgg.mjs} +1 -1
- package/dist/{cloudflare-operations-sMZXpk_S.mjs → cloudflare-operations-fxHb-byx.mjs} +118 -203
- package/dist/{preset-UHj9ARyP.mjs → cloudflare-process-B-wekeR6.mjs} +93 -6
- package/dist/{config-CF69HgXc.d.mts → config-BMHb8RCj.d.mts} +2 -2
- package/dist/{config-CafTW6Cz.mjs → config-Br_JZD6u.mjs} +2 -7
- package/dist/config-C_XRIPx2.mjs +89 -0
- package/dist/{config-s7Xj7tPb.mjs → config-CyQ-wVd7.mjs} +1 -1
- package/dist/config-entry.d.mts +1 -1
- package/dist/{config-write-BSduPMY8.mjs → config-write-B1f88wJA.mjs} +1 -1
- package/dist/{connect-BsUSRzln.mjs → connect-Bd4kJd9U.mjs} +6 -6
- package/dist/{create-project-BniEV0OW.mjs → create-project-Boczwj5r.mjs} +1 -1
- package/dist/{create-project-DBfFSZKY.mjs → create-project-bMf6ffLZ.mjs} +9 -5
- package/dist/{db-hRrvZaq_.mjs → db-8uG64XLl.mjs} +26 -26
- package/dist/{delete-D6dZ9B6B.mjs → delete-NvbiyeJf.mjs} +4 -4
- package/dist/{deploy-WaAQez1O.mjs → deploy-DzAIwqNU.mjs} +944 -607
- package/dist/{deploy-DDz7c8LK.mjs → deploy-bjXdFCtn.mjs} +1 -1
- package/dist/{dist-BR1quN_w.mjs → dist-AoCzRTJE.mjs} +226 -60
- package/dist/{dist-C5fND3R0.mjs → dist-BuDuKZJv.mjs} +1 -1
- package/dist/{dist-Dn6nn2IU.mjs → dist-CTBk70IR.mjs} +42 -42
- package/dist/{domain-Dmhvb2oU.mjs → domain-y5Tvydvo.mjs} +5 -5
- package/dist/{email-DFi-s2t4.mjs → email-B3umsW75.mjs} +15 -30
- package/dist/{env-Csi-tMbT.mjs → env-BS6qYHDb.mjs} +6 -6
- package/dist/{env-public-D_6u46fX.d.mts → env-public-BX_r8HR6.d.mts} +2 -1
- package/dist/{env-validation-BB4GkLxn.mjs → env-validation-BPn7vk-V.mjs} +18 -71
- package/dist/{env-validation-BXge7uyK.mjs → env-validation-DbTg7-ar.mjs} +1 -1
- package/dist/{fetch-CXDChK7B.mjs → fetch-BIZJh7vR.mjs} +2 -2
- package/dist/{fetch-stream-AOByI7Ki.mjs → fetch-stream-IvCYKyQL.mjs} +24 -4
- package/dist/{gen-Dz3X1Qab.mjs → gen-B580--vC.mjs} +5 -5
- package/dist/gen-BVaUUumi.mjs +2 -0
- package/dist/{github-cmd-BED3_9JD.mjs → github-cmd-v45BdfKX.mjs} +6 -8
- package/dist/{handler-BXJTXd02.d.mts → handler-CZ4nAylQ.d.mts} +2 -1
- package/dist/{headers-BOg_velo.mjs → headers-DWi2IXWx.mjs} +1 -1
- package/dist/help-DofyZuY7.mjs +2 -0
- package/dist/{help-DC7gdz7L.mjs → help-daGKjXGk.mjs} +268 -666
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +305 -1490
- package/dist/info-B97bTX9N.mjs +113 -0
- package/dist/{init-WO0JlPx8.mjs → init-Bvy7zrBo.mjs} +51 -20
- package/dist/limits-Bq5LG8Id.d.mts +27 -0
- package/dist/limits-Cjuk2VPm.mjs +68 -0
- package/dist/{link-CsHOinF7.mjs → link-CDqqCjFl.mjs} +5 -5
- package/dist/{list-CDb-4bZ1.mjs → list-CZj0dzKY.mjs} +5 -5
- package/dist/{live-CKiJilLr.d.mts → live-Chw1eIMv.d.mts} +1 -1
- package/dist/{local-d1-CC8sKFGu.mjs → local-d1-2CMnpuW_.mjs} +2 -2
- package/dist/login-DYt_An22.mjs +2 -0
- package/dist/{login-DvqXsfGs.mjs → login-UZKFM_u7.mjs} +5 -5
- package/dist/{logs-BdfiOezj.mjs → logs-CUZ6t9t3.mjs} +5 -5
- package/dist/migrate-8_2u55MD.mjs +2 -0
- package/dist/{migrate-B8KuoYsO.mjs → migrate-DHul7PRV.mjs} +5 -4
- package/dist/{node-BM43oz4G.mjs → node-BkyRWRx8.mjs} +2 -2
- package/dist/operator-args-CLgKGlwU.mjs +690 -0
- package/dist/{operator-cmd-03819ATr.mjs → operator-cmd-DBA6dl0m.mjs} +69 -23
- package/dist/output-Dm_A4Tbv.mjs +81 -0
- package/dist/pages/client.d.mts +34 -2
- package/dist/pages/client.mjs +59 -3
- package/dist/pages/index.d.mts +1 -1
- package/dist/pages/index.mjs +3 -3
- package/dist/pages/islands-plugin.d.mts +16 -6
- package/dist/pages/islands-plugin.mjs +2 -2
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +2 -308
- package/dist/{parse-filename-DioPHiR9.mjs → parse-filename-CUbj-1MP.mjs} +35 -1
- package/dist/{output-CCH48AMM.mjs → picocolors-BTps1_gs.mjs} +2 -76
- package/dist/plan-D1Q5rf-r.mjs +2 -0
- package/dist/plan-NPpwZ_kc.mjs +58 -0
- package/dist/platform-args-BJdRtlLq.mjs +506 -0
- package/dist/platform-args-D3RXyR6h.mjs +2 -0
- package/dist/{platform-auth-config-z92h63q5.mjs → platform-auth-config-B56E9YP1.mjs} +4 -4
- package/dist/{platform-auth-protection-DeE3yr2R.mjs → platform-auth-protection-BDWO_aER.mjs} +3 -3
- package/dist/{platform-auth-recovery-o_340Ixx.mjs → platform-auth-recovery-1gg4CSRe.mjs} +4 -4
- package/dist/{platform-cmd-C4ZV3Vpy.mjs → platform-cmd-Bt-1w6pY.mjs} +1 -1
- package/dist/{platform-cmd-DNl8WosH.mjs → platform-cmd-DMcQStSc.mjs} +26 -5
- package/dist/{platform-domain-CU1JtJkW.mjs → platform-domain-BNkcz0OB.mjs} +36 -9
- package/dist/{platform-lifecycle-Bc047IeT.mjs → platform-lifecycle-9OyBALhH.mjs} +850 -276
- package/dist/{platform-lifecycle-Bs2qx1E3.mjs → platform-lifecycle-BE6C_jxh.mjs} +1 -1
- package/dist/{platform-management-CVpGI9Y5.mjs → platform-management-CjwLVQwN.mjs} +59 -11
- package/dist/{platform-management-C8tt6D8h.mjs → platform-management-CnyTdcWX.mjs} +1 -1
- package/dist/platform-plans-config-BNGKGr4P.mjs +359 -0
- package/dist/{platform-recovery-dvUaptLr.mjs → platform-recovery-D6KSpuFm.mjs} +2 -2
- package/dist/{plugin-inference-BMfKRSqE.mjs → plugin-inference-CXWnn79A.mjs} +174 -64
- package/dist/{prepare-DyZ-Yok5.mjs → prepare-B5Mkic5u.mjs} +3 -3
- package/dist/{prepare-C3kt3Rst.mjs → prepare-DOsL0CC9.mjs} +4 -20
- package/dist/prepare-cgvDMtSb.mjs +2 -0
- package/dist/{project-cmd-B44I8J_W.mjs → project-cmd-CNzrqvBv.mjs} +30 -16
- package/dist/{project-team-BkbYIsXN.mjs → project-team-DQOWPfQT.mjs} +4 -4
- package/dist/{project-token-C8xEEQnB.mjs → project-token-CTDYU0Cc.mjs} +4 -4
- package/dist/project-zero-trust-BNAkW-_0.mjs +63 -0
- package/dist/{protocol-ZH3jP4a7.d.mts → protocol-CjF_iI9X.d.mts} +2 -2
- package/dist/protocol-U7bfjHmA.mjs +331 -0
- package/dist/{provision-DNtrtaVD.mjs → provision-C4ORE7G7.mjs} +1 -1
- package/dist/{provision-BhreDAOS.mjs → provision-CJFgTZY8.mjs} +111 -215
- package/dist/{requests-DFyhBMaf.mjs → requests-MhxYnau8.mjs} +4 -4
- package/dist/resource-name-C7LVpcRm.mjs +11 -0
- package/dist/{rollback-DHHxXZiS.mjs → rollback-CJ6iSDoU.mjs} +5 -5
- package/dist/route-url-CG7U-cRN.mjs +15 -0
- package/dist/{runner-B8wXwWlo.mjs → runner-CXA9Fh8h.mjs} +1 -1
- package/dist/{runner-p-dMs2UN.mjs → runner-Ol0TNjk6.mjs} +2 -2
- package/dist/runtime/ai.d.mts +12 -8
- package/dist/runtime/ai.mjs +84 -17
- package/dist/runtime/better-auth-mysql.mjs +1 -1
- package/dist/runtime/better-auth-pg.mjs +1 -1
- package/dist/runtime/better-auth.mjs +1 -1
- package/dist/runtime/client-react.mjs +2 -2
- package/dist/runtime/client-solid.mjs +2 -2
- package/dist/runtime/client-svelte.mjs +2 -2
- package/dist/runtime/client-vue.mjs +2 -2
- package/dist/runtime/client.mjs +2 -2
- package/dist/runtime/durable.d.mts +3 -1
- package/dist/runtime/durable.mjs +4 -1
- package/dist/runtime/email/testing.mjs +1 -1
- package/dist/runtime/env-public.d.mts +1 -1
- package/dist/runtime/fetch-stream.mjs +1 -1
- package/dist/runtime/fetch.mjs +1 -1
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/kv.mjs +0 -1
- package/dist/runtime/limits.d.mts +2 -0
- package/dist/runtime/limits.mjs +2 -0
- package/dist/runtime/live-client.d.mts +1 -1
- package/dist/runtime/live-server.mjs +25 -16
- package/dist/runtime/live.d.mts +1 -1
- package/dist/runtime/migration-handler.mjs +62 -42
- package/dist/runtime/route-url.d.mts +4 -0
- package/dist/runtime/route-url.mjs +2 -0
- package/dist/runtime/routing.d.mts +180 -0
- package/dist/runtime/routing.mjs +1082 -0
- package/dist/runtime/sandbox-container.d.mts +3 -0
- package/dist/runtime/sandbox-container.mjs +2 -0
- package/dist/runtime/sandbox.d.mts +4 -32
- package/dist/runtime/sandbox.mjs +151 -75
- package/dist/runtime/sse.mjs +1 -1
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +4 -2
- package/dist/runtime/ws-server.mjs +27 -2
- package/dist/runtime/ws.d.mts +2 -2
- package/dist/runtime/ws.mjs +8 -6
- package/dist/sandbox-XZAqzFlG.d.mts +52 -0
- package/dist/sandbox-container-Bo0eiFKz.d.mts +73 -0
- package/dist/sandbox-container-C6ItmVuN.mjs +281 -0
- package/dist/{scan-4tfN-PSn.mjs → scan-C7okrLyM.mjs} +4 -35
- package/dist/{secret-DN9sSNiV.mjs → secret-Dli5fP0B.mjs} +6 -6
- package/dist/{skills-O6FUaizK.mjs → skills-D1II1Juz.mjs} +1 -1
- package/dist/{sse-BaC1jXko.mjs → sse-CQNaDFFV.mjs} +6 -3
- package/dist/{subcommand-prompt-BuGYkAkC.mjs → subcommand-prompt-CY1C4fvl.mjs} +2 -2
- package/dist/validate-Dq_L3s0S.mjs +2 -0
- package/dist/{validate-CIUwFpjB.mjs → validate-ctOrgiS3.mjs} +2 -1
- package/dist/{wrangler-BymcxrRa.mjs → wrangler-7K-bW_DL.mjs} +14 -235
- package/dist/{ws-BwcqizuH.d.mts → ws-CL1w7GXU.d.mts} +13 -2
- package/package.json +48 -33
- package/sandbox.Dockerfile +4 -0
- package/schema.json +10 -22
- package/skills/migrate-vite-cloudflare-to-void/SKILL.md +34 -157
- package/skills/void/SKILL.md +50 -133
- package/skills/void/docs/guide/ai.md +94 -84
- package/skills/void/docs/guide/app-types.md +3 -32
- package/skills/void/docs/guide/auth.md +12 -116
- package/skills/void/docs/guide/database/d1.md +9 -54
- package/skills/void/docs/guide/database/mysql.md +1 -1
- package/skills/void/docs/guide/database/postgresql.md +5 -26
- package/skills/void/docs/guide/database.md +23 -75
- package/skills/void/docs/guide/deployment.md +27 -113
- package/skills/void/docs/guide/durable-state.md +43 -18
- package/skills/void/docs/guide/edge/headers.md +3 -47
- package/skills/void/docs/guide/edge/prerendering.md +5 -20
- package/skills/void/docs/guide/edge/redirects.md +11 -64
- package/skills/void/docs/guide/edge/revalidation.md +6 -19
- package/skills/void/docs/guide/edge/rewrites.md +56 -284
- package/skills/void/docs/guide/edge/static-assets.md +23 -72
- package/skills/void/docs/guide/email/domains.md +112 -0
- package/skills/void/docs/guide/email/receiving.md +139 -0
- package/skills/void/docs/guide/email/sending.md +231 -0
- package/skills/void/docs/guide/email.md +13 -619
- package/skills/void/docs/guide/env-migration.md +11 -11
- package/skills/void/docs/guide/env-vars.md +9 -29
- package/skills/void/docs/guide/index.md +0 -15
- package/skills/void/docs/guide/jobs.md +3 -18
- package/skills/void/docs/guide/kv.md +5 -11
- package/skills/void/docs/guide/live.md +5 -56
- package/skills/void/docs/guide/pages-routing/actions-and-forms.md +78 -125
- package/skills/void/docs/guide/pages-routing/head.md +10 -10
- package/skills/void/docs/guide/pages-routing/islands.md +6 -36
- package/skills/void/docs/guide/pages-routing/layouts.md +6 -128
- package/skills/void/docs/guide/pages-routing/loaders.md +3 -19
- package/skills/void/docs/guide/pages-routing/markdown.md +13 -171
- package/skills/void/docs/guide/pages-routing/overview.md +7 -17
- package/skills/void/docs/guide/pages-routing/view-transitions.md +1 -1
- package/skills/void/docs/guide/platform/administration/access.md +1 -4
- package/skills/void/docs/guide/platform/administration/email.md +35 -8
- package/skills/void/docs/guide/platform/administration/operations.md +26 -4
- package/skills/void/docs/guide/platform/administration/plans.md +126 -0
- package/skills/void/docs/guide/platform/administration/projects.md +5 -2
- package/skills/void/docs/guide/platform/administration/zero-trust.md +189 -0
- package/skills/void/docs/guide/platform/development/local.md +2 -2
- package/skills/void/docs/guide/platform/development/runtime.md +3 -13
- package/skills/void/docs/guide/platform/development/schema-ci.md +0 -58
- package/skills/void/docs/guide/platform/installation/credentials.md +6 -4
- package/skills/void/docs/guide/platform/installation/domains.md +31 -3
- package/skills/void/docs/guide/platform/installation/first-deployment.md +6 -0
- package/skills/void/docs/guide/platform/installation/maintenance.md +3 -1
- package/skills/void/docs/guide/platform/installation/prerequisites.md +21 -16
- package/skills/void/docs/guide/platform/installation/setup.md +9 -5
- package/skills/void/docs/guide/platform/installation/uninstall.md +17 -2
- package/skills/void/docs/guide/platform-administration.md +2 -0
- package/skills/void/docs/guide/queues.md +7 -9
- package/skills/void/docs/guide/quickstart.md +38 -37
- package/skills/void/docs/guide/remote-dev.md +4 -9
- package/skills/void/docs/guide/sandboxes.md +78 -41
- package/skills/void/docs/guide/server-routing.md +9 -72
- package/skills/void/docs/guide/sse.md +4 -18
- package/skills/void/docs/guide/ssg.md +3 -15
- package/skills/void/docs/guide/ssr.md +14 -62
- package/skills/void/docs/guide/storage.md +9 -4
- package/skills/void/docs/guide/type-safety.md +3 -14
- package/skills/void/docs/guide/typed-fetch.md +3 -7
- package/skills/void/docs/guide/websockets.md +68 -40
- package/skills/void/docs/integrations/agents.md +3 -3
- package/skills/void/docs/integrations/cloudflare.md +85 -316
- package/skills/void/docs/integrations/frameworks/analog.md +5 -64
- package/skills/void/docs/integrations/frameworks/astro.md +4 -73
- package/skills/void/docs/integrations/frameworks/nuxt.md +5 -62
- package/skills/void/docs/integrations/frameworks/overview.md +11 -54
- package/skills/void/docs/integrations/frameworks/react-router.md +5 -60
- package/skills/void/docs/integrations/frameworks/sveltekit.md +6 -65
- package/skills/void/docs/integrations/frameworks/tanstack-start.md +4 -62
- package/skills/void/docs/integrations/nodejs-bun-deno.md +5 -69
- package/skills/void/docs/reference/api/auth.md +156 -0
- package/skills/void/docs/reference/api/client.md +87 -0
- package/skills/void/docs/reference/api/database.md +95 -0
- package/skills/void/docs/reference/api/durable.md +46 -0
- package/skills/void/docs/reference/api/env.md +50 -0
- package/skills/void/docs/reference/api/handlers.md +254 -0
- package/skills/void/docs/reference/api/pages.md +241 -0
- package/skills/void/docs/reference/api/plugin.md +39 -0
- package/skills/void/docs/reference/api/resources.md +109 -0
- package/skills/void/docs/reference/api/rewrites.md +76 -0
- package/skills/void/docs/reference/api/types.md +92 -0
- package/skills/void/docs/reference/api.md +56 -1218
- package/skills/void/docs/reference/cli/auth.md +88 -0
- package/skills/void/docs/reference/cli/database.md +128 -0
- package/skills/void/docs/reference/cli/deploy.md +85 -0
- package/skills/void/docs/reference/cli/domains.md +41 -0
- package/skills/void/docs/reference/cli/email.md +129 -0
- package/skills/void/docs/reference/cli/generate.md +116 -0
- package/skills/void/docs/reference/cli/github.md +189 -0
- package/skills/void/docs/reference/cli/platform-config.md +92 -0
- package/skills/void/docs/reference/cli/platform-email.md +81 -0
- package/skills/void/docs/reference/cli/platform-installation.md +127 -0
- package/skills/void/docs/reference/cli/platform-operations.md +90 -0
- package/skills/void/docs/reference/cli/platform-users.md +89 -0
- package/skills/void/docs/reference/cli/platform-zero-trust.md +45 -0
- package/skills/void/docs/reference/cli/platform.md +70 -0
- package/skills/void/docs/reference/cli/project.md +214 -0
- package/skills/void/docs/reference/cli/secrets.md +76 -0
- package/skills/void/docs/reference/cli/setup.md +70 -0
- package/skills/void/docs/reference/cli.md +33 -1621
- package/skills/void/docs/reference/config.md +26 -32
- package/skills/void/docs/reference/resource-inference.md +3 -58
- package/skills/void/docs/reference/structure.md +14 -41
- package/dist/canonical-json-DuDiiUsQ.mjs +0 -13
- package/dist/cli/cf-compat.mjs +0 -968
- package/dist/client-4cDVv7BO.mjs +0 -2
- package/dist/gen-Vnv2f65C.mjs +0 -2
- package/dist/help-DQMfeKMz.mjs +0 -2
- package/dist/login-DFQk7rbW.mjs +0 -2
- package/dist/migrate-TsHGBnDA.mjs +0 -2
- package/dist/plan-BEZ8VJW0.mjs +0 -256
- package/dist/plan-DpuOr14e.mjs +0 -2
- package/dist/prepare-BZXkjdNe.mjs +0 -2
- package/dist/validate-EKmJWxmy.mjs +0 -2
- /package/dist/cli/{cf-compat.d.mts → cloudflare-operation-process.d.mts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { canonicalJson } from "@void/deploy-core";
|
|
2
2
|
//#region src/runtime/migration-handler.ts
|
|
3
3
|
const SUPPORTED_CLASSIFIER_VERSION = 1;
|
|
4
4
|
function createMigrationHandler(env, migrations, _dialect, runAuthMigrations, planBundle) {
|
|
@@ -85,7 +85,8 @@ async function createTrackingTable(db) {
|
|
|
85
85
|
)`).run();
|
|
86
86
|
}
|
|
87
87
|
async function createAttemptTables(db) {
|
|
88
|
-
await db.batch([
|
|
88
|
+
await db.batch([
|
|
89
|
+
db.prepare(`CREATE TABLE IF NOT EXISTS _void_migration_attempts (
|
|
89
90
|
attempt_id TEXT PRIMARY KEY,
|
|
90
91
|
deployment_id TEXT,
|
|
91
92
|
migration_list_hash TEXT NOT NULL,
|
|
@@ -95,16 +96,23 @@ async function createAttemptTables(db) {
|
|
|
95
96
|
started_at TEXT NOT NULL,
|
|
96
97
|
completed_at TEXT,
|
|
97
98
|
error TEXT
|
|
98
|
-
)`),
|
|
99
|
+
)`),
|
|
100
|
+
db.prepare(`CREATE TABLE IF NOT EXISTS _void_migration_lock (
|
|
99
101
|
name TEXT PRIMARY KEY,
|
|
100
102
|
attempt_id TEXT NOT NULL,
|
|
101
103
|
acquired_at TEXT NOT NULL
|
|
102
|
-
)`)
|
|
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
|
+
]);
|
|
103
110
|
}
|
|
104
|
-
async function upgradeTrackingTable(db) {
|
|
111
|
+
async function upgradeTrackingTable(db, fencedAttemptId) {
|
|
105
112
|
const { results } = await db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='_migrations'").all();
|
|
106
113
|
if (!results || results.length === 0) return;
|
|
107
114
|
await db.batch([
|
|
115
|
+
...ownershipFence(db, fencedAttemptId),
|
|
108
116
|
db.prepare(`CREATE TABLE IF NOT EXISTS _void_migrations (
|
|
109
117
|
name TEXT PRIMARY KEY,
|
|
110
118
|
applied_at TEXT NOT NULL
|
|
@@ -121,18 +129,13 @@ async function runD1AppMigrations(db, migrations, planBundle, attempt) {
|
|
|
121
129
|
const verified = await verifyPlanBundle(migrations, planBundle);
|
|
122
130
|
await createAttemptTables(db);
|
|
123
131
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
124
|
-
const lock = await acquireAttemptLock(db, attempt.attemptId, now);
|
|
125
|
-
if (lock !== "acquired") return lock;
|
|
126
132
|
const plannedNames = migrations.map((migration) => migration.name);
|
|
127
133
|
const planHashes = verified.plans.map((plan) => plan.planHash);
|
|
128
|
-
|
|
129
|
-
|
|
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
|
|
130
136
|
(attempt_id, deployment_id, migration_list_hash, planned_names_json, plan_hashes_json, status, started_at)
|
|
131
|
-
VALUES (?, ?, ?, ?, ?, 'running', ?)`).bind(attempt.attemptId, attempt.deploymentId ?? null, verified.migrationListHash, JSON.stringify(plannedNames), JSON.stringify(planHashes), now).
|
|
132
|
-
|
|
133
|
-
await releaseAttemptLock(db, attempt.attemptId);
|
|
134
|
-
return reconcileAttempt(db, attempt.attemptId);
|
|
135
|
-
}
|
|
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;
|
|
136
139
|
const migrationResults = [];
|
|
137
140
|
const confirmedApplied = [];
|
|
138
141
|
const confirmedSkipped = [];
|
|
@@ -140,7 +143,7 @@ async function runD1AppMigrations(db, migrations, planBundle, attempt) {
|
|
|
140
143
|
let stability = "stable";
|
|
141
144
|
try {
|
|
142
145
|
await createTrackingTable(db);
|
|
143
|
-
await upgradeTrackingTable(db);
|
|
146
|
+
await upgradeTrackingTable(db, fenced ? attempt.attemptId : void 0);
|
|
144
147
|
const applied = await readAppliedSet(db);
|
|
145
148
|
for (let index = 0; index < migrations.length; index++) {
|
|
146
149
|
const migration = migrations[index];
|
|
@@ -159,7 +162,7 @@ async function runD1AppMigrations(db, migrations, planBundle, attempt) {
|
|
|
159
162
|
}
|
|
160
163
|
const start = Date.now();
|
|
161
164
|
try {
|
|
162
|
-
await executeMigrationPlan(db, migration, plan);
|
|
165
|
+
await executeMigrationPlan(db, migration, plan, fenced ? attempt.attemptId : void 0);
|
|
163
166
|
applied.add(migration.name);
|
|
164
167
|
confirmedApplied.push(migration.name);
|
|
165
168
|
migrationResults.push({
|
|
@@ -223,16 +226,16 @@ async function runD1AppMigrations(db, migrations, planBundle, attempt) {
|
|
|
223
226
|
};
|
|
224
227
|
}
|
|
225
228
|
}
|
|
226
|
-
async function acquireAttemptLock(db, attemptId, acquiredAt) {
|
|
229
|
+
async function acquireAttemptLock(db, attemptId, acquiredAt, initialize) {
|
|
227
230
|
for (let tries = 0; tries < 2; tries++) try {
|
|
228
|
-
await db.prepare("INSERT INTO _void_migration_lock (name, attempt_id, acquired_at) VALUES (?, ?, ?)").bind("app", attemptId, acquiredAt)
|
|
231
|
+
await db.batch([db.prepare("INSERT INTO _void_migration_lock (name, attempt_id, acquired_at) VALUES (?, ?, ?)").bind("app", attemptId, acquiredAt), ...initialize]);
|
|
229
232
|
return "acquired";
|
|
230
233
|
} catch {
|
|
231
234
|
const existing = await db.prepare("SELECT attempt_id FROM _void_migration_lock WHERE name = ?").bind("app").first();
|
|
232
|
-
if (existing
|
|
235
|
+
if (!existing && await readAttempt(db, attemptId)) return reconcileAttempt(db, attemptId, false);
|
|
233
236
|
if (existing?.attempt_id) {
|
|
234
237
|
const row = await readAttempt(db, existing.attempt_id);
|
|
235
|
-
if (
|
|
238
|
+
if (row?.status === "completed" || row?.status === "failed") {
|
|
236
239
|
await releaseAttemptLock(db, existing.attempt_id).catch(() => {});
|
|
237
240
|
continue;
|
|
238
241
|
}
|
|
@@ -253,23 +256,41 @@ async function acquireAttemptLock(db, attemptId, acquiredAt) {
|
|
|
253
256
|
error: "migration lock could not be acquired"
|
|
254
257
|
};
|
|
255
258
|
}
|
|
256
|
-
async function executeMigrationPlan(db, migration, plan) {
|
|
259
|
+
async function executeMigrationPlan(db, migration, plan, fencedAttemptId) {
|
|
257
260
|
const appliedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
258
261
|
if (plan.kind === "single-statement") {
|
|
259
|
-
await db.batch([
|
|
262
|
+
await db.batch([
|
|
263
|
+
...ownershipFence(db, fencedAttemptId),
|
|
264
|
+
db.prepare(migration.sql),
|
|
265
|
+
db.prepare("INSERT INTO _void_migrations (name, applied_at) VALUES (?, ?)").bind(migration.name, appliedAt)
|
|
266
|
+
]);
|
|
260
267
|
return;
|
|
261
268
|
}
|
|
262
269
|
if (plan.kind === "breakpoint-framed") {
|
|
263
|
-
await db.batch([
|
|
270
|
+
await db.batch([
|
|
271
|
+
...ownershipFence(db, fencedAttemptId),
|
|
272
|
+
...plan.statements.map((statement) => db.prepare(statement)),
|
|
273
|
+
db.prepare("INSERT INTO _void_migrations (name, applied_at) VALUES (?, ?)").bind(migration.name, appliedAt)
|
|
274
|
+
]);
|
|
264
275
|
return;
|
|
265
276
|
}
|
|
266
277
|
await db.exec(migration.sql);
|
|
267
278
|
await db.prepare("INSERT OR IGNORE INTO _void_migrations (name, applied_at) VALUES (?, ?)").bind(migration.name, appliedAt).run();
|
|
268
279
|
}
|
|
269
|
-
|
|
270
|
-
|
|
280
|
+
/** Fail the whole D1 batch if recovery has revoked this executor's ownership. */
|
|
281
|
+
function ownershipFence(db, attemptId) {
|
|
282
|
+
if (!attemptId) return [];
|
|
283
|
+
return [db.prepare(`INSERT INTO _void_migration_fences (attempt_id, owned)
|
|
284
|
+
VALUES (?, EXISTS(SELECT 1 FROM _void_migration_lock WHERE name = 'app' AND attempt_id = ?))
|
|
285
|
+
ON CONFLICT(attempt_id) DO UPDATE SET owned = excluded.owned`).bind(attemptId, attemptId)];
|
|
286
|
+
}
|
|
287
|
+
function attemptUpdate(db, attemptId, status, error) {
|
|
288
|
+
return db.prepare(`UPDATE _void_migration_attempts
|
|
271
289
|
SET status = ?, completed_at = ?, error = ?
|
|
272
|
-
WHERE attempt_id =
|
|
290
|
+
WHERE attempt_id = ? AND status ${status === "completed" ? "IN ('running', 'unknown')" : "= 'running'"}`).bind(status, (/* @__PURE__ */ new Date()).toISOString(), error ?? null, attemptId);
|
|
291
|
+
}
|
|
292
|
+
async function markAttempt(db, attemptId, status, error) {
|
|
293
|
+
await attemptUpdate(db, attemptId, status, error).run();
|
|
273
294
|
}
|
|
274
295
|
async function releaseAttemptLock(db, attemptId) {
|
|
275
296
|
await db.prepare("DELETE FROM _void_migration_lock WHERE name = ? AND attempt_id = ?").bind("app", attemptId).run();
|
|
@@ -277,27 +298,26 @@ async function releaseAttemptLock(db, attemptId) {
|
|
|
277
298
|
async function readAttempt(db, attemptId) {
|
|
278
299
|
return db.prepare("SELECT * FROM _void_migration_attempts WHERE attempt_id = ?").bind(attemptId).first();
|
|
279
300
|
}
|
|
280
|
-
async function reconcileAttempt(db, attemptId) {
|
|
301
|
+
async function reconcileAttempt(db, attemptId, recover = true) {
|
|
281
302
|
await createAttemptTables(db);
|
|
282
303
|
await createTrackingTable(db);
|
|
283
304
|
const row = await readAttempt(db, attemptId);
|
|
284
|
-
if (!row) {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}
|
|
305
|
+
if (!row) return {
|
|
306
|
+
ok: false,
|
|
307
|
+
protocolVersion: 2,
|
|
308
|
+
attemptId,
|
|
309
|
+
migrations: [],
|
|
310
|
+
error: "migration attempt not found"
|
|
311
|
+
};
|
|
312
|
+
const fenced = await db.prepare("SELECT attempt_id FROM _void_migration_fences WHERE attempt_id = ?").bind(attemptId).first();
|
|
313
|
+
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)]);
|
|
294
314
|
const plannedNames = JSON.parse(row.planned_names_json);
|
|
295
315
|
const applied = await readAppliedSet(db);
|
|
296
316
|
const confirmed = plannedNames.filter((name) => applied.has(name));
|
|
297
317
|
const complete = confirmed.length === plannedNames.length;
|
|
298
318
|
if (complete && row.status !== "completed") await markAttempt(db, attemptId, "completed").catch(() => {});
|
|
299
|
-
|
|
300
|
-
await releaseAttemptLock(db, attemptId)
|
|
319
|
+
const inProgress = !fenced && !complete && (row.status === "running" || row.status === "unknown");
|
|
320
|
+
if (complete || row.status === "completed" || row.status === "failed") await releaseAttemptLock(db, attemptId);
|
|
301
321
|
return {
|
|
302
322
|
ok: complete,
|
|
303
323
|
protocolVersion: 2,
|
|
@@ -310,7 +330,7 @@ async function reconcileAttempt(db, attemptId) {
|
|
|
310
330
|
name,
|
|
311
331
|
status: applied.has(name) ? "skipped" : "failed"
|
|
312
332
|
})),
|
|
313
|
-
error: complete ? void 0 : row.error ?? "migration outcome unknown",
|
|
333
|
+
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",
|
|
314
334
|
stability: "stable"
|
|
315
335
|
};
|
|
316
336
|
}
|
|
@@ -322,7 +342,7 @@ async function verifyPlanBundle(migrations, planBundle) {
|
|
|
322
342
|
const migration = migrations[index];
|
|
323
343
|
const plan = planBundle.plans[index];
|
|
324
344
|
if (plan.name !== migration.name || plan.dialect !== "sqlite" || plan.classifierVersion !== SUPPORTED_CLASSIFIER_VERSION) throw new Error(`invalid migration execution plan for ${migration.name}`);
|
|
325
|
-
const sqlHash = await sha256Hex(canonicalSql(migration.sql));
|
|
345
|
+
const sqlHash = await sha256Hex(canonicalSql$1(migration.sql));
|
|
326
346
|
if (plan.sqlHash !== sqlHash) throw new Error(`migration SQL hash mismatch for ${migration.name}`);
|
|
327
347
|
const planHash = await hashPlan(plan);
|
|
328
348
|
if (plan.planHash !== planHash) throw new Error(`migration plan hash mismatch for ${migration.name}`);
|
|
@@ -335,7 +355,7 @@ async function verifyPlanBundle(migrations, planBundle) {
|
|
|
335
355
|
if (planBundle.migrationListHash !== migrationListHash) throw new Error("migration list hash mismatch");
|
|
336
356
|
return planBundle;
|
|
337
357
|
}
|
|
338
|
-
function canonicalSql(sql) {
|
|
358
|
+
function canonicalSql$1(sql) {
|
|
339
359
|
return (sql.charCodeAt(0) === 65279 ? sql.slice(1) : sql).replace(/\r\n?/g, "\n");
|
|
340
360
|
}
|
|
341
361
|
async function sha256Hex(value) {
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { t as DevCssAsset } from "../types-BAp5AEBU.mjs";
|
|
2
|
+
import { a as handlePageMutation, i as handlePageGet } from "../protocol-CjF_iI9X.mjs";
|
|
3
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
|
+
import { Context, ExecutionContext, Hono, MiddlewareHandler } from "hono";
|
|
5
|
+
//#region src/runtime/routing-errors.d.ts
|
|
6
|
+
type ErrorRendererOptions = {
|
|
7
|
+
dev?: boolean;
|
|
8
|
+
projectRoot: string;
|
|
9
|
+
homeDir: string;
|
|
10
|
+
};
|
|
11
|
+
type ErrorRenderer = {
|
|
12
|
+
createResponse: (request: Request, status: number, title: string, error?: unknown) => Response;
|
|
13
|
+
serveCustomPage: (context: Context, status: number, title: string, error?: unknown) => Promise<Response>;
|
|
14
|
+
onError: (error: Error, context: Context) => Promise<Response> | Response;
|
|
15
|
+
};
|
|
16
|
+
/** Error rendering is shared by generated Pages apps; production never includes exception details. */
|
|
17
|
+
export declare function createErrorRenderer(options: ErrorRendererOptions): ErrorRenderer;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/runtime/routing-worker.d.ts
|
|
20
|
+
type AssetBinding = {
|
|
21
|
+
fetch: (request: Request) => Promise<Response>;
|
|
22
|
+
};
|
|
23
|
+
type RuntimeEnvironment = Record<string, unknown> & {
|
|
24
|
+
ASSETS?: AssetBinding;
|
|
25
|
+
};
|
|
26
|
+
type AssetFallbackOptions = {
|
|
27
|
+
assetsDir?: string;
|
|
28
|
+
serveSpaFallback?: boolean;
|
|
29
|
+
notFound?: "none" | "404-page" | "single-page-application";
|
|
30
|
+
};
|
|
31
|
+
export declare function createAssetFallback(options?: AssetFallbackOptions): (request: Request, env: RuntimeEnvironment, response: Response) => Promise<Response>;
|
|
32
|
+
/** Hide platform capabilities without copying bindings or changing application bindings. */
|
|
33
|
+
export declare function filterInternalBindings<E extends Record<string, unknown>>(env: E, prefixes: Array<string>, exactNames?: Array<string>): E;
|
|
34
|
+
type WorkerFetchOptions = {
|
|
35
|
+
app: {
|
|
36
|
+
fetch: (request: Request, env: RuntimeEnvironment, context: ExecutionContext) => Response | Promise<Response>;
|
|
37
|
+
};
|
|
38
|
+
assets: ReturnType<typeof createAssetFallback>;
|
|
39
|
+
withRawEnv: (env: RuntimeEnvironment, fn: () => Promise<Response>) => Promise<Response>;
|
|
40
|
+
withRuntimeEnv: (env: RuntimeEnvironment, fn: () => Promise<Response>) => Promise<Response>;
|
|
41
|
+
filterBindings: (env: RuntimeEnvironment) => RuntimeEnvironment;
|
|
42
|
+
validateEnv?: (env: RuntimeEnvironment) => Promise<void>;
|
|
43
|
+
/** Authored/generated version metadata binding used to prove the served native version. */
|
|
44
|
+
versionMetadataBinding?: string;
|
|
45
|
+
remoteEnv?: (env: RuntimeEnvironment) => RuntimeEnvironment;
|
|
46
|
+
internalRoute: (request: Request, env: RuntimeEnvironment, ctx: ExecutionContext) => Promise<Response | null>;
|
|
47
|
+
collectPrerenderPaths: (request: Request, env: RuntimeEnvironment, ctx: ExecutionContext) => Promise<Array<string>>;
|
|
48
|
+
emailReceipt?: (request: Request, env: RuntimeEnvironment, ctx: ExecutionContext) => Promise<Response>;
|
|
49
|
+
isr?: {
|
|
50
|
+
deploymentId: string;
|
|
51
|
+
handle: (request: Request, env: RuntimeEnvironment, ctx: ExecutionContext, render: (request: Request) => Promise<Response>) => Promise<Response | null>;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export declare function createWorkerFetch(options: WorkerFetchOptions): (request: Request, env: RuntimeEnvironment, ctx: ExecutionContext) => Promise<Response>;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/runtime/routing-assets.d.ts
|
|
57
|
+
type ClientAssetTags = {
|
|
58
|
+
css: string;
|
|
59
|
+
preloads: string;
|
|
60
|
+
body: string;
|
|
61
|
+
devCss?: Array<DevCssAsset>;
|
|
62
|
+
};
|
|
63
|
+
type ClientManifest = Record<string, {
|
|
64
|
+
file?: string;
|
|
65
|
+
imports?: Array<string>;
|
|
66
|
+
css?: Array<string>;
|
|
67
|
+
/** Build-proven fingerprinted outputs; absent in older/third-party manifests. */
|
|
68
|
+
immutableFiles?: Array<string>;
|
|
69
|
+
}>;
|
|
70
|
+
type ManifestLoader = (request: Request, env: RuntimeEnvironment) => Promise<ClientManifest | null>;
|
|
71
|
+
export declare function createManifestLoader(): ManifestLoader;
|
|
72
|
+
type ClientAssetOptions = {
|
|
73
|
+
entryId: string;
|
|
74
|
+
entryUrl: string;
|
|
75
|
+
extraEntryId?: string;
|
|
76
|
+
extraEntryUrl?: string;
|
|
77
|
+
pageCssKeys?: Record<string, Array<string>>;
|
|
78
|
+
devRootPhases?: Record<string, Array<Array<string>>>;
|
|
79
|
+
kind: "ssr" | "pages" | "islands";
|
|
80
|
+
dev?: boolean;
|
|
81
|
+
reactRefresh?: boolean;
|
|
82
|
+
devCss?: (request: Request, env: RuntimeEnvironment, options: {
|
|
83
|
+
kind: "pages" | "islands";
|
|
84
|
+
componentId: string;
|
|
85
|
+
rootPhases: Array<Array<string>>;
|
|
86
|
+
}) => Promise<unknown>;
|
|
87
|
+
};
|
|
88
|
+
/** Frameworks supply only client entry IDs and active layout/page roots. */
|
|
89
|
+
export declare function createClientAssetTags(options: ClientAssetOptions, loadManifest?: ManifestLoader): (request: Request, env: RuntimeEnvironment, componentId?: string) => Promise<ClientAssetTags>;
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/runtime/routing-pages.d.ts
|
|
92
|
+
type PageGetArguments = Parameters<typeof handlePageGet>;
|
|
93
|
+
type PageModule = {
|
|
94
|
+
loader?: PageGetArguments[0];
|
|
95
|
+
head?: PageGetArguments[1];
|
|
96
|
+
action?: Parameters<typeof handlePageMutation>[0];
|
|
97
|
+
actions?: Record<string, Parameters<typeof handlePageMutation>[0]>;
|
|
98
|
+
};
|
|
99
|
+
type PageRouteOptions = {
|
|
100
|
+
load?: () => Promise<PageModule>;
|
|
101
|
+
head?: PageGetArguments[1];
|
|
102
|
+
componentId: string;
|
|
103
|
+
render: PageGetArguments[4];
|
|
104
|
+
assets: PageGetArguments[5];
|
|
105
|
+
headConfig: PageGetArguments[6] | null;
|
|
106
|
+
renderOptions: PageGetArguments[7];
|
|
107
|
+
namedActions?: boolean;
|
|
108
|
+
};
|
|
109
|
+
export declare function createPageGetHandler(options: PageRouteOptions): (c: Context) => Promise<Response>;
|
|
110
|
+
export declare function createPageMutationHandler(options: PageRouteOptions): (c: Context) => Promise<Response>;
|
|
111
|
+
export declare function createPagesFallback(options: {
|
|
112
|
+
routing: RoutingRuntime;
|
|
113
|
+
errors: ErrorRenderer;
|
|
114
|
+
fallbackRules?: Array<RoutingRule>;
|
|
115
|
+
assetsDir?: string;
|
|
116
|
+
}): (c: Context) => Promise<Response>;
|
|
117
|
+
type SsrModule = {
|
|
118
|
+
render?: (c: Context, assets: ClientAssetTags) => Response | Promise<Response>;
|
|
119
|
+
default?: (c: Context, assets: unknown) => Promise<Response>;
|
|
120
|
+
};
|
|
121
|
+
export declare function createSsrFallback(options: {
|
|
122
|
+
routing: RoutingRuntime;
|
|
123
|
+
nodeTarget?: boolean;
|
|
124
|
+
fallbackRules?: Array<RoutingRule>;
|
|
125
|
+
load: () => Promise<SsrModule>;
|
|
126
|
+
assets: (request: Request, env: Context["env"]) => Promise<ClientAssetTags>;
|
|
127
|
+
assetsDir?: string;
|
|
128
|
+
}): (c: Context) => Promise<Response>;
|
|
129
|
+
export declare function createAssetNotFound(options: {
|
|
130
|
+
routing: RoutingRuntime;
|
|
131
|
+
nodeTarget?: boolean;
|
|
132
|
+
fallbackRules?: Array<RoutingRule>;
|
|
133
|
+
assetsDir?: string;
|
|
134
|
+
}): (c: Context) => Promise<Response>;
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/runtime/routing.d.ts
|
|
137
|
+
export type RoutingRule = {
|
|
138
|
+
source: string;
|
|
139
|
+
destination: string;
|
|
140
|
+
status: number;
|
|
141
|
+
host?: string;
|
|
142
|
+
force?: boolean;
|
|
143
|
+
origin?: string;
|
|
144
|
+
};
|
|
145
|
+
export type RoutingHeaderRule = {
|
|
146
|
+
pattern: string;
|
|
147
|
+
headers: Array<[string, string]>;
|
|
148
|
+
};
|
|
149
|
+
export type RequestContextStore = {
|
|
150
|
+
request: Request;
|
|
151
|
+
executionCtx?: Context["executionCtx"];
|
|
152
|
+
};
|
|
153
|
+
export type RoutingContext = Context & {
|
|
154
|
+
rewrite: (path: string) => Promise<Response>;
|
|
155
|
+
originalUrl: () => URL | null;
|
|
156
|
+
isRewritten: () => boolean;
|
|
157
|
+
};
|
|
158
|
+
export type RoutingRuntime = {
|
|
159
|
+
requestContext: AsyncLocalStorage<RequestContextStore>;
|
|
160
|
+
originalUrls: WeakMap<Request, URL>;
|
|
161
|
+
contextMiddleware: MiddlewareHandler;
|
|
162
|
+
requestMiddleware: MiddlewareHandler;
|
|
163
|
+
routingMiddleware: (rules: Array<RoutingRule>) => MiddlewareHandler;
|
|
164
|
+
headerMiddleware: (rules: Array<RoutingHeaderRule>) => MiddlewareHandler;
|
|
165
|
+
applyFallback: (context: Context, rules: Array<RoutingRule>) => Promise<Response | undefined>;
|
|
166
|
+
markNoMatch: (request: Request, response: Response) => Response;
|
|
167
|
+
};
|
|
168
|
+
/** One state owner per generated app: recursive dispatch shares rewrite and fallback guards. */
|
|
169
|
+
export declare function createRoutingRuntime(app: Hono, options?: {
|
|
170
|
+
dev?: boolean;
|
|
171
|
+
nodeTarget?: boolean;
|
|
172
|
+
managedDispatch?: boolean;
|
|
173
|
+
blockedAssetExtensions?: Array<string>;
|
|
174
|
+
originalUrls?: WeakMap<Request, URL>;
|
|
175
|
+
}): RoutingRuntime;
|
|
176
|
+
export declare const DEFAULT_ASSET_EXTENSIONS: Array<string>;
|
|
177
|
+
export declare function markNoMatch(request: Request, response: Response): Response;
|
|
178
|
+
export declare function createHttpRouteHandler(load: () => Promise<Record<string, (c: Context) => unknown>>, method: string): (c: Context) => Promise<Response>;
|
|
179
|
+
export declare function createModuleLoader<T>(load: () => Promise<T>, cache?: boolean): () => Promise<T>;
|
|
180
|
+
//#endregion
|