@voltro/cli 0.31.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +163 -0
  2. package/dist/{apiBuild-CLPt-pX6.js → apiBuild-C4uEbs3s.js} +2 -2
  3. package/dist/apiBuild-OJEjtwcn.js +2 -0
  4. package/dist/bin.js +3 -3
  5. package/dist/checkCommand-CwMrzAgV.js +2 -0
  6. package/dist/{checkCommand-D7r6_pk7.js → checkCommand-dm7OHtPt.js} +328 -288
  7. package/dist/{commands-CNVVv03h.js → commands-C0nEePif.js} +53 -11
  8. package/dist/dbCommand-By__Ev0R.js +2 -0
  9. package/dist/{dbCommand-BH8GAYuf.js → dbCommand-ifOMafuG.js} +90 -82
  10. package/dist/{dev-DdQEn2Ia.js → dev-5ficNnvF.js} +1232 -1224
  11. package/dist/{dev-DOZVMVfi.js → dev-rc3fwPSZ.js} +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/{inspectMetrics-BeEAnjqw.js → inspectMetrics-BqO4E9G0.js} +757 -715
  14. package/dist/{sdkgen-v9WV8zRi.js → sdkgen-B_5mHQS2.js} +1 -1
  15. package/dist/{serveCommand-KsKXXWn4.js → serveCommand-PxMmn96o.js} +366 -366
  16. package/dist/serveEntry.js +2 -2
  17. package/dist/{start-CI2QdKy9.js → start-D1-8eKrO.js} +1 -1
  18. package/dist/startEntry.js +2 -2
  19. package/package.json +417 -17
  20. package/templates/AGENTS.md +1 -1
  21. package/templates/agent-docs/_index.md +1 -1
  22. package/templates/agent-docs/plugins/audit.md +24 -0
  23. package/templates/agent-docs/security.md +9 -0
  24. package/templates/agent-docs/whats-new.md +109 -61
  25. package/templates/apps/api-ai/package.json +7 -7
  26. package/templates/apps/api-auth/package.json +8 -8
  27. package/templates/apps/api-backend/package.json +7 -7
  28. package/templates/apps/api-backend-deactivation/package.json +7 -7
  29. package/templates/apps/api-backend-mail/package.json +8 -8
  30. package/templates/apps/api-backend-mariadb/package.json +9 -9
  31. package/templates/apps/api-backend-sqlite/package.json +8 -8
  32. package/templates/apps/api-backend-storage/package.json +8 -8
  33. package/templates/apps/api-cms/package.json +10 -10
  34. package/templates/apps/api-collab/package.json +8 -8
  35. package/templates/apps/api-data-advanced/package.json +8 -8
  36. package/templates/apps/api-durable/package.json +8 -8
  37. package/templates/apps/api-feature-flags/package.json +9 -9
  38. package/templates/apps/api-governance/package.json +8 -8
  39. package/templates/apps/api-kv/package.json +8 -8
  40. package/templates/apps/api-moderation/package.json +8 -8
  41. package/templates/apps/api-observability/package.json +8 -8
  42. package/templates/apps/api-ratelimit/package.json +8 -8
  43. package/templates/apps/api-rbac/package.json +8 -8
  44. package/templates/apps/api-rest/package.json +7 -7
  45. package/templates/apps/api-saas/package.json +11 -11
  46. package/templates/apps/api-saas-starter/package.json +10 -10
  47. package/templates/apps/api-search/package.json +8 -8
  48. package/templates/apps/api-status/package.json +8 -8
  49. package/templates/apps/api-versioning/package.json +8 -8
  50. package/templates/apps/api-webhooks/package.json +9 -9
  51. package/templates/apps/changelog/package.json +6 -6
  52. package/templates/apps/edge-functions/package.json +2 -2
  53. package/templates/apps/frontend-admin/package.json +8 -8
  54. package/templates/apps/frontend-app/package.json +8 -8
  55. package/templates/apps/frontend-auth/package.json +8 -8
  56. package/templates/apps/frontend-blank/package.json +7 -7
  57. package/templates/apps/frontend-cms/package.json +9 -9
  58. package/templates/apps/frontend-collab/package.json +9 -9
  59. package/templates/apps/frontend-contact/package.json +7 -7
  60. package/templates/apps/frontend-dashboard/package.json +7 -7
  61. package/templates/apps/frontend-docs/package.json +7 -7
  62. package/templates/apps/frontend-i18n/package.json +6 -6
  63. package/templates/apps/frontend-landing/package.json +7 -7
  64. package/templates/apps/frontend-portal/package.json +8 -8
  65. package/templates/apps/frontend-saas/package.json +8 -8
  66. package/templates/apps/frontend-spa/package.json +7 -7
  67. package/templates/apps/frontend-ssr/package.json +7 -7
  68. package/templates/apps/frontend-ssr-api/package.json +8 -8
  69. package/templates/apps/frontend-static-blog/package.json +6 -6
  70. package/templates/apps/frontend-status/package.json +8 -8
  71. package/templates/apps/mobile-app/package.json +2 -2
  72. package/dist/apiBuild-BOqL1dlg.js +0 -2
  73. package/dist/checkCommand-ClRvH_SN.js +0 -2
  74. package/dist/dbCommand-BwQ_Jl98.js +0 -2
@@ -10,17 +10,17 @@ import { createLogger as _ } from "@voltro/logger";
10
10
  import { promises as v, writeSync as y } from "node:fs";
11
11
  import { InMemoryDataStore as ee } from "@voltro/runtime";
12
12
  import { SqlClient as b } from "@effect/sql";
13
- import { actorsTable as te, frameworkTables as x, isMigrationDefinition as ne, quoteIdent as S, registerCoreTables as re } from "@voltro/database";
13
+ import { actorsTable as te, frameworkTables as x, isMigrationDefinition as S, quoteIdent as ne, registerCoreTables as re } from "@voltro/database";
14
14
  import { createHash as ie } from "node:crypto";
15
- import { DEFAULT_CDC_CHANNEL as ae, applyPlan as C, applySchema as w, assessRollingDeployGate as oe, declaredSnapshot as se, destructiveScope as ce, detectReactiveTriggerDrift as le, fingerprintSchema as T, ignoreTablesFromEnv as E, introspectSchema as ue, pendingFileMigrationIds as de, planMigrations as D, reactiveTriggerRepairSql as fe, rollbackFileBasedMigration as pe, rollingDeployUnsafeOps as me, runFileBasedMigrations as he, shortFingerprint as O, squashMigrationPlans as ge, unblockLossy as _e } from "@voltro/database/sql";
15
+ import { DEFAULT_CDC_CHANNEL as ae, applyPlan as oe, applySchema as C, assessRollingDeployGate as se, declaredSnapshot as ce, destructiveScope as le, detectReactiveTriggerDrift as ue, fingerprintSchema as w, ignoreTablesFromEnv as T, introspectSchema as de, pendingFileMigrationIds as fe, planMigrations as E, reactiveTriggerRepairSql as pe, rollbackFileBasedMigration as me, rollingDeployUnsafeOps as he, runFileBasedMigrations as ge, shortFingerprint as D, squashMigrationPlans as _e, unblockLossy as ve } from "@voltro/database/sql";
16
16
  //#region src/cliError.ts
17
- var k = class extends Error {
17
+ var O = class extends Error {
18
18
  isCliError = !0;
19
19
  code;
20
20
  constructor(e, t = 1) {
21
21
  super(e), this.name = "CliError", this.code = t;
22
22
  }
23
- }, ve = (e) => typeof e == "object" && !!e && e.isCliError === !0, ye = (e) => typeof e != "string", be = (e, t, n, r) => {
23
+ }, ye = (e) => typeof e == "object" && !!e && e.isCliError === !0, be = (e) => typeof e != "string", xe = (e, t, n, r) => {
24
24
  let i = [], a = new Map(t.map((e) => [e.name, e])), o = new Map(n.map((e) => [e.name, e])), s = new Set(e.leaveUnset ?? []);
25
25
  r > 0 && i.push({
26
26
  kind: "target-not-empty",
@@ -37,7 +37,7 @@ var k = class extends Error {
37
37
  });
38
38
  continue;
39
39
  }
40
- if (ye(n)) {
40
+ if (be(n)) {
41
41
  c.push({
42
42
  target: t,
43
43
  source: n.expr,
@@ -80,23 +80,23 @@ var k = class extends Error {
80
80
  remintIds: f,
81
81
  fatal: i.some((e) => e.fatal)
82
82
  };
83
- }, xe = (e, t) => [
83
+ }, Se = (e, t) => [
84
84
  `back up '${e.from}' to a restorable dump`,
85
85
  `copy rows: INSERT INTO ${e.into} (${t.assignments.map((e) => e.target).join(", ")}) SELECT … FROM ${e.from}`,
86
86
  ...t.remintIds ? ["record old id → new id in a translation table", `rewrite every reference to '${e.from}', JSON columns included`] : [],
87
87
  "verify: row counts match and a sample round-trips",
88
88
  `drop '${e.from}' — LAST, and only after the verify`
89
- ], Se = (e, t, n) => {
89
+ ], Ce = (e, t, n) => {
90
90
  let r = [`adopt · ${e.from} (${n} row(s)) → ${e.into}`, ""];
91
91
  for (let e of t.assignments) r.push(` ${e.target.padEnd(24)} ← ${e.raw ? `${e.source} (raw)` : e.source}`);
92
92
  t.problems.length > 0 && r.push("");
93
93
  for (let e of t.problems) r.push(` ${e.fatal ? "✗" : "⚠"} ${e.detail}`);
94
94
  if (r.push(""), t.fatal) return r.push(" REFUSED — fix the problems above. Nothing was written."), r;
95
95
  r.push(" would run, in this order:");
96
- for (let [n, i] of xe(e, t).entries()) r.push(` ${n + 1}. ${i}`);
96
+ for (let [n, i] of Se(e, t).entries()) r.push(` ${n + 1}. ${i}`);
97
97
  return r;
98
- }, Ce = (e) => e === "mysql" || e === "mariadb" ? (e) => `\`${e}\`` : e === "mssql" ? (e) => `[${e}]` : (e) => `"${e}"`, we = (e) => `${e}__adopt_snapshot`, Te = (e, t, n, r, i) => {
99
- let a = Ce(n), o = we(e.from), s = t.assignments.map((e) => e.target), c = t.assignments.map((e) => e.raw ? e.source : a(e.source));
98
+ }, we = (e) => e === "mysql" || e === "mariadb" ? (e) => `\`${e}\`` : e === "mssql" ? (e) => `[${e}]` : (e) => `"${e}"`, Te = (e) => `${e}__adopt_snapshot`, Ee = (e, t, n, r, i) => {
99
+ let a = we(n), o = Te(e.from), s = t.assignments.map((e) => e.target), c = t.assignments.map((e) => e.raw ? e.source : a(e.source));
100
100
  return i !== void 0 && (s.unshift(r), c.unshift(i)), {
101
101
  snapshot: n === "mssql" ? `SELECT * INTO ${a(o)} FROM ${a(e.from)}` : `CREATE TABLE ${a(o)} AS SELECT * FROM ${a(e.from)}`,
102
102
  copy: `INSERT INTO ${a(e.into)} (${s.map(a).join(", ")}) SELECT ${c.join(", ")} FROM ${a(e.from)}`,
@@ -106,18 +106,18 @@ var k = class extends Error {
106
106
  drop: `DROP TABLE ${a(e.from)}`,
107
107
  dropSnapshot: `DROP TABLE ${a(o)}`
108
108
  };
109
- }, A = (e) => {
109
+ }, De = (e) => {
110
110
  let t = e[0];
111
111
  if (t === void 0) return 0;
112
112
  let n = t.n ?? t.N ?? Object.values(t)[0];
113
113
  return Number(n ?? 0);
114
- }, Ee = async (e, t, n, r, i, a, o = {}) => {
114
+ }, Oe = async (e, t, n, r, i, a, o = {}) => {
115
115
  if (t.fatal) throw Error("adopt: the plan was refused — nothing was run");
116
- let s = Te(e, t, n, r, i), c = we(e.from), l = A(await a(s.verifySource));
116
+ let s = Ee(e, t, n, r, i), c = Te(e.from), l = De(await a(s.verifySource));
117
117
  await a(s.snapshot);
118
118
  for (let e of s.translations) await a(e);
119
119
  await a(s.copy);
120
- let u = A(await a(s.verifyTarget));
120
+ let u = De(await a(s.verifyTarget));
121
121
  return u === l ? o.keepSource === !0 ? {
122
122
  copied: u,
123
123
  sourceRows: l,
@@ -137,7 +137,7 @@ var k = class extends Error {
137
137
  snapshotTable: c,
138
138
  sourceDropped: !1
139
139
  };
140
- }, De = [
140
+ }, k = [
141
141
  "token",
142
142
  "secret",
143
143
  "password",
@@ -146,7 +146,7 @@ var k = class extends Error {
146
146
  "credential",
147
147
  "privatekey",
148
148
  "private_key"
149
- ], Oe = [
149
+ ], ke = [
150
150
  {
151
151
  table: "_voltro_audit_log",
152
152
  column: "subject"
@@ -191,7 +191,7 @@ var k = class extends Error {
191
191
  table: "_voltro_row_history",
192
192
  column: "subjectId"
193
193
  }
194
- ], ke = (e, t) => {
194
+ ], Ae = (e, t) => {
195
195
  switch (t) {
196
196
  case "postgres": return `LOWER(CAST(${e} AS text))`;
197
197
  case "mysql":
@@ -200,7 +200,7 @@ var k = class extends Error {
200
200
  case "sqlite":
201
201
  case "turso": return `LOWER(CAST(${e} AS TEXT))`;
202
202
  }
203
- }, Ae = (e, t, n = De) => n.map((n) => `${ke(e, t)} LIKE '%${n}%'`).join("\n OR "), je = async (e, t) => {
203
+ }, je = (e, t, n = k) => n.map((n) => `${Ae(e, t)} LIKE '%${n}%'`).join("\n OR "), A = async (e, t) => {
204
204
  let n = await g.runPromise(e.unsafe(t));
205
205
  return Number(Object.values(n[0] ?? { n: 0 })[0] ?? 0);
206
206
  }, Me = async (e, t, n, r) => {
@@ -208,7 +208,7 @@ var k = class extends Error {
208
208
  for (let a of n) {
209
209
  let n = r(a.table), o;
210
210
  try {
211
- o = await je(e, `SELECT COUNT(*) AS n FROM ${n}`);
211
+ o = await A(e, `SELECT COUNT(*) AS n FROM ${n}`);
212
212
  } catch {
213
213
  i.push({
214
214
  table: a.table,
@@ -220,12 +220,20 @@ var k = class extends Error {
220
220
  continue;
221
221
  }
222
222
  try {
223
- let s = await je(e, `SELECT COUNT(*) AS n FROM ${n}\n WHERE ${Ae(r(a.column), t)}`);
223
+ let s = await A(e, `SELECT COUNT(*) AS n FROM ${n}\n WHERE ${je(r(a.column), t)}`), c = [];
224
+ if (s > 0) for (let i of k) try {
225
+ let o = await A(e, `SELECT COUNT(*) AS n FROM ${n}\n WHERE ${je(r(a.column), t, [i])}`);
226
+ o > 0 && c.push({
227
+ needle: i,
228
+ rows: o
229
+ });
230
+ } catch {}
224
231
  i.push({
225
232
  table: a.table,
226
233
  column: a.column,
227
234
  scanned: o,
228
- hits: s
235
+ hits: s,
236
+ matchedNeedles: c
229
237
  });
230
238
  } catch {
231
239
  i.push({
@@ -239,25 +247,25 @@ var k = class extends Error {
239
247
  }
240
248
  return i;
241
249
  }, Ne = (e, t) => {
242
- let n = [`credential scan · dialect ${t}`, ""], r = /* @__PURE__ */ new Set();
250
+ let n = k.length, r = [`credential scan · dialect ${t}`, ""], i = /* @__PURE__ */ new Set();
243
251
  for (let t of e) {
244
252
  if (t.unavailable === "column") {
245
- n.push(` · ${t.table}.${t.column} — column is not present on this deployment (${t.scanned} row(s) exist but this column was not scanned)`);
253
+ r.push(` · ${t.table}.${t.column} — column is not present on this deployment (${t.scanned} row(s) exist but this column was not scanned)`);
246
254
  continue;
247
255
  }
248
256
  if (t.scanned === void 0) {
249
- r.has(t.table) || (r.add(t.table), n.push(` · ${t.table} — table not present (nothing scanned)`));
257
+ i.has(t.table) || (i.add(t.table), r.push(` · ${t.table} — table not present (nothing scanned)`));
250
258
  continue;
251
259
  }
252
260
  if (t.scanned === 0) {
253
- n.push(` · ${t.table} — table is EMPTY (0 rows scanned; this is not a clean bill of health)`);
261
+ r.push(` · ${t.table} — table is EMPTY (0 rows scanned; this is not a clean bill of health)`);
254
262
  continue;
255
263
  }
256
264
  let e = (t.hits ?? 0) > 0 ? "✗" : "✓";
257
- n.push(` ${e} ${t.table}.${t.column} — ${t.hits} of ${t.scanned} row(s) match a credential-shaped key`);
265
+ r.push(` ${e} ${t.table}.${t.column} — ${t.hits} of ${t.scanned} row(s) match a credential-shaped key`), (t.matchedNeedles?.length ?? 0) > 0 && r.push(` matched (rows per needle, may overlap): ${t.matchedNeedles.map((e) => `${e.needle} (${e.rows})`).join(", ")}`);
258
266
  }
259
- let i = e.reduce((e, t) => e + (t.hits ?? 0), 0);
260
- return n.push(""), i > 0 ? n.push(` ${i} row(s) carry something credential-shaped.`, " Purge them AND rotate the credentials — assume anything written to a log", " table has been read. Then stop putting the credential on the Subject:", " `connectionCredentials(...)` keeps it in the framework vault.") : e.every((e) => e.scanned === void 0 || e.scanned === 0 || e.unavailable !== void 0) ? n.push(" NOTHING WAS SCANNED. This run proves nothing about your data.") : n.push(" No credential-shaped keys found in the rows that exist."), n.push("", " Run this on EVERY environment. A dev database is not a sample of production."), n.join("\n");
267
+ let a = e.reduce((e, t) => e + (t.hits ?? 0), 0);
268
+ return r.push(""), a > 0 ? r.push(` ${a} row(s) carry something credential-shaped.`, " Purge them AND rotate the credentials — assume anything written to a log", " table has been read. Then stop putting the credential on the Subject:", " `connectionCredentials(...)` keeps it in the framework vault.") : e.every((e) => e.scanned === void 0 || e.scanned === 0 || e.unavailable !== void 0) ? r.push(" NOTHING WAS SCANNED. This run proves nothing about your data.") : r.push(" No credential-shaped keys found in the rows that exist."), r.push("", ` These are NAME heuristics (${n} of them), not proof. A credential in a`, " column whose key is not credential-shaped — `keyValue`, `pat`, `authz` —", " is invisible here. A clean run means \"no credential-SHAPED key found\",", " which is not the same as \"no credential\".", "", " Run this on EVERY environment. A dev database is not a sample of production."), r.join("\n");
261
269
  }, Pe = (e) => e.some((e) => (e.hits ?? 0) > 0) ? 1 : e.every((e) => e.unavailable !== void 0 || e.scanned === void 0 || e.scanned === 0) ? 2 : 0, j = /\.migration\.ts$/, M = async (e, t) => {
262
270
  let n = [];
263
271
  for (let r of e) {
@@ -268,7 +276,7 @@ var k = class extends Error {
268
276
  t.warn("migration: failed to import", { file: r }, e);
269
277
  continue;
270
278
  }
271
- let i = (e.default && ne(e.default) ? e.default : void 0) ?? Object.values(e).find(ne);
279
+ let i = (e.default && S(e.default) ? e.default : void 0) ?? Object.values(e).find(S);
272
280
  if (!i) {
273
281
  t.warn("migration: no defineMigration export", { file: r });
274
282
  continue;
@@ -288,7 +296,7 @@ var k = class extends Error {
288
296
  return [...n].sort((e, t) => e.definition.id < t.definition.id ? -1 : 1);
289
297
  }, N = (e) => {
290
298
  let t = (process.env.DB_DIALECT ?? "postgres").toLowerCase(), n = t === "memory" ? "postgres" : t;
291
- return g.runPromise(w(x, n).pipe(g.provide(e)));
299
+ return g.runPromise(C(x, n).pipe(g.provide(e)));
292
300
  }, P = (e) => g.runPromise(g.gen(function* () {
293
301
  let e = yield* (yield* b.SqlClient)`SELECT id, status, hash, "appliedAt" FROM "_voltro_migrations"`.pipe(g.orElseSucceed(() => []));
294
302
  return new Map(e.map((e) => [e.id, e]));
@@ -560,9 +568,9 @@ var k = class extends Error {
560
568
  return /ERR_OUT_OF_RANGE|out of range/i.test(n) && /pg-protocol|parseDataRow|buffer-reader|BufferReader/i.test(n);
561
569
  }, U = "Live-DB introspection got a corrupt / misaligned response from the database. This happens when `voltro db plan` / `apply` / `drift` / `migrate` runs through a connection POOLER (Supabase Supavisor / PgBouncer) on a LARGE schema — the pooler mis-frames a big catalog response. The introspection already batches by table to keep responses small; if a batch still trips it:\n 1. Lower the batch: set `VOLTRO_INTROSPECT_BATCH` to a smaller number of tables (default 20 — try 5 or 1). This keeps `db plan` on the normal pooler, no direct connection needed.\n 2. Or use a DIRECT (non-pooler) connection: set `DB_DIRECT_URL` (or `DB_MIGRATE_URL`) to the direct database URL — the runtime keeps `DB_URL`, so only the migration path is affected. (Supabase: direct = `db.<project-ref>.supabase.co` [IPv6-only on newer projects]; pooler = `aws-0-<region>.pooler.supabase.com`.)", W = () => {
562
570
  let e = (process.env.DB_DIALECT ?? "postgres").toLowerCase();
563
- if (e === "memory") throw new k("voltro db: subcommands require a real dialect, not DB_DIALECT=memory.");
571
+ if (e === "memory") throw new O("voltro db: subcommands require a real dialect, not DB_DIALECT=memory.");
564
572
  return e;
565
- }, G = (e) => S(e, W()), K = (e) => e === "mysql" || e === "mariadb" ? "table_schema = DATABASE()" : e === "mssql" ? "table_schema = SCHEMA_NAME()" : "table_schema = 'public'", q = async () => (await r(W())).makeSqlLayer(V()), Re = async (e) => {
573
+ }, G = (e) => ne(e, W()), K = (e) => e === "mysql" || e === "mariadb" ? "table_schema = DATABASE()" : e === "mssql" ? "table_schema = SCHEMA_NAME()" : "table_schema = 'public'", q = async () => (await r(W())).makeSqlLayer(V()), Re = async (e) => {
566
574
  let t = B(e), n = e.includes("--dry-run"), r = await M(await z(t, j), R);
567
575
  if (r.length === 0) return R.info("no migrations found", { root: t }), 0;
568
576
  if (n) {
@@ -667,19 +675,19 @@ var k = class extends Error {
667
675
  }
668
676
  return [...t.values()];
669
677
  }, qe = (e) => {
670
- let t = ce(process.env.VOLTRO_DESTRUCTIVE_OK);
678
+ let t = le(process.env.VOLTRO_DESTRUCTIVE_OK);
671
679
  if (t === void 0 || !e.operations.filter((e) => e.blocked).every((e) => e.classification === "lossy")) return {
672
680
  plan: e,
673
681
  acknowledged: !1
674
682
  };
675
- let n = _e(e, t);
683
+ let n = ve(e, t);
676
684
  return {
677
685
  plan: n,
678
686
  acknowledged: !n.operations.some((e) => e.blocked)
679
687
  };
680
688
  }, J = async (e, t) => g.runPromise(t.pipe(g.provide(e))), Y = async (e) => {
681
689
  try {
682
- return await J(e, b.SqlClient.pipe(g.flatMap(ue)));
690
+ return await J(e, b.SqlClient.pipe(g.flatMap(de)));
683
691
  } catch (e) {
684
692
  let t = String(e?.message ?? e);
685
693
  if (H(e) || /connection error/i.test(t)) {
@@ -771,7 +779,7 @@ var k = class extends Error {
771
779
  if (i === void 0 || a === void 0) continue;
772
780
  let o = 0;
773
781
  try {
774
- let e = await J(t, b.SqlClient.pipe(g.flatMap((e) => e.unsafe(`SELECT COUNT(*) AS n FROM ${S(i, W())}`))));
782
+ let e = await J(t, b.SqlClient.pipe(g.flatMap((e) => e.unsafe(`SELECT COUNT(*) AS n FROM ${ne(i, W())}`))));
775
783
  o = Number(Object.values(e[0] ?? { n: 0 })[0] ?? 0);
776
784
  } catch {
777
785
  continue;
@@ -787,11 +795,11 @@ var k = class extends Error {
787
795
  if (W() !== "postgres") return;
788
796
  let n = ae, r;
789
797
  try {
790
- r = await J(t, b.SqlClient.pipe(g.flatMap((t) => le(t, e, n))));
798
+ r = await J(t, b.SqlClient.pipe(g.flatMap((t) => ue(t, e, n))));
791
799
  } catch {
792
800
  return;
793
801
  }
794
- let i = fe({
802
+ let i = pe({
795
803
  tables: e,
796
804
  dialect: "postgres",
797
805
  missing: r.missing,
@@ -815,17 +823,17 @@ var k = class extends Error {
815
823
  for (let t of e.operations) console.log(Ye(t));
816
824
  console.log(), console.log(` safe: ${t.safe} needs-default: ${t.needsDefault} needs-backfill: ${t.needsBackfill}`), console.log(` rename: ${t.needsRenameAnnotation} lossy: ${t.lossy} blocked: ${t.blocked}`), console.log(` fingerprint: ${e.fromFingerprint.slice(0, 16)} → ${e.toFingerprint.slice(0, 16)}\n`), Ze(e);
817
825
  }, Ze = (e) => {
818
- let t = me(e.operations);
826
+ let t = he(e.operations);
819
827
  if (t.length !== 0) {
820
828
  console.log(` ⚠ ${t.length} operation(s) UNSAFE under a rolling deploy`), console.log(" (old + new instances overlap → old code breaks against the new schema):");
821
829
  for (let e of t) console.log(` • ${e.op.op.kind}: ${e.reason}`), console.log(` → ${e.remedy}`);
822
830
  console.log(" Deploy with a maintenance window / scale-to-zero, or split into"), console.log(" expand → deploy → contract. See docs: deployment/production-hardening.\n");
823
831
  }
824
832
  }, Qe = (e, t) => {
825
- let n = oe({
833
+ let n = se({
826
834
  enabled: process.env.VOLTRO_ROLLING_DEPLOY === "1",
827
835
  forced: t.includes("--force"),
828
- unsafeCount: me(e.operations).length
836
+ unsafeCount: he(e.operations).length
829
837
  });
830
838
  return n.refuse ? (R.error(`db apply: ${n.message}`), !0) : (n.warnForced && R.warn(`db apply: ${n.message}`), !1);
831
839
  }, $e = (e) => {
@@ -858,11 +866,11 @@ var k = class extends Error {
858
866
  if (!i.ok) return R.error(`db plan --against: remote returned ${i.status}`, { url: e }), 1;
859
867
  let a = (await i.json()).drift?.liveSnapshot;
860
868
  if (!a) return R.error("db plan --against: remote inspect payload missing drift.liveSnapshot", { url: e }), 1;
861
- let s = D({
869
+ let s = E({
862
870
  declared: r,
863
871
  live: a,
864
872
  dialect: W(),
865
- ...E(),
873
+ ...T(),
866
874
  ...t === void 0 ? {} : { onlineAfter: t }
867
875
  });
868
876
  return console.log(`\n[--against ${e}] — diff vs remote live schema:\n`), Z(s), s.summary.blocked > 0 ? 2 : 0;
@@ -870,11 +878,11 @@ var k = class extends Error {
870
878
  return R.error(`db plan --against: ${e.message}`), 1;
871
879
  }
872
880
  }
873
- let a = D({
881
+ let a = E({
874
882
  declared: r,
875
883
  live: await Y(await q()),
876
884
  dialect: W(),
877
- ...E(),
885
+ ...T(),
878
886
  ...t === void 0 ? {} : { onlineAfter: t }
879
887
  });
880
888
  return e.includes("--json") ? (y(1, `${JSON.stringify(a, null, 2)}\n`), a.summary.blocked > 0 ? 2 : 0) : (Z(a), a.summary.blocked > 0 ? 2 : 0);
@@ -890,14 +898,14 @@ var k = class extends Error {
890
898
  let i = await Q(n);
891
899
  if (i === void 0) return R.warn("db apply --plan: no schema files found", { root: n }), 1;
892
900
  let a = await q();
893
- await J(a, w(x, W()));
894
- let o = await J(a, b.SqlClient.pipe(g.flatMap((e) => de(e, n)))).catch(() => []);
901
+ await J(a, C(x, W()));
902
+ let o = await J(a, b.SqlClient.pipe(g.flatMap((e) => fe(e, n)))).catch(() => []);
895
903
  if (o.length > 0) return R.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;
896
- let s = D({
904
+ let s = E({
897
905
  declared: i,
898
906
  live: await Y(a),
899
907
  dialect: W(),
900
- ...E()
908
+ ...T()
901
909
  });
902
910
  if (s.fromFingerprint !== r.fromFingerprint) return R.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=${s.fromFingerprint.slice(0, 16)}`), console.error(" Regenerate against the current live schema: `voltro db plan --json > plan.json`"), 2;
903
911
  if (s.toFingerprint !== r.toFingerprint) return R.error("db apply --plan: refusing — the declared schema differs from what this plan targets."), console.error(` plan.to=${r.toFingerprint.slice(0, 16)} declared=${s.toFingerprint.slice(0, 16)}`), console.error(" The schema files changed since the plan was generated. Regenerate the plan."), 2;
@@ -906,17 +914,17 @@ var k = class extends Error {
906
914
  if (c.acknowledged && R.warn("db apply --plan: proceeding with acknowledged lossy operation(s) (VOLTRO_DESTRUCTIVE_OK)"), Qe(u, t)) return 2;
907
915
  if (u.operations.length === 0) return R.info("db apply --plan: schema is up to date — no DDL to apply (change triggers are reconciled separately below)"), await X(i, a), 0;
908
916
  Z(u);
909
- let d = (process.env.NODE_ENV ?? "dev").toLowerCase(), f = l(t, "--note"), p = await J(a, b.SqlClient.pipe(g.flatMap((e) => C(e, u, {
917
+ let d = (process.env.NODE_ENV ?? "dev").toLowerCase(), f = l(t, "--note"), p = await J(a, b.SqlClient.pipe(g.flatMap((e) => oe(e, u, {
910
918
  declared: i,
911
919
  appliedBy: process.env.USER ? `cli:${process.env.USER}` : "cli:plan",
912
920
  environment: d === "production" ? "prod" : d === "staging" ? "staging" : "dev",
913
921
  source: "file",
914
922
  ...f ? { notes: f } : {},
915
- replan: () => g.promise(() => Y(a)).pipe(g.map((e) => D({
923
+ replan: () => g.promise(() => Y(a)).pipe(g.map((e) => E({
916
924
  declared: i,
917
925
  live: e,
918
926
  dialect: W(),
919
- ...E()
927
+ ...T()
920
928
  })))
921
929
  }))));
922
930
  return R.info(`db apply --plan: applied ${p.appliedOps} op(s) in ${p.durationMs}ms`, {
@@ -931,12 +939,12 @@ var k = class extends Error {
931
939
  if (i === void 0) return R.warn("db apply: no schema files found", { root: t }), 1;
932
940
  let a = await q(), o = await dt(t, a);
933
941
  if ("failed" in o) return R.error("db apply: a file-based migration FAILED — the schema diff was NOT run"), console.error(o.failed), console.error("Fix the migration and re-run. `voltro db files` runs them alone."), 1;
934
- await J(a, w(x, W()));
935
- let s = D({
942
+ await J(a, C(x, W()));
943
+ let s = E({
936
944
  declared: i,
937
945
  live: await Y(a),
938
946
  dialect: W(),
939
- ...E(),
947
+ ...T(),
940
948
  ...n === void 0 ? {} : { onlineAfter: n }
941
949
  });
942
950
  Z(s), await Xe(s, a);
@@ -944,17 +952,17 @@ var k = class extends Error {
944
952
  if (u.summary.blocked > 0 && !c.acknowledged) return R.error(`db apply: refusing — ${u.summary.blocked} blocked operation(s). See the fix hints above.`), process.env.VOLTRO_DESTRUCTIVE_OK !== void 0 && (R.error(" VOLTRO_DESTRUCTIVE_OK is set but did not cover this plan — it only relaxes"), R.error(" `lossy` operations, and only the tables it names. Anything else stays refused.")), 2;
945
953
  if (c.acknowledged && R.warn(`db apply: proceeding with ${s.summary.blocked} acknowledged lossy operation(s) (VOLTRO_DESTRUCTIVE_OK)`), Qe(u, e)) return 2;
946
954
  if (u.operations.length === 0) return R.info("db apply: schema is up to date — no DDL to apply (change triggers are reconciled separately below)"), await st(a), l(e, "--note") !== void 0 && (R.warn("db apply: --note was ignored — an empty plan writes no history row to attach it to."), console.error("To record that the CURRENT live schema is the accepted baseline, use `voltro db drift --accept`.")), await X(i, a), 0;
947
- let d = l(e, "--note"), f = await J(a, b.SqlClient.pipe(g.flatMap((e) => C(e, u, {
955
+ let d = l(e, "--note"), f = await J(a, b.SqlClient.pipe(g.flatMap((e) => oe(e, u, {
948
956
  declared: i,
949
957
  appliedBy: process.env.USER ? `cli:${process.env.USER}` : "cli:user",
950
958
  environment: (process.env.NODE_ENV ?? "dev").toLowerCase() === "staging" ? "staging" : "dev",
951
959
  source: "auto-diff",
952
960
  ...d ? { notes: d } : {},
953
- replan: () => g.promise(() => Y(a)).pipe(g.map((e) => D({
961
+ replan: () => g.promise(() => Y(a)).pipe(g.map((e) => E({
954
962
  declared: i,
955
963
  live: e,
956
964
  dialect: W(),
957
- ...E(),
965
+ ...T(),
958
966
  ...n === void 0 ? {} : { onlineAfter: n }
959
967
  })))
960
968
  }))));
@@ -978,7 +986,7 @@ var k = class extends Error {
978
986
  try {
979
987
  t = JSON.parse(ct(e.operations)).length;
980
988
  } catch {}
981
- console.log(` ${e.id} fp=${O(e.fingerprint)} env=${e.environment} src=${e.source} ${t} op(s) ${e.durationMs}ms ${$(e.appliedAt)} by=${e.appliedBy}`), e.notes && console.log(` [2mnote: ${e.notes}[0m`);
989
+ console.log(` ${e.id} fp=${D(e.fingerprint)} env=${e.environment} src=${e.source} ${t} op(s) ${e.durationMs}ms ${$(e.appliedAt)} by=${e.appliedBy}`), e.notes && console.log(` [2mnote: ${e.notes}[0m`);
982
990
  }
983
991
  return console.log(), 0;
984
992
  }, it = async (e) => {
@@ -1064,22 +1072,22 @@ var k = class extends Error {
1064
1072
  if (Number.isNaN(new Date(n).getTime())) return console.error(`voltro db squash: --before '${n}' is not a valid ISO date`), 2;
1065
1073
  let r = l(e, "--note"), i = B(e), a = await Q(i);
1066
1074
  if (a === void 0) return R.warn("db squash: no schema files found", { root: i }), 1;
1067
- let o = T(se(a)), s = await q();
1075
+ let o = w(ce(a)), s = await q();
1068
1076
  try {
1069
- let e = await J(s, ge({
1077
+ let e = await J(s, _e({
1070
1078
  before: n,
1071
1079
  fingerprint: o,
1072
1080
  appliedBy: process.env.USER ?? "cli",
1073
1081
  environment: process.env.NODE_ENV === "production" ? "prod" : "dev",
1074
1082
  ...r === void 0 ? {} : { note: r }
1075
1083
  }));
1076
- return console.log(`\n✓ squashed ${e.squashedCount} migration plan(s)\n snapshot id: ${e.snapshotId}\n fingerprint: ${O(e.snapshotFingerprint)}\n`), 0;
1084
+ return console.log(`\n✓ squashed ${e.squashedCount} migration plan(s)\n snapshot id: ${e.snapshotId}\n fingerprint: ${D(e.snapshotFingerprint)}\n`), 0;
1077
1085
  } catch (e) {
1078
1086
  return console.error(`squash refused: ${e.message}`), 1;
1079
1087
  }
1080
1088
  }, st = async (e) => {
1081
1089
  try {
1082
- let t = T(await Y(e));
1090
+ let t = w(await Y(e));
1083
1091
  await J(e, b.SqlClient.pipe(g.flatMap((e) => e`
1084
1092
  UPDATE ${e("_voltro_migration_plans")}
1085
1093
  SET ${e("liveFingerprint")} = ${t}
@@ -1106,19 +1114,19 @@ var k = class extends Error {
1106
1114
  SELECT * FROM ${e("_voltro_migration_plans")}
1107
1115
  ORDER BY ${e("appliedAt")} DESC
1108
1116
  LIMIT 1
1109
- `))), i = await Y(n), a = T(i);
1110
- if (r.length === 0) return R.info("db drift: no _voltro_migration_plans rows yet"), console.log(`live user-schema fingerprint: ${O(a)}`), console.log("No baseline to compare against. Run `voltro db apply` to lock in the current state."), 0;
1117
+ `))), i = await Y(n), a = w(i);
1118
+ if (r.length === 0) return R.info("db drift: no _voltro_migration_plans rows yet"), console.log(`live user-schema fingerprint: ${D(a)}`), console.log("No baseline to compare against. Run `voltro db apply` to lock in the current state."), 0;
1111
1119
  let o = r[0];
1112
- if (o.liveFingerprint === null || o.liveFingerprint === void 0) return R.warn("db drift: no drift baseline recorded yet — cannot compare"), console.log(), console.log(` last applied: ${o.id} at ${$(o.appliedAt)}`), console.log(` live now: ${O(a)}`), console.log(), console.log("That row was written before the framework recorded a live-schema baseline,"), console.log("and the value it does carry is the DECLARED snapshot's hash — not comparable"), console.log("with a live one. Run `voltro db apply` once to establish the baseline (a no-op"), console.log("apply backfills it too); use `voltro db plan` meanwhile, which compares declared"), console.log("against live directly."), console.log(), console.log("Exit code 3 — NOT 0. \"Did not compare\" is not \"clean\", and a gate on the exit"), console.log("code has to be able to tell them apart."), 3;
1113
- if (o.liveFingerprint === a) return R.info(`db drift: live matches last applied (${O(a)})`), 0;
1120
+ if (o.liveFingerprint === null || o.liveFingerprint === void 0) return R.warn("db drift: no drift baseline recorded yet — cannot compare"), console.log(), console.log(` last applied: ${o.id} at ${$(o.appliedAt)}`), console.log(` live now: ${D(a)}`), console.log(), console.log("That row was written before the framework recorded a live-schema baseline,"), console.log("and the value it does carry is the DECLARED snapshot's hash — not comparable"), console.log("with a live one. Run `voltro db apply` once to establish the baseline (a no-op"), console.log("apply backfills it too); use `voltro db plan` meanwhile, which compares declared"), console.log("against live directly."), console.log(), console.log("Exit code 3 — NOT 0. \"Did not compare\" is not \"clean\", and a gate on the exit"), console.log("code has to be able to tell them apart."), 3;
1121
+ if (o.liveFingerprint === a) return R.info(`db drift: live matches last applied (${D(a)})`), 0;
1114
1122
  let s = await (async () => {
1115
1123
  try {
1116
1124
  let t = await Q(B(e));
1117
- return t === void 0 ? void 0 : D({
1125
+ return t === void 0 ? void 0 : E({
1118
1126
  declared: t,
1119
1127
  live: i,
1120
1128
  dialect: W(),
1121
- ...E()
1129
+ ...T()
1122
1130
  }).operations;
1123
1131
  } catch {
1124
1132
  return;
@@ -1141,13 +1149,13 @@ var k = class extends Error {
1141
1149
  ORDER BY ${e("appliedAt")} DESC LIMIT 1
1142
1150
  ) AS ${e("newest")}
1143
1151
  )
1144
- `))), R.info(`db drift: accepted the live schema as the baseline (${O(a)})`), console.log(), console.log("`voltro db plan` reports 0 operations against this schema, so the live state already"), console.log("matches your declaration — only the ledger did not know. It does now."), console.log(), console.log("No history entry was invented: the latest row's baseline was updated in place,"), console.log("because no migration ran."), 0;
1152
+ `))), R.info(`db drift: accepted the live schema as the baseline (${D(a)})`), console.log(), console.log("`voltro db plan` reports 0 operations against this schema, so the live state already"), console.log("matches your declaration — only the ledger did not know. It does now."), console.log(), console.log("No history entry was invented: the latest row's baseline was updated in place,"), console.log("because no migration ran."), 0;
1145
1153
  }
1146
- return R.error("db drift: live schema DIVERGED from last applied state"), console.log(), console.log(` baseline: ${O(o.liveFingerprint)} at ${$(o.appliedAt)} (${o.id})`), console.log(` live now: ${O(a)}`), console.log(), console.log("Something changed the live schema after the last apply. This command can see"), console.log("THAT it changed, not what or who — the fingerprints are hashes, not a diff."), console.log(), s === void 0 ? (console.log("No schema files found here, so the declared side could not be compared."), console.log("Run `voltro db plan` from your project root for the actual difference."), 4) : s.length === 0 ? (console.log("Your DECLARED schema is already satisfied — `voltro db plan` reports 0 operations"), console.log("against this database. So the live schema is not wrong, only unrecorded: something"), console.log("applied a change without going through the planner (a hand-run ALTER, a DBA"), console.log("window, a restored dump), or it touched a table your code does not declare."), console.log(), console.log("If that was deliberate and the schema is right, record it:"), console.log(), console.log(" voltro db drift --accept"), console.log(), console.log("It updates the latest ledger row's baseline to the live schema and invents no"), console.log("history entry. Drift then measures from here."), 4) : (console.log(`\`voltro db plan\` reports ${s.length} operation(s) still pending against your`), console.log("declared schema, so this is not merely an unrecorded change — run it for the diff,"), console.log("then `voltro db apply`, which writes a fresh baseline of its own."), 4);
1154
+ return R.error("db drift: live schema DIVERGED from last applied state"), console.log(), console.log(` baseline: ${D(o.liveFingerprint)} at ${$(o.appliedAt)} (${o.id})`), console.log(` live now: ${D(a)}`), console.log(), console.log("Something changed the live schema after the last apply. This command can see"), console.log("THAT it changed, not what or who — the fingerprints are hashes, not a diff."), console.log(), s === void 0 ? (console.log("No schema files found here, so the declared side could not be compared."), console.log("Run `voltro db plan` from your project root for the actual difference."), 4) : s.length === 0 ? (console.log("Your DECLARED schema is already satisfied — `voltro db plan` reports 0 operations"), console.log("against this database. So the live schema is not wrong, only unrecorded: something"), console.log("applied a change without going through the planner (a hand-run ALTER, a DBA"), console.log("window, a restored dump), or it touched a table your code does not declare."), console.log(), console.log("If that was deliberate and the schema is right, record it:"), console.log(), console.log(" voltro db drift --accept"), console.log(), console.log("It updates the latest ledger row's baseline to the live schema and invents no"), console.log("history entry. Drift then measures from here."), 4) : (console.log(`\`voltro db plan\` reports ${s.length} operation(s) still pending against your`), console.log("declared schema, so this is not merely an unrecorded change — run it for the diff,"), console.log("then `voltro db apply`, which writes a fresh baseline of its own."), 4);
1147
1155
  }, dt = async (e, t) => {
1148
1156
  let n = (process.env.NODE_ENV ?? "").toLowerCase() === "production" ? "prod" : (process.env.NODE_ENV ?? "").toLowerCase() === "staging" ? "staging" : "dev";
1149
1157
  try {
1150
- let r = await J(t, b.SqlClient.pipe(g.flatMap((t) => he(t, {
1158
+ let r = await J(t, b.SqlClient.pipe(g.flatMap((t) => ge(t, {
1151
1159
  projectRoot: e,
1152
1160
  env: n,
1153
1161
  appliedBy: process.env.USER ? `cli:${process.env.USER}` : "cli:user"
@@ -1158,8 +1166,8 @@ var k = class extends Error {
1158
1166
  }
1159
1167
  }, ft = async (e) => {
1160
1168
  let t = B(e), n = await q(), r = (process.env.NODE_ENV ?? "").toLowerCase() === "production" ? "prod" : (process.env.NODE_ENV ?? "").toLowerCase() === "staging" ? "staging" : "dev";
1161
- await J(n, w(x, W()));
1162
- let i = await J(n, b.SqlClient.pipe(g.flatMap((e) => he(e, {
1169
+ await J(n, C(x, W()));
1170
+ let i = await J(n, b.SqlClient.pipe(g.flatMap((e) => ge(e, {
1163
1171
  projectRoot: t,
1164
1172
  env: r,
1165
1173
  appliedBy: process.env.USER ? `cli:${process.env.USER}` : "cli:user"
@@ -1172,7 +1180,7 @@ var k = class extends Error {
1172
1180
  let t = B(e), n = e.find((e) => !e.startsWith("--"));
1173
1181
  if (!n) return R.error("voltro db rollback-file <migration-id>"), 2;
1174
1182
  if ((process.env.NODE_ENV ?? "").toLowerCase() === "production") return R.error("voltro db rollback-file: refusing on prod — schema rollback runs as an explicit deploy step."), 3;
1175
- let r = await J(await q(), b.SqlClient.pipe(g.flatMap((e) => pe(e, {
1183
+ let r = await J(await q(), b.SqlClient.pipe(g.flatMap((e) => me(e, {
1176
1184
  projectRoot: t,
1177
1185
  id: n
1178
1186
  }))));
@@ -1250,18 +1258,18 @@ export default defineMigration({
1250
1258
  into: r,
1251
1259
  map: o.map,
1252
1260
  ...o.leaveUnset ? { leaveUnset: o.leaveUnset } : {}
1253
- }, c = W(), l = await q(), u = await J(l, b.SqlClient.pipe(g.flatMap(ue))), d = (e) => u.tables.find((t) => t.name === e)?.columns.map((e) => ({
1261
+ }, c = W(), l = await q(), u = await J(l, b.SqlClient.pipe(g.flatMap(de))), d = (e) => u.tables.find((t) => t.name === e)?.columns.map((e) => ({
1254
1262
  name: e.name,
1255
1263
  nullable: e.nullable,
1256
1264
  hasDefault: e.defaultValue !== void 0 && e.defaultValue !== null
1257
1265
  })), f = d(n), p = d(r);
1258
1266
  if (f === void 0) return console.error(`voltro db adopt: '${n}' does not exist in the database`), 1;
1259
1267
  if (p === void 0) return console.error(`voltro db adopt: '${r}' does not exist in the database — boot once so the plugin's table is created`), 1;
1260
- let h = async (e) => await J(l, b.SqlClient.pipe(g.flatMap((t) => t.unsafe(e)))), _ = async (e) => Number(Object.values((await h(`SELECT COUNT(*) AS n FROM "${e}"`))[0] ?? { n: 0 })[0] ?? 0), v = be(s, f, p, await _(r));
1261
- for (let e of Se(s, v, await _(n))) console.log(e);
1268
+ let h = async (e) => await J(l, b.SqlClient.pipe(g.flatMap((t) => t.unsafe(e)))), _ = async (e) => Number(Object.values((await h(`SELECT COUNT(*) AS n FROM "${e}"`))[0] ?? { n: 0 })[0] ?? 0), v = xe(s, f, p, await _(r));
1269
+ for (let e of Ce(s, v, await _(n))) console.log(e);
1262
1270
  if (v.fatal) return 1;
1263
1271
  if (!e.includes("--apply")) return console.log(""), console.log(" (dry run — nothing written. Re-run with --apply.)"), 0;
1264
- let y = await Ee(s, v, c, "id", void 0, h, { keepSource: e.includes("--keep-source") });
1272
+ let y = await Oe(s, v, c, "id", void 0, h, { keepSource: e.includes("--keep-source") });
1265
1273
  return console.log(""), console.log(` copied ${y.copied}/${y.sourceRows} row(s)`), console.log(` snapshot: ${y.snapshotTable} — restore from here, then drop it yourself`), y.verified ? (console.log(y.sourceDropped ? ` dropped ${n}` : ` ${n} left in place (--keep-source)`), 0) : (console.error(" ✗ counts DIFFER — the source was NOT dropped. Compare the two tables before doing anything else."), 1);
1266
1274
  },
1267
1275
  "scan-credentials": async (e) => {
@@ -1269,14 +1277,14 @@ export default defineMigration({
1269
1277
  for (let t = 0; t < e.length; t += 1) {
1270
1278
  if (e[t] !== "--table") continue;
1271
1279
  let r = e[t + 1];
1272
- if (r === void 0) throw new k("voltro db scan-credentials: --table needs a value");
1280
+ if (r === void 0) throw new O("voltro db scan-credentials: --table needs a value");
1273
1281
  let [i, a = "subject"] = r.split(":");
1274
1282
  n.push({
1275
1283
  table: i,
1276
1284
  column: a
1277
1285
  });
1278
1286
  }
1279
- let r = [...Oe, ...n], i = await J(await q(), b.SqlClient.pipe(g.flatMap((e) => g.promise(() => Me(e, t, r, G)))));
1287
+ let r = [...ke, ...n], i = await J(await q(), b.SqlClient.pipe(g.flatMap((e) => g.promise(() => Me(e, t, r, G)))));
1280
1288
  return console.log(Ne(i, t)), Pe(i);
1281
1289
  }
1282
1290
  }, vt = async (e) => {
@@ -1300,4 +1308,4 @@ export default defineMigration({
1300
1308
  }
1301
1309
  };
1302
1310
  //#endregion
1303
- export { Ge as a, k as c, lt as i, ve as l, V as n, H as o, We as r, vt as s, U as t };
1311
+ export { Ge as a, O as c, lt as i, ye as l, V as n, H as o, We as r, vt as s, U as t };