@drzl/cli 4.30.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/cli.js CHANGED
@@ -29,8 +29,9 @@ import {
29
29
  tableAliases,
30
30
  tableFilterWarnings,
31
31
  tanstackStartOutDir,
32
- trpcOutDir
33
- } from "./chunk-3REB46XD.js";
32
+ trpcOutDir,
33
+ tsRestOutDir
34
+ } from "./chunk-FURPHLQS.js";
34
35
 
35
36
  // src/cli.ts
36
37
  import { qualifiedTableName as qualifiedTableName2, SchemaAnalyzer as SchemaAnalyzer2 } from "@drzl/analyzer";
@@ -379,7 +380,7 @@ function effectHttpOptions(g, cfg) {
379
380
  };
380
381
  }
381
382
 
382
- // src/h3-options.ts
383
+ // src/ts-rest-options.ts
383
384
  var VALIDATOR_DEFAULT_DIRS2 = {
384
385
  zod: "src/validators/zod",
385
386
  valibot: "src/validators/valibot",
@@ -388,10 +389,40 @@ var VALIDATOR_DEFAULT_DIRS2 = {
388
389
  function projectRelative2(p) {
389
390
  return p.startsWith("./") ? p.slice(2) : p;
390
391
  }
391
- function h3Options(g, cfg) {
392
+ function tsRestOptions(g, cfg) {
392
393
  const library = g.validation?.library ?? "zod";
393
394
  const siblings = cfg.generators.filter((s) => s.kind === library);
394
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
+
413
+ // src/h3-options.ts
414
+ var VALIDATOR_DEFAULT_DIRS3 = {
415
+ zod: "src/validators/zod",
416
+ valibot: "src/validators/valibot",
417
+ arktype: "src/validators/arktype"
418
+ };
419
+ function projectRelative3(p) {
420
+ return p.startsWith("./") ? p.slice(2) : p;
421
+ }
422
+ function h3Options(g, cfg) {
423
+ const library = g.validation?.library ?? "zod";
424
+ const siblings = cfg.generators.filter((s) => s.kind === library);
425
+ const derived = siblings.length === 1 ? projectRelative3(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS3[library]) : void 0;
395
426
  return {
396
427
  outputDir: h3OutDir(g, cfg),
397
428
  h3: g.h3,
@@ -425,18 +456,18 @@ function mcpOptions(g, cfg) {
425
456
  }
426
457
 
427
458
  // src/next-options.ts
428
- var VALIDATOR_DEFAULT_DIRS3 = {
459
+ var VALIDATOR_DEFAULT_DIRS4 = {
429
460
  zod: "src/validators/zod",
430
461
  valibot: "src/validators/valibot",
431
462
  arktype: "src/validators/arktype"
432
463
  };
433
- function projectRelative3(p) {
464
+ function projectRelative4(p) {
434
465
  return p.startsWith("./") ? p.slice(2) : p;
435
466
  }
436
467
  function nextOptions(g, cfg) {
437
468
  const library = g.validation?.library ?? "zod";
438
469
  const siblings = cfg.generators.filter((s) => s.kind === library);
439
- const derived = siblings.length === 1 ? projectRelative3(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS3[library]) : void 0;
470
+ const derived = siblings.length === 1 ? projectRelative4(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS4[library]) : void 0;
440
471
  return {
441
472
  outputDir: nextOutDir(g, cfg),
442
473
  naming: g.naming,
@@ -453,18 +484,18 @@ function nextOptions(g, cfg) {
453
484
  }
454
485
 
455
486
  // src/tanstack-start-options.ts
456
- var VALIDATOR_DEFAULT_DIRS4 = {
487
+ var VALIDATOR_DEFAULT_DIRS5 = {
457
488
  zod: "src/validators/zod",
458
489
  valibot: "src/validators/valibot",
459
490
  arktype: "src/validators/arktype"
460
491
  };
461
- function projectRelative4(p) {
492
+ function projectRelative5(p) {
462
493
  return p.startsWith("./") ? p.slice(2) : p;
463
494
  }
464
495
  function tanstackStartOptions(g, cfg) {
465
496
  const library = g.validation?.library ?? "zod";
466
497
  const siblings = cfg.generators.filter((s) => s.kind === library);
467
- const derived = siblings.length === 1 ? projectRelative4(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS4[library]) : void 0;
498
+ const derived = siblings.length === 1 ? projectRelative5(siblings[0].path ?? VALIDATOR_DEFAULT_DIRS5[library]) : void 0;
468
499
  return {
469
500
  outputDir: tanstackStartOutDir(g, cfg),
470
501
  naming: g.naming,
@@ -548,7 +579,7 @@ function trpcOptions(g, cfg, servicesDir) {
548
579
  }
549
580
 
550
581
  // src/generator-registry.ts
551
- var VALIDATOR_DEFAULT_DIRS5 = {
582
+ var VALIDATOR_DEFAULT_DIRS6 = {
552
583
  zod: "src/validators/zod",
553
584
  valibot: "src/validators/valibot",
554
585
  arktype: "src/validators/arktype",
@@ -685,6 +716,14 @@ var GENERATORS = [
685
716
  outputDir: (g, cfg) => effectHttpOutDir(g, cfg),
686
717
  options: (g, cfg) => effectHttpOptions(g, cfg)
687
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
+ },
688
727
  {
689
728
  kind: "service",
690
729
  specifier: "@drzl/generator-service",
@@ -698,7 +737,7 @@ var GENERATORS = [
698
737
  specifier: "@drzl/generator-zod",
699
738
  load: () => import("@drzl/generator-zod"),
700
739
  construct: (m, analysis) => new m.ZodGenerator(analysis),
701
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS5.zod,
740
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS6.zod,
702
741
  // `meta` is zod-only; see `GeneratorCapabilities.meta` for why it is not passed to the other
703
742
  // four rather than being passed and ignored.
704
743
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, {
@@ -712,7 +751,7 @@ var GENERATORS = [
712
751
  specifier: "@drzl/generator-valibot",
713
752
  load: () => import("@drzl/generator-valibot"),
714
753
  construct: (m, analysis) => new m.ValibotGenerator(analysis),
715
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS5.valibot,
754
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS6.valibot,
716
755
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, constraints: true })
717
756
  },
718
757
  {
@@ -720,7 +759,7 @@ var GENERATORS = [
720
759
  specifier: "@drzl/generator-arktype",
721
760
  load: () => import("@drzl/generator-arktype"),
722
761
  construct: (m, analysis) => new m.ArkTypeGenerator(analysis),
723
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS5.arktype,
762
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS6.arktype,
724
763
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: false })
725
764
  },
726
765
  {
@@ -728,7 +767,7 @@ var GENERATORS = [
728
767
  specifier: "@drzl/generator-typebox",
729
768
  load: () => import("@drzl/generator-typebox"),
730
769
  construct: (m, analysis) => new m.TypeBoxGenerator(analysis),
731
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS5.typebox,
770
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS6.typebox,
732
771
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true, standardSchema: true })
733
772
  },
734
773
  {
@@ -736,7 +775,7 @@ var GENERATORS = [
736
775
  specifier: "@drzl/generator-effect",
737
776
  load: () => import("@drzl/generator-effect"),
738
777
  construct: (m, analysis) => new m.EffectGenerator(analysis),
739
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS5.effect,
778
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS6.effect,
740
779
  options: (g, cfg, ctx) => validationOptions(g, cfg, ctx.outDir, { schemaTypes: true })
741
780
  },
742
781
  {
@@ -744,7 +783,7 @@ var GENERATORS = [
744
783
  specifier: "@drzl/generator-json-schema",
745
784
  load: () => import("@drzl/generator-json-schema"),
746
785
  construct: (m, analysis) => new m.JsonSchemaGenerator(analysis),
747
- outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS5["json-schema"],
786
+ outputDir: (g) => g.path ?? VALIDATOR_DEFAULT_DIRS6["json-schema"],
748
787
  options: (g, cfg, ctx) => jsonSchemaOptions(g, cfg, ctx.outDir)
749
788
  }
750
789
  ];