@voltro/cli 0.27.0 → 0.28.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 (58) hide show
  1. package/CHANGELOG.md +235 -0
  2. package/dist/apiBuild-DgBS9ayv.js +2 -0
  3. package/dist/{apiBuild-D22_EpoR.js → apiBuild-eUM32r1u.js} +2 -2
  4. package/dist/bin.js +2 -2
  5. package/dist/{commands-jBX8no1I.js → commands-CSkrUI1h.js} +2430 -2238
  6. package/dist/{dbCommand-uuNCrFAb.js → dbCommand-CpYgmSw4.js} +1 -1
  7. package/dist/dbCommand-DvguqlzF.js +2 -0
  8. package/dist/{dev-DcbIJrWg.js → dev-CEZwJhmb.js} +2774 -2548
  9. package/dist/dev-DlBWWnJQ.js +3 -0
  10. package/dist/index.js +1 -1
  11. package/dist/{seedRunner-D6eu-u5U.js → seedRunner-Bqxgp7HZ.js} +60 -59
  12. package/dist/serveCommand-ZTn-dPFa.js +1425 -0
  13. package/dist/serveEntry.js +2 -2
  14. package/package.json +17 -17
  15. package/templates/AGENTS.md +1 -1
  16. package/templates/agent-docs/_index.md +1 -1
  17. package/templates/agent-docs/deployment.md +56 -0
  18. package/templates/agent-docs/testing.md +42 -0
  19. package/templates/agent-docs/whats-new.md +172 -119
  20. package/templates/apps/api-ai/package.json +7 -7
  21. package/templates/apps/api-auth/package.json +8 -8
  22. package/templates/apps/api-backend/package.json +7 -7
  23. package/templates/apps/api-backend-deactivation/package.json +7 -7
  24. package/templates/apps/api-backend-mail/package.json +8 -8
  25. package/templates/apps/api-backend-mariadb/package.json +9 -9
  26. package/templates/apps/api-backend-storage/package.json +8 -8
  27. package/templates/apps/api-data-advanced/package.json +8 -8
  28. package/templates/apps/api-durable/package.json +8 -8
  29. package/templates/apps/api-feature-flags/package.json +9 -9
  30. package/templates/apps/api-governance/package.json +8 -8
  31. package/templates/apps/api-kv/package.json +8 -8
  32. package/templates/apps/api-moderation/package.json +8 -8
  33. package/templates/apps/api-observability/package.json +8 -8
  34. package/templates/apps/api-ratelimit/package.json +8 -8
  35. package/templates/apps/api-rbac/package.json +8 -8
  36. package/templates/apps/api-rest/package.json +7 -7
  37. package/templates/apps/api-saas/package.json +11 -11
  38. package/templates/apps/api-search/package.json +8 -8
  39. package/templates/apps/api-versioning/package.json +8 -8
  40. package/templates/apps/api-webhooks/package.json +9 -9
  41. package/templates/apps/changelog/package.json +6 -6
  42. package/templates/apps/edge-functions/package.json +2 -2
  43. package/templates/apps/frontend-admin/package.json +8 -8
  44. package/templates/apps/frontend-app/package.json +8 -8
  45. package/templates/apps/frontend-blank/package.json +7 -7
  46. package/templates/apps/frontend-contact/package.json +7 -7
  47. package/templates/apps/frontend-dashboard/package.json +7 -7
  48. package/templates/apps/frontend-docs/package.json +7 -7
  49. package/templates/apps/frontend-i18n/package.json +6 -6
  50. package/templates/apps/frontend-landing/package.json +7 -7
  51. package/templates/apps/frontend-spa/package.json +7 -7
  52. package/templates/apps/frontend-ssr/package.json +7 -7
  53. package/templates/apps/frontend-ssr-api/package.json +8 -8
  54. package/templates/apps/frontend-static-blog/package.json +6 -6
  55. package/dist/apiBuild-BrjrVJJh.js +0 -2
  56. package/dist/dbCommand-DrzXimKf.js +0 -2
  57. package/dist/dev-DNkso403.js +0 -3
  58. package/dist/serveCommand-DfkisVWP.js +0 -1310
@@ -0,0 +1,3 @@
1
+ import "./seedRunner-Bqxgp7HZ.js";
2
+ import { c as e, h as t, u as n } from "./dev-CEZwJhmb.js";
3
+ export { e as loadApiConfig, n as loadDiscovered, t as walk };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as e, i as t, n, o as r, r as i, t as a } from "./commands-jBX8no1I.js";
1
+ import { a as e, i as t, n, o as r, r as i, t as a } from "./commands-CSkrUI1h.js";
2
2
  //#region src/index.ts
3
3
  var o = "framework";
4
4
  //#endregion
@@ -1,66 +1,67 @@
1
- import { join as e } from "node:path";
2
- import { pathToFileURL as t } from "node:url";
3
- import { promises as n } from "node:fs";
4
- import { createRequire as r } from "node:module";
5
- import { _voltroSeedsTable as i, and as a, eq as o, generateId as s, isSeedDefinition as c } from "@voltro/database";
6
- import { createHash as l } from "node:crypto";
1
+ import { n as e } from "./appModuleLoader-C9r9mxZt.js";
2
+ import { join as t } from "node:path";
3
+ import { pathToFileURL as n } from "node:url";
4
+ import { promises as r } from "node:fs";
5
+ import { createRequire as i } from "node:module";
6
+ import { _voltroSeedsTable as a, and as o, eq as s, generateId as c, isSeedDefinition as l } from "@voltro/database";
7
+ import { createHash as u } from "node:crypto";
7
8
  //#region src/dialectDriver.ts
8
- var u = {
9
+ var d = {
9
10
  postgres: "@voltro/sql-postgres",
10
11
  sqlite: "@voltro/sql-sqlite",
11
12
  mysql: "@voltro/sql-mysql",
12
13
  mariadb: "@voltro/sql-mysql",
13
14
  mssql: "@voltro/sql-mssql",
14
15
  turso: "@voltro/sql-turso"
15
- }, d = [...new Set(Object.values(u))], f = {
16
+ }, f = [...new Set(Object.values(d))], p = {
16
17
  postgres: "postgresDialect",
17
18
  sqlite: "sqliteDialect",
18
19
  mysql: "mysqlDialect",
19
20
  mariadb: "mariadbDialect",
20
21
  mssql: "mssqlDialect",
21
22
  turso: "tursoDialect"
22
- }, p = /* @__PURE__ */ new Map(), m = (e, t) => {
23
- p.set(e, t);
24
- }, h = async (n) => {
25
- let i = p.get(n);
26
- if (i) return i;
23
+ }, m = /* @__PURE__ */ new Map(), h = (e, t) => {
24
+ m.set(e, t);
25
+ }, g = async (e) => {
26
+ let r = m.get(e);
27
+ if (r) return r;
27
28
  try {
28
- return await import(t(r(e(process.cwd(), "package.json")).resolve(n)).href);
29
+ return await import(n(i(t(process.cwd(), "package.json")).resolve(e)).href);
29
30
  } catch {
30
31
  try {
31
- return await import(n);
32
+ return await import(e);
32
33
  } catch {
33
- throw Error(`The '${n}' database driver is not installed.\n\nEvery Voltro app declares the driver for its DB dialect as a dependency (a memory store needs none). Install it in the app:\n\n pnpm add ${n}\n`);
34
+ throw Error(`The '${e}' database driver is not installed.\n\nEvery Voltro app declares the driver for its DB dialect as a dependency (a memory store needs none). Install it in the app:\n\n pnpm add ${e}\n`);
34
35
  }
35
36
  }
36
- }, g = async (e) => {
37
- let t = u[e];
37
+ }, _ = async (e) => {
38
+ let t = d[e];
38
39
  if (!t) throw Error(`Unsupported DB_DIALECT='${e}'. Supported: memory, postgres, sqlite, mysql, mariadb, mssql, turso.`);
39
- return (await h(t))[f[e]];
40
- }, _ = async (e, r) => {
40
+ return (await g(t))[p[e]];
41
+ }, v = async (t, n) => {
41
42
  let i = [];
42
- for (let a of e) {
43
- let e;
43
+ for (let a of t) {
44
+ let t;
44
45
  try {
45
- e = await import(t(a).href);
46
+ t = await e(a);
46
47
  } catch (e) {
47
- r.warn("seed: failed to import", { file: a }, e);
48
+ n.warn("seed: failed to import", { file: a }, e);
48
49
  continue;
49
50
  }
50
- let o = (e.default && c(e.default) ? e.default : void 0) ?? Object.values(e).find(c);
51
+ let o = (t.default && l(t.default) ? t.default : void 0) ?? Object.values(t).find(l);
51
52
  if (!o) {
52
- r.warn("seed: no defineSeed export", { file: a });
53
+ n.warn("seed: no defineSeed export", { file: a });
53
54
  continue;
54
55
  }
55
- let s = await n.readFile(a, "utf8").catch(() => ""), u = o.fingerprint ? o.fingerprint({ src: s }) : l("sha256").update(s).digest("hex").slice(0, 16);
56
+ let s = await r.readFile(a, "utf8").catch(() => ""), c = o.fingerprint ? o.fingerprint({ src: s }) : u("sha256").update(s).digest("hex").slice(0, 16);
56
57
  i.push({
57
58
  file: a,
58
59
  definition: o,
59
- fingerprint: u
60
+ fingerprint: c
60
61
  });
61
62
  }
62
63
  return i;
63
- }, v = (e) => ({
64
+ }, y = (e) => ({
64
65
  query: (t) => e.query({
65
66
  table: t.table,
66
67
  order: t.order ?? [],
@@ -73,18 +74,18 @@ var u = {
73
74
  insertIgnore: (t, n, r) => e.insertIgnore(t, n, r),
74
75
  update: (t, n, r) => e.update(t, n, r),
75
76
  delete: (t, n) => e.delete(t, n)
76
- }), y = (e) => async (t, n, r) => {
77
+ }), b = (e) => async (t, n, r) => {
77
78
  let i = Object.keys(n);
78
79
  if (i.length === 0) throw Error("upsertByUnique: matchFields must have at least one key");
79
- let s;
80
+ let a;
80
81
  if (i.length === 1) {
81
82
  let e = i[0];
82
- s = o(e, n[e]);
83
- } else s = a(...i.map((e) => o(e, n[e])));
83
+ a = s(e, n[e]);
84
+ } else a = o(...i.map((e) => s(e, n[e])));
84
85
  let c = (await e.query({
85
86
  table: t,
86
87
  order: [],
87
- predicate: s
88
+ predicate: a
88
89
  }))[0];
89
90
  if (c) {
90
91
  let n = c.id;
@@ -97,30 +98,30 @@ var u = {
97
98
  row: await e.insert(t, r),
98
99
  created: !0
99
100
  };
100
- }, b = (e, t) => {
101
- let n = y(e);
101
+ }, x = (e, t) => {
102
+ let n = b(e);
102
103
  return {
103
- store: v(e),
104
+ store: y(e),
104
105
  upsertByUnique: n,
105
106
  progress: (e, n) => t.debug("seed progress", {
106
107
  done: e,
107
108
  total: n
108
109
  })
109
110
  };
110
- }, x = "_voltro_seeds", S = () => {
111
- let e = i.fields.id?.idScheme;
112
- return (e ? s(e, x) : null) ?? s({
111
+ }, S = "_voltro_seeds", C = () => {
112
+ let e = a.fields.id?.idScheme;
113
+ return (e ? c(e, S) : null) ?? c({
113
114
  kind: "typeid",
114
115
  prefix: "seed"
115
- }, x);
116
- }, C = {
116
+ }, S);
117
+ }, w = {
117
118
  isUnchanged: () => !1,
118
119
  record: async () => {}
119
- }, w = async (e, t) => {
120
+ }, T = async (e, t) => {
120
121
  let n;
121
122
  try {
122
123
  n = await e.query({
123
- table: x,
124
+ table: S,
124
125
  order: [],
125
126
  predicate: void 0,
126
127
  projection: void 0,
@@ -129,9 +130,9 @@ var u = {
129
130
  });
130
131
  } catch (e) {
131
132
  return t.warn("seeds: ledger unreadable — every boot seed will run", {
132
- table: x,
133
+ table: S,
133
134
  error: String(e)
134
- }), C;
135
+ }), w;
135
136
  }
136
137
  let r = new Map(n.map((e) => [e.name, e]));
137
138
  return {
@@ -152,21 +153,21 @@ var u = {
152
153
  };
153
154
  try {
154
155
  let t = r.get(n.definition.id);
155
- t ? await e.update(x, t.id, a) : await e.insert(x, {
156
- id: S(),
156
+ t ? await e.update(S, t.id, a) : await e.insert(S, {
157
+ id: C(),
157
158
  ...a
158
159
  });
159
160
  } catch (e) {
160
161
  t.warn("seeds: could not record the ledger row — this seed will re-run on every boot", {
161
162
  seedId: n.definition.id,
162
- table: x,
163
+ table: S,
163
164
  error: String(e)
164
165
  });
165
166
  }
166
167
  }
167
168
  };
168
- }, T = async (e, t, n) => {
169
- let r = Date.now(), i = b(t, n), a = 0;
169
+ }, E = async (e, t, n) => {
170
+ let r = Date.now(), i = x(t, n), a = 0;
170
171
  for (let t of e.definition.steps) try {
171
172
  let e = await t.body(i);
172
173
  e && typeof e.rowsTouched == "number" && (a += e.rowsTouched);
@@ -193,10 +194,10 @@ var u = {
193
194
  durationMs: Date.now() - r,
194
195
  rowsTouched: a
195
196
  };
196
- }, E = async (e, t, n, r = {}) => {
197
+ }, D = async (e, t, n, r = {}) => {
197
198
  let i = e.filter((e) => e.definition.lifecycle === "boot");
198
199
  if (i.length === 0) return [];
199
- let a = await w(t, n), o = [], s = 0;
200
+ let a = await T(t, n), o = [], s = 0;
200
201
  for (let e of i) {
201
202
  if (!r.force && a.isUnchanged(e)) {
202
203
  s++, n.debug(`seed "${e.definition.id}" unchanged — skipped`, { fingerprint: e.fingerprint }), o.push({
@@ -207,7 +208,7 @@ var u = {
207
208
  });
208
209
  continue;
209
210
  }
210
- let i = await T(e, t, n);
211
+ let i = await E(e, t, n);
211
212
  i.status === "succeeded" && n.info(`seed "${i.seedId}" applied`, {
212
213
  durationMs: i.durationMs,
213
214
  rowsTouched: i.rowsTouched,
@@ -219,11 +220,11 @@ var u = {
219
220
  skipped: s,
220
221
  ...r.force ? { forced: !0 } : {}
221
222
  }), o;
222
- }, D = async (e, t, n, r) => {
223
+ }, O = async (e, t, n, r) => {
223
224
  let i = e.find((e) => e.definition.id === t);
224
225
  if (!i) throw Error(`seed not found: ${t}`);
225
- let a = await T(i, n, r);
226
- return await (await w(n, r)).record(i, a), a;
227
- }, O = /\.seed\.ts$/;
226
+ let a = await E(i, n, r);
227
+ return await (await T(n, r)).record(i, a), a;
228
+ }, k = /\.seed\.ts$/;
228
229
  //#endregion
229
- export { d as a, m as c, D as i, _ as n, h as o, E as r, g as s, O as t };
230
+ export { f as a, h as c, O as i, v as n, g as o, D as r, _ as s, k as t };