@voltro/cli 0.8.0 → 0.9.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.
- package/CHANGELOG.md +19 -0
- package/THIRD-PARTY-NOTICES.md +2 -2
- package/dist/apiBuild-Ba4njm9m.js +2 -0
- package/dist/{apiBuild-OrDkXGFX.js → apiBuild-eInHm_bJ.js} +2 -2
- package/dist/bin.js +2 -2
- package/dist/{commands-DT4PipBz.js → commands-Cxs97AFp.js} +1685 -1592
- package/dist/{dev-Ga65K4jc.js → dev-63Ehpw2p.js} +179 -179
- package/dist/dev-CXsR8Zgo.js +2 -0
- package/dist/index.js +1 -1
- package/dist/{inspectMetrics-EK0CcHyu.js → inspectMetrics-DVCKKSPk.js} +930 -839
- package/dist/{serveCommand-CR5xnYZt.js → serveCommand-Cq7BhtpB.js} +5 -5
- package/dist/serveEntry.js +3 -3
- package/dist/{start-DuyBQxW3.js → start-CYe-7ueh.js} +296 -267
- package/dist/startEntry.js +2 -2
- package/package.json +18 -17
- package/templates/agent-docs/cli.md +49 -1
- package/templates/agent-docs/routing.md +26 -2
- package/templates/apps/api-ai/package.json +7 -7
- package/templates/apps/api-auth/package.json +8 -8
- package/templates/apps/api-backend/package.json +7 -7
- package/templates/apps/api-backend-deactivation/package.json +7 -7
- package/templates/apps/api-backend-mail/package.json +8 -8
- package/templates/apps/api-backend-mariadb/package.json +9 -9
- package/templates/apps/api-backend-storage/package.json +8 -8
- package/templates/apps/api-data-advanced/package.json +8 -8
- package/templates/apps/api-durable/package.json +8 -8
- package/templates/apps/api-feature-flags/package.json +9 -9
- package/templates/apps/api-governance/package.json +8 -8
- package/templates/apps/api-kv/package.json +8 -8
- package/templates/apps/api-moderation/package.json +8 -8
- package/templates/apps/api-observability/package.json +8 -8
- package/templates/apps/api-ratelimit/package.json +8 -8
- package/templates/apps/api-rbac/package.json +8 -8
- package/templates/apps/api-rest/package.json +7 -7
- package/templates/apps/api-saas/package.json +11 -11
- package/templates/apps/api-search/package.json +8 -8
- package/templates/apps/api-versioning/package.json +8 -8
- package/templates/apps/api-webhooks/package.json +8 -8
- package/templates/apps/changelog/package.json +6 -6
- package/templates/apps/edge-functions/package.json +2 -2
- package/templates/apps/frontend-admin/package.json +8 -8
- package/templates/apps/frontend-app/package.json +8 -8
- package/templates/apps/frontend-blank/package.json +7 -7
- package/templates/apps/frontend-contact/package.json +7 -7
- package/templates/apps/frontend-dashboard/package.json +7 -7
- package/templates/apps/frontend-docs/package.json +7 -7
- package/templates/apps/frontend-i18n/package.json +6 -6
- package/templates/apps/frontend-landing/package.json +7 -7
- package/templates/apps/frontend-spa/package.json +7 -7
- package/templates/apps/frontend-ssr/package.json +7 -7
- package/templates/apps/frontend-ssr-api/package.json +8 -8
- package/templates/apps/frontend-static-blog/package.json +6 -6
- package/dist/apiBuild-CmtI6Ygh.js +0 -2
- package/dist/dev-Ca1jdwnt.js +0 -2
|
@@ -4,20 +4,20 @@ import { FileSystem as c } from "@effect/platform";
|
|
|
4
4
|
import { NodeContext as l, NodeRuntime as u } from "@effect/platform-node";
|
|
5
5
|
import { Cause as d, Effect as f, Layer as p } from "effect";
|
|
6
6
|
import { LoggerLayer as m, addSink as h, createLogger as g, printReadyBlock as _ } from "@voltro/logger";
|
|
7
|
-
import { closeSync as v, existsSync as y, mkdirSync as b, openSync as x, promises as S, readFileSync as C, readdirSync as w, statSync as T, unlinkSync as E, unwatchFile as ee, watchFile as D, writeSync as
|
|
8
|
-
import { currentTraceContext as
|
|
9
|
-
import { mkdir as
|
|
10
|
-
import { FRAMEWORK_ENV_CATALOG as
|
|
11
|
-
import { __installPublicEnv as
|
|
12
|
-
import { createHash as
|
|
13
|
-
import { spawn as
|
|
14
|
-
import { timingSafeStringEqual as
|
|
15
|
-
import { homedir as
|
|
16
|
-
import { createConnection as
|
|
17
|
-
import { createRequire as
|
|
18
|
-
import { PassThrough as
|
|
7
|
+
import { closeSync as v, existsSync as y, mkdirSync as b, openSync as x, promises as S, readFileSync as C, readdirSync as w, statSync as T, unlinkSync as E, unwatchFile as ee, watchFile as D, writeSync as te } from "node:fs";
|
|
8
|
+
import { currentTraceContext as O, lastWriteProvenance as k, recordSample as A, resolveSecret as j } from "@voltro/runtime";
|
|
9
|
+
import { mkdir as M, writeFile as N } from "node:fs/promises";
|
|
10
|
+
import { FRAMEWORK_ENV_CATALOG as P, appEnvEntries as F, checkEnvNaming as ne, formatEnvErrors as I, installEnvSnapshot as re, isEnvContract as ie, pluginEnvEntries as ae, renderDotEnvExample as L, resolveEnv as oe } from "@voltro/env";
|
|
11
|
+
import { __installPublicEnv as se } from "@voltro/env/public";
|
|
12
|
+
import { createHash as ce } from "node:crypto";
|
|
13
|
+
import { spawn as le } from "node:child_process";
|
|
14
|
+
import { timingSafeStringEqual as ue } from "@voltro/protocol/session";
|
|
15
|
+
import { homedir as de } from "node:os";
|
|
16
|
+
import { createConnection as fe } from "node:net";
|
|
17
|
+
import { createRequire as pe } from "node:module";
|
|
18
|
+
import { PassThrough as me } from "node:stream";
|
|
19
19
|
//#region src/cliRuntime.ts
|
|
20
|
-
var
|
|
20
|
+
var he = [
|
|
21
21
|
"severity",
|
|
22
22
|
"code",
|
|
23
23
|
"detail",
|
|
@@ -34,14 +34,14 @@ var ve = [
|
|
|
34
34
|
"file",
|
|
35
35
|
"line",
|
|
36
36
|
"routine"
|
|
37
|
-
],
|
|
37
|
+
], ge = (e, t = 0, n = /* @__PURE__ */ new WeakSet()) => {
|
|
38
38
|
if (t > 10 || typeof e != "object" || !e || n.has(e)) return null;
|
|
39
39
|
n.add(e);
|
|
40
40
|
let r = e, i = r.message;
|
|
41
41
|
if (typeof i == "string" && i.length > 0 && i !== "Failed to execute statement") {
|
|
42
42
|
let e = { message: i };
|
|
43
43
|
typeof r.stack == "string" && (e.stack = r.stack);
|
|
44
|
-
for (let t of
|
|
44
|
+
for (let t of he) r[t] !== void 0 && (e[t] = r[t]);
|
|
45
45
|
return e;
|
|
46
46
|
}
|
|
47
47
|
for (let e of [
|
|
@@ -54,20 +54,20 @@ var ve = [
|
|
|
54
54
|
]) {
|
|
55
55
|
let i = r[e];
|
|
56
56
|
if (i !== void 0) {
|
|
57
|
-
let e =
|
|
57
|
+
let e = ge(i, t + 1, n);
|
|
58
58
|
if (e) return e;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
if (Array.isArray(r.failures)) for (let e of r.failures) {
|
|
62
|
-
let r =
|
|
62
|
+
let r = ge(e, t + 1, n);
|
|
63
63
|
if (r) return r;
|
|
64
64
|
}
|
|
65
65
|
return null;
|
|
66
|
-
},
|
|
66
|
+
}, _e = (e = {}) => p.merge(l.layer, m({
|
|
67
67
|
...e.scope ? { defaultScope: e.scope } : {},
|
|
68
68
|
...e.logger
|
|
69
|
-
})),
|
|
70
|
-
let n = e.pipe(f.provide(
|
|
69
|
+
})), ve = async (e, t = {}) => {
|
|
70
|
+
let n = e.pipe(f.provide(_e(t)));
|
|
71
71
|
return await f.runPromise(f.matchCauseEffect(n, {
|
|
72
72
|
onSuccess: (e) => f.succeed(e),
|
|
73
73
|
onFailure: (e) => {
|
|
@@ -83,7 +83,7 @@ var ve = [
|
|
|
83
83
|
}
|
|
84
84
|
let n = null;
|
|
85
85
|
for (let e of t) {
|
|
86
|
-
let t =
|
|
86
|
+
let t = ge(e);
|
|
87
87
|
if (t) {
|
|
88
88
|
n = t;
|
|
89
89
|
break;
|
|
@@ -103,41 +103,41 @@ var ve = [
|
|
|
103
103
|
return f.zipRight(f.logError("cli command failed", r), f.succeed(1));
|
|
104
104
|
}
|
|
105
105
|
}).pipe(f.provide(m(t.logger ?? {}))));
|
|
106
|
-
},
|
|
107
|
-
let n = e.pipe(f.provide(
|
|
106
|
+
}, ye = (e, t = {}) => {
|
|
107
|
+
let n = e.pipe(f.provide(_e(t)));
|
|
108
108
|
u.runMain(n, { disableErrorReporting: !1 });
|
|
109
|
-
},
|
|
109
|
+
}, be = t(o(import.meta.url)), R = [a(be, "..", "templates"), a(be, "..", "..", "templates")], xe = (e) => ({
|
|
110
110
|
_tag: "TemplateNotFoundError",
|
|
111
111
|
searched: e
|
|
112
|
-
}),
|
|
112
|
+
}), Se = ["AGENTS.md", "CLAUDE.md"], Ce = "voltro:agents-md:keep", we = 2048, Te = "<!-- VOLTRO:INDEX -->", z = (e, t) => e.exists(t).pipe(f.orElseSucceed(() => !1)), B = (e, t) => e.readFileString(t).pipe(f.orElseSucceed(() => "")), Ee = (e, t) => e.readFileString(t).pipe(f.map((e) => {
|
|
113
113
|
try {
|
|
114
114
|
return JSON.parse(e).workspaces !== void 0;
|
|
115
115
|
} catch {
|
|
116
116
|
return !1;
|
|
117
117
|
}
|
|
118
|
-
}), f.orElseSucceed(() => !1)),
|
|
118
|
+
}), f.orElseSucceed(() => !1)), De = (e) => f.gen(function* () {
|
|
119
119
|
let n = yield* c.FileSystem, i = a(e);
|
|
120
120
|
for (;;) {
|
|
121
|
-
if ((yield*
|
|
121
|
+
if ((yield* z(n, r(i, ".git"))) || (yield* z(n, r(i, "pnpm-workspace.yaml"))) || (yield* Ee(n, r(i, "package.json")))) return i;
|
|
122
122
|
let o = t(i);
|
|
123
123
|
if (o === i) return a(e);
|
|
124
124
|
i = o;
|
|
125
125
|
}
|
|
126
|
-
}),
|
|
126
|
+
}), Oe = (e, t, n) => f.gen(function* () {
|
|
127
127
|
yield* e.makeDirectory(n, { recursive: !0 }).pipe(f.orElseSucceed(() => void 0));
|
|
128
128
|
let i = yield* e.readDirectory(t).pipe(f.orElseSucceed(() => []));
|
|
129
129
|
for (let a of i) {
|
|
130
130
|
let i = r(t, a), o = r(n, a);
|
|
131
|
-
(yield* e.stat(i).pipe(f.orElseSucceed(() => null)))?.type === "Directory" ? yield*
|
|
131
|
+
(yield* e.stat(i).pipe(f.orElseSucceed(() => null)))?.type === "Directory" ? yield* Oe(e, i, o) : yield* e.copyFile(i, o).pipe(f.orElseSucceed(() => void 0));
|
|
132
132
|
}
|
|
133
|
-
}),
|
|
133
|
+
}), ke = (e) => typeof e?.name == "string" && e.name.length > 0 ? e.name.split("#")[0] : null, Ae = (e, t) => f.gen(function* () {
|
|
134
134
|
let n = r(t, "app.config.ts");
|
|
135
|
-
if (!(yield*
|
|
135
|
+
if (!(yield* z(e, n))) return null;
|
|
136
136
|
let i = (yield* f.tryPromise(() => import(s(n).href)).pipe(f.orElseSucceed(() => null)))?.default;
|
|
137
|
-
return !i || i.type && i.type !== "api" ? i?.type === "web" ? [] : null : (i.plugins ?? []).map(
|
|
138
|
-
}),
|
|
137
|
+
return !i || i.type && i.type !== "api" ? i?.type === "web" ? [] : null : (i.plugins ?? []).map(ke).filter((e) => e !== null);
|
|
138
|
+
}), je = (e, t) => f.gen(function* () {
|
|
139
139
|
let n = [], i = [], a = r(t, "apps");
|
|
140
|
-
if (!(yield*
|
|
140
|
+
if (!(yield* z(e, a))) return {
|
|
141
141
|
apis: n,
|
|
142
142
|
webs: i
|
|
143
143
|
};
|
|
@@ -145,8 +145,8 @@ var ve = [
|
|
|
145
145
|
let o = r(a, t);
|
|
146
146
|
if ((yield* e.stat(o).pipe(f.orElseSucceed(() => null)))?.type === "Directory") for (let t of yield* e.readDirectory(o).pipe(f.orElseSucceed(() => []))) {
|
|
147
147
|
let a = r(o, t), s = r(a, "app.config.ts");
|
|
148
|
-
if (!(yield*
|
|
149
|
-
let c = yield*
|
|
148
|
+
if (!(yield* z(e, s))) continue;
|
|
149
|
+
let c = yield* B(e, s);
|
|
150
150
|
/type:\s*['"]web['"]/.test(c) ? i.push(a) : n.push(a);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
@@ -154,7 +154,7 @@ var ve = [
|
|
|
154
154
|
apis: n,
|
|
155
155
|
webs: i
|
|
156
156
|
};
|
|
157
|
-
}),
|
|
157
|
+
}), Me = (e) => e.replace(/\|/g, "\\|").replace(/\n/g, " ").trim(), Ne = (e, t, n) => {
|
|
158
158
|
let r = [
|
|
159
159
|
"<!-- voltro agent-docs index — regenerated at seed time -->",
|
|
160
160
|
"## Deep reference (read on demand)",
|
|
@@ -166,17 +166,17 @@ var ve = [
|
|
|
166
166
|
"",
|
|
167
167
|
"| Topic | Open | Summary |",
|
|
168
168
|
"|---|---|---|",
|
|
169
|
-
...e.modules.map((e) => `| ${e.title} | \`${n}${e.path}\` | ${
|
|
169
|
+
...e.modules.map((e) => `| ${e.title} | \`${n}${e.path}\` | ${Me(e.description)} |`),
|
|
170
170
|
""
|
|
171
|
-
], i = new Map(e.plugins.map((e) => [e.pkg, e])), a = t === null ? e.plugins.map((e) => `| ${e.slug} | \`node_modules/${e.pkg}/README.md\` | ${
|
|
171
|
+
], i = new Map(e.plugins.map((e) => [e.pkg, e])), a = t === null ? e.plugins.map((e) => `| ${e.slug} | \`node_modules/${e.pkg}/README.md\` | ${Me(e.description)} |`) : t.map((e) => {
|
|
172
172
|
let t = i.get(e);
|
|
173
|
-
return t ? `| ${t.slug} | \`node_modules/${e}/README.md\` | ${
|
|
173
|
+
return t ? `| ${t.slug} | \`node_modules/${e}/README.md\` | ${Me(t.description)} |` : `| ${e.replace(/^@[^/]+\//, "")} | \`node_modules/${e}/README.md\` | (see plugin README) |`;
|
|
174
174
|
});
|
|
175
175
|
return r.push(`### Plugins${t === null ? "" : " (installed)"}`, "", "| Plugin | Open | Summary |", "|---|---|---|"), r.push(a.length ? a.join("\n") : "| _(none installed)_ | | |", ""), r.join("\n");
|
|
176
|
-
},
|
|
176
|
+
}, Pe = (e, t, n) => {
|
|
177
177
|
let r = t.templates?.[e] ?? t.templates?.[e.replace(/^frontend-/, "")];
|
|
178
178
|
return `\nScaffolded from the \`${e}\` template — see \`${r ? `${n}${r}` : `${n}agent-docs/templates/overview.md`}\`.\n`;
|
|
179
|
-
},
|
|
179
|
+
}, Fe = {
|
|
180
180
|
api: (e, t, n = "") => `# api — agent notes
|
|
181
181
|
|
|
182
182
|
You are in a Voltro **api** app. Server primitives live here: \`queries/\`,
|
|
@@ -216,7 +216,7 @@ You are in a Voltro **web** app. File-based routing under \`src/pages/**\`.
|
|
|
216
216
|
Deep reference (paths from the repo root): \`${e}agent-docs/routing.md\`,
|
|
217
217
|
\`${e}agent-docs/schema-driven-ui.md\`, \`${e}agent-docs/internationalization.md\`.
|
|
218
218
|
${t}`
|
|
219
|
-
},
|
|
219
|
+
}, Ie = [
|
|
220
220
|
{
|
|
221
221
|
name: "voltro-schema",
|
|
222
222
|
description: "Define or change a Voltro database table/schema (columns, mixins, indexes, relations).",
|
|
@@ -247,7 +247,7 @@ ${t}`
|
|
|
247
247
|
description: "Export/import + backup/restore Voltro data & assets, and copy prod→dev/stage SAFELY with fail-closed masking/anonymization (.sensitive()/.safe()) + referential subsetting. Use for data takeout, seeding lower envs, backups, or cross-dialect moves.",
|
|
248
248
|
module: "cli.md"
|
|
249
249
|
}
|
|
250
|
-
],
|
|
250
|
+
], Le = (e, t) => `---
|
|
251
251
|
name: ${e.name}
|
|
252
252
|
description: ${e.description}
|
|
253
253
|
---
|
|
@@ -258,10 +258,10 @@ Open the full reference and follow the patterns there:
|
|
|
258
258
|
|
|
259
259
|
Also read the repo-root \`AGENTS.md\` for the always-true rules (browser/server
|
|
260
260
|
boundary, naming, anti-patterns) before editing.
|
|
261
|
-
`,
|
|
262
|
-
let a = yield*
|
|
261
|
+
`, Re = (e, n, r, i) => f.gen(function* () {
|
|
262
|
+
let a = yield* z(e, n);
|
|
263
263
|
if (a) {
|
|
264
|
-
if ((yield*
|
|
264
|
+
if ((yield* B(e, n)).slice(0, we).includes("voltro:agents-md:keep")) return {
|
|
265
265
|
path: n,
|
|
266
266
|
action: "protected"
|
|
267
267
|
};
|
|
@@ -274,64 +274,64 @@ boundary, naming, anti-patterns) before editing.
|
|
|
274
274
|
path: n,
|
|
275
275
|
action: a ? "overwritten" : "created"
|
|
276
276
|
};
|
|
277
|
-
}),
|
|
278
|
-
let n = yield* c.FileSystem, i = yield*
|
|
279
|
-
for (let e of
|
|
277
|
+
}), ze = (e, t = {}) => f.gen(function* () {
|
|
278
|
+
let n = yield* c.FileSystem, i = yield* De(e), o = null;
|
|
279
|
+
for (let e of R) if (yield* z(n, r(e, "AGENTS.core.md"))) {
|
|
280
280
|
o = e;
|
|
281
281
|
break;
|
|
282
282
|
}
|
|
283
283
|
if (o === null) {
|
|
284
|
-
for (let e of
|
|
285
|
-
let a = yield*
|
|
286
|
-
for (let e of
|
|
284
|
+
for (let e of R) if (yield* z(n, r(e, "AGENTS.md"))) {
|
|
285
|
+
let a = yield* B(n, r(e, "AGENTS.md")), o = [];
|
|
286
|
+
for (let e of Se) o.push(yield* Re(n, r(i, e), a, t.force ?? !1));
|
|
287
287
|
return { files: o };
|
|
288
288
|
}
|
|
289
|
-
return yield* f.fail(
|
|
289
|
+
return yield* f.fail(xe(R.map((e) => r(e, "AGENTS.core.md"))));
|
|
290
290
|
}
|
|
291
|
-
let s = yield*
|
|
291
|
+
let s = yield* B(n, r(o, "AGENTS.core.md")), l = yield* B(n, r(o, "agent-docs", "_manifest.json")), u = l ? JSON.parse(l) : {
|
|
292
292
|
modules: [],
|
|
293
293
|
plugins: []
|
|
294
|
-
}, d = (t.preferPointer ?? !1) || (yield*
|
|
295
|
-
if ((yield* f.forEach(h, (e) =>
|
|
294
|
+
}, d = (t.preferPointer ?? !1) || (yield* z(n, r(i, "node_modules/@voltro/cli/templates/agent-docs", "_manifest.json"))), p = d ? "node_modules/@voltro/cli/templates/" : "", m = t.force ?? !1, h = Se.map((e) => r(i, e));
|
|
295
|
+
if ((yield* f.forEach(h, (e) => B(n, e).pipe(f.map((e) => e.slice(0, we))))).every((e) => e.includes("voltro:agents-md:keep"))) return { files: h.map((e) => ({
|
|
296
296
|
path: e,
|
|
297
297
|
action: "protected"
|
|
298
298
|
})) };
|
|
299
|
-
let { apis: g, webs: _ } = yield*
|
|
299
|
+
let { apis: g, webs: _ } = yield* je(n, i), v = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Set(), b = !1;
|
|
300
300
|
for (let e of g) {
|
|
301
|
-
let t = yield*
|
|
301
|
+
let t = yield* Ae(n, e);
|
|
302
302
|
if (v.set(e, t), t !== null) {
|
|
303
303
|
b = !0;
|
|
304
304
|
for (let e of t) y.add(e);
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
let x = t.plugins ? t.plugins.map(
|
|
308
|
-
for (let e of h) C.push(yield*
|
|
309
|
-
d || (yield*
|
|
307
|
+
let x = t.plugins ? t.plugins.map(ke).filter((e) => e !== null) : b ? [...y] : null, S = s.includes(Te) ? s.replace(Te, Ne(u, x, p)) : s, C = [];
|
|
308
|
+
for (let e of h) C.push(yield* Re(n, e, S, m));
|
|
309
|
+
d || (yield* Oe(n, r(o, "agent-docs"), r(i, "agent-docs")));
|
|
310
310
|
let w = new Map((t.appTemplates ?? []).map((e) => [a(e.dir), e.template])), T = (e) => {
|
|
311
311
|
let t = w.get(a(e));
|
|
312
|
-
return t ?
|
|
313
|
-
}, E = (e, t) => f.forEach(
|
|
314
|
-
for (let e of g) C.push(...yield* E(e,
|
|
315
|
-
for (let e of _) C.push(...yield* E(e,
|
|
316
|
-
for (let e of
|
|
312
|
+
return t ? Pe(t, u, p) : "";
|
|
313
|
+
}, E = (e, t) => f.forEach(Se, (i) => Re(n, r(e, i), t, m));
|
|
314
|
+
for (let e of g) C.push(...yield* E(e, Fe.api(p, v.get(e) ?? null, T(e)))), (yield* z(n, r(e, "database"))) && C.push(...yield* E(r(e, "database"), Fe.database(p)));
|
|
315
|
+
for (let e of _) C.push(...yield* E(e, Fe.web(p, T(e))));
|
|
316
|
+
for (let e of Ie) C.push(yield* Re(n, r(i, ".claude", "skills", e.name, "SKILL.md"), Le(e, p), m));
|
|
317
317
|
return { files: C };
|
|
318
|
-
}),
|
|
318
|
+
}), Be = (e, t = {}) => f.runPromise(ze(e, t).pipe(f.provide(l.layer))), Ve = async (e) => {
|
|
319
319
|
let t = e.includes("--force"), n = e.find((e) => !e.startsWith("-")) ?? process.cwd();
|
|
320
|
-
return
|
|
321
|
-
let e = yield*
|
|
320
|
+
return ve(f.gen(function* () {
|
|
321
|
+
let e = yield* ze(n, { force: t });
|
|
322
322
|
for (let t of e.files) {
|
|
323
|
-
let e = t.action === "created" ? "wrote" : t.action === "overwritten" ? "overwrote" : t.action === "protected" ? `protected (hand-maintained — has "${
|
|
323
|
+
let e = t.action === "created" ? "wrote" : t.action === "overwritten" ? "overwrote" : t.action === "protected" ? `protected (hand-maintained — has "${Ce}")` : "present (use --force to overwrite)";
|
|
324
324
|
yield* f.logInfo(`${t.path.split("/").slice(-2).join("/")} ${e}`, { action: t.action });
|
|
325
325
|
}
|
|
326
326
|
return 0;
|
|
327
327
|
}).pipe(f.catchTag("TemplateNotFoundError", (e) => f.gen(function* () {
|
|
328
328
|
return yield* f.logError("AGENTS.md template not found", { searched: e.searched }), 1;
|
|
329
329
|
}))), { scope: "voltro:agents-md" });
|
|
330
|
-
},
|
|
330
|
+
}, He = (e) => e.replace(/\\"|"(?:[^"\\]|\\.)*"|(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g, (e, t) => t ? "" : e), Ue = (e) => {
|
|
331
331
|
try {
|
|
332
332
|
let t = r(e, "tsconfig.json");
|
|
333
333
|
if (!y(t)) return [];
|
|
334
|
-
let n = JSON.parse(
|
|
334
|
+
let n = JSON.parse(He(C(t, "utf8"))).compilerOptions ?? {}, i = n.paths ?? {}, o = a(e, n.baseUrl ?? "."), s = [];
|
|
335
335
|
for (let [e, t] of Object.entries(i)) {
|
|
336
336
|
let n = t[0];
|
|
337
337
|
if (!n) continue;
|
|
@@ -351,17 +351,17 @@ boundary, naming, anti-patterns) before editing.
|
|
|
351
351
|
} catch {
|
|
352
352
|
return [];
|
|
353
353
|
}
|
|
354
|
-
},
|
|
354
|
+
}, We = (e) => {
|
|
355
355
|
let t = e;
|
|
356
356
|
return t?.code === "ERR_MODULE_NOT_FOUND" || /Cannot find (package|module)/.test(String(t?.message ?? ""));
|
|
357
|
-
},
|
|
357
|
+
}, Ge = async (e, t) => {
|
|
358
358
|
try {
|
|
359
359
|
return await t();
|
|
360
360
|
} catch (t) {
|
|
361
|
-
throw
|
|
361
|
+
throw We(t) ? Error(`voltro: the build tool '${e}' is not installed.\n\nIt's an OPTIONAL dependency of @voltro/cli — needed by 'voltro dev' and 'voltro build', but excluded from a serve-only production install (that's how prod images stay lean). If you are building, reinstall WITHOUT '--no-optional' (e.g. 'pnpm install'). A production SERVE container does not need '${e}' — it boots from the precompiled bundle.`) : t;
|
|
362
362
|
}
|
|
363
|
-
},
|
|
364
|
-
let n =
|
|
363
|
+
}, Ke = "// AUTO-GENERATED by Voltro — DO NOT EDIT.\n// Source: app.config.ts `env` (defineEnv). Regenerated on every `voltro dev` boot.\n", qe = (e, t) => t ? `${e} | undefined` : e, Je = (e, t) => Object.entries(e.vars).filter(([, e]) => t(e.access)).map(([e, t]) => `${t.description ? ` /** ${t.description} */\n` : ""} readonly ${e}: ${qe(t.tsType, t.optional)}`).join("\n"), Ye = async (e, t) => {
|
|
364
|
+
let n = Je(t, () => !0), i = `${Ke}
|
|
365
365
|
import '@voltro/env/server'
|
|
366
366
|
|
|
367
367
|
declare module '@voltro/env/server' {
|
|
@@ -370,9 +370,9 @@ ${n.length > 0 ? n : " // (no variables declared)"}
|
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
372
|
`;
|
|
373
|
-
await
|
|
374
|
-
},
|
|
375
|
-
let n =
|
|
373
|
+
await N(r(e, "env.generated.d.ts"), i, "utf8");
|
|
374
|
+
}, Xe = async (e, t) => {
|
|
375
|
+
let n = Je(t, (e) => e === "public"), i = `${Ke}
|
|
376
376
|
import '@voltro/env/public'
|
|
377
377
|
|
|
378
378
|
declare module '@voltro/env/public' {
|
|
@@ -381,9 +381,9 @@ ${n.length > 0 ? n : " // (no public variables declared)"}
|
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
`, a = r(e, "src");
|
|
384
|
-
await
|
|
385
|
-
},
|
|
386
|
-
let n = `${
|
|
384
|
+
await M(a, { recursive: !0 }), await N(r(a, "voltro-env.d.ts"), i, "utf8");
|
|
385
|
+
}, Ze = async (e, t) => {
|
|
386
|
+
let n = `${Ke}
|
|
387
387
|
import { __installPublicEnv } from '@voltro/env/public'
|
|
388
388
|
|
|
389
389
|
export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
|
|
@@ -391,14 +391,14 @@ export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
|
|
|
391
391
|
// Set the browser/SSR-shared global the \`publicEnv\` accessor reads.
|
|
392
392
|
__installPublicEnv(publicEnvValues)
|
|
393
393
|
`;
|
|
394
|
-
await
|
|
395
|
-
},
|
|
396
|
-
let t =
|
|
394
|
+
await M(e, { recursive: !0 }), await N(r(e, "env.public.ts"), n, "utf8");
|
|
395
|
+
}, Qe = async (e) => {
|
|
396
|
+
let t = ie(e.rawEnv) ? e.rawEnv : void 0, n = await oe({
|
|
397
397
|
contract: t,
|
|
398
|
-
resolveSecret:
|
|
399
|
-
}), r = [...n.errors, ...
|
|
400
|
-
if (r.length > 0) throw Error(
|
|
401
|
-
|
|
398
|
+
resolveSecret: j
|
|
399
|
+
}), r = [...n.errors, ...ne(t, e.appType)];
|
|
400
|
+
if (r.length > 0) throw Error(I(r));
|
|
401
|
+
re(n.values), e.appType === "web" && se(n.publicValues);
|
|
402
402
|
let i = t ? Object.keys(t.vars).length : 0;
|
|
403
403
|
if (i > 0) {
|
|
404
404
|
let r = Object.keys(n.publicValues).length;
|
|
@@ -410,52 +410,101 @@ __installPublicEnv(publicEnvValues)
|
|
|
410
410
|
n.length > 0 && e.log.warn(`env: ${n.length} secret var(s) declared on a web app — secrets are reachable only from server-side render code and are NEVER bundled. Prefer declaring secrets on the api.`, { keys: n });
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
return e.generateTypes && t && (e.appType === "api" ? await
|
|
413
|
+
return e.generateTypes && t && (e.appType === "api" ? await Ye(e.root, t) : await Xe(e.root, t)), {
|
|
414
414
|
resolved: n,
|
|
415
415
|
contract: t
|
|
416
416
|
};
|
|
417
|
-
},
|
|
417
|
+
}, $e = g({ scope: "vite" }), et = /\x1b\[[0-9;]*m/g, tt = /^\s*\[?vite\]?\s*(\([a-z-]+\)\s*)?/, nt = (e) => e.replace(et, "").replace(tt, "").trim(), rt = /proxy error/i, it = [
|
|
418
418
|
"ECONNREFUSED",
|
|
419
419
|
"ECONNRESET",
|
|
420
420
|
"ECONNABORTED",
|
|
421
421
|
"EPIPE",
|
|
422
422
|
"ETIMEDOUT"
|
|
423
|
-
],
|
|
423
|
+
], at = (e, t = 0) => {
|
|
424
424
|
if (e == null || t > 5) return !1;
|
|
425
425
|
let n = e;
|
|
426
|
-
return typeof n.code == "string" &&
|
|
427
|
-
},
|
|
426
|
+
return typeof n.code == "string" && it.includes(n.code) || typeof n.message == "string" && it.some((e) => n.message.includes(e)) || Array.isArray(n.errors) && n.errors.some((e) => at(e, t + 1)) ? !0 : at(n.cause, t + 1);
|
|
427
|
+
}, ot = 4e3, st = () => {
|
|
428
428
|
let e = /* @__PURE__ */ new Set(), t = 0, n = {
|
|
429
429
|
hasWarned: !1,
|
|
430
430
|
info: (e) => {
|
|
431
|
-
let t =
|
|
432
|
-
t.length !== 0 &&
|
|
431
|
+
let t = nt(e);
|
|
432
|
+
t.length !== 0 && $e.info(t);
|
|
433
433
|
},
|
|
434
434
|
warn: (e) => {
|
|
435
435
|
n.hasWarned = !0;
|
|
436
|
-
let t =
|
|
437
|
-
t.length !== 0 &&
|
|
436
|
+
let t = nt(e);
|
|
437
|
+
t.length !== 0 && $e.warn(t);
|
|
438
438
|
},
|
|
439
439
|
warnOnce: (t) => {
|
|
440
|
-
let r =
|
|
441
|
-
e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 &&
|
|
440
|
+
let r = nt(t);
|
|
441
|
+
e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 && $e.warn(r));
|
|
442
442
|
},
|
|
443
443
|
error: (e, n) => {
|
|
444
|
-
let r =
|
|
444
|
+
let r = nt(e), i = n?.error;
|
|
445
445
|
if (r.length !== 0) {
|
|
446
|
-
if (
|
|
446
|
+
if (rt.test(r) && at(i)) {
|
|
447
447
|
let e = Date.now();
|
|
448
|
-
e - t >
|
|
448
|
+
e - t > ot && (t = e, $e.info("waiting for api — proxy upstream not accepting connections yet (still starting?)"));
|
|
449
449
|
return;
|
|
450
450
|
}
|
|
451
|
-
|
|
451
|
+
$e.error(r, {}, i);
|
|
452
452
|
}
|
|
453
453
|
},
|
|
454
454
|
clearScreen: () => {},
|
|
455
455
|
hasErrorLogged: (e) => !1
|
|
456
456
|
};
|
|
457
457
|
return n;
|
|
458
|
+
}, ct = (e = process.env) => {
|
|
459
|
+
let t = e.VOLTRO_DEV_SSR_COMPILE_CONCURRENCY;
|
|
460
|
+
if (t === void 0 || t.trim() === "") return 4;
|
|
461
|
+
let n = Number(t);
|
|
462
|
+
return Number.isFinite(n) && n >= 1 ? Math.floor(n) : 4;
|
|
458
463
|
}, lt = (e) => {
|
|
464
|
+
let t = Math.max(1, Math.floor(e)), n = 0, r = [], i = () => n < t ? (n++, Promise.resolve()) : new Promise((e) => r.push(e)), a = () => {
|
|
465
|
+
let e = r.shift();
|
|
466
|
+
e ? e() : n--;
|
|
467
|
+
};
|
|
468
|
+
return {
|
|
469
|
+
withPermit: async (e) => {
|
|
470
|
+
await i();
|
|
471
|
+
try {
|
|
472
|
+
return await e();
|
|
473
|
+
} finally {
|
|
474
|
+
a();
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
get active() {
|
|
478
|
+
return n;
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
}, ut = (e) => {
|
|
482
|
+
let t = lt(e.limit), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
|
|
483
|
+
return {
|
|
484
|
+
load: (i, a) => {
|
|
485
|
+
if (r.has(i)) return a();
|
|
486
|
+
let o = n.get(i);
|
|
487
|
+
if (o) return o;
|
|
488
|
+
let s = t.withPermit(async () => {
|
|
489
|
+
e.onColdStart?.(i);
|
|
490
|
+
try {
|
|
491
|
+
return await a();
|
|
492
|
+
} finally {
|
|
493
|
+
e.onColdEnd?.(i);
|
|
494
|
+
}
|
|
495
|
+
}).then((e) => (r.add(i), e)).finally(() => {
|
|
496
|
+
n.delete(i);
|
|
497
|
+
});
|
|
498
|
+
return n.set(i, s), s;
|
|
499
|
+
},
|
|
500
|
+
get inFlightCount() {
|
|
501
|
+
return n.size;
|
|
502
|
+
},
|
|
503
|
+
get warmCount() {
|
|
504
|
+
return r.size;
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
}, dt = (e) => {
|
|
459
508
|
let t = [];
|
|
460
509
|
for (let n of e.split("/").filter(Boolean)) n.startsWith("[[...") && n.endsWith("]]") ? t.push({
|
|
461
510
|
name: n.slice(5, -2),
|
|
@@ -471,7 +520,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
471
520
|
optional: !1
|
|
472
521
|
});
|
|
473
522
|
return t;
|
|
474
|
-
},
|
|
523
|
+
}, ft = (e) => e.replace(/-([a-z0-9])/g, (e, t) => t.toUpperCase()), pt = async (e) => {
|
|
475
524
|
let n = a(e);
|
|
476
525
|
for (let e = 0; e < 4; e++) {
|
|
477
526
|
let e = r(n, "project.json");
|
|
@@ -489,8 +538,8 @@ __installPublicEnv(publicEnvValues)
|
|
|
489
538
|
n = i;
|
|
490
539
|
}
|
|
491
540
|
return null;
|
|
492
|
-
},
|
|
493
|
-
let n = await
|
|
541
|
+
}, mt = async (t) => {
|
|
542
|
+
let n = await pt(t);
|
|
494
543
|
if (!n) return [];
|
|
495
544
|
let { projectDir: i, manifest: a } = n, o = e(t), s = a.apps ?? {}, c = [];
|
|
496
545
|
for (let [e, t] of Object.entries(s)) {
|
|
@@ -502,20 +551,20 @@ __installPublicEnv(publicEnvValues)
|
|
|
502
551
|
let { pages: e } = await $(n);
|
|
503
552
|
a = e.map((e) => ({
|
|
504
553
|
pattern: e.pattern,
|
|
505
|
-
params:
|
|
554
|
+
params: dt(e.pattern)
|
|
506
555
|
}));
|
|
507
556
|
} catch {
|
|
508
557
|
continue;
|
|
509
558
|
}
|
|
510
559
|
c.push({
|
|
511
|
-
key:
|
|
560
|
+
key: ft(e),
|
|
512
561
|
origin: `http://localhost:${t.port}`,
|
|
513
562
|
...typeof t.origin == "string" && t.origin.length > 0 ? { prodOrigin: t.origin } : {},
|
|
514
563
|
routes: a
|
|
515
564
|
});
|
|
516
565
|
}
|
|
517
566
|
return c;
|
|
518
|
-
},
|
|
567
|
+
}, ht = (e) => {
|
|
519
568
|
if (e.params.length === 0) return `'${e.pattern}'`;
|
|
520
569
|
let t = e.pattern;
|
|
521
570
|
for (let n of e.params) {
|
|
@@ -523,21 +572,21 @@ __installPublicEnv(publicEnvValues)
|
|
|
523
572
|
t = t.replace(e, r);
|
|
524
573
|
}
|
|
525
574
|
return "`" + t + "`";
|
|
526
|
-
},
|
|
575
|
+
}, gt = (e) => e.params.length === 0 ? "EmptyParams" : `{ ${e.params.map((e) => {
|
|
527
576
|
let t = "string";
|
|
528
577
|
return e.optional ? `readonly ${e.name}?: ${t}` : `readonly ${e.name}: ${t}`;
|
|
529
|
-
}).join("; ")} }`,
|
|
530
|
-
let r =
|
|
578
|
+
}).join("; ")} }`, _t = (e, t, n) => {
|
|
579
|
+
let r = gt(e), i = ht(e), a = t ? "VoltroExternalUrl" : "VoltroRouteUrl", o = t && n ? `${n} + ` : "";
|
|
531
580
|
return e.params.length === 0 ? `() => (${o}${i}) as ${a}` : `({ ${e.params.map((e) => e.name).join(", ")} }: ${r}) => (${o}${i}) as ${a}`;
|
|
532
|
-
},
|
|
581
|
+
}, vt = (e) => `{\n${[...e].sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => ` ${JSON.stringify(e.pattern)}: ${_t(e, !1)},`).join("\n")}\n}`, yt = (e, t) => {
|
|
533
582
|
if (e.routes.length === 0) return ` ${e.key}: {} as Record<string, never>,`;
|
|
534
|
-
let n = [...e.routes].sort((e, t) => e.pattern.localeCompare(t.pattern)), r = t === "prod" && e.prodOrigin ? e.prodOrigin : e.origin, i = JSON.stringify(r), a = n.map((e) => ` ${JSON.stringify(e.pattern)}: ${
|
|
583
|
+
let n = [...e.routes].sort((e, t) => e.pattern.localeCompare(t.pattern)), r = t === "prod" && e.prodOrigin ? e.prodOrigin : e.origin, i = JSON.stringify(r), a = n.map((e) => ` ${JSON.stringify(e.pattern)}: ${_t(e, !0, i)},`);
|
|
535
584
|
return ` ${e.key}: {\n${a.join("\n")}\n },`;
|
|
536
|
-
},
|
|
585
|
+
}, bt = async (e) => {
|
|
537
586
|
let n = e.pages.map((e) => ({
|
|
538
587
|
pattern: e.pattern,
|
|
539
|
-
params:
|
|
540
|
-
})), i = await
|
|
588
|
+
params: dt(e.pattern)
|
|
589
|
+
})), i = await mt(e.appRoot), a = [
|
|
541
590
|
"// THIS FILE IS GENERATED — DO NOT EDIT BY HAND.",
|
|
542
591
|
"// Re-emitted by `voltro dev` whenever `src/pages/**` changes.",
|
|
543
592
|
"// Type-safe route builders consumed by <Link to={...}>.",
|
|
@@ -546,7 +595,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
546
595
|
"",
|
|
547
596
|
"type EmptyParams = Record<string, never>",
|
|
548
597
|
""
|
|
549
|
-
].join("\n"), o = e.mode ?? "dev", s = `${a}\n${`export const routes = ${
|
|
598
|
+
].join("\n"), o = e.mode ?? "dev", s = `${a}\n${`export const routes = ${vt(n)} as const\n`}\n${i.length === 0 ? "export const siblingApps = {} as Record<string, never>\n" : `export const siblingApps = {\n${i.map((e) => yt(e, o)).join("\n")}\n} as const\n`}`, c = r(e.appRoot, ".framework", "routes.generated.ts");
|
|
550
599
|
await S.mkdir(t(c), { recursive: !0 });
|
|
551
600
|
let l = null;
|
|
552
601
|
try {
|
|
@@ -559,16 +608,16 @@ __installPublicEnv(publicEnvValues)
|
|
|
559
608
|
path: c,
|
|
560
609
|
wrote: !0
|
|
561
610
|
});
|
|
562
|
-
},
|
|
563
|
-
let t =
|
|
611
|
+
}, xt = (e) => {
|
|
612
|
+
let t = F(e.contract), n = (e.plugins ?? []).flatMap((e) => ae(e.name, e.declaredEnv)), r = e.includeFramework === !1 ? [] : P, i = /* @__PURE__ */ new Set(), a = [];
|
|
564
613
|
for (let e of [
|
|
565
614
|
...t,
|
|
566
615
|
...n,
|
|
567
616
|
...r
|
|
568
617
|
]) i.has(e.key) || (i.add(e.key), a.push(e));
|
|
569
618
|
return a;
|
|
570
|
-
},
|
|
571
|
-
let r =
|
|
619
|
+
}, St = (e, t, n = (e) => process.env[e]) => {
|
|
620
|
+
let r = xt(t).map((e) => {
|
|
572
621
|
let t = n(e.key) !== void 0;
|
|
573
622
|
return {
|
|
574
623
|
...e,
|
|
@@ -585,17 +634,17 @@ __installPublicEnv(publicEnvValues)
|
|
|
585
634
|
missingRequired: r.filter((e) => e.required && !e.isSet && e.default === void 0).length
|
|
586
635
|
}
|
|
587
636
|
};
|
|
588
|
-
},
|
|
637
|
+
}, Ct = (e, t) => L(xt({
|
|
589
638
|
...e,
|
|
590
639
|
includeFramework: !1
|
|
591
640
|
}), {
|
|
592
641
|
includeFramework: e.includeFramework !== !1,
|
|
593
642
|
...t ? { header: t } : {}
|
|
594
|
-
}),
|
|
643
|
+
}), V = "/_voltro/inspect", H = () => process.env.VOLTRO_INSPECT === "off", U = (e) => {
|
|
595
644
|
let t = process.env.VOLTRO_INSPECT_TOKEN;
|
|
596
645
|
if (!t || t.length === 0) return { ok: !0 };
|
|
597
646
|
let n = e.authorization ?? e.Authorization;
|
|
598
|
-
return n ? n.startsWith("Bearer ") ?
|
|
647
|
+
return n ? n.startsWith("Bearer ") ? ue(n.slice(7).trim(), t) ? { ok: !0 } : {
|
|
599
648
|
ok: !1,
|
|
600
649
|
reason: "token mismatch"
|
|
601
650
|
} : {
|
|
@@ -605,7 +654,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
605
654
|
ok: !1,
|
|
606
655
|
reason: "missing Authorization header"
|
|
607
656
|
};
|
|
608
|
-
},
|
|
657
|
+
}, wt = (e) => {
|
|
609
658
|
if (!Array.isArray(e) || e.length === 0) return;
|
|
610
659
|
let t = [];
|
|
611
660
|
for (let n of e) {
|
|
@@ -627,25 +676,25 @@ __installPublicEnv(publicEnvValues)
|
|
|
627
676
|
});
|
|
628
677
|
}
|
|
629
678
|
return t.length > 0 ? t : void 0;
|
|
630
|
-
},
|
|
679
|
+
}, W = (e, t, n = {}) => ({
|
|
631
680
|
status: e,
|
|
632
681
|
contentType: "application/json; charset=utf-8",
|
|
633
682
|
body: JSON.stringify(t),
|
|
634
683
|
headers: n
|
|
635
|
-
}),
|
|
684
|
+
}), G = (e) => !e || e.length === 0 ? {} : {
|
|
636
685
|
"access-control-allow-origin": e,
|
|
637
686
|
"access-control-allow-credentials": "true",
|
|
638
687
|
"access-control-allow-methods": "GET, POST, OPTIONS",
|
|
639
688
|
"access-control-allow-headers": "authorization, content-type, accept",
|
|
640
689
|
"access-control-expose-headers": "content-type, content-length",
|
|
641
690
|
vary: "Origin"
|
|
642
|
-
},
|
|
691
|
+
}, K = (e) => {
|
|
643
692
|
let t = e.indexOf("?");
|
|
644
693
|
return t === -1 ? e : e.slice(0, t);
|
|
645
|
-
},
|
|
694
|
+
}, Tt = (e) => {
|
|
646
695
|
let t = e.indexOf("?");
|
|
647
696
|
return t === -1 ? new URLSearchParams() : new URLSearchParams(e.slice(t + 1));
|
|
648
|
-
},
|
|
697
|
+
}, Et = (e) => e === "/_voltro/inspect" || e.startsWith("/_voltro/inspect/"), Dt = [
|
|
649
698
|
"text",
|
|
650
699
|
"textarea",
|
|
651
700
|
"number",
|
|
@@ -661,7 +710,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
661
710
|
"file",
|
|
662
711
|
"hidden",
|
|
663
712
|
"custom"
|
|
664
|
-
],
|
|
713
|
+
], Ot = (e, t, n = []) => ({
|
|
665
714
|
version: 2,
|
|
666
715
|
procedures: [...e].sort((e, t) => e.tag.localeCompare(t.tag)).map((e) => ({
|
|
667
716
|
tag: e.tag,
|
|
@@ -675,7 +724,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
675
724
|
...e.exposeAsTool === void 0 ? {} : { exposeAsTool: e.exposeAsTool }
|
|
676
725
|
})),
|
|
677
726
|
workflows: [...t].sort((e, t) => e.tag.localeCompare(t.tag)).map((e) => ({ name: e.tag })),
|
|
678
|
-
widgets:
|
|
727
|
+
widgets: Dt,
|
|
679
728
|
tables: [...n].filter((e) => !e.isFrameworkTable).sort((e, t) => e.name.localeCompare(t.name)).map((e) => ({
|
|
680
729
|
name: e.name,
|
|
681
730
|
reactive: e.isReactive,
|
|
@@ -688,58 +737,58 @@ __installPublicEnv(publicEnvValues)
|
|
|
688
737
|
...e.oneOf === void 0 ? {} : { enum: e.oneOf }
|
|
689
738
|
}))
|
|
690
739
|
}))
|
|
691
|
-
}),
|
|
692
|
-
let i =
|
|
693
|
-
if (!
|
|
694
|
-
let a =
|
|
740
|
+
}), kt = (e, t, n = {}, r = {}) => {
|
|
741
|
+
let i = K(e);
|
|
742
|
+
if (!Et(i)) return null;
|
|
743
|
+
let a = G(n.origin ?? n.Origin);
|
|
695
744
|
if ((r.method ?? "GET").toUpperCase() === "OPTIONS") return {
|
|
696
745
|
status: 204,
|
|
697
746
|
contentType: "text/plain",
|
|
698
747
|
body: "",
|
|
699
748
|
headers: a
|
|
700
749
|
};
|
|
701
|
-
if (
|
|
702
|
-
let o = (r.authResolver ??
|
|
703
|
-
if (!o.ok) return
|
|
750
|
+
if (H()) return W(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" }, a);
|
|
751
|
+
let o = (r.authResolver ?? U)(n);
|
|
752
|
+
if (!o.ok) return W(401, {
|
|
704
753
|
error: "unauthorized",
|
|
705
754
|
reason: o.reason
|
|
706
755
|
}, a);
|
|
707
|
-
if (i === "/_voltro/inspect" || i === "/_voltro/inspect/" || i === "/_voltro/inspect/app") return
|
|
756
|
+
if (i === "/_voltro/inspect" || i === "/_voltro/inspect/" || i === "/_voltro/inspect/app") return W(200, {
|
|
708
757
|
kind: t.kind,
|
|
709
758
|
...t.meta
|
|
710
759
|
}, a);
|
|
711
|
-
if (i === "/_voltro/inspect/routes") return t.kind === "web" ?
|
|
760
|
+
if (i === "/_voltro/inspect/routes") return t.kind === "web" ? W(200, {
|
|
712
761
|
pages: t.routes,
|
|
713
762
|
dirs: t.dirs
|
|
714
|
-
}, a) :
|
|
715
|
-
if (i === "/_voltro/inspect/cache") return t.kind === "web" ?
|
|
716
|
-
if (i === "/_voltro/inspect/rpc") return t.kind === "api" ?
|
|
763
|
+
}, a) : W(404, { error: "routes endpoint is web-only" }, a);
|
|
764
|
+
if (i === "/_voltro/inspect/cache") return t.kind === "web" ? W(200, t.cache(), a) : W(404, { error: "cache endpoint is web-only" }, a);
|
|
765
|
+
if (i === "/_voltro/inspect/rpc") return t.kind === "api" ? W(200, {
|
|
717
766
|
procedures: t.rpc,
|
|
718
767
|
workflows: t.workflows
|
|
719
|
-
}, a) :
|
|
768
|
+
}, a) : W(404, { error: "rpc endpoint is api-only" }, a);
|
|
720
769
|
if (i === "/_voltro/inspect/manifest") {
|
|
721
|
-
if (t.kind !== "api") return
|
|
770
|
+
if (t.kind !== "api") return W(404, { error: "manifest endpoint is api-only" }, a);
|
|
722
771
|
let e = t.inspectTables?.().tables ?? [];
|
|
723
|
-
return
|
|
772
|
+
return W(200, Ot(t.rpc, t.workflows, e), a);
|
|
724
773
|
}
|
|
725
|
-
return i === "/_voltro/inspect/metrics" ? t.metrics === void 0 ?
|
|
774
|
+
return i === "/_voltro/inspect/metrics" ? t.metrics === void 0 ? W(200, [], a) : W(200, t.metrics(), a) : i === "/_voltro/inspect/subscriptions" ? t.kind === "api" ? t.subscriptions === void 0 ? W(200, {
|
|
726
775
|
subscriptions: [],
|
|
727
776
|
matcherStats: [],
|
|
728
777
|
capturedAt: Date.now()
|
|
729
|
-
}, a) :
|
|
778
|
+
}, a) : W(200, t.subscriptions(), a) : W(404, { error: "subscriptions endpoint is api-only" }, a) : i === "/_voltro/inspect/data-cache" ? t.kind === "api" ? t.dataCache === void 0 ? W(200, {
|
|
730
779
|
backend: "memory",
|
|
731
780
|
engine: "memory",
|
|
732
781
|
driver: "resp",
|
|
733
782
|
hits: 0,
|
|
734
783
|
misses: 0,
|
|
735
784
|
hitRate: 0
|
|
736
|
-
}, a) :
|
|
785
|
+
}, a) : W(200, t.dataCache(), a) : W(404, { error: "data-cache endpoint is api-only" }, a) : i === "/_voltro/inspect/database" ? t.kind === "api" ? t.database === void 0 ? W(200, {
|
|
737
786
|
migrations: [],
|
|
738
787
|
seeds: []
|
|
739
|
-
}, a) :
|
|
788
|
+
}, a) : W(200, t.database(), a) : W(404, { error: "database endpoint is api-only" }, a) : i === "/_voltro/inspect/plugins" ? t.kind === "api" ? t.plugins === void 0 ? W(200, {
|
|
740
789
|
plugins: [],
|
|
741
790
|
capturedAt: Date.now()
|
|
742
|
-
}, a) :
|
|
791
|
+
}, a) : W(200, t.plugins(), a) : W(404, { error: "plugins endpoint is api-only" }, a) : i === "/_voltro/inspect/env" ? t.env === void 0 ? W(200, {
|
|
743
792
|
app: t.meta.name ?? "app",
|
|
744
793
|
entries: [],
|
|
745
794
|
summary: {
|
|
@@ -747,34 +796,34 @@ __installPublicEnv(publicEnvValues)
|
|
|
747
796
|
set: 0,
|
|
748
797
|
missingRequired: 0
|
|
749
798
|
}
|
|
750
|
-
}, a) :
|
|
799
|
+
}, a) : W(200, t.env(), a) : i === "/_voltro/inspect/data/tables" ? t.kind === "api" ? t.inspectTables === void 0 ? W(200, { tables: [] }, a) : W(200, t.inspectTables(), a) : W(404, { error: "data viewer is api-only" }, a) : i === "/_voltro/inspect/invoke" ? W(404, { error: "invoke not enabled here — use POST handler" }, a) : W(404, {
|
|
751
800
|
error: "unknown inspect endpoint",
|
|
752
801
|
path: i
|
|
753
802
|
}, a);
|
|
754
|
-
},
|
|
755
|
-
let i =
|
|
756
|
-
if (
|
|
757
|
-
if ((r.method ?? "POST").toUpperCase() !== "POST") return
|
|
803
|
+
}, At = async (e, t, n, r = {}) => {
|
|
804
|
+
let i = G(t.origin ?? t.Origin);
|
|
805
|
+
if (H()) return W(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" }, i);
|
|
806
|
+
if ((r.method ?? "POST").toUpperCase() !== "POST") return W(405, {
|
|
758
807
|
error: "method not allowed",
|
|
759
808
|
expected: "POST"
|
|
760
809
|
}, i);
|
|
761
|
-
let a = (r.authResolver ??
|
|
762
|
-
if (!a.ok) return
|
|
810
|
+
let a = (r.authResolver ?? U)(t);
|
|
811
|
+
if (!a.ok) return W(401, {
|
|
763
812
|
error: "unauthorized",
|
|
764
813
|
reason: a.reason
|
|
765
814
|
}, i);
|
|
766
|
-
if (e.kind !== "api") return
|
|
767
|
-
if (!e.invokers || e.invokers.size === 0) return
|
|
815
|
+
if (e.kind !== "api") return W(404, { error: "invoke endpoint is api-only" }, i);
|
|
816
|
+
if (!e.invokers || e.invokers.size === 0) return W(404, { error: "invoke not configured" }, i);
|
|
768
817
|
let o;
|
|
769
818
|
try {
|
|
770
819
|
o = JSON.parse(n || "{}");
|
|
771
820
|
} catch {
|
|
772
|
-
return
|
|
821
|
+
return W(400, { error: "body must be JSON" }, i);
|
|
773
822
|
}
|
|
774
823
|
let s = o;
|
|
775
|
-
if (typeof s.tag != "string") return
|
|
824
|
+
if (typeof s.tag != "string") return W(400, { error: "body.tag must be a string" }, i);
|
|
776
825
|
let c = e.invokers.get(s.tag);
|
|
777
|
-
if (!c) return
|
|
826
|
+
if (!c) return W(404, {
|
|
778
827
|
error: "unknown tag",
|
|
779
828
|
tag: s.tag
|
|
780
829
|
}, i);
|
|
@@ -784,167 +833,167 @@ __installPublicEnv(publicEnvValues)
|
|
|
784
833
|
let n = e.toLowerCase();
|
|
785
834
|
n !== "cookie" && (u[n] = t);
|
|
786
835
|
}
|
|
787
|
-
return
|
|
788
|
-
},
|
|
789
|
-
let a =
|
|
790
|
-
if (!
|
|
791
|
-
let o =
|
|
836
|
+
return W(200, await c(s.input, u), i);
|
|
837
|
+
}, jt = async (e, t, n, r, i = {}) => {
|
|
838
|
+
let a = K(e);
|
|
839
|
+
if (!Et(a) || !a.startsWith("/_voltro/inspect/webhooks/")) return null;
|
|
840
|
+
let o = G(n.origin ?? n.Origin);
|
|
792
841
|
if ((i.method ?? "POST").toUpperCase() !== "POST") return null;
|
|
793
|
-
if (
|
|
794
|
-
let s = (i.authResolver ??
|
|
795
|
-
if (!s.ok) return
|
|
842
|
+
if (H()) return W(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" }, o);
|
|
843
|
+
let s = (i.authResolver ?? U)(n);
|
|
844
|
+
if (!s.ok) return W(401, {
|
|
796
845
|
error: "unauthorized",
|
|
797
846
|
reason: s.reason
|
|
798
847
|
}, o);
|
|
799
|
-
if (t.kind !== "api") return
|
|
800
|
-
if (!t.webhookActions) return
|
|
848
|
+
if (t.kind !== "api") return W(404, { error: "webhook actions are api-only" }, o);
|
|
849
|
+
if (!t.webhookActions) return W(404, { error: "webhook actions not configured — is @voltro/plugin-webhooks active?" }, o);
|
|
801
850
|
let c;
|
|
802
851
|
try {
|
|
803
852
|
c = JSON.parse(r || "{}");
|
|
804
853
|
} catch {
|
|
805
|
-
return
|
|
854
|
+
return W(400, { error: "body must be JSON" }, o);
|
|
806
855
|
}
|
|
807
|
-
let l = a.slice(`${
|
|
856
|
+
let l = a.slice(`${V}/webhooks/`.length);
|
|
808
857
|
try {
|
|
809
858
|
switch (l) {
|
|
810
859
|
case "subscribe": {
|
|
811
860
|
let e = c;
|
|
812
|
-
return typeof e.event != "string" || e.event.length === 0 ?
|
|
861
|
+
return typeof e.event != "string" || e.event.length === 0 ? W(400, { error: "event required" }, o) : typeof e.url != "string" || e.url.length === 0 ? W(400, { error: "url required" }, o) : W(200, await t.webhookActions.subscribe(e), o);
|
|
813
862
|
}
|
|
814
863
|
case "pause": {
|
|
815
864
|
let e = c.targetId;
|
|
816
|
-
return typeof e != "string" || e.length === 0 ?
|
|
865
|
+
return typeof e != "string" || e.length === 0 ? W(400, { error: "targetId required" }, o) : (await t.webhookActions.pause(e), W(200, { ok: !0 }, o));
|
|
817
866
|
}
|
|
818
867
|
case "resume": {
|
|
819
868
|
let e = c.targetId;
|
|
820
|
-
return typeof e != "string" || e.length === 0 ?
|
|
869
|
+
return typeof e != "string" || e.length === 0 ? W(400, { error: "targetId required" }, o) : (await t.webhookActions.resume(e), W(200, { ok: !0 }, o));
|
|
821
870
|
}
|
|
822
871
|
case "delete": {
|
|
823
872
|
let e = c.targetId;
|
|
824
|
-
return typeof e != "string" || e.length === 0 ?
|
|
873
|
+
return typeof e != "string" || e.length === 0 ? W(400, { error: "targetId required" }, o) : (await t.webhookActions.delete(e), W(200, { ok: !0 }, o));
|
|
825
874
|
}
|
|
826
875
|
case "rotateSecret": {
|
|
827
876
|
let e = c.targetId;
|
|
828
|
-
return typeof e != "string" || e.length === 0 ?
|
|
877
|
+
return typeof e != "string" || e.length === 0 ? W(400, { error: "targetId required" }, o) : W(200, await t.webhookActions.rotateSecret(e), o);
|
|
829
878
|
}
|
|
830
879
|
case "replay": {
|
|
831
880
|
let e = c.deliveryId;
|
|
832
|
-
return typeof e != "string" || e.length === 0 ?
|
|
881
|
+
return typeof e != "string" || e.length === 0 ? W(400, { error: "deliveryId required" }, o) : (await t.webhookActions.replay(e), W(200, { ok: !0 }, o));
|
|
833
882
|
}
|
|
834
883
|
case "repinVersion": {
|
|
835
884
|
let e = c.targetId, n = c.version;
|
|
836
|
-
return typeof e != "string" || e.length === 0 ?
|
|
885
|
+
return typeof e != "string" || e.length === 0 ? W(400, { error: "targetId required" }, o) : typeof n != "number" || !Number.isInteger(n) || n < 1 ? W(400, { error: "version must be a positive integer" }, o) : (await t.webhookActions.updateTargetPayloadVersion(e, n), W(200, { ok: !0 }, o));
|
|
837
886
|
}
|
|
838
|
-
default: return
|
|
887
|
+
default: return W(404, { error: `unknown webhook action: ${l}` }, o);
|
|
839
888
|
}
|
|
840
889
|
} catch (e) {
|
|
841
|
-
return
|
|
890
|
+
return W(500, {
|
|
842
891
|
error: "webhook action failed",
|
|
843
892
|
message: e?.message ?? String(e)
|
|
844
893
|
}, o);
|
|
845
894
|
}
|
|
846
|
-
},
|
|
847
|
-
let a =
|
|
848
|
-
if (!
|
|
849
|
-
let o =
|
|
895
|
+
}, Mt = async (e, t, n, r, i = {}) => {
|
|
896
|
+
let a = K(e);
|
|
897
|
+
if (!Et(a)) return null;
|
|
898
|
+
let o = G(n.origin ?? n.Origin);
|
|
850
899
|
if ((i.method ?? "POST").toUpperCase() !== "POST") return null;
|
|
851
|
-
if (
|
|
852
|
-
let s = (i.authResolver ??
|
|
853
|
-
if (!s.ok) return
|
|
900
|
+
if (H()) return W(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" }, o);
|
|
901
|
+
let s = (i.authResolver ?? U)(n);
|
|
902
|
+
if (!s.ok) return W(401, {
|
|
854
903
|
error: "unauthorized",
|
|
855
904
|
reason: s.reason
|
|
856
905
|
}, o);
|
|
857
|
-
if (t.kind !== "api") return
|
|
858
|
-
let c = `${
|
|
906
|
+
if (t.kind !== "api") return W(404, { error: "framework-action endpoints are api-only" }, o);
|
|
907
|
+
let c = `${V}/seeds/run`, l = `${V}/migrations/rollback`, u = `${V}/migrations/squash`, d = `${V}/migrations/restore-snapshot`;
|
|
859
908
|
if (a !== c && a !== l && a !== u && a !== d && a !== "/_voltro/inspect/migrations/compare-env") return null;
|
|
860
909
|
let f;
|
|
861
910
|
try {
|
|
862
911
|
f = JSON.parse(r || "{}");
|
|
863
912
|
} catch {
|
|
864
|
-
return
|
|
913
|
+
return W(400, { error: "body must be JSON" }, o);
|
|
865
914
|
}
|
|
866
915
|
try {
|
|
867
|
-
if (a === c) return typeof f.id != "string" || f.id.length === 0 ?
|
|
868
|
-
if (a === l) return typeof f.id != "string" || f.id.length === 0 ?
|
|
916
|
+
if (a === c) return typeof f.id != "string" || f.id.length === 0 ? W(400, { error: "body.id must be a non-empty string" }, o) : t.runSeed ? W(200, await t.runSeed(f.id), o) : W(404, { error: "runSeed not configured" }, o);
|
|
917
|
+
if (a === l) return typeof f.id != "string" || f.id.length === 0 ? W(400, { error: "body.id must be a non-empty string" }, o) : t.rollbackMigration ? W(200, await t.rollbackMigration(f.id), o) : W(404, { error: "rollbackMigration not configured" }, o);
|
|
869
918
|
if (a === u) {
|
|
870
|
-
if (typeof f.before != "string" || f.before.length === 0) return
|
|
871
|
-
if (!t.squashMigrationHistory) return
|
|
919
|
+
if (typeof f.before != "string" || f.before.length === 0) return W(400, { error: "body.before must be a non-empty ISO date string" }, o);
|
|
920
|
+
if (!t.squashMigrationHistory) return W(404, { error: "squashMigrationHistory not configured" }, o);
|
|
872
921
|
let e = typeof f.note == "string" ? f.note : void 0;
|
|
873
|
-
return
|
|
922
|
+
return W(200, await t.squashMigrationHistory({
|
|
874
923
|
before: f.before,
|
|
875
924
|
note: e
|
|
876
925
|
}), o);
|
|
877
926
|
}
|
|
878
|
-
return a === d ? typeof f.planId != "string" || f.planId.length === 0 ?
|
|
927
|
+
return a === d ? typeof f.planId != "string" || f.planId.length === 0 ? W(400, { error: "body.planId must be a non-empty string" }, o) : t.restoreSnapshot ? W(200, await t.restoreSnapshot({ planId: f.planId }), o) : W(404, { error: "restoreSnapshot not configured" }, o) : typeof f.url != "string" || f.url.length === 0 ? W(400, { error: "body.url must be a non-empty URL string" }, o) : t.compareCrossEnv ? (await t.compareCrossEnv({
|
|
879
928
|
url: f.url,
|
|
880
929
|
label: typeof f.label == "string" ? f.label : void 0,
|
|
881
930
|
token: typeof f.token == "string" ? f.token : void 0
|
|
882
|
-
}),
|
|
931
|
+
}), W(200, { ok: !0 }, o)) : W(404, { error: "compareCrossEnv not configured" }, o);
|
|
883
932
|
} catch (e) {
|
|
884
|
-
return
|
|
933
|
+
return W(500, {
|
|
885
934
|
error: "framework action failed",
|
|
886
935
|
message: e?.message ?? String(e)
|
|
887
936
|
}, o);
|
|
888
937
|
}
|
|
889
|
-
},
|
|
890
|
-
if (
|
|
891
|
-
let i =
|
|
892
|
-
if ((r.method ?? "GET").toUpperCase() !== "GET") return
|
|
938
|
+
}, Nt = async (e, t, n, r = {}) => {
|
|
939
|
+
if (K(e) !== "/_voltro/inspect/data/rows") return null;
|
|
940
|
+
let i = G(n.origin ?? n.Origin);
|
|
941
|
+
if ((r.method ?? "GET").toUpperCase() !== "GET") return W(405, {
|
|
893
942
|
error: "method not allowed",
|
|
894
943
|
expected: "GET"
|
|
895
944
|
}, i);
|
|
896
|
-
if (
|
|
897
|
-
let a = (r.authResolver ??
|
|
898
|
-
if (!a.ok) return
|
|
945
|
+
if (H()) return W(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" }, i);
|
|
946
|
+
let a = (r.authResolver ?? U)(n);
|
|
947
|
+
if (!a.ok) return W(401, {
|
|
899
948
|
error: "unauthorized",
|
|
900
949
|
reason: a.reason
|
|
901
950
|
}, i);
|
|
902
|
-
if (t.kind !== "api") return
|
|
903
|
-
if (t.inspectRows === void 0) return
|
|
904
|
-
let o =
|
|
905
|
-
if (!s) return
|
|
906
|
-
let c =
|
|
951
|
+
if (t.kind !== "api") return W(404, { error: "data viewer is api-only" }, i);
|
|
952
|
+
if (t.inspectRows === void 0) return W(404, { error: "inspectRows not configured" }, i);
|
|
953
|
+
let o = q(e), s = o.get("table");
|
|
954
|
+
if (!s) return W(400, { error: "query.table is required" }, i);
|
|
955
|
+
let c = J(o.get("offset")) ?? 0, l = J(o.get("limit")) ?? 50, u = {}, d = o.get("q");
|
|
907
956
|
if (d) {
|
|
908
|
-
if (d.length > 8192) return
|
|
957
|
+
if (d.length > 8192) return W(400, { error: "query.q too large" }, i);
|
|
909
958
|
try {
|
|
910
959
|
u = JSON.parse(Buffer.from(d, "base64url").toString("utf8"));
|
|
911
960
|
} catch {
|
|
912
|
-
return
|
|
961
|
+
return W(400, { error: "query.q is not valid base64url JSON" }, i);
|
|
913
962
|
}
|
|
914
963
|
}
|
|
915
964
|
try {
|
|
916
|
-
return
|
|
965
|
+
return W(200, await t.inspectRows({
|
|
917
966
|
table: s,
|
|
918
967
|
offset: c,
|
|
919
968
|
limit: l,
|
|
920
969
|
...u
|
|
921
970
|
}), i);
|
|
922
971
|
} catch (e) {
|
|
923
|
-
return e?.name === "InspectQueryError" ?
|
|
972
|
+
return e?.name === "InspectQueryError" ? W(400, {
|
|
924
973
|
error: "invalid query",
|
|
925
974
|
message: e.message
|
|
926
|
-
}, i) :
|
|
975
|
+
}, i) : W(500, {
|
|
927
976
|
error: "data-rows query failed",
|
|
928
977
|
message: e?.message ?? String(e)
|
|
929
978
|
}, i);
|
|
930
979
|
}
|
|
931
|
-
},
|
|
932
|
-
if (
|
|
933
|
-
let i =
|
|
934
|
-
if ((r.method ?? "GET").toUpperCase() !== "GET") return
|
|
980
|
+
}, Pt = async (e, t, n, r = {}) => {
|
|
981
|
+
if (K(e) !== "/_voltro/inspect/provenance") return null;
|
|
982
|
+
let i = G(n.origin ?? n.Origin);
|
|
983
|
+
if ((r.method ?? "GET").toUpperCase() !== "GET") return W(405, {
|
|
935
984
|
error: "method not allowed",
|
|
936
985
|
expected: "GET"
|
|
937
986
|
}, i);
|
|
938
|
-
if (
|
|
939
|
-
let a = (r.authResolver ??
|
|
940
|
-
if (!a.ok) return
|
|
987
|
+
if (H()) return W(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" }, i);
|
|
988
|
+
let a = (r.authResolver ?? U)(n);
|
|
989
|
+
if (!a.ok) return W(401, {
|
|
941
990
|
error: "unauthorized",
|
|
942
991
|
reason: a.reason
|
|
943
992
|
}, i);
|
|
944
|
-
if (t.kind !== "api") return
|
|
945
|
-
if (t.inspectRows === void 0) return
|
|
946
|
-
let o =
|
|
947
|
-
if (!s || !c) return
|
|
993
|
+
if (t.kind !== "api") return W(404, { error: "provenance is api-only" }, i);
|
|
994
|
+
if (t.inspectRows === void 0) return W(404, { error: "inspectRows not configured" }, i);
|
|
995
|
+
let o = q(e), s = o.get("table"), c = o.get("id"), l = o.get("column") ?? void 0;
|
|
996
|
+
if (!s || !c) return W(400, { error: "query.table and query.id are required" }, i);
|
|
948
997
|
try {
|
|
949
998
|
let e = (await t.inspectRows({
|
|
950
999
|
table: s,
|
|
@@ -956,175 +1005,175 @@ __installPublicEnv(publicEnvValues)
|
|
|
956
1005
|
value: c
|
|
957
1006
|
}
|
|
958
1007
|
})).rows[0];
|
|
959
|
-
return
|
|
1008
|
+
return W(200, k(e, {
|
|
960
1009
|
table: s,
|
|
961
1010
|
id: c,
|
|
962
1011
|
...l === void 0 ? {} : { column: l }
|
|
963
1012
|
}), i);
|
|
964
1013
|
} catch (e) {
|
|
965
|
-
return e?.name === "InspectQueryError" ?
|
|
1014
|
+
return e?.name === "InspectQueryError" ? W(400, {
|
|
966
1015
|
error: "invalid query",
|
|
967
1016
|
message: e.message
|
|
968
|
-
}, i) :
|
|
1017
|
+
}, i) : W(500, {
|
|
969
1018
|
error: "provenance query failed",
|
|
970
1019
|
message: e?.message ?? String(e)
|
|
971
1020
|
}, i);
|
|
972
1021
|
}
|
|
973
|
-
},
|
|
1022
|
+
}, q = (e) => {
|
|
974
1023
|
let t = e.indexOf("?");
|
|
975
1024
|
return t < 0 ? new URLSearchParams() : new URLSearchParams(e.slice(t + 1));
|
|
976
|
-
},
|
|
1025
|
+
}, J = (e) => {
|
|
977
1026
|
if (e === null || e === "") return;
|
|
978
1027
|
let t = Number(e);
|
|
979
1028
|
return Number.isFinite(t) && t >= 0 ? Math.floor(t) : void 0;
|
|
980
|
-
},
|
|
981
|
-
if (
|
|
982
|
-
let i =
|
|
983
|
-
if ((r.method ?? "GET").toUpperCase() !== "GET") return
|
|
1029
|
+
}, Ft = async (e, t, n, r = {}) => {
|
|
1030
|
+
if (K(e) !== "/_voltro/inspect/workflows/runs") return null;
|
|
1031
|
+
let i = G(n.origin ?? n.Origin);
|
|
1032
|
+
if ((r.method ?? "GET").toUpperCase() !== "GET") return W(405, {
|
|
984
1033
|
error: "method not allowed",
|
|
985
1034
|
expected: "GET"
|
|
986
1035
|
}, i);
|
|
987
|
-
if (
|
|
988
|
-
let a = (r.authResolver ??
|
|
989
|
-
if (!a.ok) return
|
|
1036
|
+
if (H()) return W(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" }, i);
|
|
1037
|
+
let a = (r.authResolver ?? U)(n);
|
|
1038
|
+
if (!a.ok) return W(401, {
|
|
990
1039
|
error: "unauthorized",
|
|
991
1040
|
reason: a.reason
|
|
992
1041
|
}, i);
|
|
993
|
-
if (t.kind !== "api") return
|
|
994
|
-
if (t.inspectWorkflowRuns === void 0) return
|
|
1042
|
+
if (t.kind !== "api") return W(404, { error: "workflows endpoint is api-only" }, i);
|
|
1043
|
+
if (t.inspectWorkflowRuns === void 0) return W(200, {
|
|
995
1044
|
runs: [],
|
|
996
1045
|
total: 0,
|
|
997
1046
|
offset: 0,
|
|
998
1047
|
limit: 50
|
|
999
1048
|
}, i);
|
|
1000
|
-
let o =
|
|
1049
|
+
let o = q(e);
|
|
1001
1050
|
try {
|
|
1002
|
-
return
|
|
1051
|
+
return W(200, await t.inspectWorkflowRuns({
|
|
1003
1052
|
...o.get("tag") === null ? {} : { tag: o.get("tag") },
|
|
1004
1053
|
...o.get("status") === null ? {} : { status: o.get("status") },
|
|
1005
|
-
offset:
|
|
1006
|
-
limit:
|
|
1054
|
+
offset: J(o.get("offset")) ?? 0,
|
|
1055
|
+
limit: J(o.get("limit")) ?? 50
|
|
1007
1056
|
}), i);
|
|
1008
1057
|
} catch (e) {
|
|
1009
|
-
return
|
|
1058
|
+
return W(500, {
|
|
1010
1059
|
error: "workflow-runs query failed",
|
|
1011
1060
|
message: e?.message ?? String(e)
|
|
1012
1061
|
}, i);
|
|
1013
1062
|
}
|
|
1014
|
-
},
|
|
1015
|
-
let a =
|
|
1063
|
+
}, It = async (e, t, n, r, i = {}) => {
|
|
1064
|
+
let a = K(e).match(/^\/_voltro\/inspect\/workflows\/start\/([^/]+)$/);
|
|
1016
1065
|
if (!a) return null;
|
|
1017
|
-
let o = decodeURIComponent(a[1] ?? ""), s =
|
|
1018
|
-
if ((i.method ?? "POST").toUpperCase() !== "POST") return
|
|
1066
|
+
let o = decodeURIComponent(a[1] ?? ""), s = G(n.origin ?? n.Origin);
|
|
1067
|
+
if ((i.method ?? "POST").toUpperCase() !== "POST") return W(405, {
|
|
1019
1068
|
error: "method not allowed",
|
|
1020
1069
|
expected: "POST"
|
|
1021
1070
|
}, s);
|
|
1022
|
-
if (
|
|
1023
|
-
let c = (i.authResolver ??
|
|
1024
|
-
if (!c.ok) return
|
|
1071
|
+
if (H()) return W(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" }, s);
|
|
1072
|
+
let c = (i.authResolver ?? U)(n);
|
|
1073
|
+
if (!c.ok) return W(401, {
|
|
1025
1074
|
error: "unauthorized",
|
|
1026
1075
|
reason: c.reason
|
|
1027
1076
|
}, s);
|
|
1028
|
-
if (t.kind !== "api") return
|
|
1029
|
-
if (t.inspectStartWorkflow === void 0) return
|
|
1077
|
+
if (t.kind !== "api") return W(404, { error: "workflow start is api-only" }, s);
|
|
1078
|
+
if (t.inspectStartWorkflow === void 0) return W(404, { error: "inspectStartWorkflow not configured" }, s);
|
|
1030
1079
|
let l = {};
|
|
1031
1080
|
if (r.length > 0) try {
|
|
1032
1081
|
l = JSON.parse(r).payload ?? {};
|
|
1033
1082
|
} catch {
|
|
1034
|
-
return
|
|
1083
|
+
return W(400, { error: "start requires JSON body `{ payload?: unknown }`" }, s);
|
|
1035
1084
|
}
|
|
1036
1085
|
try {
|
|
1037
|
-
return
|
|
1086
|
+
return W(200, await t.inspectStartWorkflow({
|
|
1038
1087
|
name: o,
|
|
1039
1088
|
payload: l
|
|
1040
1089
|
}), s);
|
|
1041
1090
|
} catch (e) {
|
|
1042
|
-
return
|
|
1091
|
+
return W(500, {
|
|
1043
1092
|
error: "workflow start failed",
|
|
1044
1093
|
message: e?.message ?? String(e)
|
|
1045
1094
|
}, s);
|
|
1046
1095
|
}
|
|
1047
|
-
},
|
|
1048
|
-
let i =
|
|
1096
|
+
}, Lt = async (e, t, n, r = {}) => {
|
|
1097
|
+
let i = K(e);
|
|
1049
1098
|
if (!i.startsWith("/_voltro/inspect/schedules")) return null;
|
|
1050
|
-
let a =
|
|
1051
|
-
if (
|
|
1052
|
-
let o = (r.authResolver ??
|
|
1053
|
-
if (!o.ok) return
|
|
1099
|
+
let a = G(n.origin ?? n.Origin);
|
|
1100
|
+
if (H()) return W(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" }, a);
|
|
1101
|
+
let o = (r.authResolver ?? U)(n);
|
|
1102
|
+
if (!o.ok) return W(401, {
|
|
1054
1103
|
error: "unauthorized",
|
|
1055
1104
|
reason: o.reason
|
|
1056
1105
|
}, a);
|
|
1057
|
-
if (t.kind !== "api") return
|
|
1106
|
+
if (t.kind !== "api") return W(404, { error: "schedules are api-only" }, a);
|
|
1058
1107
|
let s = (r.method ?? "GET").toUpperCase(), c = i.match(/^\/_voltro\/inspect\/schedules\/([^/]+)\/fire$/);
|
|
1059
1108
|
if (c) {
|
|
1060
|
-
if (s !== "POST") return
|
|
1109
|
+
if (s !== "POST") return W(405, {
|
|
1061
1110
|
error: "method not allowed",
|
|
1062
1111
|
expected: "POST"
|
|
1063
1112
|
}, a);
|
|
1064
|
-
if (!t.inspectFireSchedule) return
|
|
1065
|
-
let n = decodeURIComponent(c[1] ?? ""), r =
|
|
1113
|
+
if (!t.inspectFireSchedule) return W(404, { error: "inspectFireSchedule not configured" }, a);
|
|
1114
|
+
let n = decodeURIComponent(c[1] ?? ""), r = q(e).get("trigger") === "external" ? "external" : "manual";
|
|
1066
1115
|
try {
|
|
1067
|
-
return
|
|
1116
|
+
return W(200, await t.inspectFireSchedule({
|
|
1068
1117
|
name: n,
|
|
1069
1118
|
trigger: r
|
|
1070
1119
|
}), a);
|
|
1071
1120
|
} catch (e) {
|
|
1072
|
-
return
|
|
1121
|
+
return W(500, {
|
|
1073
1122
|
error: "fire failed",
|
|
1074
1123
|
message: e?.message ?? String(e)
|
|
1075
1124
|
}, a);
|
|
1076
1125
|
}
|
|
1077
1126
|
}
|
|
1078
1127
|
if (i === "/_voltro/inspect/schedules/runs") {
|
|
1079
|
-
if (s !== "GET") return
|
|
1128
|
+
if (s !== "GET") return W(405, {
|
|
1080
1129
|
error: "method not allowed",
|
|
1081
1130
|
expected: "GET"
|
|
1082
1131
|
}, a);
|
|
1083
|
-
if (!t.inspectScheduleRuns) return
|
|
1132
|
+
if (!t.inspectScheduleRuns) return W(200, {
|
|
1084
1133
|
runs: [],
|
|
1085
1134
|
total: 0,
|
|
1086
1135
|
offset: 0,
|
|
1087
1136
|
limit: 50
|
|
1088
1137
|
}, a);
|
|
1089
|
-
let n =
|
|
1138
|
+
let n = q(e);
|
|
1090
1139
|
try {
|
|
1091
|
-
return
|
|
1140
|
+
return W(200, await t.inspectScheduleRuns({
|
|
1092
1141
|
...n.get("name") === null ? {} : { name: n.get("name") },
|
|
1093
|
-
offset:
|
|
1094
|
-
limit:
|
|
1142
|
+
offset: J(n.get("offset")) ?? 0,
|
|
1143
|
+
limit: J(n.get("limit")) ?? 50
|
|
1095
1144
|
}), a);
|
|
1096
1145
|
} catch (e) {
|
|
1097
|
-
return
|
|
1146
|
+
return W(500, {
|
|
1098
1147
|
error: "schedule-runs query failed",
|
|
1099
1148
|
message: e?.message ?? String(e)
|
|
1100
1149
|
}, a);
|
|
1101
1150
|
}
|
|
1102
1151
|
}
|
|
1103
|
-
return i === "/_voltro/inspect/schedules" ? s === "GET" ? t.inspectSchedules ?
|
|
1152
|
+
return i === "/_voltro/inspect/schedules" ? s === "GET" ? t.inspectSchedules ? W(200, t.inspectSchedules(), a) : W(200, {
|
|
1104
1153
|
schedules: [],
|
|
1105
1154
|
coordination: "single"
|
|
1106
|
-
}, a) :
|
|
1155
|
+
}, a) : W(405, {
|
|
1107
1156
|
error: "method not allowed",
|
|
1108
1157
|
expected: "GET"
|
|
1109
|
-
}, a) :
|
|
1158
|
+
}, a) : W(404, {
|
|
1110
1159
|
error: "unknown schedules endpoint",
|
|
1111
1160
|
path: i
|
|
1112
1161
|
}, a);
|
|
1113
|
-
},
|
|
1114
|
-
if (
|
|
1115
|
-
let i =
|
|
1116
|
-
if (
|
|
1117
|
-
let a = (r.authResolver ??
|
|
1118
|
-
if (!a.ok) return
|
|
1162
|
+
}, Rt = async (e, t, n, r = {}) => {
|
|
1163
|
+
if (K(e) !== "/_voltro/inspect/cluster") return null;
|
|
1164
|
+
let i = G(n.origin ?? n.Origin);
|
|
1165
|
+
if (H()) return W(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" }, i);
|
|
1166
|
+
let a = (r.authResolver ?? U)(n);
|
|
1167
|
+
if (!a.ok) return W(401, {
|
|
1119
1168
|
error: "unauthorized",
|
|
1120
1169
|
reason: a.reason
|
|
1121
1170
|
}, i);
|
|
1122
|
-
if (t.kind !== "api") return
|
|
1123
|
-
if ((r.method ?? "GET").toUpperCase() !== "GET") return
|
|
1171
|
+
if (t.kind !== "api") return W(404, { error: "cluster is api-only" }, i);
|
|
1172
|
+
if ((r.method ?? "GET").toUpperCase() !== "GET") return W(405, {
|
|
1124
1173
|
error: "method not allowed",
|
|
1125
1174
|
expected: "GET"
|
|
1126
1175
|
}, i);
|
|
1127
|
-
if (!t.cluster) return
|
|
1176
|
+
if (!t.cluster) return W(200, {
|
|
1128
1177
|
instance: {
|
|
1129
1178
|
replicaId: process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`,
|
|
1130
1179
|
dialect: "memory",
|
|
@@ -1149,163 +1198,163 @@ __installPublicEnv(publicEnvValues)
|
|
|
1149
1198
|
capturedAt: Date.now()
|
|
1150
1199
|
}, i);
|
|
1151
1200
|
try {
|
|
1152
|
-
return
|
|
1201
|
+
return W(200, await t.cluster(), i);
|
|
1153
1202
|
} catch (e) {
|
|
1154
|
-
return
|
|
1203
|
+
return W(500, {
|
|
1155
1204
|
error: "cluster snapshot failed",
|
|
1156
1205
|
message: e?.message ?? String(e)
|
|
1157
1206
|
}, i);
|
|
1158
1207
|
}
|
|
1159
|
-
},
|
|
1160
|
-
let i =
|
|
1208
|
+
}, zt = async (e, t, n, r = {}) => {
|
|
1209
|
+
let i = K(e).match(/^\/_voltro\/inspect\/workflows\/runs\/([^/]+)\/steps$/);
|
|
1161
1210
|
if (!i) return null;
|
|
1162
|
-
let a = decodeURIComponent(i[1] ?? ""), o =
|
|
1163
|
-
if ((r.method ?? "GET").toUpperCase() !== "GET") return
|
|
1211
|
+
let a = decodeURIComponent(i[1] ?? ""), o = G(n.origin ?? n.Origin);
|
|
1212
|
+
if ((r.method ?? "GET").toUpperCase() !== "GET") return W(405, {
|
|
1164
1213
|
error: "method not allowed",
|
|
1165
1214
|
expected: "GET"
|
|
1166
1215
|
}, o);
|
|
1167
|
-
if (
|
|
1168
|
-
let s = (r.authResolver ??
|
|
1169
|
-
if (!s.ok) return
|
|
1216
|
+
if (H()) return W(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" }, o);
|
|
1217
|
+
let s = (r.authResolver ?? U)(n);
|
|
1218
|
+
if (!s.ok) return W(401, {
|
|
1170
1219
|
error: "unauthorized",
|
|
1171
1220
|
reason: s.reason
|
|
1172
1221
|
}, o);
|
|
1173
|
-
if (t.kind !== "api") return
|
|
1174
|
-
if (t.inspectWorkflowRunSteps === void 0) return
|
|
1222
|
+
if (t.kind !== "api") return W(404, { error: "workflow steps are api-only" }, o);
|
|
1223
|
+
if (t.inspectWorkflowRunSteps === void 0) return W(200, { steps: [] }, o);
|
|
1175
1224
|
try {
|
|
1176
|
-
return
|
|
1225
|
+
return W(200, await t.inspectWorkflowRunSteps({ runId: a }), o);
|
|
1177
1226
|
} catch (e) {
|
|
1178
|
-
return
|
|
1227
|
+
return W(500, {
|
|
1179
1228
|
error: "steps query failed",
|
|
1180
1229
|
message: e?.message ?? String(e)
|
|
1181
1230
|
}, o);
|
|
1182
1231
|
}
|
|
1183
|
-
},
|
|
1184
|
-
let i =
|
|
1232
|
+
}, Bt = async (e, t, n, r = {}) => {
|
|
1233
|
+
let i = K(e).match(/^\/_voltro\/inspect\/workflows\/runs\/([^/]+)\/events$/);
|
|
1185
1234
|
if (!i) return null;
|
|
1186
|
-
let a = decodeURIComponent(i[1] ?? ""), o =
|
|
1187
|
-
if ((r.method ?? "GET").toUpperCase() !== "GET") return
|
|
1235
|
+
let a = decodeURIComponent(i[1] ?? ""), o = G(n.origin ?? n.Origin);
|
|
1236
|
+
if ((r.method ?? "GET").toUpperCase() !== "GET") return W(405, {
|
|
1188
1237
|
error: "method not allowed",
|
|
1189
1238
|
expected: "GET"
|
|
1190
1239
|
}, o);
|
|
1191
|
-
if (
|
|
1192
|
-
let s = (r.authResolver ??
|
|
1193
|
-
if (!s.ok) return
|
|
1240
|
+
if (H()) return W(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" }, o);
|
|
1241
|
+
let s = (r.authResolver ?? U)(n);
|
|
1242
|
+
if (!s.ok) return W(401, {
|
|
1194
1243
|
error: "unauthorized",
|
|
1195
1244
|
reason: s.reason
|
|
1196
1245
|
}, o);
|
|
1197
|
-
if (t.kind !== "api") return
|
|
1198
|
-
if (t.inspectWorkflowRunEvents === void 0) return
|
|
1246
|
+
if (t.kind !== "api") return W(404, { error: "workflow events are api-only" }, o);
|
|
1247
|
+
if (t.inspectWorkflowRunEvents === void 0) return W(200, { events: [] }, o);
|
|
1199
1248
|
try {
|
|
1200
|
-
return
|
|
1249
|
+
return W(200, await t.inspectWorkflowRunEvents({ runId: a }), o);
|
|
1201
1250
|
} catch (e) {
|
|
1202
|
-
return
|
|
1251
|
+
return W(500, {
|
|
1203
1252
|
error: "events query failed",
|
|
1204
1253
|
message: e?.message ?? String(e)
|
|
1205
1254
|
}, o);
|
|
1206
1255
|
}
|
|
1207
|
-
},
|
|
1208
|
-
if (
|
|
1209
|
-
let i =
|
|
1210
|
-
if ((r.method ?? "GET").toUpperCase() !== "GET") return
|
|
1256
|
+
}, Vt = async (e, t, n, r = {}) => {
|
|
1257
|
+
if (K(t) !== "/_voltro/inspect/workflows/events") return null;
|
|
1258
|
+
let i = G(n.origin ?? n.Origin);
|
|
1259
|
+
if ((r.method ?? "GET").toUpperCase() !== "GET") return W(405, {
|
|
1211
1260
|
error: "method not allowed",
|
|
1212
1261
|
expected: "GET"
|
|
1213
1262
|
}, i);
|
|
1214
|
-
if (
|
|
1215
|
-
let a = (r.authResolver ??
|
|
1216
|
-
if (!a.ok) return
|
|
1263
|
+
if (H()) return W(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" }, i);
|
|
1264
|
+
let a = (r.authResolver ?? U)(n);
|
|
1265
|
+
if (!a.ok) return W(401, {
|
|
1217
1266
|
error: "unauthorized",
|
|
1218
1267
|
reason: a.reason
|
|
1219
1268
|
}, i);
|
|
1220
|
-
if (e.kind !== "api") return
|
|
1221
|
-
if (e.inspectWorkflowDomainEvents === void 0) return
|
|
1269
|
+
if (e.kind !== "api") return W(404, { error: "workflow domain events are api-only" }, i);
|
|
1270
|
+
if (e.inspectWorkflowDomainEvents === void 0) return W(200, {
|
|
1222
1271
|
events: [],
|
|
1223
1272
|
total: 0,
|
|
1224
1273
|
offset: 0,
|
|
1225
1274
|
limit: 100
|
|
1226
1275
|
}, i);
|
|
1227
|
-
let o =
|
|
1276
|
+
let o = Tt(t), s = o.get("name") ?? void 0, c = Number(o.get("offset") ?? "0"), l = Number(o.get("limit") ?? "100");
|
|
1228
1277
|
try {
|
|
1229
|
-
return
|
|
1278
|
+
return W(200, await e.inspectWorkflowDomainEvents({
|
|
1230
1279
|
...s !== void 0 && s !== "" ? { name: s } : {},
|
|
1231
1280
|
offset: Number.isFinite(c) ? c : 0,
|
|
1232
1281
|
limit: Number.isFinite(l) ? l : 100
|
|
1233
1282
|
}), i);
|
|
1234
1283
|
} catch (e) {
|
|
1235
|
-
return
|
|
1284
|
+
return W(500, {
|
|
1236
1285
|
error: "workflow domain events query failed",
|
|
1237
1286
|
message: e?.message ?? String(e)
|
|
1238
1287
|
}, i);
|
|
1239
1288
|
}
|
|
1240
|
-
},
|
|
1241
|
-
let i =
|
|
1289
|
+
}, Ht = async (e, t, n, r = {}) => {
|
|
1290
|
+
let i = K(t).match(/^\/_voltro\/inspect\/workflows\/events\/([^/]+)\/deliveries$/);
|
|
1242
1291
|
if (!i) return null;
|
|
1243
|
-
let a = decodeURIComponent(i[1] ?? ""), o =
|
|
1244
|
-
if ((r.method ?? "GET").toUpperCase() !== "GET") return
|
|
1292
|
+
let a = decodeURIComponent(i[1] ?? ""), o = G(n.origin ?? n.Origin);
|
|
1293
|
+
if ((r.method ?? "GET").toUpperCase() !== "GET") return W(405, {
|
|
1245
1294
|
error: "method not allowed",
|
|
1246
1295
|
expected: "GET"
|
|
1247
1296
|
}, o);
|
|
1248
|
-
if (
|
|
1249
|
-
let s = (r.authResolver ??
|
|
1250
|
-
if (!s.ok) return
|
|
1297
|
+
if (H()) return W(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" }, o);
|
|
1298
|
+
let s = (r.authResolver ?? U)(n);
|
|
1299
|
+
if (!s.ok) return W(401, {
|
|
1251
1300
|
error: "unauthorized",
|
|
1252
1301
|
reason: s.reason
|
|
1253
1302
|
}, o);
|
|
1254
|
-
if (e.kind !== "api") return
|
|
1255
|
-
if (e.inspectWorkflowEventDeliveries === void 0) return
|
|
1303
|
+
if (e.kind !== "api") return W(404, { error: "workflow event deliveries are api-only" }, o);
|
|
1304
|
+
if (e.inspectWorkflowEventDeliveries === void 0) return W(200, { deliveries: [] }, o);
|
|
1256
1305
|
try {
|
|
1257
|
-
return
|
|
1306
|
+
return W(200, await e.inspectWorkflowEventDeliveries({ eventId: a }), o);
|
|
1258
1307
|
} catch (e) {
|
|
1259
|
-
return
|
|
1308
|
+
return W(500, {
|
|
1260
1309
|
error: "workflow event deliveries query failed",
|
|
1261
1310
|
message: e?.message ?? String(e)
|
|
1262
1311
|
}, o);
|
|
1263
1312
|
}
|
|
1264
|
-
},
|
|
1265
|
-
if (
|
|
1266
|
-
let i =
|
|
1267
|
-
if ((r.method ?? "GET").toUpperCase() !== "GET") return
|
|
1313
|
+
}, Ut = async (e, t, n, r = {}) => {
|
|
1314
|
+
if (K(e) !== "/_voltro/inspect/workflows/children") return null;
|
|
1315
|
+
let i = G(n.origin ?? n.Origin);
|
|
1316
|
+
if ((r.method ?? "GET").toUpperCase() !== "GET") return W(405, {
|
|
1268
1317
|
error: "method not allowed",
|
|
1269
1318
|
expected: "GET"
|
|
1270
1319
|
}, i);
|
|
1271
|
-
if (
|
|
1272
|
-
let a = (r.authResolver ??
|
|
1273
|
-
if (!a.ok) return
|
|
1320
|
+
if (H()) return W(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" }, i);
|
|
1321
|
+
let a = (r.authResolver ?? U)(n);
|
|
1322
|
+
if (!a.ok) return W(401, {
|
|
1274
1323
|
error: "unauthorized",
|
|
1275
1324
|
reason: a.reason
|
|
1276
1325
|
}, i);
|
|
1277
|
-
if (t.kind !== "api") return
|
|
1278
|
-
let o =
|
|
1279
|
-
if (o === null || o === "") return
|
|
1280
|
-
if (t.inspectWorkflowChildren === void 0) return
|
|
1326
|
+
if (t.kind !== "api") return W(404, { error: "workflow children are api-only" }, i);
|
|
1327
|
+
let o = q(e).get("parentExecutionId");
|
|
1328
|
+
if (o === null || o === "") return W(400, { error: "parentExecutionId query param required" }, i);
|
|
1329
|
+
if (t.inspectWorkflowChildren === void 0) return W(200, {
|
|
1281
1330
|
runs: [],
|
|
1282
1331
|
total: 0,
|
|
1283
1332
|
offset: 0,
|
|
1284
1333
|
limit: 200
|
|
1285
1334
|
}, i);
|
|
1286
1335
|
try {
|
|
1287
|
-
return
|
|
1336
|
+
return W(200, await t.inspectWorkflowChildren({ parentExecutionId: o }), i);
|
|
1288
1337
|
} catch (e) {
|
|
1289
|
-
return
|
|
1338
|
+
return W(500, {
|
|
1290
1339
|
error: "children query failed",
|
|
1291
1340
|
message: e?.message ?? String(e)
|
|
1292
1341
|
}, i);
|
|
1293
1342
|
}
|
|
1294
|
-
},
|
|
1295
|
-
let a =
|
|
1343
|
+
}, Wt = async (e, t, n, r, i = {}) => {
|
|
1344
|
+
let a = K(e).match(/^\/_voltro\/inspect\/workflows\/runs\/([^/]+)\/(cancel|retry|suspend|resume|signal|update)$/);
|
|
1296
1345
|
if (!a) return null;
|
|
1297
|
-
let o = decodeURIComponent(a[1] ?? ""), s = a[2], c =
|
|
1298
|
-
if ((i.method ?? "POST").toUpperCase() !== "POST") return
|
|
1346
|
+
let o = decodeURIComponent(a[1] ?? ""), s = a[2], c = G(n.origin ?? n.Origin);
|
|
1347
|
+
if ((i.method ?? "POST").toUpperCase() !== "POST") return W(405, {
|
|
1299
1348
|
error: "method not allowed",
|
|
1300
1349
|
expected: "POST"
|
|
1301
1350
|
}, c);
|
|
1302
|
-
if (
|
|
1303
|
-
let l = (i.authResolver ??
|
|
1304
|
-
if (!l.ok) return
|
|
1351
|
+
if (H()) return W(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" }, c);
|
|
1352
|
+
let l = (i.authResolver ?? U)(n);
|
|
1353
|
+
if (!l.ok) return W(401, {
|
|
1305
1354
|
error: "unauthorized",
|
|
1306
1355
|
reason: l.reason
|
|
1307
1356
|
}, c);
|
|
1308
|
-
if (t.kind !== "api") return
|
|
1357
|
+
if (t.kind !== "api") return W(404, { error: "workflow actions are api-only" }, c);
|
|
1309
1358
|
let u = {
|
|
1310
1359
|
cancel: t.inspectCancelWorkflowRun,
|
|
1311
1360
|
retry: t.inspectRetryWorkflowRun,
|
|
@@ -1314,16 +1363,16 @@ __installPublicEnv(publicEnvValues)
|
|
|
1314
1363
|
signal: t.inspectSignalWorkflowRun,
|
|
1315
1364
|
update: t.inspectUpdateWorkflowRun
|
|
1316
1365
|
}[s];
|
|
1317
|
-
if (!u) return
|
|
1366
|
+
if (!u) return W(404, { error: `inspect${s[0]?.toUpperCase() ?? ""}${s.slice(1)}WorkflowRun not configured` }, c);
|
|
1318
1367
|
let d, f, p, m, h, g;
|
|
1319
1368
|
if (r.length > 0) try {
|
|
1320
1369
|
let e = JSON.parse(r);
|
|
1321
1370
|
s === "retry" && (d = e.payloadOverride), s === "signal" && (typeof e.signalName == "string" && e.signalName.length > 0 && (f = e.signalName), p = e.payload), s === "update" && (typeof e.updateName == "string" && e.updateName.length > 0 && (m = e.updateName), h = e.payload, typeof e.timeoutMs == "number" && Number.isFinite(e.timeoutMs) && (g = e.timeoutMs));
|
|
1322
1371
|
} catch {}
|
|
1323
|
-
if (s === "signal" && f === void 0) return
|
|
1324
|
-
if (s === "update" && m === void 0) return
|
|
1372
|
+
if (s === "signal" && f === void 0) return W(400, { error: "signal requires JSON body `{ signalName: string, payload?: unknown }`" }, c);
|
|
1373
|
+
if (s === "update" && m === void 0) return W(400, { error: "update requires JSON body `{ updateName: string, payload?: unknown, timeoutMs?: number }`" }, c);
|
|
1325
1374
|
try {
|
|
1326
|
-
return
|
|
1375
|
+
return W(200, s === "retry" && d !== void 0 ? await u({
|
|
1327
1376
|
runId: o,
|
|
1328
1377
|
payloadOverride: d
|
|
1329
1378
|
}) : s === "signal" ? await u({
|
|
@@ -1337,71 +1386,71 @@ __installPublicEnv(publicEnvValues)
|
|
|
1337
1386
|
...g === void 0 ? {} : { timeoutMs: g }
|
|
1338
1387
|
}) : await u({ runId: o }), c);
|
|
1339
1388
|
} catch (e) {
|
|
1340
|
-
return
|
|
1389
|
+
return W(500, {
|
|
1341
1390
|
error: `${s} failed`,
|
|
1342
1391
|
message: e?.message ?? String(e)
|
|
1343
1392
|
}, c);
|
|
1344
1393
|
}
|
|
1345
|
-
},
|
|
1346
|
-
if (
|
|
1347
|
-
let a =
|
|
1348
|
-
if (
|
|
1349
|
-
let o = (i.authResolver ??
|
|
1350
|
-
if (!o.ok) return
|
|
1394
|
+
}, Gt = async (e, t, n, r, i = {}) => {
|
|
1395
|
+
if (K(e) !== "/_voltro/inspect/data/import" || (i.method ?? "POST").toUpperCase() !== "POST") return null;
|
|
1396
|
+
let a = G(n.origin ?? n.Origin);
|
|
1397
|
+
if (H()) return W(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" }, a);
|
|
1398
|
+
let o = (i.authResolver ?? U)(n);
|
|
1399
|
+
if (!o.ok) return W(401, {
|
|
1351
1400
|
error: "unauthorized",
|
|
1352
1401
|
reason: o.reason
|
|
1353
1402
|
}, a);
|
|
1354
|
-
if (t.kind !== "api") return
|
|
1355
|
-
if (!t.inspectImport) return
|
|
1403
|
+
if (t.kind !== "api") return W(404, { error: "data import is api-only" }, a);
|
|
1404
|
+
if (!t.inspectImport) return W(404, { error: "inspectImport not configured" }, a);
|
|
1356
1405
|
let s;
|
|
1357
1406
|
try {
|
|
1358
1407
|
s = JSON.parse(r || "{}");
|
|
1359
1408
|
} catch {
|
|
1360
|
-
return
|
|
1409
|
+
return W(400, { error: "body must be JSON" }, a);
|
|
1361
1410
|
}
|
|
1362
|
-
if (typeof s.bundleDir != "string" || !s.bundleDir) return
|
|
1411
|
+
if (typeof s.bundleDir != "string" || !s.bundleDir) return W(400, { error: "body.bundleDir (string) is required" }, a);
|
|
1363
1412
|
try {
|
|
1364
|
-
return
|
|
1413
|
+
return W(200, await t.inspectImport({
|
|
1365
1414
|
bundleDir: s.bundleDir,
|
|
1366
1415
|
...s.mode === "upsert" || s.mode === "append" || s.mode === "replace" ? { mode: s.mode } : {},
|
|
1367
1416
|
...s.onConflict === "skip" || s.onConflict === "fail" ? { onConflict: s.onConflict } : {},
|
|
1368
1417
|
...typeof s.atomic == "boolean" ? { atomic: s.atomic } : {}
|
|
1369
1418
|
}), a);
|
|
1370
1419
|
} catch (e) {
|
|
1371
|
-
return
|
|
1420
|
+
return W(500, {
|
|
1372
1421
|
error: "import failed",
|
|
1373
1422
|
message: e?.message ?? String(e)
|
|
1374
1423
|
}, a);
|
|
1375
1424
|
}
|
|
1376
|
-
},
|
|
1377
|
-
let a =
|
|
1425
|
+
}, Kt = async (e, t, n, r, i = {}) => {
|
|
1426
|
+
let a = K(e);
|
|
1378
1427
|
if (!a.startsWith("/_voltro/inspect/data/rows")) return null;
|
|
1379
1428
|
let o = (i.method ?? "POST").toUpperCase();
|
|
1380
1429
|
if (o === "GET" && a === "/_voltro/inspect/data/rows") return null;
|
|
1381
|
-
let s =
|
|
1382
|
-
if (
|
|
1383
|
-
let c = (i.authResolver ??
|
|
1384
|
-
if (!c.ok) return
|
|
1430
|
+
let s = G(n.origin ?? n.Origin);
|
|
1431
|
+
if (H()) return W(503, { error: "inspect disabled (VOLTRO_INSPECT=off)" }, s);
|
|
1432
|
+
let c = (i.authResolver ?? U)(n);
|
|
1433
|
+
if (!c.ok) return W(401, {
|
|
1385
1434
|
error: "unauthorized",
|
|
1386
1435
|
reason: c.reason
|
|
1387
1436
|
}, s);
|
|
1388
|
-
if (t.kind !== "api") return
|
|
1437
|
+
if (t.kind !== "api") return W(404, { error: "data viewer is api-only" }, s);
|
|
1389
1438
|
if (o === "POST" && a === "/_voltro/inspect/data/rows") {
|
|
1390
|
-
if (!t.inspectInsertRow) return
|
|
1439
|
+
if (!t.inspectInsertRow) return W(404, { error: "inspectInsertRow not configured" }, s);
|
|
1391
1440
|
let e;
|
|
1392
1441
|
try {
|
|
1393
1442
|
e = JSON.parse(r || "{}");
|
|
1394
1443
|
} catch {
|
|
1395
|
-
return
|
|
1444
|
+
return W(400, { error: "body must be JSON" }, s);
|
|
1396
1445
|
}
|
|
1397
|
-
if (typeof e.table != "string" || !e.row || typeof e.row != "object") return
|
|
1446
|
+
if (typeof e.table != "string" || !e.row || typeof e.row != "object") return W(400, { error: "body must be { table: string, row: object }" }, s);
|
|
1398
1447
|
try {
|
|
1399
|
-
return
|
|
1448
|
+
return W(200, await t.inspectInsertRow({
|
|
1400
1449
|
table: e.table,
|
|
1401
1450
|
row: e.row
|
|
1402
1451
|
}), s);
|
|
1403
1452
|
} catch (e) {
|
|
1404
|
-
return
|
|
1453
|
+
return W(500, {
|
|
1405
1454
|
error: "insert failed",
|
|
1406
1455
|
message: e?.message ?? String(e)
|
|
1407
1456
|
}, s);
|
|
@@ -1410,50 +1459,50 @@ __installPublicEnv(publicEnvValues)
|
|
|
1410
1459
|
let l = a.match(/^\/_voltro\/inspect\/data\/rows\/([^/]+)$/);
|
|
1411
1460
|
if (!l) return null;
|
|
1412
1461
|
let u = decodeURIComponent(l[1] ?? "");
|
|
1413
|
-
if (!u) return
|
|
1414
|
-
let d =
|
|
1415
|
-
if (!d) return
|
|
1462
|
+
if (!u) return W(400, { error: "row id is required in URL" }, s);
|
|
1463
|
+
let d = q(e).get("table") ?? "";
|
|
1464
|
+
if (!d) return W(400, { error: "query.table is required" }, s);
|
|
1416
1465
|
if (o === "PATCH") {
|
|
1417
|
-
if (!t.inspectUpdateRow) return
|
|
1466
|
+
if (!t.inspectUpdateRow) return W(404, { error: "inspectUpdateRow not configured" }, s);
|
|
1418
1467
|
let e;
|
|
1419
1468
|
try {
|
|
1420
1469
|
e = JSON.parse(r || "{}");
|
|
1421
1470
|
} catch {
|
|
1422
|
-
return
|
|
1471
|
+
return W(400, { error: "body must be JSON" }, s);
|
|
1423
1472
|
}
|
|
1424
|
-
if (!e.patch || typeof e.patch != "object") return
|
|
1473
|
+
if (!e.patch || typeof e.patch != "object") return W(400, { error: "body.patch must be an object" }, s);
|
|
1425
1474
|
try {
|
|
1426
|
-
return
|
|
1475
|
+
return W(200, await t.inspectUpdateRow({
|
|
1427
1476
|
table: d,
|
|
1428
1477
|
id: u,
|
|
1429
1478
|
patch: e.patch
|
|
1430
1479
|
}), s);
|
|
1431
1480
|
} catch (e) {
|
|
1432
|
-
return
|
|
1481
|
+
return W(500, {
|
|
1433
1482
|
error: "update failed",
|
|
1434
1483
|
message: e?.message ?? String(e)
|
|
1435
1484
|
}, s);
|
|
1436
1485
|
}
|
|
1437
1486
|
}
|
|
1438
1487
|
if (o === "DELETE") {
|
|
1439
|
-
if (!t.inspectDeleteRow) return
|
|
1488
|
+
if (!t.inspectDeleteRow) return W(404, { error: "inspectDeleteRow not configured" }, s);
|
|
1440
1489
|
try {
|
|
1441
|
-
return
|
|
1490
|
+
return W(200, await t.inspectDeleteRow({
|
|
1442
1491
|
table: d,
|
|
1443
1492
|
id: u
|
|
1444
1493
|
}), s);
|
|
1445
1494
|
} catch (e) {
|
|
1446
|
-
return
|
|
1495
|
+
return W(500, {
|
|
1447
1496
|
error: "delete failed",
|
|
1448
1497
|
message: e?.message ?? String(e)
|
|
1449
1498
|
}, s);
|
|
1450
1499
|
}
|
|
1451
1500
|
}
|
|
1452
|
-
return
|
|
1501
|
+
return W(405, {
|
|
1453
1502
|
error: "method not allowed",
|
|
1454
1503
|
expected: "POST | PATCH | DELETE"
|
|
1455
1504
|
}, s);
|
|
1456
|
-
},
|
|
1505
|
+
}, qt = 256, Jt = (e = qt) => {
|
|
1457
1506
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
1458
1507
|
return {
|
|
1459
1508
|
emit(r, i) {
|
|
@@ -1476,27 +1525,27 @@ __installPublicEnv(publicEnvValues)
|
|
|
1476
1525
|
return t.slice();
|
|
1477
1526
|
}
|
|
1478
1527
|
};
|
|
1479
|
-
},
|
|
1528
|
+
}, Yt = (e) => `event: ${e.channel}\ndata: ${JSON.stringify(e)}\n\n`, Xt = () => `: keep-alive ${Date.now()}\n\n`, Zt = {
|
|
1480
1529
|
trace: 0,
|
|
1481
1530
|
debug: 1,
|
|
1482
1531
|
info: 2,
|
|
1483
1532
|
warn: 3,
|
|
1484
1533
|
error: 4,
|
|
1485
1534
|
fatal: 5
|
|
1486
|
-
},
|
|
1535
|
+
}, Qt = 2e3, $t = 200, en = class {
|
|
1487
1536
|
capacity;
|
|
1488
1537
|
buffer = [];
|
|
1489
|
-
constructor(e =
|
|
1538
|
+
constructor(e = Qt) {
|
|
1490
1539
|
this.capacity = e;
|
|
1491
1540
|
}
|
|
1492
1541
|
append(e) {
|
|
1493
1542
|
this.buffer.push(e), this.buffer.length > this.capacity && this.buffer.shift();
|
|
1494
1543
|
}
|
|
1495
1544
|
query(e = {}) {
|
|
1496
|
-
let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ??
|
|
1545
|
+
let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? $t, this.capacity), i = e.minLevel === void 0 ? Zt.trace : Zt[e.minLevel], a = e.scope?.toLowerCase(), o = e.source, s = e.filter?.toLowerCase(), c = e.traceId, l = [];
|
|
1497
1546
|
for (let e = this.buffer.length - 1; e >= 0 && l.length < r; e--) {
|
|
1498
1547
|
let r = this.buffer[e];
|
|
1499
|
-
r.ts < t || r.ts > n ||
|
|
1548
|
+
r.ts < t || r.ts > n || Zt[r.level] < i || o !== void 0 && r.source !== o || a !== void 0 && (r.scope === void 0 || !r.scope.toLowerCase().includes(a)) || s !== void 0 && !r.message.toLowerCase().includes(s) || c !== void 0 && r.fields.traceId !== c || l.push(r);
|
|
1500
1549
|
}
|
|
1501
1550
|
return l.reverse();
|
|
1502
1551
|
}
|
|
@@ -1509,7 +1558,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1509
1558
|
clear() {
|
|
1510
1559
|
this.buffer = [];
|
|
1511
1560
|
}
|
|
1512
|
-
},
|
|
1561
|
+
}, tn = null, nn = () => (tn === null && (tn = new en()), tn), rn = (e) => {
|
|
1513
1562
|
if (typeof e == "string") return e;
|
|
1514
1563
|
if (e instanceof Error) return e.message;
|
|
1515
1564
|
try {
|
|
@@ -1517,18 +1566,18 @@ __installPublicEnv(publicEnvValues)
|
|
|
1517
1566
|
} catch {
|
|
1518
1567
|
return String(e);
|
|
1519
1568
|
}
|
|
1520
|
-
},
|
|
1569
|
+
}, an = (e) => {
|
|
1521
1570
|
let t = {
|
|
1522
1571
|
log: console.log.bind(console),
|
|
1523
1572
|
info: console.info.bind(console),
|
|
1524
1573
|
warn: console.warn.bind(console),
|
|
1525
1574
|
error: console.error.bind(console),
|
|
1526
1575
|
debug: console.debug.bind(console)
|
|
1527
|
-
}, n =
|
|
1576
|
+
}, n = nn(), r = !1, i = (i) => (...a) => {
|
|
1528
1577
|
if (t[i](...a), !r) {
|
|
1529
1578
|
r = !0;
|
|
1530
1579
|
try {
|
|
1531
|
-
let t = a.length > 0 ?
|
|
1580
|
+
let t = a.length > 0 ? rn(a[0]) : "", r = t.length > 500 ? t.slice(0, 500) + "…" : t, o = O();
|
|
1532
1581
|
e.emit("log", {
|
|
1533
1582
|
level: i,
|
|
1534
1583
|
message: r,
|
|
@@ -1566,7 +1615,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1566
1615
|
argsCount: 1,
|
|
1567
1616
|
...t.scope === void 0 ? {} : { scope: t.scope }
|
|
1568
1617
|
});
|
|
1569
|
-
let a =
|
|
1618
|
+
let a = O(), o = a !== void 0 && t.fields.traceId === void 0 ? {
|
|
1570
1619
|
...t.fields,
|
|
1571
1620
|
traceId: a.traceId
|
|
1572
1621
|
} : t.fields;
|
|
@@ -1586,24 +1635,24 @@ __installPublicEnv(publicEnvValues)
|
|
|
1586
1635
|
return () => {
|
|
1587
1636
|
console.log = t.log, console.info = t.info, console.warn = t.warn, console.error = t.error, console.debug = t.debug, a();
|
|
1588
1637
|
};
|
|
1589
|
-
},
|
|
1638
|
+
}, on = 2e3, sn = 8, cn = 1e3, ln = 200, Y = (e, t) => e.length > t ? `${e.slice(0, t)}…` : e, un = (e) => {
|
|
1590
1639
|
switch (e) {
|
|
1591
1640
|
case "error": return "error";
|
|
1592
1641
|
case "warn": return "warn";
|
|
1593
1642
|
case "debug": return "debug";
|
|
1594
1643
|
default: return "info";
|
|
1595
1644
|
}
|
|
1596
|
-
},
|
|
1645
|
+
}, dn = g({ scope: "client" }), fn = (e, t) => {
|
|
1597
1646
|
let n;
|
|
1598
1647
|
try {
|
|
1599
1648
|
n = JSON.parse(e);
|
|
1600
1649
|
} catch {
|
|
1601
|
-
return
|
|
1650
|
+
return pn(400, { error: "invalid JSON body" });
|
|
1602
1651
|
}
|
|
1603
|
-
if (typeof n != "object" || !n) return
|
|
1652
|
+
if (typeof n != "object" || !n) return pn(400, { error: "body must be a JSON object" });
|
|
1604
1653
|
let r = n;
|
|
1605
|
-
if (!Array.isArray(r.entries)) return
|
|
1606
|
-
let i = typeof r.app == "string" ?
|
|
1654
|
+
if (!Array.isArray(r.entries)) return pn(400, { error: "entries must be an array" });
|
|
1655
|
+
let i = typeof r.app == "string" ? Y(r.app, 120) : void 0, a = typeof r.page == "string" ? Y(r.page, 200) : void 0, o = typeof r.ua == "string" ? Y(r.ua, 200) : void 0, s = r.entries.slice(0, ln), c = 0;
|
|
1607
1656
|
for (let e of s) {
|
|
1608
1657
|
if (typeof e != "object" || !e) continue;
|
|
1609
1658
|
let n = e;
|
|
@@ -1614,7 +1663,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1614
1663
|
"warn",
|
|
1615
1664
|
"error",
|
|
1616
1665
|
"debug"
|
|
1617
|
-
].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l =
|
|
1666
|
+
].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = Y(n.message, on), u = Array.isArray(n.args) ? n.args.slice(0, sn).filter((e) => typeof e == "string").map((e) => Y(e, cn)) : void 0, d = typeof n.stack == "string" ? Y(n.stack, on) : void 0;
|
|
1618
1667
|
t.emit("clientLog", {
|
|
1619
1668
|
ts: s,
|
|
1620
1669
|
level: r,
|
|
@@ -1629,35 +1678,35 @@ __installPublicEnv(publicEnvValues)
|
|
|
1629
1678
|
...i === void 0 ? {} : { app: i },
|
|
1630
1679
|
...a === void 0 ? {} : { page: a },
|
|
1631
1680
|
...u !== void 0 && u.length > 0 ? { args: u } : {}
|
|
1632
|
-
}, p =
|
|
1633
|
-
(p === "error" || p === "warn") && d !== void 0 ?
|
|
1681
|
+
}, p = un(r);
|
|
1682
|
+
(p === "error" || p === "warn") && d !== void 0 ? dn[p](l, f, { stack: d }) : dn[p](l, {
|
|
1634
1683
|
...f,
|
|
1635
1684
|
...d === void 0 ? {} : { stack: d }
|
|
1636
1685
|
}), c++;
|
|
1637
1686
|
}
|
|
1638
|
-
return
|
|
1687
|
+
return pn(202, {
|
|
1639
1688
|
accepted: c,
|
|
1640
1689
|
dropped: r.entries.length - c
|
|
1641
1690
|
});
|
|
1642
|
-
},
|
|
1691
|
+
}, pn = (e, t) => ({
|
|
1643
1692
|
status: e,
|
|
1644
1693
|
contentType: "application/json; charset=utf-8",
|
|
1645
1694
|
body: JSON.stringify(t)
|
|
1646
|
-
}),
|
|
1695
|
+
}), mn = "/_voltro/inspect/clientLog", hn = [
|
|
1647
1696
|
"trace",
|
|
1648
1697
|
"debug",
|
|
1649
1698
|
"info",
|
|
1650
1699
|
"warn",
|
|
1651
1700
|
"error",
|
|
1652
1701
|
"fatal"
|
|
1653
|
-
],
|
|
1702
|
+
], gn = {
|
|
1654
1703
|
trace: "TRACE",
|
|
1655
1704
|
debug: "DEBUG",
|
|
1656
1705
|
info: "INFO ",
|
|
1657
1706
|
warn: "WARN ",
|
|
1658
1707
|
error: "ERROR",
|
|
1659
1708
|
fatal: "FATAL"
|
|
1660
|
-
},
|
|
1709
|
+
}, _n = (e) => hn.includes(e), vn = (e, t) => {
|
|
1661
1710
|
let n = e.indexOf("?"), r = n === -1 ? new URLSearchParams() : new URLSearchParams(e.slice(n + 1)), i = {}, a = r.get("since");
|
|
1662
1711
|
if (a !== null) {
|
|
1663
1712
|
let e = Number(a);
|
|
@@ -1674,7 +1723,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1674
1723
|
Number.isFinite(e) && e > 0 && (i.max = Math.floor(e));
|
|
1675
1724
|
}
|
|
1676
1725
|
let c = r.get("level");
|
|
1677
|
-
c !== null &&
|
|
1726
|
+
c !== null && _n(c) && (i.minLevel = c);
|
|
1678
1727
|
let l = r.get("source");
|
|
1679
1728
|
(l === "server" || l === "client") && (i.source = l);
|
|
1680
1729
|
let u = r.get("scope");
|
|
@@ -1687,7 +1736,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1687
1736
|
if ((r.get("format") ?? "json") === "text") return {
|
|
1688
1737
|
status: 200,
|
|
1689
1738
|
contentType: "text/plain; charset=utf-8",
|
|
1690
|
-
body: p.map(
|
|
1739
|
+
body: p.map(yn).join("\n") + (p.length > 0 ? "\n" : "")
|
|
1691
1740
|
};
|
|
1692
1741
|
let m = {
|
|
1693
1742
|
capturedAt: Date.now(),
|
|
@@ -1701,34 +1750,34 @@ __installPublicEnv(publicEnvValues)
|
|
|
1701
1750
|
contentType: "application/json; charset=utf-8",
|
|
1702
1751
|
body: JSON.stringify(m)
|
|
1703
1752
|
};
|
|
1704
|
-
},
|
|
1705
|
-
let t = new Date(e.ts), n = String(t.getHours()).padStart(2, "0"), r = String(t.getMinutes()).padStart(2, "0"), i = String(t.getSeconds()).padStart(2, "0"), a = String(t.getMilliseconds()).padStart(3, "0"), o = `[${e.scope ?? "?"}/${e.source}]`, s =
|
|
1706
|
-
return `${n}:${r}:${i}.${a} ${
|
|
1707
|
-
},
|
|
1753
|
+
}, yn = (e) => {
|
|
1754
|
+
let t = new Date(e.ts), n = String(t.getHours()).padStart(2, "0"), r = String(t.getMinutes()).padStart(2, "0"), i = String(t.getSeconds()).padStart(2, "0"), a = String(t.getMilliseconds()).padStart(3, "0"), o = `[${e.scope ?? "?"}/${e.source}]`, s = xn(e.fields);
|
|
1755
|
+
return `${n}:${r}:${i}.${a} ${gn[e.level]} ${o} ${e.message}${s}`;
|
|
1756
|
+
}, bn = 80, xn = (e) => {
|
|
1708
1757
|
let t = Object.entries(e);
|
|
1709
1758
|
if (t.length === 0) return "";
|
|
1710
1759
|
let n = [];
|
|
1711
1760
|
for (let [e, r] of t) {
|
|
1712
1761
|
if (r === void 0) continue;
|
|
1713
|
-
let t =
|
|
1762
|
+
let t = Sn(r);
|
|
1714
1763
|
n.push(`${e}=${t}`);
|
|
1715
1764
|
}
|
|
1716
1765
|
return n.length > 0 ? " " + n.join(" ") : "";
|
|
1717
|
-
},
|
|
1766
|
+
}, Sn = (e) => {
|
|
1718
1767
|
if (typeof e == "string") {
|
|
1719
|
-
let t = e.length >
|
|
1768
|
+
let t = e.length > bn ? e.slice(0, bn) + "…" : e;
|
|
1720
1769
|
return /[\s=]/.test(t) ? `"${t.replace(/"/g, "\\\"")}"` : t;
|
|
1721
1770
|
}
|
|
1722
1771
|
if (e === null) return "null";
|
|
1723
1772
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
1724
1773
|
try {
|
|
1725
1774
|
let t = JSON.stringify(e);
|
|
1726
|
-
return t.length >
|
|
1775
|
+
return t.length > bn ? t.slice(0, bn) + "…" : t;
|
|
1727
1776
|
} catch {
|
|
1728
1777
|
return "[unserialisable]";
|
|
1729
1778
|
}
|
|
1730
|
-
},
|
|
1731
|
-
|
|
1779
|
+
}, Cn = "/_voltro/inspect/logs", wn = g({ scope: "voltro:cli" }), Tn = [], En = (e) => {
|
|
1780
|
+
Tn.length = 0;
|
|
1732
1781
|
let r = e[1] && !e[1].startsWith("-") ? e[1] : void 0, i = r ? n(r) ? r : a(process.cwd(), r) : process.cwd(), o = [], s = i;
|
|
1733
1782
|
for (;;) {
|
|
1734
1783
|
o.push(s);
|
|
@@ -1739,7 +1788,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1739
1788
|
for (let e of o) for (let t of [".env.local", ".env"]) {
|
|
1740
1789
|
let n = a(e, t);
|
|
1741
1790
|
if (y(n)) {
|
|
1742
|
-
|
|
1791
|
+
Tn.push(n);
|
|
1743
1792
|
try {
|
|
1744
1793
|
let e = C(n, "utf8");
|
|
1745
1794
|
for (let t of e.split(/\r?\n/)) {
|
|
@@ -1751,15 +1800,15 @@ __installPublicEnv(publicEnvValues)
|
|
|
1751
1800
|
(i.startsWith("\"") && i.endsWith("\"") || i.startsWith("'") && i.endsWith("'")) && (i = i.slice(1, -1)), process.env[r] === void 0 && (process.env[r] = i);
|
|
1752
1801
|
}
|
|
1753
1802
|
} catch (e) {
|
|
1754
|
-
|
|
1803
|
+
wn.warn("failed to load env file (continuing)", { path: n }, e);
|
|
1755
1804
|
}
|
|
1756
1805
|
}
|
|
1757
1806
|
}
|
|
1758
|
-
},
|
|
1807
|
+
}, Dn = 500, On = (e, t, n = {}) => {
|
|
1759
1808
|
if (e.length === 0) return () => {};
|
|
1760
1809
|
let r = (e) => n.root ? i(n.root, e) : e, a = !1, o = (e) => {
|
|
1761
1810
|
a || (a = !0, t.warn(`.env changed (${r(e)}) — hard-restarting: process.env is read once at boot, a reload would keep stale values`, { file: r(e) }), Promise.resolve().then(() => n.onBeforeRestart?.()).catch((e) => t.warn(".env restart: onBeforeRestart failed (continuing)", {}, e)).finally(() => {
|
|
1762
|
-
let e =
|
|
1811
|
+
let e = le(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
|
|
1763
1812
|
stdio: "inherit",
|
|
1764
1813
|
env: process.env,
|
|
1765
1814
|
cwd: n.cwd ?? process.cwd()
|
|
@@ -1773,16 +1822,16 @@ __installPublicEnv(publicEnvValues)
|
|
|
1773
1822
|
});
|
|
1774
1823
|
}));
|
|
1775
1824
|
};
|
|
1776
|
-
for (let t of e) D(t, { interval:
|
|
1825
|
+
for (let t of e) D(t, { interval: Dn }, (e, n) => {
|
|
1777
1826
|
e.mtimeMs !== n.mtimeMs && o(t);
|
|
1778
1827
|
});
|
|
1779
1828
|
return t.info("watching .env files for changes", {
|
|
1780
1829
|
files: e.map(r),
|
|
1781
|
-
intervalMs:
|
|
1830
|
+
intervalMs: Dn
|
|
1782
1831
|
}), () => {
|
|
1783
1832
|
for (let t of e) ee(t);
|
|
1784
1833
|
};
|
|
1785
|
-
},
|
|
1834
|
+
}, kn = [{
|
|
1786
1835
|
match: (e) => typeof e == "string" && e.startsWith("[BABEL] Note: The code generator has deoptimised"),
|
|
1787
1836
|
handle: (e, t) => {
|
|
1788
1837
|
let n = e[0], r = n.match(/deoptimised the styling of (.+?) as it exceeds the max of (\d+\w*B)\.?/);
|
|
@@ -1794,13 +1843,13 @@ __installPublicEnv(publicEnvValues)
|
|
|
1794
1843
|
});
|
|
1795
1844
|
} else t.info(n);
|
|
1796
1845
|
}
|
|
1797
|
-
}],
|
|
1846
|
+
}], An = () => {
|
|
1798
1847
|
let e = {
|
|
1799
1848
|
warn: console.warn.bind(console),
|
|
1800
1849
|
error: console.error.bind(console)
|
|
1801
1850
|
}, t = g({ scope: "babel" }), n = !1, r = (r) => (...i) => {
|
|
1802
1851
|
if (!n) {
|
|
1803
|
-
for (let e of
|
|
1852
|
+
for (let e of kn) if (e.match(i[0])) {
|
|
1804
1853
|
n = !0;
|
|
1805
1854
|
try {
|
|
1806
1855
|
e.handle(i, t);
|
|
@@ -1815,7 +1864,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1815
1864
|
return console.warn = r("warn"), console.error = r("error"), () => {
|
|
1816
1865
|
console.warn = e.warn, console.error = e.error;
|
|
1817
1866
|
};
|
|
1818
|
-
},
|
|
1867
|
+
}, jn = "virtual:voltro-route-refresh", Mn = `\0${jn}`, Nn = /(?:^|&)(raw|url|inline|worker|sharedworker|direct)(?:&|=|$)/, Pn = () => "\n// GENERATED by @voltro/cli — the `voltro dev` route Fast Refresh runtime.\n\n/** Mirrors react-refresh's own `isLikelyComponentType` closely enough for the\n * decision we make with it: an uppercase-named function, or a React element\n * type object (memo / forwardRef / lazy carry `$$typeof`). */\nconst isComponentLike = (value) => {\n if (typeof value === 'function') {\n const name = value.displayName ?? value.name\n return typeof name === 'string' && /^[A-Z]/.test(name)\n }\n return typeof value === 'object' && value !== null && '$$typeof' in value\n}\n\n/** Value identity that survives module re-evaluation. A function is compared by\n * SOURCE TEXT — a re-evaluated but unedited `loader` is a brand-new object\n * with identical text — and everything else by its JSON form, so a `meta`\n * object literal does not read as changed on every edit. */\nconst stableForm = (value) => {\n if (typeof value === 'function') return 'fn:' + String(value)\n try { return 'js:' + JSON.stringify(value) } catch { return 'st:' + String(value) }\n}\n\n/** id (absolute file path, as react-refresh spells it) → export names that\n * react-refresh must NOT judge. */\nconst ignoredExports = new Map()\n\nexport const registerRouteModule = (id, moduleExports) => {\n const names = []\n for (const key of Object.keys(moduleExports)) {\n if (key === 'default') continue\n if (isComponentLike(moduleExports[key])) continue\n names.push(key)\n }\n ignoredExports.set(id, names)\n}\n\n/** The name of the first non-component export whose VALUE changed, or null when\n * this update is a pure component edit that Fast Refresh can apply in place. */\nexport const routeUpdateNeedsReload = (prevExports, nextExports) => {\n const keys = new Set([...Object.keys(prevExports), ...Object.keys(nextExports)])\n for (const key of keys) {\n if (key === 'default') continue\n const prev = prevExports[key]\n const next = nextExports[key]\n if (isComponentLike(prev) && isComponentLike(next)) continue\n if (stableForm(prev) !== stableForm(next)) return key\n }\n return null\n}\n\n// `globalThis`, not `window`: identical in the browser (which is the only place\n// this module is ever loaded) and it keeps the runtime evaluatable by the unit\n// test, which is what lets the test read the REAL source instead of a copy.\n// Chained rather than overwritten — another plugin may own the hook for its own\n// modules, and ours only answers for ids it registered.\nconst previousHook = globalThis.__getReactRefreshIgnoredExports\nglobalThis.__getReactRefreshIgnoredExports = (args) =>\n ignoredExports.get(args.id) ?? previousHook?.(args) ?? []\n", Fn = (e) => `
|
|
1819
1868
|
if (import.meta.hot) {
|
|
1820
1869
|
// Self-import to read our OWN exports, the same technique the react plugin
|
|
1821
1870
|
// uses; the namespace is only complete after evaluation, hence the promise.
|
|
@@ -1839,26 +1888,26 @@ if (import.meta.hot) {
|
|
|
1839
1888
|
import {
|
|
1840
1889
|
registerRouteModule as __voltro_registerRouteModule,
|
|
1841
1890
|
routeUpdateNeedsReload as __voltro_routeUpdateNeedsReload,
|
|
1842
|
-
} from '${
|
|
1843
|
-
`,
|
|
1844
|
-
let [n = "", r] =
|
|
1845
|
-
if (!n.endsWith(".tsx") || r !== void 0 &&
|
|
1846
|
-
let i =
|
|
1891
|
+
} from '${jn}'
|
|
1892
|
+
`, In = (e) => e.replace(/\\/g, "/"), Ln = (e, t) => {
|
|
1893
|
+
let [n = "", r] = In(e).split("?");
|
|
1894
|
+
if (!n.endsWith(".tsx") || r !== void 0 && Nn.test(r)) return !1;
|
|
1895
|
+
let i = In(t).replace(/\/$/, "");
|
|
1847
1896
|
return n.startsWith(`${i}/`);
|
|
1848
|
-
},
|
|
1897
|
+
}, Rn = (e, t, n) => Ln(t, n) ? `${e}${Fn(In(t).split("?")[0] ?? t)}` : null, zn = (e) => ({
|
|
1849
1898
|
name: "voltro:route-fast-refresh",
|
|
1850
1899
|
enforce: "pre",
|
|
1851
|
-
resolveId: (e) => e === "virtual:voltro-route-refresh" ?
|
|
1852
|
-
load: (e) => e ===
|
|
1900
|
+
resolveId: (e) => e === "virtual:voltro-route-refresh" ? Mn : void 0,
|
|
1901
|
+
load: (e) => e === Mn ? Pn() : void 0,
|
|
1853
1902
|
transform: (t, n, r) => {
|
|
1854
1903
|
if (r?.ssr === !0) return null;
|
|
1855
|
-
let i =
|
|
1904
|
+
let i = Rn(t, n, e);
|
|
1856
1905
|
return i === null ? null : {
|
|
1857
1906
|
code: i,
|
|
1858
1907
|
map: null
|
|
1859
1908
|
};
|
|
1860
1909
|
}
|
|
1861
|
-
}),
|
|
1910
|
+
}), Bn = () => {
|
|
1862
1911
|
let e = /* @__PURE__ */ new Map();
|
|
1863
1912
|
return {
|
|
1864
1913
|
get(t) {
|
|
@@ -1885,7 +1934,7 @@ import {
|
|
|
1885
1934
|
return Array.from(e.entries());
|
|
1886
1935
|
}
|
|
1887
1936
|
};
|
|
1888
|
-
},
|
|
1937
|
+
}, Vn = (e) => {
|
|
1889
1938
|
if (typeof e == "number" && Number.isFinite(e) && e > 0) return e * 1e3;
|
|
1890
1939
|
if (typeof e != "string") return null;
|
|
1891
1940
|
let t = /^\s*(\d+)\s*(s|seconds?|m|minutes?|h|hours?|d|days?)\s*$/i.exec(e);
|
|
@@ -1894,17 +1943,17 @@ import {
|
|
|
1894
1943
|
if (!Number.isFinite(n) || n <= 0) return null;
|
|
1895
1944
|
let r = t[2].toLowerCase();
|
|
1896
1945
|
return r === "s" || r.startsWith("second") ? n * 1e3 : r === "m" || r.startsWith("minute") ? n * 6e4 : r === "h" || r.startsWith("hour") ? n * 36e5 : r === "d" || r.startsWith("day") ? n * 864e5 : null;
|
|
1897
|
-
},
|
|
1946
|
+
}, Hn = (e, t = {}) => {
|
|
1898
1947
|
let n = [e];
|
|
1899
1948
|
return t.tenant !== void 0 && t.tenant !== "" && n.push(`tenant=${t.tenant}`), t.locale !== void 0 && t.locale !== "" && n.push(`lang=${t.locale}`), n.join("|");
|
|
1900
|
-
},
|
|
1949
|
+
}, Un = (e, t) => e.expiresAt > t, Wn = (e, t) => e.expiresAt <= t && e.servableUntil > t, Gn = r(de(), ".voltro"), Kn = r(Gn, "runtime-registry.json"), qn = 3e4, Jn = () => {
|
|
1901
1950
|
let e = Math.random().toString(36).slice(2, 10);
|
|
1902
|
-
return `${
|
|
1903
|
-
},
|
|
1904
|
-
await S.mkdir(
|
|
1905
|
-
},
|
|
1951
|
+
return `${Kn}.${process.pid}.${Date.now()}.${e}.tmp`;
|
|
1952
|
+
}, Yn = async () => {
|
|
1953
|
+
await S.mkdir(Gn, { recursive: !0 });
|
|
1954
|
+
}, Xn = async () => {
|
|
1906
1955
|
try {
|
|
1907
|
-
let e = await S.readFile(
|
|
1956
|
+
let e = await S.readFile(Kn, "utf8"), t = JSON.parse(e);
|
|
1908
1957
|
return t.version !== 1 || !Array.isArray(t.apps) ? {
|
|
1909
1958
|
version: 1,
|
|
1910
1959
|
apps: []
|
|
@@ -1915,31 +1964,31 @@ import {
|
|
|
1915
1964
|
apps: []
|
|
1916
1965
|
};
|
|
1917
1966
|
}
|
|
1918
|
-
},
|
|
1919
|
-
await
|
|
1920
|
-
let t =
|
|
1967
|
+
}, Zn = async (e) => {
|
|
1968
|
+
await Yn();
|
|
1969
|
+
let t = Jn();
|
|
1921
1970
|
try {
|
|
1922
|
-
await S.writeFile(t, JSON.stringify(e, null, 2), "utf8"), await S.rename(t,
|
|
1971
|
+
await S.writeFile(t, JSON.stringify(e, null, 2), "utf8"), await S.rename(t, Kn);
|
|
1923
1972
|
} catch (e) {
|
|
1924
1973
|
try {
|
|
1925
1974
|
await S.unlink(t);
|
|
1926
1975
|
} catch {}
|
|
1927
1976
|
throw e;
|
|
1928
1977
|
}
|
|
1929
|
-
},
|
|
1978
|
+
}, Qn = (e) => {
|
|
1930
1979
|
try {
|
|
1931
1980
|
return process.kill(e, 0), !0;
|
|
1932
1981
|
} catch {
|
|
1933
1982
|
return !1;
|
|
1934
1983
|
}
|
|
1935
|
-
},
|
|
1984
|
+
}, $n = (e) => {
|
|
1936
1985
|
let t = Date.now();
|
|
1937
|
-
return e.filter((e) =>
|
|
1938
|
-
},
|
|
1939
|
-
let e = await
|
|
1986
|
+
return e.filter((e) => Qn(e.pid) ? t - new Date(e.heartbeatAt).getTime() < qn : !1);
|
|
1987
|
+
}, er = async () => {
|
|
1988
|
+
let e = await Xn(), t = $n(e.apps);
|
|
1940
1989
|
if (t.length === e.apps.length) return e;
|
|
1941
1990
|
try {
|
|
1942
|
-
await
|
|
1991
|
+
await Zn({
|
|
1943
1992
|
version: 1,
|
|
1944
1993
|
apps: t
|
|
1945
1994
|
});
|
|
@@ -1948,48 +1997,48 @@ import {
|
|
|
1948
1997
|
version: 1,
|
|
1949
1998
|
apps: t
|
|
1950
1999
|
};
|
|
1951
|
-
},
|
|
1952
|
-
let t = await
|
|
2000
|
+
}, tr = async (e) => {
|
|
2001
|
+
let t = await Xn(), n = (/* @__PURE__ */ new Date()).toISOString(), r = t.apps.findIndex((t) => t.id === e.id), i = {
|
|
1953
2002
|
...e,
|
|
1954
2003
|
registeredAt: r >= 0 ? t.apps[r].registeredAt : n,
|
|
1955
2004
|
heartbeatAt: n
|
|
1956
2005
|
};
|
|
1957
|
-
await
|
|
2006
|
+
await Zn({
|
|
1958
2007
|
version: 1,
|
|
1959
2008
|
apps: r >= 0 ? t.apps.map((e, t) => t === r ? i : e) : [...t.apps, i]
|
|
1960
2009
|
});
|
|
1961
|
-
},
|
|
2010
|
+
}, nr = async (e) => {
|
|
1962
2011
|
try {
|
|
1963
|
-
let t = await
|
|
2012
|
+
let t = await Xn(), n = t.apps.filter((t) => t.id !== e);
|
|
1964
2013
|
if (n.length === t.apps.length) return;
|
|
1965
|
-
await
|
|
2014
|
+
await Zn({
|
|
1966
2015
|
version: 1,
|
|
1967
2016
|
apps: n
|
|
1968
2017
|
});
|
|
1969
2018
|
} catch {}
|
|
1970
|
-
},
|
|
2019
|
+
}, rr = (e, t, n) => `${e}:${t}:${n}`, X = r(de(), ".voltro", "logs"), ir = () => {
|
|
1971
2020
|
let e = Number(process.env.VOLTRO_LOG_FILE_TTL_MS);
|
|
1972
2021
|
return Number.isFinite(e) && e > 0 ? e : 3600 * 1e3;
|
|
1973
|
-
},
|
|
1974
|
-
if (
|
|
1975
|
-
|
|
1976
|
-
let e = Date.now() -
|
|
2022
|
+
}, ar = !1, or = () => {
|
|
2023
|
+
if (ar) return;
|
|
2024
|
+
ar = !0;
|
|
2025
|
+
let e = Date.now() - ir(), t = [];
|
|
1977
2026
|
try {
|
|
1978
|
-
t = w(
|
|
2027
|
+
t = w(X);
|
|
1979
2028
|
} catch {
|
|
1980
2029
|
return;
|
|
1981
2030
|
}
|
|
1982
2031
|
for (let n of t) {
|
|
1983
2032
|
if (!n.endsWith(".log")) continue;
|
|
1984
|
-
let t = r(
|
|
2033
|
+
let t = r(X, n);
|
|
1985
2034
|
try {
|
|
1986
2035
|
T(t).mtimeMs < e && E(t);
|
|
1987
2036
|
} catch {}
|
|
1988
2037
|
}
|
|
1989
|
-
},
|
|
1990
|
-
let t =
|
|
2038
|
+
}, sr = (e) => e.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80), cr = (e, t) => r(X, `${sr(e)}-${t}.log`), lr = (e) => {
|
|
2039
|
+
let t = sr(e), n = [];
|
|
1991
2040
|
try {
|
|
1992
|
-
n = w(
|
|
2041
|
+
n = w(X);
|
|
1993
2042
|
} catch {
|
|
1994
2043
|
return;
|
|
1995
2044
|
}
|
|
@@ -1997,19 +2046,19 @@ import {
|
|
|
1997
2046
|
if (i.length === 0) return;
|
|
1998
2047
|
let a, o = -1;
|
|
1999
2048
|
for (let e of i) {
|
|
2000
|
-
let t = r(
|
|
2049
|
+
let t = r(X, e);
|
|
2001
2050
|
try {
|
|
2002
2051
|
let e = T(t);
|
|
2003
2052
|
e.mtimeMs > o && (o = e.mtimeMs, a = t);
|
|
2004
2053
|
} catch {}
|
|
2005
2054
|
}
|
|
2006
2055
|
return a;
|
|
2007
|
-
},
|
|
2056
|
+
}, ur = (e) => {
|
|
2008
2057
|
try {
|
|
2009
|
-
b(
|
|
2058
|
+
b(X, { recursive: !0 });
|
|
2010
2059
|
} catch {}
|
|
2011
|
-
|
|
2012
|
-
let t =
|
|
2060
|
+
or();
|
|
2061
|
+
let t = cr(e, process.pid), n = x(t, "w"), r = (e) => {
|
|
2013
2062
|
let t = {
|
|
2014
2063
|
ts: e.ts.getTime(),
|
|
2015
2064
|
level: e.level,
|
|
@@ -2032,7 +2081,7 @@ import {
|
|
|
2032
2081
|
}
|
|
2033
2082
|
}, i = !1, a = h((e) => {
|
|
2034
2083
|
if (!i) try {
|
|
2035
|
-
|
|
2084
|
+
te(n, r(e));
|
|
2036
2085
|
} catch {}
|
|
2037
2086
|
}), o = () => {
|
|
2038
2087
|
if (!i) {
|
|
@@ -2050,7 +2099,7 @@ import {
|
|
|
2050
2099
|
a(), o(), process.off("exit", o), process.off("uncaughtException", s), process.off("unhandledRejection", s);
|
|
2051
2100
|
}
|
|
2052
2101
|
};
|
|
2053
|
-
},
|
|
2102
|
+
}, dr = async (e, t) => {
|
|
2054
2103
|
let n;
|
|
2055
2104
|
try {
|
|
2056
2105
|
n = await S.readFile(e, "utf8");
|
|
@@ -2064,11 +2113,11 @@ import {
|
|
|
2064
2113
|
i.push(t);
|
|
2065
2114
|
} catch {}
|
|
2066
2115
|
return t?.max !== void 0 && i.length > t.max ? i.slice(i.length - t.max) : i;
|
|
2067
|
-
},
|
|
2116
|
+
}, fr = g({ scope: "voltro:dashboard" }), pr = pe(import.meta.url), mr = 5179, hr = (e) => {
|
|
2068
2117
|
let n = process.env.VOLTRO_DASHBOARD_PATH;
|
|
2069
2118
|
if (n && y(r(a(n), "app.config.ts"))) return a(n);
|
|
2070
2119
|
try {
|
|
2071
|
-
let e = t(
|
|
2120
|
+
let e = t(pr.resolve("@voltro/dashboard/package.json"));
|
|
2072
2121
|
if (y(r(e, "app.config.ts"))) return e;
|
|
2073
2122
|
} catch {}
|
|
2074
2123
|
let i = r("voltro-devtools", "apps", "dashboard"), o = a(e);
|
|
@@ -2080,53 +2129,53 @@ import {
|
|
|
2080
2129
|
o = n;
|
|
2081
2130
|
}
|
|
2082
2131
|
return null;
|
|
2083
|
-
},
|
|
2084
|
-
let i =
|
|
2132
|
+
}, gr = "VOLTRO_IS_DASHBOARD", _r = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
|
|
2133
|
+
let i = fe({
|
|
2085
2134
|
port: e,
|
|
2086
2135
|
host: t
|
|
2087
2136
|
}), a = !1, o = (e) => {
|
|
2088
2137
|
a || (a = !0, i.destroy(), r(e));
|
|
2089
2138
|
};
|
|
2090
2139
|
i.once("connect", () => o(!0)), i.once("error", () => o(!1)), setTimeout(() => o(!1), n);
|
|
2091
|
-
}),
|
|
2140
|
+
}), vr = () => !!(process.env.VOLTRO_DASHBOARD === "off" || process.argv.includes("--disable-dashboard")), yr = () => process.env[gr] === "1", br = () => process.stdout.isTTY === !0, xr = r(de(), ".voltro", "dashboard-launch.lock"), Sr = 1e4, Cr = async () => {
|
|
2092
2141
|
try {
|
|
2093
|
-
await S.mkdir(t(
|
|
2094
|
-
let e = await S.open(
|
|
2142
|
+
await S.mkdir(t(xr), { recursive: !0 });
|
|
2143
|
+
let e = await S.open(xr, "wx");
|
|
2095
2144
|
return await e.write(`${process.pid}\n${Date.now()}\n`), await e.close(), !0;
|
|
2096
2145
|
} catch {
|
|
2097
2146
|
try {
|
|
2098
|
-
let e = await S.stat(
|
|
2099
|
-
if (Date.now() - e.mtimeMs >
|
|
2147
|
+
let e = await S.stat(xr);
|
|
2148
|
+
if (Date.now() - e.mtimeMs > Sr) return await S.unlink(xr).catch(() => void 0), Cr();
|
|
2100
2149
|
} catch {}
|
|
2101
2150
|
return !1;
|
|
2102
2151
|
}
|
|
2103
|
-
},
|
|
2152
|
+
}, wr = async () => {
|
|
2104
2153
|
try {
|
|
2105
|
-
await S.unlink(
|
|
2154
|
+
await S.unlink(xr);
|
|
2106
2155
|
} catch {}
|
|
2107
|
-
},
|
|
2156
|
+
}, Tr = async (e) => {
|
|
2108
2157
|
let n = e.port ?? 5179;
|
|
2109
|
-
if (
|
|
2158
|
+
if (vr()) return {
|
|
2110
2159
|
status: "skipped",
|
|
2111
2160
|
reason: "disabled by flag/env",
|
|
2112
2161
|
port: n
|
|
2113
2162
|
};
|
|
2114
|
-
if (
|
|
2163
|
+
if (yr()) return {
|
|
2115
2164
|
status: "skipped",
|
|
2116
2165
|
reason: "this process IS the dashboard",
|
|
2117
2166
|
port: n
|
|
2118
2167
|
};
|
|
2119
|
-
if (!
|
|
2168
|
+
if (!br()) return {
|
|
2120
2169
|
status: "skipped",
|
|
2121
2170
|
reason: "stdout is not a TTY (CI/smoke)",
|
|
2122
2171
|
port: n
|
|
2123
2172
|
};
|
|
2124
|
-
if (!await
|
|
2173
|
+
if (!await Cr()) return {
|
|
2125
2174
|
status: "skipped",
|
|
2126
2175
|
reason: "another voltro process is currently launching the dashboard",
|
|
2127
2176
|
port: n
|
|
2128
2177
|
};
|
|
2129
|
-
if (await
|
|
2178
|
+
if (await _r(n)) return await wr(), {
|
|
2130
2179
|
status: "already-running",
|
|
2131
2180
|
port: n
|
|
2132
2181
|
};
|
|
@@ -2135,7 +2184,7 @@ import {
|
|
|
2135
2184
|
let e = process.argv[1];
|
|
2136
2185
|
i = e && e.endsWith("/src/bin.ts") ? r(t(e), "..", "bin", "voltro.mjs") : e ?? "voltro";
|
|
2137
2186
|
}
|
|
2138
|
-
let a = y(r(e.dashboardAppPath, ".framework", "dist", "index.html")), o = a ? "start" : "dev", s =
|
|
2187
|
+
let a = y(r(e.dashboardAppPath, ".framework", "dist", "index.html")), o = a ? "start" : "dev", s = le(process.execPath, [
|
|
2139
2188
|
i,
|
|
2140
2189
|
o,
|
|
2141
2190
|
e.dashboardAppPath
|
|
@@ -2143,7 +2192,7 @@ import {
|
|
|
2143
2192
|
stdio: "ignore",
|
|
2144
2193
|
env: {
|
|
2145
2194
|
...process.env,
|
|
2146
|
-
[
|
|
2195
|
+
[gr]: "1",
|
|
2147
2196
|
VOLTRO_DASHBOARD_PORT: String(n)
|
|
2148
2197
|
}
|
|
2149
2198
|
});
|
|
@@ -2151,22 +2200,22 @@ import {
|
|
|
2151
2200
|
if (s.exitCode === null && s.signalCode === null) try {
|
|
2152
2201
|
s.kill("SIGTERM");
|
|
2153
2202
|
} catch {}
|
|
2154
|
-
}),
|
|
2203
|
+
}), fr.info(`auto-launching dashboard at http://localhost:${n}`, {
|
|
2155
2204
|
port: n,
|
|
2156
2205
|
mode: o,
|
|
2157
2206
|
prebuilt: a
|
|
2158
|
-
}), a ||
|
|
2159
|
-
|
|
2207
|
+
}), a || fr.debug("no pre-built dashboard — running `voltro dev`. Build with `cd voltro-devtools && pnpm build` for a fast prod boot."), fr.debug("disable via --disable-dashboard or VOLTRO_DASHBOARD=off"), setTimeout(() => {
|
|
2208
|
+
wr();
|
|
2160
2209
|
}, 4e3).unref(), {
|
|
2161
2210
|
status: "launched",
|
|
2162
2211
|
port: n
|
|
2163
2212
|
};
|
|
2164
|
-
},
|
|
2213
|
+
}, Er = class extends Error {
|
|
2165
2214
|
_voltroDeferral = !0;
|
|
2166
2215
|
constructor(e) {
|
|
2167
2216
|
super(e), this.name = "DeferralNotSupportedError";
|
|
2168
2217
|
}
|
|
2169
|
-
},
|
|
2218
|
+
}, Dr = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, Or = (e) => {
|
|
2170
2219
|
let { helpers: t } = e, n = t.prepareDeferredLoaderData(e.loaderData, "page"), r = {}, i = {}, a = {};
|
|
2171
2220
|
for (let [n, o] of Object.entries(e.segmentLoaderData)) {
|
|
2172
2221
|
let e = Number(n), s = t.prepareDeferredLoaderData(o, e);
|
|
@@ -2180,7 +2229,7 @@ import {
|
|
|
2180
2229
|
interactive: e.interactive
|
|
2181
2230
|
});
|
|
2182
2231
|
} catch (e) {
|
|
2183
|
-
throw new
|
|
2232
|
+
throw new Er(e instanceof Error ? e.message : String(e));
|
|
2184
2233
|
}
|
|
2185
2234
|
return {
|
|
2186
2235
|
loaderData: n.renderData,
|
|
@@ -2194,30 +2243,45 @@ import {
|
|
|
2194
2243
|
...Object.keys(a).length > 0 ? { deferredSegmentIds: a } : {}
|
|
2195
2244
|
}
|
|
2196
2245
|
};
|
|
2197
|
-
},
|
|
2198
|
-
let t
|
|
2199
|
-
|
|
2246
|
+
}, kr = (e) => {
|
|
2247
|
+
let { helpers: t, renderInput: n } = e, { html: r, meta: i } = t.renderPageToHtml({
|
|
2248
|
+
...n,
|
|
2249
|
+
pageSlot: !0
|
|
2250
|
+
});
|
|
2251
|
+
return {
|
|
2252
|
+
body: r,
|
|
2253
|
+
meta: i,
|
|
2254
|
+
stateScript: t.renderRouterStateScript({
|
|
2255
|
+
loaderData: null,
|
|
2256
|
+
segmentLoaderData: n.segmentLoaderData ?? {},
|
|
2257
|
+
pageLoaderRan: !1,
|
|
2258
|
+
pageClientOnly: !0
|
|
2259
|
+
})
|
|
2260
|
+
};
|
|
2261
|
+
}, Ar = "<div id=\"root\"></div>", jr = "<div id=\"root\">", Mr = "</div>", Nr = /<script\b[^>]*\btype=["']module["'][^>]*><\/script>[ \t]*\n?/gi, Pr = /\bsrc=["']([^"']+)["']/i, Fr = /<script(?![^>]*\basync\b)([^>]*\btype=["']module["'][^>]*)>/gi, Ir = (e) => {
|
|
2262
|
+
let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(Nr, (e) => {
|
|
2263
|
+
let r = Pr.exec(e)?.[1];
|
|
2200
2264
|
return r === void 0 || t(r) ? e : (n.push(r), "");
|
|
2201
2265
|
});
|
|
2202
|
-
e.inlineModuleScriptsAsync && (r = r.replace(
|
|
2203
|
-
let i = r.indexOf(
|
|
2204
|
-
if (i === -1) throw Error(`[voltro] the generated shell has no \`${
|
|
2266
|
+
e.inlineModuleScriptsAsync && (r = r.replace(Fr, "<script async$1>"));
|
|
2267
|
+
let i = r.indexOf(Ar);
|
|
2268
|
+
if (i === -1) throw Error(`[voltro] the generated shell has no \`${Ar}\` element, so a streamed response cannot be split around the page body. This is a framework bug unless the app overrode \`.framework/index.html\` by hand.`);
|
|
2205
2269
|
return {
|
|
2206
|
-
head: `${r.slice(0, i)}${
|
|
2207
|
-
tail: `${
|
|
2270
|
+
head: `${r.slice(0, i)}${jr}`,
|
|
2271
|
+
tail: `${Mr}${r.slice(i + 21)}`,
|
|
2208
2272
|
bootstrapModules: n
|
|
2209
2273
|
};
|
|
2210
|
-
},
|
|
2274
|
+
}, Lr = (e) => e.head.replace("</head>", ` ${e.headInjection}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${e.htmlLang}"`), Rr = (e) => {
|
|
2211
2275
|
let { res: t, shell: n, htmlLang: r, headInjection: i } = e, a = null, o = !1, s = !1, c = () => {
|
|
2212
2276
|
if (s || !o || a === null) return;
|
|
2213
2277
|
s = !0, t.statusCode = e.statusCode ?? 200;
|
|
2214
2278
|
for (let [n, r] of Object.entries(e.headers ?? {})) t.setHeader(n, r);
|
|
2215
|
-
t.flushHeaders?.(), t.write(
|
|
2279
|
+
t.flushHeaders?.(), t.write(Lr({
|
|
2216
2280
|
head: n.head,
|
|
2217
2281
|
headInjection: i(a.meta),
|
|
2218
2282
|
htmlLang: r
|
|
2219
2283
|
}));
|
|
2220
|
-
let c = new
|
|
2284
|
+
let c = new me();
|
|
2221
2285
|
c.pipe(t, { end: !1 }), c.on("end", () => {
|
|
2222
2286
|
t.end(n.tail);
|
|
2223
2287
|
}), a.stream.pipe(c);
|
|
@@ -2242,14 +2306,14 @@ import {
|
|
|
2242
2306
|
return;
|
|
2243
2307
|
}
|
|
2244
2308
|
c();
|
|
2245
|
-
}, Z = g({ scope: "voltro:dev:web" }),
|
|
2309
|
+
}, Z = g({ scope: "voltro:dev:web" }), zr = g({ scope: "vite" }), Br = await (async () => {
|
|
2246
2310
|
try {
|
|
2247
2311
|
let e = r(t(o(import.meta.url)), "..", "package.json"), n = await S.readFile(e, "utf8");
|
|
2248
2312
|
return JSON.parse(n).version ?? "0.0.0";
|
|
2249
2313
|
} catch {
|
|
2250
2314
|
return "0.0.0";
|
|
2251
2315
|
}
|
|
2252
|
-
})(),
|
|
2316
|
+
})(), Vr = async () => {
|
|
2253
2317
|
try {
|
|
2254
2318
|
let e = t(o(import.meta.url)), n = a(e, "..", "..", "devtools");
|
|
2255
2319
|
if (y(r(n, "package.json"))) return n;
|
|
@@ -2258,7 +2322,7 @@ import {
|
|
|
2258
2322
|
} catch {
|
|
2259
2323
|
return null;
|
|
2260
2324
|
}
|
|
2261
|
-
},
|
|
2325
|
+
}, Hr = (e, t) => e.disableDevtools || !t ? [] : [
|
|
2262
2326
|
"",
|
|
2263
2327
|
"// Dev-only in-page devtools overlay. The `import.meta.env.DEV` guard is a",
|
|
2264
2328
|
"// compile-time constant, so prod builds strip this whole `if` block — the",
|
|
@@ -2268,12 +2332,12 @@ import {
|
|
|
2268
2332
|
" await import('@voltro/devtools/styles.css')",
|
|
2269
2333
|
" Devtools = (await import('@voltro/devtools')).VoltroDevtools",
|
|
2270
2334
|
"}"
|
|
2271
|
-
],
|
|
2335
|
+
], Ur = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], Wr = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], Gr = (e) => e.sentry ? [
|
|
2272
2336
|
"",
|
|
2273
2337
|
"// Browser-side Sentry (frontend half of the deep integration). Errors +",
|
|
2274
2338
|
"// browser rpc spans flow to Sentry, sharing the server transactions' trace.",
|
|
2275
2339
|
`await initSentryBrowser(${JSON.stringify(e.sentry)})`
|
|
2276
|
-
] : [],
|
|
2340
|
+
] : [], Kr = (e) => e.env ? ["import './env.public'"] : [], qr = (e) => {
|
|
2277
2341
|
let n = [], i = a(e);
|
|
2278
2342
|
for (;;) {
|
|
2279
2343
|
y(r(i, "pnpm-workspace.yaml")) && n.push(i);
|
|
@@ -2282,19 +2346,19 @@ import {
|
|
|
2282
2346
|
i = e;
|
|
2283
2347
|
}
|
|
2284
2348
|
return n;
|
|
2285
|
-
},
|
|
2349
|
+
}, Jr = /* @__PURE__ */ new Set([
|
|
2286
2350
|
"layout.tsx",
|
|
2287
2351
|
"error.tsx",
|
|
2288
2352
|
"loading.tsx",
|
|
2289
2353
|
"not-found.tsx"
|
|
2290
|
-
]),
|
|
2354
|
+
]), Yr = (e) => /\.(test|spec)\.tsx$/.test(e), Xr = (e) => {
|
|
2291
2355
|
if (/\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:react|react-dom|scheduler)\//.test(e)) return "react";
|
|
2292
2356
|
let t = /\/([^/]+)\.island\.tsx?$/.exec(e);
|
|
2293
2357
|
if (t) return `island-${t[1]}`;
|
|
2294
|
-
},
|
|
2295
|
-
let t = e.replace(/\.tsx$/, "").split("/").filter(Boolean).filter((e) => !
|
|
2358
|
+
}, Zr = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, Qr = (e) => e.startsWith("(") && e.endsWith(")"), $r = (e) => e.filter((e) => !Qr(e)), ei = (e) => {
|
|
2359
|
+
let t = e.replace(/\.tsx$/, "").split("/").filter(Boolean).filter((e) => !Qr(e)), n = t.length > 0 && t[t.length - 1] === "index" ? t.slice(0, -1) : t;
|
|
2296
2360
|
return n.length === 0 ? "/" : "/" + n.join("/");
|
|
2297
|
-
},
|
|
2361
|
+
}, ti = (e) => `${e.replace(/\.tsx$/, "").split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Index"}Page`, Q = (e, t) => e === "" ? `Root${t}` : `${e.split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Root"}${t}`, $ = async (e) => {
|
|
2298
2362
|
let t = [], n = [], i = async (e, a) => {
|
|
2299
2363
|
let o = [];
|
|
2300
2364
|
try {
|
|
@@ -2302,17 +2366,17 @@ import {
|
|
|
2302
2366
|
} catch {
|
|
2303
2367
|
return;
|
|
2304
2368
|
}
|
|
2305
|
-
let s = o.filter((e) => e.isDirectory()).map((e) => e.name).sort(), c = o.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !
|
|
2306
|
-
if (c.some((e) =>
|
|
2369
|
+
let s = o.filter((e) => e.isDirectory()).map((e) => e.name).sort(), c = o.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !Yr(e.name)).map((e) => e.name).sort(), l = new Set(c), u = a.join("/");
|
|
2370
|
+
if (c.some((e) => Jr.has(e))) {
|
|
2307
2371
|
let t = l.has("layout.tsx"), i = !1;
|
|
2308
2372
|
if (t) try {
|
|
2309
2373
|
let t = await S.readFile(r(e, "layout.tsx"), "utf8");
|
|
2310
|
-
i =
|
|
2374
|
+
i = Zr.test(t);
|
|
2311
2375
|
} catch {}
|
|
2312
2376
|
n.push({
|
|
2313
2377
|
dir: u,
|
|
2314
2378
|
chain: a,
|
|
2315
|
-
contributesToUrl: a.length === 0 || !
|
|
2379
|
+
contributesToUrl: a.length === 0 || !Qr(a[a.length - 1]),
|
|
2316
2380
|
hasLayout: t,
|
|
2317
2381
|
hasLayoutLoader: i,
|
|
2318
2382
|
hasError: l.has("error.tsx"),
|
|
@@ -2321,12 +2385,12 @@ import {
|
|
|
2321
2385
|
});
|
|
2322
2386
|
}
|
|
2323
2387
|
for (let e of c) {
|
|
2324
|
-
if (
|
|
2388
|
+
if (Jr.has(e)) continue;
|
|
2325
2389
|
let n = u ? `${u}/${e}` : e;
|
|
2326
2390
|
t.push({
|
|
2327
2391
|
file: n,
|
|
2328
|
-
pattern:
|
|
2329
|
-
ident:
|
|
2392
|
+
pattern: ei(n),
|
|
2393
|
+
ident: ti(n),
|
|
2330
2394
|
dirChain: a
|
|
2331
2395
|
});
|
|
2332
2396
|
}
|
|
@@ -2336,14 +2400,14 @@ import {
|
|
|
2336
2400
|
pages: t,
|
|
2337
2401
|
dirs: n
|
|
2338
2402
|
};
|
|
2339
|
-
},
|
|
2403
|
+
}, ni = (e, t) => {
|
|
2340
2404
|
let n = [];
|
|
2341
2405
|
for (let r = 0; r <= t.length; r++) {
|
|
2342
2406
|
let i = t.slice(0, r).join("/"), a = e.find((e) => e.dir === i);
|
|
2343
2407
|
a && n.push(a);
|
|
2344
2408
|
}
|
|
2345
2409
|
return n;
|
|
2346
|
-
},
|
|
2410
|
+
}, ri = async (e) => {
|
|
2347
2411
|
let { entries: t, loadLayout: n, loadError: r, loadPending: i, ctx: a } = e, o = {};
|
|
2348
2412
|
return {
|
|
2349
2413
|
chain: await Promise.all(t.map(async (e, t) => {
|
|
@@ -2365,10 +2429,10 @@ import {
|
|
|
2365
2429
|
})),
|
|
2366
2430
|
segmentLoaderData: o
|
|
2367
2431
|
};
|
|
2368
|
-
},
|
|
2369
|
-
let t =
|
|
2432
|
+
}, ii = (e) => {
|
|
2433
|
+
let t = $r(e);
|
|
2370
2434
|
return t.length === 0 ? "" : "/" + t.join("/");
|
|
2371
|
-
},
|
|
2435
|
+
}, ai = [
|
|
2372
2436
|
"// Hot-reload bridge: keep SSR-injected <link rel=\"stylesheet\"> tags",
|
|
2373
2437
|
"// in sync with Vite's CSS HMR. Without this, edits to .css files",
|
|
2374
2438
|
"// only update the JS-injected <style> overlay; the underlying <link>",
|
|
@@ -2461,7 +2525,7 @@ import {
|
|
|
2461
2525
|
" _vdtErrorStart('Build error')",
|
|
2462
2526
|
" })",
|
|
2463
2527
|
"}"
|
|
2464
|
-
].join("\n"),
|
|
2528
|
+
].join("\n"), oi = (e) => {
|
|
2465
2529
|
let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
|
|
2466
2530
|
for (let e of r) e.startsWith("[[...") && e.endsWith("]]") ? (i.push("(.*)"), t.push(e.slice(5, -2)), n += 2) : e.startsWith("[...") && e.endsWith("]") ? (i.push("(.+)"), t.push(e.slice(4, -1)), n += 3) : e.startsWith("[") && e.endsWith("]") ? (i.push("([^/]+)"), t.push(e.slice(1, -1)), n += 1) : i.push(e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
2467
2531
|
let a = i.join("/");
|
|
@@ -2470,8 +2534,8 @@ import {
|
|
|
2470
2534
|
paramNames: t,
|
|
2471
2535
|
priority: n
|
|
2472
2536
|
};
|
|
2473
|
-
},
|
|
2474
|
-
let { regex: t, paramNames: n, priority: r } =
|
|
2537
|
+
}, si = (e) => e.map((e) => {
|
|
2538
|
+
let { regex: t, paramNames: n, priority: r } = oi(e.pattern);
|
|
2475
2539
|
return {
|
|
2476
2540
|
pattern: e.pattern,
|
|
2477
2541
|
file: e.file,
|
|
@@ -2480,7 +2544,7 @@ import {
|
|
|
2480
2544
|
paramNames: n,
|
|
2481
2545
|
priority: r
|
|
2482
2546
|
};
|
|
2483
|
-
}).slice().sort((e, t) => e.priority - t.priority),
|
|
2547
|
+
}).slice().sort((e, t) => e.priority - t.priority), ci = (e, t) => {
|
|
2484
2548
|
for (let n of t) {
|
|
2485
2549
|
let t = n.regex.exec(e);
|
|
2486
2550
|
if (!t) continue;
|
|
@@ -2492,7 +2556,7 @@ import {
|
|
|
2492
2556
|
};
|
|
2493
2557
|
}
|
|
2494
2558
|
return null;
|
|
2495
|
-
},
|
|
2559
|
+
}, li = async (e, n) => {
|
|
2496
2560
|
let i = e;
|
|
2497
2561
|
for (;;) {
|
|
2498
2562
|
let e = r(i, "node_modules", n);
|
|
@@ -2506,7 +2570,7 @@ import {
|
|
|
2506
2570
|
if (a === i) return null;
|
|
2507
2571
|
i = a;
|
|
2508
2572
|
}
|
|
2509
|
-
},
|
|
2573
|
+
}, ui = async (e) => {
|
|
2510
2574
|
try {
|
|
2511
2575
|
let t = await import(s(r(e, "app.config.ts")).href), n = t.default?.port, i = typeof n == "number" ? n : 4e3, a = t.default?.transport?.wsPath, o = typeof a == "string" && a.startsWith("/") ? a : void 0;
|
|
2512
2576
|
return o ? {
|
|
@@ -2515,13 +2579,13 @@ import {
|
|
|
2515
2579
|
} : { port: i };
|
|
2516
2580
|
} catch {}
|
|
2517
2581
|
return { port: 4e3 };
|
|
2518
|
-
},
|
|
2582
|
+
}, di = (e, t) => ({
|
|
2519
2583
|
name: e,
|
|
2520
2584
|
pkg: t.package,
|
|
2521
2585
|
browserWsUrl: t.url,
|
|
2522
2586
|
proxyTarget: void 0,
|
|
2523
2587
|
...t.headers ? { headers: t.headers } : {}
|
|
2524
|
-
}),
|
|
2588
|
+
}), fi = (e, t, n) => {
|
|
2525
2589
|
let r = t.transport?.wsPath ?? n.wsPath;
|
|
2526
2590
|
return {
|
|
2527
2591
|
name: e,
|
|
@@ -2531,7 +2595,7 @@ import {
|
|
|
2531
2595
|
...r ? { wsPath: r } : {},
|
|
2532
2596
|
...t.headers ? { headers: t.headers } : {}
|
|
2533
2597
|
};
|
|
2534
|
-
},
|
|
2598
|
+
}, pi = (e) => {
|
|
2535
2599
|
let t = /* @__PURE__ */ new Map();
|
|
2536
2600
|
for (let n of e) {
|
|
2537
2601
|
if (n.proxyTarget === void 0) continue;
|
|
@@ -2539,19 +2603,19 @@ import {
|
|
|
2539
2603
|
if (e) throw Error(`[voltro] api ${JSON.stringify(n.name)} and ${JSON.stringify(e)} both resolve the same-origin WS path ${JSON.stringify(n.browserWsUrl)}. A custom transport.wsPath must be unique per origin (one api per origin may use a fixed path). Give each a distinct wsPath, or drop the override to use the default /ws/<name>.`);
|
|
2540
2604
|
t.set(n.browserWsUrl, n.name);
|
|
2541
2605
|
}
|
|
2542
|
-
},
|
|
2606
|
+
}, mi = async (e, t) => {
|
|
2543
2607
|
let n = Object.entries(t.apis ?? {}), r = [];
|
|
2544
2608
|
for (let [t, i] of n) {
|
|
2545
2609
|
if (i.url) {
|
|
2546
|
-
r.push(
|
|
2610
|
+
r.push(di(t, i));
|
|
2547
2611
|
continue;
|
|
2548
2612
|
}
|
|
2549
|
-
let n = await
|
|
2613
|
+
let n = await li(e, i.package);
|
|
2550
2614
|
if (!n) throw Error(`[voltro dev] api ${JSON.stringify(t)} (package ${JSON.stringify(i.package)}) is not a workspace dep and has no \`url\` set in app.config.ts. External apis need an explicit \`url\` because the framework can't discover their dev port.`);
|
|
2551
|
-
r.push(
|
|
2615
|
+
r.push(fi(t, i, await ui(n)));
|
|
2552
2616
|
}
|
|
2553
|
-
return
|
|
2554
|
-
},
|
|
2617
|
+
return pi(r), r;
|
|
2618
|
+
}, hi = (e) => {
|
|
2555
2619
|
if (!e) return;
|
|
2556
2620
|
let t = e.proxyTarget ?? e.browserWsUrl;
|
|
2557
2621
|
if (t && !(!/^wss?:\/\//.test(t) && !/^https?:\/\//.test(t))) try {
|
|
@@ -2560,7 +2624,7 @@ import {
|
|
|
2560
2624
|
} catch {
|
|
2561
2625
|
return;
|
|
2562
2626
|
}
|
|
2563
|
-
},
|
|
2627
|
+
}, gi = (e, t) => {
|
|
2564
2628
|
if (e) return async (n, r) => {
|
|
2565
2629
|
let i = {
|
|
2566
2630
|
_tag: "Request",
|
|
@@ -2592,8 +2656,8 @@ import {
|
|
|
2592
2656
|
}
|
|
2593
2657
|
if (l) return c;
|
|
2594
2658
|
};
|
|
2595
|
-
},
|
|
2596
|
-
let a = t.title ?? t.name ?? "app", o = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", s = y(r(e, "node_modules", "@voltro", "devtools", "package.json")) || await
|
|
2659
|
+
}, _i = async (e, t, n, i = {}) => {
|
|
2660
|
+
let a = t.title ?? t.name ?? "app", o = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", s = y(r(e, "node_modules", "@voltro", "devtools", "package.json")) || await Vr() !== null, c = t.theme === "system" ? [
|
|
2597
2661
|
" <script>",
|
|
2598
2662
|
" (function () {",
|
|
2599
2663
|
" var root = document.documentElement",
|
|
@@ -2642,13 +2706,13 @@ import {
|
|
|
2642
2706
|
e.hasLayout && e.hasLayoutLoader ? n.push(`import * as ${Q(e.dir, "Layout")}Mod from '${t}/layout.tsx'`) : e.hasLayout && n.push(`import ${Q(e.dir, "Layout")} from '${t}/layout.tsx'`), e.hasError && n.push(`import ${Q(e.dir, "Error")} from '${t}/error.tsx'`), e.hasPending && n.push(`import ${Q(e.dir, "Pending")} from '${t}/loading.tsx'`), e.hasNotFound && n.push(`import ${Q(e.dir, "NotFound")} from '${t}/not-found.tsx'`);
|
|
2643
2707
|
}
|
|
2644
2708
|
let r = u.map((e) => {
|
|
2645
|
-
let t =
|
|
2709
|
+
let t = ni(d, e.dirChain).map((e) => {
|
|
2646
2710
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2647
2711
|
return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasLayoutLoader && t.push(`loader: refs.layoutLoaders[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), e.hasPending && t.push(`Pending: refs.pendings[${n}]`), ` { ${t.join(", ")} }`;
|
|
2648
2712
|
}).join(",\n");
|
|
2649
2713
|
return ` makePageRoute(${JSON.stringify(e.pattern)}, ${t.length > 0 ? `[\n${t},\n ]` : "undefined"}),`;
|
|
2650
2714
|
}), i = d.filter((e) => e.hasNotFound).map((e) => {
|
|
2651
|
-
let t =
|
|
2715
|
+
let t = ii(e.chain), n = ni(d, e.chain).map((e) => {
|
|
2652
2716
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2653
2717
|
return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), ` { ${t.join(", ")} }`;
|
|
2654
2718
|
}).join(",\n"), r = n.length > 0 ? `\n chain: [\n${n},\n ],` : "";
|
|
@@ -2887,14 +2951,14 @@ import {
|
|
|
2887
2951
|
"// resolved apis map. Side-effect only — no local component definitions —",
|
|
2888
2952
|
"// so downstream invalidations (user page edits) terminate at app.tsx.",
|
|
2889
2953
|
"",
|
|
2890
|
-
...
|
|
2954
|
+
...Kr(t),
|
|
2891
2955
|
"import { mount } from '@voltro/web'",
|
|
2892
2956
|
...m,
|
|
2893
2957
|
"import { App } from './app'",
|
|
2894
2958
|
"import { preloadCurrentRoute } from './routeTable'",
|
|
2895
|
-
...
|
|
2896
|
-
...
|
|
2897
|
-
...
|
|
2959
|
+
...Wr(t),
|
|
2960
|
+
...Hr(t, s),
|
|
2961
|
+
...Gr(t),
|
|
2898
2962
|
"",
|
|
2899
2963
|
"// Preload the current route's page chunk BEFORE hydration so the first",
|
|
2900
2964
|
"// client render matches the SSG/SSR-prerendered HTML. Without it, a lazy",
|
|
@@ -2911,10 +2975,10 @@ import {
|
|
|
2911
2975
|
" apis: {",
|
|
2912
2976
|
...h,
|
|
2913
2977
|
" },",
|
|
2914
|
-
...
|
|
2978
|
+
...Ur(t, s),
|
|
2915
2979
|
"})",
|
|
2916
2980
|
"",
|
|
2917
|
-
|
|
2981
|
+
ai
|
|
2918
2982
|
].join("\n");
|
|
2919
2983
|
} else g = "", _ = "", v = [
|
|
2920
2984
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
@@ -2922,25 +2986,25 @@ import {
|
|
|
2922
2986
|
"// and calls mount(). Side-effect only, no component definitions, so the",
|
|
2923
2987
|
"// user's component file remains the Fast Refresh boundary.",
|
|
2924
2988
|
"",
|
|
2925
|
-
...
|
|
2989
|
+
...Kr(t),
|
|
2926
2990
|
"import { mount } from '@voltro/web'",
|
|
2927
2991
|
...m,
|
|
2928
2992
|
"import App from '../src/App'",
|
|
2929
|
-
...
|
|
2930
|
-
...
|
|
2931
|
-
...
|
|
2993
|
+
...Wr(t),
|
|
2994
|
+
...Hr(t, s),
|
|
2995
|
+
...Gr(t),
|
|
2932
2996
|
"",
|
|
2933
2997
|
"mount(App, {",
|
|
2934
2998
|
" apis: {",
|
|
2935
2999
|
...h,
|
|
2936
3000
|
" },",
|
|
2937
|
-
...
|
|
3001
|
+
...Ur(t, s),
|
|
2938
3002
|
"})",
|
|
2939
3003
|
"",
|
|
2940
|
-
|
|
3004
|
+
ai
|
|
2941
3005
|
].join("\n");
|
|
2942
3006
|
let b = r(e, ".framework");
|
|
2943
|
-
await S.mkdir(b, { recursive: !0 }), t.env ? await
|
|
3007
|
+
await S.mkdir(b, { recursive: !0 }), t.env ? await Ze(b, i) : await S.rm(r(b, "env.public.ts"), { force: !0 }), await S.writeFile(r(b, "index.html"), l, "utf8"), await S.writeFile(r(b, "main.tsx"), v, "utf8"), g ? (await S.writeFile(r(b, "app.tsx"), g, "utf8"), await S.writeFile(r(b, "routeTable.ts"), _, "utf8")) : (await S.rm(r(b, "app.tsx"), { force: !0 }), await S.rm(r(b, "routeTable.ts"), { force: !0 }));
|
|
2944
3008
|
let x = r(e, ".gitignore"), C = "";
|
|
2945
3009
|
try {
|
|
2946
3010
|
C = await S.readFile(x, "utf8");
|
|
@@ -2948,7 +3012,7 @@ import {
|
|
|
2948
3012
|
let w = ["/.framework/"], T = C.split("\n").filter((e) => e.trim() !== "");
|
|
2949
3013
|
for (let e of w) T.includes(e) || T.push(e);
|
|
2950
3014
|
await S.writeFile(x, T.join("\n") + "\n", "utf8");
|
|
2951
|
-
},
|
|
3015
|
+
}, vi = async (e, n) => {
|
|
2952
3016
|
try {
|
|
2953
3017
|
let i = r(t(e), "project.json");
|
|
2954
3018
|
if (!y(i)) return;
|
|
@@ -2961,49 +3025,49 @@ import {
|
|
|
2961
3025
|
projectJson: i
|
|
2962
3026
|
});
|
|
2963
3027
|
} catch {}
|
|
2964
|
-
},
|
|
2965
|
-
let t =
|
|
3028
|
+
}, yi = (e) => r(e, ".framework", "dist", "server", "appConfig.js"), bi = async (e) => {
|
|
3029
|
+
let t = yi(e), n = y(t) ? t : r(e, "app.config.ts");
|
|
2966
3030
|
try {
|
|
2967
3031
|
let e = (await import(s(n).href)).default;
|
|
2968
3032
|
return typeof e == "object" && e && "type" in e && e.type === "web" ? e : null;
|
|
2969
3033
|
} catch {
|
|
2970
3034
|
return null;
|
|
2971
3035
|
}
|
|
2972
|
-
},
|
|
2973
|
-
let n = await
|
|
3036
|
+
}, xi = async (t) => {
|
|
3037
|
+
let n = await bi(t);
|
|
2974
3038
|
if (!n) return {
|
|
2975
3039
|
ran: !1,
|
|
2976
3040
|
exitCode: 0
|
|
2977
3041
|
};
|
|
2978
|
-
|
|
2979
|
-
let o =
|
|
2980
|
-
|
|
2981
|
-
let s = await
|
|
3042
|
+
An();
|
|
3043
|
+
let o = Jt();
|
|
3044
|
+
an(o), Z.info("booting voltro dev (web)", { app: n.name ?? "(unnamed)" });
|
|
3045
|
+
let s = await mi(t, n);
|
|
2982
3046
|
for (let e of s) Z.info("api wired", {
|
|
2983
3047
|
name: e.name,
|
|
2984
3048
|
pkg: e.pkg,
|
|
2985
3049
|
...e.proxyTarget ? { proxyTo: e.proxyTarget } : { directWs: e.browserWsUrl }
|
|
2986
3050
|
});
|
|
2987
|
-
|
|
3051
|
+
Be(t).then((e) => {
|
|
2988
3052
|
for (let t of e.files) if (t.action === "created") {
|
|
2989
3053
|
let e = t.path.split("/").pop() ?? t.path;
|
|
2990
3054
|
Z.info(`${e} seeded`, { path: t.path });
|
|
2991
3055
|
}
|
|
2992
3056
|
}).catch(() => {});
|
|
2993
|
-
let { resolved: c } = await
|
|
3057
|
+
let { resolved: c } = await Qe({
|
|
2994
3058
|
rawEnv: n.env,
|
|
2995
3059
|
appType: "web",
|
|
2996
3060
|
root: t,
|
|
2997
3061
|
log: Z,
|
|
2998
3062
|
generateTypes: !0
|
|
2999
3063
|
}), l = c.publicValues;
|
|
3000
|
-
await
|
|
3064
|
+
await _i(t, n, s, l), Z.debug("generated framework entry files", { files: [
|
|
3001
3065
|
"index.html",
|
|
3002
3066
|
".framework/main.tsx",
|
|
3003
3067
|
...n.env ? [".framework/env.public.ts"] : []
|
|
3004
3068
|
] });
|
|
3005
|
-
let u = process.env.VOLTRO_IS_DASHBOARD === "1" && process.env.VOLTRO_DASHBOARD_PORT ? Number(process.env.VOLTRO_DASHBOARD_PORT) : n.port ?? 5173, d = n.name ?? "unnamed", f =
|
|
3006
|
-
await
|
|
3069
|
+
let u = process.env.VOLTRO_IS_DASHBOARD === "1" && process.env.VOLTRO_DASHBOARD_PORT ? Number(process.env.VOLTRO_DASHBOARD_PORT) : n.port ?? 5173, d = n.name ?? "unnamed", f = rr("web", d, u), p = ur(d);
|
|
3070
|
+
await tr({
|
|
3007
3071
|
id: f,
|
|
3008
3072
|
name: d,
|
|
3009
3073
|
kind: "web",
|
|
@@ -3011,19 +3075,19 @@ import {
|
|
|
3011
3075
|
pid: process.pid,
|
|
3012
3076
|
status: "booting",
|
|
3013
3077
|
logFile: p.path
|
|
3014
|
-
}).catch(() => {}), await
|
|
3078
|
+
}).catch(() => {}), await vi(t, u);
|
|
3015
3079
|
let { pages: m, dirs: h } = await $(r(t, "src", "pages")), g = h.map((e) => ({
|
|
3016
3080
|
dir: e.dir,
|
|
3017
3081
|
hasLayout: e.hasLayout,
|
|
3018
3082
|
hasError: e.hasError,
|
|
3019
3083
|
hasPending: e.hasPending,
|
|
3020
3084
|
hasNotFound: e.hasNotFound
|
|
3021
|
-
})), v = await
|
|
3085
|
+
})), v = await bt({
|
|
3022
3086
|
appRoot: t,
|
|
3023
3087
|
pages: m
|
|
3024
3088
|
});
|
|
3025
3089
|
v.wrote && Z.debug("routes codegen wrote", { path: i(t, v.path) });
|
|
3026
|
-
let b = await
|
|
3090
|
+
let b = await Ge("vite", () => import("vite")), x = (await import("@vitejs/plugin-react")).default, C = (await import("@tailwindcss/vite")).default, w = r(t, ".framework"), T = r(t, "src"), E = /* @__PURE__ */ new Set([
|
|
3027
3091
|
".framework",
|
|
3028
3092
|
"node_modules",
|
|
3029
3093
|
"dist",
|
|
@@ -3047,7 +3111,7 @@ import {
|
|
|
3047
3111
|
...i.devDependencies
|
|
3048
3112
|
});
|
|
3049
3113
|
await Promise.all(a.map(async (n) => {
|
|
3050
|
-
let i = await
|
|
3114
|
+
let i = await li(t, n);
|
|
3051
3115
|
if (!i) return;
|
|
3052
3116
|
let a = r(i, "src");
|
|
3053
3117
|
try {
|
|
@@ -3056,12 +3120,12 @@ import {
|
|
|
3056
3120
|
}));
|
|
3057
3121
|
} catch {}
|
|
3058
3122
|
}
|
|
3059
|
-
}, D = r(t, "src", "pages"),
|
|
3123
|
+
}, D = r(t, "src", "pages"), te = (e) => e.endsWith(".tsx") && (e === D || e.startsWith(D + "/")), O = (e) => e === D || e.startsWith(D + "/"), k = async (e) => {
|
|
3060
3124
|
try {
|
|
3061
3125
|
let r = Date.now();
|
|
3062
|
-
await
|
|
3126
|
+
await _i(t, n, s, l);
|
|
3063
3127
|
let { pages: i } = await $(D);
|
|
3064
|
-
await
|
|
3128
|
+
await bt({
|
|
3065
3129
|
appRoot: t,
|
|
3066
3130
|
pages: i
|
|
3067
3131
|
}), Z.info("page tree regenerated", {
|
|
@@ -3071,44 +3135,44 @@ import {
|
|
|
3071
3135
|
} catch (t) {
|
|
3072
3136
|
Z.error("page tree regen failed", { reason: e }, t);
|
|
3073
3137
|
}
|
|
3074
|
-
},
|
|
3138
|
+
}, A = {
|
|
3075
3139
|
name: "framework:regenerate-on-page-tree-change",
|
|
3076
3140
|
configureServer(e) {
|
|
3077
3141
|
let n = null, r = [], a = (e) => {
|
|
3078
3142
|
r.push(e), n && clearTimeout(n), n = setTimeout(() => {
|
|
3079
3143
|
n = null;
|
|
3080
3144
|
let e = r.length === 1 ? r[0] : `${r.length} events (${r[0]}, …)`;
|
|
3081
|
-
r.length = 0,
|
|
3145
|
+
r.length = 0, k(e);
|
|
3082
3146
|
}, 50);
|
|
3083
3147
|
};
|
|
3084
3148
|
e.watcher.on("add", (e) => {
|
|
3085
|
-
|
|
3149
|
+
te(e) && a(`add ${i(t, e)}`);
|
|
3086
3150
|
}), e.watcher.on("unlink", (e) => {
|
|
3087
|
-
|
|
3151
|
+
te(e) && a(`unlink ${i(t, e)}`);
|
|
3088
3152
|
}), e.watcher.on("addDir", (e) => {
|
|
3089
|
-
|
|
3153
|
+
O(e) && a(`addDir ${i(t, e)}`);
|
|
3090
3154
|
}), e.watcher.on("unlinkDir", (e) => {
|
|
3091
|
-
|
|
3155
|
+
O(e) && a(`unlinkDir ${i(t, e)}`);
|
|
3092
3156
|
});
|
|
3093
3157
|
}
|
|
3094
|
-
},
|
|
3095
|
-
if (!
|
|
3158
|
+
}, j = r(t, "app.config.ts"), M = (e) => {
|
|
3159
|
+
if (!ie(e.env)) return "";
|
|
3096
3160
|
let t = Object.entries(e.env.vars).map(([e, t]) => `${e}:${t.access}`).sort();
|
|
3097
3161
|
return `${String(e.env.publicPrefix)}|${t.join(",")}`;
|
|
3098
|
-
},
|
|
3162
|
+
}, N = (e, t) => {
|
|
3099
3163
|
let n = [];
|
|
3100
|
-
return e.port !== t.port && n.push(`port ${e.port ?? "(default)"} → ${t.port ?? "(default)"}`), JSON.stringify(e.proxies) !== JSON.stringify(t.proxies) && n.push("proxies"), JSON.stringify(e.allowedHosts) !== JSON.stringify(t.allowedHosts) && n.push("allowedHosts"), JSON.stringify(e.apis) !== JSON.stringify(t.apis) && n.push("apis"),
|
|
3101
|
-
},
|
|
3164
|
+
return e.port !== t.port && n.push(`port ${e.port ?? "(default)"} → ${t.port ?? "(default)"}`), JSON.stringify(e.proxies) !== JSON.stringify(t.proxies) && n.push("proxies"), JSON.stringify(e.allowedHosts) !== JSON.stringify(t.allowedHosts) && n.push("allowedHosts"), JSON.stringify(e.apis) !== JSON.stringify(t.apis) && n.push("apis"), M(e) !== M(t) && n.push("env"), n;
|
|
3165
|
+
}, P = n, F = a(j), ne = {
|
|
3102
3166
|
name: "framework:watch-app-config",
|
|
3103
3167
|
async configureServer(n) {
|
|
3104
|
-
n.watcher.add(
|
|
3168
|
+
n.watcher.add(j), Z.info("watching app.config.ts for changes", { path: i(t, j) });
|
|
3105
3169
|
let r = async () => {
|
|
3106
3170
|
try {
|
|
3107
3171
|
try {
|
|
3108
|
-
let e = n.moduleGraph.getModuleById(
|
|
3172
|
+
let e = n.moduleGraph.getModuleById(j);
|
|
3109
3173
|
e && n.moduleGraph.invalidateModule(e);
|
|
3110
3174
|
} catch {}
|
|
3111
|
-
let e = (await n.ssrLoadModule(
|
|
3175
|
+
let e = (await n.ssrLoadModule(j, { fixStacktrace: !0 })).default;
|
|
3112
3176
|
return typeof e == "object" && e && "type" in e && e.type === "web" ? e : (Z.warn("app.config.ts re-load returned wrong shape", { hasDefault: e !== void 0 }), null);
|
|
3113
3177
|
} catch (e) {
|
|
3114
3178
|
return Z.warn("app.config.ts re-load failed — ignoring this change", {}, e), null;
|
|
@@ -3127,17 +3191,17 @@ import {
|
|
|
3127
3191
|
theme: e.theme,
|
|
3128
3192
|
port: e.port,
|
|
3129
3193
|
name: e.name
|
|
3130
|
-
}), JSON.stringify(e) === JSON.stringify(
|
|
3194
|
+
}), JSON.stringify(e) === JSON.stringify(P)) {
|
|
3131
3195
|
Z.info("app.config.ts onConfigChange: parsed config unchanged — skipping (no-op edit?)");
|
|
3132
3196
|
return;
|
|
3133
3197
|
}
|
|
3134
|
-
let i =
|
|
3198
|
+
let i = N(P, e);
|
|
3135
3199
|
if (i.length > 0) {
|
|
3136
3200
|
Z.warn("app.config.ts changed — hard restart required", { fields: i });
|
|
3137
3201
|
try {
|
|
3138
3202
|
await n.close();
|
|
3139
3203
|
} catch {}
|
|
3140
|
-
let e =
|
|
3204
|
+
let e = le(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
|
|
3141
3205
|
stdio: "inherit",
|
|
3142
3206
|
env: process.env,
|
|
3143
3207
|
cwd: process.cwd()
|
|
@@ -3153,7 +3217,7 @@ import {
|
|
|
3153
3217
|
}
|
|
3154
3218
|
try {
|
|
3155
3219
|
let r = Date.now();
|
|
3156
|
-
await
|
|
3220
|
+
await _i(t, e, await mi(t, e)), P = e, n.ws && n.ws.send({
|
|
3157
3221
|
type: "full-reload",
|
|
3158
3222
|
path: "*"
|
|
3159
3223
|
}), Z.info("app.config.ts soft-regen", {
|
|
@@ -3163,7 +3227,7 @@ import {
|
|
|
3163
3227
|
} catch (e) {
|
|
3164
3228
|
Z.error("app.config.ts soft-regen failed", {}, e);
|
|
3165
3229
|
}
|
|
3166
|
-
}, l = (t) => e(t) === "app.config.ts" ? t ===
|
|
3230
|
+
}, l = (t) => e(t) === "app.config.ts" ? t === j || a(t) === F : !1;
|
|
3167
3231
|
n.watcher.on("change", (e) => {
|
|
3168
3232
|
l(e) && (Z.info("app.config.ts change event (chokidar)", { file: e }), s());
|
|
3169
3233
|
}), n.watcher.on("add", (e) => {
|
|
@@ -3171,29 +3235,29 @@ import {
|
|
|
3171
3235
|
});
|
|
3172
3236
|
try {
|
|
3173
3237
|
let { watchFile: e } = await import("node:fs");
|
|
3174
|
-
e(
|
|
3238
|
+
e(j, { interval: 500 }, (e, t) => {
|
|
3175
3239
|
e.mtimeMs !== t.mtimeMs && (Z.info("app.config.ts change event (poll)", { mtime: e.mtimeMs }), s());
|
|
3176
3240
|
}), Z.info("app.config.ts polling watcher attached", { intervalMs: 500 });
|
|
3177
3241
|
} catch (e) {
|
|
3178
3242
|
Z.warn("app.config.ts polling watcher could not attach", {}, e);
|
|
3179
3243
|
}
|
|
3180
|
-
|
|
3244
|
+
On(Tn, Z, {
|
|
3181
3245
|
root: t,
|
|
3182
3246
|
onBeforeRestart: () => n.close()
|
|
3183
3247
|
});
|
|
3184
3248
|
}
|
|
3185
|
-
},
|
|
3249
|
+
}, I = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, re = {
|
|
3186
3250
|
name: "framework:suppress-api-hmr",
|
|
3187
3251
|
handleHotUpdate(e) {
|
|
3188
|
-
if (
|
|
3252
|
+
if (I.test(e.file)) return [];
|
|
3189
3253
|
}
|
|
3190
|
-
},
|
|
3254
|
+
}, ae = {
|
|
3191
3255
|
name: "framework:reoptimize-on-rpcgroup-change",
|
|
3192
3256
|
async configureServer(e) {
|
|
3193
3257
|
let n = /* @__PURE__ */ new Map();
|
|
3194
3258
|
for (let i of s) {
|
|
3195
3259
|
if (!i.proxyTarget) continue;
|
|
3196
|
-
let a = await
|
|
3260
|
+
let a = await li(t, i.pkg);
|
|
3197
3261
|
if (!a) continue;
|
|
3198
3262
|
let o = r(a, "rpcGroup.generated.ts");
|
|
3199
3263
|
try {
|
|
@@ -3236,28 +3300,28 @@ import {
|
|
|
3236
3300
|
};
|
|
3237
3301
|
e.watcher.on("change", u), e.watcher.on("add", u);
|
|
3238
3302
|
}
|
|
3239
|
-
},
|
|
3303
|
+
}, L = {};
|
|
3240
3304
|
for (let e of s) {
|
|
3241
3305
|
if (!e.proxyTarget) continue;
|
|
3242
|
-
|
|
3306
|
+
L[e.browserWsUrl] = {
|
|
3243
3307
|
target: e.proxyTarget,
|
|
3244
3308
|
ws: !0,
|
|
3245
3309
|
changeOrigin: !0,
|
|
3246
3310
|
...e.wsPath ? {} : { rewrite: () => "/ws" }
|
|
3247
3311
|
};
|
|
3248
3312
|
let t = e.proxyTarget.replace(/^ws/, "http");
|
|
3249
|
-
|
|
3313
|
+
L[`/_voltro/api/${e.name}`] = {
|
|
3250
3314
|
target: t,
|
|
3251
3315
|
changeOrigin: !0,
|
|
3252
3316
|
rewrite: (t) => t.replace(RegExp(`^/_voltro/api/${e.name}`), "")
|
|
3253
3317
|
};
|
|
3254
3318
|
}
|
|
3255
3319
|
for (let [e, t] of Object.entries(n.proxies ?? {})) {
|
|
3256
|
-
if (
|
|
3320
|
+
if (L[e]) {
|
|
3257
3321
|
Z.warn("user proxy ignored — prefix already claimed by an api ws proxy", { prefix: e });
|
|
3258
3322
|
continue;
|
|
3259
3323
|
}
|
|
3260
|
-
|
|
3324
|
+
L[e] = {
|
|
3261
3325
|
target: t.target,
|
|
3262
3326
|
changeOrigin: t.changeOrigin ?? !0,
|
|
3263
3327
|
...t.rewrite === void 0 ? {} : { rewrite: (n) => n.replace(RegExp(`^${e}`), t.rewrite) }
|
|
@@ -3267,7 +3331,7 @@ import {
|
|
|
3267
3331
|
...t.rewrite === void 0 ? {} : { rewrite: t.rewrite }
|
|
3268
3332
|
});
|
|
3269
3333
|
}
|
|
3270
|
-
let
|
|
3334
|
+
let oe = {
|
|
3271
3335
|
name: "framework:inspect",
|
|
3272
3336
|
configureServer(e) {
|
|
3273
3337
|
let i = null, a = async () => {
|
|
@@ -3282,8 +3346,8 @@ import {
|
|
|
3282
3346
|
renderMode: a.renderMode ?? "static",
|
|
3283
3347
|
interactive: a.interactive ?? "full",
|
|
3284
3348
|
tenantAware: a.tenantAware === !0,
|
|
3285
|
-
revalidateMs:
|
|
3286
|
-
staleWhileRevalidateMs:
|
|
3349
|
+
revalidateMs: Vn(a.revalidate),
|
|
3350
|
+
staleWhileRevalidateMs: Vn(a.staleWhileRevalidate) ?? 0,
|
|
3287
3351
|
cacheInvalidatesOn: Array.isArray(a.cacheInvalidatesOn) ? a.cacheInvalidatesOn : [],
|
|
3288
3352
|
hasLoader: typeof a.loader == "function",
|
|
3289
3353
|
hasMeta: a.meta != null,
|
|
@@ -3388,22 +3452,22 @@ import {
|
|
|
3388
3452
|
for (let [t, n] of Object.entries(e.headers ?? {})) n !== void 0 && (s[String(t).toLowerCase()] = Array.isArray(n) ? n.join(", ") : String(n));
|
|
3389
3453
|
let c = i.split("?")[0];
|
|
3390
3454
|
if (e.method === "GET" && (c === "/_voltro/inspect/logs" || i.startsWith("/_voltro/inspect/logs?"))) {
|
|
3391
|
-
let e =
|
|
3392
|
-
if (
|
|
3455
|
+
let e = G(s.origin);
|
|
3456
|
+
if (H()) {
|
|
3393
3457
|
t.statusCode = 503, t.setHeader("content-type", "application/json");
|
|
3394
3458
|
for (let [n, r] of Object.entries(e)) t.setHeader(n, r);
|
|
3395
3459
|
t.end(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }));
|
|
3396
3460
|
return;
|
|
3397
3461
|
}
|
|
3398
|
-
let n =
|
|
3462
|
+
let n = vn(i, nn());
|
|
3399
3463
|
t.statusCode = n.status, t.setHeader("content-type", n.contentType);
|
|
3400
3464
|
for (let [n, r] of Object.entries(e)) t.setHeader(n, r);
|
|
3401
3465
|
t.end(n.body);
|
|
3402
3466
|
return;
|
|
3403
3467
|
}
|
|
3404
3468
|
if (e.method === "POST" && c === "/_voltro/inspect/clientLog") {
|
|
3405
|
-
let n =
|
|
3406
|
-
if (
|
|
3469
|
+
let n = G(s.origin);
|
|
3470
|
+
if (H()) {
|
|
3407
3471
|
t.statusCode = 503, t.setHeader("content-type", "application/json");
|
|
3408
3472
|
for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
|
|
3409
3473
|
t.end(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }));
|
|
@@ -3413,7 +3477,7 @@ import {
|
|
|
3413
3477
|
e.setEncoding("utf-8"), e.on("data", (e) => {
|
|
3414
3478
|
r += e;
|
|
3415
3479
|
}), e.on("end", () => {
|
|
3416
|
-
let e =
|
|
3480
|
+
let e = fn(r, o);
|
|
3417
3481
|
t.statusCode = e.status, t.setHeader("content-type", e.contentType);
|
|
3418
3482
|
for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
|
|
3419
3483
|
t.end(e.body);
|
|
@@ -3423,14 +3487,14 @@ import {
|
|
|
3423
3487
|
return;
|
|
3424
3488
|
}
|
|
3425
3489
|
if (c === "/_voltro/inspect/stream") {
|
|
3426
|
-
let n =
|
|
3427
|
-
if (
|
|
3490
|
+
let n = G(s.origin);
|
|
3491
|
+
if (H()) {
|
|
3428
3492
|
t.statusCode = 503, t.setHeader("content-type", "application/json");
|
|
3429
3493
|
for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
|
|
3430
3494
|
t.end(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }));
|
|
3431
3495
|
return;
|
|
3432
3496
|
}
|
|
3433
|
-
let r =
|
|
3497
|
+
let r = U(s);
|
|
3434
3498
|
if (!r.ok) {
|
|
3435
3499
|
t.statusCode = 401, t.setHeader("content-type", "application/json");
|
|
3436
3500
|
for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
|
|
@@ -3444,14 +3508,14 @@ import {
|
|
|
3444
3508
|
for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
|
|
3445
3509
|
t.flushHeaders?.(), t.write("retry: 5000\n\n");
|
|
3446
3510
|
let a = i.indexOf("?");
|
|
3447
|
-
if (!(a !== -1 && new URLSearchParams(i.slice(a + 1)).get("live") === "1")) for (let e of o.buffered()) t.write(
|
|
3511
|
+
if (!(a !== -1 && new URLSearchParams(i.slice(a + 1)).get("live") === "1")) for (let e of o.buffered()) t.write(Yt(e));
|
|
3448
3512
|
let c = o.subscribe((e) => {
|
|
3449
3513
|
try {
|
|
3450
|
-
t.write(
|
|
3514
|
+
t.write(Yt(e));
|
|
3451
3515
|
} catch {}
|
|
3452
3516
|
}), l = setInterval(() => {
|
|
3453
3517
|
try {
|
|
3454
|
-
t.write(
|
|
3518
|
+
t.write(Xt());
|
|
3455
3519
|
} catch {}
|
|
3456
3520
|
}, 15e3), u = () => {
|
|
3457
3521
|
clearInterval(l), c();
|
|
@@ -3460,11 +3524,11 @@ import {
|
|
|
3460
3524
|
return;
|
|
3461
3525
|
}
|
|
3462
3526
|
try {
|
|
3463
|
-
let o =
|
|
3527
|
+
let o = kt(i, {
|
|
3464
3528
|
kind: "web",
|
|
3465
3529
|
meta: {
|
|
3466
3530
|
name: n.name ?? "(unnamed)",
|
|
3467
|
-
voltroVersion:
|
|
3531
|
+
voltroVersion: Br,
|
|
3468
3532
|
port: u,
|
|
3469
3533
|
mode: "dev",
|
|
3470
3534
|
apis: Object.entries(n.apis ?? {}).map(([e, t]) => {
|
|
@@ -3482,7 +3546,7 @@ import {
|
|
|
3482
3546
|
size: 0,
|
|
3483
3547
|
entries: []
|
|
3484
3548
|
}),
|
|
3485
|
-
env: () =>
|
|
3549
|
+
env: () => St(n.name ?? "app", { contract: ie(n.env) ? n.env : void 0 })
|
|
3486
3550
|
}, s, { method: e.method ?? "GET" });
|
|
3487
3551
|
if (o === null) return r();
|
|
3488
3552
|
t.statusCode = o.status, t.setHeader("content-type", o.contentType);
|
|
@@ -3493,37 +3557,44 @@ import {
|
|
|
3493
3557
|
}
|
|
3494
3558
|
});
|
|
3495
3559
|
}
|
|
3496
|
-
},
|
|
3560
|
+
}, se = n.name === "voltroDashboard" ? {
|
|
3497
3561
|
name: "framework:dashboard-registry",
|
|
3498
3562
|
configureServer(e) {
|
|
3499
3563
|
e.middlewares.use(async (e, t, n) => {
|
|
3500
3564
|
if (!(e.url ?? "").startsWith("/api/dashboard/registry")) return n();
|
|
3501
3565
|
try {
|
|
3502
|
-
let e = await
|
|
3566
|
+
let e = await er();
|
|
3503
3567
|
t.statusCode = 200, t.setHeader("content-type", "application/json; charset=utf-8"), t.end(JSON.stringify(e));
|
|
3504
3568
|
} catch (e) {
|
|
3505
3569
|
t.statusCode = 500, t.setHeader("content-type", "text/plain"), t.end(`registry read error: ${e.message}`);
|
|
3506
3570
|
}
|
|
3507
3571
|
});
|
|
3508
3572
|
}
|
|
3509
|
-
} : null,
|
|
3573
|
+
} : null, ue = si(m), de = /* @__PURE__ */ new Set(), fe = ct(), pe = ut({
|
|
3574
|
+
limit: fe,
|
|
3575
|
+
onColdStart: (e) => Z.debug("ssr cold-compile start", { id: e }),
|
|
3576
|
+
onColdEnd: (e) => Z.debug("ssr cold-compile end", { id: e })
|
|
3577
|
+
});
|
|
3578
|
+
Z.debug(`ssr cold-compile concurrency ${fe}`, { concurrency: fe });
|
|
3579
|
+
let me = null, he = async () => (me === null && (me = await S.readFile(r(t, ".framework", "index.html"), "utf8")), me), ge = {
|
|
3510
3580
|
name: "framework:ssr",
|
|
3511
3581
|
configureServer(e) {
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3582
|
+
let n = (t) => pe.load(t, async () => await e.ssrLoadModule(t));
|
|
3583
|
+
e.middlewares.use(async (i, a, o) => {
|
|
3584
|
+
if (i.method !== "GET" && i.method !== "HEAD") return o();
|
|
3585
|
+
let c = i.url ?? "/", l = c.indexOf("?"), u = (l === -1 ? c : c.slice(0, l)) || "/";
|
|
3586
|
+
if (u.startsWith("/@") || u.startsWith("/node_modules/") || u.startsWith("/.framework/") || u.startsWith("/_voltro/") || u === "/main.tsx" || u === "/index.html" || u === "/sw.js" || u === "/favicon.ico" || u === "/robots.txt" || /\.[a-z0-9]+$/i.test(u)) return o();
|
|
3587
|
+
let d = ci(u, ue);
|
|
3588
|
+
if (!d) return o();
|
|
3589
|
+
let f = !de.has(d.route.pattern), p = Date.now();
|
|
3590
|
+
f && Z.info(`ssr compiling ${d.route.pattern}`, {
|
|
3591
|
+
pattern: d.route.pattern,
|
|
3592
|
+
pathname: u
|
|
3522
3593
|
});
|
|
3523
|
-
let
|
|
3594
|
+
let m = {}, g = async (e, t) => {
|
|
3524
3595
|
let n = Date.now(), r = await t();
|
|
3525
|
-
return
|
|
3526
|
-
},
|
|
3596
|
+
return m[e] = (m[e] ?? 0) + (Date.now() - n), r;
|
|
3597
|
+
}, _ = async (t, n, r) => {
|
|
3527
3598
|
let i = await e.moduleGraph.getModuleById(t);
|
|
3528
3599
|
if (!(!i || n.has(t))) {
|
|
3529
3600
|
if (n.add(t), i.id && /\.(css|sass|scss|less|stylus|pcss|postcss)(\?|$)/.test(i.id)) {
|
|
@@ -3531,158 +3602,178 @@ import {
|
|
|
3531
3602
|
r.includes(e) || r.push(e);
|
|
3532
3603
|
return;
|
|
3533
3604
|
}
|
|
3534
|
-
for (let e of i.importedModules ?? []) e.id && await
|
|
3605
|
+
for (let e of i.importedModules ?? []) e.id && await _(e.id, n, r);
|
|
3535
3606
|
}
|
|
3536
3607
|
};
|
|
3537
3608
|
try {
|
|
3538
|
-
let
|
|
3539
|
-
if (
|
|
3540
|
-
let
|
|
3541
|
-
for (let [e, t] of Object.entries(
|
|
3542
|
-
let
|
|
3543
|
-
|
|
3544
|
-
let
|
|
3609
|
+
let l = await g("loadPage", async () => await n(r(t, "src", "pages", d.route.file))), v = l.renderMode ?? "static", y = ni(h, d.route.dirChain), b = v === "spa" && y.some((e) => e.hasLayout);
|
|
3610
|
+
if (v !== "ssr" && v !== "isr" && !b) return o();
|
|
3611
|
+
let x = {};
|
|
3612
|
+
for (let [e, t] of Object.entries(i.headers ?? {})) typeof t == "string" ? x[e] = t : Array.isArray(t) && (x[e] = t.join(", "));
|
|
3613
|
+
let S = gi(hi(s[0]), x.cookie), C = new AbortController(), w = () => C.abort();
|
|
3614
|
+
a.once("close", w);
|
|
3615
|
+
let T = null, E = [], ee = {};
|
|
3545
3616
|
try {
|
|
3546
|
-
({chain:
|
|
3547
|
-
entries:
|
|
3548
|
-
loadLayout: (
|
|
3549
|
-
loadError: (
|
|
3550
|
-
loadPending: (
|
|
3617
|
+
({chain: E, segmentLoaderData: ee} = await g("loadChain", () => ri({
|
|
3618
|
+
entries: y,
|
|
3619
|
+
loadLayout: (e) => n(r(t, "src", "pages", e.dir, "layout.tsx")),
|
|
3620
|
+
loadError: (e) => n(r(t, "src", "pages", e.dir, "error.tsx")),
|
|
3621
|
+
loadPending: (e) => n(r(t, "src", "pages", e.dir, "loading.tsx")),
|
|
3551
3622
|
ctx: {
|
|
3552
|
-
params:
|
|
3553
|
-
pathname:
|
|
3554
|
-
signal:
|
|
3555
|
-
headers:
|
|
3556
|
-
query:
|
|
3623
|
+
params: d.params,
|
|
3624
|
+
pathname: u,
|
|
3625
|
+
signal: C.signal,
|
|
3626
|
+
headers: x,
|
|
3627
|
+
query: S
|
|
3557
3628
|
}
|
|
3558
3629
|
})));
|
|
3559
|
-
let
|
|
3560
|
-
typeof
|
|
3561
|
-
params:
|
|
3562
|
-
pathname:
|
|
3563
|
-
signal:
|
|
3564
|
-
headers:
|
|
3565
|
-
query:
|
|
3630
|
+
let e = l.loader;
|
|
3631
|
+
typeof e == "function" && !b && (T = await g("loader", () => e({
|
|
3632
|
+
params: d.params,
|
|
3633
|
+
pathname: u,
|
|
3634
|
+
signal: C.signal,
|
|
3635
|
+
headers: x,
|
|
3636
|
+
query: S
|
|
3566
3637
|
})));
|
|
3567
3638
|
} finally {
|
|
3568
|
-
|
|
3639
|
+
a.off("close", w);
|
|
3569
3640
|
}
|
|
3570
|
-
let
|
|
3571
|
-
pattern:
|
|
3572
|
-
Component:
|
|
3573
|
-
meta:
|
|
3574
|
-
loader:
|
|
3575
|
-
ErrorBoundary:
|
|
3576
|
-
Pending:
|
|
3577
|
-
renderMode:
|
|
3578
|
-
chain:
|
|
3579
|
-
},
|
|
3580
|
-
cookies:
|
|
3581
|
-
headers:
|
|
3582
|
-
url:
|
|
3583
|
-
},
|
|
3584
|
-
helpers:
|
|
3585
|
-
page: `src/pages/${
|
|
3586
|
-
renderMode:
|
|
3587
|
-
interactive:
|
|
3588
|
-
loaderData:
|
|
3589
|
-
segmentLoaderData:
|
|
3590
|
-
pageLoaderRan: typeof
|
|
3591
|
-
}),
|
|
3592
|
-
await
|
|
3641
|
+
let D = await g("loadSsrHelpers", async () => await n("@voltro/web/ssr")), te = {
|
|
3642
|
+
pattern: d.route.pattern,
|
|
3643
|
+
Component: l.default,
|
|
3644
|
+
meta: l.meta,
|
|
3645
|
+
loader: l.loader,
|
|
3646
|
+
ErrorBoundary: l.ErrorBoundary,
|
|
3647
|
+
Pending: l.Pending,
|
|
3648
|
+
renderMode: v,
|
|
3649
|
+
chain: E
|
|
3650
|
+
}, O = {
|
|
3651
|
+
cookies: D.parseCookieHeader(x.cookie),
|
|
3652
|
+
headers: x,
|
|
3653
|
+
url: c
|
|
3654
|
+
}, k = l.interactive ?? "full", A = b ? null : Or({
|
|
3655
|
+
helpers: D,
|
|
3656
|
+
page: `src/pages/${d.route.file}`,
|
|
3657
|
+
renderMode: v,
|
|
3658
|
+
interactive: k,
|
|
3659
|
+
loaderData: T,
|
|
3660
|
+
segmentLoaderData: ee,
|
|
3661
|
+
pageLoaderRan: typeof l.loader == "function"
|
|
3662
|
+
}), j = [];
|
|
3663
|
+
await g("collectCss", async () => {
|
|
3593
3664
|
let e = /* @__PURE__ */ new Set(), n = [
|
|
3594
|
-
r(t, "src", "pages",
|
|
3595
|
-
...
|
|
3665
|
+
r(t, "src", "pages", d.route.file),
|
|
3666
|
+
...y.flatMap((e) => [
|
|
3596
3667
|
...e.hasLayout ? [r(t, "src", "pages", e.dir, "layout.tsx")] : [],
|
|
3597
3668
|
...e.hasError ? [r(t, "src", "pages", e.dir, "error.tsx")] : [],
|
|
3598
3669
|
...e.hasPending ? [r(t, "src", "pages", e.dir, "loading.tsx")] : []
|
|
3599
3670
|
]),
|
|
3600
3671
|
r(t, ".framework", "main.tsx")
|
|
3601
3672
|
];
|
|
3602
|
-
for (let t of n) await
|
|
3673
|
+
for (let t of n) await _(t, e, j);
|
|
3603
3674
|
});
|
|
3604
|
-
let
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
"
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3675
|
+
let M = await g("readShell", he), N = await g("transformShell", () => e.transformIndexHtml(c, M)), P = j.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), F = O.cookies["voltro:locale"] ?? "en", ne = Date.now();
|
|
3676
|
+
if (b) {
|
|
3677
|
+
let e = kr({
|
|
3678
|
+
helpers: D,
|
|
3679
|
+
renderInput: {
|
|
3680
|
+
descriptor: te,
|
|
3681
|
+
params: d.params,
|
|
3682
|
+
pathname: u,
|
|
3683
|
+
segmentLoaderData: ee,
|
|
3684
|
+
requestContext: O
|
|
3685
|
+
}
|
|
3686
|
+
}), t = [
|
|
3687
|
+
P,
|
|
3688
|
+
D.renderMetaToHtml(e.meta),
|
|
3689
|
+
`<meta name="voltro-interactive" content="${k}" />`,
|
|
3690
|
+
e.stateScript
|
|
3691
|
+
].filter((e) => e.length > 0).join("\n "), n = N.replace("<div id=\"root\"></div>", `<div id="root">${e.body}</div>`).replace("</head>", ` ${t}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${F}"`);
|
|
3692
|
+
a.statusCode = 200, a.setHeader("content-type", "text/html; charset=utf-8"), a.setHeader("x-voltro-rendered-by", "spa-shell-dev"), a.end(n);
|
|
3693
|
+
} else if (A) {
|
|
3694
|
+
let e = (e) => [
|
|
3695
|
+
P,
|
|
3696
|
+
D.renderMetaToHtml(e),
|
|
3697
|
+
`<meta name="voltro-interactive" content="${k}" />`,
|
|
3698
|
+
...A.hasDeferred ? [D.renderDeferredRegistryScript()] : [],
|
|
3699
|
+
D.renderRouterStateScript(A.stateInput)
|
|
3700
|
+
].filter((e) => e.length > 0).join("\n "), t = {
|
|
3701
|
+
descriptor: te,
|
|
3702
|
+
params: d.params,
|
|
3703
|
+
pathname: u,
|
|
3704
|
+
loaderData: A.loaderData,
|
|
3705
|
+
segmentLoaderData: A.segmentLoaderData,
|
|
3706
|
+
requestContext: O
|
|
3707
|
+
};
|
|
3708
|
+
if (v === "ssr" && k === "full") Rr({
|
|
3709
|
+
res: a,
|
|
3710
|
+
shell: Ir({
|
|
3711
|
+
shell: N,
|
|
3712
|
+
inlineModuleScriptsAsync: !0
|
|
3713
|
+
}),
|
|
3714
|
+
htmlLang: F,
|
|
3715
|
+
headers: {
|
|
3716
|
+
"content-type": "text/html; charset=utf-8",
|
|
3717
|
+
"x-voltro-rendered-by": "ssr-dev"
|
|
3718
|
+
},
|
|
3719
|
+
headInjection: e,
|
|
3720
|
+
render: (e) => D.renderPageToStream({
|
|
3721
|
+
...t,
|
|
3722
|
+
...e
|
|
3723
|
+
}),
|
|
3724
|
+
onShellError: (e) => {
|
|
3725
|
+
Z.warn("ssr-dev shell render failed; falling back to SPA shell", {
|
|
3726
|
+
pathname: u,
|
|
3727
|
+
pattern: d.route.pattern
|
|
3728
|
+
}, e), o();
|
|
3729
|
+
}
|
|
3730
|
+
});
|
|
3731
|
+
else {
|
|
3732
|
+
let { html: n, meta: r } = D.renderPageToHtml(t), i = N.replace("<div id=\"root\"></div>", `<div id="root">${n}</div>`).replace("</head>", ` ${e(r)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${F}"`);
|
|
3733
|
+
a.statusCode = 200, a.setHeader("content-type", "text/html; charset=utf-8"), a.setHeader("x-voltro-rendered-by", "ssr-dev"), a.end(i);
|
|
3639
3734
|
}
|
|
3640
|
-
});
|
|
3641
|
-
else {
|
|
3642
|
-
let { html: e, meta: t } = E.renderPageToHtml(ae), n = A.replace("<div id=\"root\"></div>", `<div id="root">${e}</div>`).replace("</head>", ` ${j(t)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${M}"`);
|
|
3643
|
-
i.statusCode = 200, i.setHeader("content-type", "text/html; charset=utf-8"), i.setHeader("x-voltro-rendered-by", "ssr-dev"), i.end(n);
|
|
3644
3735
|
}
|
|
3645
|
-
|
|
3646
|
-
let
|
|
3647
|
-
|
|
3648
|
-
pattern:
|
|
3649
|
-
pathname:
|
|
3650
|
-
elapsedMs:
|
|
3736
|
+
m.render = Date.now() - ne;
|
|
3737
|
+
let I = Date.now() - p;
|
|
3738
|
+
f ? (de.add(d.route.pattern), Z.info(`ssr compiled ${d.route.pattern} in ${I}ms`, {
|
|
3739
|
+
pattern: d.route.pattern,
|
|
3740
|
+
pathname: u,
|
|
3741
|
+
elapsedMs: I,
|
|
3651
3742
|
cold: !0,
|
|
3652
|
-
phases:
|
|
3653
|
-
})) :
|
|
3654
|
-
pattern:
|
|
3655
|
-
pathname:
|
|
3656
|
-
elapsedMs:
|
|
3743
|
+
phases: m
|
|
3744
|
+
})) : I > 200 && Z.info(`ssr rendered ${u} in ${I}ms`, {
|
|
3745
|
+
pattern: d.route.pattern,
|
|
3746
|
+
pathname: u,
|
|
3747
|
+
elapsedMs: I,
|
|
3657
3748
|
cold: !1,
|
|
3658
|
-
phases:
|
|
3749
|
+
phases: m
|
|
3659
3750
|
});
|
|
3660
3751
|
} catch (e) {
|
|
3661
|
-
if (
|
|
3752
|
+
if (Dr(e)) {
|
|
3662
3753
|
Z.error("ssr-dev render refused", {
|
|
3663
|
-
pathname:
|
|
3664
|
-
pattern:
|
|
3665
|
-
}, e),
|
|
3754
|
+
pathname: u,
|
|
3755
|
+
pattern: d.route.pattern
|
|
3756
|
+
}, e), a.statusCode = 500, a.setHeader("content-type", "text/plain; charset=utf-8"), a.end(e.message);
|
|
3666
3757
|
return;
|
|
3667
3758
|
}
|
|
3668
3759
|
Z.warn("ssr-dev render failed; falling back to SPA shell", {
|
|
3669
|
-
pathname:
|
|
3670
|
-
pattern:
|
|
3671
|
-
}, e),
|
|
3760
|
+
pathname: u,
|
|
3761
|
+
pattern: d.route.pattern
|
|
3762
|
+
}, e), o();
|
|
3672
3763
|
}
|
|
3673
3764
|
});
|
|
3674
3765
|
}
|
|
3675
|
-
},
|
|
3766
|
+
}, _e = Date.now(), ve = b.version ?? "?", ye = await Vr(), be = r(t, "node_modules", "@voltro", "ui-shadcn"), R = y(r(be, "package.json")) ? be : null, xe = [], Se = await (async () => {
|
|
3676
3767
|
let e = [];
|
|
3677
3768
|
for (let n of s) {
|
|
3678
3769
|
if (!n.proxyTarget) continue;
|
|
3679
|
-
let i = await
|
|
3770
|
+
let i = await li(t, n.pkg);
|
|
3680
3771
|
if (i) try {
|
|
3681
3772
|
e.push(await S.readFile(r(i, "rpcGroup.generated.ts"), "utf8"));
|
|
3682
3773
|
} catch {}
|
|
3683
3774
|
}
|
|
3684
3775
|
if (e.length === 0) return !1;
|
|
3685
|
-
let n =
|
|
3776
|
+
let n = ce("sha1").update(e.join("\0")).digest("hex"), i = r(w, ".voltro-rpcgroup-optimize"), a = "";
|
|
3686
3777
|
try {
|
|
3687
3778
|
a = (await S.readFile(i, "utf8")).trim();
|
|
3688
3779
|
} catch {}
|
|
@@ -3692,73 +3783,73 @@ import {
|
|
|
3692
3783
|
} catch {}
|
|
3693
3784
|
return !0;
|
|
3694
3785
|
})();
|
|
3695
|
-
|
|
3786
|
+
Se && Z.info("rpcGroup changed since last boot — forcing a dep re-optimize so the browser loads the current api client"), await (await b.createServer({
|
|
3696
3787
|
root: w,
|
|
3697
3788
|
envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
|
|
3698
3789
|
ssr: { noExternal: ["react-intl"] },
|
|
3699
3790
|
resolve: {
|
|
3700
3791
|
dedupe: ["react", "react-dom"],
|
|
3701
3792
|
alias: [
|
|
3702
|
-
...
|
|
3793
|
+
...ye ? [{
|
|
3703
3794
|
find: "@voltro/devtools/styles.css",
|
|
3704
|
-
replacement: r(
|
|
3795
|
+
replacement: r(ye, "src/styles.css")
|
|
3705
3796
|
}, {
|
|
3706
3797
|
find: "@voltro/devtools",
|
|
3707
|
-
replacement: r(
|
|
3798
|
+
replacement: r(ye, "src/index.ts")
|
|
3708
3799
|
}] : [],
|
|
3709
|
-
...
|
|
3800
|
+
...R ? [
|
|
3710
3801
|
{
|
|
3711
3802
|
find: "@voltro/ui-shadcn/tokens.css",
|
|
3712
|
-
replacement: r(
|
|
3803
|
+
replacement: r(R, "src/tokens.css")
|
|
3713
3804
|
},
|
|
3714
3805
|
{
|
|
3715
3806
|
find: "@voltro/ui-shadcn/cn",
|
|
3716
|
-
replacement: r(
|
|
3807
|
+
replacement: r(R, "src/cn.ts")
|
|
3717
3808
|
},
|
|
3718
3809
|
{
|
|
3719
3810
|
find: "@voltro/ui-shadcn/brand",
|
|
3720
|
-
replacement: r(
|
|
3811
|
+
replacement: r(R, "src/brand/voltroLogo.tsx")
|
|
3721
3812
|
},
|
|
3722
3813
|
{
|
|
3723
3814
|
find: "@voltro/ui-shadcn",
|
|
3724
|
-
replacement: r(
|
|
3815
|
+
replacement: r(R, "src/index.ts")
|
|
3725
3816
|
}
|
|
3726
3817
|
] : [],
|
|
3727
|
-
...
|
|
3818
|
+
...Ue(t)
|
|
3728
3819
|
]
|
|
3729
3820
|
},
|
|
3730
3821
|
optimizeDeps: {
|
|
3731
3822
|
include: [...s.map((e) => `${e.pkg}/rpcGroup`), ...xe],
|
|
3732
|
-
force:
|
|
3823
|
+
force: Se
|
|
3733
3824
|
},
|
|
3734
|
-
customLogger:
|
|
3825
|
+
customLogger: st(),
|
|
3735
3826
|
plugins: [
|
|
3736
|
-
|
|
3827
|
+
zn(r(t, "src", "pages")),
|
|
3737
3828
|
x(),
|
|
3738
3829
|
C(),
|
|
3739
3830
|
ee,
|
|
3831
|
+
A,
|
|
3740
3832
|
ne,
|
|
3833
|
+
re,
|
|
3741
3834
|
ae,
|
|
3742
3835
|
oe,
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
_e,
|
|
3746
|
-
...ue ? [ue] : []
|
|
3836
|
+
ge,
|
|
3837
|
+
...se ? [se] : []
|
|
3747
3838
|
],
|
|
3748
3839
|
server: {
|
|
3749
3840
|
port: u,
|
|
3750
3841
|
strictPort: !0,
|
|
3751
3842
|
host: !0,
|
|
3752
3843
|
allowedHosts: n.allowedHosts === !0 || [...n.allowedHosts ?? []],
|
|
3753
|
-
proxy:
|
|
3754
|
-
fs: { allow: [t, ...
|
|
3844
|
+
proxy: L,
|
|
3845
|
+
fs: { allow: [t, ...qr(t)] }
|
|
3755
3846
|
},
|
|
3756
3847
|
appType: "spa",
|
|
3757
3848
|
cacheDir: r(w, ".vite"),
|
|
3758
3849
|
publicDir: r(t, "public")
|
|
3759
|
-
})).listen(),
|
|
3760
|
-
version:
|
|
3761
|
-
bootMs: Date.now() -
|
|
3850
|
+
})).listen(), zr.info(`v${ve} ready in ${Date.now() - _e}ms`, {
|
|
3851
|
+
version: ve,
|
|
3852
|
+
bootMs: Date.now() - _e
|
|
3762
3853
|
}), Z.info(`listening on http://localhost:${u}`, {
|
|
3763
3854
|
port: u,
|
|
3764
3855
|
app: n.name ?? "(unnamed)"
|
|
@@ -3768,7 +3859,7 @@ import {
|
|
|
3768
3859
|
target: e.proxyTarget
|
|
3769
3860
|
}), Z.info(`proxy /_voltro/api/${e.name} → ${e.proxyTarget.replace(/^ws/, "http")}/_voltro/inspect`, { api: e.name }));
|
|
3770
3861
|
try {
|
|
3771
|
-
await
|
|
3862
|
+
await tr({
|
|
3772
3863
|
id: f,
|
|
3773
3864
|
name: d,
|
|
3774
3865
|
kind: "web",
|
|
@@ -3777,13 +3868,13 @@ import {
|
|
|
3777
3868
|
status: "live",
|
|
3778
3869
|
logFile: p.path
|
|
3779
3870
|
});
|
|
3780
|
-
let e =
|
|
3871
|
+
let e = hr(t);
|
|
3781
3872
|
if (e) {
|
|
3782
|
-
let t = await
|
|
3873
|
+
let t = await Tr({ dashboardAppPath: e });
|
|
3783
3874
|
t.status === "launched" ? Z.info(`dashboard launched at http://localhost:${t.port}`, { port: t.port }) : t.status === "already-running" && Z.debug(`dashboard already running on :${t.port}`, { port: t.port });
|
|
3784
3875
|
}
|
|
3785
3876
|
setInterval(() => {
|
|
3786
|
-
|
|
3877
|
+
tr({
|
|
3787
3878
|
id: f,
|
|
3788
3879
|
name: d,
|
|
3789
3880
|
kind: "web",
|
|
@@ -3794,7 +3885,7 @@ import {
|
|
|
3794
3885
|
}).catch(() => {});
|
|
3795
3886
|
}, 1e4).unref();
|
|
3796
3887
|
let n = () => {
|
|
3797
|
-
|
|
3888
|
+
nr(f), p.dispose();
|
|
3798
3889
|
};
|
|
3799
3890
|
process.on("SIGINT", n), process.on("SIGTERM", n);
|
|
3800
3891
|
} catch (e) {
|
|
@@ -3804,40 +3895,40 @@ import {
|
|
|
3804
3895
|
app: n.name ?? "unnamed",
|
|
3805
3896
|
kind: "web",
|
|
3806
3897
|
url: `http://localhost:${u}`,
|
|
3807
|
-
bootMs: Date.now() -
|
|
3898
|
+
bootMs: Date.now() - _e
|
|
3808
3899
|
}), new Promise(() => {});
|
|
3809
|
-
},
|
|
3900
|
+
}, Si = async (e) => {
|
|
3810
3901
|
process.env.NODE_ENV || (process.env.NODE_ENV = "production");
|
|
3811
|
-
let t = await
|
|
3902
|
+
let t = await bi(e);
|
|
3812
3903
|
if (!t) return {
|
|
3813
3904
|
ran: !1,
|
|
3814
3905
|
exitCode: 0
|
|
3815
3906
|
};
|
|
3816
3907
|
let n = Date.now(), i = Z.child("serve");
|
|
3817
3908
|
i.info("booting voltro serve (preview)", { app: t.name ?? "(unnamed)" });
|
|
3818
|
-
let a = await
|
|
3909
|
+
let a = await mi(e, t);
|
|
3819
3910
|
for (let e of a) i.info("api wired", {
|
|
3820
3911
|
name: e.name,
|
|
3821
3912
|
pkg: e.pkg
|
|
3822
3913
|
});
|
|
3823
|
-
await
|
|
3914
|
+
await _i(e, t, a);
|
|
3824
3915
|
{
|
|
3825
3916
|
let { pages: t } = await $(r(e, "src", "pages"));
|
|
3826
|
-
await
|
|
3917
|
+
await bt({
|
|
3827
3918
|
appRoot: e,
|
|
3828
3919
|
pages: t
|
|
3829
3920
|
});
|
|
3830
3921
|
}
|
|
3831
|
-
let o = t.port ?? 5173, s = await
|
|
3922
|
+
let o = t.port ?? 5173, s = await Ge("vite", () => import("vite")), c = (await import("@vitejs/plugin-react")).default, l = r(e, ".framework");
|
|
3832
3923
|
Z.info("running production build"), await s.build({
|
|
3833
3924
|
root: l,
|
|
3834
3925
|
envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
|
|
3835
3926
|
plugins: [c()],
|
|
3836
|
-
customLogger:
|
|
3927
|
+
customLogger: st(),
|
|
3837
3928
|
resolve: { dedupe: ["react", "react-dom"] },
|
|
3838
3929
|
build: {
|
|
3839
3930
|
outDir: "dist",
|
|
3840
|
-
rollupOptions: { output: { manualChunks:
|
|
3931
|
+
rollupOptions: { output: { manualChunks: Xr } }
|
|
3841
3932
|
},
|
|
3842
3933
|
publicDir: r(e, "public")
|
|
3843
3934
|
});
|
|
@@ -3857,14 +3948,14 @@ import {
|
|
|
3857
3948
|
extras: f,
|
|
3858
3949
|
bootMs: Date.now() - n
|
|
3859
3950
|
}), new Promise(() => {});
|
|
3860
|
-
},
|
|
3951
|
+
}, Ci = 5e3, wi = 6e4, Ti = (e, t) => {
|
|
3861
3952
|
if (e.length === 0) return 0;
|
|
3862
3953
|
if (e.length === 1) return e[0];
|
|
3863
3954
|
let n = t * (e.length - 1), r = Math.floor(n), i = Math.ceil(n);
|
|
3864
3955
|
if (r === i) return e[r];
|
|
3865
3956
|
let a = n - r;
|
|
3866
3957
|
return e[r] * (1 - a) + e[i] * a;
|
|
3867
|
-
},
|
|
3958
|
+
}, Ei = (e) => {
|
|
3868
3959
|
if (e.length === 0) return {
|
|
3869
3960
|
p50: 0,
|
|
3870
3961
|
p95: 0,
|
|
@@ -3876,18 +3967,18 @@ import {
|
|
|
3876
3967
|
let t = e.slice().sort((e, t) => e - t), n = 0;
|
|
3877
3968
|
for (let e of t) n += e;
|
|
3878
3969
|
return {
|
|
3879
|
-
p50:
|
|
3880
|
-
p95:
|
|
3881
|
-
p99:
|
|
3970
|
+
p50: Ti(t, .5),
|
|
3971
|
+
p95: Ti(t, .95),
|
|
3972
|
+
p99: Ti(t, .99),
|
|
3882
3973
|
mean: n / t.length,
|
|
3883
3974
|
min: t[0],
|
|
3884
3975
|
max: t[t.length - 1]
|
|
3885
3976
|
};
|
|
3886
|
-
},
|
|
3887
|
-
let t = e.maxSamples ??
|
|
3977
|
+
}, Di = (e = {}) => {
|
|
3978
|
+
let t = e.maxSamples ?? Ci, n = e.defaultWindowMs ?? wi, r = [];
|
|
3888
3979
|
return {
|
|
3889
3980
|
record(e) {
|
|
3890
|
-
|
|
3981
|
+
A(e), r.push({
|
|
3891
3982
|
...e,
|
|
3892
3983
|
ts: Date.now()
|
|
3893
3984
|
}), r.length > t && r.shift();
|
|
@@ -3913,7 +4004,7 @@ import {
|
|
|
3913
4004
|
tag: e.tag,
|
|
3914
4005
|
count: e.samples.length,
|
|
3915
4006
|
errorCount: n,
|
|
3916
|
-
latencyMs:
|
|
4007
|
+
latencyMs: Ei(t)
|
|
3917
4008
|
});
|
|
3918
4009
|
}
|
|
3919
4010
|
return c.sort((e, t) => t.count - e.count), {
|
|
@@ -3926,4 +4017,4 @@ import {
|
|
|
3926
4017
|
};
|
|
3927
4018
|
};
|
|
3928
4019
|
//#endregion
|
|
3929
|
-
export {
|
|
4020
|
+
export { Kt as $, Hn as A, ye as At, mn as B, lr as C, Xe as Ct, er as D, Be as Dt, rr as E, Ue as Et, On as F, Jt as G, an as H, En as I, Ot as J, Xt as K, Tn as L, Wn as M, Bn as N, nr as O, Ve as Ot, Vn as P, Nt as Q, Cn as R, hr as S, Qe as St, dr as T, Ge as Tt, nn as U, fn as V, Yt as W, Rt as X, U as Y, Gt as Z, Or as _, St as _t, ri as a, jt as at, mr as b, ut as bt, mi as c, Vt as ct, Xr as d, zt as dt, Mt as et, $ as f, Ft as ft, Dr as g, wt as gt, Rr as h, H as ht, gi as i, Lt as it, Un as j, tr as k, ve as kt, xi as l, Ht as lt, Ir as m, G as mt, Zr as n, Pt as nt, ni as o, Wt as ot, _i as p, It as pt, V as q, hi as r, kt as rt, bi as s, Ut as st, Di as t, At as tt, Si as u, Bt as ut, kr as v, Ct as vt, ur as w, Ye as wt, Tr as x, ct as xt, gr as y, bt as yt, vn as z };
|