@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
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $ as e,
|
|
2
|
-
import { i as
|
|
3
|
-
import { r as
|
|
4
|
-
import { t as
|
|
1
|
+
import { $ as e, At as t, Dt as n, E as r, F as i, G as a, H as o, J as s, K as c, L as l, O as u, P as d, Q as f, S as p, St as m, U as h, V as g, W as _, X as ee, Y as te, Z as ne, _t as re, at as ie, ct as ae, dt as v, et as oe, ft as se, gt as ce, ht as le, it as ue, k as de, l as y, lt as fe, mt as b, nt as pe, ot as me, pt as he, q as ge, rt as _e, st as ve, t as ye, tt as be, ut as xe, w as Se, x as Ce, z as we } from "./inspectMetrics-DVCKKSPk.js";
|
|
2
|
+
import { i as x, n as Te, t as Ee } from "./startupRunner-DhlX9nqd.js";
|
|
3
|
+
import { r as De } from "./devActivity-1WtIVyHc.js";
|
|
4
|
+
import { t as S } from "./frameworkInspectState-CX2250XB.js";
|
|
5
5
|
import { basename as C, dirname as w, join as T, relative as E, resolve as D } from "node:path";
|
|
6
6
|
import { fileURLToPath as Oe, pathToFileURL as O } from "node:url";
|
|
7
7
|
import { FetchHttpClient as ke } from "@effect/platform";
|
|
@@ -284,7 +284,7 @@ ${a.join("\n\n")}\n`);
|
|
|
284
284
|
let f = (e) => e.replace(/[^a-zA-Z0-9_$]/g, "_"), p = (e) => `__src_agent_${f(e.name)}`, m = (e) => `__agentRoutes_${f(e.name)}`, h = r.length > 0, g = r.map((e, t) => `import { ${e.name} as __pe${t} } from '${e.module}'`), _ = h ? ", __voltroPluginErrors" : "", ee = u.length > 0, te = u.map((e, t) => `import { ${e.name} as __prpc${t} } from '${e.module}'`), ne = (e) => e === "query" ? "queryToRpc" : e === "mutation" ? "mutationToRpc" : "actionToRpc", re = u.map((e, t) => `export const ${Y(e.tag)} = ${ne(e.kind)}(__prpc${t}${_})`), ie = u.map((e) => ` ${Y(e.tag)},`), ae = u.map((e, t) => ` ${JSON.stringify(e.tag)}: normalizeDescriptor(__prpc${t}),`), v = [...n].sort((e, t) => e.kind === t.kind ? e.rpcTag < t.rpcTag ? -1 : 1 : ja(e.kind) - ja(t.kind)), oe = w(t), se = (e) => `__src_${Y(e.rpcTag)}`, ce = (e) => {
|
|
285
285
|
let t = `./${E(oe, e.file).replace(/\\/g, "/").replace(/\.tsx?$/, "")}`;
|
|
286
286
|
return `import { ${e.exportName} as ${se(e)} } from '${t}'`;
|
|
287
|
-
},
|
|
287
|
+
}, le = (e) => {
|
|
288
288
|
let t = Y(e.rpcTag), n = se(e);
|
|
289
289
|
return e.kind === "query" ? `export const ${t} = queryToRpc(${n}${_})` : e.kind === "mutation" ? `export const ${t} = mutationToRpc(${n}${_})` : e.kind === "action" ? `export const ${t} = actionToRpc(${n}${_})` : e.kind === "stream" ? `export const ${t} = streamToRpc(${n}${_})` : [
|
|
290
290
|
`export const ${t} = Rpc.make('${e.rpcTag}', {`,
|
|
@@ -293,7 +293,7 @@ ${a.join("\n\n")}\n`);
|
|
|
293
293
|
` error: ${n}.errorSchema,`,
|
|
294
294
|
"})"
|
|
295
295
|
].join("\n");
|
|
296
|
-
},
|
|
296
|
+
}, ue = [...v.filter((e) => e.kind === "query" || e.kind === "mutation" || e.kind === "action" || e.kind === "stream").map((e) => ` | __AppErrorOf<typeof ${se(e)}>`), ...h ? [" | Schema.Schema.Type<(typeof __voltroPluginErrors)[number]>"] : []], de = ue.length > 0, y = v.some((e) => e.kind === "workflow"), fe = y ? [
|
|
297
297
|
"__voltroWorkflowRun",
|
|
298
298
|
"__voltroWorkflowRuns",
|
|
299
299
|
"__voltroWorkflowRunSteps",
|
|
@@ -304,7 +304,7 @@ ${a.join("\n\n")}\n`);
|
|
|
304
304
|
"__voltroWorkflowResume",
|
|
305
305
|
"__voltroWorkflowSignal",
|
|
306
306
|
"__voltroWorkflowUpdate"
|
|
307
|
-
] : [],
|
|
307
|
+
] : [], b = a ? [
|
|
308
308
|
"__voltroUndoLog",
|
|
309
309
|
"__voltroUndoApply",
|
|
310
310
|
"__voltroUndoRedo"
|
|
@@ -316,13 +316,13 @@ ${a.join("\n\n")}\n`);
|
|
|
316
316
|
] : [], me = [
|
|
317
317
|
...v.map((e) => ` ${Y(e.rpcTag)},`),
|
|
318
318
|
...i.flatMap((e) => [` ${Y(`${e.name}.send`)},`, ` ${Y(`${e.name}.messages`)},`]),
|
|
319
|
-
...de.map((e) => ` ${e},`),
|
|
320
319
|
...fe.map((e) => ` ${e},`),
|
|
320
|
+
...b.map((e) => ` ${e},`),
|
|
321
321
|
...pe.map((e) => ` ${e},`),
|
|
322
322
|
...ie
|
|
323
|
-
].join("\n"),
|
|
324
|
-
(v.some((e) => e.kind === "mutation") || u.some((e) => e.kind === "mutation")) &&
|
|
325
|
-
let
|
|
323
|
+
].join("\n"), he = ["queryToRpc"];
|
|
324
|
+
(v.some((e) => e.kind === "mutation") || u.some((e) => e.kind === "mutation")) && he.push("mutationToRpc"), (v.some((e) => e.kind === "action") || y || c || u.some((e) => e.kind === "action")) && he.push("actionToRpc"), v.some((e) => e.kind === "stream") && he.push("streamToRpc"), y && he.push("WorkflowRunHandleSchema", "workflowCancelDescriptor", "workflowDomainEventsQueryDescriptor", "workflowEventDeliveriesQueryDescriptor", "workflowResumeDescriptor", "workflowRunEventsQueryDescriptor", "workflowRunQueryDescriptor", "workflowRunsQueryDescriptor", "workflowRunStepsQueryDescriptor", "workflowSignalDescriptor", "workflowUpdateDescriptor"), a && he.push("mutationToRpc", "undoLogQueryDescriptor", "undoApplyDescriptor", "undoRedoDescriptor"), o && he.push("mutationToRpc", "actionToRpc", "connectionsListQueryDescriptor", "connectionStartDescriptor", "connectionSubmitTokenDescriptor", "connectionDisconnectDescriptor"), (v.some((e) => e.kind === "query" || e.kind === "mutation" || e.kind === "action" || e.kind === "stream") || c || y || a || o || ee) && he.push("normalizeDescriptor");
|
|
325
|
+
let ge = [...new Set(he)].sort(), _e = v.filter((e) => e.kind === "query" || e.kind === "mutation" || e.kind === "action" || e.kind === "stream").map((e) => ` ${JSON.stringify(e.rpcTag)}: normalizeDescriptor(${se(e)}),`), ve = i.flatMap((e) => [` ${JSON.stringify(`${e.name}.send`)}: normalizeDescriptor(${m(e)}.send),`, ` ${JSON.stringify(`${e.name}.messages`)}: normalizeDescriptor(${m(e)}.messages),`]), ye = y ? [
|
|
326
326
|
" \"__voltro.workflow.run\": normalizeDescriptor(workflowRunQueryDescriptor),",
|
|
327
327
|
" \"__voltro.workflow.runs\": normalizeDescriptor(workflowRunsQueryDescriptor),",
|
|
328
328
|
" \"__voltro.workflow.run.steps\": normalizeDescriptor(workflowRunStepsQueryDescriptor),",
|
|
@@ -333,16 +333,16 @@ ${a.join("\n\n")}\n`);
|
|
|
333
333
|
" \"__voltro.workflow.resume\": normalizeDescriptor(workflowResumeDescriptor),",
|
|
334
334
|
" \"__voltro.workflow.signal\": normalizeDescriptor(workflowSignalDescriptor),",
|
|
335
335
|
" \"__voltro.workflow.update\": normalizeDescriptor(workflowUpdateDescriptor),"
|
|
336
|
-
] : [],
|
|
336
|
+
] : [], be = a ? [
|
|
337
337
|
" \"__voltro.undo.log\": normalizeDescriptor(undoLogQueryDescriptor),",
|
|
338
338
|
" \"__voltro.undo.apply\": normalizeDescriptor(undoApplyDescriptor),",
|
|
339
339
|
" \"__voltro.undo.redo\": normalizeDescriptor(undoRedoDescriptor),"
|
|
340
|
-
] : [],
|
|
340
|
+
] : [], xe = o ? [
|
|
341
341
|
" \"__voltro.connections.list\": normalizeDescriptor(connectionsListQueryDescriptor),",
|
|
342
342
|
" \"__voltro.connections.start\": normalizeDescriptor(connectionStartDescriptor),",
|
|
343
343
|
" \"__voltro.connections.submitToken\": normalizeDescriptor(connectionSubmitTokenDescriptor),",
|
|
344
344
|
" \"__voltro.connections.disconnect\": normalizeDescriptor(connectionDisconnectDescriptor),"
|
|
345
|
-
] : [],
|
|
345
|
+
] : [], Se = v.filter((e) => e.kind === "workflow").map((e) => ` ${JSON.stringify(e.rpcTag)}: { kind: 'workflow' },`), Ce = v.filter((e) => e.kind === "workflow").map((e) => {
|
|
346
346
|
let t = se(e);
|
|
347
347
|
return [
|
|
348
348
|
` ${JSON.stringify(e.rpcTag)}: {`,
|
|
@@ -355,14 +355,14 @@ ${a.join("\n\n")}\n`);
|
|
|
355
355
|
` queries: __voltroWorkflowMessages(${t}).queries,`,
|
|
356
356
|
" },"
|
|
357
357
|
].join("\n");
|
|
358
|
-
}),
|
|
358
|
+
}), we = [...v, ...i.map((e) => ({
|
|
359
359
|
rpcTag: `agent:${e.name}`,
|
|
360
360
|
file: e.file
|
|
361
361
|
}))];
|
|
362
362
|
return [
|
|
363
363
|
"// THIS FILE IS GENERATED — DO NOT EDIT BY HAND.",
|
|
364
364
|
"// Re-emitted by `voltro dev` whenever query/mutation/action/stream/workflow files change.",
|
|
365
|
-
`// descriptor-fingerprint: ${Rn("sha1").update(
|
|
365
|
+
`// descriptor-fingerprint: ${Rn("sha1").update(we.map((e) => {
|
|
366
366
|
let t = "";
|
|
367
367
|
try {
|
|
368
368
|
t = Ue(e.file, "utf8");
|
|
@@ -373,9 +373,9 @@ ${a.join("\n\n")}\n`);
|
|
|
373
373
|
...v.map((t) => `// - ${E(e, t.file).replace(/\\/g, "/")}`),
|
|
374
374
|
...i.map((t) => `// - ${E(e, t.file).replace(/\\/g, "/")} (agent)`),
|
|
375
375
|
"",
|
|
376
|
-
|
|
377
|
-
...
|
|
378
|
-
`import { ${
|
|
376
|
+
y ? "import { Rpc, RpcGroup } from '@effect/rpc'" : "import { RpcGroup } from '@effect/rpc'",
|
|
377
|
+
...y || de ? ["import { Schema } from 'effect'"] : [],
|
|
378
|
+
`import { ${ge.join(", ")} } from '@voltro/protocol'`,
|
|
379
379
|
...c ? ["import { agentRouteDescriptors as __voltroAgentRoutes } from '@voltro/ai/agent'"] : [],
|
|
380
380
|
"",
|
|
381
381
|
...v.map(ce),
|
|
@@ -391,7 +391,7 @@ ${a.join("\n\n")}\n`);
|
|
|
391
391
|
`const __voltroPluginErrors = [${r.map((e, t) => `__pe${t}`).join(", ")}] as const`,
|
|
392
392
|
""
|
|
393
393
|
] : [],
|
|
394
|
-
...
|
|
394
|
+
...y ? [
|
|
395
395
|
"const __voltroEmptyWorkflowMessages = { signals: {}, updates: {}, queries: {} } as const",
|
|
396
396
|
"const __voltroWorkflowMessages = <const M extends {",
|
|
397
397
|
" readonly signals: Readonly<Record<string, Schema.Schema.Any>>",
|
|
@@ -401,7 +401,7 @@ ${a.join("\n\n")}\n`);
|
|
|
401
401
|
" definition.__voltroWorkflowMessages ?? __voltroEmptyWorkflowMessages",
|
|
402
402
|
"",
|
|
403
403
|
"export const workflowDescriptors = {",
|
|
404
|
-
...
|
|
404
|
+
...Ce,
|
|
405
405
|
"} as const",
|
|
406
406
|
"",
|
|
407
407
|
"export type WorkflowDescriptors = typeof workflowDescriptors",
|
|
@@ -425,9 +425,9 @@ ${a.join("\n\n")}\n`);
|
|
|
425
425
|
"} }",
|
|
426
426
|
""
|
|
427
427
|
] : [],
|
|
428
|
-
...v.map(
|
|
428
|
+
...v.map(le),
|
|
429
429
|
...i.flatMap((e) => [`export const ${Y(`${e.name}.send`)} = actionToRpc(${m(e)}.send${_})`, `export const ${Y(`${e.name}.messages`)} = queryToRpc(${m(e)}.messages${_})`]),
|
|
430
|
-
...
|
|
430
|
+
...y ? [
|
|
431
431
|
"export const __voltroWorkflowRun = queryToRpc(workflowRunQueryDescriptor)",
|
|
432
432
|
"export const __voltroWorkflowRuns = queryToRpc(workflowRunsQueryDescriptor)",
|
|
433
433
|
"export const __voltroWorkflowRunSteps = queryToRpc(workflowRunStepsQueryDescriptor)",
|
|
@@ -460,24 +460,24 @@ ${a.join("\n\n")}\n`);
|
|
|
460
460
|
" * Function fields (target.shape, target.identify) survive because",
|
|
461
461
|
" * the descriptors themselves are imported by reference. */",
|
|
462
462
|
"export const appDescriptors = {",
|
|
463
|
-
...ge,
|
|
464
463
|
..._e,
|
|
465
|
-
...xe,
|
|
466
464
|
...ve,
|
|
465
|
+
...Se,
|
|
467
466
|
...ye,
|
|
468
467
|
...be,
|
|
468
|
+
...xe,
|
|
469
469
|
...ae,
|
|
470
470
|
"} as const",
|
|
471
471
|
"",
|
|
472
472
|
"export type AppDescriptors = typeof appDescriptors",
|
|
473
473
|
"",
|
|
474
|
-
...
|
|
474
|
+
...de ? [
|
|
475
475
|
"type __AppErrorOf<D> = D extends { readonly error: infer E extends Schema.Schema.Any } ? Schema.Schema.Type<E> : never",
|
|
476
476
|
"/** Union of every typed error the app's rpcs can fail with — the declared",
|
|
477
477
|
" * `error:` schemas + cross-cutting plugin errors. Generated by reference,",
|
|
478
478
|
" * so it can never drift out of date. (Workflows: see `WorkflowErrors`.) */",
|
|
479
479
|
"export type AppError =",
|
|
480
|
-
...
|
|
480
|
+
...ue,
|
|
481
481
|
"/** The `_tag` literal of every AppError — the exhaustive key set for `matchError`. */",
|
|
482
482
|
"export type AppErrorTag = AppError extends { readonly _tag: infer T extends string } ? T : never",
|
|
483
483
|
"",
|
|
@@ -815,7 +815,7 @@ ${a.join("\n\n")}\n`);
|
|
|
815
815
|
})), ro = (e) => e.flatMap((e) => e.extendSchema?.tables ?? []), io = /(?<!\.server)\.agent\.tsx?$/, Z = /\.agent\.server\.tsx?$/, ao = /\.tool\.tsx?$/, oo = async (e, t) => {
|
|
816
816
|
let n = 0;
|
|
817
817
|
for (let r of e) if (ao.test(r)) try {
|
|
818
|
-
let e = await
|
|
818
|
+
let e = await x(r);
|
|
819
819
|
n += Qn(e);
|
|
820
820
|
} catch (e) {
|
|
821
821
|
t.warn("tool: failed to import — handler not wired", { file: r }, e);
|
|
@@ -827,7 +827,7 @@ ${a.join("\n\n")}\n`);
|
|
|
827
827
|
if (!io.test(i)) continue;
|
|
828
828
|
let e;
|
|
829
829
|
try {
|
|
830
|
-
e = await
|
|
830
|
+
e = await x(i);
|
|
831
831
|
} catch (e) {
|
|
832
832
|
t.warn("agent: failed to import descriptor", { file: i }, e);
|
|
833
833
|
continue;
|
|
@@ -846,7 +846,7 @@ ${a.join("\n\n")}\n`);
|
|
|
846
846
|
}
|
|
847
847
|
let o = so(i), s;
|
|
848
848
|
try {
|
|
849
|
-
s = await
|
|
849
|
+
s = await x(o);
|
|
850
850
|
} catch (e) {
|
|
851
851
|
t.warn("agent: no executor — expected a `*.agent.server.tsx` default-exporting defineAgentExecutor()", {
|
|
852
852
|
descriptor: i,
|
|
@@ -876,7 +876,7 @@ ${a.join("\n\n")}\n`);
|
|
|
876
876
|
for (let i of e) {
|
|
877
877
|
let e;
|
|
878
878
|
try {
|
|
879
|
-
e = await
|
|
879
|
+
e = await x(i);
|
|
880
880
|
} catch (e) {
|
|
881
881
|
t.warn("connections: failed to import", { file: i }, e);
|
|
882
882
|
continue;
|
|
@@ -1641,7 +1641,7 @@ ${a.join("\n\n")}\n`);
|
|
|
1641
1641
|
for (let r of e) {
|
|
1642
1642
|
let e;
|
|
1643
1643
|
try {
|
|
1644
|
-
e = await
|
|
1644
|
+
e = await x(r);
|
|
1645
1645
|
} catch (e) {
|
|
1646
1646
|
t.warn("subscriber: failed to import", { file: r }, e);
|
|
1647
1647
|
continue;
|
|
@@ -1723,7 +1723,7 @@ ${a.join("\n\n")}\n`);
|
|
|
1723
1723
|
for (let i of e) {
|
|
1724
1724
|
let e;
|
|
1725
1725
|
try {
|
|
1726
|
-
e = await
|
|
1726
|
+
e = await x(i);
|
|
1727
1727
|
} catch (e) {
|
|
1728
1728
|
t.warn("outbox: failed to import", { file: i }, e);
|
|
1729
1729
|
continue;
|
|
@@ -1891,7 +1891,7 @@ ${a.join("\n\n")}\n`);
|
|
|
1891
1891
|
for (let r of e) {
|
|
1892
1892
|
let e;
|
|
1893
1893
|
try {
|
|
1894
|
-
e = await
|
|
1894
|
+
e = await x(r);
|
|
1895
1895
|
} catch (e) {
|
|
1896
1896
|
t.warn("reaction: failed to import (check defineReaction validation)", { file: r }, e);
|
|
1897
1897
|
continue;
|
|
@@ -2217,7 +2217,7 @@ ${a.join("\n\n")}\n`);
|
|
|
2217
2217
|
for (let i of e) {
|
|
2218
2218
|
let e;
|
|
2219
2219
|
try {
|
|
2220
|
-
e = await
|
|
2220
|
+
e = await x(i);
|
|
2221
2221
|
} catch (e) {
|
|
2222
2222
|
t.warn("aggregate: failed to import", { file: i }, e);
|
|
2223
2223
|
continue;
|
|
@@ -2797,7 +2797,7 @@ ${a.join("\n\n")}\n`);
|
|
|
2797
2797
|
for (let a of e) {
|
|
2798
2798
|
let e;
|
|
2799
2799
|
try {
|
|
2800
|
-
e = await
|
|
2800
|
+
e = await x(a);
|
|
2801
2801
|
} catch (e) {
|
|
2802
2802
|
t.warn("webhook: failed to import", { file: a }, e);
|
|
2803
2803
|
continue;
|
|
@@ -3164,7 +3164,7 @@ ${a.join("\n\n")}\n`);
|
|
|
3164
3164
|
typeof e == "function" && i.push($c(a.name, t, e, n));
|
|
3165
3165
|
}
|
|
3166
3166
|
return i;
|
|
3167
|
-
}, tl = `${
|
|
3167
|
+
}, tl = `${ge}/plugins/`, nl = (e) => e.startsWith("/") ? e : `/${e}`, rl = (e) => {
|
|
3168
3168
|
let t = e.indexOf("?");
|
|
3169
3169
|
return t >= 0 ? e.slice(0, t) : e;
|
|
3170
3170
|
}, il = (e, t) => e.kind === "json" ? {
|
|
@@ -3198,20 +3198,20 @@ ${a.join("\n\n")}\n`);
|
|
|
3198
3198
|
async dispatch(e, t, r, i, a) {
|
|
3199
3199
|
let o = rl(e);
|
|
3200
3200
|
if (!o.startsWith(tl)) return null;
|
|
3201
|
-
let s =
|
|
3201
|
+
let s = b(r.origin ?? r.Origin), c = t.toUpperCase();
|
|
3202
3202
|
if (c === "OPTIONS") return {
|
|
3203
3203
|
status: 204,
|
|
3204
3204
|
contentType: "text/plain",
|
|
3205
3205
|
body: "",
|
|
3206
3206
|
headers: s
|
|
3207
3207
|
};
|
|
3208
|
-
if (
|
|
3208
|
+
if (le()) return {
|
|
3209
3209
|
status: 503,
|
|
3210
3210
|
contentType: "application/json; charset=utf-8",
|
|
3211
3211
|
body: JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }),
|
|
3212
3212
|
headers: s
|
|
3213
3213
|
};
|
|
3214
|
-
let l = (a?.authResolver ??
|
|
3214
|
+
let l = (a?.authResolver ?? te)(r);
|
|
3215
3215
|
if (!l.ok) return {
|
|
3216
3216
|
status: 401,
|
|
3217
3217
|
contentType: "application/json; charset=utf-8",
|
|
@@ -3898,24 +3898,24 @@ ${a.join("\n\n")}\n`);
|
|
|
3898
3898
|
for (let t of e) {
|
|
3899
3899
|
let e = C(t);
|
|
3900
3900
|
if (hu.test(e)) {
|
|
3901
|
-
let e = await
|
|
3901
|
+
let e = await x(t);
|
|
3902
3902
|
for (let t of Object.values(e)) Ou(t) && (f.set(t.tableName, t), ju(t) && u.add(t.tableName), Nu(t) && d.add(t.tableName));
|
|
3903
3903
|
Gr(e);
|
|
3904
3904
|
continue;
|
|
3905
3905
|
}
|
|
3906
3906
|
if (gu.test(e)) {
|
|
3907
|
-
Gr(await
|
|
3907
|
+
Gr(await x(t)) === 0 && $.warn("skipping relations file — no relations(...) export found", { file: t });
|
|
3908
3908
|
continue;
|
|
3909
3909
|
}
|
|
3910
3910
|
if (iu.test(e)) {
|
|
3911
|
-
let e = await
|
|
3911
|
+
let e = await x(t), n = Object.values(e).find(wu);
|
|
3912
3912
|
if (!n) {
|
|
3913
3913
|
$.warn("skipping workflow — no workflow(...) export", { file: t });
|
|
3914
3914
|
continue;
|
|
3915
3915
|
}
|
|
3916
3916
|
let r = t.replace(/\.workflow\.tsx$/, ".workflow.server.tsx"), i;
|
|
3917
3917
|
try {
|
|
3918
|
-
i = await
|
|
3918
|
+
i = await x(r);
|
|
3919
3919
|
} catch {
|
|
3920
3920
|
$.warn("skipping workflow — missing paired executor", {
|
|
3921
3921
|
file: t,
|
|
@@ -3937,7 +3937,7 @@ ${a.join("\n\n")}\n`);
|
|
|
3937
3937
|
continue;
|
|
3938
3938
|
}
|
|
3939
3939
|
if (ou.test(e)) {
|
|
3940
|
-
let n = await
|
|
3940
|
+
let n = await x(t), r = n.default ?? Object.values(n).find(Ot);
|
|
3941
3941
|
if (!Ot(r)) {
|
|
3942
3942
|
$.warn("skipping trigger — default export is not triggerWorkflow(...)", { file: t });
|
|
3943
3943
|
continue;
|
|
@@ -3954,7 +3954,7 @@ ${a.join("\n\n")}\n`);
|
|
|
3954
3954
|
continue;
|
|
3955
3955
|
}
|
|
3956
3956
|
if (lu.test(e)) {
|
|
3957
|
-
let e = (await
|
|
3957
|
+
let e = (await x(t)).default;
|
|
3958
3958
|
if (!Dt(e)) {
|
|
3959
3959
|
$.warn("skipping cron — default export is not defineSchedule(...)", { file: t });
|
|
3960
3960
|
continue;
|
|
@@ -3980,7 +3980,7 @@ ${a.join("\n\n")}\n`);
|
|
|
3980
3980
|
}
|
|
3981
3981
|
}
|
|
3982
3982
|
for (let e of p) {
|
|
3983
|
-
let t = await
|
|
3983
|
+
let t = await x(e), o = Object.values(t).find(yu) ?? Object.values(t).find(bu) ?? Object.values(t).find(xu) ?? Object.values(t).find(Su);
|
|
3984
3984
|
if (!o) {
|
|
3985
3985
|
$.warn("skipping procedure descriptor — no defineQuery / defineMutation / defineAction / defineStream export", { file: e });
|
|
3986
3986
|
continue;
|
|
@@ -3993,7 +3993,7 @@ ${a.join("\n\n")}\n`);
|
|
|
3993
3993
|
});
|
|
3994
3994
|
continue;
|
|
3995
3995
|
}
|
|
3996
|
-
let c = (await
|
|
3996
|
+
let c = (await x(s)).default;
|
|
3997
3997
|
if (typeof c != "function") {
|
|
3998
3998
|
$.warn("skipping procedure server executor — missing default export", { file: s });
|
|
3999
3999
|
continue;
|
|
@@ -4048,7 +4048,7 @@ ${a.join("\n\n")}\n`);
|
|
|
4048
4048
|
}, Lu = async (e) => {
|
|
4049
4049
|
let t = T(e, "app.config.ts");
|
|
4050
4050
|
try {
|
|
4051
|
-
let e = (await
|
|
4051
|
+
let e = (await x(t)).default;
|
|
4052
4052
|
return typeof e == "object" && e ? e : null;
|
|
4053
4053
|
} catch {
|
|
4054
4054
|
return null;
|
|
@@ -4152,14 +4152,14 @@ ${a.join("\n\n")}\n`);
|
|
|
4152
4152
|
changeStrategy: r ? "cdc" : "inline",
|
|
4153
4153
|
...u ? { cdcConfig: u } : {}
|
|
4154
4154
|
}), f = Hu();
|
|
4155
|
-
if (f.length === 0) return $.info("read replicas: none configured (DB_REPLICA_URLS unset) — all queries → primary"),
|
|
4155
|
+
if (f.length === 0) return $.info("read replicas: none configured (DB_REPLICA_URLS unset) — all queries → primary"), S.recordReplication({
|
|
4156
4156
|
replicaCount: 0,
|
|
4157
4157
|
rywPolicy: "off",
|
|
4158
4158
|
rywStore: "memory",
|
|
4159
4159
|
region: null,
|
|
4160
4160
|
localityEnabled: !1
|
|
4161
4161
|
}), d;
|
|
4162
|
-
if (Vr(i.id)) return $.warn(`read replicas: not applicable (${i.id} is single-process); ignoring DB_REPLICA_URLS`),
|
|
4162
|
+
if (Vr(i.id)) return $.warn(`read replicas: not applicable (${i.id} is single-process); ignoring DB_REPLICA_URLS`), S.recordReplication({
|
|
4163
4163
|
replicaCount: 0,
|
|
4164
4164
|
rywPolicy: "off",
|
|
4165
4165
|
rywStore: "memory",
|
|
@@ -4167,7 +4167,7 @@ ${a.join("\n\n")}\n`);
|
|
|
4167
4167
|
localityEnabled: !1
|
|
4168
4168
|
}), d;
|
|
4169
4169
|
let p = await Xu(i.id);
|
|
4170
|
-
if (p === null) return $.warn(`read replicas: no replication adapter for dialect ${i.id}; falling back to primary-only routing`),
|
|
4170
|
+
if (p === null) return $.warn(`read replicas: no replication adapter for dialect ${i.id}; falling back to primary-only routing`), S.recordReplication({
|
|
4171
4171
|
replicaCount: 0,
|
|
4172
4172
|
rywPolicy: "off",
|
|
4173
4173
|
rywStore: "memory",
|
|
@@ -4203,7 +4203,7 @@ ${a.join("\n\n")}\n`);
|
|
|
4203
4203
|
replicaRegions: Yu(m, te),
|
|
4204
4204
|
inner: pn()
|
|
4205
4205
|
}) : pn();
|
|
4206
|
-
return $.info(`read replicas: ${m.length} configured, ryw policy '${h}', dialect=${i.id}, region=${ne ?? "unknown"}` + (te.length > 0 ? ", replica-locality=on" : "")),
|
|
4206
|
+
return $.info(`read replicas: ${m.length} configured, ryw policy '${h}', dialect=${i.id}, region=${ne ?? "unknown"}` + (te.length > 0 ? ", replica-locality=on" : "")), S.recordReplication({
|
|
4207
4207
|
replicaCount: m.length,
|
|
4208
4208
|
rywPolicy: h,
|
|
4209
4209
|
rywStore: ee,
|
|
@@ -4252,40 +4252,40 @@ ${a.join("\n\n")}\n`);
|
|
|
4252
4252
|
default: return null;
|
|
4253
4253
|
}
|
|
4254
4254
|
}, Zu = async (e) => {
|
|
4255
|
-
let
|
|
4256
|
-
return
|
|
4257
|
-
}, Qu = async (
|
|
4258
|
-
let
|
|
4259
|
-
await
|
|
4255
|
+
let n = D(e.find((e) => !e.startsWith("-")) ?? process.cwd()), r = await y(n);
|
|
4256
|
+
return r.ran ? r.exitCode : process.env.FRAMEWORK_DEV_INNER !== "1" && process.env.WATCH !== "0" ? (t(cs({ root: n }), { scope: "voltro:dev" }), new Promise(() => {})) : Qu(n);
|
|
4257
|
+
}, Qu = async (t) => {
|
|
4258
|
+
let y = Date.now(), ge = await Lu(t), x = Number(process.env.PORT ?? ge?.port ?? 4e3), w = ge?.name ?? C(t), D = r("api", w, x), Oe = Se(w);
|
|
4259
|
+
await de({
|
|
4260
4260
|
id: D,
|
|
4261
4261
|
name: w,
|
|
4262
4262
|
kind: "api",
|
|
4263
|
-
url: `http://localhost:${
|
|
4263
|
+
url: `http://localhost:${x}`,
|
|
4264
4264
|
pid: process.pid,
|
|
4265
4265
|
status: "booting",
|
|
4266
4266
|
logFile: Oe.path
|
|
4267
4267
|
}).catch(() => {});
|
|
4268
|
-
let O =
|
|
4269
|
-
|
|
4270
|
-
root:
|
|
4268
|
+
let O = a();
|
|
4269
|
+
o(O), $.info("booting voltro dev", {
|
|
4270
|
+
root: t,
|
|
4271
4271
|
version: Kl,
|
|
4272
4272
|
logFile: Oe.path
|
|
4273
4273
|
});
|
|
4274
|
-
let ke = await
|
|
4275
|
-
project: C(
|
|
4274
|
+
let ke = await De({
|
|
4275
|
+
project: C(t),
|
|
4276
4276
|
cliVersion: Kl
|
|
4277
4277
|
});
|
|
4278
4278
|
if (ke.kind === "not-personal") return $.error(`voltro dev needs a personal login — the stored credential belongs to no user.
|
|
4279
4279
|
${ke.message}`), 1;
|
|
4280
4280
|
ke.kind === "reported" && ke.seat === "claimed" && $.info("cloud: this machine now counts toward your organisation's seats (voltro cloud whoami)");
|
|
4281
|
-
let je = process.env.VOLTRO_DEV_HEALTH_PORT, Me = je === void 0 ?
|
|
4281
|
+
let je = process.env.VOLTRO_DEV_HEALTH_PORT, Me = je === void 0 ? x + 1 : Number(je), Ne;
|
|
4282
4282
|
Me > 0 && Number.isFinite(Me) && (Ne = await Wl({
|
|
4283
4283
|
port: Me,
|
|
4284
4284
|
log: {
|
|
4285
4285
|
info: (e, t) => $.debug(e, t),
|
|
4286
4286
|
warn: (e, t) => $.warn(e, t)
|
|
4287
4287
|
}
|
|
4288
|
-
})), n(
|
|
4288
|
+
})), n(t).then((e) => {
|
|
4289
4289
|
for (let t of e.files) if (t.action === "created") {
|
|
4290
4290
|
let e = t.path.split("/").slice(-2).join("/");
|
|
4291
4291
|
$.info(`${e} seeded`, { path: t.path });
|
|
@@ -4293,26 +4293,26 @@ ${a.join("\n\n")}\n`);
|
|
|
4293
4293
|
}).catch((e) => {
|
|
4294
4294
|
$.warn("agent-instructions seed failed (non-fatal)", {}, e);
|
|
4295
4295
|
});
|
|
4296
|
-
let j = await vu(
|
|
4296
|
+
let j = await vu(t);
|
|
4297
4297
|
$.info(`discovered ${j.length} files`, { count: j.length });
|
|
4298
|
-
let { pluginContributions: Ie, pluginErrorImports: Le, pluginRpcImports: Re } = await wl(
|
|
4299
|
-
root:
|
|
4298
|
+
let { pluginContributions: Ie, pluginErrorImports: Le, pluginRpcImports: Re } = await wl(ge?.plugins ?? [], ge?.name ?? C(t), t), ze = await Pa({
|
|
4299
|
+
root: t,
|
|
4300
4300
|
...Ie.length > 0 ? { pluginContributions: Ie } : {},
|
|
4301
4301
|
...Le.length > 0 ? { pluginErrorImports: Le } : {},
|
|
4302
4302
|
...Re.length > 0 ? { pluginRpcImports: Re } : {},
|
|
4303
|
-
...
|
|
4303
|
+
...ge?.name === void 0 ? {} : { apiName: ge.name }
|
|
4304
4304
|
});
|
|
4305
|
-
ze ? ($.info("codegen wrote rpcGroup", { path: E(
|
|
4306
|
-
let He = Wu(
|
|
4305
|
+
ze ? ($.info("codegen wrote rpcGroup", { path: E(t, ze) }), await _a(ze)) : $.debug("codegen skipped — no descriptors discovered");
|
|
4306
|
+
let He = Wu(ge ?? null), M = He === "mariadb" ? "mariadb" : He === "mssql" ? "mssql" : void 0, Ue = M !== void 0 && (process.env.CDC ?? "1") !== "0", { queries: P, mutations: F, actions: I, streams: We, workflows: L, workflowWorkers: Ke, eventTriggers: Je, schedules: Ye, connections: Xe, tables: Ze, featureMix: Qe, tenantScopedTables: $e, softDeleteScopedTables: et } = await Iu(j, { cdc: Ue }), tt = L.length > 0 || Je.length > 0, R = await Lu(t);
|
|
4307
4307
|
Dn(xn(R?.secrets));
|
|
4308
|
-
let nt = Wo(Ln(R?.env) ? R.env : void 0,
|
|
4309
|
-
nt.minted.length > 0 && nt.file !== void 0 && ($.warn(`minted ${nt.minted.length} project secret(s) into ${E(
|
|
4308
|
+
let nt = Wo(Ln(R?.env) ? R.env : void 0, t);
|
|
4309
|
+
nt.minted.length > 0 && nt.file !== void 0 && ($.warn(`minted ${nt.minted.length} project secret(s) into ${E(t, nt.file)} — unique to this project, gitignored. Your DEPLOYMENT needs its own values (\`voltro secret generate\`).`, {
|
|
4310
4310
|
keys: nt.minted,
|
|
4311
|
-
file: E(
|
|
4312
|
-
}),
|
|
4311
|
+
file: E(t, nt.file)
|
|
4312
|
+
}), l.includes(nt.file) || l.unshift(nt.file)), await m({
|
|
4313
4313
|
rawEnv: R?.env,
|
|
4314
4314
|
appType: "api",
|
|
4315
|
-
root:
|
|
4315
|
+
root: t,
|
|
4316
4316
|
log: $,
|
|
4317
4317
|
generateTypes: !0
|
|
4318
4318
|
});
|
|
@@ -4332,7 +4332,7 @@ ${a.join("\n\n")}\n`);
|
|
|
4332
4332
|
for (let e of z) Rr(e);
|
|
4333
4333
|
let Dt = Zc({
|
|
4334
4334
|
plugins: R?.plugins ?? [],
|
|
4335
|
-
appName: R?.name ?? C(
|
|
4335
|
+
appName: R?.name ?? C(t),
|
|
4336
4336
|
appType: "api",
|
|
4337
4337
|
voltroVersion: process.env.npm_package_version ?? "0.0.0",
|
|
4338
4338
|
log: $
|
|
@@ -4434,7 +4434,7 @@ ${a.join("\n\n")}\n`);
|
|
|
4434
4434
|
emailCount: pn,
|
|
4435
4435
|
tenantTables: [...$e]
|
|
4436
4436
|
}), Be({
|
|
4437
|
-
appName: R?.name ?? C(
|
|
4437
|
+
appName: R?.name ?? C(t),
|
|
4438
4438
|
queries: P.map((e) => e.descriptor.name),
|
|
4439
4439
|
mutations: F.map((e) => e.descriptor.name),
|
|
4440
4440
|
actions: I.map((e) => e.descriptor.name),
|
|
@@ -4474,7 +4474,7 @@ ${a.join("\n\n")}\n`);
|
|
|
4474
4474
|
let Pn = Bs({
|
|
4475
4475
|
definitions: Xe.map((e) => e.definition),
|
|
4476
4476
|
store: B,
|
|
4477
|
-
publicUrl: Hs(
|
|
4477
|
+
publicUrl: Hs(x),
|
|
4478
4478
|
log: $.child("connections")
|
|
4479
4479
|
});
|
|
4480
4480
|
P.push(...Pn.queries), F.push(...Pn.mutations), I.push(...Pn.actions);
|
|
@@ -4525,31 +4525,31 @@ ${a.join("\n\n")}\n`);
|
|
|
4525
4525
|
});
|
|
4526
4526
|
let lr = or.dispose, ur = Wu(R), mr;
|
|
4527
4527
|
if (ur !== "memory" && process.env.VOLTRO_AUTO_MIGRATE !== "0") {
|
|
4528
|
-
let e = Date.now(),
|
|
4528
|
+
let e = Date.now(), n = (process.env.NODE_ENV ?? "").toLowerCase() === "production" ? "prod" : (process.env.NODE_ENV ?? "").toLowerCase() === "staging" ? "staging" : "dev";
|
|
4529
4529
|
$.info("auto-migrate: planning schema", {
|
|
4530
4530
|
dialect: ur,
|
|
4531
|
-
env:
|
|
4531
|
+
env: n,
|
|
4532
4532
|
tables: z.length
|
|
4533
4533
|
}), Ne?.set({
|
|
4534
4534
|
phase: "migrating",
|
|
4535
4535
|
tablesTotal: z.length
|
|
4536
4536
|
});
|
|
4537
4537
|
try {
|
|
4538
|
-
let
|
|
4539
|
-
mr =
|
|
4540
|
-
let
|
|
4541
|
-
projectRoot:
|
|
4542
|
-
env:
|
|
4543
|
-
appliedBy: `boot:${
|
|
4544
|
-
})), k.provide(
|
|
4545
|
-
|
|
4538
|
+
let r = await Va(ur), i = r.makeSqlLayer(Ru());
|
|
4539
|
+
mr = i, await zi(ku(z.filter((e) => e.tableName.startsWith("_voltro_") || e.tableName === "voltro_isr_cache"), z), i, r.id);
|
|
4540
|
+
let a = await k.runPromise(V.SqlClient.pipe(k.flatMap((e) => Ri(e, {
|
|
4541
|
+
projectRoot: t,
|
|
4542
|
+
env: n,
|
|
4543
|
+
appliedBy: `boot:${n}`
|
|
4544
|
+
})), k.provide(i)));
|
|
4545
|
+
a.applied.length > 0 && $.info(`file-based migrations: applied ${a.applied.length}`, { applied: a.applied.map((e) => `${e.id} (${e.durationMs}ms)`) });
|
|
4546
4546
|
let o = await k.runPromise(V.SqlClient.pipe(k.flatMap((e) => Bi(e, z, {
|
|
4547
|
-
appliedBy: `boot:${
|
|
4548
|
-
environment:
|
|
4549
|
-
dialectId:
|
|
4550
|
-
})), k.provide(
|
|
4551
|
-
if (o.kind === "refused-blocked" || o.kind === "prod-mismatch") throw $.error(Pi(o,
|
|
4552
|
-
$.info(Pi(o,
|
|
4547
|
+
appliedBy: `boot:${n}`,
|
|
4548
|
+
environment: n,
|
|
4549
|
+
dialectId: r.id
|
|
4550
|
+
})), k.provide(i)));
|
|
4551
|
+
if (o.kind === "refused-blocked" || o.kind === "prod-mismatch") throw $.error(Pi(o, r.id)), Error("auto-migrate refused — see error above");
|
|
4552
|
+
$.info(Pi(o, r.id), { durationMs: Date.now() - e });
|
|
4553
4553
|
} catch (e) {
|
|
4554
4554
|
throw $.error("auto-migrate failed — aborting boot", { err: e }), Ne?.set({
|
|
4555
4555
|
phase: "error",
|
|
@@ -4577,14 +4577,14 @@ ${a.join("\n\n")}\n`);
|
|
|
4577
4577
|
let Dr = $.child("seeds"), Or = j.filter((e) => /\.seed\.ts$/.test(e)), kr = Or.length > 0 ? await ws(Or, Dr) : [];
|
|
4578
4578
|
if (kr.length > 0) {
|
|
4579
4579
|
Dr.info("discovered seeds", { ids: kr.map((e) => e.definition.id) });
|
|
4580
|
-
for (let e of kr)
|
|
4580
|
+
for (let e of kr) S.registerSeed(e);
|
|
4581
4581
|
let e = await ks(kr, B, Dr);
|
|
4582
|
-
for (let t of e)
|
|
4582
|
+
for (let t of e) S.recordSeedResult(t);
|
|
4583
4583
|
let t = e.filter((e) => e.status === "failed");
|
|
4584
4584
|
t.length > 0 && Dr.warn("one or more seeds failed (server continues)", { failedIds: t.map((e) => e.seedId) });
|
|
4585
4585
|
}
|
|
4586
|
-
let Ar = $.child("startup"), jr = j.filter((e) => cu.test(e)), Mr = jr.length > 0 ? await
|
|
4587
|
-
Mr.length > 0 && (Ar.info("discovered startups", { ids: Mr.map((e) => e.id) }), Nr = await
|
|
4586
|
+
let Ar = $.child("startup"), jr = j.filter((e) => cu.test(e)), Mr = jr.length > 0 ? await Ee(jr, Ar) : [], Nr;
|
|
4587
|
+
Mr.length > 0 && (Ar.info("discovered startups", { ids: Mr.map((e) => e.id) }), Nr = await Te(Mr, B, Ar)), Nr && process.on("beforeExit", () => {
|
|
4588
4588
|
Nr.shutdown();
|
|
4589
4589
|
});
|
|
4590
4590
|
let Pr = $.child("subscribe"), Br = j.filter((e) => du.test(e)), Hr = Br.length > 0 ? await Ns(Br, Pr) : [], Wr;
|
|
@@ -5022,14 +5022,14 @@ ${a.join("\n\n")}\n`);
|
|
|
5022
5022
|
}, Oa = (e) => JSON.stringify(e, (e, t) => typeof t == "object" && t && !Array.isArray(t) ? Object.fromEntries(Object.entries(t).sort(([e], [t]) => e.localeCompare(t))) : t), Y = (e, t) => {
|
|
5023
5023
|
let n = e.cache;
|
|
5024
5024
|
if (n === void 0) return;
|
|
5025
|
-
let r =
|
|
5025
|
+
let r = d(n.ttl);
|
|
5026
5026
|
if (r !== null) return {
|
|
5027
5027
|
ttlMs: r,
|
|
5028
|
-
swrMs: n.swr === void 0 ? void 0 :
|
|
5028
|
+
swrMs: n.swr === void 0 ? void 0 : d(n.swr) ?? void 0,
|
|
5029
5029
|
scope: n.scope,
|
|
5030
5030
|
baseKey: `q:${e.name}:${Oa(t)}`
|
|
5031
5031
|
};
|
|
5032
|
-
}, ka =
|
|
5032
|
+
}, ka = ye(), Aa = R?.plugins ?? [], ja = li(el(Aa, "mutation", ka)), Ma = li(el(Aa, "action", ka)), Na = li(el(Aa, "query", ka)), Fa = Jt({
|
|
5033
5033
|
store: B,
|
|
5034
5034
|
buildContext: (e, t, n) => Sa(e, t, n),
|
|
5035
5035
|
runEffect: (e, t) => ya(e, t),
|
|
@@ -5356,31 +5356,31 @@ ${a.join("\n\n")}\n`);
|
|
|
5356
5356
|
}));
|
|
5357
5357
|
e.length > 0 && (i.targets = e);
|
|
5358
5358
|
}
|
|
5359
|
-
let c =
|
|
5359
|
+
let c = ce(e.guards);
|
|
5360
5360
|
c !== void 0 && (i.guards = c), e.publicApi != null && typeof e.publicApi == "object" && (i.publicApi = e.publicApi);
|
|
5361
5361
|
let l = e.exposeAsTool;
|
|
5362
5362
|
return l === !0 ? i.exposeAsTool = { enabled: !0 } : typeof l == "object" && l && (i.exposeAsTool = l), i;
|
|
5363
5363
|
}, ho = [
|
|
5364
|
-
...P.map((e) => po(e.descriptor, "query", E(
|
|
5365
|
-
...F.map((e) => po(e.descriptor, "mutation", E(
|
|
5366
|
-
...I.map((e) => po(e.descriptor, "action", E(
|
|
5364
|
+
...P.map((e) => po(e.descriptor, "query", E(t, e.file))),
|
|
5365
|
+
...F.map((e) => po(e.descriptor, "mutation", E(t, e.file))),
|
|
5366
|
+
...I.map((e) => po(e.descriptor, "action", E(t, e.file))),
|
|
5367
5367
|
...We.map((e) => po({
|
|
5368
5368
|
name: e.descriptor.name,
|
|
5369
5369
|
input: e.descriptor.input,
|
|
5370
5370
|
output: e.descriptor.element,
|
|
5371
5371
|
error: e.descriptor.error
|
|
5372
|
-
}, "stream", E(
|
|
5372
|
+
}, "stream", E(t, e.file)))
|
|
5373
5373
|
], go = L.map((e) => ({
|
|
5374
5374
|
tag: e.definition.name,
|
|
5375
|
-
file: E(
|
|
5375
|
+
file: E(t, e.file)
|
|
5376
5376
|
}));
|
|
5377
|
-
N.writeFile(T(
|
|
5378
|
-
let e = T(
|
|
5377
|
+
N.writeFile(T(t, "app.manifest.generated.json"), `${JSON.stringify(s(ho, go), null, 2)}\n`, "utf8").catch(() => {}), (async () => {
|
|
5378
|
+
let e = T(t, ".gitignore"), n = "";
|
|
5379
5379
|
try {
|
|
5380
|
-
|
|
5380
|
+
n = await N.readFile(e, "utf8");
|
|
5381
5381
|
} catch {}
|
|
5382
|
-
let
|
|
5383
|
-
|
|
5382
|
+
let r = n.split("\n").filter((e) => e.trim() !== "");
|
|
5383
|
+
r.includes("app.manifest.generated.json") || (r.push("app.manifest.generated.json"), await N.writeFile(e, `${r.join("\n")}\n`, "utf8"));
|
|
5384
5384
|
})().catch(() => {});
|
|
5385
5385
|
let _o = /* @__PURE__ */ new Map();
|
|
5386
5386
|
for (let e of F) _o.set(e.descriptor.name, async (t, n) => {
|
|
@@ -5433,14 +5433,14 @@ ${a.join("\n\n")}\n`);
|
|
|
5433
5433
|
});
|
|
5434
5434
|
let vo = () => ({
|
|
5435
5435
|
dialect: U,
|
|
5436
|
-
replication:
|
|
5436
|
+
replication: S.replicationSnapshot() ?? {
|
|
5437
5437
|
replicaCount: 0,
|
|
5438
5438
|
rywPolicy: "off",
|
|
5439
5439
|
rywStore: "memory",
|
|
5440
5440
|
region: null,
|
|
5441
5441
|
localityEnabled: !1
|
|
5442
5442
|
},
|
|
5443
|
-
migrations:
|
|
5443
|
+
migrations: S.migrationsSnapshot().map((e) => ({
|
|
5444
5444
|
id: e.id,
|
|
5445
5445
|
name: e.name,
|
|
5446
5446
|
hash: e.hash,
|
|
@@ -5450,7 +5450,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5450
5450
|
...e.durationMs ? { durationMs: e.durationMs } : {},
|
|
5451
5451
|
...e.lastError ? { lastError: e.lastError } : {}
|
|
5452
5452
|
})),
|
|
5453
|
-
seeds:
|
|
5453
|
+
seeds: S.seedsSnapshot().map((e) => ({
|
|
5454
5454
|
id: e.id,
|
|
5455
5455
|
name: e.name,
|
|
5456
5456
|
lifecycle: e.lifecycle,
|
|
@@ -5541,9 +5541,9 @@ ${a.join("\n\n")}\n`);
|
|
|
5541
5541
|
}, Q = {
|
|
5542
5542
|
kind: "api",
|
|
5543
5543
|
meta: {
|
|
5544
|
-
name: R?.name ?? C(
|
|
5544
|
+
name: R?.name ?? C(t),
|
|
5545
5545
|
voltroVersion: Kl,
|
|
5546
|
-
port:
|
|
5546
|
+
port: x,
|
|
5547
5547
|
mode: "dev",
|
|
5548
5548
|
store: Z,
|
|
5549
5549
|
cdc: so ? "on" : "off"
|
|
@@ -5567,7 +5567,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5567
5567
|
plugins: Dt.snapshot(),
|
|
5568
5568
|
capturedAt: Date.now()
|
|
5569
5569
|
}),
|
|
5570
|
-
env: () =>
|
|
5570
|
+
env: () => re(R?.name ?? C(t), {
|
|
5571
5571
|
contract: Ln(R?.env) ? R.env : void 0,
|
|
5572
5572
|
plugins: R?.plugins ?? []
|
|
5573
5573
|
}),
|
|
@@ -6149,7 +6149,7 @@ ${a.join("\n\n")}\n`);
|
|
|
6149
6149
|
},
|
|
6150
6150
|
runSeed: async (e) => {
|
|
6151
6151
|
let t = await As(kr, e, B, Dr);
|
|
6152
|
-
return
|
|
6152
|
+
return S.recordSeedResult(t), vo();
|
|
6153
6153
|
},
|
|
6154
6154
|
rollbackMigration: async (e) => (Dr.warn("rollbackMigration called but only memory store is wired — no-op"), vo()),
|
|
6155
6155
|
webhooks: async () => {
|
|
@@ -6262,7 +6262,7 @@ ${a.join("\n\n")}\n`);
|
|
|
6262
6262
|
group: pa,
|
|
6263
6263
|
handlersLayer: $a,
|
|
6264
6264
|
httpHandlersLayer: ro,
|
|
6265
|
-
port:
|
|
6265
|
+
port: x,
|
|
6266
6266
|
path: R?.transport?.wsPath ?? "/ws",
|
|
6267
6267
|
...xo ? { pluginHttpInterceptor: xo } : {},
|
|
6268
6268
|
...Mo.length > 0 ? { httpRoutes: Mo } : {},
|
|
@@ -6274,91 +6274,91 @@ ${a.join("\n\n")}\n`);
|
|
|
6274
6274
|
mounts: jt,
|
|
6275
6275
|
capturedAt: Date.now()
|
|
6276
6276
|
}),
|
|
6277
|
-
headers:
|
|
6277
|
+
headers: b(n.origin)
|
|
6278
6278
|
};
|
|
6279
|
-
if (r === "POST" && (t === "/_voltro/inspect/invoke" || t.startsWith("/_voltro/inspect/invoke?"))) return
|
|
6280
|
-
if (r === "POST" && t.startsWith("/_voltro/inspect/webhooks/")) return
|
|
6279
|
+
if (r === "POST" && (t === "/_voltro/inspect/invoke" || t.startsWith("/_voltro/inspect/invoke?"))) return be(Q, n, i ?? "", { method: r });
|
|
6280
|
+
if (r === "POST" && t.startsWith("/_voltro/inspect/webhooks/")) return ie(t, Q, n, i ?? "", { method: r }).then((e) => e ?? {
|
|
6281
6281
|
status: 404,
|
|
6282
6282
|
contentType: "application/json; charset=utf-8",
|
|
6283
6283
|
body: JSON.stringify({ error: "unknown webhook URL" })
|
|
6284
6284
|
});
|
|
6285
6285
|
if (r === "POST" && t.startsWith("/_voltro/inspect/")) {
|
|
6286
|
-
let e =
|
|
6286
|
+
let e = oe(t, Q, n, i ?? "", { method: r });
|
|
6287
6287
|
if (t === "/_voltro/inspect/seeds/run" || t === "/_voltro/inspect/migrations/rollback") return e;
|
|
6288
6288
|
}
|
|
6289
6289
|
if (r === "POST" && t === "/_voltro/inspect/clientLog") return {
|
|
6290
|
-
...
|
|
6291
|
-
headers:
|
|
6290
|
+
...g(i ?? "", O),
|
|
6291
|
+
headers: b(n.origin)
|
|
6292
6292
|
};
|
|
6293
6293
|
if (r === "GET" && (t === "/_voltro/inspect/logs" || t.startsWith("/_voltro/inspect/logs?"))) return {
|
|
6294
|
-
...
|
|
6295
|
-
headers:
|
|
6294
|
+
...we(t, h()),
|
|
6295
|
+
headers: b(n.origin)
|
|
6296
6296
|
};
|
|
6297
6297
|
if (r === "GET" && (t === "/_voltro/inspect/traces" || t.startsWith("/_voltro/inspect/traces?"))) {
|
|
6298
6298
|
let e = bo();
|
|
6299
6299
|
return {
|
|
6300
6300
|
...Hl(t, Z === "postgres" && Eo() ? await Fu(t, e, B) : e),
|
|
6301
|
-
headers:
|
|
6301
|
+
headers: b(n.origin)
|
|
6302
6302
|
};
|
|
6303
6303
|
}
|
|
6304
6304
|
if (r === "GET" && (t === "/_voltro/inspect/data/rows" || t.startsWith("/_voltro/inspect/data/rows?"))) {
|
|
6305
|
-
let e = await
|
|
6305
|
+
let e = await f(t, Q, n, { method: r });
|
|
6306
6306
|
if (e) return e;
|
|
6307
6307
|
}
|
|
6308
6308
|
if (r === "GET" && t.startsWith("/_voltro/inspect/provenance")) {
|
|
6309
|
-
let e = await
|
|
6309
|
+
let e = await pe(t, Q, n, { method: r });
|
|
6310
6310
|
if (e) return e;
|
|
6311
6311
|
}
|
|
6312
6312
|
if ((r === "POST" || r === "PATCH" || r === "DELETE") && t.startsWith("/_voltro/inspect/data/rows")) {
|
|
6313
|
-
let
|
|
6314
|
-
if (
|
|
6313
|
+
let a = await e(t, Q, n, i ?? "", { method: r });
|
|
6314
|
+
if (a) return a;
|
|
6315
6315
|
}
|
|
6316
6316
|
if (r === "POST" && t.startsWith("/_voltro/inspect/data/import")) {
|
|
6317
6317
|
let e = await ne(t, Q, n, i ?? "", { method: r });
|
|
6318
6318
|
if (e) return e;
|
|
6319
6319
|
}
|
|
6320
6320
|
if (r === "GET" && (t === "/_voltro/inspect/workflows/runs" || t.startsWith("/_voltro/inspect/workflows/runs?"))) {
|
|
6321
|
-
let e = await
|
|
6321
|
+
let e = await se(t, Q, n, { method: r });
|
|
6322
6322
|
if (e) return e;
|
|
6323
6323
|
}
|
|
6324
6324
|
if (r === "POST" && t.startsWith("/_voltro/inspect/workflows/start/")) {
|
|
6325
|
-
let e = await
|
|
6325
|
+
let e = await he(t, Q, n, i ?? "", { method: r });
|
|
6326
6326
|
if (e) return e;
|
|
6327
6327
|
}
|
|
6328
6328
|
if (r === "GET" && t.startsWith("/_voltro/inspect/workflows/runs/") && t.endsWith("/steps")) {
|
|
6329
|
-
let e = await
|
|
6329
|
+
let e = await v(t, Q, n, { method: r });
|
|
6330
6330
|
if (e) return e;
|
|
6331
6331
|
}
|
|
6332
6332
|
if (r === "GET" && t.startsWith("/_voltro/inspect/workflows/runs/") && t.endsWith("/events")) {
|
|
6333
|
-
let e = await
|
|
6333
|
+
let e = await xe(t, Q, n, { method: r });
|
|
6334
6334
|
if (e) return e;
|
|
6335
6335
|
}
|
|
6336
6336
|
if (r === "GET" && (t === "/_voltro/inspect/workflows/events" || t.startsWith("/_voltro/inspect/workflows/events?"))) {
|
|
6337
|
-
let e = await
|
|
6337
|
+
let e = await ae(Q, t, n, { method: r });
|
|
6338
6338
|
if (e) return e;
|
|
6339
6339
|
}
|
|
6340
6340
|
if (r === "GET" && t.startsWith("/_voltro/inspect/workflows/events/") && t.endsWith("/deliveries")) {
|
|
6341
|
-
let e = await
|
|
6341
|
+
let e = await fe(Q, t, n, { method: r });
|
|
6342
6342
|
if (e) return e;
|
|
6343
6343
|
}
|
|
6344
6344
|
if (r === "GET" && (t === "/_voltro/inspect/workflows/children" || t.startsWith("/_voltro/inspect/workflows/children?"))) {
|
|
6345
|
-
let e = await
|
|
6345
|
+
let e = await ve(t, Q, n, { method: r });
|
|
6346
6346
|
if (e) return e;
|
|
6347
6347
|
}
|
|
6348
6348
|
if (r === "POST" && t.startsWith("/_voltro/inspect/workflows/runs/") && (t.endsWith("/cancel") || t.endsWith("/retry") || t.endsWith("/suspend") || t.endsWith("/resume") || t.endsWith("/signal"))) {
|
|
6349
|
-
let e = await
|
|
6349
|
+
let e = await me(t, Q, n, i ?? "", { method: r });
|
|
6350
6350
|
if (e) return e;
|
|
6351
6351
|
}
|
|
6352
6352
|
if (t.startsWith("/_voltro/inspect/schedules")) {
|
|
6353
|
-
let e = await
|
|
6353
|
+
let e = await ue(t, Q, n, { method: r });
|
|
6354
6354
|
if (e) return e;
|
|
6355
6355
|
}
|
|
6356
6356
|
if (t === "/_voltro/inspect/cluster" || t.startsWith("/_voltro/inspect/cluster?")) {
|
|
6357
|
-
let e = await
|
|
6357
|
+
let e = await ee(t, Q, n, { method: r });
|
|
6358
6358
|
if (e) return e;
|
|
6359
6359
|
}
|
|
6360
6360
|
if (t.startsWith("/_voltro/inspect/aggregates")) {
|
|
6361
|
-
let e = await bc(t, r, $r.registry,
|
|
6361
|
+
let e = await bc(t, r, $r.registry, b(n.origin));
|
|
6362
6362
|
if (e) return e;
|
|
6363
6363
|
}
|
|
6364
6364
|
if (t.startsWith("/_voltro/inspect/timeline")) {
|
|
@@ -6370,14 +6370,14 @@ ${a.join("\n\n")}\n`);
|
|
|
6370
6370
|
limit: 500,
|
|
6371
6371
|
count: "none"
|
|
6372
6372
|
})).rows
|
|
6373
|
-
},
|
|
6373
|
+
}, b(n.origin));
|
|
6374
6374
|
if (e) return e;
|
|
6375
6375
|
}
|
|
6376
6376
|
if (t.startsWith("/_voltro/inspect/analytics")) {
|
|
6377
6377
|
let e = wc(t, r, {
|
|
6378
6378
|
sink: sr,
|
|
6379
6379
|
metricsCollector: ka
|
|
6380
|
-
},
|
|
6380
|
+
}, b(n.origin));
|
|
6381
6381
|
if (e) return e;
|
|
6382
6382
|
}
|
|
6383
6383
|
if (r === "GET" && (t === "/_voltro/inspect/webhooks" || t.startsWith("/_voltro/inspect/webhooks?"))) return Q.webhooks === void 0 ? {
|
|
@@ -6389,26 +6389,26 @@ ${a.join("\n\n")}\n`);
|
|
|
6389
6389
|
targets: [],
|
|
6390
6390
|
deliveries: []
|
|
6391
6391
|
}),
|
|
6392
|
-
headers:
|
|
6392
|
+
headers: b(n.origin)
|
|
6393
6393
|
} : Q.webhooks().then((e) => ({
|
|
6394
6394
|
status: 200,
|
|
6395
6395
|
contentType: "application/json; charset=utf-8",
|
|
6396
6396
|
body: JSON.stringify(e),
|
|
6397
|
-
headers:
|
|
6397
|
+
headers: b(n.origin)
|
|
6398
6398
|
}));
|
|
6399
6399
|
if (t.startsWith("/_voltro/inspect/plugins/")) {
|
|
6400
6400
|
let e = await kt.dispatch(t, r, n, i ?? "");
|
|
6401
6401
|
if (e) return e;
|
|
6402
6402
|
}
|
|
6403
|
-
return
|
|
6403
|
+
return _e(t, Q, n, { method: r });
|
|
6404
6404
|
} },
|
|
6405
6405
|
inspectStream: {
|
|
6406
|
-
authorize: (e) =>
|
|
6407
|
-
isDisabled: () =>
|
|
6408
|
-
replay: () => O.buffered().map(
|
|
6409
|
-
subscribe: (e) => O.subscribe((t) => e(
|
|
6410
|
-
corsHeaders: (e) =>
|
|
6411
|
-
keepAlive: () =>
|
|
6406
|
+
authorize: (e) => te(e),
|
|
6407
|
+
isDisabled: () => le(),
|
|
6408
|
+
replay: () => O.buffered().map(_),
|
|
6409
|
+
subscribe: (e) => O.subscribe((t) => e(_(t))),
|
|
6410
|
+
corsHeaders: (e) => b(e),
|
|
6411
|
+
keepAlive: () => c()
|
|
6412
6412
|
},
|
|
6413
6413
|
webhookRoutes: new Map(Array.from(Hi.entries()).map(([e, t]) => [e, { handle: t }])),
|
|
6414
6414
|
...Nn ? { tracerLayer: Nn } : {}
|
|
@@ -6416,61 +6416,61 @@ ${a.join("\n\n")}\n`);
|
|
|
6416
6416
|
try {
|
|
6417
6417
|
await dt(No);
|
|
6418
6418
|
} catch (e) {
|
|
6419
|
-
$.error(`rpc server failed to bind on port ${
|
|
6419
|
+
$.error(`rpc server failed to bind on port ${x} — aborting boot`, { port: x }, e), process.exit(1);
|
|
6420
6420
|
}
|
|
6421
|
-
$.info(`listening on http://localhost:${
|
|
6422
|
-
port:
|
|
6423
|
-
ws: `ws://localhost:${
|
|
6421
|
+
$.info(`listening on http://localhost:${x}`, {
|
|
6422
|
+
port: x,
|
|
6423
|
+
ws: `ws://localhost:${x}/ws`,
|
|
6424
6424
|
store: Z
|
|
6425
6425
|
}), Ne?.set({ phase: "ready" }), Z === "postgres" && $.info("postgres change-data-capture", { enabled: (process.env.CDC ?? "1") !== "0" }), await Ca();
|
|
6426
6426
|
try {
|
|
6427
|
-
await
|
|
6427
|
+
await de({
|
|
6428
6428
|
id: D,
|
|
6429
6429
|
name: w,
|
|
6430
6430
|
kind: "api",
|
|
6431
|
-
url: `http://localhost:${
|
|
6431
|
+
url: `http://localhost:${x}`,
|
|
6432
6432
|
pid: process.pid,
|
|
6433
6433
|
status: "live",
|
|
6434
6434
|
logFile: Oe.path
|
|
6435
6435
|
});
|
|
6436
|
-
let e =
|
|
6436
|
+
let e = p(t);
|
|
6437
6437
|
if (e) {
|
|
6438
|
-
let t = await
|
|
6438
|
+
let t = await Ce({ dashboardAppPath: e });
|
|
6439
6439
|
t.status === "launched" ? $.info(`dashboard launched at http://localhost:${t.port}`, { port: t.port }) : t.status === "already-running" && $.debug(`dashboard already running on :${t.port}`, { port: t.port });
|
|
6440
6440
|
}
|
|
6441
6441
|
setInterval(() => {
|
|
6442
|
-
|
|
6442
|
+
de({
|
|
6443
6443
|
id: D,
|
|
6444
6444
|
name: w,
|
|
6445
6445
|
kind: "api",
|
|
6446
|
-
url: `http://localhost:${
|
|
6446
|
+
url: `http://localhost:${x}`,
|
|
6447
6447
|
pid: process.pid,
|
|
6448
6448
|
status: "live",
|
|
6449
6449
|
logFile: Oe.path
|
|
6450
6450
|
}).catch(() => {});
|
|
6451
6451
|
}, 1e4).unref();
|
|
6452
|
-
let
|
|
6452
|
+
let n = async () => {
|
|
6453
6453
|
Dt.deactivate();
|
|
6454
6454
|
for (let e of Hn) e.stop();
|
|
6455
|
-
zn?.dispose(),
|
|
6455
|
+
zn?.dispose(), u(D), Oe.dispose(), Zn(), Wn?.close(), await lr();
|
|
6456
6456
|
};
|
|
6457
6457
|
process.on("SIGINT", () => {
|
|
6458
|
-
|
|
6458
|
+
n();
|
|
6459
6459
|
}), process.on("SIGTERM", () => {
|
|
6460
|
-
|
|
6460
|
+
n();
|
|
6461
6461
|
});
|
|
6462
|
-
let
|
|
6463
|
-
if (
|
|
6462
|
+
let r = process.ppid;
|
|
6463
|
+
if (r > 1) {
|
|
6464
6464
|
let e = setInterval(() => {
|
|
6465
|
-
(process.ppid !==
|
|
6465
|
+
(process.ppid !== r || process.ppid === 1) && (clearInterval(e), n().finally(() => process.exit(0)));
|
|
6466
6466
|
}, 2e3);
|
|
6467
6467
|
e.unref();
|
|
6468
6468
|
}
|
|
6469
6469
|
} catch (e) {
|
|
6470
6470
|
$.warn("runtime-registry write failed", {}, e);
|
|
6471
6471
|
}
|
|
6472
|
-
return
|
|
6473
|
-
root:
|
|
6472
|
+
return i(l, $, {
|
|
6473
|
+
root: t,
|
|
6474
6474
|
onBeforeRestart: () => {
|
|
6475
6475
|
try {
|
|
6476
6476
|
No.closeAllConnections?.();
|
|
@@ -6480,12 +6480,12 @@ ${a.join("\n\n")}\n`);
|
|
|
6480
6480
|
}), Ve({
|
|
6481
6481
|
app: w,
|
|
6482
6482
|
kind: "api",
|
|
6483
|
-
url: `http://localhost:${
|
|
6483
|
+
url: `http://localhost:${x}`,
|
|
6484
6484
|
extras: [{
|
|
6485
6485
|
label: "WS",
|
|
6486
|
-
url: `ws://localhost:${
|
|
6486
|
+
url: `ws://localhost:${x}/ws`
|
|
6487
6487
|
}],
|
|
6488
|
-
bootMs: Date.now() -
|
|
6488
|
+
bootMs: Date.now() - y
|
|
6489
6489
|
}), new Promise(() => {});
|
|
6490
6490
|
};
|
|
6491
6491
|
//#endregion
|