@voltro/cli 0.20.2 → 0.21.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 (64) hide show
  1. package/CHANGELOG.md +149 -0
  2. package/THIRD-PARTY-NOTICES.md +61 -61
  3. package/dist/{apiBuild-qZBEu59d.js → apiBuild-BHOtsQkp.js} +93 -80
  4. package/dist/apiBuild-K7M6Rt0U.js +2 -0
  5. package/dist/bin.js +41 -20
  6. package/dist/{commands-kYbfVoPO.js → commands-BZoimvvS.js} +2752 -2633
  7. package/dist/{dbCommand-BPp9R0Wc.js → dbCommand-CDBbZ-Ac.js} +27 -13
  8. package/dist/dbCommand-oADAj6ez.js +2 -0
  9. package/dist/dev-CZQ73Yoh.js +3 -0
  10. package/dist/{dev-OHLsAq4K.js → dev-DKb92NYX.js} +1537 -1527
  11. package/dist/index.js +1 -1
  12. package/dist/{inspectMetrics-DvPNXmGA.js → inspectMetrics-DMjWBQif.js} +576 -567
  13. package/dist/serveCommand-qHJCs0cX.js +1162 -0
  14. package/dist/serveEntry.js +2 -2
  15. package/dist/{start-CXQ7WL1W.js → start-B1x6Z60h.js} +389 -389
  16. package/dist/startEntry.js +2 -2
  17. package/package.json +27 -27
  18. package/templates/AGENTS.md +1 -1
  19. package/templates/agent-docs/_index.md +1 -1
  20. package/templates/agent-docs/cli.md +63 -0
  21. package/templates/agent-docs/database/migrations.md +33 -11
  22. package/templates/agent-docs/database/schema.md +7 -0
  23. package/templates/agent-docs/database/seedsdialects.md +3 -3
  24. package/templates/agent-docs/whats-new.md +136 -9
  25. package/templates/apps/api-ai/package.json +12 -12
  26. package/templates/apps/api-auth/package.json +13 -13
  27. package/templates/apps/api-backend/package.json +12 -12
  28. package/templates/apps/api-backend-deactivation/package.json +12 -12
  29. package/templates/apps/api-backend-mail/package.json +11 -11
  30. package/templates/apps/api-backend-mariadb/package.json +14 -14
  31. package/templates/apps/api-backend-storage/package.json +11 -11
  32. package/templates/apps/api-data-advanced/package.json +13 -13
  33. package/templates/apps/api-durable/package.json +13 -13
  34. package/templates/apps/api-feature-flags/package.json +14 -14
  35. package/templates/apps/api-governance/package.json +13 -13
  36. package/templates/apps/api-kv/package.json +13 -13
  37. package/templates/apps/api-moderation/package.json +13 -13
  38. package/templates/apps/api-observability/package.json +13 -13
  39. package/templates/apps/api-ratelimit/package.json +13 -13
  40. package/templates/apps/api-rbac/package.json +13 -13
  41. package/templates/apps/api-rest/package.json +12 -12
  42. package/templates/apps/api-saas/package.json +16 -16
  43. package/templates/apps/api-search/package.json +13 -13
  44. package/templates/apps/api-versioning/package.json +13 -13
  45. package/templates/apps/api-webhooks/package.json +14 -14
  46. package/templates/apps/changelog/package.json +8 -8
  47. package/templates/apps/edge-functions/package.json +5 -5
  48. package/templates/apps/frontend-admin/package.json +10 -10
  49. package/templates/apps/frontend-app/package.json +10 -10
  50. package/templates/apps/frontend-blank/package.json +9 -9
  51. package/templates/apps/frontend-contact/package.json +11 -11
  52. package/templates/apps/frontend-dashboard/package.json +9 -9
  53. package/templates/apps/frontend-docs/package.json +9 -9
  54. package/templates/apps/frontend-i18n/package.json +8 -8
  55. package/templates/apps/frontend-landing/package.json +9 -9
  56. package/templates/apps/frontend-spa/package.json +9 -9
  57. package/templates/apps/frontend-ssr/package.json +9 -9
  58. package/templates/apps/frontend-ssr-api/package.json +10 -10
  59. package/templates/apps/frontend-static-blog/package.json +8 -8
  60. package/dist/apiBuild-C9aHz4Yh.js +0 -2
  61. package/dist/dbCommand-DtUe-0dM.js +0 -2
  62. package/dist/dev-2AvdzDg2.js +0 -3
  63. package/dist/serveCommand-BKqTKWTX.js +0 -1136
  64. /package/templates/patches/{@effect__cluster@0.59.0.patch → @effect__cluster@0.60.0.patch} +0 -0
@@ -1,17 +1,29 @@
1
- import { ft as e } from "./inspectMetrics-DvPNXmGA.js";
1
+ import { ct as e } from "./inspectMetrics-DMjWBQif.js";
2
2
  import { a as t } from "./seedRunner-D6eu-u5U.js";
3
- import { p as n } from "./dev-OHLsAq4K.js";
4
- import { isAbsolute as r, join as i, relative as a, resolve as o } from "node:path";
5
- import { createLogger as s } from "@voltro/logger";
6
- import { existsSync as c, promises as l } from "node:fs";
7
- import { createRequire as u } from "node:module";
3
+ import { m as n } from "./dev-DKb92NYX.js";
4
+ import { dirname as r, isAbsolute as i, join as a, relative as o, resolve as s } from "node:path";
5
+ import { fileURLToPath as c } from "node:url";
6
+ import { createLogger as l } from "@voltro/logger";
7
+ import { existsSync as u, promises as d } from "node:fs";
8
+ import { createRequire as f } from "node:module";
8
9
  //#region src/apiBuild.ts
9
- var d = s({ scope: "voltro:build" }), f = async (e) => {
10
- let n = i(e, "package.json");
11
- if (!c(n)) return [];
10
+ var p = l({ scope: "voltro:build" }), m = (e) => {
11
+ let t = r(c(import.meta.url));
12
+ for (let n of [
13
+ ".js",
14
+ ".ts",
15
+ ".mjs"
16
+ ]) {
17
+ let r = a(t, `${e}${n}`);
18
+ if (u(r)) return { [`@voltro/cli/${e}`]: r };
19
+ }
20
+ return {};
21
+ }, h = async (e) => {
22
+ let n = a(e, "package.json");
23
+ if (!u(n)) return [];
12
24
  let r = {};
13
25
  try {
14
- let e = JSON.parse(await l.readFile(n, "utf8"));
26
+ let e = JSON.parse(await d.readFile(n, "utf8"));
15
27
  r = {
16
28
  ...e.dependencies,
17
29
  ...e.devDependencies,
@@ -20,32 +32,32 @@ var d = s({ scope: "voltro:build" }), f = async (e) => {
20
32
  } catch {
21
33
  return [];
22
34
  }
23
- let a = u(n);
35
+ let i = f(n);
24
36
  return t.filter((e) => {
25
37
  if (r[e] === void 0) return !1;
26
38
  try {
27
- return a.resolve(e), !0;
39
+ return i.resolve(e), !0;
28
40
  } catch {
29
41
  return !1;
30
42
  }
31
43
  });
32
- }, p = /(?:\.(?:query|mutation|action|stream)(?:\.server)?\.ts|\.workflow(?:\.server)?\.tsx|\.(?:subscribe|reaction|aggregate|agent|tool|webhook|cron|trigger|outbox|connection|email)(?:\.server)?\.tsx?|\.(?:startup|seed)\.tsx?|\.(?:entity|schema|relations|migration)\.ts|(?:^|\/)schema\.ts)$/, m = (e) => /\.(ts|tsx)$/.test(e) && !/\.(test|spec)\.[tj]sx?$/.test(e), h = async (e) => (await n(e)).filter((t) => p.test(t) && m(t) && !t.includes(`${e}/.framework/`)), g = {
44
+ }, g = /(?:\.(?:query|mutation|action|stream)(?:\.server)?\.ts|\.workflow(?:\.server)?\.tsx|\.(?:subscribe|reaction|aggregate|agent|tool|webhook|cron|trigger|outbox|connection|email)(?:\.server)?\.tsx?|\.(?:startup|seed)\.tsx?|\.(?:entity|schema|relations|migration)\.ts|(?:^|\/)schema\.ts)$/, _ = (e) => /\.(ts|tsx)$/.test(e) && !/\.(test|spec)\.[tj]sx?$/.test(e), v = async (e) => (await n(e)).filter((t) => g.test(t) && _(t) && !t.includes(`${e}/.framework/`)), y = {
33
45
  name: "externalize-bare",
34
46
  setup(e) {
35
47
  e.onResolve({ filter: /.*/ }, (e) => {
36
48
  let t = e.path;
37
- if (!(t.startsWith(".") || r(t))) return {
49
+ if (!(t.startsWith(".") || i(t))) return {
38
50
  path: t,
39
51
  external: !0
40
52
  };
41
53
  });
42
54
  }
43
- }, _ = async (t) => {
44
- let n = await e("esbuild", () => import("esbuild")), r = i(t, ".framework"), s = i(r, "dist-api");
45
- await l.mkdir(r, { recursive: !0 });
46
- let u = [...await h(t)], f = i(t, "app.config.ts");
47
- if (c(f) && u.push(f), u.length === 0) return d.warn("api build: no handlers or app.config found — nothing to precompile", { root: t }), null;
48
- let p = i(t, "tsconfig.json"), _ = {
55
+ }, b = async (t) => {
56
+ let n = await e("esbuild", () => import("esbuild")), r = a(t, ".framework"), i = a(r, "dist-api");
57
+ await d.mkdir(r, { recursive: !0 });
58
+ let c = [...await v(t)], l = a(t, "app.config.ts");
59
+ if (u(l) && c.push(l), c.length === 0) return p.warn("api build: no handlers or app.config found — nothing to precompile", { root: t }), null;
60
+ let f = a(t, "tsconfig.json"), m = {
49
61
  bundle: !0,
50
62
  format: "esm",
51
63
  platform: "node",
@@ -54,36 +66,36 @@ var d = s({ scope: "voltro:build" }), f = async (e) => {
54
66
  jsx: "automatic",
55
67
  jsxImportSource: "react",
56
68
  absWorkingDir: t,
57
- ...c(p) ? { tsconfig: p } : {},
58
- plugins: [g]
59
- }, v = await n.build({
60
- ..._,
61
- entryPoints: u,
69
+ ...u(f) ? { tsconfig: f } : {},
70
+ plugins: [y]
71
+ }, h = await n.build({
72
+ ...m,
73
+ entryPoints: c,
62
74
  write: !1,
63
75
  metafile: !0,
64
- outdir: s
65
- }), y = Object.keys(v.metafile.inputs).map((e) => o(t, e)).filter((e) => e.startsWith(`${t}/`) && !e.includes("/node_modules/") && !e.includes("/.framework/") && m(e)), b = [
76
+ outdir: i
77
+ }), g = Object.keys(h.metafile.inputs).map((e) => s(t, e)).filter((e) => e.startsWith(`${t}/`) && !e.includes("/node_modules/") && !e.includes("/.framework/") && _(e)), b = [
66
78
  "// GENERATED BY `voltro build` — do not edit; overwritten on next build.",
67
79
  "// Precompiled api entry: the single bundle the serve runtime loads instead",
68
80
  "// of importing every handler/schema source at boot. See apiBuild.ts /",
69
81
  "// appModuleLoader.ts.",
70
82
  ""
71
83
  ], x = [];
72
- y.forEach((e, n) => {
73
- b.push(`import * as m${n} from ${JSON.stringify(e)}`), x.push(` ${JSON.stringify(a(t, e))}: m${n},`);
84
+ g.forEach((e, n) => {
85
+ b.push(`import * as m${n} from ${JSON.stringify(e)}`), x.push(` ${JSON.stringify(o(t, e))}: m${n},`);
74
86
  }), b.push("", "export const modules: Record<string, unknown> = {", ...x, "}", "");
75
- let S = i(r, "apiEntry.ts");
76
- return await l.writeFile(S, b.join("\n"), "utf8"), await n.build({
77
- ..._,
87
+ let S = a(r, "apiEntry.ts");
88
+ return await d.writeFile(S, b.join("\n"), "utf8"), await n.build({
89
+ ...m,
78
90
  entryPoints: [S],
79
- outfile: i(s, "apiEntry.js"),
91
+ outfile: a(i, "apiEntry.js"),
80
92
  metafile: !1,
81
93
  write: !0
82
- }), d.info("api build: precompiled bundle written", {
83
- modules: y.length,
84
- out: i(".framework", "dist-api", "apiEntry.js")
85
- }), i(s, "apiEntry.js");
86
- }, v = (e) => i(e, ".framework", "dist-api", "apiEntry.js"), y = [
94
+ }), p.info("api build: precompiled bundle written", {
95
+ modules: g.length,
96
+ out: a(".framework", "dist-api", "apiEntry.js")
97
+ }), a(i, "apiEntry.js");
98
+ }, x = (e) => a(e, ".framework", "dist-api", "apiEntry.js"), S = [
87
99
  "better-sqlite3",
88
100
  "pg-native",
89
101
  "@tursodatabase/*",
@@ -91,7 +103,7 @@ var d = s({ scope: "voltro:build" }), f = async (e) => {
91
103
  "@vlasky/zongji",
92
104
  "ioredis",
93
105
  "nodemailer"
94
- ], b = [
106
+ ], C = [
95
107
  "tsx",
96
108
  "esbuild",
97
109
  "vite",
@@ -99,47 +111,47 @@ var d = s({ scope: "voltro:build" }), f = async (e) => {
99
111
  "@tailwindcss/*",
100
112
  "rolldown",
101
113
  "lightningcss"
102
- ], x = (e, t) => t.some((t) => t.endsWith("/*") ? e === t.slice(0, -2) || e.startsWith(t.slice(0, -1)) : e === t || e.startsWith(`${t}/`)), S = (e, t) => `const { createRequire } = require('node:module')
114
+ ], w = (e, t) => t.some((t) => t.endsWith("/*") ? e === t.slice(0, -2) || e.startsWith(t.slice(0, -1)) : e === t || e.startsWith(`${t}/`)), T = (e, t) => `const { createRequire } = require('node:module')
103
115
  const { join } = require('node:path')
104
116
  const reqApp = createRequire(join(process.cwd(), 'package.json'))
105
- const drivers = ${JSON.stringify(t)}\nlet mod\nfor (const d of drivers) {\n try { mod = createRequire(reqApp.resolve(d + '/package.json'))(${JSON.stringify(e)}); break } catch (e) {}\n}\nif (!mod) { try { mod = reqApp(${JSON.stringify(e)}) } catch (e) {} }\nif (!mod) mod = require(${JSON.stringify(e)})\nmodule.exports = mod\n`, C = (e, t, n) => ({
117
+ const drivers = ${JSON.stringify(t)}\nlet mod\nfor (const d of drivers) {\n try { mod = createRequire(reqApp.resolve(d + '/package.json'))(${JSON.stringify(e)}); break } catch (e) {}\n}\nif (!mod) { try { mod = reqApp(${JSON.stringify(e)}) } catch (e) {} }\nif (!mod) mod = require(${JSON.stringify(e)})\nmodule.exports = mod\n`, E = (e, t, n) => ({
106
118
  name: "native-leaf-runtime-resolver",
107
- setup(a) {
108
- a.onResolve({ filter: /.*/ }, (e) => {
109
- let a = e.path;
110
- if (!(a.startsWith(".") || r(a) || a.startsWith("node:")) && !(/^effect$/.test(a) || a.startsWith("@effect/") || a.startsWith("@voltro/"))) {
111
- if (x(a, y)) return {
112
- path: a,
119
+ setup(r) {
120
+ r.onResolve({ filter: /.*/ }, (e) => {
121
+ let r = e.path;
122
+ if (!(r.startsWith(".") || i(r) || r.startsWith("node:")) && !(/^effect$/.test(r) || r.startsWith("@effect/") || r.startsWith("@voltro/"))) {
123
+ if (w(r, S)) return {
124
+ path: r,
113
125
  namespace: "native-leaf"
114
126
  };
115
- if (x(a, b)) return {
116
- path: a,
127
+ if (w(r, C)) return {
128
+ path: r,
117
129
  external: !0
118
130
  };
119
131
  for (let n of [e.resolveDir, t]) if (n) try {
120
- u(i(n, "_.js")).resolve(a);
132
+ f(a(n, "_.js")).resolve(r);
121
133
  return;
122
134
  } catch {}
123
- return n.add(a), {
124
- path: a,
135
+ return n.add(r), {
136
+ path: r,
125
137
  external: !0
126
138
  };
127
139
  }
128
- }), a.onLoad({
140
+ }), r.onLoad({
129
141
  filter: /.*/,
130
142
  namespace: "native-leaf"
131
143
  }, (t) => ({
132
- contents: S(t.path, e),
144
+ contents: T(t.path, e),
133
145
  loader: "js"
134
146
  }));
135
147
  }
136
- }), w = (e) => i(e, ".framework", "dist-api", "serveBundle", "serveEntry.js"), T = async (t) => {
137
- let n = await e("esbuild", () => import("esbuild")), r = i(t, ".framework"), s = i(r, "dist-api", "serveBundle");
138
- await l.mkdir(r, { recursive: !0 });
139
- let u = [...await h(t)], p = i(t, "app.config.ts");
140
- if (c(p) && u.push(p), u.length === 0) return null;
141
- let _ = i(t, "tsconfig.json"), v = await n.build({
142
- entryPoints: u,
148
+ }), D = (e) => a(e, ".framework", "dist-api", "serveBundle", "serveEntry.js"), O = async (t) => {
149
+ let n = await e("esbuild", () => import("esbuild")), r = a(t, ".framework"), i = a(r, "dist-api", "serveBundle");
150
+ await d.mkdir(r, { recursive: !0 });
151
+ let c = [...await v(t)], l = a(t, "app.config.ts");
152
+ if (u(l) && c.push(l), c.length === 0) return null;
153
+ let f = a(t, "tsconfig.json"), g = await n.build({
154
+ entryPoints: c,
143
155
  bundle: !0,
144
156
  write: !1,
145
157
  metafile: !0,
@@ -149,48 +161,49 @@ const drivers = ${JSON.stringify(t)}\nlet mod\nfor (const d of drivers) {\n try
149
161
  jsx: "automatic",
150
162
  jsxImportSource: "react",
151
163
  logLevel: "silent",
152
- plugins: [g],
153
- outdir: i(s, ".probe"),
154
- ...c(_) ? { tsconfig: _ } : {}
155
- }), y = Object.keys(v.metafile.inputs).map((e) => o(t, e)).filter((e) => e.startsWith(`${t}/`) && !e.includes("/node_modules/") && !e.includes("/.framework/") && m(e)), b = await f(t), x = /* @__PURE__ */ new Set(), S = [
164
+ plugins: [y],
165
+ outdir: a(i, ".probe"),
166
+ ...u(f) ? { tsconfig: f } : {}
167
+ }), b = Object.keys(g.metafile.inputs).map((e) => s(t, e)).filter((e) => e.startsWith(`${t}/`) && !e.includes("/node_modules/") && !e.includes("/.framework/") && _(e)), x = await h(t), S = /* @__PURE__ */ new Set(), C = [
156
168
  "// GENERATED BY `voltro build` — do not edit; overwritten on next build.",
157
169
  "import { join as __join, dirname as __dirname, resolve as __resolve } from 'node:path'",
158
170
  "import { pathToFileURL as __pathToFileURL, fileURLToPath as __fileURLToPath } from 'node:url'",
159
171
  "import { runServe as __runServe, registerAppModules, registerDriver, loadDotEnv } from '@voltro/cli/serveEntry'",
160
- ...b.map((e, t) => `import * as __drv${t} from ${JSON.stringify(e)}`),
172
+ ...x.map((e, t) => `import * as __drv${t} from ${JSON.stringify(e)}`),
161
173
  "const __isMain = Boolean(process.argv[1]) && import.meta.url === __pathToFileURL(process.argv[1]).href",
162
174
  "if (__isMain) process.chdir(__resolve(__dirname(__fileURLToPath(import.meta.url)), '..', '..', '..'))",
163
175
  "const __root = process.cwd()",
164
176
  "registerAppModules({",
165
- ...y.map((e) => ` [__join(__root, ${JSON.stringify(a(t, e))})]: () => import(${JSON.stringify(e)}),`),
177
+ ...b.map((e) => ` [__join(__root, ${JSON.stringify(o(t, e))})]: () => import(${JSON.stringify(e)}),`),
166
178
  "})",
167
- ...b.map((e, t) => `registerDriver(${JSON.stringify(e)}, __drv${t})`),
179
+ ...x.map((e, t) => `registerDriver(${JSON.stringify(e)}, __drv${t})`),
168
180
  "export const runServe = (args = []) => { loadDotEnv([]); return __runServe(args) }",
169
181
  "if (__isMain) runServe(process.argv.slice(2)).then((c) => process.exit(typeof c === 'number' ? c : 0))",
170
182
  ""
171
- ], w = i(r, "serveEntry.ts");
172
- return await l.writeFile(w, S.join("\n"), "utf8"), await n.build({
183
+ ], w = a(r, "serveEntry.ts");
184
+ return await d.writeFile(w, C.join("\n"), "utf8"), await n.build({
173
185
  entryPoints: [w],
174
186
  bundle: !0,
175
187
  format: "esm",
176
188
  platform: "node",
177
189
  target: "node22",
178
- outdir: s,
190
+ outdir: i,
179
191
  splitting: !0,
180
192
  write: !0,
181
- plugins: [C(b, t, x)],
193
+ plugins: [E(x, t, S)],
182
194
  banner: { js: "import { createRequire as __voltroRequire } from 'node:module'; const require = __voltroRequire(import.meta.url);" },
183
195
  jsx: "automatic",
184
196
  jsxImportSource: "react",
185
197
  logLevel: "silent",
186
198
  absWorkingDir: t,
187
- ...c(_) ? { tsconfig: _ } : {}
188
- }), d.info("api build: serve bundle written", {
189
- appModules: y.length,
190
- drivers: b.length > 0 ? b.join(", ") : "none (memory)",
191
- ...x.size > 0 ? { externalizedOptionalPeers: [...x].join(", ") } : {},
192
- out: i(".framework", "dist-api", "serveBundle", "serveEntry.js")
193
- }), i(s, "serveEntry.js");
199
+ alias: m("serveEntry"),
200
+ ...u(f) ? { tsconfig: f } : {}
201
+ }), p.info("api build: serve bundle written", {
202
+ appModules: b.length,
203
+ drivers: x.length > 0 ? x.join(", ") : "none (memory)",
204
+ ...S.size > 0 ? { externalizedOptionalPeers: [...S].join(", ") } : {},
205
+ out: a(".framework", "dist-api", "serveBundle", "serveEntry.js")
206
+ }), a(i, "serveEntry.js");
194
207
  };
195
208
  //#endregion
196
- export { C as a, w as c, h as i, y as n, _ as o, v as r, T as s, p as t };
209
+ export { v as a, O as c, m as i, D as l, S as n, E as o, x as r, b as s, g as t };
@@ -0,0 +1,2 @@
1
+ import { c as e, s as t } from "./apiBuild-BHOtsQkp.js";
2
+ export { t as runApiBuild, e as runServeBundleBuild };
package/dist/bin.js CHANGED
@@ -1,32 +1,53 @@
1
1
  #!/usr/bin/env node
2
- import { et as e } from "./inspectMetrics-DvPNXmGA.js";
3
- import { r as t } from "./commands-kYbfVoPO.js";
4
- import { c as n } from "./dbCommand-BPp9R0Wc.js";
2
+ import { X as e } from "./inspectMetrics-DMjWBQif.js";
3
+ import { r as t } from "./commands-BZoimvvS.js";
4
+ import { c as n } from "./dbCommand-CDBbZ-Ac.js";
5
5
  import { createLogger as r } from "@voltro/logger";
6
6
  //#region src/sqlErrorDetail.ts
7
7
  var i = (e) => typeof e == "object" && !!e, a = (e) => {
8
- let t = [], n = e;
9
- for (let e = 0; e < 8 && i(n); e++) t.push(n), n = n.cause;
10
- return t;
11
- }, o = (e) => {
8
+ if (i(e)) {
9
+ for (let t of Object.getOwnPropertySymbols(e)) if (String(t).includes("FiberFailure/Cause")) return e[t];
10
+ }
11
+ }, o = (e, t = 0) => {
12
+ if (t > 8 || !i(e)) return [];
13
+ let n = e, r = [];
14
+ n.error !== void 0 && r.push(n.error), n.defect !== void 0 && r.push(n.defect);
15
+ for (let e of [
16
+ "left",
17
+ "right",
18
+ "cause"
19
+ ]) n[e] !== void 0 && r.push(...o(n[e], t + 1));
20
+ return r;
21
+ }, s = (e) => {
22
+ let t = [], n = /* @__PURE__ */ new Set(), r = (e, s) => {
23
+ let c = e;
24
+ for (let e = 0; e < 8 && i(c) && !n.has(c); e++) {
25
+ n.add(c), t.push(c);
26
+ let e = a(c);
27
+ if (e !== void 0 && s < 4) for (let t of o(e)) r(t, s + 1);
28
+ c = c.cause;
29
+ }
30
+ };
31
+ return r(e, 0), t;
32
+ }, c = (e) => {
12
33
  if (e == null || e === "") return;
13
34
  let t = String(e);
14
35
  return t === "" ? void 0 : t;
15
- }, s = (e) => {
16
- let t = a(e);
36
+ }, l = (e) => {
37
+ let t = s(e);
17
38
  if (t.length === 0) return;
18
39
  let n = (e) => {
19
40
  for (let n of t) {
20
- let t = o(n[e]);
41
+ let t = c(n[e]);
21
42
  if (t !== void 0) return t;
22
43
  }
23
- }, r = n("sql"), i = n("sqlMessage"), s = n("code"), c = n("errno"), l = n("sqlState"), u = n("detail"), d = n("hint"), f = n("position");
24
- if (r === void 0 && i === void 0 && s === void 0 && c === void 0 && l === void 0 && u === void 0) return;
44
+ }, r = n("sql"), i = n("sqlMessage"), a = n("code"), o = n("errno"), l = n("sqlState"), u = n("detail"), d = n("hint"), f = n("position");
45
+ if (r === void 0 && i === void 0 && a === void 0 && o === void 0 && l === void 0 && u === void 0) return;
25
46
  let p = [];
26
47
  i !== void 0 && p.push(` driver: ${i}`);
27
48
  let m = [
28
- s === void 0 ? void 0 : `code=${s}`,
29
- c === void 0 ? void 0 : `errno=${c}`,
49
+ a === void 0 ? void 0 : `code=${a}`,
50
+ o === void 0 ? void 0 : `errno=${o}`,
30
51
  l === void 0 ? void 0 : `sqlState=${l}`,
31
52
  f === void 0 ? void 0 : `position=${f}`
32
53
  ].filter((e) => e !== void 0);
@@ -35,7 +56,7 @@ var i = (e) => typeof e == "object" && !!e, a = (e) => {
35
56
  p.push(` statement: ${e.length > 600 ? `${e.slice(0, 600)}…` : e}`);
36
57
  } else p.push(" statement: <not attached by the driver>");
37
58
  return p.join("\n");
38
- }, c = r({ scope: "voltro:cli" }), l = (e) => {
59
+ }, u = r({ scope: "voltro:cli" }), d = (e) => {
39
60
  process.exitCode = e;
40
61
  let t = 2, n = () => {
41
62
  --t === 0 && process.exit(e);
@@ -48,13 +69,13 @@ var i = (e) => typeof e == "object" && !!e, a = (e) => {
48
69
  }
49
70
  e.write("", () => n());
50
71
  }
51
- }, u = process.argv.slice(2);
52
- e(u), t(u).then((e) => l(e)).catch((e) => {
72
+ }, f = process.argv.slice(2);
73
+ e(f), t(f).then((e) => d(e)).catch((e) => {
53
74
  if (n(e)) {
54
- console.error(e.message), l(e.code);
75
+ console.error(e.message), d(e.code);
55
76
  return;
56
77
  }
57
- let t = s(e);
58
- c.fatal("unhandled cli error", {}, e), t !== void 0 && console.error(t), l(1);
78
+ let t = l(e);
79
+ u.fatal("unhandled cli error", {}, e), t !== void 0 && console.error(t), d(1);
59
80
  });
60
81
  //#endregion