@drzl/cli 4.31.0 → 4.34.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-S5JWTWWU.js} +61 -3
- package/dist/chunk-S5JWTWWU.js.map +1 -0
- package/dist/cli.cjs +158 -21
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +105 -20
- package/dist/cli.js.map +1 -1
- package/dist/config.cjs +63 -2
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +52 -1
- package/dist/config.d.ts +52 -1
- package/dist/config.js +7 -1
- package/dist/drzl.config.schema.json +16 -1
- package/package.json +7 -4
- package/dist/chunk-FURPHLQS.js.map +0 -1
package/dist/cli.cjs
CHANGED
|
@@ -509,11 +509,14 @@ var GeneratorKindSchema = import_zod.z.enum([
|
|
|
509
509
|
"graphql",
|
|
510
510
|
"ai",
|
|
511
511
|
"effect-http",
|
|
512
|
+
"elysia",
|
|
512
513
|
"h3",
|
|
513
514
|
"mcp",
|
|
514
515
|
"next",
|
|
515
516
|
"tanstack-start",
|
|
516
517
|
"ts-rest",
|
|
518
|
+
"seed",
|
|
519
|
+
"fast-check",
|
|
517
520
|
"service",
|
|
518
521
|
"zod",
|
|
519
522
|
"valibot",
|
|
@@ -556,6 +559,18 @@ var GeneratorSchema = import_zod.z.object({
|
|
|
556
559
|
apiName: import_zod.z.string().optional(),
|
|
557
560
|
/** The identifier the assembled root contract carries. `ts-rest` only, defaults to `'contract'`. */
|
|
558
561
|
contractName: import_zod.z.string().optional(),
|
|
562
|
+
/** The identifier the assembled Elysia app is exported as. `elysia` only, defaults to `'app'`. */
|
|
563
|
+
appName: import_zod.z.string().optional(),
|
|
564
|
+
/** How many rows each generated seed function returns by default. `seed` only, defaults to 10. */
|
|
565
|
+
count: import_zod.z.number().int().positive().optional(),
|
|
566
|
+
/**
|
|
567
|
+
* Prefixed to every table's mount point. `elysia` only.
|
|
568
|
+
*
|
|
569
|
+
* Passed to Elysia's own `new Elysia({ prefix })` on the assembled app rather than folded into
|
|
570
|
+
* each module's prefix, because Elysia lifts it into the app's type: the full path is what Eden
|
|
571
|
+
* Treaty reports.
|
|
572
|
+
*/
|
|
573
|
+
prefix: import_zod.z.string().optional(),
|
|
559
574
|
/**
|
|
560
575
|
* Prefixed to every path in the emitted contract. `ts-rest` only.
|
|
561
576
|
*
|
|
@@ -791,7 +806,16 @@ var GeneratorSchema = import_zod.z.object({
|
|
|
791
806
|
// router validation sharing (orpc, trpc)
|
|
792
807
|
validation: import_zod.z.object({
|
|
793
808
|
useShared: import_zod.z.boolean().default(false).optional(),
|
|
794
|
-
|
|
809
|
+
/**
|
|
810
|
+
* Which validation generator's schemas this generator imports.
|
|
811
|
+
*
|
|
812
|
+
* `typebox` is accepted here and works for exactly one kind, `elysia`, whose validator slot
|
|
813
|
+
* takes a TypeBox schema natively because Elysia's own `t` is TypeBox. Every other router
|
|
814
|
+
* types its validators as a Standard Schema, which TypeBox does not implement, so a router
|
|
815
|
+
* wired to one would type against `any` and validate nothing. Naming it on any other kind is
|
|
816
|
+
* reported below rather than accepted, which is why the enum can be this wide.
|
|
817
|
+
*/
|
|
818
|
+
library: import_zod.z.enum(["zod", "valibot", "arktype", "typebox"]).default("zod").optional(),
|
|
795
819
|
importPath: import_zod.z.string().optional(),
|
|
796
820
|
schemaSuffix: import_zod.z.string().optional(),
|
|
797
821
|
/**
|
|
@@ -962,7 +986,8 @@ var ROUTER_KINDS = /* @__PURE__ */ new Set([
|
|
|
962
986
|
"tanstack-start",
|
|
963
987
|
"h3",
|
|
964
988
|
"effect-http",
|
|
965
|
-
"ts-rest"
|
|
989
|
+
"ts-rest",
|
|
990
|
+
"elysia"
|
|
966
991
|
]);
|
|
967
992
|
var INJECTION_KINDS = /* @__PURE__ */ new Set(["orpc", "trpc"]);
|
|
968
993
|
function trpcOutDir(g, cfg) {
|
|
@@ -1004,6 +1029,15 @@ function effectHttpOutDir(g, cfg) {
|
|
|
1004
1029
|
function tsRestOutDir(g, cfg) {
|
|
1005
1030
|
return g.path ?? cfg.outDir;
|
|
1006
1031
|
}
|
|
1032
|
+
function elysiaOutDir(g, cfg) {
|
|
1033
|
+
return g.path ?? cfg.outDir;
|
|
1034
|
+
}
|
|
1035
|
+
function seedOutDir(g, cfg) {
|
|
1036
|
+
return g.path ?? cfg.outDir;
|
|
1037
|
+
}
|
|
1038
|
+
function fastCheckOutDir(g, cfg) {
|
|
1039
|
+
return g.path ?? cfg.outDir;
|
|
1040
|
+
}
|
|
1007
1041
|
function sharedSchemaNames(opts) {
|
|
1008
1042
|
const resolved = (0, import_validation_core.resolveAffix)(opts);
|
|
1009
1043
|
return import_validation_core.NAME_MODES.map((mode) => (0, import_validation_core.schemaName)(mode, import_validation_core.AFFIX_PROBE_TABLE, resolved));
|
|
@@ -1069,6 +1103,24 @@ function resolveConfig(cfg) {
|
|
|
1069
1103
|
}
|
|
1070
1104
|
continue;
|
|
1071
1105
|
}
|
|
1106
|
+
if (g.validation?.library === "typebox" && g.kind !== "elysia") {
|
|
1107
|
+
warnings.push(
|
|
1108
|
+
`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.`
|
|
1109
|
+
);
|
|
1110
|
+
}
|
|
1111
|
+
if (g.kind === "elysia") {
|
|
1112
|
+
if (g.includeRelations) {
|
|
1113
|
+
warnings.push(
|
|
1114
|
+
`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.`
|
|
1115
|
+
);
|
|
1116
|
+
}
|
|
1117
|
+
const library2 = g.validation?.library ?? "zod";
|
|
1118
|
+
if (!g.validation?.importPath && !generators.some((s) => s.kind === library2)) {
|
|
1119
|
+
warnings.push(
|
|
1120
|
+
`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.`
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1072
1124
|
if (g.kind === "effect-http") {
|
|
1073
1125
|
if (g.validation?.library) {
|
|
1074
1126
|
warnings.push(
|
|
@@ -1301,6 +1353,9 @@ function computeGeneratorOutputDirs(cfg, cwd = process.cwd()) {
|
|
|
1301
1353
|
if (g.kind === "h3") dirs.add(abs(h3OutDir(g, cfg)));
|
|
1302
1354
|
if (g.kind === "effect-http") dirs.add(abs(effectHttpOutDir(g, cfg)));
|
|
1303
1355
|
if (g.kind === "ts-rest") dirs.add(abs(tsRestOutDir(g, cfg)));
|
|
1356
|
+
if (g.kind === "elysia") dirs.add(abs(elysiaOutDir(g, cfg)));
|
|
1357
|
+
if (g.kind === "seed") dirs.add(abs(seedOutDir(g, cfg)));
|
|
1358
|
+
if (g.kind === "fast-check") dirs.add(abs(fastCheckOutDir(g, cfg)));
|
|
1304
1359
|
if (g.kind === "service") dirs.add(abs(g.path ?? "src/services"));
|
|
1305
1360
|
if (g.kind === "zod") dirs.add(abs(g.path ?? "src/validators/zod"));
|
|
1306
1361
|
if (g.kind === "valibot") dirs.add(abs(g.path ?? "src/validators/valibot"));
|
|
@@ -1532,7 +1587,8 @@ function projectRelative2(p) {
|
|
|
1532
1587
|
return p.startsWith("./") ? p.slice(2) : p;
|
|
1533
1588
|
}
|
|
1534
1589
|
function tsRestOptions(g, cfg) {
|
|
1535
|
-
const
|
|
1590
|
+
const configured = g.validation?.library ?? "zod";
|
|
1591
|
+
const library = configured === "typebox" ? "zod" : configured;
|
|
1536
1592
|
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
1537
1593
|
const derived = siblings.length === 1 ? projectRelative2(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS2[library]) : void 0;
|
|
1538
1594
|
return {
|
|
@@ -1552,19 +1608,74 @@ function tsRestOptions(g, cfg) {
|
|
|
1552
1608
|
};
|
|
1553
1609
|
}
|
|
1554
1610
|
|
|
1555
|
-
// src/
|
|
1611
|
+
// src/elysia-options.ts
|
|
1556
1612
|
var VALIDATOR_DEFAULT_DIRS3 = {
|
|
1557
1613
|
zod: "src/validators/zod",
|
|
1558
1614
|
valibot: "src/validators/valibot",
|
|
1559
|
-
arktype: "src/validators/arktype"
|
|
1615
|
+
arktype: "src/validators/arktype",
|
|
1616
|
+
typebox: "src/validators/typebox"
|
|
1560
1617
|
};
|
|
1561
1618
|
function projectRelative3(p) {
|
|
1562
1619
|
return p.startsWith("./") ? p.slice(2) : p;
|
|
1563
1620
|
}
|
|
1564
|
-
function
|
|
1621
|
+
function elysiaOptions(g, cfg) {
|
|
1565
1622
|
const library = g.validation?.library ?? "zod";
|
|
1566
1623
|
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
1567
1624
|
const derived = siblings.length === 1 ? projectRelative3(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS3[library]) : void 0;
|
|
1625
|
+
return {
|
|
1626
|
+
outputDir: elysiaOutDir(g, cfg),
|
|
1627
|
+
appName: g.appName,
|
|
1628
|
+
prefix: g.prefix,
|
|
1629
|
+
naming: g.naming,
|
|
1630
|
+
outputHeader: g.outputHeader,
|
|
1631
|
+
format: g.format,
|
|
1632
|
+
importExtension: g.importExtension,
|
|
1633
|
+
validation: {
|
|
1634
|
+
...g.validation,
|
|
1635
|
+
library,
|
|
1636
|
+
useShared: true,
|
|
1637
|
+
importPath: g.validation?.importPath ?? derived
|
|
1638
|
+
}
|
|
1639
|
+
};
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
// src/seed-options.ts
|
|
1643
|
+
function seedOptions(g, cfg) {
|
|
1644
|
+
return {
|
|
1645
|
+
outputDir: seedOutDir(g, cfg),
|
|
1646
|
+
defaultCount: g.count,
|
|
1647
|
+
naming: g.naming,
|
|
1648
|
+
outputHeader: g.outputHeader,
|
|
1649
|
+
format: g.format,
|
|
1650
|
+
importExtension: g.importExtension
|
|
1651
|
+
};
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
// src/fast-check-options.ts
|
|
1655
|
+
function fastCheckOptions(g, cfg) {
|
|
1656
|
+
return {
|
|
1657
|
+
outputDir: fastCheckOutDir(g, cfg),
|
|
1658
|
+
naming: g.naming,
|
|
1659
|
+
outputHeader: g.outputHeader,
|
|
1660
|
+
format: g.format,
|
|
1661
|
+
importExtension: g.importExtension
|
|
1662
|
+
};
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
// src/h3-options.ts
|
|
1666
|
+
var VALIDATOR_DEFAULT_DIRS4 = {
|
|
1667
|
+
zod: "src/validators/zod",
|
|
1668
|
+
valibot: "src/validators/valibot",
|
|
1669
|
+
arktype: "src/validators/arktype"
|
|
1670
|
+
};
|
|
1671
|
+
function projectRelative4(p) {
|
|
1672
|
+
return p.startsWith("./") ? p.slice(2) : p;
|
|
1673
|
+
}
|
|
1674
|
+
function h3Options(g, cfg) {
|
|
1675
|
+
const configured = g.validation?.library ?? "zod";
|
|
1676
|
+
const library = configured === "typebox" ? "zod" : configured;
|
|
1677
|
+
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
1678
|
+
const derived = siblings.length === 1 ? projectRelative4(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS4[library]) : void 0;
|
|
1568
1679
|
return {
|
|
1569
1680
|
outputDir: h3OutDir(g, cfg),
|
|
1570
1681
|
h3: g.h3,
|
|
@@ -1598,18 +1709,19 @@ function mcpOptions(g, cfg) {
|
|
|
1598
1709
|
}
|
|
1599
1710
|
|
|
1600
1711
|
// src/next-options.ts
|
|
1601
|
-
var
|
|
1712
|
+
var VALIDATOR_DEFAULT_DIRS5 = {
|
|
1602
1713
|
zod: "src/validators/zod",
|
|
1603
1714
|
valibot: "src/validators/valibot",
|
|
1604
1715
|
arktype: "src/validators/arktype"
|
|
1605
1716
|
};
|
|
1606
|
-
function
|
|
1717
|
+
function projectRelative5(p) {
|
|
1607
1718
|
return p.startsWith("./") ? p.slice(2) : p;
|
|
1608
1719
|
}
|
|
1609
1720
|
function nextOptions(g, cfg) {
|
|
1610
|
-
const
|
|
1721
|
+
const configured = g.validation?.library ?? "zod";
|
|
1722
|
+
const library = configured === "typebox" ? "zod" : configured;
|
|
1611
1723
|
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
1612
|
-
const derived = siblings.length === 1 ?
|
|
1724
|
+
const derived = siblings.length === 1 ? projectRelative5(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS5[library]) : void 0;
|
|
1613
1725
|
return {
|
|
1614
1726
|
outputDir: nextOutDir(g, cfg),
|
|
1615
1727
|
naming: g.naming,
|
|
@@ -1626,18 +1738,19 @@ function nextOptions(g, cfg) {
|
|
|
1626
1738
|
}
|
|
1627
1739
|
|
|
1628
1740
|
// src/tanstack-start-options.ts
|
|
1629
|
-
var
|
|
1741
|
+
var VALIDATOR_DEFAULT_DIRS6 = {
|
|
1630
1742
|
zod: "src/validators/zod",
|
|
1631
1743
|
valibot: "src/validators/valibot",
|
|
1632
1744
|
arktype: "src/validators/arktype"
|
|
1633
1745
|
};
|
|
1634
|
-
function
|
|
1746
|
+
function projectRelative6(p) {
|
|
1635
1747
|
return p.startsWith("./") ? p.slice(2) : p;
|
|
1636
1748
|
}
|
|
1637
1749
|
function tanstackStartOptions(g, cfg) {
|
|
1638
|
-
const
|
|
1750
|
+
const configured = g.validation?.library ?? "zod";
|
|
1751
|
+
const library = configured === "typebox" ? "zod" : configured;
|
|
1639
1752
|
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
1640
|
-
const derived = siblings.length === 1 ?
|
|
1753
|
+
const derived = siblings.length === 1 ? projectRelative6(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS6[library]) : void 0;
|
|
1641
1754
|
return {
|
|
1642
1755
|
outputDir: tanstackStartOutDir(g, cfg),
|
|
1643
1756
|
naming: g.naming,
|
|
@@ -1721,7 +1834,7 @@ function trpcOptions(g, cfg, servicesDir) {
|
|
|
1721
1834
|
}
|
|
1722
1835
|
|
|
1723
1836
|
// src/generator-registry.ts
|
|
1724
|
-
var
|
|
1837
|
+
var VALIDATOR_DEFAULT_DIRS7 = {
|
|
1725
1838
|
zod: "src/validators/zod",
|
|
1726
1839
|
valibot: "src/validators/valibot",
|
|
1727
1840
|
arktype: "src/validators/arktype",
|
|
@@ -1866,6 +1979,30 @@ var GENERATORS = [
|
|
|
1866
1979
|
outputDir: (g, cfg) => tsRestOutDir(g, cfg),
|
|
1867
1980
|
options: (g, cfg) => tsRestOptions(g, cfg)
|
|
1868
1981
|
},
|
|
1982
|
+
{
|
|
1983
|
+
kind: "elysia",
|
|
1984
|
+
specifier: "@drzl/generator-elysia",
|
|
1985
|
+
load: () => import("@drzl/generator-elysia"),
|
|
1986
|
+
construct: (m, analysis) => new m.ElysiaGenerator(analysis),
|
|
1987
|
+
outputDir: (g, cfg) => elysiaOutDir(g, cfg),
|
|
1988
|
+
options: (g, cfg) => elysiaOptions(g, cfg)
|
|
1989
|
+
},
|
|
1990
|
+
{
|
|
1991
|
+
kind: "seed",
|
|
1992
|
+
specifier: "@drzl/generator-seed",
|
|
1993
|
+
load: () => import("@drzl/generator-seed"),
|
|
1994
|
+
construct: (m, analysis) => new m.SeedGenerator(analysis),
|
|
1995
|
+
outputDir: (g, cfg) => seedOutDir(g, cfg),
|
|
1996
|
+
options: (g, cfg) => seedOptions(g, cfg)
|
|
1997
|
+
},
|
|
1998
|
+
{
|
|
1999
|
+
kind: "fast-check",
|
|
2000
|
+
specifier: "@drzl/generator-fast-check",
|
|
2001
|
+
load: () => import("@drzl/generator-fast-check"),
|
|
2002
|
+
construct: (m, analysis) => new m.FastCheckGenerator(analysis),
|
|
2003
|
+
outputDir: (g, cfg) => fastCheckOutDir(g, cfg),
|
|
2004
|
+
options: (g, cfg) => fastCheckOptions(g, cfg)
|
|
2005
|
+
},
|
|
1869
2006
|
{
|
|
1870
2007
|
kind: "service",
|
|
1871
2008
|
specifier: "@drzl/generator-service",
|
|
@@ -1879,7 +2016,7 @@ var GENERATORS = [
|
|
|
1879
2016
|
specifier: "@drzl/generator-zod",
|
|
1880
2017
|
load: () => import("@drzl/generator-zod"),
|
|
1881
2018
|
construct: (m, analysis) => new m.ZodGenerator(analysis),
|
|
1882
|
-
outputDir: (g) => g.path ??
|
|
2019
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS7.zod,
|
|
1883
2020
|
// `meta` is zod-only; see `GeneratorCapabilities.meta` for why it is not passed to the other
|
|
1884
2021
|
// four rather than being passed and ignored.
|
|
1885
2022
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, {
|
|
@@ -1893,7 +2030,7 @@ var GENERATORS = [
|
|
|
1893
2030
|
specifier: "@drzl/generator-valibot",
|
|
1894
2031
|
load: () => import("@drzl/generator-valibot"),
|
|
1895
2032
|
construct: (m, analysis) => new m.ValibotGenerator(analysis),
|
|
1896
|
-
outputDir: (g) => g.path ??
|
|
2033
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS7.valibot,
|
|
1897
2034
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, constraints: true })
|
|
1898
2035
|
},
|
|
1899
2036
|
{
|
|
@@ -1901,7 +2038,7 @@ var GENERATORS = [
|
|
|
1901
2038
|
specifier: "@drzl/generator-arktype",
|
|
1902
2039
|
load: () => import("@drzl/generator-arktype"),
|
|
1903
2040
|
construct: (m, analysis) => new m.ArkTypeGenerator(analysis),
|
|
1904
|
-
outputDir: (g) => g.path ??
|
|
2041
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS7.arktype,
|
|
1905
2042
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: false })
|
|
1906
2043
|
},
|
|
1907
2044
|
{
|
|
@@ -1909,7 +2046,7 @@ var GENERATORS = [
|
|
|
1909
2046
|
specifier: "@drzl/generator-typebox",
|
|
1910
2047
|
load: () => import("@drzl/generator-typebox"),
|
|
1911
2048
|
construct: (m, analysis) => new m.TypeBoxGenerator(analysis),
|
|
1912
|
-
outputDir: (g) => g.path ??
|
|
2049
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS7.typebox,
|
|
1913
2050
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, standardSchema: true })
|
|
1914
2051
|
},
|
|
1915
2052
|
{
|
|
@@ -1917,7 +2054,7 @@ var GENERATORS = [
|
|
|
1917
2054
|
specifier: "@drzl/generator-effect",
|
|
1918
2055
|
load: () => import("@drzl/generator-effect"),
|
|
1919
2056
|
construct: (m, analysis) => new m.EffectGenerator(analysis),
|
|
1920
|
-
outputDir: (g) => g.path ??
|
|
2057
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS7.effect,
|
|
1921
2058
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true })
|
|
1922
2059
|
},
|
|
1923
2060
|
{
|
|
@@ -1925,7 +2062,7 @@ var GENERATORS = [
|
|
|
1925
2062
|
specifier: "@drzl/generator-json-schema",
|
|
1926
2063
|
load: () => import("@drzl/generator-json-schema"),
|
|
1927
2064
|
construct: (m, analysis) => new m.JsonSchemaGenerator(analysis),
|
|
1928
|
-
outputDir: (g) => g.path ??
|
|
2065
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS7["json-schema"],
|
|
1929
2066
|
options: (g, cfg, ctx) => jsonSchemaOptions(g, cfg, ctx.outDir)
|
|
1930
2067
|
}
|
|
1931
2068
|
];
|