@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/config.cjs CHANGED
@@ -64,7 +64,8 @@ __export(config_exports, {
64
64
  resolveTemplateDirsSync: () => resolveTemplateDirsSync,
65
65
  tableFilterWarnings: () => tableFilterWarnings,
66
66
  tanstackStartOutDir: () => tanstackStartOutDir,
67
- trpcOutDir: () => trpcOutDir
67
+ trpcOutDir: () => trpcOutDir,
68
+ tsRestOutDir: () => tsRestOutDir
68
69
  });
69
70
  module.exports = __toCommonJS(config_exports);
70
71
  var import_validation_core = require("@drzl/validation-core");
@@ -363,6 +364,7 @@ var GeneratorKindSchema = import_zod.z.enum([
363
364
  "mcp",
364
365
  "next",
365
366
  "tanstack-start",
367
+ "ts-rest",
366
368
  "service",
367
369
  "zod",
368
370
  "valibot",
@@ -403,6 +405,17 @@ var GeneratorSchema = import_zod.z.object({
403
405
  h3: import_zod.z.enum(["v1", "v2"]).optional(),
404
406
  /** The identifier the assembled `HttpApi` carries. `effect-http` only, defaults to `'api'`. */
405
407
  apiName: import_zod.z.string().optional(),
408
+ /** The identifier the assembled root contract carries. `ts-rest` only, defaults to `'contract'`. */
409
+ contractName: import_zod.z.string().optional(),
410
+ /**
411
+ * Prefixed to every path in the emitted contract. `ts-rest` only.
412
+ *
413
+ * Passed through to ts-rest's own `c.router(..., { pathPrefix })` rather than written into each
414
+ * path, because ts-rest lifts the prefix into the contract's type: a client derived from the
415
+ * result reports the full path. Writing it into the strings by hand would produce the same
416
+ * requests and a different type.
417
+ */
418
+ pathPrefix: import_zod.z.string().optional(),
406
419
  /** The name and version the emitted MCP server reports at initialize. `mcp` only. */
407
420
  serverName: import_zod.z.string().optional(),
408
421
  serverVersion: import_zod.z.string().optional(),
@@ -802,7 +815,8 @@ var ROUTER_KINDS = /* @__PURE__ */ new Set([
802
815
  "ai",
803
816
  "tanstack-start",
804
817
  "h3",
805
- "effect-http"
818
+ "effect-http",
819
+ "ts-rest"
806
820
  ]);
807
821
  var INJECTION_KINDS = /* @__PURE__ */ new Set(["orpc", "trpc"]);
808
822
  function trpcOutDir(g, cfg) {
@@ -841,6 +855,9 @@ function h3OutDir(g, cfg) {
841
855
  function effectHttpOutDir(g, cfg) {
842
856
  return g.path ?? cfg.outDir;
843
857
  }
858
+ function tsRestOutDir(g, cfg) {
859
+ return g.path ?? cfg.outDir;
860
+ }
844
861
  function sharedSchemaNames(opts) {
845
862
  const resolved = (0, import_validation_core.resolveAffix)(opts);
846
863
  return import_validation_core.NAME_MODES.map((mode) => (0, import_validation_core.schemaName)(mode, import_validation_core.AFFIX_PROBE_TABLE, resolved));
@@ -918,6 +935,19 @@ function resolveConfig(cfg) {
918
935
  );
919
936
  }
920
937
  }
938
+ if (g.kind === "ts-rest") {
939
+ if (g.includeRelations) {
940
+ warnings.push(
941
+ `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.`
942
+ );
943
+ }
944
+ const library2 = g.validation?.library ?? "zod";
945
+ if (!g.validation?.importPath && !generators.some((s) => s.kind === library2)) {
946
+ warnings.push(
947
+ `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.`
948
+ );
949
+ }
950
+ }
921
951
  if (g.kind === "h3") {
922
952
  if (g.includeRelations) {
923
953
  warnings.push(
@@ -1124,6 +1154,7 @@ function computeGeneratorOutputDirs(cfg, cwd = process.cwd()) {
1124
1154
  if (g.kind === "tanstack-start") dirs.add(abs(tanstackStartOutDir(g, cfg)));
1125
1155
  if (g.kind === "h3") dirs.add(abs(h3OutDir(g, cfg)));
1126
1156
  if (g.kind === "effect-http") dirs.add(abs(effectHttpOutDir(g, cfg)));
1157
+ if (g.kind === "ts-rest") dirs.add(abs(tsRestOutDir(g, cfg)));
1127
1158
  if (g.kind === "service") dirs.add(abs(g.path ?? "src/services"));
1128
1159
  if (g.kind === "zod") dirs.add(abs(g.path ?? "src/validators/zod"));
1129
1160
  if (g.kind === "valibot") dirs.add(abs(g.path ?? "src/validators/valibot"));
@@ -1218,6 +1249,7 @@ function computeWatchTargets(cfg, cwd = process.cwd(), source) {
1218
1249
  resolveTemplateDirsSync,
1219
1250
  tableFilterWarnings,
1220
1251
  tanstackStartOutDir,
1221
- trpcOutDir
1252
+ trpcOutDir,
1253
+ tsRestOutDir
1222
1254
  });
1223
1255
  //# sourceMappingURL=config.cjs.map