@voltro/cli 0.45.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +206 -0
- package/dist/apiBuild-BsooZpw2.js +2 -0
- package/dist/{apiBuild-CDQBNRDx.js → apiBuild-FpHCWiv6.js} +2 -2
- package/dist/bin.d.ts +8 -0
- package/dist/bin.js +1 -1
- package/dist/{build-yvsLG77U.js → build-zVygXxGB.js} +8 -8
- package/dist/{checkCommand-lrzwOzV1.js → checkCommand-B2Fw73lu.js} +1 -1
- package/dist/{checkCommand-Boxov8lr.js → checkCommand-D0dAKciE.js} +4 -4
- package/dist/{codegen-sbN1Y8PB.js → codegen-CrMXs4hb.js} +176 -162
- package/dist/codegen-DiMn2KkZ.js +2 -0
- package/dist/{codegenCommand-CQOLytL-.js → codegenCommand-BTtsnRus.js} +16 -16
- package/dist/{codemodRunner-5ZhDH3rB.js → codemodRunner-DSZjgyCL.js} +8 -0
- package/dist/{commands-CEkVoFM5.js → commands-BrFKxnYW.js} +24 -24
- package/dist/{dashboardCommand-0ahyp-zA.js → dashboardCommand-D9SjDc8E.js} +3 -3
- package/dist/{dataCommand-D4IlZcih.js → dataCommand-Dl11q14e.js} +271 -230
- package/dist/dbCommand-BUD4Fd8v.js +2 -0
- package/dist/{dbCommand-B237qI-j.js → dbCommand-jbrmzwW_.js} +110 -110
- package/dist/{dev-P4HyeY9W.js → dev-CaIfZnw5.js} +1 -1
- package/dist/{dev-DAM5CnAa.js → dev-RjB7eE_B.js} +2081 -2058
- package/dist/devActivity.d.ts +8 -0
- package/dist/doctorCommand-5zv6PN-G.js +2 -0
- package/dist/{doctorCommand-DW2cwAvC.js → doctorCommand-D7X29cw6.js} +16 -16
- package/dist/{doctorSourceRelations-CPjSwYuZ.js → doctorSourceRelations-Dd48LPvO.js} +15 -10
- package/dist/{dormancyCommand-BqQz7lbM.js → dormancyCommand-BGOP27fz.js} +1 -1
- package/dist/{embeddingsCommand-DJyArpU4.js → embeddingsCommand-D72E22bw.js} +1 -1
- package/dist/{envCommand-CviRZx1L.js → envCommand-BHSxz6wC.js} +2 -2
- package/dist/{evalCommand-6RUfPen4.js → evalCommand-Db01Kbng.js} +24 -24
- package/dist/{evolveCommand-qdlP-R9G.js → evolveCommand-C2ofGGlz.js} +2 -2
- package/dist/{frameworkTableAssembly-oMPBKqlE.js → frameworkTableAssembly-BvZ0Lil_.js} +97 -89
- package/dist/frameworkTableAssembly-DDKtwsy2.js +2 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +1 -1
- package/dist/{infoCommand-CNWPSUcW.js → infoCommand-CuNl9cbh.js} +1 -1
- package/dist/inspectState.d.ts +8 -0
- package/dist/interruptedReplace-C1ZI84xi.js +27 -0
- package/dist/interruptedReplace-DNJ7MKph.js +2 -0
- package/dist/{migrate-DN47p2PG.js → migrate-odCPGHPq.js} +27 -27
- package/dist/{runtimeTrace-BDZSt9W_.js → runtimeTrace-C_OKr0jY.js} +1 -1
- package/dist/{sdkgen-sNaD3oZB.js → sdkgen-D9trW7sl.js} +1 -1
- package/dist/{seedRunner-IdHEprqf.js → seedRunner-Dgsiwk_e.js} +59 -59
- package/dist/serveCommand-BU0wfV6V.js +1931 -0
- package/dist/serveCommand-Bwrn_9Fn.js +2 -0
- package/dist/serveEntry.d.ts +8 -0
- package/dist/serveEntry.js +1 -1
- package/dist/{start-Ds3xyn8R.js → start-7HcSIKEp.js} +1 -1
- package/dist/{start-BAlGcjF5.js → start-DvlYDyAr.js} +1 -1
- package/dist/startEntry.d.ts +8 -0
- package/dist/startEntry.js +1 -1
- package/dist/startup.d.ts +8 -0
- package/dist/{test-CHb7UwvE.js → test-rXFq4S76.js} +1 -1
- package/dist/{updateCommand-rCnhaj84.js → updateCommand-BlyXavoG.js} +1 -1
- package/dist/updateCommand-CT5AvVg7.js +2 -0
- package/dist/{webDev-101csg6Q.js → webDev-B4IEMB0n.js} +6 -6
- package/dist/webDev-B79ji8M5.js +2 -0
- package/dist/{webhooksCommand-C0iZZfaI.js → webhooksCommand-BqcWcbuW.js} +1 -1
- package/package.json +23 -17
- package/templates/AGENTS.md +1 -1
- package/templates/agent-docs/_index.md +1 -1
- package/templates/agent-docs/cli.md +166 -2
- package/templates/agent-docs/data.md +70 -4
- package/templates/agent-docs/whats-new.md +14 -87
- 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-sqlite/package.json +8 -8
- package/templates/apps/api-backend-storage/package.json +8 -8
- package/templates/apps/api-cms/package.json +10 -10
- package/templates/apps/api-collab/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-saas-starter/package.json +10 -10
- package/templates/apps/api-search/package.json +8 -8
- package/templates/apps/api-status/package.json +8 -8
- package/templates/apps/api-versioning/package.json +8 -8
- package/templates/apps/api-webhooks/package.json +9 -9
- 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 +9 -9
- package/templates/apps/frontend-auth/package.json +8 -8
- package/templates/apps/frontend-blank/package.json +7 -7
- package/templates/apps/frontend-cms/package.json +9 -9
- package/templates/apps/frontend-collab/package.json +10 -10
- 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-portal/package.json +8 -8
- package/templates/apps/frontend-saas/package.json +8 -8
- 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/templates/apps/frontend-status/package.json +8 -8
- package/templates/apps/mobile-app/package.json +4 -4
- package/dist/apiBuild-yJCqJYQ8.js +0 -2
- package/dist/codegen-DcE2li1i.js +0 -2
- package/dist/dbCommand-BvQeKQOb.js +0 -2
- package/dist/doctorCommand-2K1dIzYk.js +0 -2
- package/dist/frameworkTableAssembly-DgylYh9_.js +0 -2
- package/dist/serveCommand-BBhT2U94.js +0 -1885
- package/dist/serveCommand-DY2jLy0o.js +0 -2
- package/dist/updateCommand-BH6EGuCc.js +0 -2
- package/dist/webDev-BLKBO34K.js +0 -2
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { dirname as
|
|
3
|
-
import { promises as
|
|
4
|
-
import { pathToFileURL as
|
|
5
|
-
import { isEventDescriptor as
|
|
6
|
-
import { undoSurfaceEnabled as
|
|
7
|
-
import { createHash as
|
|
8
|
-
import { isAgentDescriptor as
|
|
1
|
+
import { b as e, o as t, y as n } from "./fileConventions-Cof68_BL.js";
|
|
2
|
+
import { dirname as r, join as i, relative as a, resolve as o } from "node:path";
|
|
3
|
+
import { promises as s, readFileSync as c } from "node:fs";
|
|
4
|
+
import { pathToFileURL as l } from "node:url";
|
|
5
|
+
import { isEventDescriptor as u, isWireReachable as d } from "@voltro/protocol";
|
|
6
|
+
import { undoSurfaceEnabled as f } from "@voltro/runtime";
|
|
7
|
+
import { createHash as p } from "node:crypto";
|
|
8
|
+
import { isAgentDescriptor as m } from "@voltro/ai/agent";
|
|
9
9
|
//#region src/browserSafetyGuard.ts
|
|
10
|
-
var
|
|
10
|
+
var h = /* @__PURE__ */ new Set(/* @__PURE__ */ "crypto.fs.path.os.net.http.https.http2.tls.dns.dgram.stream.zlib.child_process.worker_threads.cluster.readline.vm.module.perf_hooks.async_hooks.inspector.v8.process.tty.repl.constants.sys.string_decoder".split(".")), g = (e) => e.startsWith("node:") || h.has(e) || e === "@voltro/workflow" ? !0 : e === "@voltro/database/wire" ? !1 : e === "@voltro/database" || e.startsWith("@voltro/database/") || e === "@voltro/runtime" || e.startsWith("@voltro/runtime/") ? !0 : e === "@voltro/ai/agent" || e === "@voltro/ai/events" ? !1 : !!(e === "@voltro/ai" || e.startsWith("@voltro/ai/") || [
|
|
11
11
|
"@voltro/protocol/session",
|
|
12
12
|
"@voltro/protocol/jwt",
|
|
13
13
|
"@voltro/protocol/apikey"
|
|
@@ -26,8 +26,8 @@ var p = /* @__PURE__ */ new Set(/* @__PURE__ */ "crypto.fs.path.os.net.http.http
|
|
|
26
26
|
"@prisma/client",
|
|
27
27
|
"nodemailer",
|
|
28
28
|
"jose"
|
|
29
|
-
].includes(e)),
|
|
30
|
-
let t =
|
|
29
|
+
].includes(e)), _ = (e) => e.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/(^|[^:])\/\/[^\n]*/g, "$1"), v = (e) => {
|
|
30
|
+
let t = _(e), n = [], r = /(?:^|[\n;}])\s*(?:import|export)\s+([^;'"]*?)\s+from\s+['"]([^'"]+)['"]/g, i;
|
|
31
31
|
for (; (i = r.exec(t)) !== null;) {
|
|
32
32
|
let e = i[1].trim();
|
|
33
33
|
if (e === "type" || e.startsWith("type ")) continue;
|
|
@@ -43,29 +43,29 @@ var p = /* @__PURE__ */ new Set(/* @__PURE__ */ "crypto.fs.path.os.net.http.http
|
|
|
43
43
|
let o = /\bimport\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
44
44
|
for (; (i = o.exec(t)) !== null;) n.push(i[1]);
|
|
45
45
|
return n;
|
|
46
|
-
},
|
|
47
|
-
let t =
|
|
46
|
+
}, y = (e) => e.endsWith(".ts") || e.endsWith(".tsx"), b = async (e) => {
|
|
47
|
+
let t = y(e) ? [e] : [
|
|
48
48
|
`${e}.ts`,
|
|
49
49
|
`${e}.tsx`,
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
i(e, "index.ts"),
|
|
51
|
+
i(e, "index.tsx")
|
|
52
52
|
];
|
|
53
53
|
for (let e of t) try {
|
|
54
|
-
if ((await
|
|
54
|
+
if ((await s.stat(e)).isFile()) return e;
|
|
55
55
|
} catch {}
|
|
56
56
|
return null;
|
|
57
|
-
},
|
|
58
|
-
let
|
|
57
|
+
}, x = async (e, t) => {
|
|
58
|
+
let n = t;
|
|
59
59
|
for (;;) {
|
|
60
|
-
let
|
|
60
|
+
let t = i(n, "node_modules", e);
|
|
61
61
|
try {
|
|
62
|
-
if ((await
|
|
62
|
+
if ((await s.stat(t)).isDirectory()) return t;
|
|
63
63
|
} catch {}
|
|
64
|
-
let
|
|
65
|
-
if (
|
|
66
|
-
|
|
64
|
+
let a = r(n);
|
|
65
|
+
if (a === n) return null;
|
|
66
|
+
n = a;
|
|
67
67
|
}
|
|
68
|
-
},
|
|
68
|
+
}, S = (e) => {
|
|
69
69
|
if (typeof e == "string") return e;
|
|
70
70
|
if (typeof e == "object" && e) {
|
|
71
71
|
let t = e;
|
|
@@ -75,65 +75,65 @@ var p = /* @__PURE__ */ new Set(/* @__PURE__ */ "crypto.fs.path.os.net.http.http
|
|
|
75
75
|
"node",
|
|
76
76
|
"default"
|
|
77
77
|
]) if (e in t) {
|
|
78
|
-
let n =
|
|
78
|
+
let n = S(t[e]);
|
|
79
79
|
if (n !== void 0) return n;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
},
|
|
83
|
-
if (e.startsWith(".")) return
|
|
84
|
-
let
|
|
82
|
+
}, C = async (e, t) => {
|
|
83
|
+
if (e.startsWith(".")) return b(o(r(t), e));
|
|
84
|
+
let n = e.split("/"), a = e.startsWith("@"), c = a ? `${n[0]}/${n[1]}` : n[0], l = a ? n.slice(2) : n.slice(1), u = l.length > 0 ? `./${l.join("/")}` : ".", d = await x(c, r(t));
|
|
85
85
|
if (!d) return null;
|
|
86
86
|
try {
|
|
87
|
-
let e = JSON.parse(await
|
|
88
|
-
if (typeof t == "string") return
|
|
87
|
+
let e = JSON.parse(await s.readFile(i(d, "package.json"), "utf8")), t = S(e.exports?.[u]) ?? (u === "." ? e.module ?? e.main : void 0);
|
|
88
|
+
if (typeof t == "string") return b(o(d, t));
|
|
89
89
|
} catch {}
|
|
90
90
|
return null;
|
|
91
|
-
},
|
|
91
|
+
}, w = (e, t) => e.startsWith(t) ? e.slice(t.length).replace(/^[/\\]/, "") : e, T = async (e, t) => {
|
|
92
92
|
let n = /* @__PURE__ */ new Set(), r = [{
|
|
93
93
|
file: e,
|
|
94
|
-
chain: [
|
|
94
|
+
chain: [w(e, t)]
|
|
95
95
|
}];
|
|
96
96
|
for (; r.length > 0;) {
|
|
97
97
|
let { file: e, chain: i } = r.shift();
|
|
98
98
|
if (n.has(e)) continue;
|
|
99
99
|
n.add(e);
|
|
100
|
-
let
|
|
100
|
+
let a;
|
|
101
101
|
try {
|
|
102
|
-
|
|
102
|
+
a = await s.readFile(e, "utf8");
|
|
103
103
|
} catch {
|
|
104
104
|
continue;
|
|
105
105
|
}
|
|
106
|
-
for (let
|
|
107
|
-
if (
|
|
108
|
-
specifier:
|
|
109
|
-
chain: [...i,
|
|
106
|
+
for (let o of v(a)) {
|
|
107
|
+
if (g(o)) return {
|
|
108
|
+
specifier: o,
|
|
109
|
+
chain: [...i, o]
|
|
110
110
|
};
|
|
111
|
-
let
|
|
112
|
-
|
|
113
|
-
file:
|
|
114
|
-
chain: [...i, `${
|
|
111
|
+
let a = await C(o, e);
|
|
112
|
+
a && !n.has(a) && r.push({
|
|
113
|
+
file: a,
|
|
114
|
+
chain: [...i, `${o} (${w(a, t)})`]
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
return null;
|
|
119
|
-
},
|
|
119
|
+
}, E = /\.client\.tsx?$/, D = async (e, t) => {
|
|
120
120
|
let n = [];
|
|
121
121
|
for (let r of t) {
|
|
122
|
-
if (!
|
|
123
|
-
let t = await
|
|
122
|
+
if (!E.test(r)) continue;
|
|
123
|
+
let t = await T(r, e);
|
|
124
124
|
t !== null && n.push({
|
|
125
|
-
file:
|
|
125
|
+
file: w(r, e),
|
|
126
126
|
violation: t
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
return n;
|
|
130
|
-
},
|
|
130
|
+
}, O = (e) => `browser-safety violation — ${e.file} declares itself browser-safe (.client.ts) and is not.\n\n '${e.violation.specifier}' is server-only (node:* / database / ai / cluster / protocol session / db driver).\n\n import chain:\n → ${e.violation.chain.join("\n → ")}\n\n The .client suffix is a claim the framework checks, not a hint. Either move the server-only\n code behind a *.server.ts and keep this file pure, or drop the suffix — an unmarked file\n makes no claim, and only the rpcGroup guard will judge it (later, and with a longer chain).`, k = async (e) => {
|
|
131
131
|
if (process.env.VOLTRO_BROWSER_SAFETY === "off") return;
|
|
132
|
-
let
|
|
133
|
-
if (!
|
|
134
|
-
let
|
|
135
|
-
throw Error(`browser-safety violation — the generated rpcGroup pulls a SERVER-ONLY module into the client bundle.\n\n '${
|
|
136
|
-
},
|
|
132
|
+
let t = await T(e, r(e));
|
|
133
|
+
if (!t) return;
|
|
134
|
+
let n = t.chain.join("\n → ");
|
|
135
|
+
throw Error(`browser-safety violation — the generated rpcGroup pulls a SERVER-ONLY module into the client bundle.\n\n '${t.specifier}' is server-only (node:* / database / ai / cluster / protocol session / db driver),\n and the web client loads rpcGroup VALUE-LEVEL — this crashes the browser with\n "Module …node:crypto… has been externalized for browser compatibility", or bloats the\n bundle with the whole server graph.\n\n import chain:\n → ${n}\n\n Fix: keep the descriptor (*.query/.mutation/.action.ts), the workflow descriptor\n (*.workflow.tsx, import from @voltro/workflow/define), AND any plugin error schema\n browser-safe. Move DB-backed / node: code behind a *.server.ts file or a browser-safe\n subpath (e.g. a plugin's '/errors' export). Escape hatch (not recommended):\n VOLTRO_BROWSER_SAFETY=off.`);
|
|
136
|
+
}, A = /\.(query|mutation|action|stream)\.ts$/, j = /\.(query|mutation|action|stream)\.server\.ts$/, M = /\.workflow\.tsx$/, N = /(?<!\.server)\.agent\.tsx?$/, P = /\.connection\.tsx?$/, F = /* @__PURE__ */ new Set([
|
|
137
137
|
"node_modules",
|
|
138
138
|
"dist",
|
|
139
139
|
"build",
|
|
@@ -141,29 +141,43 @@ var p = /* @__PURE__ */ new Set(/* @__PURE__ */ "crypto.fs.path.os.net.http.http
|
|
|
141
141
|
".vite",
|
|
142
142
|
".next",
|
|
143
143
|
".git"
|
|
144
|
-
]),
|
|
144
|
+
]), I = async (e) => {
|
|
145
145
|
let t = async (e) => {
|
|
146
|
-
let
|
|
147
|
-
for (let
|
|
148
|
-
if (
|
|
149
|
-
if (await t(
|
|
150
|
-
} else if (
|
|
146
|
+
let n = await s.readdir(e, { withFileTypes: !0 }).catch(() => []);
|
|
147
|
+
for (let r of n) if (!F.has(r.name)) {
|
|
148
|
+
if (r.isDirectory()) {
|
|
149
|
+
if (await t(i(e, r.name))) return !0;
|
|
150
|
+
} else if (r.isFile() && P.test(r.name)) return !0;
|
|
151
151
|
}
|
|
152
152
|
return !1;
|
|
153
153
|
};
|
|
154
154
|
return t(e);
|
|
155
|
-
},
|
|
156
|
-
let r = [],
|
|
157
|
-
let o = await
|
|
158
|
-
for (let
|
|
159
|
-
if (
|
|
160
|
-
let o =
|
|
161
|
-
|
|
155
|
+
}, L = async (t) => {
|
|
156
|
+
let r = [], a = async (t) => {
|
|
157
|
+
let o = await s.readdir(t, { withFileTypes: !0 });
|
|
158
|
+
for (let s of o) {
|
|
159
|
+
if (F.has(s.name)) continue;
|
|
160
|
+
let o = i(t, s.name);
|
|
161
|
+
if (s.isDirectory()) {
|
|
162
|
+
await a(o);
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
s.isFile() && (e.test(s.name) || n.test(s.name)) && r.push(o);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
return await a(t), r;
|
|
169
|
+
}, R = async (e) => {
|
|
170
|
+
let n = [], r = async (e) => {
|
|
171
|
+
let a = await s.readdir(e, { withFileTypes: !0 });
|
|
172
|
+
for (let o of a) {
|
|
173
|
+
if (F.has(o.name)) continue;
|
|
174
|
+
let a = i(e, o.name);
|
|
175
|
+
o.isDirectory() ? await r(a) : o.isFile() && (A.test(o.name) && !j.test(o.name) || M.test(o.name) || N.test(o.name) || t.test(o.name)) && n.push(a);
|
|
162
176
|
}
|
|
163
177
|
};
|
|
164
|
-
return await
|
|
165
|
-
},
|
|
166
|
-
let t = [], n = await
|
|
178
|
+
return await r(e), n;
|
|
179
|
+
}, z = (e) => typeof e == "object" && !!e && "kind" in e && "name" in e && (e.kind === "query" || e.kind === "mutation" || e.kind === "action" || e.kind === "stream"), B = Symbol.for("@effect/workflow/Workflow"), V = (e) => typeof e == "object" && !!e && B in e && "name" in e && typeof e.name == "string", H = async (e) => Promise.all(e.map((e) => import(l(e).href))), U = async (e) => {
|
|
180
|
+
let t = [], n = await H(e);
|
|
167
181
|
for (let [r, i] of e.entries()) {
|
|
168
182
|
let e = n[r], a = /* @__PURE__ */ new Set();
|
|
169
183
|
for (let [n, r] of Object.entries(e)) {
|
|
@@ -171,8 +185,8 @@ var p = /* @__PURE__ */ new Set(/* @__PURE__ */ "crypto.fs.path.os.net.http.http
|
|
|
171
185
|
if (a.has(r)) continue;
|
|
172
186
|
a.add(r);
|
|
173
187
|
}
|
|
174
|
-
if (
|
|
175
|
-
if (!
|
|
188
|
+
if (z(r)) {
|
|
189
|
+
if (!d(r)) continue;
|
|
176
190
|
t.push({
|
|
177
191
|
file: i,
|
|
178
192
|
exportName: n,
|
|
@@ -180,12 +194,12 @@ var p = /* @__PURE__ */ new Set(/* @__PURE__ */ "crypto.fs.path.os.net.http.http
|
|
|
180
194
|
kind: r.kind,
|
|
181
195
|
...r.requiresApproval == null ? {} : { requiresApproval: !0 }
|
|
182
196
|
});
|
|
183
|
-
} else
|
|
197
|
+
} else u(r) ? t.push({
|
|
184
198
|
file: i,
|
|
185
199
|
exportName: n,
|
|
186
200
|
rpcTag: r.name,
|
|
187
201
|
kind: "event"
|
|
188
|
-
}) :
|
|
202
|
+
}) : V(r) && t.push({
|
|
189
203
|
file: i,
|
|
190
204
|
exportName: n,
|
|
191
205
|
rpcTag: r.name,
|
|
@@ -194,36 +208,36 @@ var p = /* @__PURE__ */ new Set(/* @__PURE__ */ "crypto.fs.path.os.net.http.http
|
|
|
194
208
|
}
|
|
195
209
|
}
|
|
196
210
|
return t;
|
|
197
|
-
},
|
|
198
|
-
let t = [], n = e.filter((e) =>
|
|
199
|
-
for (let [e, i] of n.entries()) for (let [n, a] of Object.entries(r[e]))
|
|
211
|
+
}, W = async (e) => {
|
|
212
|
+
let t = [], n = e.filter((e) => N.test(e)), r = await H(n);
|
|
213
|
+
for (let [e, i] of n.entries()) for (let [n, a] of Object.entries(r[e])) m(a) && t.push({
|
|
200
214
|
file: i,
|
|
201
215
|
exportName: n,
|
|
202
216
|
name: a.name
|
|
203
217
|
});
|
|
204
218
|
return t;
|
|
205
|
-
},
|
|
219
|
+
}, G = (e) => {
|
|
206
220
|
let t = (e, t) => e.split(/[^a-zA-Z0-9]+/).filter(Boolean).map((e, n) => (n === 0 && !t ? e.charAt(0).toLowerCase() : e.charAt(0).toUpperCase()) + e.slice(1)).join(""), n = e.split(".");
|
|
207
221
|
return `${t(n[0] ?? "rpc", !1)}${n.slice(1).map((e) => t(e, !0)).join("")}Rpc`;
|
|
208
|
-
},
|
|
209
|
-
let n = (e) =>
|
|
210
|
-
if (
|
|
222
|
+
}, K = /^[A-Za-z][A-Za-z0-9]*([._-][A-Za-z0-9]+)*$/, q = (e, t) => {
|
|
223
|
+
let n = (e) => a(t, e.file).replace(/\\/g, "/"), r = e.filter((e) => !K.test(e.rpcTag));
|
|
224
|
+
if (r.length > 0) throw Error(`invalid rpc tag — a procedure/workflow \`name\` must start with a letter and
|
|
211
225
|
use only letters, digits, and \`.\` \`-\` \`_\` separators (the tag becomes a JS
|
|
212
226
|
identifier in the generated rpcGroup):
|
|
213
227
|
|
|
214
|
-
${
|
|
215
|
-
let
|
|
228
|
+
${r.map((e) => ` • "${e.rpcTag}" (${n(e)})`).join("\n")}\n`);
|
|
229
|
+
let i = /* @__PURE__ */ new Map();
|
|
216
230
|
for (let t of e) {
|
|
217
|
-
let e =
|
|
218
|
-
n ? n.push(t) :
|
|
231
|
+
let e = G(t.rpcTag), n = i.get(e);
|
|
232
|
+
n ? n.push(t) : i.set(e, [t]);
|
|
219
233
|
}
|
|
220
|
-
let o = [...
|
|
234
|
+
let o = [...i.values()].filter((e) => new Set(e.map((e) => e.rpcTag)).size > 1);
|
|
221
235
|
if (o.length > 0) throw Error(`rpc tag identifier collision — these distinct tags collapse to the same
|
|
222
236
|
generated identifier (separators are normalized away). Rename one so they
|
|
223
237
|
differ by more than a \`.\`/\`-\`/\`_\`:
|
|
224
238
|
|
|
225
|
-
${o.map((e) => ` ${
|
|
226
|
-
},
|
|
239
|
+
${o.map((e) => ` ${G(e[0].rpcTag)}:\n` + e.map((e) => ` - "${e.rpcTag}" (${n(e)})`).join("\n")).join("\n\n")}\n`);
|
|
240
|
+
}, J = (e) => {
|
|
227
241
|
switch (e) {
|
|
228
242
|
case "query": return 0;
|
|
229
243
|
case "mutation": return 1;
|
|
@@ -232,66 +246,66 @@ ${o.map((e) => ` ${U(e[0].rpcTag)}:\n` + e.map((e) => ` - "${e.rpcTag}" (${
|
|
|
232
246
|
case "event": return 4;
|
|
233
247
|
case "workflow": return 5;
|
|
234
248
|
}
|
|
235
|
-
},
|
|
249
|
+
}, ee = (e, t) => {
|
|
236
250
|
let n = /* @__PURE__ */ new Map();
|
|
237
251
|
for (let t of e) n.has(t.rpcTag) || n.set(t.rpcTag, t);
|
|
238
|
-
let
|
|
239
|
-
for (let e of
|
|
240
|
-
let t =
|
|
252
|
+
let r = [...n.keys()], i = (e) => a(t, n.get(e).file).replace(/\\/g, "/"), o = [];
|
|
253
|
+
for (let e of r) {
|
|
254
|
+
let t = r.filter((t) => t.startsWith(`${e}.`)).sort();
|
|
241
255
|
if (t.length === 0) continue;
|
|
242
|
-
let n = t.map((e) => ` - ${e} (${
|
|
243
|
-
o.push(` • "${e}" (${
|
|
256
|
+
let n = t.map((e) => ` - ${e} (${i(e)})`).join("\n");
|
|
257
|
+
o.push(` • "${e}" (${i(e)})\n is a procedure AND the namespace prefix of:\n${n}`);
|
|
244
258
|
}
|
|
245
259
|
if (o.length !== 0) throw Error(`rpc tag namespace collision — the web client nests tags by ".", so a tag
|
|
246
260
|
can't be both a leaf and a namespace. Rename one side (e.g. give the
|
|
247
261
|
workflow/procedure a nested name like "<prefix>.run"):
|
|
248
262
|
|
|
249
263
|
${o.join("\n\n")}\n`);
|
|
250
|
-
},
|
|
251
|
-
let t = [...await
|
|
252
|
-
for (let
|
|
264
|
+
}, te = "// source-fingerprint: ", Y = async (e) => {
|
|
265
|
+
let t = [...await R(e)].sort(), n = p("sha1");
|
|
266
|
+
for (let r of t) {
|
|
253
267
|
let t = "";
|
|
254
268
|
try {
|
|
255
|
-
t =
|
|
269
|
+
t = c(r, "utf8");
|
|
256
270
|
} catch {}
|
|
257
|
-
n.update(`${
|
|
271
|
+
n.update(`${a(e, r).replace(/\\/g, "/")}\u0000${t}\u0000`);
|
|
258
272
|
}
|
|
259
273
|
return n.digest("hex").slice(0, 16);
|
|
260
274
|
}, X = async (e) => {
|
|
261
275
|
let t = async (e) => {
|
|
262
|
-
let
|
|
263
|
-
for (let t of
|
|
264
|
-
for (let
|
|
265
|
-
if (
|
|
266
|
-
let
|
|
267
|
-
if (
|
|
276
|
+
let n = await s.readdir(e, { withFileTypes: !0 }).catch(() => []);
|
|
277
|
+
for (let t of n) if (!F.has(t.name) && t.isFile() && t.name === "rpcGroup.generated.ts") return i(e, t.name);
|
|
278
|
+
for (let r of n) {
|
|
279
|
+
if (F.has(r.name) || !r.isDirectory()) continue;
|
|
280
|
+
let n = await t(i(e, r.name));
|
|
281
|
+
if (n !== void 0) return n;
|
|
268
282
|
}
|
|
269
283
|
};
|
|
270
|
-
return t(
|
|
284
|
+
return t(o(e));
|
|
271
285
|
}, Z = async (e) => {
|
|
272
|
-
let
|
|
273
|
-
if (
|
|
274
|
-
let
|
|
286
|
+
let t = await X(e);
|
|
287
|
+
if (t === void 0) return { kind: "absent" };
|
|
288
|
+
let n = "";
|
|
275
289
|
try {
|
|
276
|
-
|
|
290
|
+
n = await s.readFile(t, "utf8");
|
|
277
291
|
} catch {
|
|
278
292
|
return { kind: "absent" };
|
|
279
293
|
}
|
|
280
|
-
let i = /^\/\/ source-fingerprint: ([0-9a-f]+)$/m.exec(
|
|
294
|
+
let i = /^\/\/ source-fingerprint: ([0-9a-f]+)$/m.exec(n)?.[1];
|
|
281
295
|
return i === void 0 ? {
|
|
282
296
|
kind: "stale",
|
|
283
|
-
file:
|
|
297
|
+
file: t,
|
|
284
298
|
reason: "the generated group carries no freshness stamp"
|
|
285
|
-
} : await Y(t
|
|
299
|
+
} : await Y(r(t)) === i ? {
|
|
286
300
|
kind: "fresh",
|
|
287
|
-
file:
|
|
301
|
+
file: t
|
|
288
302
|
} : {
|
|
289
303
|
kind: "stale",
|
|
290
|
-
file:
|
|
304
|
+
file: t,
|
|
291
305
|
reason: "a descriptor changed since the group was generated"
|
|
292
306
|
};
|
|
293
|
-
}, Q = (e, n, i
|
|
294
|
-
let
|
|
307
|
+
}, Q = (e, t, n, i = [], o = [], s = !1, l = !1, u = [], d = "") => {
|
|
308
|
+
let f = o.length > 0, m = o.flatMap((e) => [{
|
|
295
309
|
file: e.file,
|
|
296
310
|
exportName: e.exportName,
|
|
297
311
|
rpcTag: `${e.name}.send`,
|
|
@@ -307,20 +321,20 @@ ${o.join("\n\n")}\n`);
|
|
|
307
321
|
rpcTag: e.tag,
|
|
308
322
|
kind: e.kind
|
|
309
323
|
}));
|
|
310
|
-
|
|
311
|
-
...
|
|
324
|
+
ee([
|
|
325
|
+
...n,
|
|
312
326
|
...m,
|
|
313
327
|
...g
|
|
314
|
-
], e),
|
|
315
|
-
...
|
|
328
|
+
], e), q([
|
|
329
|
+
...n,
|
|
316
330
|
...m,
|
|
317
331
|
...g
|
|
318
332
|
], e);
|
|
319
|
-
let _ = (e) => e.replace(/[^a-zA-Z0-9_$]/g, "_"), v = (e) => `__src_agent_${_(e.name)}`, y = (e) => `__agentRoutes_${_(e.name)}`, b =
|
|
320
|
-
let t = `./${
|
|
333
|
+
let _ = (e) => e.replace(/[^a-zA-Z0-9_$]/g, "_"), v = (e) => `__src_agent_${_(e.name)}`, y = (e) => `__agentRoutes_${_(e.name)}`, b = i.length > 0, x = i.map((e, t) => `import { ${e.name} as __pe${t} } from '${e.module}'`), S = b ? ", __voltroPluginErrors" : "", C = h.length > 0, w = h.map((e, t) => `import { ${e.name} as __prpc${t} } from '${e.module}'`), T = (e) => e === "query" ? "queryToRpc" : e === "mutation" ? "mutationToRpc" : "actionToRpc", E = h.map((e, t) => `export const ${G(e.tag)} = ${T(e.kind)}(__prpc${t}${S})`), D = h.map((e) => ` ${G(e.tag)},`), O = [...n].sort((e, t) => e.kind === t.kind ? e.rpcTag < t.rpcTag ? -1 : 1 : J(e.kind) - J(t.kind)), k = r(t), A = (e) => `__src_${G(e.rpcTag)}`, j = (e) => {
|
|
334
|
+
let t = `./${a(k, e.file).replace(/\\/g, "/").replace(/\.tsx?$/, "")}`;
|
|
321
335
|
return `import { ${e.exportName} as ${A(e)} } from '${t}'`;
|
|
322
336
|
}, M = (e) => {
|
|
323
|
-
let t =
|
|
337
|
+
let t = G(e.rpcTag), n = A(e);
|
|
324
338
|
return e.kind === "query" ? `export const ${t} = queryToRpc(${n}${S})` : e.kind === "mutation" ? `export const ${t} = mutationToRpc(${n}${S})` : e.kind === "action" ? `export const ${t} = actionToRpc(${n}${S})` : e.kind === "stream" ? `export const ${t} = streamToRpc(${n}${S})` : e.kind === "event" ? `export const ${t} = eventToRpc(${n}${S})` : [
|
|
325
339
|
`export const ${t} = Rpc.make('${e.rpcTag}', {`,
|
|
326
340
|
` payload: strictInput(${n}.payloadSchema),`,
|
|
@@ -339,7 +353,7 @@ ${o.join("\n\n")}\n`);
|
|
|
339
353
|
"__voltroWorkflowResume",
|
|
340
354
|
"__voltroWorkflowSignal",
|
|
341
355
|
"__voltroWorkflowUpdate"
|
|
342
|
-
] : [], L =
|
|
356
|
+
] : [], L = s ? [
|
|
343
357
|
"__voltroUndoLog",
|
|
344
358
|
"__voltroUndoApply",
|
|
345
359
|
"__voltroUndoRedo"
|
|
@@ -349,16 +363,16 @@ ${o.join("\n\n")}\n`);
|
|
|
349
363
|
"__voltroConnectionSubmitToken",
|
|
350
364
|
"__voltroConnectionDisconnect"
|
|
351
365
|
] : [], V = [
|
|
352
|
-
...O.map((e) => ` ${
|
|
353
|
-
...
|
|
366
|
+
...O.map((e) => ` ${G(e.rpcTag)},`),
|
|
367
|
+
...o.flatMap((e) => [` ${G(`${e.name}.send`)},`, ` ${G(`${e.name}.messages`)},`]),
|
|
354
368
|
...I.map((e) => ` ${e},`),
|
|
355
369
|
...L.map((e) => ` ${e},`),
|
|
356
370
|
...z.map((e) => ` ${e},`),
|
|
357
371
|
...B.map((e) => ` ${e},`),
|
|
358
372
|
...D
|
|
359
373
|
].join("\n"), H = ["queryToRpc"];
|
|
360
|
-
(O.some((e) => e.kind === "mutation") || h.some((e) => e.kind === "mutation")) && H.push("mutationToRpc"), (O.some((e) => e.kind === "action") || F ||
|
|
361
|
-
let
|
|
374
|
+
(O.some((e) => e.kind === "mutation") || h.some((e) => e.kind === "mutation")) && H.push("mutationToRpc"), (O.some((e) => e.kind === "action") || F || f || h.some((e) => e.kind === "action")) && H.push("actionToRpc"), O.some((e) => e.kind === "stream") && H.push("streamToRpc"), O.some((e) => e.kind === "event") && H.push("eventToRpc"), F && H.push("strictInput", "WorkflowRunHandleSchema", "workflowCancelDescriptor", "workflowDomainEventsQueryDescriptor", "workflowEventDeliveriesQueryDescriptor", "workflowResumeDescriptor", "workflowRunEventsQueryDescriptor", "workflowRunQueryDescriptor", "workflowRunsQueryDescriptor", "workflowRunStepsQueryDescriptor", "workflowSignalDescriptor", "workflowUpdateDescriptor"), s && H.push("mutationToRpc", "undoLogQueryDescriptor", "undoApplyDescriptor", "undoRedoDescriptor"), R && H.push("mutationToRpc", "approvalsPendingQueryDescriptor", "approvalsDecideDescriptor"), l && H.push("mutationToRpc", "actionToRpc", "connectionsListQueryDescriptor", "connectionStartDescriptor", "connectionSubmitTokenDescriptor", "connectionDisconnectDescriptor"), (O.some((e) => e.kind === "query" || e.kind === "mutation" || e.kind === "action" || e.kind === "stream") || f || F || s || R || l || C) && H.push("normalizeDescriptor");
|
|
375
|
+
let U = [...new Set(H)].sort(), W = [...O.filter((e) => e.kind === "query" || e.kind === "mutation" || e.kind === "action" || e.kind === "stream").map((e) => [e.rpcTag, A(e)]), ...o.flatMap((e) => [[`${e.name}.send`, `${y(e)}.send`], [`${e.name}.messages`, `${y(e)}.messages`]])], K = [
|
|
362
376
|
...F ? [
|
|
363
377
|
["__voltro.workflow.run", "workflowRunQueryDescriptor"],
|
|
364
378
|
["__voltro.workflow.runs", "workflowRunsQueryDescriptor"],
|
|
@@ -371,7 +385,7 @@ ${o.join("\n\n")}\n`);
|
|
|
371
385
|
["__voltro.workflow.signal", "workflowSignalDescriptor"],
|
|
372
386
|
["__voltro.workflow.update", "workflowUpdateDescriptor"]
|
|
373
387
|
] : [],
|
|
374
|
-
...
|
|
388
|
+
...s ? [
|
|
375
389
|
["__voltro.undo.log", "undoLogQueryDescriptor"],
|
|
376
390
|
["__voltro.undo.apply", "undoApplyDescriptor"],
|
|
377
391
|
["__voltro.undo.redo", "undoRedoDescriptor"]
|
|
@@ -384,10 +398,10 @@ ${o.join("\n\n")}\n`);
|
|
|
384
398
|
["__voltro.connections.disconnect", "connectionDisconnectDescriptor"]
|
|
385
399
|
] : [],
|
|
386
400
|
...h.map((e, t) => [e.tag, `__prpc${t}`])
|
|
387
|
-
],
|
|
388
|
-
...
|
|
401
|
+
], Y = ([e, t]) => ` ${JSON.stringify(e)}: normalizeDescriptor(${t}),`, X = ([e, t]) => ` readonly ${JSON.stringify(e)}: typeof ${t}`, Z = W.map(Y), Q = K.map(Y), $ = O.filter((e) => e.kind === "workflow").map((e) => ` ${JSON.stringify(e.rpcTag)}: { kind: 'workflow' },`), ne = O.filter((e) => e.kind === "workflow").map((e) => ` readonly ${JSON.stringify(e.rpcTag)}: { readonly kind: 'workflow' }`), re = [
|
|
402
|
+
...W.map(X),
|
|
389
403
|
...ne,
|
|
390
|
-
...
|
|
404
|
+
...K.map(X)
|
|
391
405
|
], ie = O.filter((e) => e.kind === "workflow").map((e) => {
|
|
392
406
|
let t = A(e);
|
|
393
407
|
return [
|
|
@@ -400,41 +414,41 @@ ${o.join("\n\n")}\n`);
|
|
|
400
414
|
` updates: __voltroWorkflowMessages(${t}).updates,`,
|
|
401
415
|
" },"
|
|
402
416
|
].join("\n");
|
|
403
|
-
}), ae = [...O, ...
|
|
417
|
+
}), ae = [...O, ...o.map((e) => ({
|
|
404
418
|
rpcTag: `agent:${e.name}`,
|
|
405
419
|
file: e.file
|
|
406
420
|
}))];
|
|
407
421
|
return [
|
|
408
422
|
"// THIS FILE IS GENERATED — DO NOT EDIT BY HAND.",
|
|
409
423
|
"// Re-emitted by `voltro dev` whenever query/mutation/action/stream/workflow files change.",
|
|
410
|
-
`// descriptor-fingerprint: ${
|
|
424
|
+
`// descriptor-fingerprint: ${p("sha1").update(ae.map((e) => {
|
|
411
425
|
let t = "";
|
|
412
426
|
try {
|
|
413
|
-
t =
|
|
427
|
+
t = c(e.file, "utf8");
|
|
414
428
|
} catch {}
|
|
415
429
|
return `${e.rpcTag}\u0000${t}`;
|
|
416
430
|
}).join("")).digest("hex").slice(0, 16)}`,
|
|
417
|
-
`${
|
|
431
|
+
`${te}${d}`,
|
|
418
432
|
"// Source files:",
|
|
419
|
-
...O.map((t) => `// - ${
|
|
420
|
-
...
|
|
433
|
+
...O.map((t) => `// - ${a(e, t.file).replace(/\\/g, "/")}`),
|
|
434
|
+
...o.map((t) => `// - ${a(e, t.file).replace(/\\/g, "/")} (agent)`),
|
|
421
435
|
"",
|
|
422
436
|
F ? "import { Rpc, RpcGroup } from '@effect/rpc'" : "import { RpcGroup } from '@effect/rpc'",
|
|
423
437
|
...F || P ? ["import { Schema } from 'effect'"] : [],
|
|
424
|
-
`import { ${
|
|
425
|
-
...
|
|
438
|
+
`import { ${U.join(", ")} } from '@voltro/protocol'`,
|
|
439
|
+
...f ? ["import { agentRouteDescriptors as __voltroAgentRoutes } from '@voltro/ai/agent'"] : [],
|
|
426
440
|
"",
|
|
427
441
|
...O.map(j),
|
|
428
|
-
...
|
|
442
|
+
...o.map((e) => `import { ${e.exportName} as ${v(e)} } from './${a(k, e.file).replace(/\\/g, "/").replace(/\.tsx?$/, "")}'`),
|
|
429
443
|
...b ? ["", ...x] : [],
|
|
430
444
|
...C ? ["", ...w] : [],
|
|
431
445
|
"",
|
|
432
|
-
...
|
|
433
|
-
...
|
|
446
|
+
...o.map((e) => `const ${y(e)} = __voltroAgentRoutes(${v(e)})`),
|
|
447
|
+
...f ? [""] : [],
|
|
434
448
|
...b ? [
|
|
435
449
|
"/** Cross-cutting plugin error schemas, unioned into every rpc's",
|
|
436
450
|
" * wire error so interceptor failures decode typed on the client. */",
|
|
437
|
-
`const __voltroPluginErrors = [${
|
|
451
|
+
`const __voltroPluginErrors = [${i.map((e, t) => `__pe${t}`).join(", ")}] as const`,
|
|
438
452
|
""
|
|
439
453
|
] : [],
|
|
440
454
|
...F ? [
|
|
@@ -466,7 +480,7 @@ ${o.join("\n\n")}\n`);
|
|
|
466
480
|
""
|
|
467
481
|
] : [],
|
|
468
482
|
...O.map(M),
|
|
469
|
-
...
|
|
483
|
+
...o.flatMap((e) => [`export const ${G(`${e.name}.send`)} = actionToRpc(${y(e)}.send${S})`, `export const ${G(`${e.name}.messages`)} = queryToRpc(${y(e)}.messages${S})`]),
|
|
470
484
|
...F ? [
|
|
471
485
|
"export const __voltroWorkflowRun = queryToRpc(workflowRunQueryDescriptor)",
|
|
472
486
|
"export const __voltroWorkflowRuns = queryToRpc(workflowRunsQueryDescriptor)",
|
|
@@ -479,7 +493,7 @@ ${o.join("\n\n")}\n`);
|
|
|
479
493
|
"export const __voltroWorkflowSignal = actionToRpc(workflowSignalDescriptor)",
|
|
480
494
|
"export const __voltroWorkflowUpdate = actionToRpc(workflowUpdateDescriptor)"
|
|
481
495
|
] : [],
|
|
482
|
-
...
|
|
496
|
+
...s ? [
|
|
483
497
|
"export const __voltroUndoLog = queryToRpc(undoLogQueryDescriptor)",
|
|
484
498
|
"export const __voltroUndoApply = mutationToRpc(undoApplyDescriptor)",
|
|
485
499
|
"export const __voltroUndoRedo = mutationToRpc(undoRedoDescriptor)"
|
|
@@ -501,9 +515,9 @@ ${o.join("\n\n")}\n`);
|
|
|
501
515
|
" * Function fields (target.shape, target.identify) survive because",
|
|
502
516
|
" * the descriptors themselves are imported by reference. */",
|
|
503
517
|
"export const appDescriptors = {",
|
|
518
|
+
...Z,
|
|
504
519
|
...$,
|
|
505
|
-
...
|
|
506
|
-
...ee,
|
|
520
|
+
...Q,
|
|
507
521
|
"} as const",
|
|
508
522
|
"",
|
|
509
523
|
"export type AppDescriptors = typeof appDescriptors",
|
|
@@ -561,26 +575,26 @@ ${o.join("\n\n")}\n`);
|
|
|
561
575
|
] : []
|
|
562
576
|
].join("\n");
|
|
563
577
|
}, $ = async (e) => {
|
|
564
|
-
let
|
|
565
|
-
if (
|
|
566
|
-
let
|
|
567
|
-
if (e.length === 0) return
|
|
568
|
-
let
|
|
569
|
-
for (let e = 0; e <
|
|
570
|
-
let
|
|
571
|
-
if (
|
|
578
|
+
let t = o(e.root), n = await R(t), a = await U(n), c = await W(n), l = await I(t);
|
|
579
|
+
if (a.length === 0 && c.length === 0 && !l && (e.pluginRpcImports?.length ?? 0) === 0) return;
|
|
580
|
+
let u = ((e) => {
|
|
581
|
+
if (e.length === 0) return t;
|
|
582
|
+
let n = e.map((e) => e.split("/")), r = Math.min(...n.map((e) => e.length)), i = [];
|
|
583
|
+
for (let e = 0; e < r; e++) {
|
|
584
|
+
let t = n[0][e];
|
|
585
|
+
if (n.every((n) => n[e] === t)) i.push(t);
|
|
572
586
|
else break;
|
|
573
587
|
}
|
|
574
588
|
return i.join("/") || "/";
|
|
575
|
-
})([...new Set([...
|
|
589
|
+
})([...new Set([...a.map((e) => e.file), ...c.map((e) => e.file)].map((e) => e.replace(/\/[^/]+$/, "")))]), d = /* @__PURE__ */ new Set([
|
|
576
590
|
"queries",
|
|
577
591
|
"mutations",
|
|
578
592
|
"actions",
|
|
579
593
|
"streams",
|
|
580
594
|
"workflows"
|
|
581
|
-
]), p = (e) => e.slice(e.lastIndexOf("/") + 1), m =
|
|
582
|
-
for (; m !==
|
|
583
|
-
let h =
|
|
595
|
+
]), p = (e) => e.slice(e.lastIndexOf("/") + 1), m = u;
|
|
596
|
+
for (; m !== t && d.has(p(m));) m = m.slice(0, m.lastIndexOf("/")) || "/";
|
|
597
|
+
let h = o(e.outputFile ?? i(m, "rpcGroup.generated.ts")), g = [...new Map((e.pluginErrorImports ?? []).map((e) => [`${e.module}#${e.name}`, e])).values()], _ = [...new Map((e.pluginRpcImports ?? []).map((e) => [e.tag, e])).values()], v = await Y(r(h)), y = Q(t, h, a, g, c, f(), l, _, v), b = [];
|
|
584
598
|
for (let t of e.pluginContributions ?? []) {
|
|
585
599
|
let e = null;
|
|
586
600
|
try {
|
|
@@ -597,9 +611,9 @@ ${o.join("\n\n")}\n`);
|
|
|
597
611
|
}
|
|
598
612
|
let x = b.length === 0 ? y : `${y}\n\n// ---- plugin codegen ----\n\n${b.join("\n")}`, S = null;
|
|
599
613
|
try {
|
|
600
|
-
S = await
|
|
614
|
+
S = await s.readFile(h, "utf8");
|
|
601
615
|
} catch {}
|
|
602
|
-
return S !== x && await
|
|
616
|
+
return S !== x && await s.writeFile(h, x, "utf8"), await k(h), h;
|
|
603
617
|
};
|
|
604
618
|
//#endregion
|
|
605
|
-
export {
|
|
619
|
+
export { E as a, T as c, L as i, D as l, Y as n, k as o, $ as r, O as s, Z as t };
|