@drzl/cli 4.31.0 → 4.32.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/dist/{chunk-FURPHLQS.js → chunk-BDIJ6WMG.js} +47 -3
- package/dist/chunk-BDIJ6WMG.js.map +1 -0
- package/dist/cli.cjs +107 -21
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +64 -20
- package/dist/cli.js.map +1 -1
- package/dist/config.cjs +47 -2
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +22 -1
- package/dist/config.d.ts +22 -1
- package/dist/config.js +3 -1
- package/dist/drzl.config.schema.json +9 -1
- package/package.json +5 -4
- package/dist/chunk-FURPHLQS.js.map +0 -1
package/dist/config.cjs
CHANGED
|
@@ -49,6 +49,7 @@ __export(config_exports, {
|
|
|
49
49
|
configFromKinds: () => configFromKinds,
|
|
50
50
|
defineConfig: () => defineConfig,
|
|
51
51
|
effectHttpOutDir: () => effectHttpOutDir,
|
|
52
|
+
elysiaOutDir: () => elysiaOutDir,
|
|
52
53
|
expressOutDir: () => expressOutDir,
|
|
53
54
|
fastifyOutDir: () => fastifyOutDir,
|
|
54
55
|
filterTables: () => filterTables,
|
|
@@ -360,6 +361,7 @@ var GeneratorKindSchema = import_zod.z.enum([
|
|
|
360
361
|
"graphql",
|
|
361
362
|
"ai",
|
|
362
363
|
"effect-http",
|
|
364
|
+
"elysia",
|
|
363
365
|
"h3",
|
|
364
366
|
"mcp",
|
|
365
367
|
"next",
|
|
@@ -407,6 +409,16 @@ var GeneratorSchema = import_zod.z.object({
|
|
|
407
409
|
apiName: import_zod.z.string().optional(),
|
|
408
410
|
/** The identifier the assembled root contract carries. `ts-rest` only, defaults to `'contract'`. */
|
|
409
411
|
contractName: import_zod.z.string().optional(),
|
|
412
|
+
/** The identifier the assembled Elysia app is exported as. `elysia` only, defaults to `'app'`. */
|
|
413
|
+
appName: import_zod.z.string().optional(),
|
|
414
|
+
/**
|
|
415
|
+
* Prefixed to every table's mount point. `elysia` only.
|
|
416
|
+
*
|
|
417
|
+
* Passed to Elysia's own `new Elysia({ prefix })` on the assembled app rather than folded into
|
|
418
|
+
* each module's prefix, because Elysia lifts it into the app's type: the full path is what Eden
|
|
419
|
+
* Treaty reports.
|
|
420
|
+
*/
|
|
421
|
+
prefix: import_zod.z.string().optional(),
|
|
410
422
|
/**
|
|
411
423
|
* Prefixed to every path in the emitted contract. `ts-rest` only.
|
|
412
424
|
*
|
|
@@ -642,7 +654,16 @@ var GeneratorSchema = import_zod.z.object({
|
|
|
642
654
|
// router validation sharing (orpc, trpc)
|
|
643
655
|
validation: import_zod.z.object({
|
|
644
656
|
useShared: import_zod.z.boolean().default(false).optional(),
|
|
645
|
-
|
|
657
|
+
/**
|
|
658
|
+
* Which validation generator's schemas this generator imports.
|
|
659
|
+
*
|
|
660
|
+
* `typebox` is accepted here and works for exactly one kind, `elysia`, whose validator slot
|
|
661
|
+
* takes a TypeBox schema natively because Elysia's own `t` is TypeBox. Every other router
|
|
662
|
+
* types its validators as a Standard Schema, which TypeBox does not implement, so a router
|
|
663
|
+
* wired to one would type against `any` and validate nothing. Naming it on any other kind is
|
|
664
|
+
* reported below rather than accepted, which is why the enum can be this wide.
|
|
665
|
+
*/
|
|
666
|
+
library: import_zod.z.enum(["zod", "valibot", "arktype", "typebox"]).default("zod").optional(),
|
|
646
667
|
importPath: import_zod.z.string().optional(),
|
|
647
668
|
schemaSuffix: import_zod.z.string().optional(),
|
|
648
669
|
/**
|
|
@@ -816,7 +837,8 @@ var ROUTER_KINDS = /* @__PURE__ */ new Set([
|
|
|
816
837
|
"tanstack-start",
|
|
817
838
|
"h3",
|
|
818
839
|
"effect-http",
|
|
819
|
-
"ts-rest"
|
|
840
|
+
"ts-rest",
|
|
841
|
+
"elysia"
|
|
820
842
|
]);
|
|
821
843
|
var INJECTION_KINDS = /* @__PURE__ */ new Set(["orpc", "trpc"]);
|
|
822
844
|
function trpcOutDir(g, cfg) {
|
|
@@ -858,6 +880,9 @@ function effectHttpOutDir(g, cfg) {
|
|
|
858
880
|
function tsRestOutDir(g, cfg) {
|
|
859
881
|
return g.path ?? cfg.outDir;
|
|
860
882
|
}
|
|
883
|
+
function elysiaOutDir(g, cfg) {
|
|
884
|
+
return g.path ?? cfg.outDir;
|
|
885
|
+
}
|
|
861
886
|
function sharedSchemaNames(opts) {
|
|
862
887
|
const resolved = (0, import_validation_core.resolveAffix)(opts);
|
|
863
888
|
return import_validation_core.NAME_MODES.map((mode) => (0, import_validation_core.schemaName)(mode, import_validation_core.AFFIX_PROBE_TABLE, resolved));
|
|
@@ -923,6 +948,24 @@ function resolveConfig(cfg) {
|
|
|
923
948
|
}
|
|
924
949
|
continue;
|
|
925
950
|
}
|
|
951
|
+
if (g.validation?.library === "typebox" && g.kind !== "elysia") {
|
|
952
|
+
warnings.push(
|
|
953
|
+
`drzl config: the "${g.kind}" generator sets validation.library to "typebox", which it cannot validate with. TypeBox does not implement Standard Schema, so the schemas would be accepted and never checked. Use "zod", "valibot" or "arktype". The "elysia" generator is the one that takes TypeBox, because Elysia's own "t" is TypeBox.`
|
|
954
|
+
);
|
|
955
|
+
}
|
|
956
|
+
if (g.kind === "elysia") {
|
|
957
|
+
if (g.includeRelations) {
|
|
958
|
+
warnings.push(
|
|
959
|
+
`drzl config: the "elysia" generator sets includeRelations, which it does not read. Relation lookups are a route this generator does not emit. Remove the flag.`
|
|
960
|
+
);
|
|
961
|
+
}
|
|
962
|
+
const library2 = g.validation?.library ?? "zod";
|
|
963
|
+
if (!g.validation?.importPath && !generators.some((s) => s.kind === library2)) {
|
|
964
|
+
warnings.push(
|
|
965
|
+
`drzl config: the "elysia" generator validates with the schemas a validation generator writes, and this config has no "${library2}" generator for it to import from. Add { kind: "${library2}" }, or set validation.importPath to wherever those schemas live.`
|
|
966
|
+
);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
926
969
|
if (g.kind === "effect-http") {
|
|
927
970
|
if (g.validation?.library) {
|
|
928
971
|
warnings.push(
|
|
@@ -1155,6 +1198,7 @@ function computeGeneratorOutputDirs(cfg, cwd = process.cwd()) {
|
|
|
1155
1198
|
if (g.kind === "h3") dirs.add(abs(h3OutDir(g, cfg)));
|
|
1156
1199
|
if (g.kind === "effect-http") dirs.add(abs(effectHttpOutDir(g, cfg)));
|
|
1157
1200
|
if (g.kind === "ts-rest") dirs.add(abs(tsRestOutDir(g, cfg)));
|
|
1201
|
+
if (g.kind === "elysia") dirs.add(abs(elysiaOutDir(g, cfg)));
|
|
1158
1202
|
if (g.kind === "service") dirs.add(abs(g.path ?? "src/services"));
|
|
1159
1203
|
if (g.kind === "zod") dirs.add(abs(g.path ?? "src/validators/zod"));
|
|
1160
1204
|
if (g.kind === "valibot") dirs.add(abs(g.path ?? "src/validators/valibot"));
|
|
@@ -1234,6 +1278,7 @@ function computeWatchTargets(cfg, cwd = process.cwd(), source) {
|
|
|
1234
1278
|
configFromKinds,
|
|
1235
1279
|
defineConfig,
|
|
1236
1280
|
effectHttpOutDir,
|
|
1281
|
+
elysiaOutDir,
|
|
1237
1282
|
expressOutDir,
|
|
1238
1283
|
fastifyOutDir,
|
|
1239
1284
|
filterTables,
|