@drzl/cli 4.35.0 → 4.37.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
@@ -54,6 +54,7 @@ __export(config_exports, {
54
54
  fastCheckOutDir: () => fastCheckOutDir,
55
55
  fastifyOutDir: () => fastifyOutDir,
56
56
  filterTables: () => filterTables,
57
+ formsOutDir: () => formsOutDir,
57
58
  graphqlOutDir: () => graphqlOutDir,
58
59
  h3OutDir: () => h3OutDir,
59
60
  honoOutDir: () => honoOutDir,
@@ -62,6 +63,7 @@ __export(config_exports, {
62
63
  mcpOutDir: () => mcpOutDir,
63
64
  nestjsOutDir: () => nestjsOutDir,
64
65
  nextOutDir: () => nextOutDir,
66
+ openApiFetchOutDir: () => openApiFetchOutDir,
65
67
  resolveConfig: () => resolveConfig,
66
68
  resolveTemplateDirsSync: () => resolveTemplateDirsSync,
67
69
  seedOutDir: () => seedOutDir,
@@ -369,6 +371,8 @@ var GeneratorKindSchema = import_zod.z.enum([
369
371
  "next",
370
372
  "tanstack-start",
371
373
  "ts-rest",
374
+ "openapi-fetch",
375
+ "forms",
372
376
  "seed",
373
377
  "fast-check",
374
378
  "service",
@@ -415,6 +419,13 @@ var GeneratorSchema = import_zod.z.object({
415
419
  contractName: import_zod.z.string().optional(),
416
420
  /** The identifier the assembled Elysia app is exported as. `elysia` only, defaults to `'app'`. */
417
421
  appName: import_zod.z.string().optional(),
422
+ /**
423
+ * The factory the emitted client exports. `openapi-fetch` only, defaults to `'createApiClient'`.
424
+ *
425
+ * A factory rather than a constructed client, because a client carries a `baseUrl` and a `fetch`
426
+ * and neither is a fact about a Drizzle schema.
427
+ */
428
+ clientName: import_zod.z.string().optional(),
418
429
  /** How many rows each generated seed function returns by default. `seed` only, defaults to 10. */
419
430
  count: import_zod.z.number().int().positive().optional(),
420
431
  /**
@@ -524,7 +535,24 @@ var GeneratorSchema = import_zod.z.object({
524
535
  */
525
536
  meta: import_zod.z.union([
526
537
  import_zod.z.boolean(),
527
- import_zod.z.object({ enabled: import_zod.z.boolean().optional(), description: import_zod.z.boolean().optional() }).strict()
538
+ import_zod.z.object({
539
+ enabled: import_zod.z.boolean().optional(),
540
+ description: import_zod.z.boolean().optional(),
541
+ /**
542
+ * Also give each schema an `id`, which registers it in zod's registry under that name.
543
+ *
544
+ * `z.toJSONSchema` then emits `$ref: '#/$defs/<id>'` wherever one schema references
545
+ * another instead of inlining a copy, and `z.toJSONSchema(z.globalRegistry)` returns a
546
+ * `{ schemas: { <id>: ... } }` bundle, which is what makes a generated document
547
+ * self-describing.
548
+ *
549
+ * Off by default because it is the one metadata key with a failure mode. Measured on zod
550
+ * 4.4.3, two schemas sharing an id make a registry dump silently drop one of them, with
551
+ * no warning. The id is built from the qualified table name, so an analysis cannot
552
+ * produce two the same.
553
+ */
554
+ registryIds: import_zod.z.boolean().optional()
555
+ }).strict()
528
556
  ]).optional(),
529
557
  /**
530
558
  * TypeBox only. Give every emitted schema a `~standard` key, so it can be handed to a tRPC or
@@ -597,7 +625,28 @@ var GeneratorSchema = import_zod.z.object({
597
625
  * in JSON Schema, it is ignored, so emitting the wrong dialect produces a document that
598
626
  * validates and then accepts the values the constraints exist to reject.
599
627
  */
600
- target: import_zod.z.enum(["draft-2020-12", "openapi-3.1", "openapi-3.0"]).optional(),
628
+ /**
629
+ * The `forms` generator reads the same key with its own values: which form library to emit for,
630
+ * defaulting to `react-hook-form`. One key, two kinds, as `document` already is for
631
+ * `json-schema` and `openapi-fetch`. A value from the wrong set on the wrong kind is reported
632
+ * by that generator rather than accepted, since neither shares a value with the other.
633
+ */
634
+ target: import_zod.z.enum([
635
+ "draft-2020-12",
636
+ "openapi-3.1",
637
+ "openapi-3.0",
638
+ "react-hook-form",
639
+ "tanstack-form",
640
+ "both"
641
+ ]).optional(),
642
+ /**
643
+ * Which operations get a resolver. `forms` only, defaults to insert and update.
644
+ *
645
+ * `select` is offered because a filter form is a form, but it is off by default: a select
646
+ * schema describes a row that came out of the database, so validating user input against it
647
+ * asks for the generated columns a form never supplies.
648
+ */
649
+ modes: import_zod.z.array(import_zod.z.enum(["insert", "update", "select"])).optional(),
601
650
  /** Also emit `components.ts` for the `json-schema` generator, ready for an OpenAPI document. */
602
651
  components: import_zod.z.boolean().optional(),
603
652
  /**
@@ -607,6 +656,11 @@ var GeneratorSchema = import_zod.z.object({
607
656
  * `true` is the short form. The object form carries the three things a Drizzle schema genuinely
608
657
  * cannot say: what the API is called, where it is served, and which status code that particular
609
658
  * server answers a request that fails its schema with.
659
+ *
660
+ * **The `openapi-fetch` generator reads the same key**, and the two have to be given the same
661
+ * value where both are configured. They are separate generators and nothing checks one against
662
+ * the other, so different options produce a client that describes a different API from the
663
+ * document beside it. The one that bites is `validationStatus`, which lands in both outputs.
610
664
  */
611
665
  document: import_zod.z.union([
612
666
  import_zod.z.boolean(),
@@ -844,7 +898,9 @@ var ROUTER_KINDS = /* @__PURE__ */ new Set([
844
898
  "h3",
845
899
  "effect-http",
846
900
  "ts-rest",
847
- "elysia"
901
+ "elysia",
902
+ "openapi-fetch",
903
+ "forms"
848
904
  ]);
849
905
  var INJECTION_KINDS = /* @__PURE__ */ new Set(["orpc", "trpc"]);
850
906
  function trpcOutDir(g, cfg) {
@@ -886,6 +942,12 @@ function effectHttpOutDir(g, cfg) {
886
942
  function tsRestOutDir(g, cfg) {
887
943
  return g.path ?? cfg.outDir;
888
944
  }
945
+ function openApiFetchOutDir(g, cfg) {
946
+ return g.path ?? cfg.outDir;
947
+ }
948
+ function formsOutDir(g, cfg) {
949
+ return g.path ?? cfg.outDir;
950
+ }
889
951
  function elysiaOutDir(g, cfg) {
890
952
  return g.path ?? cfg.outDir;
891
953
  }
@@ -1211,6 +1273,8 @@ function computeGeneratorOutputDirs(cfg, cwd = process.cwd()) {
1211
1273
  if (g.kind === "effect-http") dirs.add(abs(effectHttpOutDir(g, cfg)));
1212
1274
  if (g.kind === "ts-rest") dirs.add(abs(tsRestOutDir(g, cfg)));
1213
1275
  if (g.kind === "elysia") dirs.add(abs(elysiaOutDir(g, cfg)));
1276
+ if (g.kind === "openapi-fetch") dirs.add(abs(openApiFetchOutDir(g, cfg)));
1277
+ if (g.kind === "forms") dirs.add(abs(formsOutDir(g, cfg)));
1214
1278
  if (g.kind === "seed") dirs.add(abs(seedOutDir(g, cfg)));
1215
1279
  if (g.kind === "fast-check") dirs.add(abs(fastCheckOutDir(g, cfg)));
1216
1280
  if (g.kind === "service") dirs.add(abs(g.path ?? "src/services"));
@@ -1297,6 +1361,7 @@ function computeWatchTargets(cfg, cwd = process.cwd(), source) {
1297
1361
  fastCheckOutDir,
1298
1362
  fastifyOutDir,
1299
1363
  filterTables,
1364
+ formsOutDir,
1300
1365
  graphqlOutDir,
1301
1366
  h3OutDir,
1302
1367
  honoOutDir,
@@ -1305,6 +1370,7 @@ function computeWatchTargets(cfg, cwd = process.cwd(), source) {
1305
1370
  mcpOutDir,
1306
1371
  nestjsOutDir,
1307
1372
  nextOutDir,
1373
+ openApiFetchOutDir,
1308
1374
  resolveConfig,
1309
1375
  resolveTemplateDirsSync,
1310
1376
  seedOutDir,