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