@voltro/cli 0.45.0 → 0.47.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 (117) hide show
  1. package/CHANGELOG.md +206 -0
  2. package/dist/apiBuild-BsooZpw2.js +2 -0
  3. package/dist/{apiBuild-CDQBNRDx.js → apiBuild-FpHCWiv6.js} +2 -2
  4. package/dist/bin.d.ts +8 -0
  5. package/dist/bin.js +1 -1
  6. package/dist/{build-yvsLG77U.js → build-zVygXxGB.js} +8 -8
  7. package/dist/{checkCommand-lrzwOzV1.js → checkCommand-B2Fw73lu.js} +1 -1
  8. package/dist/{checkCommand-Boxov8lr.js → checkCommand-D0dAKciE.js} +4 -4
  9. package/dist/{codegen-sbN1Y8PB.js → codegen-CrMXs4hb.js} +176 -162
  10. package/dist/codegen-DiMn2KkZ.js +2 -0
  11. package/dist/{codegenCommand-CQOLytL-.js → codegenCommand-BTtsnRus.js} +16 -16
  12. package/dist/{codemodRunner-5ZhDH3rB.js → codemodRunner-DSZjgyCL.js} +8 -0
  13. package/dist/{commands-CEkVoFM5.js → commands-BrFKxnYW.js} +24 -24
  14. package/dist/{dashboardCommand-0ahyp-zA.js → dashboardCommand-D9SjDc8E.js} +3 -3
  15. package/dist/{dataCommand-D4IlZcih.js → dataCommand-Dl11q14e.js} +271 -230
  16. package/dist/dbCommand-BUD4Fd8v.js +2 -0
  17. package/dist/{dbCommand-B237qI-j.js → dbCommand-jbrmzwW_.js} +110 -110
  18. package/dist/{dev-P4HyeY9W.js → dev-CaIfZnw5.js} +1 -1
  19. package/dist/{dev-DAM5CnAa.js → dev-RjB7eE_B.js} +2081 -2058
  20. package/dist/devActivity.d.ts +8 -0
  21. package/dist/doctorCommand-5zv6PN-G.js +2 -0
  22. package/dist/{doctorCommand-DW2cwAvC.js → doctorCommand-D7X29cw6.js} +16 -16
  23. package/dist/{doctorSourceRelations-CPjSwYuZ.js → doctorSourceRelations-Dd48LPvO.js} +15 -10
  24. package/dist/{dormancyCommand-BqQz7lbM.js → dormancyCommand-BGOP27fz.js} +1 -1
  25. package/dist/{embeddingsCommand-DJyArpU4.js → embeddingsCommand-D72E22bw.js} +1 -1
  26. package/dist/{envCommand-CviRZx1L.js → envCommand-BHSxz6wC.js} +2 -2
  27. package/dist/{evalCommand-6RUfPen4.js → evalCommand-Db01Kbng.js} +24 -24
  28. package/dist/{evolveCommand-qdlP-R9G.js → evolveCommand-C2ofGGlz.js} +2 -2
  29. package/dist/{frameworkTableAssembly-oMPBKqlE.js → frameworkTableAssembly-BvZ0Lil_.js} +97 -89
  30. package/dist/frameworkTableAssembly-DDKtwsy2.js +2 -0
  31. package/dist/index.d.ts +8 -0
  32. package/dist/index.js +1 -1
  33. package/dist/{infoCommand-CNWPSUcW.js → infoCommand-CuNl9cbh.js} +1 -1
  34. package/dist/inspectState.d.ts +8 -0
  35. package/dist/interruptedReplace-C1ZI84xi.js +27 -0
  36. package/dist/interruptedReplace-DNJ7MKph.js +2 -0
  37. package/dist/{migrate-DN47p2PG.js → migrate-odCPGHPq.js} +27 -27
  38. package/dist/{runtimeTrace-BDZSt9W_.js → runtimeTrace-C_OKr0jY.js} +1 -1
  39. package/dist/{sdkgen-sNaD3oZB.js → sdkgen-D9trW7sl.js} +1 -1
  40. package/dist/{seedRunner-IdHEprqf.js → seedRunner-Dgsiwk_e.js} +59 -59
  41. package/dist/serveCommand-BU0wfV6V.js +1931 -0
  42. package/dist/serveCommand-Bwrn_9Fn.js +2 -0
  43. package/dist/serveEntry.d.ts +8 -0
  44. package/dist/serveEntry.js +1 -1
  45. package/dist/{start-Ds3xyn8R.js → start-7HcSIKEp.js} +1 -1
  46. package/dist/{start-BAlGcjF5.js → start-DvlYDyAr.js} +1 -1
  47. package/dist/startEntry.d.ts +8 -0
  48. package/dist/startEntry.js +1 -1
  49. package/dist/startup.d.ts +8 -0
  50. package/dist/{test-CHb7UwvE.js → test-rXFq4S76.js} +1 -1
  51. package/dist/{updateCommand-rCnhaj84.js → updateCommand-BlyXavoG.js} +1 -1
  52. package/dist/updateCommand-CT5AvVg7.js +2 -0
  53. package/dist/{webDev-101csg6Q.js → webDev-B4IEMB0n.js} +6 -6
  54. package/dist/webDev-B79ji8M5.js +2 -0
  55. package/dist/{webhooksCommand-C0iZZfaI.js → webhooksCommand-BqcWcbuW.js} +1 -1
  56. package/package.json +23 -17
  57. package/templates/AGENTS.md +1 -1
  58. package/templates/agent-docs/_index.md +1 -1
  59. package/templates/agent-docs/cli.md +166 -2
  60. package/templates/agent-docs/data.md +70 -4
  61. package/templates/agent-docs/whats-new.md +14 -87
  62. package/templates/apps/api-ai/package.json +7 -7
  63. package/templates/apps/api-auth/package.json +8 -8
  64. package/templates/apps/api-backend/package.json +7 -7
  65. package/templates/apps/api-backend-deactivation/package.json +7 -7
  66. package/templates/apps/api-backend-mail/package.json +8 -8
  67. package/templates/apps/api-backend-mariadb/package.json +9 -9
  68. package/templates/apps/api-backend-sqlite/package.json +8 -8
  69. package/templates/apps/api-backend-storage/package.json +8 -8
  70. package/templates/apps/api-cms/package.json +10 -10
  71. package/templates/apps/api-collab/package.json +8 -8
  72. package/templates/apps/api-data-advanced/package.json +8 -8
  73. package/templates/apps/api-durable/package.json +8 -8
  74. package/templates/apps/api-feature-flags/package.json +9 -9
  75. package/templates/apps/api-governance/package.json +8 -8
  76. package/templates/apps/api-kv/package.json +8 -8
  77. package/templates/apps/api-moderation/package.json +8 -8
  78. package/templates/apps/api-observability/package.json +8 -8
  79. package/templates/apps/api-ratelimit/package.json +8 -8
  80. package/templates/apps/api-rbac/package.json +8 -8
  81. package/templates/apps/api-rest/package.json +7 -7
  82. package/templates/apps/api-saas/package.json +11 -11
  83. package/templates/apps/api-saas-starter/package.json +10 -10
  84. package/templates/apps/api-search/package.json +8 -8
  85. package/templates/apps/api-status/package.json +8 -8
  86. package/templates/apps/api-versioning/package.json +8 -8
  87. package/templates/apps/api-webhooks/package.json +9 -9
  88. package/templates/apps/changelog/package.json +6 -6
  89. package/templates/apps/edge-functions/package.json +2 -2
  90. package/templates/apps/frontend-admin/package.json +8 -8
  91. package/templates/apps/frontend-app/package.json +9 -9
  92. package/templates/apps/frontend-auth/package.json +8 -8
  93. package/templates/apps/frontend-blank/package.json +7 -7
  94. package/templates/apps/frontend-cms/package.json +9 -9
  95. package/templates/apps/frontend-collab/package.json +10 -10
  96. package/templates/apps/frontend-contact/package.json +7 -7
  97. package/templates/apps/frontend-dashboard/package.json +7 -7
  98. package/templates/apps/frontend-docs/package.json +7 -7
  99. package/templates/apps/frontend-i18n/package.json +6 -6
  100. package/templates/apps/frontend-landing/package.json +7 -7
  101. package/templates/apps/frontend-portal/package.json +8 -8
  102. package/templates/apps/frontend-saas/package.json +8 -8
  103. package/templates/apps/frontend-spa/package.json +7 -7
  104. package/templates/apps/frontend-ssr/package.json +7 -7
  105. package/templates/apps/frontend-ssr-api/package.json +8 -8
  106. package/templates/apps/frontend-static-blog/package.json +6 -6
  107. package/templates/apps/frontend-status/package.json +8 -8
  108. package/templates/apps/mobile-app/package.json +4 -4
  109. package/dist/apiBuild-yJCqJYQ8.js +0 -2
  110. package/dist/codegen-DcE2li1i.js +0 -2
  111. package/dist/dbCommand-BvQeKQOb.js +0 -2
  112. package/dist/doctorCommand-2K1dIzYk.js +0 -2
  113. package/dist/frameworkTableAssembly-DgylYh9_.js +0 -2
  114. package/dist/serveCommand-BBhT2U94.js +0 -1885
  115. package/dist/serveCommand-DY2jLy0o.js +0 -2
  116. package/dist/updateCommand-BH6EGuCc.js +0 -2
  117. package/dist/webDev-BLKBO34K.js +0 -2
@@ -1,13 +1,13 @@
1
1
  import { t as e } from "./cliError-BmdYnghb.js";
2
2
  import { r as t } from "./dialectDriver-czCHYpeH.js";
3
3
  import { a as n, r } from "./connectionConfig-Bk9IC7D0.js";
4
- import { n as i, s as a, y as o } from "./frameworkTableAssembly-oMPBKqlE.js";
4
+ import { n as i, s as a, y as o } from "./frameworkTableAssembly-BvZ0Lil_.js";
5
5
  import { t as s } from "./cliRuntime-Dh7UDinH.js";
6
6
  import { join as c, relative as l, resolve as u } from "node:path";
7
7
  import { pathToFileURL as d } from "node:url";
8
- import { Effect as f } from "effect";
9
- import { runMigrate as p } from "@voltro/database/sql";
10
- import { actorsTable as m, registerCoreTables as h } from "@voltro/database";
8
+ import { actorsTable as f, registerCoreTables as p } from "@voltro/database";
9
+ import { Effect as m } from "effect";
10
+ import { runMigrate as h } from "@voltro/database/sql";
11
11
  import { FileSystem as g } from "@effect/platform";
12
12
  //#region src/migrate.ts
13
13
  var _ = /* @__PURE__ */ new Set([
@@ -18,58 +18,58 @@ var _ = /* @__PURE__ */ new Set([
18
18
  ".vite",
19
19
  ".next",
20
20
  ".git"
21
- ]), v = /\.entity\.ts$|\.schema\.ts$|^schema\.ts$/, y = (e) => f.gen(function* () {
22
- let t = yield* g.FileSystem, n = [], r = (e) => f.gen(function* () {
23
- let i = yield* t.readDirectory(e).pipe(f.orElseSucceed(() => []));
21
+ ]), v = /\.entity\.ts$|\.schema\.ts$|^schema\.ts$/, y = (e) => m.gen(function* () {
22
+ let t = yield* g.FileSystem, n = [], r = (e) => m.gen(function* () {
23
+ let i = yield* t.readDirectory(e).pipe(m.orElseSucceed(() => []));
24
24
  for (let a of i) {
25
25
  if (_.has(a)) continue;
26
- let i = c(e, a), o = yield* t.stat(i).pipe(f.orElseSucceed(() => null));
26
+ let i = c(e, a), o = yield* t.stat(i).pipe(m.orElseSucceed(() => null));
27
27
  o && (o.type === "Directory" ? yield* r(i) : o.type === "File" && v.test(a) && n.push(i));
28
28
  }
29
29
  });
30
30
  return yield* r(e), n;
31
- }), b = (e) => typeof e == "object" && !!e && "tableName" in e && "fields" in e && "isReactive" in e && typeof e.tableName == "string", x = (e) => f.gen(function* () {
31
+ }), b = (e) => typeof e == "object" && !!e && "tableName" in e && "fields" in e && "isReactive" in e && typeof e.tableName == "string", x = (e) => m.gen(function* () {
32
32
  let t = [];
33
33
  for (let n of e) {
34
- let e = yield* f.promise(() => import(d(n).href));
34
+ let e = yield* m.promise(() => import(d(n).href));
35
35
  for (let n of Object.values(e)) b(n) && t.push(n);
36
36
  }
37
37
  return t;
38
- }), S = (e) => f.gen(function* () {
39
- yield* f.logInfo("starting migration", { root: e });
38
+ }), S = (e) => m.gen(function* () {
39
+ yield* m.logInfo("starting migration", { root: e });
40
40
  let t = yield* y(e);
41
- if (t.length === 0) return yield* f.logError("no schema files found", {
41
+ if (t.length === 0) return yield* m.logError("no schema files found", {
42
42
  hint: "looked for *.entity.ts / *.schema.ts / schema.ts under the project root",
43
43
  root: e
44
44
  }), 1;
45
- yield* f.logInfo(`discovered ${t.length} schema file(s)`, { files: t.map((t) => l(e, t)) });
46
- let n = yield* x(t), r = yield* f.promise(() => i({ root: e })), s = [...n, ...r];
47
- if (yield* f.logInfo(`tables to apply: ${s.length}`, {
45
+ yield* m.logInfo(`discovered ${t.length} schema file(s)`, { files: t.map((t) => l(e, t)) });
46
+ let n = yield* x(t), r = yield* m.promise(() => i({ root: e })), s = [...n, ...r];
47
+ if (yield* m.logInfo(`tables to apply: ${s.length}`, {
48
48
  user: n.map((e) => e.tableName),
49
49
  framework: r.map((e) => e.tableName)
50
- }), s.length === 0) return yield* f.logWarning("no table descriptors discovered, nothing to apply"), 0;
51
- s.some((e) => e.tableName === "actors") || (s = [m, ...s]);
50
+ }), s.length === 0) return yield* m.logWarning("no table descriptors discovered, nothing to apply"), 0;
51
+ s.some((e) => e.tableName === "actors") || (s = [f, ...s]);
52
52
  let c = new Map(s.map((e) => [e.tableName, e])), u = c.get("actors"), d = c.get("tenants");
53
- (u !== void 0 || d !== void 0) && h({
53
+ (u !== void 0 || d !== void 0) && p({
54
54
  ...u === void 0 ? {} : { actors: () => u },
55
55
  ...d === void 0 ? {} : { tenants: () => d }
56
56
  });
57
- let g = yield* f.promise(() => w()), _ = g.makeSqlLayer(C());
58
- yield* f.promise(() => p(s, _, g.id, { retryFilter: g.retryFilter }));
59
- let v = yield* f.promise(() => a(e)), b = [], S = yield* o(v, (e, t) => {
57
+ let g = yield* m.promise(() => w()), _ = g.makeSqlLayer(C());
58
+ yield* m.promise(() => h(s, _, g.id, { retryFilter: g.retryFilter }));
59
+ let v = yield* m.promise(() => a(e)), b = [], S = yield* o(v, (e, t) => {
60
60
  b.push({
61
61
  message: e,
62
62
  fields: t ?? {}
63
63
  });
64
- }).pipe(f.provide(_), f.match({
64
+ }).pipe(m.provide(_), m.match({
65
65
  onFailure: (e) => e,
66
66
  onSuccess: () => void 0
67
67
  }));
68
- for (let e of b) yield* f.logInfo(e.message, e.fields);
69
- return S === void 0 ? (yield* f.logInfo(`applied ${s.length} table(s) to ${g.id}`, {
68
+ for (let e of b) yield* m.logInfo(e.message, e.fields);
69
+ return S === void 0 ? (yield* m.logInfo(`applied ${s.length} table(s) to ${g.id}`, {
70
70
  count: s.length,
71
71
  dialect: g.id
72
- }), 0) : (yield* f.logError("a plugin migration FAILED — the tables were created, the plugin steps were not", { error: S instanceof Error ? S.message : String(S) }), 1);
72
+ }), 0) : (yield* m.logError("a plugin migration FAILED — the tables were created, the plugin steps were not", { error: S instanceof Error ? S.message : String(S) }), 1);
73
73
  }), C = () => (r() && console.warn("voltro migrate: no DB_URL/DB_HOST set — defaulting to postgres://app@localhost:5432/app"), n("migration")), w = async () => {
74
74
  let n = (process.env.DB_DIALECT ?? "postgres").toLowerCase();
75
75
  if (n === "memory") throw new e("voltro migrate: cannot migrate against an in-memory store. Set DB_DIALECT to one of: postgres, sqlite, mysql, mariadb, mssql, turso.");
@@ -79,7 +79,7 @@ var _ = /* @__PURE__ */ new Set([
79
79
  let t = u(e.find((e) => !e.startsWith("-")) ?? process.cwd());
80
80
  return s(S(t), { scope: "voltro:migrate" });
81
81
  }
82
- let { runDbCommand: t } = await import("./dbCommand-BvQeKQOb.js");
82
+ let { runDbCommand: t } = await import("./dbCommand-BUD4Fd8v.js");
83
83
  return t(["apply", ...e]);
84
84
  };
85
85
  //#endregion
@@ -1,4 +1,4 @@
1
- import { n as e } from "./apiBuild-CDQBNRDx.js";
1
+ import { n as e } from "./apiBuild-FpHCWiv6.js";
2
2
  import { join as t, resolve as n, sep as r } from "node:path";
3
3
  import { existsSync as i, promises as a } from "node:fs";
4
4
  import { createLogger as o } from "@voltro/logger";
@@ -422,7 +422,7 @@ let package = Package(
422
422
  await l.mkdir(o(e), { recursive: !0 }), await l.writeFile(e, n.content, "utf8");
423
423
  }
424
424
  }, X = async (e) => {
425
- let { offlineManifest: t } = await import("./checkCommand-lrzwOzV1.js"), { manifest: n } = await t(e);
425
+ let { offlineManifest: t } = await import("./checkCommand-B2Fw73lu.js"), { manifest: n } = await t(e);
426
426
  return n;
427
427
  }, Z = async (e) => {
428
428
  let t = J(await (e.manifestProvider ?? X)(e.root), {
@@ -1,55 +1,55 @@
1
1
  import { n as e } from "./appModuleLoader-C9r9mxZt.js";
2
2
  import { promises as t } from "node:fs";
3
- import { Cause as n, Effect as r } from "effect";
4
- import { SqlClient as i } from "@effect/sql";
5
- import { DEFAULT_CDC_CHANNEL as a, detectReactiveTriggerDrift as o, migrationLockKeyForSchema as s, reactiveTriggerRepairSql as c, resolveMigrationLockSchema as l } from "@voltro/database/sql";
6
- import { _voltroSeedsTable as u, and as d, eq as f, generateId as p, isSeedDefinition as m, setSchemaChangeSeedHook as h, setTenantCreateSeedHook as g } from "@voltro/database";
3
+ import { _voltroSeedsTable as n, and as r, eq as i, generateId as a, isSeedDefinition as o, setSchemaChangeSeedHook as s, setTenantCreateSeedHook as c } from "@voltro/database";
4
+ import { Cause as l, Effect as u } from "effect";
5
+ import { SqlClient as d } from "@effect/sql";
6
+ import { DEFAULT_CDC_CHANNEL as f, detectReactiveTriggerDrift as p, migrationLockKeyForSchema as m, reactiveTriggerRepairSql as h, resolveMigrationLockSchema as g } from "@voltro/database/sql";
7
7
  import { defineSchedule as _ } from "@voltro/runtime";
8
8
  import { createHash as v } from "node:crypto";
9
9
  //#region src/reactiveTriggerBoot.ts
10
10
  var y = (e, t = process.env) => {
11
11
  let n = (t.VOLTRO_REACTIVE_TRIGGERS ?? "").trim().toLowerCase(), r = n === "repair" || n === "report" || n === "off" ? n : e ?? "repair";
12
12
  return r === "repair" && t.VOLTRO_AUTO_MIGRATE === "0" ? "report" : r;
13
- }, b = (e, t, n = a) => r.map(o(e, t, n), (e) => ({
13
+ }, b = (e, t, n = f) => u.map(p(e, t, n), (e) => ({
14
14
  drift: e,
15
- statements: c({
15
+ statements: h({
16
16
  tables: t,
17
17
  dialect: "postgres",
18
18
  channel: n,
19
19
  ...e
20
20
  })
21
- })), x = (e, t) => r.gen(function* () {
22
- let n = yield* i.SqlClient, { drift: o, statements: c } = yield* b(n, e, t.channel ?? a), u = {
23
- missing: o.missing.length,
24
- stale: o.stale.length,
25
- statements: c.length
21
+ })), x = (e, t) => u.gen(function* () {
22
+ let n = yield* d.SqlClient, { drift: r, statements: i } = yield* b(n, e, t.channel ?? f), a = {
23
+ missing: r.missing.length,
24
+ stale: r.stale.length,
25
+ statements: i.length
26
26
  };
27
- if (c.length === 0) return {
27
+ if (i.length === 0) return {
28
28
  kind: "clean",
29
- ...u
29
+ ...a
30
30
  };
31
31
  if (t.mode === "report") return {
32
32
  kind: "reported",
33
- ...u
33
+ ...a
34
34
  };
35
- let d = s(l({ schema: t.lockSchema }));
35
+ let o = m(g({ schema: t.lockSchema }));
36
36
  return (yield* n`
37
- SELECT pg_try_advisory_lock(${d.toString()}::bigint) AS got`)[0]?.got === !0 ? yield* r.gen(function* () {
38
- for (let e of c) yield* n.unsafe(e);
37
+ SELECT pg_try_advisory_lock(${o.toString()}::bigint) AS got`)[0]?.got === !0 ? yield* u.gen(function* () {
38
+ for (let e of i) yield* n.unsafe(e);
39
39
  return {
40
40
  kind: "repaired",
41
- ...u
41
+ ...a
42
42
  };
43
- }).pipe(r.ensuring(n`SELECT pg_advisory_unlock(${d.toString()}::bigint)`.pipe(r.catchAll(() => r.void)))) : {
43
+ }).pipe(u.ensuring(n`SELECT pg_advisory_unlock(${o.toString()}::bigint)`.pipe(u.catchAll(() => u.void)))) : {
44
44
  kind: "lock-held",
45
- ...u
45
+ ...a
46
46
  };
47
- }).pipe(r.catchAllCause((e) => r.succeed({
47
+ }).pipe(u.catchAllCause((e) => u.succeed({
48
48
  kind: "failed",
49
49
  missing: 0,
50
50
  stale: 0,
51
51
  statements: 0,
52
- detail: n.pretty(e)
52
+ detail: l.pretty(e)
53
53
  }))), S = async (e) => {
54
54
  let t = {
55
55
  kind: "skipped",
@@ -58,39 +58,39 @@ var y = (e, t = process.env) => {
58
58
  statements: 0
59
59
  };
60
60
  if (e.dialectId !== "postgres" || e.mode === "off" || e.tables.length === 0) return t;
61
- let n = await e.makeLayer(), i = await r.runPromise(x(e.tables, {
61
+ let n = await e.makeLayer(), r = await u.runPromise(x(e.tables, {
62
62
  mode: e.mode,
63
63
  ...e.channel === void 0 ? {} : { channel: e.channel },
64
64
  ...e.lockSchema === void 0 ? {} : { lockSchema: e.lockSchema }
65
- }).pipe(r.provide(n))).catch((e) => ({
65
+ }).pipe(u.provide(n))).catch((e) => ({
66
66
  kind: "failed",
67
67
  missing: 0,
68
68
  stale: 0,
69
69
  statements: 0,
70
70
  detail: e instanceof Error ? e.message : String(e)
71
71
  }));
72
- switch (i.kind) {
72
+ switch (r.kind) {
73
73
  case "repaired":
74
- e.log.info(`reactive triggers: converged at boot — installed ${i.missing}, removed ${i.stale} (${i.statements} statement(s))`, {
75
- missing: i.missing,
76
- stale: i.stale
74
+ e.log.info(`reactive triggers: converged at boot — installed ${r.missing}, removed ${r.stale} (${r.statements} statement(s))`, {
75
+ missing: r.missing,
76
+ stale: r.stale
77
77
  });
78
78
  break;
79
79
  case "reported":
80
- e.log.warn(`reactive triggers: ${i.missing} table(s) have NO change trigger and ${i.stale} carry a stale one. Writes to them do not reach another instance's subscribers — invisible on a single instance, which is why this surfaces only once you scale out. This boot is in report-only mode (VOLTRO_REACTIVE_TRIGGERS=report, or VOLTRO_AUTO_MIGRATE=0); run \`voltro db apply\` to close it.`, {
81
- missing: i.missing,
82
- stale: i.stale
80
+ e.log.warn(`reactive triggers: ${r.missing} table(s) have NO change trigger and ${r.stale} carry a stale one. Writes to them do not reach another instance's subscribers — invisible on a single instance, which is why this surfaces only once you scale out. This boot is in report-only mode (VOLTRO_REACTIVE_TRIGGERS=report, or VOLTRO_AUTO_MIGRATE=0); run \`voltro db apply\` to close it.`, {
81
+ missing: r.missing,
82
+ stale: r.stale
83
83
  });
84
84
  break;
85
85
  case "lock-held":
86
86
  e.log.info("reactive triggers: drift found; another instance (or a `voltro db apply`) holds the migration lock and is converging it. Not waiting — a boot that queues on a lock is worse than a boot that re-checks on the next start.", {
87
- missing: i.missing,
88
- stale: i.stale
87
+ missing: r.missing,
88
+ stale: r.stale
89
89
  });
90
90
  break;
91
- case "failed": e.log.warn("reactive triggers: the boot check could not run — reactivity may be silently degraded. Run `voltro db apply` to converge them explicitly.", { error: i.detail });
91
+ case "failed": e.log.warn("reactive triggers: the boot check could not run — reactivity may be silently degraded. Run `voltro db apply` to converge them explicitly.", { error: r.detail });
92
92
  }
93
- return i;
93
+ return r;
94
94
  }, C = async (n, r) => {
95
95
  let i = [];
96
96
  for (let a of n) {
@@ -101,16 +101,16 @@ var y = (e, t = process.env) => {
101
101
  r.warn("seed: failed to import", { file: a }, e);
102
102
  continue;
103
103
  }
104
- let o = (n.default && m(n.default) ? n.default : void 0) ?? Object.values(n).find(m);
105
- if (!o) {
104
+ let s = (n.default && o(n.default) ? n.default : void 0) ?? Object.values(n).find(o);
105
+ if (!s) {
106
106
  r.warn("seed: no defineSeed export", { file: a });
107
107
  continue;
108
108
  }
109
- let s = await t.readFile(a, "utf8").catch(() => ""), c = o.fingerprint ? o.fingerprint({ src: s }) : v("sha256").update(s).digest("hex").slice(0, 16);
109
+ let c = await t.readFile(a, "utf8").catch(() => ""), l = s.fingerprint ? s.fingerprint({ src: c }) : v("sha256").update(c).digest("hex").slice(0, 16);
110
110
  i.push({
111
111
  file: a,
112
- definition: o,
113
- fingerprint: c
112
+ definition: s,
113
+ fingerprint: l
114
114
  });
115
115
  }
116
116
  return i;
@@ -127,28 +127,28 @@ var y = (e, t = process.env) => {
127
127
  insertIgnore: (t, n, r) => e.insertIgnore(t, n, r),
128
128
  update: (t, n, r) => e.update(t, n, r),
129
129
  delete: (t, n) => e.delete(t, n)
130
- }), T = (e) => async (t, n, r) => {
131
- let i = Object.keys(n);
132
- if (i.length === 0) throw Error("upsertByUnique: matchFields must have at least one key");
133
- let a;
134
- if (i.length === 1) {
135
- let e = i[0];
136
- a = f(e, n[e]);
137
- } else a = d(...i.map((e) => f(e, n[e])));
138
- let o = (await e.query({
130
+ }), T = (e) => async (t, n, a) => {
131
+ let o = Object.keys(n);
132
+ if (o.length === 0) throw Error("upsertByUnique: matchFields must have at least one key");
133
+ let s;
134
+ if (o.length === 1) {
135
+ let e = o[0];
136
+ s = i(e, n[e]);
137
+ } else s = r(...o.map((e) => i(e, n[e])));
138
+ let c = (await e.query({
139
139
  table: t,
140
140
  order: [],
141
- predicate: a
141
+ predicate: s
142
142
  }))[0];
143
- if (o) {
144
- let n = o.id;
143
+ if (c) {
144
+ let n = c.id;
145
145
  return {
146
- row: await e.update(t, n, r) ?? o,
146
+ row: await e.update(t, n, a) ?? c,
147
147
  created: !1
148
148
  };
149
149
  }
150
150
  return {
151
- row: await e.insert(t, r),
151
+ row: await e.insert(t, a),
152
152
  created: !0
153
153
  };
154
154
  }, E = (e, t) => {
@@ -162,8 +162,8 @@ var y = (e, t = process.env) => {
162
162
  })
163
163
  };
164
164
  }, D = "_voltro_seeds", O = () => {
165
- let e = u.fields.id?.idScheme;
166
- return (e ? p(e, D) : null) ?? p({
165
+ let e = n.fields.id?.idScheme;
166
+ return (e ? a(e, D) : null) ?? a({
167
167
  kind: "typeid",
168
168
  prefix: "seed"
169
169
  }, D);
@@ -311,12 +311,12 @@ var y = (e, t = process.env) => {
311
311
  }
312
312
  let c = s.filter((e) => e.status === "failed");
313
313
  return c.length > 0 && r.warn("one or more onSchemaChange seeds failed (the schema apply itself succeeded)", { failedIds: c.map((e) => e.seedId) }), s;
314
- }, L = (e, t, n) => (g(async (r) => {
314
+ }, L = (e, t, n) => (c(async (r) => {
315
315
  await F(e, r.namespace, t, n);
316
- }), h(async (r) => {
316
+ }), s(async (r) => {
317
317
  await I(e, r.changedTables, t, n);
318
318
  }), () => {
319
- g(null), h(null);
319
+ c(null), s(null);
320
320
  }), R = "seed:", z = (e, t, n) => e.filter((e) => e.definition.lifecycle === "cron").map((r) => _({
321
321
  name: `${R}${r.definition.id}`,
322
322
  cron: r.definition.cron ?? "",