@voltro/cli 0.38.0 → 0.39.1
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/CHANGELOG.md +276 -0
- package/THIRD-PARTY-NOTICES.md +80 -45
- package/dist/{addCommand-BNeoeSxe.js → addCommand-C05L9tZh.js} +2 -2
- package/dist/addCommand-C3MdJG-a.js +2 -0
- package/dist/{agentsMd-mhQMF1bx.js → agentsMd-7zI2h5l9.js} +3 -3
- package/dist/agentsMd-BFCXh2gl.js +2 -0
- package/dist/apiBuild-BmR_bIxN.js +2 -0
- package/dist/{apiBuild-CvacV4zA.js → apiBuild-D9FB13_2.js} +3 -3
- package/dist/baselineCommand-CXv680Dc.js +2 -0
- package/dist/{baselineCommand-C6NMt-oa.js → baselineCommand-Ck2Xm8M7.js} +18 -18
- package/dist/bin.js +1 -1
- package/dist/{build-_LoTC1s0.js → build-DORV5mLM.js} +107 -100
- package/dist/{capabilitiesCommand-nq_pz5xd.js → capabilitiesCommand-D5gucwYa.js} +8 -8
- package/dist/{checkCommand-Pjk5sBl2.js → checkCommand-Bf6oMao4.js} +35 -35
- package/dist/{checkCommand-wibtQx-N.js → checkCommand-D9qK_gtA.js} +1 -1
- package/dist/{cloudCmd-NQSwe_Qk.js → cloudCmd-C42gaO8s.js} +16 -16
- package/dist/{clusterCmd-D5wsCmA_.js → clusterCmd-DrVFCzSj.js} +8 -4
- package/dist/{codegen-GYYcdpCg.js → codegen-CbpGCWLG.js} +1 -1
- package/dist/codegen-i8QGcHsi.js +2 -0
- package/dist/codegenCommand-CxOyKmc1.js +129 -0
- package/dist/{codemodRunner-CXgQ-ecJ.js → codemodRunner-D-jTyvWo.js} +622 -551
- package/dist/{commands-DaZVi9wi.js → commands-D6aW_6AR.js} +48 -48
- package/dist/{connectionConfig-UFlIEiys.js → connectionConfig-Bk9IC7D0.js} +1 -1
- package/dist/{dashboardCommand-Dxy_kmoW.js → dashboardCommand-CwTZh-XZ.js} +3 -3
- package/dist/{dataCommand-D6-Ha2lf.js → dataCommand-Cc9RiLQZ.js} +14 -11
- package/dist/{dbCommand-C4UW8cVN.js → dbCommand-DSwGv9wS.js} +50 -49
- package/dist/dbCommand-DcqEyxju.js +2 -0
- package/dist/{dev-E7Eo5GHc.js → dev-3mgc8c-H.js} +2260 -2184
- package/dist/dev-CjJAasDs.js +3 -0
- package/dist/{dialectDriver-CgXnDfec.js → dialectDriver-czCHYpeH.js} +2 -1
- package/dist/doctorCommand-Cghssndo.js +2 -0
- package/dist/{doctorCommand-gmDyALFL.js → doctorCommand-oLuzc-aC.js} +261 -244
- package/dist/{dormancyCommand-CE6wG8lj.js → dormancyCommand-Bxe4WtHU.js} +1 -1
- package/dist/{e2eCmd-BRabZww-.js → e2eCmd-uFHig1hV.js} +8 -2
- package/dist/{embeddingsCommand-C3uAuf6N.js → embeddingsCommand-CyNQkFIc.js} +6 -6
- package/dist/{envCommand-DzuWh8ya.js → envCommand-CAkSgBbh.js} +19 -19
- package/dist/{evolveCommand-DPLqcYb2.js → evolveCommand-CWhBoe_P.js} +6 -8
- package/dist/frameworkTableAssembly-DgylYh9_.js +2 -0
- package/dist/{generateCommand-DbgcUpGw.js → generateCommand-CcyvH2ve.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{infoCommand-CmczGj_l.js → infoCommand-CTo8Jnhq.js} +7 -7
- package/dist/inspect-B7U7Cl_Z.js +1192 -0
- package/dist/inspect-DUze25t0.js +2 -0
- package/dist/{inspectCmd-EHFZ9yYu.js → inspectCmd-niF97fAq.js} +5 -5
- package/dist/inspectGateHint-BjnFubmH.js +7 -0
- package/dist/{logFileSink-C_D2wRN1.js → logFileSink-B4uP8pvf.js} +1 -1
- package/dist/{logsCmd-D36xK7Zu.js → logsCmd-B6oNsfaZ.js} +10 -7
- package/dist/{manifestBuild-hpPLaGxV.js → manifestBuild-BK42hu0k.js} +1 -1
- package/dist/manifestBuild-j0n109tt.js +2 -0
- package/dist/{metaCommands-CIoQNlaQ.js → metaCommands-DUYR--Ts.js} +1 -1
- package/dist/{migrate-RwgUWXfc.js → migrate-BnPw2zC8.js} +7 -4
- package/dist/{packageCommand-Cug_3Ogl.js → packageCommand-9SVyvsSo.js} +3 -2
- package/dist/{probeCommand-BPEpwT32.js → probeCommand-C9gazU0H.js} +35 -24
- package/dist/{projectScaffold-CxgtJvlb.js → projectScaffold-BEhhHjPr.js} +1 -1
- package/dist/{projectScaffold-DDgWbNLe.js → projectScaffold-BvhLOrLq.js} +17 -15
- package/dist/{runtimeTrace-6jfznSzr.js → runtimeTrace-gNXeLf6H.js} +1 -1
- package/dist/{scheduleManifestCmd-D2x0CTTY.js → scheduleManifestCmd-kmWzrO_w.js} +6 -9
- package/dist/{sdkgen-CEJZZQUA.js → sdkgen-C8zz10-X.js} +4 -4
- package/dist/{seedRunner-ZmLSqNe2.js → seedRunner-IdHEprqf.js} +1 -4
- package/dist/serveCommand-BpK8-m1N.js +1770 -0
- package/dist/serveCommand-CW-goXvh.js +2 -0
- package/dist/serveEntry.js +2 -2
- package/dist/{serverlessCommand-CfJZy6dS.js → serverlessCommand-DbJ7Plg9.js} +3 -3
- package/dist/{start-CidwCcjl.js → start-BNuTWdRd.js} +1 -1
- package/dist/{start-RCh6qKFe.js → start-ft_KzFTd.js} +257 -254
- package/dist/startEntry.js +1 -1
- package/dist/{test-DIQ0jlkQ.js → test-CLYXrZ2F.js} +1 -1
- package/dist/{tracesCmd-DStmCJPi.js → tracesCmd-DgtgOUdi.js} +7 -4
- package/dist/{typecheckCommand-BlsWiCNq.js → typecheckCommand-BuCtT92o.js} +7 -7
- package/dist/updateCommand-6FMU2klq.js +2 -0
- package/dist/{updateCommand-CmksX7m_.js → updateCommand-CHBmCB17.js} +5 -3
- package/dist/{webDev-BKdD7c_a.js → webDev-CTpSY-e_.js} +813 -775
- package/dist/webDev-id3I5PvG.js +2 -0
- package/dist/{webhookDiscovery-D7VaeMlz.js → webhookDiscovery-CphsQe59.js} +4 -6
- package/dist/{webhookDiscovery-CrGAfhIG.js → webhookDiscovery-il9ti-HE.js} +1 -1
- package/dist/{webhooksCommand-BHeaF1ZJ.js → webhooksCommand-EccPZQZ4.js} +1 -1
- package/package.json +27 -21
- package/templates/AGENTS.md +2 -2
- package/templates/agent-docs/_index.md +2 -2
- package/templates/agent-docs/_manifest.json +2 -2
- package/templates/agent-docs/authentication.md +43 -4
- package/templates/agent-docs/cli.md +17 -13
- package/templates/agent-docs/data.md +44 -1
- package/templates/agent-docs/database/migrations.md +2 -2
- package/templates/agent-docs/database/seedsdialects.md +2 -2
- package/templates/agent-docs/deployment.md +21 -7
- package/templates/agent-docs/internationalization.md +10 -3
- package/templates/agent-docs/local-first-mobile.md +141 -20
- package/templates/agent-docs/plugins/mail.md +1 -1
- package/templates/agent-docs/plugins/ratelimit.md +1 -1
- package/templates/agent-docs/plugins.md +3 -1
- package/templates/agent-docs/releases.md +130 -1
- package/templates/agent-docs/routing.md +34 -2
- package/templates/agent-docs/templates/apibackends.md +1 -1
- package/templates/agent-docs/templates/mobile.md +1 -1
- package/templates/agent-docs/whats-new.md +26 -66
- package/templates/apps/api-ai/package.json +7 -7
- package/templates/apps/api-auth/package.json +8 -8
- package/templates/apps/api-backend/package.json +7 -7
- package/templates/apps/api-backend-deactivation/package.json +7 -7
- package/templates/apps/api-backend-mail/package.json +8 -8
- package/templates/apps/api-backend-mariadb/package.json +9 -9
- package/templates/apps/api-backend-sqlite/package.json +8 -8
- package/templates/apps/api-backend-storage/package.json +8 -8
- package/templates/apps/api-cms/package.json +10 -10
- package/templates/apps/api-collab/package.json +8 -8
- package/templates/apps/api-data-advanced/package.json +8 -8
- package/templates/apps/api-durable/package.json +8 -8
- package/templates/apps/api-durable/startup/warm.startup.tsx +16 -2
- package/templates/apps/api-feature-flags/package.json +9 -9
- package/templates/apps/api-governance/package.json +8 -8
- package/templates/apps/api-kv/package.json +8 -8
- package/templates/apps/api-moderation/package.json +8 -8
- package/templates/apps/api-observability/package.json +8 -8
- package/templates/apps/api-ratelimit/package.json +8 -8
- package/templates/apps/api-rbac/authz.ts +16 -1
- package/templates/apps/api-rbac/package.json +8 -8
- package/templates/apps/api-rest/package.json +7 -7
- package/templates/apps/api-saas/package.json +11 -11
- package/templates/apps/api-saas-starter/package.json +10 -10
- package/templates/apps/api-search/package.json +8 -8
- package/templates/apps/api-status/package.json +8 -8
- package/templates/apps/api-versioning/package.json +8 -8
- package/templates/apps/api-webhooks/package.json +9 -9
- package/templates/apps/changelog/package.json +6 -6
- package/templates/apps/edge-functions/package.json +2 -2
- package/templates/apps/frontend-admin/package.json +8 -8
- package/templates/apps/frontend-app/package.json +9 -9
- package/templates/apps/frontend-auth/package.json +8 -8
- package/templates/apps/frontend-blank/package.json +7 -7
- package/templates/apps/frontend-cms/package.json +9 -9
- package/templates/apps/frontend-collab/package.json +10 -10
- package/templates/apps/frontend-contact/package.json +7 -7
- package/templates/apps/frontend-dashboard/package.json +7 -7
- package/templates/apps/frontend-docs/package.json +7 -7
- package/templates/apps/frontend-i18n/package.json +6 -6
- package/templates/apps/frontend-landing/package.json +7 -7
- package/templates/apps/frontend-portal/package.json +8 -8
- package/templates/apps/frontend-saas/package.json +8 -8
- package/templates/apps/frontend-spa/package.json +7 -7
- package/templates/apps/frontend-ssr/package.json +7 -7
- package/templates/apps/frontend-ssr-api/package.json +8 -8
- package/templates/apps/frontend-static-blog/package.json +6 -6
- package/templates/apps/frontend-status/package.json +8 -8
- package/templates/apps/mobile-app/README.md +41 -17
- package/templates/apps/mobile-app/app.config.ts +1 -1
- package/templates/apps/mobile-app/package.json +15 -11
- package/templates/apps/mobile-app/src/app/_layout.tsx +44 -13
- package/templates/apps/mobile-app/src/app/index.tsx +1 -1
- package/templates/apps/mobile-app/src/app/settings.tsx +4 -1
- package/templates/apps/mobile-app/src/client.ts +74 -57
- package/templates/apps/mobile-app/src/lib/api.ts +4 -4
- package/templates/apps/mobile-app/src/lib/deeplinks.ts +6 -6
- package/templates/apps/mobile-app/src/persistence.ts +24 -3
- package/templates/apps/mobile-app/tsconfig.json +17 -3
- package/dist/addCommand-aXSQveak.js +0 -2
- package/dist/agentsMd-BTchIZku.js +0 -2
- package/dist/apiBuild-ttSDDOGp.js +0 -2
- package/dist/baselineCommand-Cfw2Afwm.js +0 -2
- package/dist/codegen-uYrrDzQv.js +0 -2
- package/dist/codegenCommand-C60m_LCp.js +0 -30
- package/dist/dbCommand-CC-qNzpz.js +0 -2
- package/dist/dev-CAOoXOkc.js +0 -3
- package/dist/doctorCommand-Cjl8Yii8.js +0 -2
- package/dist/frameworkTableAssembly-YyVe32Cb.js +0 -2
- package/dist/inspect-CjTYzAs_.js +0 -1190
- package/dist/inspect-P4pxoMaV.js +0 -2
- package/dist/inspectGateHint-BF6608UT.js +0 -4
- package/dist/manifestBuild-COkJoyAr.js +0 -2
- package/dist/serveCommand-DNRF2nDI.js +0 -2
- package/dist/serveCommand-DnY4VS3D.js +0 -1767
- package/dist/updateCommand-B0J_T9Vs.js +0 -2
- package/dist/webDev-CcJfdSjl2.js +0 -2
|
@@ -3,12 +3,12 @@ import { n as t, r as n } from "./nodeEnvironment-cGFAj1J8.js";
|
|
|
3
3
|
import { t as r } from "./cliError-BmdYnghb.js";
|
|
4
4
|
import { n as i } from "./appModuleLoader-C9r9mxZt.js";
|
|
5
5
|
import { a, i as o, n as s, t as c } from "./cliArgs-D4p8n7EE.js";
|
|
6
|
-
import { r as l } from "./dialectDriver-
|
|
7
|
-
import { a as u } from "./connectionConfig-
|
|
8
|
-
import { i as d, n as f, r as p, s as m, t as h } from "./seedRunner-
|
|
6
|
+
import { r as l } from "./dialectDriver-czCHYpeH.js";
|
|
7
|
+
import { a as u } from "./connectionConfig-Bk9IC7D0.js";
|
|
8
|
+
import { i as d, n as f, r as p, s as m, t as h } from "./seedRunner-IdHEprqf.js";
|
|
9
9
|
import { n as g, s as _, y as v } from "./frameworkTableAssembly-oMPBKqlE.js";
|
|
10
10
|
import { b as y, x as b } from "./fileConventions-Cof68_BL.js";
|
|
11
|
-
import {
|
|
11
|
+
import { r as ee, t as x } from "./inspectGateHint-BjnFubmH.js";
|
|
12
12
|
import { basename as te, join as S, relative as C, resolve as w } from "node:path";
|
|
13
13
|
import { promises as T, writeSync as ne } from "node:fs";
|
|
14
14
|
import { pathToFileURL as E } from "node:url";
|
|
@@ -730,19 +730,21 @@ var Ne = (e) => typeof e != "string", Pe = (e, t, n, r) => {
|
|
|
730
730
|
dialectId: n.id
|
|
731
731
|
};
|
|
732
732
|
}, Dt = async (e) => {
|
|
733
|
-
let t = H(e), n = s(e, "--id"), r = s(e, "--lifecycle"), i = await
|
|
734
|
-
if (
|
|
735
|
-
let { store:
|
|
733
|
+
let t = H(e), n = s(e, "--id"), r = s(e, "--lifecycle"), i = await V(t, b), a = await f(i, B);
|
|
734
|
+
if (a.length === 0) return B.info("no seeds found", { root: t }), 0;
|
|
735
|
+
let { store: o, dispose: c, dialectId: l } = await Et(e);
|
|
736
736
|
try {
|
|
737
|
-
|
|
737
|
+
if (n) return +((await d(a, n, o, B)).status === "failed");
|
|
738
|
+
let e = r ? a.filter((e) => e.definition.lifecycle === r) : a.filter((e) => e.definition.lifecycle === "boot");
|
|
739
|
+
return +((await p(e.map((e) => ({
|
|
738
740
|
...e,
|
|
739
741
|
definition: {
|
|
740
742
|
...e.definition,
|
|
741
743
|
lifecycle: "boot"
|
|
742
744
|
}
|
|
743
|
-
})),
|
|
745
|
+
})), o, B, { force: !0 })).filter((e) => e.status === "failed").length > 0);
|
|
744
746
|
} finally {
|
|
745
|
-
await
|
|
747
|
+
await c().catch((e) => {
|
|
746
748
|
B.warn("voltro db seed: store dispose failed", { error: String(e) });
|
|
747
749
|
});
|
|
748
750
|
}
|
|
@@ -867,9 +869,7 @@ var Ne = (e) => typeof e != "string", Pe = (e, t, n, r) => {
|
|
|
867
869
|
case "add-check":
|
|
868
870
|
n = `ALTER TABLE ${t.table} ADD CHECK (${t.column} IN (${t.values.join(", ")}))`;
|
|
869
871
|
break;
|
|
870
|
-
case "drop-check":
|
|
871
|
-
n = `ALTER TABLE ${t.table} DROP CHECK ${t.column}`;
|
|
872
|
-
break;
|
|
872
|
+
case "drop-check": n = `ALTER TABLE ${t.table} DROP CHECK ${t.column}`;
|
|
873
873
|
}
|
|
874
874
|
let r = Nt[e.classification], i = e.reason ? ` [2m# ${e.reason}[0m` : "", a = e.blocked ? `\n [31m! ${e.blocked.fix}[0m` : "";
|
|
875
875
|
return ` ${r} ${n}${i}${a}`;
|
|
@@ -952,7 +952,8 @@ var Ne = (e) => typeof e != "string", Pe = (e, t, n, r) => {
|
|
|
952
952
|
}, Q = async (e, t, n) => {
|
|
953
953
|
let r;
|
|
954
954
|
try {
|
|
955
|
-
|
|
955
|
+
let t = await _(e);
|
|
956
|
+
await J(n, v(t, (e, t) => {
|
|
956
957
|
B.info(`db apply: ${e}`, t ?? {});
|
|
957
958
|
}));
|
|
958
959
|
} catch (e) {
|
|
@@ -997,14 +998,14 @@ var Ne = (e) => typeof e != "string", Pe = (e, t, n, r) => {
|
|
|
997
998
|
return B.error(`db plan --against: ${e.message}`), 1;
|
|
998
999
|
}
|
|
999
1000
|
}
|
|
1000
|
-
let a = M({
|
|
1001
|
+
let a = await Y(await q()), o = M({
|
|
1001
1002
|
declared: r,
|
|
1002
|
-
live:
|
|
1003
|
+
live: a,
|
|
1003
1004
|
dialect: W(),
|
|
1004
1005
|
...j(),
|
|
1005
1006
|
...t === void 0 ? {} : { onlineAfter: t }
|
|
1006
1007
|
});
|
|
1007
|
-
return e.includes("--json") ? (ne(1, `${JSON.stringify(
|
|
1008
|
+
return e.includes("--json") ? (ne(1, `${JSON.stringify(o, null, 2)}\n`), o.summary.blocked > 0 ? 2 : 0) : (X(o), o.summary.blocked > 0 ? 2 : 0);
|
|
1008
1009
|
}, $ = n, Ht = async (e, t, n) => {
|
|
1009
1010
|
let r;
|
|
1010
1011
|
try {
|
|
@@ -1018,32 +1019,32 @@ var Ne = (e) => typeof e != "string", Pe = (e, t, n, r) => {
|
|
|
1018
1019
|
if (i === void 0) return B.warn("db apply --plan: no schema files found", { root: n }), 1;
|
|
1019
1020
|
let a = await q(), o = await J(a, k.SqlClient.pipe(O.flatMap((e) => fe(e, n)))).catch(() => []);
|
|
1020
1021
|
if (o.length > 0) return B.error(`db apply --plan: refusing — ${o.length} pending file-based migration(s).`), console.error(` ${o.join("\n ")}`), console.error(""), console.error(" These perform the changes a state diff cannot infer, so they change the shape"), console.error(" this plan was computed against. Apply them and regenerate the plan:"), console.error(""), console.error(" voltro db files ."), console.error(" voltro db plan --json > plan.json"), console.error(" voltro db apply --plan plan.json"), 1;
|
|
1021
|
-
let c = M({
|
|
1022
|
+
let c = await Y(a), l = M({
|
|
1022
1023
|
declared: i,
|
|
1023
|
-
live:
|
|
1024
|
+
live: c,
|
|
1024
1025
|
dialect: W(),
|
|
1025
1026
|
...j()
|
|
1026
1027
|
});
|
|
1027
|
-
if (
|
|
1028
|
-
if (
|
|
1029
|
-
let
|
|
1030
|
-
if (
|
|
1031
|
-
if (
|
|
1032
|
-
if (
|
|
1033
|
-
let e = await J(a, k.SqlClient.pipe(O.flatMap((e) => pe(e,
|
|
1028
|
+
if (l.fromFingerprint !== r.fromFingerprint) return B.error("db apply --plan: refusing — the live schema has drifted since this plan was generated."), console.error(` plan.from=${r.fromFingerprint.slice(0, 16)} live=${l.fromFingerprint.slice(0, 16)}`), console.error(" Regenerate against the current live schema: `voltro db plan --json > plan.json`"), 2;
|
|
1029
|
+
if (l.toFingerprint !== r.toFingerprint) return B.error("db apply --plan: refusing — the declared schema differs from what this plan targets."), console.error(` plan.to=${r.toFingerprint.slice(0, 16)} declared=${l.toFingerprint.slice(0, 16)}`), console.error(" The schema files changed since the plan was generated. Regenerate the plan."), 2;
|
|
1030
|
+
let u = Mt(l), d = u.plan;
|
|
1031
|
+
if (d.summary.blocked > 0 && !u.acknowledged) return X(d), B.error(`db apply --plan: refusing — ${l.summary.blocked} blocked operation(s). See the fix hints above.`), process.env.VOLTRO_DESTRUCTIVE_OK !== void 0 && (B.error(" VOLTRO_DESTRUCTIVE_OK is set but did not cover this plan — it only relaxes"), B.error(" `lossy` operations, and only the tables it names. Anything else stays refused.")), 2;
|
|
1032
|
+
if (u.acknowledged && B.warn("db apply --plan: proceeding with acknowledged lossy operation(s) (VOLTRO_DESTRUCTIVE_OK)"), Rt(d, t)) return 2;
|
|
1033
|
+
if (d.operations.length === 0) {
|
|
1034
|
+
let e = await J(a, k.SqlClient.pipe(O.flatMap((e) => pe(e, d, {
|
|
1034
1035
|
appliedBy: process.env.USER ? `cli:${process.env.USER}` : "cli:plan",
|
|
1035
1036
|
environment: $(),
|
|
1036
1037
|
source: "file"
|
|
1037
1038
|
}))));
|
|
1038
|
-
return B.info(e === "recorded" ? `db apply --plan: schema is up to date — no DDL to apply, recorded fingerprint=${
|
|
1039
|
+
return B.info(e === "recorded" ? `db apply --plan: schema is up to date — no DDL to apply, recorded fingerprint=${d.toFingerprint.slice(0, 16)} (change triggers are reconciled separately below)` : "db apply --plan: schema is up to date — no DDL to apply (change triggers are reconciled separately below)"), Q(n, i, a);
|
|
1039
1040
|
}
|
|
1040
|
-
X(
|
|
1041
|
-
let
|
|
1041
|
+
X(d);
|
|
1042
|
+
let f = s(t, "--note"), p = await J(a, k.SqlClient.pipe(O.flatMap((e) => re(e, d, {
|
|
1042
1043
|
declared: i,
|
|
1043
1044
|
appliedBy: process.env.USER ? `cli:${process.env.USER}` : "cli:plan",
|
|
1044
1045
|
environment: $(),
|
|
1045
1046
|
source: "file",
|
|
1046
|
-
...
|
|
1047
|
+
...f ? { notes: f } : {},
|
|
1047
1048
|
replan: () => O.promise(() => Y(a)).pipe(O.map((e) => M({
|
|
1048
1049
|
declared: i,
|
|
1049
1050
|
live: e,
|
|
@@ -1051,9 +1052,9 @@ var Ne = (e) => typeof e != "string", Pe = (e, t, n, r) => {
|
|
|
1051
1052
|
...j()
|
|
1052
1053
|
})))
|
|
1053
1054
|
}))));
|
|
1054
|
-
return B.info(`db apply --plan: applied ${
|
|
1055
|
-
id:
|
|
1056
|
-
fingerprint:
|
|
1055
|
+
return B.info(`db apply --plan: applied ${p.appliedOps} op(s) in ${p.durationMs}ms`, {
|
|
1056
|
+
id: p.id,
|
|
1057
|
+
fingerprint: p.fingerprint.slice(0, 16)
|
|
1057
1058
|
}), Q(n, i, a);
|
|
1058
1059
|
}, Ut = async (e) => {
|
|
1059
1060
|
let t = H(e), n = await Bt(t, e);
|
|
@@ -1070,32 +1071,32 @@ var Ne = (e) => typeof e != "string", Pe = (e, t, n, r) => {
|
|
|
1070
1071
|
if (a === void 0) return B.warn("db apply: no schema files found", { root: n }), 1;
|
|
1071
1072
|
let o = await q(), c = await sn(n, o);
|
|
1072
1073
|
if ("failed" in c) return B.error("db apply: a file-based migration FAILED — the schema diff was NOT run"), console.error(c.failed), console.error("Fix the migration and re-run. `voltro db files` runs them alone."), 1;
|
|
1073
|
-
let l = M({
|
|
1074
|
+
let l = await Y(o), u = M({
|
|
1074
1075
|
declared: a,
|
|
1075
|
-
live:
|
|
1076
|
+
live: l,
|
|
1076
1077
|
dialect: W(),
|
|
1077
1078
|
...j(),
|
|
1078
1079
|
...r === void 0 ? {} : { onlineAfter: r }
|
|
1079
1080
|
});
|
|
1080
|
-
X(
|
|
1081
|
-
let
|
|
1082
|
-
if (
|
|
1083
|
-
if (
|
|
1084
|
-
if (
|
|
1081
|
+
X(u), await Ft(u, o);
|
|
1082
|
+
let d = Mt(u), f = d.plan;
|
|
1083
|
+
if (f.summary.blocked > 0 && !d.acknowledged) return B.error(`db apply: refusing — ${f.summary.blocked} blocked operation(s). See the fix hints above.`), process.env.VOLTRO_DESTRUCTIVE_OK !== void 0 && (B.error(" VOLTRO_DESTRUCTIVE_OK is set but did not cover this plan — it only relaxes"), B.error(" `lossy` operations, and only the tables it names. Anything else stays refused.")), 2;
|
|
1084
|
+
if (d.acknowledged && B.warn(`db apply: proceeding with ${u.summary.blocked} acknowledged lossy operation(s) (VOLTRO_DESTRUCTIVE_OK)`), Rt(f, e)) return 2;
|
|
1085
|
+
if (f.operations.length === 0) {
|
|
1085
1086
|
B.info("db apply: schema is up to date — no DDL to apply (change triggers are reconciled separately below)");
|
|
1086
|
-
let t = await J(o, k.SqlClient.pipe(O.flatMap((e) => pe(e,
|
|
1087
|
+
let t = await J(o, k.SqlClient.pipe(O.flatMap((e) => pe(e, f, {
|
|
1087
1088
|
appliedBy: process.env.USER ? `cli:${process.env.USER}` : "cli:apply",
|
|
1088
1089
|
environment: $(),
|
|
1089
1090
|
source: "auto-diff"
|
|
1090
1091
|
}))));
|
|
1091
|
-
return t === "recorded" && B.info(`db apply: recorded fingerprint=${
|
|
1092
|
+
return t === "recorded" && B.info(`db apply: recorded fingerprint=${f.toFingerprint.slice(0, 16)} (0 operations)`), await tn(o), s(e, "--note") !== void 0 && t !== "recorded" && (B.warn("db apply: --note was ignored — this schema is already the latest recorded one, so there is no new history row to attach it to."), console.error("To record that the CURRENT live schema is the accepted baseline, use `voltro db drift --accept`.")), Q(n, a, o);
|
|
1092
1093
|
}
|
|
1093
|
-
let
|
|
1094
|
+
let p = s(e, "--note"), m = await J(o, k.SqlClient.pipe(O.flatMap((e) => re(e, f, {
|
|
1094
1095
|
declared: a,
|
|
1095
1096
|
appliedBy: process.env.USER ? `cli:${process.env.USER}` : "cli:user",
|
|
1096
1097
|
environment: $(),
|
|
1097
1098
|
source: "auto-diff",
|
|
1098
|
-
...
|
|
1099
|
+
...p ? { notes: p } : {},
|
|
1099
1100
|
replan: () => O.promise(() => Y(o)).pipe(O.map((e) => M({
|
|
1100
1101
|
declared: a,
|
|
1101
1102
|
live: e,
|
|
@@ -1104,9 +1105,9 @@ var Ne = (e) => typeof e != "string", Pe = (e, t, n, r) => {
|
|
|
1104
1105
|
...r === void 0 ? {} : { onlineAfter: r }
|
|
1105
1106
|
})))
|
|
1106
1107
|
}))));
|
|
1107
|
-
return B.info(`db apply: applied ${
|
|
1108
|
-
id:
|
|
1109
|
-
fingerprint:
|
|
1108
|
+
return B.info(`db apply: applied ${m.appliedOps} op(s) in ${m.durationMs}ms`, {
|
|
1109
|
+
id: m.id,
|
|
1110
|
+
fingerprint: m.fingerprint.slice(0, 16)
|
|
1110
1111
|
}), Q(n, a, o);
|
|
1111
1112
|
}, Gt = (e) => {
|
|
1112
1113
|
let t = [];
|
|
@@ -1337,10 +1338,10 @@ var Ne = (e) => typeof e != "string", Pe = (e, t, n, r) => {
|
|
|
1337
1338
|
}
|
|
1338
1339
|
}, tn = async (e) => {
|
|
1339
1340
|
try {
|
|
1340
|
-
let t =
|
|
1341
|
+
let t = await Y(e), n = le(t);
|
|
1341
1342
|
await J(e, k.SqlClient.pipe(O.flatMap((e) => e`
|
|
1342
1343
|
UPDATE ${e("_voltro_migration_plans")}
|
|
1343
|
-
SET ${e("liveFingerprint")} = ${
|
|
1344
|
+
SET ${e("liveFingerprint")} = ${n}
|
|
1344
1345
|
WHERE ${e("id")} = (
|
|
1345
1346
|
SELECT ${e("id")} FROM (
|
|
1346
1347
|
SELECT ${e("id")} FROM ${e("_voltro_migration_plans")}
|