@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.js
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
computeWatchTargets,
|
|
11
11
|
configFromKinds,
|
|
12
12
|
displayTableName,
|
|
13
|
+
effectHttpOutDir,
|
|
13
14
|
expressOutDir,
|
|
14
15
|
fastifyOutDir,
|
|
15
16
|
filterTables,
|
|
@@ -28,8 +29,9 @@ import {
|
|
|
28
29
|
tableAliases,
|
|
29
30
|
tableFilterWarnings,
|
|
30
31
|
tanstackStartOutDir,
|
|
31
|
-
trpcOutDir
|
|
32
|
-
|
|
32
|
+
trpcOutDir,
|
|
33
|
+
tsRestOutDir
|
|
34
|
+
} from "./chunk-FURPHLQS.js";
|
|
33
35
|
|
|
34
36
|
// src/cli.ts
|
|
35
37
|
import { qualifiedTableName as qualifiedTableName2, SchemaAnalyzer as SchemaAnalyzer2 } from "@drzl/analyzer";
|
|
@@ -353,19 +355,74 @@ function aiOptions(g, cfg) {
|
|
|
353
355
|
};
|
|
354
356
|
}
|
|
355
357
|
|
|
358
|
+
// src/effect-http-options.ts
|
|
359
|
+
var VALIDATOR_DEFAULT_DIRS = { effect: "src/validators/effect" };
|
|
360
|
+
function projectRelative(p) {
|
|
361
|
+
return p.startsWith("./") ? p.slice(2) : p;
|
|
362
|
+
}
|
|
363
|
+
function effectHttpOptions(g, cfg) {
|
|
364
|
+
const library = "effect";
|
|
365
|
+
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
366
|
+
const derived = siblings.length === 1 ? projectRelative(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS[library]) : void 0;
|
|
367
|
+
return {
|
|
368
|
+
outputDir: effectHttpOutDir(g, cfg),
|
|
369
|
+
apiName: g.apiName,
|
|
370
|
+
naming: g.naming,
|
|
371
|
+
outputHeader: g.outputHeader,
|
|
372
|
+
format: g.format,
|
|
373
|
+
importExtension: g.importExtension,
|
|
374
|
+
validation: {
|
|
375
|
+
...g.validation,
|
|
376
|
+
library,
|
|
377
|
+
useShared: true,
|
|
378
|
+
importPath: g.validation?.importPath ?? derived
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// src/ts-rest-options.ts
|
|
384
|
+
var VALIDATOR_DEFAULT_DIRS2 = {
|
|
385
|
+
zod: "src/validators/zod",
|
|
386
|
+
valibot: "src/validators/valibot",
|
|
387
|
+
arktype: "src/validators/arktype"
|
|
388
|
+
};
|
|
389
|
+
function projectRelative2(p) {
|
|
390
|
+
return p.startsWith("./") ? p.slice(2) : p;
|
|
391
|
+
}
|
|
392
|
+
function tsRestOptions(g, cfg) {
|
|
393
|
+
const library = g.validation?.library ?? "zod";
|
|
394
|
+
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
395
|
+
const derived = siblings.length === 1 ? projectRelative2(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS2[library]) : void 0;
|
|
396
|
+
return {
|
|
397
|
+
outputDir: tsRestOutDir(g, cfg),
|
|
398
|
+
contractName: g.contractName,
|
|
399
|
+
pathPrefix: g.pathPrefix,
|
|
400
|
+
naming: g.naming,
|
|
401
|
+
outputHeader: g.outputHeader,
|
|
402
|
+
format: g.format,
|
|
403
|
+
importExtension: g.importExtension,
|
|
404
|
+
validation: {
|
|
405
|
+
...g.validation,
|
|
406
|
+
library,
|
|
407
|
+
useShared: true,
|
|
408
|
+
importPath: g.validation?.importPath ?? derived
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
|
|
356
413
|
// src/h3-options.ts
|
|
357
|
-
var
|
|
414
|
+
var VALIDATOR_DEFAULT_DIRS3 = {
|
|
358
415
|
zod: "src/validators/zod",
|
|
359
416
|
valibot: "src/validators/valibot",
|
|
360
417
|
arktype: "src/validators/arktype"
|
|
361
418
|
};
|
|
362
|
-
function
|
|
419
|
+
function projectRelative3(p) {
|
|
363
420
|
return p.startsWith("./") ? p.slice(2) : p;
|
|
364
421
|
}
|
|
365
422
|
function h3Options(g, cfg) {
|
|
366
423
|
const library = g.validation?.library ?? "zod";
|
|
367
424
|
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
368
|
-
const derived = siblings.length === 1 ?
|
|
425
|
+
const derived = siblings.length === 1 ? projectRelative3(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS3[library]) : void 0;
|
|
369
426
|
return {
|
|
370
427
|
outputDir: h3OutDir(g, cfg),
|
|
371
428
|
h3: g.h3,
|
|
@@ -399,18 +456,18 @@ function mcpOptions(g, cfg) {
|
|
|
399
456
|
}
|
|
400
457
|
|
|
401
458
|
// src/next-options.ts
|
|
402
|
-
var
|
|
459
|
+
var VALIDATOR_DEFAULT_DIRS4 = {
|
|
403
460
|
zod: "src/validators/zod",
|
|
404
461
|
valibot: "src/validators/valibot",
|
|
405
462
|
arktype: "src/validators/arktype"
|
|
406
463
|
};
|
|
407
|
-
function
|
|
464
|
+
function projectRelative4(p) {
|
|
408
465
|
return p.startsWith("./") ? p.slice(2) : p;
|
|
409
466
|
}
|
|
410
467
|
function nextOptions(g, cfg) {
|
|
411
468
|
const library = g.validation?.library ?? "zod";
|
|
412
469
|
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
413
|
-
const derived = siblings.length === 1 ?
|
|
470
|
+
const derived = siblings.length === 1 ? projectRelative4(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS4[library]) : void 0;
|
|
414
471
|
return {
|
|
415
472
|
outputDir: nextOutDir(g, cfg),
|
|
416
473
|
naming: g.naming,
|
|
@@ -427,18 +484,18 @@ function nextOptions(g, cfg) {
|
|
|
427
484
|
}
|
|
428
485
|
|
|
429
486
|
// src/tanstack-start-options.ts
|
|
430
|
-
var
|
|
487
|
+
var VALIDATOR_DEFAULT_DIRS5 = {
|
|
431
488
|
zod: "src/validators/zod",
|
|
432
489
|
valibot: "src/validators/valibot",
|
|
433
490
|
arktype: "src/validators/arktype"
|
|
434
491
|
};
|
|
435
|
-
function
|
|
492
|
+
function projectRelative5(p) {
|
|
436
493
|
return p.startsWith("./") ? p.slice(2) : p;
|
|
437
494
|
}
|
|
438
495
|
function tanstackStartOptions(g, cfg) {
|
|
439
496
|
const library = g.validation?.library ?? "zod";
|
|
440
497
|
const siblings = cfg.generators.filter((s) => s.kind === library);
|
|
441
|
-
const derived = siblings.length === 1 ?
|
|
498
|
+
const derived = siblings.length === 1 ? projectRelative5(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS5[library]) : void 0;
|
|
442
499
|
return {
|
|
443
500
|
outputDir: tanstackStartOutDir(g, cfg),
|
|
444
501
|
naming: g.naming,
|
|
@@ -522,7 +579,7 @@ function trpcOptions(g, cfg, servicesDir) {
|
|
|
522
579
|
}
|
|
523
580
|
|
|
524
581
|
// src/generator-registry.ts
|
|
525
|
-
var
|
|
582
|
+
var VALIDATOR_DEFAULT_DIRS6 = {
|
|
526
583
|
zod: "src/validators/zod",
|
|
527
584
|
valibot: "src/validators/valibot",
|
|
528
585
|
arktype: "src/validators/arktype",
|
|
@@ -651,6 +708,22 @@ var GENERATORS = [
|
|
|
651
708
|
outputDir: (g, cfg) => h3OutDir(g, cfg),
|
|
652
709
|
options: (g, cfg) => h3Options(g, cfg)
|
|
653
710
|
},
|
|
711
|
+
{
|
|
712
|
+
kind: "effect-http",
|
|
713
|
+
specifier: "@drzl/generator-effect-http",
|
|
714
|
+
load: () => import("@drzl/generator-effect-http"),
|
|
715
|
+
construct: (m, analysis) => new m.EffectHttpGenerator(analysis),
|
|
716
|
+
outputDir: (g, cfg) => effectHttpOutDir(g, cfg),
|
|
717
|
+
options: (g, cfg) => effectHttpOptions(g, cfg)
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
kind: "ts-rest",
|
|
721
|
+
specifier: "@drzl/generator-ts-rest",
|
|
722
|
+
load: () => import("@drzl/generator-ts-rest"),
|
|
723
|
+
construct: (m, analysis) => new m.TsRestGenerator(analysis),
|
|
724
|
+
outputDir: (g, cfg) => tsRestOutDir(g, cfg),
|
|
725
|
+
options: (g, cfg) => tsRestOptions(g, cfg)
|
|
726
|
+
},
|
|
654
727
|
{
|
|
655
728
|
kind: "service",
|
|
656
729
|
specifier: "@drzl/generator-service",
|
|
@@ -664,7 +737,7 @@ var GENERATORS = [
|
|
|
664
737
|
specifier: "@drzl/generator-zod",
|
|
665
738
|
load: () => import("@drzl/generator-zod"),
|
|
666
739
|
construct: (m, analysis) => new m.ZodGenerator(analysis),
|
|
667
|
-
outputDir: (g) => g.path ??
|
|
740
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS6.zod,
|
|
668
741
|
// `meta` is zod-only; see `GeneratorCapabilities.meta` for why it is not passed to the other
|
|
669
742
|
// four rather than being passed and ignored.
|
|
670
743
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, {
|
|
@@ -678,7 +751,7 @@ var GENERATORS = [
|
|
|
678
751
|
specifier: "@drzl/generator-valibot",
|
|
679
752
|
load: () => import("@drzl/generator-valibot"),
|
|
680
753
|
construct: (m, analysis) => new m.ValibotGenerator(analysis),
|
|
681
|
-
outputDir: (g) => g.path ??
|
|
754
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS6.valibot,
|
|
682
755
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, constraints: true })
|
|
683
756
|
},
|
|
684
757
|
{
|
|
@@ -686,7 +759,7 @@ var GENERATORS = [
|
|
|
686
759
|
specifier: "@drzl/generator-arktype",
|
|
687
760
|
load: () => import("@drzl/generator-arktype"),
|
|
688
761
|
construct: (m, analysis) => new m.ArkTypeGenerator(analysis),
|
|
689
|
-
outputDir: (g) => g.path ??
|
|
762
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS6.arktype,
|
|
690
763
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: false })
|
|
691
764
|
},
|
|
692
765
|
{
|
|
@@ -694,7 +767,7 @@ var GENERATORS = [
|
|
|
694
767
|
specifier: "@drzl/generator-typebox",
|
|
695
768
|
load: () => import("@drzl/generator-typebox"),
|
|
696
769
|
construct: (m, analysis) => new m.TypeBoxGenerator(analysis),
|
|
697
|
-
outputDir: (g) => g.path ??
|
|
770
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS6.typebox,
|
|
698
771
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, standardSchema: true })
|
|
699
772
|
},
|
|
700
773
|
{
|
|
@@ -702,7 +775,7 @@ var GENERATORS = [
|
|
|
702
775
|
specifier: "@drzl/generator-effect",
|
|
703
776
|
load: () => import("@drzl/generator-effect"),
|
|
704
777
|
construct: (m, analysis) => new m.EffectGenerator(analysis),
|
|
705
|
-
outputDir: (g) => g.path ??
|
|
778
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS6.effect,
|
|
706
779
|
options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true })
|
|
707
780
|
},
|
|
708
781
|
{
|
|
@@ -710,7 +783,7 @@ var GENERATORS = [
|
|
|
710
783
|
specifier: "@drzl/generator-json-schema",
|
|
711
784
|
load: () => import("@drzl/generator-json-schema"),
|
|
712
785
|
construct: (m, analysis) => new m.JsonSchemaGenerator(analysis),
|
|
713
|
-
outputDir: (g) => g.path ??
|
|
786
|
+
outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS6["json-schema"],
|
|
714
787
|
options: (g, cfg, ctx) => jsonSchemaOptions(g, cfg, ctx.outDir)
|
|
715
788
|
}
|
|
716
789
|
];
|