@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/cli.js
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
configFromKinds,
|
|
12
12
|
displayTableName,
|
|
13
13
|
effectHttpOutDir,
|
|
14
|
+
elysiaOutDir,
|
|
14
15
|
expressOutDir,
|
|
15
16
|
fastifyOutDir,
|
|
16
17
|
filterTables,
|
|
@@ -29,8 +30,9 @@ import {
|
|
|
29
30
|
tableAliases,
|
|
30
31
|
tableFilterWarnings,
|
|
31
32
|
tanstackStartOutDir,
|
|
32
|
-
trpcOutDir
|
|
33
|
-
|
|
33
|
+
trpcOutDir,
|
|
34
|
+
tsRestOutDir
|
|
35
|
+
} from "./chunk-BDIJ6WMG.js";
|
|
34
36
|
|
|
35
37
|
// src/cli.ts
|
|
36
38
|
import { qualifiedTableName as qualifiedTableName2, SchemaAnalyzer as SchemaAnalyzer2 } from "@drzl/analyzer";
|
|
@@ -379,7 +381,7 @@ function effectHttpOptions(g, cfg) {
|
|
|
379
381
|
};
|
|
380
382
|
}
|
|
381
383
|
|
|
382
|
-
// src/
|
|
384
|
+
// src/ts-rest-options.ts
|
|
383
385
|
var VALIDATOR_DEFAULT_DIRS2 = {
|
|
384
386
|
zod: "src/validators/zod",
|
|
385
387
|
valibot: "src/validators/valibot",
|
|
@@ -388,10 +390,73 @@ var VALIDATOR_DEFAULT_DIRS2 = {
|
|
|
388
390
|
function projectRelative2(p) {
|
|
389
391
|
return p.startsWith("./") ? p.slice(2) : p;
|
|
390
392
|
}
|
|
391
|
-
function
|
|
392
|
-
const
|
|
393
|
+
function tsRestOptions(g, cfg) {
|
|
394
|
+
const configured = g.validation?.library ?? "zod";
|
|
395
|
+
const library = configured === "typebox" ? "zod" : configured;
|
|
393
396
|
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
394
397
|
const derived = siblings.length === 1 ? projectRelative2(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS2[library]) : void 0;
|
|
398
|
+
return {
|
|
399
|
+
outputDir: tsRestOutDir(g, cfg),
|
|
400
|
+
contractName: g.contractName,
|
|
401
|
+
pathPrefix: g.pathPrefix,
|
|
402
|
+
naming: g.naming,
|
|
403
|
+
outputHeader: g.outputHeader,
|
|
404
|
+
format: g.format,
|
|
405
|
+
importExtension: g.importExtension,
|
|
406
|
+
validation: {
|
|
407
|
+
...g.validation,
|
|
408
|
+
library,
|
|
409
|
+
useShared: true,
|
|
410
|
+
importPath: g.validation?.importPath ?? derived
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// src/elysia-options.ts
|
|
416
|
+
var VALIDATOR_DEFAULT_DIRS3 = {
|
|
417
|
+
zod: "src/validators/zod",
|
|
418
|
+
valibot: "src/validators/valibot",
|
|
419
|
+
arktype: "src/validators/arktype",
|
|
420
|
+
typebox: "src/validators/typebox"
|
|
421
|
+
};
|
|
422
|
+
function projectRelative3(p) {
|
|
423
|
+
return p.startsWith("./") ? p.slice(2) : p;
|
|
424
|
+
}
|
|
425
|
+
function elysiaOptions(g, cfg) {
|
|
426
|
+
const library = g.validation?.library ?? "zod";
|
|
427
|
+
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
428
|
+
const derived = siblings.length === 1 ? projectRelative3(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS3[library]) : void 0;
|
|
429
|
+
return {
|
|
430
|
+
outputDir: elysiaOutDir(g, cfg),
|
|
431
|
+
appName: g.appName,
|
|
432
|
+
prefix: g.prefix,
|
|
433
|
+
naming: g.naming,
|
|
434
|
+
outputHeader: g.outputHeader,
|
|
435
|
+
format: g.format,
|
|
436
|
+
importExtension: g.importExtension,
|
|
437
|
+
validation: {
|
|
438
|
+
...g.validation,
|
|
439
|
+
library,
|
|
440
|
+
useShared: true,
|
|
441
|
+
importPath: g.validation?.importPath ?? derived
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// src/h3-options.ts
|
|
447
|
+
var VALIDATOR_DEFAULT_DIRS4 = {
|
|
448
|
+
zod: "src/validators/zod",
|
|
449
|
+
valibot: "src/validators/valibot",
|
|
450
|
+
arktype: "src/validators/arktype"
|
|
451
|
+
};
|
|
452
|
+
function projectRelative4(p) {
|
|
453
|
+
return p.startsWith("./") ? p.slice(2) : p;
|
|
454
|
+
}
|
|
455
|
+
function h3Options(g, cfg) {
|
|
456
|
+
const configured = g.validation?.library ?? "zod";
|
|
457
|
+
const library = configured === "typebox" ? "zod" : configured;
|
|
458
|
+
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
459
|
+
const derived = siblings.length === 1 ? projectRelative4(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS4[library]) : void 0;
|
|
395
460
|
return {
|
|
396
461
|
outputDir: h3OutDir(g, cfg),
|
|
397
462
|
h3: g.h3,
|
|
@@ -425,18 +490,19 @@ function mcpOptions(g, cfg) {
|
|
|
425
490
|
}
|
|
426
491
|
|
|
427
492
|
// src/next-options.ts
|
|
428
|
-
var
|
|
493
|
+
var VALIDATOR_DEFAULT_DIRS5 = {
|
|
429
494
|
zod: "src/validators/zod",
|
|
430
495
|
valibot: "src/validators/valibot",
|
|
431
496
|
arktype: "src/validators/arktype"
|
|
432
497
|
};
|
|
433
|
-
function
|
|
498
|
+
function projectRelative5(p) {
|
|
434
499
|
return p.startsWith("./") ? p.slice(2) : p;
|
|
435
500
|
}
|
|
436
501
|
function nextOptions(g, cfg) {
|
|
437
|
-
const
|
|
502
|
+
const configured = g.validation?.library ?? "zod";
|
|
503
|
+
const library = configured === "typebox" ? "zod" : configured;
|
|
438
504
|
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
439
|
-
const derived = siblings.length === 1 ?
|
|
505
|
+
const derived = siblings.length === 1 ? projectRelative5(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS5[library]) : void 0;
|
|
440
506
|
return {
|
|
441
507
|
outputDir: nextOutDir(g, cfg),
|
|
442
508
|
naming: g.naming,
|
|
@@ -453,18 +519,19 @@ function nextOptions(g, cfg) {
|
|
|
453
519
|
}
|
|
454
520
|
|
|
455
521
|
// src/tanstack-start-options.ts
|
|
456
|
-
var
|
|
522
|
+
var VALIDATOR_DEFAULT_DIRS6 = {
|
|
457
523
|
zod: "src/validators/zod",
|
|
458
524
|
valibot: "src/validators/valibot",
|
|
459
525
|
arktype: "src/validators/arktype"
|
|
460
526
|
};
|
|
461
|
-
function
|
|
527
|
+
function projectRelative6(p) {
|
|
462
528
|
return p.startsWith("./") ? p.slice(2) : p;
|
|
463
529
|
}
|
|
464
530
|
function tanstackStartOptions(g, cfg) {
|
|
465
|
-
const
|
|
531
|
+
const configured = g.validation?.library ?? "zod";
|
|
532
|
+
const library = configured === "typebox" ? "zod" : configured;
|
|
466
533
|
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
467
|
-
const derived = siblings.length === 1 ?
|
|
534
|
+
const derived = siblings.length === 1 ? projectRelative6(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS6[library]) : void 0;
|
|
468
535
|
return {
|
|
469
536
|
outputDir: tanstackStartOutDir(g, cfg),
|
|
470
537
|
naming: g.naming,
|
|
@@ -548,7 +615,7 @@ function trpcOptions(g, cfg, servicesDir) {
|
|
|
548
615
|
}
|
|
549
616
|
|
|
550
617
|
// src/generator-registry.ts
|
|
551
|
-
var
|
|
618
|
+
var VALIDATOR_DEFAULT_DIRS7 = {
|
|
552
619
|
zod: "src/validators/zod",
|
|
553
620
|
valibot: "src/validators/valibot",
|
|
554
621
|
arktype: "src/validators/arktype",
|
|
@@ -685,6 +752,22 @@ var GENERATORS = [
|
|
|
685
752
|
outputDir: (g, cfg) => effectHttpOutDir(g, cfg),
|
|
686
753
|
options: (g, cfg) => effectHttpOptions(g, cfg)
|
|
687
754
|
},
|
|
755
|
+
{
|
|
756
|
+
kind: "ts-rest",
|
|
757
|
+
specifier: "@drzl/generator-ts-rest",
|
|
758
|
+
load: () => import("@drzl/generator-ts-rest"),
|
|
759
|
+
construct: (m, analysis) => new m.TsRestGenerator(analysis),
|
|
760
|
+
outputDir: (g, cfg) => tsRestOutDir(g, cfg),
|
|
761
|
+
options: (g, cfg) => tsRestOptions(g, cfg)
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
kind: "elysia",
|
|
765
|
+
specifier: "@drzl/generator-elysia",
|
|
766
|
+
load: () => import("@drzl/generator-elysia"),
|
|
767
|
+
construct: (m, analysis) => new m.ElysiaGenerator(analysis),
|
|
768
|
+
outputDir: (g, cfg) => elysiaOutDir(g, cfg),
|
|
769
|
+
options: (g, cfg) => elysiaOptions(g, cfg)
|
|
770
|
+
},
|
|
688
771
|
{
|
|
689
772
|
kind: "service",
|
|
690
773
|
specifier: "@drzl/generator-service",
|
|
@@ -698,7 +781,7 @@ var GENERATORS = [
|
|
|
698
781
|
specifier: "@drzl/generator-zod",
|
|
699
782
|
load: () => import("@drzl/generator-zod"),
|
|
700
783
|
construct: (m, analysis) => new m.ZodGenerator(analysis),
|
|
701
|
-
outputDir: (g) => g.path ??
|
|
784
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS7.zod,
|
|
702
785
|
// `meta` is zod-only; see `GeneratorCapabilities.meta` for why it is not passed to the other
|
|
703
786
|
// four rather than being passed and ignored.
|
|
704
787
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, {
|
|
@@ -712,7 +795,7 @@ var GENERATORS = [
|
|
|
712
795
|
specifier: "@drzl/generator-valibot",
|
|
713
796
|
load: () => import("@drzl/generator-valibot"),
|
|
714
797
|
construct: (m, analysis) => new m.ValibotGenerator(analysis),
|
|
715
|
-
outputDir: (g) => g.path ??
|
|
798
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS7.valibot,
|
|
716
799
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, constraints: true })
|
|
717
800
|
},
|
|
718
801
|
{
|
|
@@ -720,7 +803,7 @@ var GENERATORS = [
|
|
|
720
803
|
specifier: "@drzl/generator-arktype",
|
|
721
804
|
load: () => import("@drzl/generator-arktype"),
|
|
722
805
|
construct: (m, analysis) => new m.ArkTypeGenerator(analysis),
|
|
723
|
-
outputDir: (g) => g.path ??
|
|
806
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS7.arktype,
|
|
724
807
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: false })
|
|
725
808
|
},
|
|
726
809
|
{
|
|
@@ -728,7 +811,7 @@ var GENERATORS = [
|
|
|
728
811
|
specifier: "@drzl/generator-typebox",
|
|
729
812
|
load: () => import("@drzl/generator-typebox"),
|
|
730
813
|
construct: (m, analysis) => new m.TypeBoxGenerator(analysis),
|
|
731
|
-
outputDir: (g) => g.path ??
|
|
814
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS7.typebox,
|
|
732
815
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, standardSchema: true })
|
|
733
816
|
},
|
|
734
817
|
{
|
|
@@ -736,7 +819,7 @@ var GENERATORS = [
|
|
|
736
819
|
specifier: "@drzl/generator-effect",
|
|
737
820
|
load: () => import("@drzl/generator-effect"),
|
|
738
821
|
construct: (m, analysis) => new m.EffectGenerator(analysis),
|
|
739
|
-
outputDir: (g) => g.path ??
|
|
822
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS7.effect,
|
|
740
823
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true })
|
|
741
824
|
},
|
|
742
825
|
{
|
|
@@ -744,7 +827,7 @@ var GENERATORS = [
|
|
|
744
827
|
specifier: "@drzl/generator-json-schema",
|
|
745
828
|
load: () => import("@drzl/generator-json-schema"),
|
|
746
829
|
construct: (m, analysis) => new m.JsonSchemaGenerator(analysis),
|
|
747
|
-
outputDir: (g) => g.path ??
|
|
830
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS7["json-schema"],
|
|
748
831
|
options: (g, cfg, ctx) => jsonSchemaOptions(g, cfg, ctx.outDir)
|
|
749
832
|
}
|
|
750
833
|
];
|