@drzl/cli 4.29.0 → 4.31.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-WZQV2WVN.js → chunk-FURPHLQS.js} +54 -2
- package/dist/chunk-FURPHLQS.js.map +1 -0
- package/dist/cli.cjs +138 -17
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +91 -18
- package/dist/cli.js.map +1 -1
- package/dist/config.cjs +57 -3
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +38 -3
- package/dist/config.d.ts +38 -3
- package/dist/config.js +7 -3
- package/dist/drzl.config.schema.json +11 -0
- package/package.json +13 -11
- package/dist/chunk-WZQV2WVN.js.map +0 -1
package/dist/cli.cjs
CHANGED
|
@@ -508,10 +508,12 @@ var GeneratorKindSchema = import_zod.z.enum([
|
|
|
508
508
|
"nestjs",
|
|
509
509
|
"graphql",
|
|
510
510
|
"ai",
|
|
511
|
+
"effect-http",
|
|
511
512
|
"h3",
|
|
512
513
|
"mcp",
|
|
513
514
|
"next",
|
|
514
515
|
"tanstack-start",
|
|
516
|
+
"ts-rest",
|
|
515
517
|
"service",
|
|
516
518
|
"zod",
|
|
517
519
|
"valibot",
|
|
@@ -550,6 +552,19 @@ var GeneratorSchema = import_zod.z.object({
|
|
|
550
552
|
* schema directly and carries none.
|
|
551
553
|
*/
|
|
552
554
|
h3: import_zod.z.enum(["v1", "v2"]).optional(),
|
|
555
|
+
/** The identifier the assembled `HttpApi` carries. `effect-http` only, defaults to `'api'`. */
|
|
556
|
+
apiName: import_zod.z.string().optional(),
|
|
557
|
+
/** The identifier the assembled root contract carries. `ts-rest` only, defaults to `'contract'`. */
|
|
558
|
+
contractName: import_zod.z.string().optional(),
|
|
559
|
+
/**
|
|
560
|
+
* Prefixed to every path in the emitted contract. `ts-rest` only.
|
|
561
|
+
*
|
|
562
|
+
* Passed through to ts-rest's own `c.router(..., { pathPrefix })` rather than written into each
|
|
563
|
+
* path, because ts-rest lifts the prefix into the contract's type: a client derived from the
|
|
564
|
+
* result reports the full path. Writing it into the strings by hand would produce the same
|
|
565
|
+
* requests and a different type.
|
|
566
|
+
*/
|
|
567
|
+
pathPrefix: import_zod.z.string().optional(),
|
|
553
568
|
/** The name and version the emitted MCP server reports at initialize. `mcp` only. */
|
|
554
569
|
serverName: import_zod.z.string().optional(),
|
|
555
570
|
serverVersion: import_zod.z.string().optional(),
|
|
@@ -945,7 +960,9 @@ var ROUTER_KINDS = /* @__PURE__ */ new Set([
|
|
|
945
960
|
"next",
|
|
946
961
|
"ai",
|
|
947
962
|
"tanstack-start",
|
|
948
|
-
"h3"
|
|
963
|
+
"h3",
|
|
964
|
+
"effect-http",
|
|
965
|
+
"ts-rest"
|
|
949
966
|
]);
|
|
950
967
|
var INJECTION_KINDS = /* @__PURE__ */ new Set(["orpc", "trpc"]);
|
|
951
968
|
function trpcOutDir(g, cfg) {
|
|
@@ -981,6 +998,12 @@ function tanstackStartOutDir(g, cfg) {
|
|
|
981
998
|
function h3OutDir(g, cfg) {
|
|
982
999
|
return g.path ?? cfg.outDir;
|
|
983
1000
|
}
|
|
1001
|
+
function effectHttpOutDir(g, cfg) {
|
|
1002
|
+
return g.path ?? cfg.outDir;
|
|
1003
|
+
}
|
|
1004
|
+
function tsRestOutDir(g, cfg) {
|
|
1005
|
+
return g.path ?? cfg.outDir;
|
|
1006
|
+
}
|
|
984
1007
|
function sharedSchemaNames(opts) {
|
|
985
1008
|
const resolved = (0, import_validation_core.resolveAffix)(opts);
|
|
986
1009
|
return import_validation_core.NAME_MODES.map((mode) => (0, import_validation_core.schemaName)(mode, import_validation_core.AFFIX_PROBE_TABLE, resolved));
|
|
@@ -1046,6 +1069,31 @@ function resolveConfig(cfg) {
|
|
|
1046
1069
|
}
|
|
1047
1070
|
continue;
|
|
1048
1071
|
}
|
|
1072
|
+
if (g.kind === "effect-http") {
|
|
1073
|
+
if (g.validation?.library) {
|
|
1074
|
+
warnings.push(
|
|
1075
|
+
`drzl config: the "effect-http" generator sets validation.library, which it does not read. HttpApi declares its payloads as Effect Schema and takes nothing else, so there is no library to choose. Remove the key.`
|
|
1076
|
+
);
|
|
1077
|
+
}
|
|
1078
|
+
if (!g.validation?.importPath && !generators.some((s) => s.kind === "effect")) {
|
|
1079
|
+
warnings.push(
|
|
1080
|
+
`drzl config: the "effect-http" generator declares the Effect Schema modules a validation generator writes, and this config has no "effect" generator for it to import from. Add { kind: "effect" }, or set validation.importPath to wherever those schemas live.`
|
|
1081
|
+
);
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
if (g.kind === "ts-rest") {
|
|
1085
|
+
if (g.includeRelations) {
|
|
1086
|
+
warnings.push(
|
|
1087
|
+
`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.`
|
|
1088
|
+
);
|
|
1089
|
+
}
|
|
1090
|
+
const library2 = g.validation?.library ?? "zod";
|
|
1091
|
+
if (!g.validation?.importPath && !generators.some((s) => s.kind === library2)) {
|
|
1092
|
+
warnings.push(
|
|
1093
|
+
`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.`
|
|
1094
|
+
);
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1049
1097
|
if (g.kind === "h3") {
|
|
1050
1098
|
if (g.includeRelations) {
|
|
1051
1099
|
warnings.push(
|
|
@@ -1251,6 +1299,8 @@ function computeGeneratorOutputDirs(cfg, cwd = process.cwd()) {
|
|
|
1251
1299
|
if (g.kind === "ai") dirs.add(abs(aiOutDir(g, cfg)));
|
|
1252
1300
|
if (g.kind === "tanstack-start") dirs.add(abs(tanstackStartOutDir(g, cfg)));
|
|
1253
1301
|
if (g.kind === "h3") dirs.add(abs(h3OutDir(g, cfg)));
|
|
1302
|
+
if (g.kind === "effect-http") dirs.add(abs(effectHttpOutDir(g, cfg)));
|
|
1303
|
+
if (g.kind === "ts-rest") dirs.add(abs(tsRestOutDir(g, cfg)));
|
|
1254
1304
|
if (g.kind === "service") dirs.add(abs(g.path ?? "src/services"));
|
|
1255
1305
|
if (g.kind === "zod") dirs.add(abs(g.path ?? "src/validators/zod"));
|
|
1256
1306
|
if (g.kind === "valibot") dirs.add(abs(g.path ?? "src/validators/valibot"));
|
|
@@ -1447,19 +1497,74 @@ function aiOptions(g, cfg) {
|
|
|
1447
1497
|
};
|
|
1448
1498
|
}
|
|
1449
1499
|
|
|
1500
|
+
// src/effect-http-options.ts
|
|
1501
|
+
var VALIDATOR_DEFAULT_DIRS = { effect: "src/validators/effect" };
|
|
1502
|
+
function projectRelative(p) {
|
|
1503
|
+
return p.startsWith("./") ? p.slice(2) : p;
|
|
1504
|
+
}
|
|
1505
|
+
function effectHttpOptions(g, cfg) {
|
|
1506
|
+
const library = "effect";
|
|
1507
|
+
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
1508
|
+
const derived = siblings.length === 1 ? projectRelative(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS[library]) : void 0;
|
|
1509
|
+
return {
|
|
1510
|
+
outputDir: effectHttpOutDir(g, cfg),
|
|
1511
|
+
apiName: g.apiName,
|
|
1512
|
+
naming: g.naming,
|
|
1513
|
+
outputHeader: g.outputHeader,
|
|
1514
|
+
format: g.format,
|
|
1515
|
+
importExtension: g.importExtension,
|
|
1516
|
+
validation: {
|
|
1517
|
+
...g.validation,
|
|
1518
|
+
library,
|
|
1519
|
+
useShared: true,
|
|
1520
|
+
importPath: g.validation?.importPath ?? derived
|
|
1521
|
+
}
|
|
1522
|
+
};
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
// src/ts-rest-options.ts
|
|
1526
|
+
var VALIDATOR_DEFAULT_DIRS2 = {
|
|
1527
|
+
zod: "src/validators/zod",
|
|
1528
|
+
valibot: "src/validators/valibot",
|
|
1529
|
+
arktype: "src/validators/arktype"
|
|
1530
|
+
};
|
|
1531
|
+
function projectRelative2(p) {
|
|
1532
|
+
return p.startsWith("./") ? p.slice(2) : p;
|
|
1533
|
+
}
|
|
1534
|
+
function tsRestOptions(g, cfg) {
|
|
1535
|
+
const library = g.validation?.library ?? "zod";
|
|
1536
|
+
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
1537
|
+
const derived = siblings.length === 1 ? projectRelative2(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS2[library]) : void 0;
|
|
1538
|
+
return {
|
|
1539
|
+
outputDir: tsRestOutDir(g, cfg),
|
|
1540
|
+
contractName: g.contractName,
|
|
1541
|
+
pathPrefix: g.pathPrefix,
|
|
1542
|
+
naming: g.naming,
|
|
1543
|
+
outputHeader: g.outputHeader,
|
|
1544
|
+
format: g.format,
|
|
1545
|
+
importExtension: g.importExtension,
|
|
1546
|
+
validation: {
|
|
1547
|
+
...g.validation,
|
|
1548
|
+
library,
|
|
1549
|
+
useShared: true,
|
|
1550
|
+
importPath: g.validation?.importPath ?? derived
|
|
1551
|
+
}
|
|
1552
|
+
};
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1450
1555
|
// src/h3-options.ts
|
|
1451
|
-
var
|
|
1556
|
+
var VALIDATOR_DEFAULT_DIRS3 = {
|
|
1452
1557
|
zod: "src/validators/zod",
|
|
1453
1558
|
valibot: "src/validators/valibot",
|
|
1454
1559
|
arktype: "src/validators/arktype"
|
|
1455
1560
|
};
|
|
1456
|
-
function
|
|
1561
|
+
function projectRelative3(p) {
|
|
1457
1562
|
return p.startsWith("./") ? p.slice(2) : p;
|
|
1458
1563
|
}
|
|
1459
1564
|
function h3Options(g, cfg) {
|
|
1460
1565
|
const library = g.validation?.library ?? "zod";
|
|
1461
1566
|
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
1462
|
-
const derived = siblings.length === 1 ?
|
|
1567
|
+
const derived = siblings.length === 1 ? projectRelative3(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS3[library]) : void 0;
|
|
1463
1568
|
return {
|
|
1464
1569
|
outputDir: h3OutDir(g, cfg),
|
|
1465
1570
|
h3: g.h3,
|
|
@@ -1493,18 +1598,18 @@ function mcpOptions(g, cfg) {
|
|
|
1493
1598
|
}
|
|
1494
1599
|
|
|
1495
1600
|
// src/next-options.ts
|
|
1496
|
-
var
|
|
1601
|
+
var VALIDATOR_DEFAULT_DIRS4 = {
|
|
1497
1602
|
zod: "src/validators/zod",
|
|
1498
1603
|
valibot: "src/validators/valibot",
|
|
1499
1604
|
arktype: "src/validators/arktype"
|
|
1500
1605
|
};
|
|
1501
|
-
function
|
|
1606
|
+
function projectRelative4(p) {
|
|
1502
1607
|
return p.startsWith("./") ? p.slice(2) : p;
|
|
1503
1608
|
}
|
|
1504
1609
|
function nextOptions(g, cfg) {
|
|
1505
1610
|
const library = g.validation?.library ?? "zod";
|
|
1506
1611
|
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
1507
|
-
const derived = siblings.length === 1 ?
|
|
1612
|
+
const derived = siblings.length === 1 ? projectRelative4(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS4[library]) : void 0;
|
|
1508
1613
|
return {
|
|
1509
1614
|
outputDir: nextOutDir(g, cfg),
|
|
1510
1615
|
naming: g.naming,
|
|
@@ -1521,18 +1626,18 @@ function nextOptions(g, cfg) {
|
|
|
1521
1626
|
}
|
|
1522
1627
|
|
|
1523
1628
|
// src/tanstack-start-options.ts
|
|
1524
|
-
var
|
|
1629
|
+
var VALIDATOR_DEFAULT_DIRS5 = {
|
|
1525
1630
|
zod: "src/validators/zod",
|
|
1526
1631
|
valibot: "src/validators/valibot",
|
|
1527
1632
|
arktype: "src/validators/arktype"
|
|
1528
1633
|
};
|
|
1529
|
-
function
|
|
1634
|
+
function projectRelative5(p) {
|
|
1530
1635
|
return p.startsWith("./") ? p.slice(2) : p;
|
|
1531
1636
|
}
|
|
1532
1637
|
function tanstackStartOptions(g, cfg) {
|
|
1533
1638
|
const library = g.validation?.library ?? "zod";
|
|
1534
1639
|
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
1535
|
-
const derived = siblings.length === 1 ?
|
|
1640
|
+
const derived = siblings.length === 1 ? projectRelative5(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS5[library]) : void 0;
|
|
1536
1641
|
return {
|
|
1537
1642
|
outputDir: tanstackStartOutDir(g, cfg),
|
|
1538
1643
|
naming: g.naming,
|
|
@@ -1616,7 +1721,7 @@ function trpcOptions(g, cfg, servicesDir) {
|
|
|
1616
1721
|
}
|
|
1617
1722
|
|
|
1618
1723
|
// src/generator-registry.ts
|
|
1619
|
-
var
|
|
1724
|
+
var VALIDATOR_DEFAULT_DIRS6 = {
|
|
1620
1725
|
zod: "src/validators/zod",
|
|
1621
1726
|
valibot: "src/validators/valibot",
|
|
1622
1727
|
arktype: "src/validators/arktype",
|
|
@@ -1745,6 +1850,22 @@ var GENERATORS = [
|
|
|
1745
1850
|
outputDir: (g, cfg) => h3OutDir(g, cfg),
|
|
1746
1851
|
options: (g, cfg) => h3Options(g, cfg)
|
|
1747
1852
|
},
|
|
1853
|
+
{
|
|
1854
|
+
kind: "effect-http",
|
|
1855
|
+
specifier: "@drzl/generator-effect-http",
|
|
1856
|
+
load: () => import("@drzl/generator-effect-http"),
|
|
1857
|
+
construct: (m, analysis) => new m.EffectHttpGenerator(analysis),
|
|
1858
|
+
outputDir: (g, cfg) => effectHttpOutDir(g, cfg),
|
|
1859
|
+
options: (g, cfg) => effectHttpOptions(g, cfg)
|
|
1860
|
+
},
|
|
1861
|
+
{
|
|
1862
|
+
kind: "ts-rest",
|
|
1863
|
+
specifier: "@drzl/generator-ts-rest",
|
|
1864
|
+
load: () => import("@drzl/generator-ts-rest"),
|
|
1865
|
+
construct: (m, analysis) => new m.TsRestGenerator(analysis),
|
|
1866
|
+
outputDir: (g, cfg) => tsRestOutDir(g, cfg),
|
|
1867
|
+
options: (g, cfg) => tsRestOptions(g, cfg)
|
|
1868
|
+
},
|
|
1748
1869
|
{
|
|
1749
1870
|
kind: "service",
|
|
1750
1871
|
specifier: "@drzl/generator-service",
|
|
@@ -1758,7 +1879,7 @@ var GENERATORS = [
|
|
|
1758
1879
|
specifier: "@drzl/generator-zod",
|
|
1759
1880
|
load: () => import("@drzl/generator-zod"),
|
|
1760
1881
|
construct: (m, analysis) => new m.ZodGenerator(analysis),
|
|
1761
|
-
outputDir: (g) => g.path ??
|
|
1882
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS6.zod,
|
|
1762
1883
|
// `meta` is zod-only; see `GeneratorCapabilities.meta` for why it is not passed to the other
|
|
1763
1884
|
// four rather than being passed and ignored.
|
|
1764
1885
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, {
|
|
@@ -1772,7 +1893,7 @@ var GENERATORS = [
|
|
|
1772
1893
|
specifier: "@drzl/generator-valibot",
|
|
1773
1894
|
load: () => import("@drzl/generator-valibot"),
|
|
1774
1895
|
construct: (m, analysis) => new m.ValibotGenerator(analysis),
|
|
1775
|
-
outputDir: (g) => g.path ??
|
|
1896
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS6.valibot,
|
|
1776
1897
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, constraints: true })
|
|
1777
1898
|
},
|
|
1778
1899
|
{
|
|
@@ -1780,7 +1901,7 @@ var GENERATORS = [
|
|
|
1780
1901
|
specifier: "@drzl/generator-arktype",
|
|
1781
1902
|
load: () => import("@drzl/generator-arktype"),
|
|
1782
1903
|
construct: (m, analysis) => new m.ArkTypeGenerator(analysis),
|
|
1783
|
-
outputDir: (g) => g.path ??
|
|
1904
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS6.arktype,
|
|
1784
1905
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: false })
|
|
1785
1906
|
},
|
|
1786
1907
|
{
|
|
@@ -1788,7 +1909,7 @@ var GENERATORS = [
|
|
|
1788
1909
|
specifier: "@drzl/generator-typebox",
|
|
1789
1910
|
load: () => import("@drzl/generator-typebox"),
|
|
1790
1911
|
construct: (m, analysis) => new m.TypeBoxGenerator(analysis),
|
|
1791
|
-
outputDir: (g) => g.path ??
|
|
1912
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS6.typebox,
|
|
1792
1913
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, standardSchema: true })
|
|
1793
1914
|
},
|
|
1794
1915
|
{
|
|
@@ -1796,7 +1917,7 @@ var GENERATORS = [
|
|
|
1796
1917
|
specifier: "@drzl/generator-effect",
|
|
1797
1918
|
load: () => import("@drzl/generator-effect"),
|
|
1798
1919
|
construct: (m, analysis) => new m.EffectGenerator(analysis),
|
|
1799
|
-
outputDir: (g) => g.path ??
|
|
1920
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS6.effect,
|
|
1800
1921
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true })
|
|
1801
1922
|
},
|
|
1802
1923
|
{
|
|
@@ -1804,7 +1925,7 @@ var GENERATORS = [
|
|
|
1804
1925
|
specifier: "@drzl/generator-json-schema",
|
|
1805
1926
|
load: () => import("@drzl/generator-json-schema"),
|
|
1806
1927
|
construct: (m, analysis) => new m.JsonSchemaGenerator(analysis),
|
|
1807
|
-
outputDir: (g) => g.path ??
|
|
1928
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS6["json-schema"],
|
|
1808
1929
|
options: (g, cfg, ctx) => jsonSchemaOptions(g, cfg, ctx.outDir)
|
|
1809
1930
|
}
|
|
1810
1931
|
];
|