void 0.9.0 → 0.9.2
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/{auth-cmd-BSdoU6dB.mjs → auth-cmd-CPkWrQR9.mjs} +2 -2
- package/dist/{better-auth-shared-BxcgLiHN.d.mts → better-auth-shared-CmEQZs1T.d.mts} +2 -2
- package/dist/{cache-Cb4Vs95q.mjs → cache-1SVxZ7BK.mjs} +2 -2
- package/dist/{cancel-deploy-CLVkqGJB.mjs → cancel-deploy-JaFClLr7.mjs} +1 -1
- package/dist/cli/cli.mjs +77 -40
- package/dist/{client-CCOKwNUz.mjs → client-DIfOFf1W.mjs} +6 -1
- package/dist/{create-project-Dg5hiuDE.mjs → create-project-DCUrFJxa.mjs} +3 -3
- package/dist/{db-D7l4OGV1.mjs → db-DiddQC2v.mjs} +191 -19
- package/dist/{delete-Bi-gbEHT.mjs → delete-CYknzwXU.mjs} +2 -2
- package/dist/{deploy-iR7ug73w.mjs → deploy-CRU9fGjE.mjs} +8 -11
- package/dist/{domain-C_atK_X9.mjs → domain-B7RntQ1r.mjs} +13 -28
- package/dist/{env-Dc073Aip.mjs → env-Bvw0wMTI.mjs} +1 -1
- package/dist/{env-helpers-bupZjGHq.d.mts → env-helpers-Bd2wVdxz.d.mts} +1 -1
- package/dist/{gen-CsawhQZz.mjs → gen-CZdNWIaA.mjs} +1 -1
- package/dist/{handler-DMSGX5S6.d.mts → handler-xflsMwWM.d.mts} +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +71 -52
- package/dist/{init-CD9yg4Xt.mjs → init-BHupO7Fm.mjs} +7 -7
- package/dist/{link-27a64clx.mjs → link-7MoXUMaI.mjs} +3 -3
- package/dist/{list-C3Xt_i8a.mjs → list-N2mCHv8q.mjs} +2 -2
- package/dist/{login-BZ1Yk9Xw.mjs → login-tt1OmNVg.mjs} +1 -1
- package/dist/{logs-CktUaLEr.mjs → logs-Cl7q2CjZ.mjs} +1 -1
- package/dist/{mcp-BU7CP6gX.mjs → mcp-BXD35N2J.mjs} +1 -1
- package/dist/{node-C2HhnBO_.mjs → node-CHWVVjO6.mjs} +3 -3
- package/dist/pages/client.d.mts +1 -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 +1 -1
- package/dist/pages/islands-plugin.d.mts +1 -1
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +1 -1
- package/dist/{prepare-BNuC8Ds9.mjs → prepare-CrlAVbWS.mjs} +1 -1
- package/dist/{preset-Lvi0ORmO.mjs → preset-CIJG2O7a.mjs} +1 -1
- package/dist/{project-cmd-DUkWHooP.mjs → project-cmd-CLrqSbqj.mjs} +8 -8
- package/dist/{protocol-hjl3Nx5x.d.mts → protocol-DYca39yJ.d.mts} +3 -3
- package/dist/proxy-M3pxItg2.mjs +5 -0
- package/dist/{rollback-CEjAG9uQ.mjs → rollback-CEbAwbHK.mjs} +1 -1
- package/dist/{runner-Cioqe5b2.mjs → runner-DLZ9E_cX.mjs} +1 -1
- package/dist/runtime/ai.d.mts +20 -100
- package/dist/runtime/ai.mjs +102 -55
- 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/env-helpers.d.mts +1 -1
- package/dist/runtime/env-public-client.d.mts +1 -1
- package/dist/runtime/env-public.d.mts +2 -2
- package/dist/runtime/env-public.mjs +1 -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 +1 -1
- package/dist/runtime/handler.mjs +1 -1
- package/dist/runtime/isr.mjs +1 -1
- package/dist/runtime/live.d.mts +2 -2
- package/dist/runtime/live.mjs +1 -1
- package/dist/runtime/migration-handler-pg.mjs +1 -1
- 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.d.mts +3 -3
- package/dist/{secret-Dab6XQdb.mjs → secret-C_uTY7xx.mjs} +2 -2
- package/dist/{skills-GPm5Kjev.mjs → skills-BRKc--As.mjs} +1 -1
- package/package.json +2 -2
- package/skills/void/docs/guide/ai.md +109 -51
- package/skills/void/docs/guide/auth.md +3 -3
- package/skills/void/docs/node_modules/void/AGENTS.md +1 -1
- package/skills/void/docs/reference/api.md +9 -2
- package/skills/void/docs/reference/cli.md +50 -30
- /package/dist/{agents-Dkgafwfr.mjs → agents-MhSzNMiC.mjs} +0 -0
- /package/dist/{auth-BL0cU_Sy.d.mts → auth-CDeb2XAl.d.mts} +0 -0
- /package/dist/{auth-migrations-DBoTUBvq.mjs → auth-migrations-CuQkjjWE.mjs} +0 -0
- /package/dist/{better-auth-shared-pR54mTD2.mjs → better-auth-shared-ChVbrq52.mjs} +0 -0
- /package/dist/{defer-BosTTQTi.mjs → defer-CouVukrf.mjs} +0 -0
- /package/dist/{drizzle-Bvhm-Uug.mjs → drizzle-2fs1qTgy.mjs} +0 -0
- /package/dist/{env-raw-DhK_myJu.mjs → env-raw-RDkMnSTC.mjs} +0 -0
- /package/dist/{fetch-error-B8GTcrQw.mjs → fetch-error-BFIoojjf.mjs} +0 -0
- /package/dist/{fetch-error-Dn-En6Wg.d.mts → fetch-error-CimrygMq.d.mts} +0 -0
- /package/dist/{head-BW_f2L_4.d.mts → head-BsSTGnIe.d.mts} +0 -0
- /package/dist/{headers-wAPJigtE.mjs → headers-Y0jshugF.mjs} +0 -0
- /package/dist/{package-json-BMdypFnO.mjs → package-json-B2TD0JLu.mjs} +0 -0
- /package/dist/{pg-C-ybKyFU.mjs → pg-CMZ_5wsC.mjs} +0 -0
- /package/dist/{project-slug-De4UjtD9.mjs → project-slug-rX3kTOfY.mjs} +0 -0
- /package/dist/{providers-BVUcW4Jo.d.mts → providers-3Kkv63Ha.d.mts} +0 -0
- /package/dist/{resolve-project-CNpUbUHd.mjs → resolve-project-D4O1_fZz.mjs} +0 -0
- /package/dist/{runner-pg-D8ciL41o.mjs → runner-pg-Cv9V7ydr.mjs} +0 -0
- /package/dist/{standard-schema-DCIm8cwQ.d.mts → standard-schema-Dnsh2vnl.d.mts} +0 -0
- /package/dist/{subcommand-prompt-DUaWltdH.mjs → subcommand-prompt-OD-x_Tsm.mjs} +0 -0
- /package/dist/{types-s2mK7ar_.d.mts → types-Dm9kep2X.d.mts} +0 -0
- /package/dist/{yarn-pnp-BdM0hoCa.mjs → yarn-pnp-0SwYgQxx.mjs} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as getToken, d as removeToken, n as PlatformClient } from "./client-
|
|
1
|
+
import { c as getToken, d as removeToken, n as PlatformClient } from "./client-DIfOFf1W.mjs";
|
|
2
2
|
import { c as R } from "./dist-abzUneor.mjs";
|
|
3
|
-
import { n as runLoginCommand } from "./login-
|
|
3
|
+
import { n as runLoginCommand } from "./login-tt1OmNVg.mjs";
|
|
4
4
|
import { execSync } from "node:child_process";
|
|
5
5
|
//#region src/cli/auth-cmd.ts
|
|
6
6
|
async function runAuthCommand(root, args) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as VoidAuthConfig, n as AuthState } from "./auth-
|
|
2
|
-
import { t as VoidAuthProvider } from "./providers-
|
|
1
|
+
import { i as VoidAuthConfig, n as AuthState } from "./auth-CDeb2XAl.mjs";
|
|
2
|
+
import { t as VoidAuthProvider } from "./providers-3Kkv63Ha.mjs";
|
|
3
3
|
import { DBFieldAttribute } from "better-auth/db";
|
|
4
4
|
import { BetterAuthOptions, betterAuth } from "better-auth";
|
|
5
5
|
import { Context } from "hono";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i as dim, n as cliTitle, r as createSpinner } from "./output-DeiS4oEX.mjs";
|
|
2
|
-
import { c as getToken, n as PlatformClient } from "./client-
|
|
2
|
+
import { c as getToken, n as PlatformClient } from "./client-DIfOFf1W.mjs";
|
|
3
3
|
import { c as R, g as ge, y as ye } from "./dist-abzUneor.mjs";
|
|
4
4
|
import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
|
|
5
|
-
import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-
|
|
5
|
+
import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-D4O1_fZz.mjs";
|
|
6
6
|
//#region src/cli/cache.ts
|
|
7
7
|
async function runPurgeCacheCommand(root, projectSlug) {
|
|
8
8
|
console.log();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as cliTitle } from "./output-DeiS4oEX.mjs";
|
|
2
|
-
import { c as getToken, n as PlatformClient } from "./client-
|
|
2
|
+
import { c as getToken, n as PlatformClient } from "./client-DIfOFf1W.mjs";
|
|
3
3
|
import { c as R, g as ge, v as ue, x as q, y as ye } from "./dist-abzUneor.mjs";
|
|
4
4
|
import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
|
|
5
5
|
//#region src/cli/cancel-deploy.ts
|
package/dist/cli/cli.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { a as join } from "../pathe.M-eThtNZ-BrPhGF_K.mjs";
|
|
3
3
|
import { c as sectionTitle, o as helpLine, s as import_picocolors, t as categoryTitle } from "../output-DeiS4oEX.mjs";
|
|
4
4
|
import { c as R, u as Se, y as ye } from "../dist-abzUneor.mjs";
|
|
5
|
-
import { r as getPackageDir } from "../agents-
|
|
5
|
+
import { r as getPackageDir } from "../agents-MhSzNMiC.mjs";
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
7
7
|
import { parseArgs } from "node:util";
|
|
8
8
|
//#region src/cli/args.ts
|
|
@@ -104,7 +104,11 @@ const dbSubcommands = [
|
|
|
104
104
|
{
|
|
105
105
|
name: "execute",
|
|
106
106
|
arg: "<sql>",
|
|
107
|
-
description: "Run SQL against the
|
|
107
|
+
description: "Run SQL against the database (use --remote for the deployed database)",
|
|
108
|
+
flags: [{
|
|
109
|
+
name: "--remote",
|
|
110
|
+
description: "Run against the deployed database"
|
|
111
|
+
}]
|
|
108
112
|
},
|
|
109
113
|
{
|
|
110
114
|
name: "migrate",
|
|
@@ -116,7 +120,11 @@ const dbSubcommands = [
|
|
|
116
120
|
},
|
|
117
121
|
{
|
|
118
122
|
name: "studio",
|
|
119
|
-
description: "Open Drizzle Studio for the
|
|
123
|
+
description: "Open Drizzle Studio against the database (use --remote for the deployed PostgreSQL database)",
|
|
124
|
+
flags: [{
|
|
125
|
+
name: "--remote",
|
|
126
|
+
description: "Open Studio against the deployed database"
|
|
127
|
+
}]
|
|
120
128
|
},
|
|
121
129
|
{
|
|
122
130
|
name: "set-url",
|
|
@@ -198,7 +206,8 @@ function parseDbArgs(args) {
|
|
|
198
206
|
return {
|
|
199
207
|
action,
|
|
200
208
|
command,
|
|
201
|
-
file
|
|
209
|
+
file,
|
|
210
|
+
remote: parsed.values.remote === true ? true : void 0
|
|
202
211
|
};
|
|
203
212
|
}
|
|
204
213
|
if (action === "migrate") {
|
|
@@ -210,7 +219,10 @@ function parseDbArgs(args) {
|
|
|
210
219
|
}
|
|
211
220
|
if (action === "studio") {
|
|
212
221
|
if (rest.length > 0) throw new Error(`db: Unexpected argument '${rest[0]}'.`);
|
|
213
|
-
return {
|
|
222
|
+
return {
|
|
223
|
+
action,
|
|
224
|
+
remote: parsed.values.remote === true ? true : void 0
|
|
225
|
+
};
|
|
214
226
|
}
|
|
215
227
|
if (action === "set-url") {
|
|
216
228
|
if (rest.length > 0) throw new Error(`db: Unexpected argument '${rest[0]}'.`);
|
|
@@ -221,6 +233,7 @@ function parseDbArgs(args) {
|
|
|
221
233
|
return { action };
|
|
222
234
|
}
|
|
223
235
|
if (action === "export") {
|
|
236
|
+
if (parsed.values.remote === true) throw new Error("`void db export --remote` is not yet supported. Local export only for now.");
|
|
224
237
|
if (rest.length > 0) throw new Error(`db: Unexpected argument '${rest[0]}'.`);
|
|
225
238
|
return {
|
|
226
239
|
action,
|
|
@@ -868,7 +881,7 @@ const HELP_TREE = {
|
|
|
868
881
|
},
|
|
869
882
|
{
|
|
870
883
|
command: "execute <sql>",
|
|
871
|
-
description: "Run SQL against the
|
|
884
|
+
description: "Run SQL against the database (--remote for deployed)"
|
|
872
885
|
},
|
|
873
886
|
{
|
|
874
887
|
command: "migrate",
|
|
@@ -876,7 +889,7 @@ const HELP_TREE = {
|
|
|
876
889
|
},
|
|
877
890
|
{
|
|
878
891
|
command: "studio",
|
|
879
|
-
description: "Open Drizzle Studio for
|
|
892
|
+
description: "Open Drizzle Studio (--remote for deployed PG)"
|
|
880
893
|
},
|
|
881
894
|
{
|
|
882
895
|
command: "export",
|
|
@@ -905,19 +918,29 @@ const HELP_TREE = {
|
|
|
905
918
|
}]
|
|
906
919
|
},
|
|
907
920
|
execute: {
|
|
908
|
-
summary: "Run SQL against the local database.",
|
|
921
|
+
summary: "Run SQL against the database (local by default; use --remote for the deployed database).",
|
|
909
922
|
usage: ["void db execute <sql>", "void db execute --file <path>"],
|
|
910
923
|
options: [{
|
|
911
924
|
command: "--file <path>",
|
|
912
925
|
description: "Run SQL from a file instead"
|
|
913
|
-
}],
|
|
914
|
-
examples: [{
|
|
915
|
-
command: "void db execute \"select * from users\"",
|
|
916
|
-
description: "Run inline SQL"
|
|
917
926
|
}, {
|
|
918
|
-
command: "
|
|
919
|
-
description: "Run
|
|
920
|
-
}]
|
|
927
|
+
command: "--remote",
|
|
928
|
+
description: "Run against the deployed database (D1 via proxy; PostgreSQL via direct connection)"
|
|
929
|
+
}],
|
|
930
|
+
examples: [
|
|
931
|
+
{
|
|
932
|
+
command: "void db execute \"select * from users\"",
|
|
933
|
+
description: "Run inline SQL"
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
command: "void db execute --file query.sql",
|
|
937
|
+
description: "Run SQL from a file"
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
command: "void db execute --remote \"select count(*) from users\"",
|
|
941
|
+
description: "Query the deployed database"
|
|
942
|
+
}
|
|
943
|
+
]
|
|
921
944
|
},
|
|
922
945
|
migrate: {
|
|
923
946
|
summary: "Apply pending migrations.",
|
|
@@ -927,7 +950,21 @@ const HELP_TREE = {
|
|
|
927
950
|
description: "Apply to the remote database"
|
|
928
951
|
}]
|
|
929
952
|
},
|
|
930
|
-
studio:
|
|
953
|
+
studio: {
|
|
954
|
+
summary: "Open Drizzle Studio against the database (local by default; use --remote for the deployed PostgreSQL database; D1 remote not yet supported).",
|
|
955
|
+
usage: ["void db studio [options]"],
|
|
956
|
+
options: [{
|
|
957
|
+
command: "--remote",
|
|
958
|
+
description: "Open Studio against the deployed PostgreSQL database (D1 remote not yet supported)"
|
|
959
|
+
}],
|
|
960
|
+
examples: [{
|
|
961
|
+
command: "void db studio",
|
|
962
|
+
description: "Open Studio for the local database"
|
|
963
|
+
}, {
|
|
964
|
+
command: "void db studio --remote",
|
|
965
|
+
description: "Open Studio against the deployed PostgreSQL database"
|
|
966
|
+
}]
|
|
967
|
+
},
|
|
931
968
|
export: {
|
|
932
969
|
summary: "Export local database contents as SQL.",
|
|
933
970
|
usage: ["void db export [options]"],
|
|
@@ -1487,7 +1524,7 @@ async function runSubcommandGroup(command, subcommands, parse, run) {
|
|
|
1487
1524
|
const sub = args[1];
|
|
1488
1525
|
try {
|
|
1489
1526
|
if ((!sub || sub.startsWith("-")) && process.stdin.isTTY) {
|
|
1490
|
-
const { promptSubcommand } = await import("../subcommand-prompt-
|
|
1527
|
+
const { promptSubcommand } = await import("../subcommand-prompt-OD-x_Tsm.mjs");
|
|
1491
1528
|
const result = await promptSubcommand(command, subcommands);
|
|
1492
1529
|
if (!result) process.exit(0);
|
|
1493
1530
|
await run(root, parse(buildArgs(result, args.slice(1))));
|
|
@@ -1516,7 +1553,7 @@ else if (command === "deploy") {
|
|
|
1516
1553
|
R.error(err instanceof Error ? err.message : String(err));
|
|
1517
1554
|
process.exit(1);
|
|
1518
1555
|
}
|
|
1519
|
-
import("../deploy-
|
|
1556
|
+
import("../deploy-CRU9fGjE.mjs").then((n) => n.t).then(({ runDeploy }) => {
|
|
1520
1557
|
runDeploy(root, {
|
|
1521
1558
|
projectSlug: deployArgs.projectSlug,
|
|
1522
1559
|
dir: deployArgs.dir,
|
|
@@ -1528,13 +1565,13 @@ else if (command === "deploy") {
|
|
|
1528
1565
|
process.exit(1);
|
|
1529
1566
|
});
|
|
1530
1567
|
});
|
|
1531
|
-
} else if (command === "auth") runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (root, parsed) => import("../auth-cmd-
|
|
1532
|
-
else if (command === "project") runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (root, parsed) => import("../project-cmd-
|
|
1533
|
-
else if (command === "secret") runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (root, parsed) => import("../secret-
|
|
1534
|
-
else if (command === "domain") runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (root, parsed) => import("../domain-
|
|
1535
|
-
else if (command === "db") runSubcommandGroup("db", dbSubcommands, parseDbArgs, (root, parsed) => import("../db-
|
|
1536
|
-
else if (command === "env") runSubcommandGroup("env", envSubcommands, parseEnvArgs, (root, parsed) => import("../env-
|
|
1537
|
-
else if (command === "gen") runSubcommandGroup("gen", genSubcommands, parseGenArgs, (root, parsed) => import("../gen-
|
|
1568
|
+
} else if (command === "auth") runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (root, parsed) => import("../auth-cmd-CPkWrQR9.mjs").then(({ runAuthCommand }) => runAuthCommand(root, parsed)));
|
|
1569
|
+
else if (command === "project") runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (root, parsed) => import("../project-cmd-CLrqSbqj.mjs").then(({ runProjectCommand }) => runProjectCommand(root, parsed)));
|
|
1570
|
+
else if (command === "secret") runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (root, parsed) => import("../secret-C_uTY7xx.mjs").then(({ runSecretCommand }) => runSecretCommand(root, parsed)));
|
|
1571
|
+
else if (command === "domain") runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (root, parsed) => import("../domain-B7RntQ1r.mjs").then(({ runDomainCommand }) => runDomainCommand(root, parsed)));
|
|
1572
|
+
else if (command === "db") runSubcommandGroup("db", dbSubcommands, parseDbArgs, (root, parsed) => import("../db-DiddQC2v.mjs").then(({ runDbCommand }) => runDbCommand(root, parsed)));
|
|
1573
|
+
else if (command === "env") runSubcommandGroup("env", envSubcommands, parseEnvArgs, (root, parsed) => import("../env-Bvw0wMTI.mjs").then(({ runEnvCommand }) => runEnvCommand(root, parsed)));
|
|
1574
|
+
else if (command === "gen") runSubcommandGroup("gen", genSubcommands, parseGenArgs, (root, parsed) => import("../gen-CZdNWIaA.mjs").then(({ runGenCommand }) => runGenCommand(root, parsed)));
|
|
1538
1575
|
else if (command === "prepare") {
|
|
1539
1576
|
const root = process.cwd();
|
|
1540
1577
|
let prepareArgs;
|
|
@@ -1544,7 +1581,7 @@ else if (command === "prepare") {
|
|
|
1544
1581
|
R.error(err instanceof Error ? err.message : String(err));
|
|
1545
1582
|
process.exit(1);
|
|
1546
1583
|
}
|
|
1547
|
-
import("../prepare-
|
|
1584
|
+
import("../prepare-CrlAVbWS.mjs").then(({ runPrepareCommand }) => {
|
|
1548
1585
|
runPrepareCommand(root, prepareArgs).catch((err) => {
|
|
1549
1586
|
R.error(err.message ?? err);
|
|
1550
1587
|
process.exit(1);
|
|
@@ -1552,7 +1589,7 @@ else if (command === "prepare") {
|
|
|
1552
1589
|
});
|
|
1553
1590
|
} else if (command === "init") {
|
|
1554
1591
|
const root = process.cwd();
|
|
1555
|
-
import("../init-
|
|
1592
|
+
import("../init-BHupO7Fm.mjs").then(({ runInitCommand, parseInitArgs }) => {
|
|
1556
1593
|
let initArgs;
|
|
1557
1594
|
try {
|
|
1558
1595
|
initArgs = parseInitArgs(args.slice(1));
|
|
@@ -1565,7 +1602,7 @@ else if (command === "prepare") {
|
|
|
1565
1602
|
process.exit(1);
|
|
1566
1603
|
});
|
|
1567
1604
|
});
|
|
1568
|
-
} else if (command === "mcp") import("../mcp-
|
|
1605
|
+
} else if (command === "mcp") import("../mcp-BXD35N2J.mjs").then(({ runMcp }) => {
|
|
1569
1606
|
runMcp();
|
|
1570
1607
|
});
|
|
1571
1608
|
else if (command === "-v" || command === "--version") {
|
|
@@ -1634,36 +1671,36 @@ else if (command === "-v" || command === "--version") {
|
|
|
1634
1671
|
];
|
|
1635
1672
|
(async () => {
|
|
1636
1673
|
printVoidHeader();
|
|
1637
|
-
const { promptSubcommand } = await import("../subcommand-prompt-
|
|
1674
|
+
const { promptSubcommand } = await import("../subcommand-prompt-OD-x_Tsm.mjs");
|
|
1638
1675
|
const result = await promptSubcommand("", topLevelCommands);
|
|
1639
1676
|
if (!result) process.exit(0);
|
|
1640
1677
|
const cmd = result.subcommand;
|
|
1641
1678
|
const root = process.cwd();
|
|
1642
1679
|
switch (cmd) {
|
|
1643
1680
|
case "init": {
|
|
1644
|
-
const { runInitCommand, parseInitArgs } = await import("../init-
|
|
1681
|
+
const { runInitCommand, parseInitArgs } = await import("../init-BHupO7Fm.mjs");
|
|
1645
1682
|
await runInitCommand(root, parseInitArgs([]));
|
|
1646
1683
|
return;
|
|
1647
1684
|
}
|
|
1648
1685
|
case "deploy": {
|
|
1649
|
-
const { runDeploy } = await import("../deploy-
|
|
1686
|
+
const { runDeploy } = await import("../deploy-CRU9fGjE.mjs").then((n) => n.t);
|
|
1650
1687
|
await runDeploy(root);
|
|
1651
1688
|
return;
|
|
1652
1689
|
}
|
|
1653
1690
|
case "mcp": {
|
|
1654
|
-
const { runMcp } = await import("../mcp-
|
|
1691
|
+
const { runMcp } = await import("../mcp-BXD35N2J.mjs");
|
|
1655
1692
|
runMcp();
|
|
1656
1693
|
return;
|
|
1657
1694
|
}
|
|
1658
|
-
case "auth": return runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (r, p) => import("../auth-cmd-
|
|
1659
|
-
case "project": return runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (r, p) => import("../project-cmd-
|
|
1660
|
-
case "secret": return runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (r, p) => import("../secret-
|
|
1661
|
-
case "domain": return runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (r, p) => import("../domain-
|
|
1662
|
-
case "db": return runSubcommandGroup("db", dbSubcommands, parseDbArgs, (r, p) => import("../db-
|
|
1663
|
-
case "env": return runSubcommandGroup("env", envSubcommands, parseEnvArgs, (r, p) => import("../env-
|
|
1664
|
-
case "gen": return runSubcommandGroup("gen", genSubcommands, parseGenArgs, (r, p) => import("../gen-
|
|
1695
|
+
case "auth": return runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (r, p) => import("../auth-cmd-CPkWrQR9.mjs").then(({ runAuthCommand }) => runAuthCommand(r, p)));
|
|
1696
|
+
case "project": return runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (r, p) => import("../project-cmd-CLrqSbqj.mjs").then(({ runProjectCommand }) => runProjectCommand(r, p)));
|
|
1697
|
+
case "secret": return runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (r, p) => import("../secret-C_uTY7xx.mjs").then(({ runSecretCommand }) => runSecretCommand(r, p)));
|
|
1698
|
+
case "domain": return runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (r, p) => import("../domain-B7RntQ1r.mjs").then(({ runDomainCommand }) => runDomainCommand(r, p)));
|
|
1699
|
+
case "db": return runSubcommandGroup("db", dbSubcommands, parseDbArgs, (r, p) => import("../db-DiddQC2v.mjs").then(({ runDbCommand }) => runDbCommand(r, p)));
|
|
1700
|
+
case "env": return runSubcommandGroup("env", envSubcommands, parseEnvArgs, (r, p) => import("../env-Bvw0wMTI.mjs").then(({ runEnvCommand }) => runEnvCommand(r, p)));
|
|
1701
|
+
case "gen": return runSubcommandGroup("gen", genSubcommands, parseGenArgs, (r, p) => import("../gen-CZdNWIaA.mjs").then(({ runGenCommand }) => runGenCommand(r, p)));
|
|
1665
1702
|
case "prepare": {
|
|
1666
|
-
const { runPrepareCommand } = await import("../prepare-
|
|
1703
|
+
const { runPrepareCommand } = await import("../prepare-CrlAVbWS.mjs");
|
|
1667
1704
|
await runPrepareCommand(root, parsePrepareArgs([]));
|
|
1668
1705
|
return;
|
|
1669
1706
|
}
|
|
@@ -3,7 +3,7 @@ import { a as join } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
|
|
|
3
3
|
import { s as import_picocolors } from "./output-DeiS4oEX.mjs";
|
|
4
4
|
import { t as cfAccessHeaders } from "./cf-access-DKDsgwOU.mjs";
|
|
5
5
|
import { t as isVoidInternalStaging } from "./project-CH9pdo16.mjs";
|
|
6
|
-
import { r as getPackageDir } from "./agents-
|
|
6
|
+
import { r as getPackageDir } from "./agents-MhSzNMiC.mjs";
|
|
7
7
|
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
8
8
|
import { createHash, randomBytes } from "node:crypto";
|
|
9
9
|
import { homedir } from "node:os";
|
|
@@ -754,6 +754,11 @@ var PlatformClient = class {
|
|
|
754
754
|
if (!res.ok) await throwPlatformApiError("Failed to update database URL", res);
|
|
755
755
|
return res.json();
|
|
756
756
|
}
|
|
757
|
+
async getDatabaseUrl(projectId) {
|
|
758
|
+
const res = await fetch(`${this.baseUrl}/projects/${projectId}/database-url`, { headers: { ...this.authHeaders } });
|
|
759
|
+
if (!res.ok) await throwPlatformApiError("Failed to fetch database URL", res);
|
|
760
|
+
return res.json();
|
|
761
|
+
}
|
|
757
762
|
async purgeCache(projectId) {
|
|
758
763
|
const res = await fetch(`${this.baseUrl}/projects/${projectId}/revalidate`, {
|
|
759
764
|
method: "POST",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { n as __exportAll } from "./chunk-DJd-R1mw.mjs";
|
|
2
2
|
import { s as import_picocolors } from "./output-DeiS4oEX.mjs";
|
|
3
|
-
import { s as getSiteDomain, t as PlatformApiError } from "./client-
|
|
3
|
+
import { s as getSiteDomain, t as PlatformApiError } from "./client-DIfOFf1W.mjs";
|
|
4
4
|
import { _ as me, c as R, i as Ee, l as Re, v as ue, x as q } from "./dist-abzUneor.mjs";
|
|
5
5
|
import { a as writeProjectConfig } from "./project-CH9pdo16.mjs";
|
|
6
|
-
import { n as validateProjectSlug } from "./project-slug-
|
|
7
|
-
import { n as inferDefaultSlug } from "./resolve-project-
|
|
6
|
+
import { n as validateProjectSlug } from "./project-slug-rX3kTOfY.mjs";
|
|
7
|
+
import { n as inferDefaultSlug } from "./resolve-project-D4O1_fZz.mjs";
|
|
8
8
|
//#region src/cli/prompt.ts
|
|
9
9
|
async function promptProjectSetupAction(message = "Set up a Void project:", options = {}) {
|
|
10
10
|
const result = await Ee({
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { a as join, c as resolve, r as extname, s as relative } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
|
|
2
2
|
import { i as dim, n as cliTitle, s as import_picocolors } from "./output-DeiS4oEX.mjs";
|
|
3
3
|
import { n as readProjectPaths } from "./project-paths-CCMrHYQm.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { c as
|
|
4
|
+
import { t as cfAccessHeaders } from "./cf-access-DKDsgwOU.mjs";
|
|
5
|
+
import { c as getToken, n as PlatformClient, t as PlatformApiError, u as isStagingMode } from "./client-DIfOFf1W.mjs";
|
|
6
|
+
import { c as R, g as ge, v as ue, x as q, y as ye } from "./dist-abzUneor.mjs";
|
|
6
7
|
import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
|
|
7
|
-
import { c as getDatabaseDialect, f as readConfig } from "./config-BVEC0lti.mjs";
|
|
8
|
+
import { c as getDatabaseDialect, f as readConfig, p as resolveBindingNames } from "./config-BVEC0lti.mjs";
|
|
8
9
|
import { r as detectFramework } from "./plugin-inference-BUBhHt_1.mjs";
|
|
9
10
|
import { a as writeJournal, i as stripSqlExt, r as readJournal, t as collectMigrations } from "./collect-9rO3JFNM.mjs";
|
|
10
11
|
import { n as listDrizzleArtifacts, r as validateMigrations, t as assertJournalCoherence } from "./validate-CNWm-PsL.mjs";
|
|
11
|
-
import {
|
|
12
|
+
import { n as STAGING_PROXY_URL, t as DEFAULT_PROXY_URL } from "./proxy-M3pxItg2.mjs";
|
|
13
|
+
import { formatTimestamp } from "./gen-CZdNWIaA.mjs";
|
|
12
14
|
import { existsSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
13
15
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
14
16
|
import { execFileSync } from "node:child_process";
|
|
@@ -87,9 +89,9 @@ async function runDbCommand(root, args) {
|
|
|
87
89
|
else if (args.action === "status") await runStatus(root, dialect);
|
|
88
90
|
else if (args.action === "reset") await runReset(root, dialect);
|
|
89
91
|
else if (args.action === "seed") await runSeed(root, args.file, dialect);
|
|
90
|
-
else if (args.action === "execute") await runExecute(root, args.command, args.file, dialect);
|
|
92
|
+
else if (args.action === "execute") await runExecute(root, args.command, args.file, dialect, args.remote);
|
|
91
93
|
else if (args.action === "migrate") await runMigrate(root, dialect, args.remote);
|
|
92
|
-
else if (args.action === "studio") await runStudio(root, dialect);
|
|
94
|
+
else if (args.action === "studio") await runStudio(root, dialect, args.remote);
|
|
93
95
|
else if (args.action === "set-url") await runSetUrl(root);
|
|
94
96
|
else if (args.action === "rename-migrations") await runRenameMigrations(root, dialect);
|
|
95
97
|
else await runExport(root, args, dialect);
|
|
@@ -101,7 +103,7 @@ async function runPush(root, dialect) {
|
|
|
101
103
|
else {
|
|
102
104
|
const { mkdirSync } = await import("node:fs");
|
|
103
105
|
const { dirname } = await import("node:path");
|
|
104
|
-
const { getMiniflareDatabasePath } = await import("./runner-
|
|
106
|
+
const { getMiniflareDatabasePath } = await import("./runner-DLZ9E_cX.mjs");
|
|
105
107
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
106
108
|
mkdirSync(dirname(dbPath), { recursive: true });
|
|
107
109
|
configPath = writeDrizzleConfig(root, dbPath);
|
|
@@ -159,7 +161,7 @@ async function runStatus(root, dialect) {
|
|
|
159
161
|
localApplied = [];
|
|
160
162
|
}
|
|
161
163
|
else {
|
|
162
|
-
const { getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-
|
|
164
|
+
const { getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-DLZ9E_cX.mjs");
|
|
163
165
|
localApplied = await getAppliedMigrations(getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local"));
|
|
164
166
|
}
|
|
165
167
|
const localSet = new Set(localApplied.map((m) => m.name));
|
|
@@ -217,7 +219,7 @@ async function resetDatabase(root, dialect) {
|
|
|
217
219
|
});
|
|
218
220
|
return migrations.length;
|
|
219
221
|
}
|
|
220
|
-
const { getMiniflareDatabasePath, runMigrations } = await import("./runner-
|
|
222
|
+
const { getMiniflareDatabasePath, runMigrations } = await import("./runner-DLZ9E_cX.mjs");
|
|
221
223
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
222
224
|
rmSync(dbPath, { force: true });
|
|
223
225
|
rmSync(dbPath + "-wal", { force: true });
|
|
@@ -244,7 +246,7 @@ async function runSeed(root, file, dialect) {
|
|
|
244
246
|
ye("Done.");
|
|
245
247
|
return;
|
|
246
248
|
}
|
|
247
|
-
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-
|
|
249
|
+
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-DLZ9E_cX.mjs");
|
|
248
250
|
const db = await openSqliteDatabase(getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local"));
|
|
249
251
|
try {
|
|
250
252
|
db.exec(sql);
|
|
@@ -256,7 +258,147 @@ async function runSeed(root, file, dialect) {
|
|
|
256
258
|
R.info(dim("Restart your dev server if it's running."));
|
|
257
259
|
ye("Done.");
|
|
258
260
|
}
|
|
259
|
-
|
|
261
|
+
/**
|
|
262
|
+
* Returns true when the SQL is read-only (SELECT / EXPLAIN only).
|
|
263
|
+
* Used to skip the destructive-statement safety prompt for safe queries.
|
|
264
|
+
*
|
|
265
|
+
* This is a fail-closed heuristic, not a real SQL parser:
|
|
266
|
+
* - SQL comments (slash-star block and double-dash line) are stripped first,
|
|
267
|
+
* so commented variants like `EXPLAIN <block-comment> ANALYZE DELETE FROM
|
|
268
|
+
* users` or `EXPLAIN -- c\n ANALYZE ...` can't bypass the EXPLAIN ANALYZE
|
|
269
|
+
* check by hiding the `ANALYZE` keyword behind a comment that PostgreSQL
|
|
270
|
+
* treats as whitespace. This also handles leading comments, so
|
|
271
|
+
* `-- header\nSELECT 1` is now correctly classified as safe.
|
|
272
|
+
* - The comment-stripping regex is naive and doesn't understand string
|
|
273
|
+
* literals: a string literal containing a block-comment marker will have its
|
|
274
|
+
* contents stripped. That's harmless here (still classified as SELECT, still
|
|
275
|
+
* safe), but worth knowing if this helper is ever reused.
|
|
276
|
+
* - `WITH` (CTEs) is intentionally excluded: writable CTEs such as
|
|
277
|
+
* `WITH deleted AS (DELETE FROM users RETURNING *) SELECT * FROM deleted`
|
|
278
|
+
* are destructive but match a naive `WITH` prefix check. Users with
|
|
279
|
+
* read-only CTEs will see the safety prompt — minor friction, safe by default.
|
|
280
|
+
* - Multi-statement SQL (`SELECT 1; DELETE FROM users`) is rejected: any `;`
|
|
281
|
+
* followed by non-whitespace content after stripping a trailing semicolon is
|
|
282
|
+
* treated as unsafe.
|
|
283
|
+
* - `EXPLAIN ANALYZE` is explicitly excluded: in PostgreSQL, `EXPLAIN ANALYZE`
|
|
284
|
+
* actually executes the underlying statement (including DML) to collect runtime
|
|
285
|
+
* statistics. A naive `EXPLAIN` prefix check would treat it as safe when it is
|
|
286
|
+
* in fact destructive. Only plain `EXPLAIN` (without `ANALYZE`) is allowed.
|
|
287
|
+
* - `EXPLAIN (...)` parenthesized option lists (PostgreSQL) are scanned for
|
|
288
|
+
* `ANALYZE`. The bare-keyword form `EXPLAIN ANALYZE ...` and the option-list
|
|
289
|
+
* form `EXPLAIN (ANALYZE) ...` / `EXPLAIN (ANALYZE TRUE) ...` both execute
|
|
290
|
+
* the underlying statement, so either shape is rejected. Even
|
|
291
|
+
* `EXPLAIN (ANALYZE FALSE)` is rejected (over-strict, but safer than
|
|
292
|
+
* guessing the boolean value of an arbitrary option expression).
|
|
293
|
+
*/
|
|
294
|
+
function isSafeStatement(sql) {
|
|
295
|
+
const stripped = sql.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/--[^\n]*/g, " ").replace(/;\s*$/, "");
|
|
296
|
+
if (stripped.includes(";")) return false;
|
|
297
|
+
if (/^\s*SELECT\b/i.test(stripped)) return true;
|
|
298
|
+
if (/^\s*EXPLAIN\b/i.test(stripped)) {
|
|
299
|
+
if (/^\s*EXPLAIN\s+ANALYZE\b/i.test(stripped)) return false;
|
|
300
|
+
const parenMatch = stripped.match(/^\s*EXPLAIN\s*\(([^)]*)\)/i);
|
|
301
|
+
if (parenMatch && /\bANALYZE\b/i.test(parenMatch[1])) return false;
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Fetch a project's remote PostgreSQL connection string from the platform.
|
|
308
|
+
* Exits with a friendly message when the URL has never been stored (404);
|
|
309
|
+
* other errors propagate so the caller's top-level handler can report them.
|
|
310
|
+
*/
|
|
311
|
+
async function fetchRemoteDatabaseUrl(client, projectId) {
|
|
312
|
+
try {
|
|
313
|
+
return (await client.getDatabaseUrl(projectId)).url;
|
|
314
|
+
} catch (err) {
|
|
315
|
+
if (err instanceof PlatformApiError && err.status === 404) {
|
|
316
|
+
R.error("This project's database URL isn't stored on the platform yet. Run `void db set-url` once to populate it, then retry.");
|
|
317
|
+
process.exit(1);
|
|
318
|
+
}
|
|
319
|
+
throw err;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Prompt the user to confirm a destructive remote query when running in a TTY.
|
|
324
|
+
* Returns true if execution should proceed, false if it was cancelled.
|
|
325
|
+
*/
|
|
326
|
+
async function confirmDestructiveRemote(sql) {
|
|
327
|
+
if (isSafeStatement(sql)) return true;
|
|
328
|
+
if (!process.stdin.isTTY) return true;
|
|
329
|
+
const ok = await ue({ message: "This will run against your deployed database. Continue?" });
|
|
330
|
+
if (q(ok) || !ok) return false;
|
|
331
|
+
return true;
|
|
332
|
+
}
|
|
333
|
+
async function runExecute(root, command, file, dialect, remote) {
|
|
334
|
+
if (remote) {
|
|
335
|
+
if (dialect !== "postgresql" && file) {
|
|
336
|
+
R.error("--file is not yet supported with --remote D1; pipe statements through stdin or run them one at a time.");
|
|
337
|
+
process.exit(1);
|
|
338
|
+
}
|
|
339
|
+
const sql = file ? readFileSync(join(root, file), "utf-8") : command;
|
|
340
|
+
const token = getToken(root);
|
|
341
|
+
if (!token) {
|
|
342
|
+
R.error("Not logged in. Run `void auth login` first.");
|
|
343
|
+
process.exit(1);
|
|
344
|
+
}
|
|
345
|
+
const projectConfig = readProjectConfig(root);
|
|
346
|
+
if (!projectConfig) {
|
|
347
|
+
R.error("No project linked. Run `void deploy` first or link a project.");
|
|
348
|
+
process.exit(1);
|
|
349
|
+
}
|
|
350
|
+
if (!await confirmDestructiveRemote(sql)) {
|
|
351
|
+
R.info("Cancelled.");
|
|
352
|
+
process.exit(0);
|
|
353
|
+
}
|
|
354
|
+
if (dialect === "postgresql") {
|
|
355
|
+
const dbUrl = await fetchRemoteDatabaseUrl(new PlatformClient(token, { root }), projectConfig.projectId);
|
|
356
|
+
const { Client } = await import("pg");
|
|
357
|
+
const pgClient = new Client({ connectionString: dbUrl });
|
|
358
|
+
await pgClient.connect();
|
|
359
|
+
try {
|
|
360
|
+
const result = await pgClient.query(sql);
|
|
361
|
+
if (result.rows && result.rows.length > 0) printTable(result.rows);
|
|
362
|
+
else R.success("Executed successfully.");
|
|
363
|
+
} finally {
|
|
364
|
+
await pgClient.end();
|
|
365
|
+
}
|
|
366
|
+
ye("Done.");
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
const platformClient = new PlatformClient(token, { root });
|
|
370
|
+
let binding = resolveBindingNames(readConfig(root).inference?.bindings)?.d1 ?? "DB";
|
|
371
|
+
try {
|
|
372
|
+
const d1Resource = (await platformClient.getResources(projectConfig.projectId)).find((r) => r.type === "d1");
|
|
373
|
+
if (d1Resource) binding = d1Resource.binding_name;
|
|
374
|
+
} catch {}
|
|
375
|
+
const proxyUrl = isStagingMode(root) ? STAGING_PROXY_URL : DEFAULT_PROXY_URL;
|
|
376
|
+
const res = await fetch(`${proxyUrl}/d1/query`, {
|
|
377
|
+
method: "POST",
|
|
378
|
+
headers: {
|
|
379
|
+
Authorization: `Bearer ${token}`,
|
|
380
|
+
"Content-Type": "application/json",
|
|
381
|
+
...cfAccessHeaders(process.env)
|
|
382
|
+
},
|
|
383
|
+
body: JSON.stringify({
|
|
384
|
+
projectId: projectConfig.projectId,
|
|
385
|
+
binding,
|
|
386
|
+
sql,
|
|
387
|
+
params: [],
|
|
388
|
+
method: "all"
|
|
389
|
+
})
|
|
390
|
+
});
|
|
391
|
+
if (!res.ok) {
|
|
392
|
+
const text = await res.text().catch(() => res.statusText);
|
|
393
|
+
R.error(`db: Proxy request failed with ${res.status}: '${text}'.`);
|
|
394
|
+
process.exit(1);
|
|
395
|
+
}
|
|
396
|
+
const rows = (await res.json()).results ?? [];
|
|
397
|
+
if (rows.length > 0) printTable(rows);
|
|
398
|
+
else R.success("Executed successfully.");
|
|
399
|
+
ye("Done.");
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
260
402
|
if (dialect === "postgresql") {
|
|
261
403
|
const sql = file ? readFileSync(join(root, file), "utf-8") : command;
|
|
262
404
|
await withPgClient(root, async (client) => {
|
|
@@ -267,7 +409,7 @@ async function runExecute(root, command, file, dialect) {
|
|
|
267
409
|
ye("Done.");
|
|
268
410
|
return;
|
|
269
411
|
}
|
|
270
|
-
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-
|
|
412
|
+
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-DLZ9E_cX.mjs");
|
|
271
413
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
272
414
|
if (!existsSync(dbPath)) {
|
|
273
415
|
R.error("No local database found. Run `void dev` first.");
|
|
@@ -370,7 +512,7 @@ async function runMigrate(root, dialect, remote) {
|
|
|
370
512
|
return;
|
|
371
513
|
}
|
|
372
514
|
if (dialect === "postgresql") {
|
|
373
|
-
const { applyPgMigrations } = await import("./runner-pg-
|
|
515
|
+
const { applyPgMigrations } = await import("./runner-pg-Cv9V7ydr.mjs");
|
|
374
516
|
const applied = await withPgClient(root, async (client) => {
|
|
375
517
|
let existingRows = [];
|
|
376
518
|
try {
|
|
@@ -394,7 +536,7 @@ async function runMigrate(root, dialect, remote) {
|
|
|
394
536
|
ye("Done.");
|
|
395
537
|
return;
|
|
396
538
|
}
|
|
397
|
-
const { getMiniflareDatabasePath, getAppliedMigrations, runMigrations } = await import("./runner-
|
|
539
|
+
const { getMiniflareDatabasePath, getAppliedMigrations, runMigrations } = await import("./runner-DLZ9E_cX.mjs");
|
|
398
540
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
399
541
|
try {
|
|
400
542
|
const existingRows = await getAppliedMigrations(dbPath);
|
|
@@ -412,7 +554,37 @@ async function runMigrate(root, dialect, remote) {
|
|
|
412
554
|
}
|
|
413
555
|
ye("Done.");
|
|
414
556
|
}
|
|
415
|
-
async function runStudio(root, dialect) {
|
|
557
|
+
async function runStudio(root, dialect, remote) {
|
|
558
|
+
if (remote) {
|
|
559
|
+
if (dialect !== "postgresql") {
|
|
560
|
+
R.error("Remote D1 studio is not yet supported. Use `void db execute --remote` for ad-hoc queries against your deployed D1 database.");
|
|
561
|
+
process.exit(1);
|
|
562
|
+
}
|
|
563
|
+
const token = getToken(root);
|
|
564
|
+
if (!token) {
|
|
565
|
+
R.error("Not logged in. Run `void auth login` first.");
|
|
566
|
+
process.exit(1);
|
|
567
|
+
}
|
|
568
|
+
const projectConfig = readProjectConfig(root);
|
|
569
|
+
if (!projectConfig) {
|
|
570
|
+
R.error("No project linked. Run `void deploy` first or link a project.");
|
|
571
|
+
process.exit(1);
|
|
572
|
+
}
|
|
573
|
+
const dbUrl = await fetchRemoteDatabaseUrl(new PlatformClient(token, { root }), projectConfig.projectId);
|
|
574
|
+
const { writeDrizzleConfig } = await import("./config--wXmVOoe.mjs").then((n) => n.t);
|
|
575
|
+
const configPath = writeDrizzleConfig(root, dbUrl, "postgresql");
|
|
576
|
+
R.info("Opening Drizzle Studio (remote)...");
|
|
577
|
+
try {
|
|
578
|
+
runDrizzleKit(root, [
|
|
579
|
+
"studio",
|
|
580
|
+
"--config",
|
|
581
|
+
configPath
|
|
582
|
+
]);
|
|
583
|
+
} catch {
|
|
584
|
+
process.exit(1);
|
|
585
|
+
}
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
416
588
|
if (dialect === "postgresql") {
|
|
417
589
|
const { writeDrizzleConfig } = await import("./config--wXmVOoe.mjs").then((n) => n.t);
|
|
418
590
|
const configPath = writeDrizzleConfig(root, getPgUrl(root), "postgresql");
|
|
@@ -429,7 +601,7 @@ async function runStudio(root, dialect) {
|
|
|
429
601
|
return;
|
|
430
602
|
}
|
|
431
603
|
const { writeDrizzleConfig } = await import("./config--wXmVOoe.mjs").then((n) => n.t);
|
|
432
|
-
const { getMiniflareDatabasePath } = await import("./runner-
|
|
604
|
+
const { getMiniflareDatabasePath } = await import("./runner-DLZ9E_cX.mjs");
|
|
433
605
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
434
606
|
if (!existsSync(dbPath)) {
|
|
435
607
|
R.error("No local database found. Run `void dev` first.");
|
|
@@ -649,7 +821,7 @@ async function runRenameMigrations(root, dialect) {
|
|
|
649
821
|
process.exit(1);
|
|
650
822
|
}
|
|
651
823
|
else {
|
|
652
|
-
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-
|
|
824
|
+
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-DLZ9E_cX.mjs");
|
|
653
825
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
654
826
|
if (existsSync(dbPath)) try {
|
|
655
827
|
const db = await openSqliteDatabase(dbPath);
|
|
@@ -727,7 +899,7 @@ async function runExport(root, args, dialect) {
|
|
|
727
899
|
} else process.stdout.write(output);
|
|
728
900
|
return;
|
|
729
901
|
}
|
|
730
|
-
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-
|
|
902
|
+
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-DLZ9E_cX.mjs");
|
|
731
903
|
const dbPath = getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local");
|
|
732
904
|
if (!existsSync(dbPath)) {
|
|
733
905
|
R.error("No local database found. Run `void dev` first.");
|
|
@@ -855,7 +1027,7 @@ async function runSeedModule(root, seedPath, dialect) {
|
|
|
855
1027
|
return;
|
|
856
1028
|
}
|
|
857
1029
|
const { drizzle } = await import("drizzle-orm/better-sqlite3");
|
|
858
|
-
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-
|
|
1030
|
+
const { getMiniflareDatabasePath, openSqliteDatabase } = await import("./runner-DLZ9E_cX.mjs");
|
|
859
1031
|
const sqlite = await openSqliteDatabase(getMiniflareDatabasePath(getLocalD1PersistRoot(root), "local"));
|
|
860
1032
|
try {
|
|
861
1033
|
const options = getDrizzleSchemaOptions(schema);
|