@drzl/cli 4.30.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-3REB46XD.js → chunk-BDIJ6WMG.js} +78 -3
- package/dist/chunk-BDIJ6WMG.js.map +1 -0
- package/dist/cli.cjs +174 -20
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +103 -20
- package/dist/cli.js.map +1 -1
- package/dist/config.cjs +81 -4
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +43 -3
- package/dist/config.d.ts +43 -3
- package/dist/config.js +7 -3
- package/dist/drzl.config.schema.json +16 -1
- package/package.json +5 -3
- package/dist/chunk-3REB46XD.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,
|
|
@@ -64,7 +65,8 @@ __export(config_exports, {
|
|
|
64
65
|
resolveTemplateDirsSync: () => resolveTemplateDirsSync,
|
|
65
66
|
tableFilterWarnings: () => tableFilterWarnings,
|
|
66
67
|
tanstackStartOutDir: () => tanstackStartOutDir,
|
|
67
|
-
trpcOutDir: () => trpcOutDir
|
|
68
|
+
trpcOutDir: () => trpcOutDir,
|
|
69
|
+
tsRestOutDir: () => tsRestOutDir
|
|
68
70
|
});
|
|
69
71
|
module.exports = __toCommonJS(config_exports);
|
|
70
72
|
var import_validation_core = require("@drzl/validation-core");
|
|
@@ -359,10 +361,12 @@ var GeneratorKindSchema = import_zod.z.enum([
|
|
|
359
361
|
"graphql",
|
|
360
362
|
"ai",
|
|
361
363
|
"effect-http",
|
|
364
|
+
"elysia",
|
|
362
365
|
"h3",
|
|
363
366
|
"mcp",
|
|
364
367
|
"next",
|
|
365
368
|
"tanstack-start",
|
|
369
|
+
"ts-rest",
|
|
366
370
|
"service",
|
|
367
371
|
"zod",
|
|
368
372
|
"valibot",
|
|
@@ -403,6 +407,27 @@ var GeneratorSchema = import_zod.z.object({
|
|
|
403
407
|
h3: import_zod.z.enum(["v1", "v2"]).optional(),
|
|
404
408
|
/** The identifier the assembled `HttpApi` carries. `effect-http` only, defaults to `'api'`. */
|
|
405
409
|
apiName: import_zod.z.string().optional(),
|
|
410
|
+
/** The identifier the assembled root contract carries. `ts-rest` only, defaults to `'contract'`. */
|
|
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(),
|
|
422
|
+
/**
|
|
423
|
+
* Prefixed to every path in the emitted contract. `ts-rest` only.
|
|
424
|
+
*
|
|
425
|
+
* Passed through to ts-rest's own `c.router(..., { pathPrefix })` rather than written into each
|
|
426
|
+
* path, because ts-rest lifts the prefix into the contract's type: a client derived from the
|
|
427
|
+
* result reports the full path. Writing it into the strings by hand would produce the same
|
|
428
|
+
* requests and a different type.
|
|
429
|
+
*/
|
|
430
|
+
pathPrefix: import_zod.z.string().optional(),
|
|
406
431
|
/** The name and version the emitted MCP server reports at initialize. `mcp` only. */
|
|
407
432
|
serverName: import_zod.z.string().optional(),
|
|
408
433
|
serverVersion: import_zod.z.string().optional(),
|
|
@@ -629,7 +654,16 @@ var GeneratorSchema = import_zod.z.object({
|
|
|
629
654
|
// router validation sharing (orpc, trpc)
|
|
630
655
|
validation: import_zod.z.object({
|
|
631
656
|
useShared: import_zod.z.boolean().default(false).optional(),
|
|
632
|
-
|
|
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(),
|
|
633
667
|
importPath: import_zod.z.string().optional(),
|
|
634
668
|
schemaSuffix: import_zod.z.string().optional(),
|
|
635
669
|
/**
|
|
@@ -802,7 +836,9 @@ var ROUTER_KINDS = /* @__PURE__ */ new Set([
|
|
|
802
836
|
"ai",
|
|
803
837
|
"tanstack-start",
|
|
804
838
|
"h3",
|
|
805
|
-
"effect-http"
|
|
839
|
+
"effect-http",
|
|
840
|
+
"ts-rest",
|
|
841
|
+
"elysia"
|
|
806
842
|
]);
|
|
807
843
|
var INJECTION_KINDS = /* @__PURE__ */ new Set(["orpc", "trpc"]);
|
|
808
844
|
function trpcOutDir(g, cfg) {
|
|
@@ -841,6 +877,12 @@ function h3OutDir(g, cfg) {
|
|
|
841
877
|
function effectHttpOutDir(g, cfg) {
|
|
842
878
|
return g.path ?? cfg.outDir;
|
|
843
879
|
}
|
|
880
|
+
function tsRestOutDir(g, cfg) {
|
|
881
|
+
return g.path ?? cfg.outDir;
|
|
882
|
+
}
|
|
883
|
+
function elysiaOutDir(g, cfg) {
|
|
884
|
+
return g.path ?? cfg.outDir;
|
|
885
|
+
}
|
|
844
886
|
function sharedSchemaNames(opts) {
|
|
845
887
|
const resolved = (0, import_validation_core.resolveAffix)(opts);
|
|
846
888
|
return import_validation_core.NAME_MODES.map((mode) => (0, import_validation_core.schemaName)(mode, import_validation_core.AFFIX_PROBE_TABLE, resolved));
|
|
@@ -906,6 +948,24 @@ function resolveConfig(cfg) {
|
|
|
906
948
|
}
|
|
907
949
|
continue;
|
|
908
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
|
+
}
|
|
909
969
|
if (g.kind === "effect-http") {
|
|
910
970
|
if (g.validation?.library) {
|
|
911
971
|
warnings.push(
|
|
@@ -918,6 +978,19 @@ function resolveConfig(cfg) {
|
|
|
918
978
|
);
|
|
919
979
|
}
|
|
920
980
|
}
|
|
981
|
+
if (g.kind === "ts-rest") {
|
|
982
|
+
if (g.includeRelations) {
|
|
983
|
+
warnings.push(
|
|
984
|
+
`drzl config: the "ts-rest" generator sets includeRelations, which it does not read. Relation lookups are a route this generator does not declare. Remove the flag.`
|
|
985
|
+
);
|
|
986
|
+
}
|
|
987
|
+
const library2 = g.validation?.library ?? "zod";
|
|
988
|
+
if (!g.validation?.importPath && !generators.some((s) => s.kind === library2)) {
|
|
989
|
+
warnings.push(
|
|
990
|
+
`drzl config: the "ts-rest" generator declares its contract 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.`
|
|
991
|
+
);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
921
994
|
if (g.kind === "h3") {
|
|
922
995
|
if (g.includeRelations) {
|
|
923
996
|
warnings.push(
|
|
@@ -1124,6 +1197,8 @@ function computeGeneratorOutputDirs(cfg, cwd = process.cwd()) {
|
|
|
1124
1197
|
if (g.kind === "tanstack-start") dirs.add(abs(tanstackStartOutDir(g, cfg)));
|
|
1125
1198
|
if (g.kind === "h3") dirs.add(abs(h3OutDir(g, cfg)));
|
|
1126
1199
|
if (g.kind === "effect-http") dirs.add(abs(effectHttpOutDir(g, cfg)));
|
|
1200
|
+
if (g.kind === "ts-rest") dirs.add(abs(tsRestOutDir(g, cfg)));
|
|
1201
|
+
if (g.kind === "elysia") dirs.add(abs(elysiaOutDir(g, cfg)));
|
|
1127
1202
|
if (g.kind === "service") dirs.add(abs(g.path ?? "src/services"));
|
|
1128
1203
|
if (g.kind === "zod") dirs.add(abs(g.path ?? "src/validators/zod"));
|
|
1129
1204
|
if (g.kind === "valibot") dirs.add(abs(g.path ?? "src/validators/valibot"));
|
|
@@ -1203,6 +1278,7 @@ function computeWatchTargets(cfg, cwd = process.cwd(), source) {
|
|
|
1203
1278
|
configFromKinds,
|
|
1204
1279
|
defineConfig,
|
|
1205
1280
|
effectHttpOutDir,
|
|
1281
|
+
elysiaOutDir,
|
|
1206
1282
|
expressOutDir,
|
|
1207
1283
|
fastifyOutDir,
|
|
1208
1284
|
filterTables,
|
|
@@ -1218,6 +1294,7 @@ function computeWatchTargets(cfg, cwd = process.cwd(), source) {
|
|
|
1218
1294
|
resolveTemplateDirsSync,
|
|
1219
1295
|
tableFilterWarnings,
|
|
1220
1296
|
tanstackStartOutDir,
|
|
1221
|
-
trpcOutDir
|
|
1297
|
+
trpcOutDir,
|
|
1298
|
+
tsRestOutDir
|
|
1222
1299
|
});
|
|
1223
1300
|
//# sourceMappingURL=config.cjs.map
|