void 0.10.5 → 0.10.6
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/dist/agents-Bmr5tFFb.mjs +1454 -0
- package/dist/{auth-cmd-UoCwfDQv.mjs → auth-cmd-DlgNwByu.mjs} +10 -10
- package/dist/{better-auth-shared-D0Mbmx5V.mjs → better-auth-shared-BQooDxbw.mjs} +1 -1
- package/dist/{better-auth-shared-jkksALri.d.mts → better-auth-shared-BvnM9px6.d.mts} +2 -2
- package/dist/{build-cmd-CVyuBHjP.mjs → build-cmd-Br8qL0rA.mjs} +15 -17
- package/dist/{cache-ACORQCIq.mjs → cache-wH-mP8UE.mjs} +10 -12
- package/dist/{cancel-deploy-Gi8zmoZC.mjs → cancel-deploy-BEBOEgtu.mjs} +16 -18
- package/dist/cli/cli.mjs +47 -49
- package/dist/{client-BlbnA92X.mjs → client-Cj96iiBH.mjs} +74 -8
- package/dist/{config-8dLIngKW.mjs → config-1twldYCW.mjs} +10 -10
- package/dist/{config-CbJS4Krx.mjs → config-BdUctCZD.mjs} +4 -4
- package/dist/{create-project-LjvkYziS.mjs → create-project-DD9n8Ho-.mjs} +28 -23
- package/dist/{db-C00yjN01.mjs → db-DjKE2-A-.mjs} +147 -149
- package/dist/{delete-CplfvTgU.mjs → delete-D2kr3Kmk.mjs} +13 -15
- package/dist/{deploy-CISNL5uK.mjs → deploy-C4PbkFyE.mjs} +97 -100
- package/dist/{discover-ZWuBvt22.mjs → discover-BuVVSAum.mjs} +3 -3
- package/dist/{dist-5cGIJHQQ.mjs → dist-BuiRJkTd.mjs} +59 -27
- package/dist/{domain-B4HpcgNG.mjs → domain-_luIsM_B.mjs} +14 -16
- package/dist/{env-DNMJpeVF.mjs → env-CO5XAS9t.mjs} +23 -25
- package/dist/{env-helpers-B_ks681T.d.mts → env-helpers-z4stu8uc.d.mts} +1 -1
- package/dist/{env-types-BS8cZead.mjs → env-types-D51bnR-c.mjs} +3 -3
- package/dist/{env-validation-BxbtBbjh.mjs → env-validation-CeC2FL66.mjs} +4 -4
- package/dist/{fetch-error-C6qffTl2.mjs → fetch-error-Dj3crt0e.mjs} +3 -3
- package/dist/{gen-C0pV2gRQ.mjs → gen-Cf79J4aw.mjs} +42 -44
- package/dist/{github-cmd-CwtLD1yI.mjs → github-cmd-DnqxyOsb.mjs} +88 -90
- package/dist/{handler-B7rCOy21.d.mts → handler-imD0UVDT.d.mts} +4 -5
- package/dist/{headers-BNWymgnH.mjs → headers-BwvFGhkx.mjs} +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +102 -83
- package/dist/{init-D58GxCtt.mjs → init-KirOzVDs.mjs} +132 -134
- package/dist/link-CUmiosyb.mjs +45 -0
- package/dist/{list-CbNNjXTm.mjs → list-3GEw7b6m.mjs} +10 -12
- package/dist/{login-CvxxF_9z.mjs → login-DJReaT_Q.mjs} +14 -15
- package/dist/{logs-BDZ9AuhM.mjs → logs-D-rQ56Lq.mjs} +9 -11
- package/dist/{magic-string.es-C1Fb0uxq.mjs → magic-string.es-ZQjdJFFn.mjs} +3 -3
- package/dist/{mcp-C8BjRt_z.mjs → mcp-D7yc0dXY.mjs} +2 -3
- package/dist/{node-B07cZs0d.mjs → node-yFFk626c.mjs} +6 -6
- package/dist/{package-json-Bg_GJdJB.mjs → package-json-B0NuUWGd.mjs} +1 -1
- package/dist/pages/client.d.mts +1 -1
- package/dist/pages/client.mjs +2 -1
- package/dist/pages/head-client.d.mts +1 -1
- package/dist/pages/head.d.mts +1 -1
- package/dist/pages/index.d.mts +2 -2
- package/dist/pages/index.mjs +5 -5
- package/dist/pages/islands-plugin.d.mts +1 -1
- package/dist/pages/islands-plugin.mjs +3 -3
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +5 -2
- package/dist/{plugin-inference-D04iL1mW.mjs → plugin-inference-CJxi_fWI.mjs} +3 -3
- package/dist/{prepare-DUo9q8cM.mjs → prepare-C_cVurhP.mjs} +15 -18
- package/dist/{preset-D0My64KQ.mjs → preset-CVvwCeIy.mjs} +4 -4
- package/dist/{project-cmd-Dd1gNRdd.mjs → project-cmd-DnU7u9QF.mjs} +13 -14
- package/dist/{project-paths-CCMrHYQm.mjs → project-paths-tpdR1mJR.mjs} +2 -2
- package/dist/{project-tsconfig-DMBV55K2.mjs → project-tsconfig-D9uSVVpA.mjs} +2 -2
- package/dist/{protocol-6UZCowS1.d.mts → protocol-6hTJ04T1.d.mts} +3 -3
- package/dist/{resolve-project-D4O1_fZz.mjs → resolve-project-D2HI3TrG.mjs} +2 -2
- package/dist/{rollback-DzmCCrFg.mjs → rollback-Yh7bCKob.mjs} +21 -23
- package/dist/{route-types-BpSJEW20.mjs → route-types-CfKfhbIg.mjs} +234 -3
- package/dist/{runner-BQyKUqAL.mjs → runner-h272wcPj.mjs} +4 -5
- package/dist/{runner-pg-EuhrFW3D.mjs → runner-pg-waxJOnBb.mjs} +1 -1
- package/dist/runtime/ai.mjs +2 -2
- package/dist/runtime/auth.d.mts +1 -1
- package/dist/runtime/better-auth-pg.d.mts +1 -1
- package/dist/runtime/better-auth-pg.mjs +3 -3
- package/dist/runtime/better-auth.d.mts +1 -1
- package/dist/runtime/better-auth.mjs +2 -2
- package/dist/runtime/client-react.d.mts +2 -2
- package/dist/runtime/client-react.mjs +1 -1
- package/dist/runtime/client-solid.d.mts +2 -2
- package/dist/runtime/client-solid.mjs +1 -1
- package/dist/runtime/client-svelte.d.mts +2 -2
- package/dist/runtime/client-svelte.mjs +1 -1
- package/dist/runtime/client-vue.d.mts +2 -2
- package/dist/runtime/client-vue.mjs +1 -1
- package/dist/runtime/client.d.mts +2 -2
- package/dist/runtime/client.mjs +1 -1
- package/dist/runtime/db-pg.d.mts +1 -1
- package/dist/runtime/env-helpers.d.mts +1 -1
- package/dist/runtime/env-public-client.d.mts +1 -1
- package/dist/runtime/env-public-client.mjs +2 -0
- package/dist/runtime/env-public.d.mts +3 -4
- package/dist/runtime/env-public.mjs +3 -1
- package/dist/runtime/env.mjs +1 -1
- package/dist/runtime/fetch-stream.d.mts +1 -1
- package/dist/runtime/fetch-stream.mjs +1 -1
- package/dist/runtime/fetch.d.mts +1 -1
- package/dist/runtime/fetch.mjs +1 -1
- package/dist/runtime/handler.d.mts +2 -2
- package/dist/runtime/handler.mjs +1 -1
- package/dist/runtime/isr.mjs +1 -1
- package/dist/runtime/live-server.mjs +2 -0
- package/dist/runtime/live.d.mts +2 -2
- package/dist/runtime/live.mjs +3 -1
- package/dist/runtime/migration-handler-pg.mjs +1 -1
- package/dist/runtime/migration-handler.mjs +1 -1
- package/dist/runtime/remote/index.mjs +11 -1
- package/dist/runtime/sandbox.d.mts +1 -4
- package/dist/runtime/sandbox.mjs +1 -1
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +2 -2
- package/dist/runtime/ws-server.mjs +2 -0
- package/dist/runtime/ws.d.mts +3 -3
- package/dist/runtime/ws.mjs +2 -0
- package/dist/{scan-VCAM1oh3.mjs → scan-Dp_Gyzs3.mjs} +3 -3
- package/dist/{scan---8wfN58.mjs → scan-i7Yz54fv.mjs} +26 -8
- package/dist/{secret-CMLYWkE-.mjs → secret-u7FRvg8d.mjs} +22 -24
- package/dist/{skills-Dl3u05da.mjs → skills-DsdNDtX3.mjs} +6 -7
- package/dist/{subcommand-prompt-B8ng0FTS.mjs → subcommand-prompt-DtES-oP6.mjs} +34 -35
- package/dist/sveltekit.mjs +1 -1
- package/dist/validate-DT7nFMlf.mjs +504 -0
- package/dist/{yarn-pnp-WLW2IHUY.mjs → yarn-pnp-CW8LB6g_.mjs} +1 -1
- package/package.json +19 -19
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/CHANGELOG.md +94 -0
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/README.md +32 -11
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/sandbox/README.md +45 -0
- package/skills/void/docs/node_modules/void/node_modules/@electric-sql/pglite/README.md +5 -5
- package/skills/void/docs/node_modules/void/node_modules/@types/node/README.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@types/node/README.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-exit/README.md +4 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-attrs/README.md +29 -12
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tinyglobby/README.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/AGENTS.md +1 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/README.md +18 -6
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/build.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/check.md +35 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/create.md +70 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/fmt.md +3 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/index.md +11 -7
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/lint.md +3 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/pack.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/run.md +141 -26
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/staged.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/test.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/automatic-data-tracking.md +145 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/cache.md +16 -28
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/check.md +16 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/ci.md +15 -17
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/commit-hooks.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/create.md +255 -2
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/docker.md +175 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/env.md +70 -5
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/github-actions-cache.md +165 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/ide-integration.md +2 -2
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/index.md +9 -3
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/install.md +63 -11
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/migrate-rules.md +347 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/migrate.md +27 -3
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/monorepo.md +176 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/pack.md +8 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/run.md +36 -4
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/troubleshooting.md +11 -35
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/upgrade.md +65 -13
- package/skills/void/docs/node_modules/void/node_modules/es-module-lexer/README.md +403 -390
- package/skills/void/docs/node_modules/void/node_modules/pg/README.md +2 -1
- package/skills/void/docs/node_modules/void/node_modules/tinyglobby/README.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/AGENTS.md +1 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/README.md +18 -6
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/build.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/check.md +35 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/create.md +70 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/fmt.md +3 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/index.md +11 -7
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/lint.md +3 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/pack.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/run.md +141 -26
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/staged.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/test.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/automatic-data-tracking.md +145 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/cache.md +16 -28
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/check.md +16 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/ci.md +15 -17
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/commit-hooks.md +9 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/create.md +255 -2
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/docker.md +175 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/env.md +70 -5
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/github-actions-cache.md +165 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/ide-integration.md +2 -2
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/index.md +9 -3
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/install.md +63 -11
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/migrate-rules.md +347 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/migrate.md +27 -3
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/monorepo.md +176 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/pack.md +8 -0
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/run.md +36 -4
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/troubleshooting.md +11 -35
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/upgrade.md +65 -13
- package/skills/void/docs/reference/cli.md +5 -1
- package/dist/agents-MhSzNMiC.mjs +0 -151
- package/dist/collect-9rO3JFNM.mjs +0 -55
- package/dist/config-hhMYPVRT.mjs +0 -21
- package/dist/dist-abzUneor.mjs +0 -1287
- package/dist/drizzle-DqstQTGq.mjs +0 -232
- package/dist/link-ZFmboqY3.mjs +0 -47
- package/dist/output-DeiS4oEX.mjs +0 -139
- package/dist/plan-aD3wRDqF.mjs +0 -271
- package/dist/project-CH9pdo16.mjs +0 -72
- package/dist/project-slug-rX3kTOfY.mjs +0 -10
- package/dist/validate-CNWm-PsL.mjs +0 -186
- /package/dist/{auth-migrations-BP-hMzYl.mjs → auth-migrations-BTZ-ATvQ.mjs} +0 -0
- /package/dist/{auth-Dz2CCn4T.d.mts → auth-qgMlYp7Z.d.mts} +0 -0
- /package/dist/{canonical-json-CEyQaVDa.mjs → canonical-json-DuDiiUsQ.mjs} +0 -0
- /package/dist/{cf-access-DKDsgwOU.mjs → cf-access-Bqw81xAf.mjs} +0 -0
- /package/dist/{defer-C-bdSM_b.mjs → defer-YsYDUoii.mjs} +0 -0
- /package/dist/{dotenv-lS94ymhM.mjs → dotenv-D_UbC_vc.mjs} +0 -0
- /package/dist/{env-raw-Dtj1UAoK.mjs → env-raw-CoS20LHP.mjs} +0 -0
- /package/dist/{fetch-error-B6RaJ-eZ.d.mts → fetch-error-Sp1R4mZv.d.mts} +0 -0
- /package/dist/{git-metadata-Ce0AtSZL.mjs → git-metadata-CBKaL0v5.mjs} +0 -0
- /package/dist/{head-eOUCWUNy.d.mts → head-nmvOgFjd.d.mts} +0 -0
- /package/dist/{log-BdD_Fpms.mjs → log-ChfPKsVd.mjs} +0 -0
- /package/dist/{pathe.M-eThtNZ-BrPhGF_K.mjs → pathe.M-eThtNZ-CQzLbt4c.mjs} +0 -0
- /package/dist/{pg-CempqvEJ.mjs → pg-J2HbZIkX.mjs} +0 -0
- /package/dist/{providers-BJIoduK9.d.mts → providers-BNKRacMr.d.mts} +0 -0
- /package/dist/{providers-BwPbdHdi.mjs → providers-CJlNS3kT.mjs} +0 -0
- /package/dist/{proxy-M3pxItg2.mjs → proxy-D-3_D-Gl.mjs} +0 -0
- /package/dist/{chunk-DJd-R1mw.mjs → rolldown-runtime-DJK8HYOj.mjs} +0 -0
- /package/dist/{standard-schema-Cy0lfeWv.d.mts → standard-schema-DJ0HW7QP.d.mts} +0 -0
- /package/dist/{types-BodZGegX.d.mts → types-lLjNE9Qp.d.mts} +0 -0
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { a as isVoidSocialAuthProvider } from "./providers-BwPbdHdi.mjs";
|
|
2
|
-
import { getAuthTables, getSchema } from "better-auth/db";
|
|
3
|
-
//#region src/auth/drizzle.ts
|
|
4
|
-
const DEFAULT_TABLE_ORDER = Number.MAX_SAFE_INTEGER;
|
|
5
|
-
function resolveEmailAndPassword(configuredProviders) {
|
|
6
|
-
if (!configuredProviders || configuredProviders.includes("email")) return { enabled: true };
|
|
7
|
-
}
|
|
8
|
-
function resolvePlaceholderSocialProviders(configuredProviders) {
|
|
9
|
-
if (!configuredProviders) return;
|
|
10
|
-
const providers = {};
|
|
11
|
-
for (const provider of configuredProviders) {
|
|
12
|
-
if (!isVoidSocialAuthProvider(provider)) continue;
|
|
13
|
-
providers[provider] = {
|
|
14
|
-
clientId: `void-${provider}-client-id`,
|
|
15
|
-
clientSecret: `void-${provider}-client-secret`
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
return Object.keys(providers).length > 0 ? providers : void 0;
|
|
19
|
-
}
|
|
20
|
-
function resolveSchemaUserConfig(userConfig, defaults, dialect, env) {
|
|
21
|
-
if (!userConfig) return defaults;
|
|
22
|
-
if (typeof userConfig === "function") return userConfig({
|
|
23
|
-
defaults,
|
|
24
|
-
request: new Request("http://localhost/api/auth"),
|
|
25
|
-
env,
|
|
26
|
-
dialect
|
|
27
|
-
});
|
|
28
|
-
return {
|
|
29
|
-
...defaults,
|
|
30
|
-
...userConfig
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function resolveSchemaOptions(runtime, env) {
|
|
34
|
-
const origin = "http://localhost";
|
|
35
|
-
const emailAndPassword = resolveEmailAndPassword(runtime.providers);
|
|
36
|
-
const socialProviders = resolvePlaceholderSocialProviders(runtime.providers);
|
|
37
|
-
const defaults = {
|
|
38
|
-
baseURL: origin,
|
|
39
|
-
basePath: "/api/auth",
|
|
40
|
-
secret: "void-build-better-auth-secret",
|
|
41
|
-
database: {},
|
|
42
|
-
trustedOrigins: [origin],
|
|
43
|
-
...emailAndPassword ? { emailAndPassword } : {},
|
|
44
|
-
...socialProviders ? { socialProviders } : {}
|
|
45
|
-
};
|
|
46
|
-
return resolveSchemaUserConfig(runtime.userConfig, defaults, runtime.dialect, env);
|
|
47
|
-
}
|
|
48
|
-
function resolveIdStrategy(options) {
|
|
49
|
-
const generateId = options.advanced?.database?.generateId;
|
|
50
|
-
if (generateId === "serial") return "serial";
|
|
51
|
-
if (generateId === "uuid") return "uuid";
|
|
52
|
-
return "text";
|
|
53
|
-
}
|
|
54
|
-
function sanitizeIdentifier(name) {
|
|
55
|
-
const value = name.replace(/[^A-Za-z0-9_$]/g, "_");
|
|
56
|
-
return /^[A-Za-z_$]/.test(value) ? value : `_${value}`;
|
|
57
|
-
}
|
|
58
|
-
function isJsonField(field) {
|
|
59
|
-
return field.type === "json" || field.type === "string[]" || field.type === "number[]";
|
|
60
|
-
}
|
|
61
|
-
function renderEnumValues(values) {
|
|
62
|
-
return `[${values.map((value) => JSON.stringify(value)).join(", ")}] as const`;
|
|
63
|
-
}
|
|
64
|
-
function resolveFieldName(defaultFieldName, field) {
|
|
65
|
-
return field.fieldName ?? defaultFieldName;
|
|
66
|
-
}
|
|
67
|
-
function resolveReferenceFieldName(schema, model, field) {
|
|
68
|
-
if (field === "id") return "id";
|
|
69
|
-
const referencedField = schema[model]?.fields[field];
|
|
70
|
-
return referencedField ? resolveFieldName(field, referencedField) : field;
|
|
71
|
-
}
|
|
72
|
-
function createColumnBuilder(dialect, idStrategy, fieldName, field) {
|
|
73
|
-
const useIdType = fieldName === "id" || field.references?.field === "id";
|
|
74
|
-
if (dialect === "postgresql") {
|
|
75
|
-
if (useIdType) {
|
|
76
|
-
if (idStrategy === "serial") return `integer(${JSON.stringify(fieldName)})`;
|
|
77
|
-
if (idStrategy === "uuid") return `uuid(${JSON.stringify(fieldName)})`;
|
|
78
|
-
return `text(${JSON.stringify(fieldName)})`;
|
|
79
|
-
}
|
|
80
|
-
if (Array.isArray(field.type)) return `text(${JSON.stringify(fieldName)}, { enum: ${renderEnumValues(field.type)} })`;
|
|
81
|
-
if (isJsonField(field)) return `jsonb(${JSON.stringify(fieldName)})`;
|
|
82
|
-
switch (field.type) {
|
|
83
|
-
case "boolean": return `boolean(${JSON.stringify(fieldName)})`;
|
|
84
|
-
case "date": return `timestamp(${JSON.stringify(fieldName)}, { mode: "date", withTimezone: true })`;
|
|
85
|
-
case "number": return field.bigint ? `bigint(${JSON.stringify(fieldName)}, { mode: "number" })` : `integer(${JSON.stringify(fieldName)})`;
|
|
86
|
-
case "string": return `text(${JSON.stringify(fieldName)})`;
|
|
87
|
-
default: return `text(${JSON.stringify(fieldName)})`;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (useIdType) {
|
|
91
|
-
if (idStrategy === "serial") return `integer(${JSON.stringify(fieldName)})`;
|
|
92
|
-
return `text(${JSON.stringify(fieldName)})`;
|
|
93
|
-
}
|
|
94
|
-
if (Array.isArray(field.type)) return `text(${JSON.stringify(fieldName)}, { enum: ${renderEnumValues(field.type)} })`;
|
|
95
|
-
if (isJsonField(field)) return `text(${JSON.stringify(fieldName)}, { mode: "json" })`;
|
|
96
|
-
switch (field.type) {
|
|
97
|
-
case "boolean": return `integer(${JSON.stringify(fieldName)}, { mode: "boolean" })`;
|
|
98
|
-
case "date": return `integer(${JSON.stringify(fieldName)}, { mode: "timestamp_ms" })`;
|
|
99
|
-
case "number": return `integer(${JSON.stringify(fieldName)})`;
|
|
100
|
-
case "string": return `text(${JSON.stringify(fieldName)})`;
|
|
101
|
-
default: return `text(${JSON.stringify(fieldName)})`;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
function createColumnDefinition(dialect, schema, idStrategy, defaultToVariable, defaultFieldName, field) {
|
|
105
|
-
const actualFieldName = resolveFieldName(defaultFieldName, field);
|
|
106
|
-
const parts = [createColumnBuilder(dialect, idStrategy, actualFieldName, field)];
|
|
107
|
-
if (actualFieldName === "id") parts.push(".primaryKey()");
|
|
108
|
-
if (field.required !== false || actualFieldName === "id") parts.push(".notNull()");
|
|
109
|
-
if (field.references) {
|
|
110
|
-
const referenceModel = Object.entries(schema).find(([_, value]) => value.modelName === field.references?.model)?.[0] ?? field.references.model;
|
|
111
|
-
const referenceVariable = defaultToVariable.get(referenceModel);
|
|
112
|
-
if (referenceVariable) {
|
|
113
|
-
const referenceFieldName = resolveReferenceFieldName(schema, referenceModel, field.references.field);
|
|
114
|
-
parts.push(`.references(() => ${referenceVariable}[${JSON.stringify(referenceFieldName)}], { onDelete: ${JSON.stringify(field.references.onDelete ?? "cascade")} })`);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (field.unique && actualFieldName !== "id") parts.push(".unique()");
|
|
118
|
-
return parts.join("");
|
|
119
|
-
}
|
|
120
|
-
function collectCoreImports(dialect, schema, idStrategy) {
|
|
121
|
-
const imports = new Set([dialect === "postgresql" ? "pgTable" : "sqliteTable", "text"]);
|
|
122
|
-
if (idStrategy === "serial") imports.add("integer");
|
|
123
|
-
if (idStrategy === "uuid" && dialect === "postgresql") imports.add("uuid");
|
|
124
|
-
for (const [, table] of Object.entries(schema)) for (const [defaultFieldName, field] of Object.entries(table.fields)) {
|
|
125
|
-
if (resolveFieldName(defaultFieldName, field) === "id" || field.references?.field === "id") {
|
|
126
|
-
if (idStrategy === "serial") imports.add("integer");
|
|
127
|
-
if (idStrategy === "uuid" && dialect === "postgresql") imports.add("uuid");
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
if (field.index) imports.add("index");
|
|
131
|
-
if (Array.isArray(field.type) || field.type === "string") {
|
|
132
|
-
imports.add("text");
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
if (isJsonField(field)) {
|
|
136
|
-
imports.add(dialect === "postgresql" ? "jsonb" : "text");
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
if (field.type === "boolean") {
|
|
140
|
-
imports.add(dialect === "postgresql" ? "boolean" : "integer");
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
if (field.type === "date") {
|
|
144
|
-
imports.add(dialect === "postgresql" ? "timestamp" : "integer");
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
if (field.type === "number") {
|
|
148
|
-
imports.add("integer");
|
|
149
|
-
if (field.bigint && dialect === "postgresql") imports.add("bigint");
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return [...imports].sort();
|
|
153
|
-
}
|
|
154
|
-
function generateVoidAuthDrizzleSchema(runtime, env = {}) {
|
|
155
|
-
const options = resolveSchemaOptions(runtime, env);
|
|
156
|
-
const schema = getAuthTables(options);
|
|
157
|
-
const migrationSchema = resolveVoidAuthMigrationSchema(runtime, env);
|
|
158
|
-
const idStrategy = resolveIdStrategy(options);
|
|
159
|
-
const defaultToVariable = /* @__PURE__ */ new Map();
|
|
160
|
-
const entries = Object.entries(schema).sort(([, left], [, right]) => (left.order ?? DEFAULT_TABLE_ORDER) - (right.order ?? DEFAULT_TABLE_ORDER));
|
|
161
|
-
for (const [defaultModelName] of entries) defaultToVariable.set(defaultModelName, `${sanitizeIdentifier(defaultModelName)}Table`);
|
|
162
|
-
const tableFactory = runtime.dialect === "postgresql" ? "pgTable" : "sqliteTable";
|
|
163
|
-
const importPath = runtime.dialect === "postgresql" ? "void/schema-pg" : "void/schema-d1";
|
|
164
|
-
const lines = [
|
|
165
|
-
"// Auto-generated by void — do not edit",
|
|
166
|
-
`import { ${collectCoreImports(runtime.dialect, schema, idStrategy).join(", ")} } from ${JSON.stringify(importPath)};`,
|
|
167
|
-
""
|
|
168
|
-
];
|
|
169
|
-
for (const [defaultModelName, table] of entries) {
|
|
170
|
-
const variableName = defaultToVariable.get(defaultModelName);
|
|
171
|
-
const fieldEntries = Object.entries(table.fields);
|
|
172
|
-
const renderedFields = [` "id": ${createColumnDefinition(runtime.dialect, schema, idStrategy, defaultToVariable, "id", {
|
|
173
|
-
type: idStrategy === "serial" ? "number" : "string",
|
|
174
|
-
required: true
|
|
175
|
-
})},`, ...fieldEntries.map(([defaultFieldName, field]) => {
|
|
176
|
-
const actualFieldName = resolveFieldName(defaultFieldName, field);
|
|
177
|
-
return ` ${JSON.stringify(actualFieldName)}: ${createColumnDefinition(runtime.dialect, schema, idStrategy, defaultToVariable, defaultFieldName, field)},`;
|
|
178
|
-
})];
|
|
179
|
-
const indexedFields = fieldEntries.filter(([, field]) => field.index && !field.unique);
|
|
180
|
-
if (indexedFields.length > 0) lines.push(`export const ${variableName} = ${tableFactory}(${JSON.stringify(table.modelName)}, {`, ...renderedFields, `}, (table) => [`, ...indexedFields.map(([defaultFieldName, field]) => {
|
|
181
|
-
const actualFieldName = resolveFieldName(defaultFieldName, field);
|
|
182
|
-
return ` index(${JSON.stringify(`${table.modelName}_${actualFieldName}_idx`)}).on(table[${JSON.stringify(actualFieldName)}]),`;
|
|
183
|
-
}), `]);`);
|
|
184
|
-
else lines.push(`export const ${variableName} = ${tableFactory}(${JSON.stringify(table.modelName)}, {`, ...renderedFields, `});`);
|
|
185
|
-
lines.push("");
|
|
186
|
-
}
|
|
187
|
-
lines.push("export const schema = {");
|
|
188
|
-
for (const [defaultModelName] of entries) lines.push(` ${JSON.stringify(defaultModelName)}: ${defaultToVariable.get(defaultModelName)},`);
|
|
189
|
-
lines.push("} as const;");
|
|
190
|
-
lines.push(`export const migrationSchema = ${JSON.stringify(migrationSchema, null, 2)} as const;`);
|
|
191
|
-
lines.push("");
|
|
192
|
-
return lines.join("\n") + "\n";
|
|
193
|
-
}
|
|
194
|
-
function resolveVoidAuthMigrationSchema(runtime, env = {}) {
|
|
195
|
-
const options = resolveSchemaOptions(runtime, env);
|
|
196
|
-
const schema = getSchema(options);
|
|
197
|
-
return {
|
|
198
|
-
dialect: runtime.dialect,
|
|
199
|
-
idStrategy: resolveIdStrategy(options),
|
|
200
|
-
tables: Object.entries(schema).sort(([, left], [, right]) => (left.order ?? DEFAULT_TABLE_ORDER) - (right.order ?? DEFAULT_TABLE_ORDER)).map(([name, table]) => ({
|
|
201
|
-
name,
|
|
202
|
-
order: table.order ?? DEFAULT_TABLE_ORDER,
|
|
203
|
-
fields: Object.fromEntries(Object.entries(table.fields).map(([fieldName, field]) => [fieldName, {
|
|
204
|
-
type: field.type,
|
|
205
|
-
required: field.required !== false,
|
|
206
|
-
unique: field.unique === true,
|
|
207
|
-
index: field.index === true,
|
|
208
|
-
bigint: field.bigint === true,
|
|
209
|
-
...field.references ? { references: {
|
|
210
|
-
table: field.references.model,
|
|
211
|
-
field: field.references.field,
|
|
212
|
-
...field.references.onDelete ? { onDelete: field.references.onDelete } : {}
|
|
213
|
-
} } : {}
|
|
214
|
-
}]))
|
|
215
|
-
}))
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
function generateVoidAuthDatabaseModule(options) {
|
|
219
|
-
const schemaImport = JSON.stringify(options.schemaImportPath);
|
|
220
|
-
const provider = options.dialect === "postgresql" ? "pg" : "sqlite";
|
|
221
|
-
return [
|
|
222
|
-
"// Auto-generated by void — do not edit",
|
|
223
|
-
`import { drizzleAdapter } from ${JSON.stringify(options.drizzleAdapterPath)};`,
|
|
224
|
-
`import { db as __voidDb } from "void/db";`,
|
|
225
|
-
`import { schema as __voidAuthSchema } from ${schemaImport};`,
|
|
226
|
-
"",
|
|
227
|
-
`export const __voidAuthDatabase = drizzleAdapter(__voidDb, { provider: ${JSON.stringify(provider)}, schema: __voidAuthSchema });`,
|
|
228
|
-
""
|
|
229
|
-
].join("\n");
|
|
230
|
-
}
|
|
231
|
-
//#endregion
|
|
232
|
-
export { generateVoidAuthDrizzleSchema as n, resolveVoidAuthMigrationSchema as r, generateVoidAuthDatabaseModule as t };
|
package/dist/link-ZFmboqY3.mjs
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { n as cliTitle, s as import_picocolors } from "./output-DeiS4oEX.mjs";
|
|
2
|
-
import { d as getSiteDomain, f as getToken, n as PlatformClient } from "./client-BlbnA92X.mjs";
|
|
3
|
-
import { _ as me, c as R, g as ge, y as ye } from "./dist-abzUneor.mjs";
|
|
4
|
-
import { a as writeProjectConfig, r as readProjectConfig } from "./project-CH9pdo16.mjs";
|
|
5
|
-
import { n as promptAndCreateProject, r as promptProjectSelection } from "./create-project-LjvkYziS.mjs";
|
|
6
|
-
import { r as resolveProjectBySlug } from "./resolve-project-D4O1_fZz.mjs";
|
|
7
|
-
//#region src/cli/link.ts
|
|
8
|
-
async function runLink(root, slug) {
|
|
9
|
-
console.log();
|
|
10
|
-
ge(cliTitle("project link"));
|
|
11
|
-
const existing = readProjectConfig(root);
|
|
12
|
-
if (existing) {
|
|
13
|
-
R.warn(`Already linked to ${import_picocolors.default.blue(existing.slug)}.${getSiteDomain(root)}`);
|
|
14
|
-
ye("To re-link, delete .void/project.json and run again.");
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const token = getToken(root);
|
|
18
|
-
if (!token) {
|
|
19
|
-
me("No auth token found. Run `void auth login` first.");
|
|
20
|
-
process.exit(1);
|
|
21
|
-
}
|
|
22
|
-
const client = new PlatformClient(token, { root });
|
|
23
|
-
const projects = await client.listProjects();
|
|
24
|
-
if (slug) {
|
|
25
|
-
const config = resolveProjectBySlug(projects, slug);
|
|
26
|
-
if (!config) {
|
|
27
|
-
me(`project: No project found with slug '${slug}'.`);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
writeProjectConfig(root, config);
|
|
31
|
-
ye(`Linked to ${import_picocolors.default.blue(config.slug)}.${getSiteDomain(root)}`);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const result = await promptProjectSelection(projects, "Select a project:", root, { confirmExisting: true });
|
|
35
|
-
if (result.action === "create") {
|
|
36
|
-
const config = await promptAndCreateProject(root, client);
|
|
37
|
-
ye(`Created and linked to ${import_picocolors.default.blue(config.slug)}.${getSiteDomain(root)}`);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
writeProjectConfig(root, {
|
|
41
|
-
projectId: result.project.id,
|
|
42
|
-
slug: result.project.slug
|
|
43
|
-
});
|
|
44
|
-
ye(`Linked to ${import_picocolors.default.blue(result.project.slug)}.${getSiteDomain(root)}`);
|
|
45
|
-
}
|
|
46
|
-
//#endregion
|
|
47
|
-
export { runLink };
|
package/dist/output-DeiS4oEX.mjs
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { r as __toESM, t as __commonJSMin } from "./chunk-DJd-R1mw.mjs";
|
|
2
|
-
import { c as R, f as at, h as ft } from "./dist-abzUneor.mjs";
|
|
3
|
-
//#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
4
|
-
var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5
|
-
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
6
|
-
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
7
|
-
let formatter = (open, close, replace = open) => (input) => {
|
|
8
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
9
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
10
|
-
};
|
|
11
|
-
let replaceClose = (string, close, replace, index) => {
|
|
12
|
-
let result = "", cursor = 0;
|
|
13
|
-
do {
|
|
14
|
-
result += string.substring(cursor, index) + replace;
|
|
15
|
-
cursor = index + close.length;
|
|
16
|
-
index = string.indexOf(close, cursor);
|
|
17
|
-
} while (~index);
|
|
18
|
-
return result + string.substring(cursor);
|
|
19
|
-
};
|
|
20
|
-
let createColors = (enabled = isColorSupported) => {
|
|
21
|
-
let f = enabled ? formatter : () => String;
|
|
22
|
-
return {
|
|
23
|
-
isColorSupported: enabled,
|
|
24
|
-
reset: f("\x1B[0m", "\x1B[0m"),
|
|
25
|
-
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
26
|
-
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
27
|
-
italic: f("\x1B[3m", "\x1B[23m"),
|
|
28
|
-
underline: f("\x1B[4m", "\x1B[24m"),
|
|
29
|
-
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
30
|
-
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
31
|
-
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
32
|
-
black: f("\x1B[30m", "\x1B[39m"),
|
|
33
|
-
red: f("\x1B[31m", "\x1B[39m"),
|
|
34
|
-
green: f("\x1B[32m", "\x1B[39m"),
|
|
35
|
-
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
36
|
-
blue: f("\x1B[34m", "\x1B[39m"),
|
|
37
|
-
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
38
|
-
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
39
|
-
white: f("\x1B[37m", "\x1B[39m"),
|
|
40
|
-
gray: f("\x1B[90m", "\x1B[39m"),
|
|
41
|
-
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
42
|
-
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
43
|
-
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
44
|
-
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
45
|
-
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
46
|
-
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
47
|
-
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
48
|
-
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
49
|
-
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
50
|
-
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
51
|
-
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
52
|
-
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
53
|
-
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
54
|
-
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
55
|
-
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
56
|
-
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
57
|
-
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
58
|
-
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
59
|
-
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
60
|
-
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
61
|
-
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
62
|
-
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
63
|
-
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
64
|
-
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
module.exports = createColors();
|
|
68
|
-
module.exports.createColors = createColors;
|
|
69
|
-
}));
|
|
70
|
-
//#endregion
|
|
71
|
-
//#region src/cli/output.ts
|
|
72
|
-
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
73
|
-
/**
|
|
74
|
-
* CI-safe spinner wrapper. In CI environments (GitHub Actions, etc.),
|
|
75
|
-
* `@clack/prompts` spinner emits DEC Private Mode cursor hide/show codes
|
|
76
|
-
* (`\x1b[?25l` / `\x1b[?25h`) that render as text artifacts. This wrapper
|
|
77
|
-
* replaces the spinner with plain log output in CI.
|
|
78
|
-
*/
|
|
79
|
-
function createSpinner() {
|
|
80
|
-
if (!at()) return ft();
|
|
81
|
-
let currentMessage = "";
|
|
82
|
-
return {
|
|
83
|
-
start(msg = "") {
|
|
84
|
-
currentMessage = msg;
|
|
85
|
-
if (msg) R.step(msg);
|
|
86
|
-
},
|
|
87
|
-
stop(msg = "") {
|
|
88
|
-
if (msg) R.info(msg);
|
|
89
|
-
},
|
|
90
|
-
message(msg = "") {
|
|
91
|
-
if (msg && msg !== currentMessage) {
|
|
92
|
-
currentMessage = msg;
|
|
93
|
-
R.step(msg);
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
cancel(msg = "") {
|
|
97
|
-
if (msg) R.warn(msg);
|
|
98
|
-
},
|
|
99
|
-
error(msg = "") {
|
|
100
|
-
if (msg) R.error(msg);
|
|
101
|
-
},
|
|
102
|
-
clear() {},
|
|
103
|
-
get isCancelled() {
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
function cliTitle(command) {
|
|
109
|
-
return import_picocolors.default.blue(`void ${command}`);
|
|
110
|
-
}
|
|
111
|
-
function sectionTitle(title) {
|
|
112
|
-
return import_picocolors.default.reset(import_picocolors.default.blue(title));
|
|
113
|
-
}
|
|
114
|
-
function categoryTitle(title) {
|
|
115
|
-
return import_picocolors.default.reset(import_picocolors.default.bold(import_picocolors.default.cyan(title)));
|
|
116
|
-
}
|
|
117
|
-
function dim(text) {
|
|
118
|
-
return import_picocolors.default.dim(text);
|
|
119
|
-
}
|
|
120
|
-
function tablePrefix() {
|
|
121
|
-
return `${import_picocolors.default.gray("│")} `;
|
|
122
|
-
}
|
|
123
|
-
function helpLine(command, description) {
|
|
124
|
-
return `${import_picocolors.default.reset(command.padEnd(34))} ${import_picocolors.default.dim(description)}`;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Ensure a timestamp string will be parsed as UTC by `new Date()`.
|
|
128
|
-
* DB timestamps lack timezone info — appends 'Z' only when no
|
|
129
|
-
* existing indicator (Z, z, or numeric offset) is present.
|
|
130
|
-
*/
|
|
131
|
-
function ensureUtc(s) {
|
|
132
|
-
const last = s.at(-1);
|
|
133
|
-
if (last === "Z" || last === "z") return s;
|
|
134
|
-
if (s.includes("+", 10)) return s;
|
|
135
|
-
if (s.lastIndexOf("-") > 9) return s;
|
|
136
|
-
return s + "Z";
|
|
137
|
-
}
|
|
138
|
-
//#endregion
|
|
139
|
-
export { ensureUtc as a, sectionTitle as c, dim as i, tablePrefix as l, cliTitle as n, helpLine as o, createSpinner as r, import_picocolors as s, categoryTitle as t, require_picocolors as u };
|
package/dist/plan-aD3wRDqF.mjs
DELETED
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
import { n as __exportAll } from "./chunk-DJd-R1mw.mjs";
|
|
2
|
-
import { t as canonicalJson } from "./canonical-json-CEyQaVDa.mjs";
|
|
3
|
-
import { createHash } from "node:crypto";
|
|
4
|
-
//#region src/migrations/tokenize.ts
|
|
5
|
-
function* tokenizeSql(sql) {
|
|
6
|
-
const sqlLength = sql.length;
|
|
7
|
-
let index = 0;
|
|
8
|
-
let runStart = 0;
|
|
9
|
-
const flushRun = (upTo) => {
|
|
10
|
-
if (upTo > runStart) return {
|
|
11
|
-
kind: "sql",
|
|
12
|
-
start: runStart,
|
|
13
|
-
end: upTo
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
while (index < sqlLength) {
|
|
17
|
-
const character = sql[index];
|
|
18
|
-
const next = index + 1 < sqlLength ? sql[index + 1] : "";
|
|
19
|
-
if (character === "-" && next === "-") {
|
|
20
|
-
const run = flushRun(index);
|
|
21
|
-
if (run) yield run;
|
|
22
|
-
let scanIndex = index + 2;
|
|
23
|
-
while (scanIndex < sqlLength && sql[scanIndex] !== "\n") scanIndex++;
|
|
24
|
-
yield {
|
|
25
|
-
kind: "line-comment",
|
|
26
|
-
start: index,
|
|
27
|
-
end: scanIndex
|
|
28
|
-
};
|
|
29
|
-
index = scanIndex;
|
|
30
|
-
runStart = index;
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
if (character === "/" && next === "*") {
|
|
34
|
-
const run = flushRun(index);
|
|
35
|
-
if (run) yield run;
|
|
36
|
-
let scanIndex = index + 2;
|
|
37
|
-
while (scanIndex < sqlLength - 1 && !(sql[scanIndex] === "*" && sql[scanIndex + 1] === "/")) scanIndex++;
|
|
38
|
-
const end = Math.min(scanIndex + 2, sqlLength);
|
|
39
|
-
yield {
|
|
40
|
-
kind: "block-comment",
|
|
41
|
-
start: index,
|
|
42
|
-
end
|
|
43
|
-
};
|
|
44
|
-
index = end;
|
|
45
|
-
runStart = index;
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
if (character === "'") {
|
|
49
|
-
const run = flushRun(index);
|
|
50
|
-
if (run) yield run;
|
|
51
|
-
let scanIndex = index + 1;
|
|
52
|
-
while (scanIndex < sqlLength) {
|
|
53
|
-
if (sql[scanIndex] === "'" && sql[scanIndex + 1] === "'") {
|
|
54
|
-
scanIndex += 2;
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (sql[scanIndex] === "'") {
|
|
58
|
-
scanIndex++;
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
scanIndex++;
|
|
62
|
-
}
|
|
63
|
-
yield {
|
|
64
|
-
kind: "string",
|
|
65
|
-
start: index,
|
|
66
|
-
end: scanIndex
|
|
67
|
-
};
|
|
68
|
-
index = scanIndex;
|
|
69
|
-
runStart = index;
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
if (character === "\"" || character === "`" || character === "[") {
|
|
73
|
-
const run = flushRun(index);
|
|
74
|
-
if (run) yield run;
|
|
75
|
-
const close = character === "[" ? "]" : character;
|
|
76
|
-
let scanIndex = index + 1;
|
|
77
|
-
while (scanIndex < sqlLength) {
|
|
78
|
-
if (close !== "]" && sql[scanIndex] === close && sql[scanIndex + 1] === close) {
|
|
79
|
-
scanIndex += 2;
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
if (sql[scanIndex] === close) {
|
|
83
|
-
scanIndex++;
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
scanIndex++;
|
|
87
|
-
}
|
|
88
|
-
yield {
|
|
89
|
-
kind: "ident-quote",
|
|
90
|
-
open: character,
|
|
91
|
-
start: index,
|
|
92
|
-
end: scanIndex
|
|
93
|
-
};
|
|
94
|
-
index = scanIndex;
|
|
95
|
-
runStart = index;
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
index++;
|
|
99
|
-
}
|
|
100
|
-
const tail = flushRun(sqlLength);
|
|
101
|
-
if (tail) yield tail;
|
|
102
|
-
}
|
|
103
|
-
//#endregion
|
|
104
|
-
//#region src/migrations/plan.ts
|
|
105
|
-
var plan_exports = /* @__PURE__ */ __exportAll({
|
|
106
|
-
DESTRUCTIVE_PRAGMA: () => DESTRUCTIVE_PRAGMA,
|
|
107
|
-
MIGRATION_CLASSIFIER_VERSION: () => 1,
|
|
108
|
-
UNSPLIT_MULTI_STATEMENT_PRAGMA: () => UNSPLIT_MULTI_STATEMENT_PRAGMA,
|
|
109
|
-
buildMigrationPlanBundle: () => buildMigrationPlanBundle,
|
|
110
|
-
canonicalSql: () => canonicalSql,
|
|
111
|
-
classifyMigration: () => classifyMigration,
|
|
112
|
-
computeMigrationListHash: () => computeMigrationListHash,
|
|
113
|
-
hasStandalonePragma: () => hasStandalonePragma,
|
|
114
|
-
isSingleStatement: () => isSingleStatement,
|
|
115
|
-
sha256Hex: () => sha256Hex
|
|
116
|
-
});
|
|
117
|
-
const UNSPLIT_MULTI_STATEMENT_PRAGMA = "-- void:allow-unsplit-multi-statement";
|
|
118
|
-
const DESTRUCTIVE_PRAGMA = "-- void:allow-destructive";
|
|
119
|
-
function canonicalSql(sql) {
|
|
120
|
-
return (sql.charCodeAt(0) === 65279 ? sql.slice(1) : sql).replace(/\r\n?/g, "\n");
|
|
121
|
-
}
|
|
122
|
-
function sha256Hex(value) {
|
|
123
|
-
return `sha256:${createHash("sha256").update(value).digest("hex")}`;
|
|
124
|
-
}
|
|
125
|
-
function getPlanHashInput(plan) {
|
|
126
|
-
const base = {
|
|
127
|
-
classifierVersion: plan.classifierVersion,
|
|
128
|
-
dialect: plan.dialect,
|
|
129
|
-
kind: plan.kind,
|
|
130
|
-
name: plan.name,
|
|
131
|
-
sqlHash: plan.sqlHash,
|
|
132
|
-
stability: plan.stability
|
|
133
|
-
};
|
|
134
|
-
if (plan.kind === "breakpoint-framed") base.statements = plan.statements;
|
|
135
|
-
return base;
|
|
136
|
-
}
|
|
137
|
-
function hashPlan(plan) {
|
|
138
|
-
return sha256Hex(canonicalJson(getPlanHashInput(plan)));
|
|
139
|
-
}
|
|
140
|
-
function computeMigrationListHash(plans) {
|
|
141
|
-
return sha256Hex(canonicalJson(plans.map((plan) => [
|
|
142
|
-
plan.name,
|
|
143
|
-
plan.sqlHash,
|
|
144
|
-
plan.planHash
|
|
145
|
-
])));
|
|
146
|
-
}
|
|
147
|
-
function isStandalonePragmaLine(line, pragma) {
|
|
148
|
-
return line.trim() === pragma;
|
|
149
|
-
}
|
|
150
|
-
function hasStandalonePragma(sql, pragma) {
|
|
151
|
-
return canonicalSql(sql).split("\n").some((line) => isStandalonePragmaLine(line, pragma));
|
|
152
|
-
}
|
|
153
|
-
function isBreakpointComment(text) {
|
|
154
|
-
return text.trim() === "--> statement-breakpoint";
|
|
155
|
-
}
|
|
156
|
-
function splitBreakpointFramedSql(sql) {
|
|
157
|
-
const normalized = canonicalSql(sql);
|
|
158
|
-
const statements = [];
|
|
159
|
-
let cursor = 0;
|
|
160
|
-
for (const segment of tokenizeSql(normalized)) {
|
|
161
|
-
if (segment.kind !== "line-comment") continue;
|
|
162
|
-
if (isBreakpointComment(normalized.slice(segment.start, segment.end))) {
|
|
163
|
-
const statement = normalized.slice(cursor, segment.start).trim();
|
|
164
|
-
if (statement) statements.push(statement);
|
|
165
|
-
cursor = segment.end;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
const statement = normalized.slice(cursor).trim();
|
|
169
|
-
if (statement) statements.push(statement);
|
|
170
|
-
return statements;
|
|
171
|
-
}
|
|
172
|
-
function getExecutableSql(sql) {
|
|
173
|
-
let out = "";
|
|
174
|
-
for (const segment of tokenizeSql(sql)) if (segment.kind === "sql") out += sql.slice(segment.start, segment.end);
|
|
175
|
-
else out += " ".repeat(segment.end - segment.start);
|
|
176
|
-
return out;
|
|
177
|
-
}
|
|
178
|
-
function hasStatementBreakpointOutsideLiterals(sql) {
|
|
179
|
-
const normalized = canonicalSql(sql);
|
|
180
|
-
for (const segment of tokenizeSql(normalized)) {
|
|
181
|
-
if (segment.kind !== "line-comment") continue;
|
|
182
|
-
if (isBreakpointComment(normalized.slice(segment.start, segment.end))) return true;
|
|
183
|
-
}
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
function isSingleStatement(sql) {
|
|
187
|
-
const normalized = canonicalSql(sql);
|
|
188
|
-
let statements = 0;
|
|
189
|
-
let inStatement = false;
|
|
190
|
-
for (const segment of tokenizeSql(normalized)) {
|
|
191
|
-
if (segment.kind === "line-comment" || segment.kind === "block-comment") continue;
|
|
192
|
-
if (segment.kind === "string" || segment.kind === "ident-quote") {
|
|
193
|
-
inStatement = true;
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
for (let index = segment.start; index < segment.end; index++) {
|
|
197
|
-
const character = normalized[index];
|
|
198
|
-
if (character === ";") {
|
|
199
|
-
if (inStatement) {
|
|
200
|
-
statements++;
|
|
201
|
-
inStatement = false;
|
|
202
|
-
}
|
|
203
|
-
continue;
|
|
204
|
-
}
|
|
205
|
-
if (character !== " " && character !== " " && character !== "\n" && character !== "\r") inStatement = true;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
if (inStatement) statements++;
|
|
209
|
-
return statements === 1;
|
|
210
|
-
}
|
|
211
|
-
function includesTransactionControl(sql) {
|
|
212
|
-
return getExecutableSql(sql).match(/(?:^|;)\s*(BEGIN(?:\s+(?:DEFERRED|IMMEDIATE|EXCLUSIVE|TRANSACTION))?|COMMIT|ROLLBACK|SAVEPOINT|RELEASE)\b/i)?.[1]?.toUpperCase() ?? null;
|
|
213
|
-
}
|
|
214
|
-
function classifyMigration(migration) {
|
|
215
|
-
const sql = canonicalSql(migration.sql);
|
|
216
|
-
const sqlHash = sha256Hex(sql);
|
|
217
|
-
const transactionControl = includesTransactionControl(sql);
|
|
218
|
-
if (transactionControl) throw new Error(`Migration ${migration.name} contains ${transactionControl}; Void owns the stable D1 transaction boundary.`);
|
|
219
|
-
let base;
|
|
220
|
-
const warnings = [];
|
|
221
|
-
if (hasStatementBreakpointOutsideLiterals(sql)) {
|
|
222
|
-
const statements = splitBreakpointFramedSql(sql);
|
|
223
|
-
if (statements.length === 0) throw new Error(`Migration ${migration.name} has statement breakpoints but no SQL statements.`);
|
|
224
|
-
base = {
|
|
225
|
-
classifierVersion: 1,
|
|
226
|
-
dialect: "sqlite",
|
|
227
|
-
kind: "breakpoint-framed",
|
|
228
|
-
name: migration.name,
|
|
229
|
-
sqlHash,
|
|
230
|
-
stability: "stable",
|
|
231
|
-
statements
|
|
232
|
-
};
|
|
233
|
-
} else if (isSingleStatement(sql)) base = {
|
|
234
|
-
classifierVersion: 1,
|
|
235
|
-
dialect: "sqlite",
|
|
236
|
-
kind: "single-statement",
|
|
237
|
-
name: migration.name,
|
|
238
|
-
sqlHash,
|
|
239
|
-
stability: "stable"
|
|
240
|
-
};
|
|
241
|
-
else {
|
|
242
|
-
const allowLegacy = hasStandalonePragma(sql, UNSPLIT_MULTI_STATEMENT_PRAGMA);
|
|
243
|
-
warnings.push(`Migration ${migration.name} contains multiple statements without Drizzle statement breakpoints; it will run through the legacy D1 path.`);
|
|
244
|
-
base = {
|
|
245
|
-
allowLegacy,
|
|
246
|
-
classifierVersion: 1,
|
|
247
|
-
dialect: "sqlite",
|
|
248
|
-
kind: "legacy-unsplit-multi-statement",
|
|
249
|
-
name: migration.name,
|
|
250
|
-
sqlHash,
|
|
251
|
-
stability: "legacy"
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
return {
|
|
255
|
-
...base,
|
|
256
|
-
planHash: hashPlan(base),
|
|
257
|
-
...warnings.length > 0 ? { warnings } : {}
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
function buildMigrationPlanBundle(migrations) {
|
|
261
|
-
const plans = migrations.map((migration) => classifyMigration(migration));
|
|
262
|
-
return {
|
|
263
|
-
classifierVersion: 1,
|
|
264
|
-
destructiveValidation: "passed",
|
|
265
|
-
migrationListHash: computeMigrationListHash(plans),
|
|
266
|
-
plans,
|
|
267
|
-
protocolVersion: 2
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
//#endregion
|
|
271
|
-
export { tokenizeSql as a, plan_exports as i, buildMigrationPlanBundle as n, classifyMigration as r, DESTRUCTIVE_PRAGMA as t };
|