@drzl/cli 4.19.0 → 4.23.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-54E2IO7N.js +1030 -0
- package/dist/chunk-54E2IO7N.js.map +1 -0
- package/dist/{dist-TRJLPIWT.js → chunk-KKPDOZOD.js} +239 -48
- package/dist/chunk-KKPDOZOD.js.map +1 -0
- package/dist/cli.cjs +6850 -1434
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +2958 -679
- package/dist/cli.js.map +1 -1
- package/dist/config.cjs +632 -70
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +314 -6
- package/dist/config.d.ts +314 -6
- package/dist/config.js +29 -1
- package/dist/dist-KQMPKOFK.js +350 -0
- package/dist/dist-KQMPKOFK.js.map +1 -0
- package/dist/{dist-CZDVFYFW.js → dist-KX62ETKK.js} +112 -37
- package/dist/dist-KX62ETKK.js.map +1 -0
- package/dist/dist-P24ILO5N.js +431 -0
- package/dist/dist-P24ILO5N.js.map +1 -0
- package/dist/dist-QYH7DRFY.js +27 -0
- package/dist/dist-QYH7DRFY.js.map +1 -0
- package/dist/dist-SGI2I53L.js +434 -0
- package/dist/dist-SGI2I53L.js.map +1 -0
- package/dist/dist-T5376MW7.js +489 -0
- package/dist/dist-T5376MW7.js.map +1 -0
- package/dist/dist-UVP6B4XJ.js +646 -0
- package/dist/dist-UVP6B4XJ.js.map +1 -0
- package/dist/{dist-XBGVORL3.js → dist-ZIHNXQ7U.js} +16 -6
- package/dist/dist-ZIHNXQ7U.js.map +1 -0
- package/dist/drzl.config.schema.json +717 -0
- package/package.json +19 -13
- package/dist/chunk-V2IXXAC2.js +0 -465
- package/dist/chunk-V2IXXAC2.js.map +0 -1
- package/dist/dist-CZDVFYFW.js.map +0 -1
- package/dist/dist-TRJLPIWT.js.map +0 -1
- package/dist/dist-XBGVORL3.js.map +0 -1
package/dist/config.d.cts
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* drizzle-kit interop: read the schema path from `drizzle.config.ts`, so a drizzle-kit user
|
|
5
|
+
* does not have to state it a second time in `drzl.config.ts`.
|
|
6
|
+
*
|
|
7
|
+
* Everything here mirrors drizzle-kit's measured behavior, read from the published dist of
|
|
8
|
+
* drizzle-kit 0.31.10 rather than from its docs or from memory:
|
|
9
|
+
*
|
|
10
|
+
* - `Config.schema` is `string | string[]` and entries may be glob patterns (`index.d.mts`).
|
|
11
|
+
* - The CLI's default config candidates are `drizzle.config.ts`, then `.js`, then `.json`,
|
|
12
|
+
* in that order and nothing else (`drizzleConfigFromFile` in `bin.cjs`); a custom path can
|
|
13
|
+
* be anything its `--config` flag can name, which `drizzleKit: '<path>'` mirrors.
|
|
14
|
+
* - `prepareFilenames` (bin.cjs) expands each entry with glob.sync, expands a directory
|
|
15
|
+
* match one level with readdir rather than recursively, unions the results, and hard-errors
|
|
16
|
+
* when nothing matched. It also computes the list of code extensions (.ts .js .cjs .mjs
|
|
17
|
+
* .mts .cts) into a variable it never reads, and then requires every match; DRZL applies
|
|
18
|
+
* that filter for real, which is strictly friendlier than crashing on a README.md sitting
|
|
19
|
+
* in the schema directory.
|
|
20
|
+
* - `defineConfig` is the identity function (`index.mjs`), so evaluating the config module
|
|
21
|
+
* yields the plain object and no drizzle-kit installation is needed to read it.
|
|
22
|
+
*
|
|
23
|
+
* Globs are expanded with `node:fs.globSync`, present since Node 22.0 and quiet on the CLI's
|
|
24
|
+
* `engines` floor (measured: `*`, `**`, `{a,b}` and literal paths all behave; no
|
|
25
|
+
* ExperimentalWarning on stderr on 22.22). No new dependency, and the config itself is loaded
|
|
26
|
+
* through the same jiti path as `drzl.config.ts` (`importFreshConfigModule`), so the two
|
|
27
|
+
* config files cannot drift onto different loaders.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Where the schema will be read from, decided once and handed to both `generate` and `watch`,
|
|
32
|
+
* so the two commands cannot resolve differently.
|
|
33
|
+
*/
|
|
34
|
+
interface ResolvedSchemaSource {
|
|
35
|
+
source: 'drzl' | 'drizzle-kit';
|
|
36
|
+
/**
|
|
37
|
+
* What `SchemaAnalyzer` is constructed with: the drzl config's `schema` string verbatim, or
|
|
38
|
+
* the expanded, sorted, absolute file list from the drizzle-kit config.
|
|
39
|
+
*/
|
|
40
|
+
schema: string | string[];
|
|
41
|
+
/**
|
|
42
|
+
* Absolute directories that must be watched for schema edits. For a glob this is its static
|
|
43
|
+
* base, so a file created later that matches the pattern still raises an event; a missing
|
|
44
|
+
* entry here is the infinite-blindness half of the watch-loop rules.
|
|
45
|
+
*/
|
|
46
|
+
watchDirs: string[];
|
|
47
|
+
/** Absolute path of the drizzle-kit config consulted, when source is 'drizzle-kit'. */
|
|
48
|
+
drizzleKitConfigPath?: string;
|
|
49
|
+
/** The dialect that config declares, verbatim, for the post-analysis cross-check. */
|
|
50
|
+
drizzleKitDialect?: string;
|
|
51
|
+
warnings: string[];
|
|
52
|
+
}
|
|
53
|
+
|
|
3
54
|
declare const NamingSchema: z.ZodObject<{
|
|
4
55
|
routerSuffix: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
5
56
|
procedureCase: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
@@ -51,10 +102,44 @@ declare const ImportExtensionSchema: z.ZodEnum<{
|
|
|
51
102
|
none: "none";
|
|
52
103
|
ts: "ts";
|
|
53
104
|
}>;
|
|
105
|
+
/**
|
|
106
|
+
* Every generator DRZL can run, named once.
|
|
107
|
+
*
|
|
108
|
+
* Extracted from `GeneratorSchema.kind` rather than restated beside it, because three surfaces
|
|
109
|
+
* have to agree about this list and two of them used to spell it themselves: the config parser,
|
|
110
|
+
* the JSON Schema editors validate a `drzl.config.json` against, and the CLI's `--only`. A kind
|
|
111
|
+
* added here is accepted by all three at once, which is the property `--only` needs to be able to
|
|
112
|
+
* refuse an unknown value by name instead of matching nothing in silence.
|
|
113
|
+
*/
|
|
114
|
+
declare const GeneratorKindSchema: z.ZodEnum<{
|
|
115
|
+
orpc: "orpc";
|
|
116
|
+
trpc: "trpc";
|
|
117
|
+
hono: "hono";
|
|
118
|
+
express: "express";
|
|
119
|
+
fastify: "fastify";
|
|
120
|
+
nestjs: "nestjs";
|
|
121
|
+
graphql: "graphql";
|
|
122
|
+
service: "service";
|
|
123
|
+
zod: "zod";
|
|
124
|
+
valibot: "valibot";
|
|
125
|
+
arktype: "arktype";
|
|
126
|
+
typebox: "typebox";
|
|
127
|
+
effect: "effect";
|
|
128
|
+
"json-schema": "json-schema";
|
|
129
|
+
}>;
|
|
130
|
+
/** One generator kind, as the config spells it. */
|
|
131
|
+
type GeneratorKind = z.infer<typeof GeneratorKindSchema>;
|
|
132
|
+
/** The kinds in declaration order, for a message that has to list them. */
|
|
133
|
+
declare const GENERATOR_KINDS: readonly GeneratorKind[];
|
|
54
134
|
declare const GeneratorSchema: z.ZodObject<{
|
|
55
135
|
kind: z.ZodEnum<{
|
|
56
136
|
orpc: "orpc";
|
|
57
137
|
trpc: "trpc";
|
|
138
|
+
hono: "hono";
|
|
139
|
+
express: "express";
|
|
140
|
+
fastify: "fastify";
|
|
141
|
+
nestjs: "nestjs";
|
|
142
|
+
graphql: "graphql";
|
|
58
143
|
service: "service";
|
|
59
144
|
zod: "zod";
|
|
60
145
|
valibot: "valibot";
|
|
@@ -63,6 +148,10 @@ declare const GeneratorSchema: z.ZodObject<{
|
|
|
63
148
|
effect: "effect";
|
|
64
149
|
"json-schema": "json-schema";
|
|
65
150
|
}>;
|
|
151
|
+
validator: z.ZodOptional<z.ZodEnum<{
|
|
152
|
+
zod: "zod";
|
|
153
|
+
standard: "standard";
|
|
154
|
+
}>>;
|
|
66
155
|
importExtension: z.ZodOptional<z.ZodEnum<{
|
|
67
156
|
js: "js";
|
|
68
157
|
none: "none";
|
|
@@ -70,17 +159,32 @@ declare const GeneratorSchema: z.ZodObject<{
|
|
|
70
159
|
}>>;
|
|
71
160
|
template: z.ZodOptional<z.ZodString>;
|
|
72
161
|
includeRelations: z.ZodOptional<z.ZodBoolean>;
|
|
162
|
+
sharedEnums: z.ZodOptional<z.ZodBoolean>;
|
|
73
163
|
coerceDates: z.ZodOptional<z.ZodEnum<{
|
|
74
|
-
none: "none";
|
|
75
164
|
input: "input";
|
|
165
|
+
none: "none";
|
|
76
166
|
all: "all";
|
|
77
167
|
}>>;
|
|
78
168
|
typedJson: z.ZodOptional<z.ZodBoolean>;
|
|
79
169
|
typedColumns: z.ZodOptional<z.ZodBoolean>;
|
|
80
170
|
applyDefaults: z.ZodOptional<z.ZodBoolean>;
|
|
81
171
|
duplicateFinder: z.ZodOptional<z.ZodBoolean>;
|
|
172
|
+
constraints: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
173
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
174
|
+
errorMap: z.ZodOptional<z.ZodBoolean>;
|
|
175
|
+
}, z.core.$strict>]>>;
|
|
176
|
+
meta: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
177
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
178
|
+
description: z.ZodOptional<z.ZodBoolean>;
|
|
179
|
+
}, z.core.$strict>]>>;
|
|
180
|
+
standardSchema: z.ZodOptional<z.ZodBoolean>;
|
|
82
181
|
nestedSchemas: z.ZodOptional<z.ZodBoolean>;
|
|
83
182
|
nestedDepth: z.ZodOptional<z.ZodNumber>;
|
|
183
|
+
branded: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
184
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
185
|
+
foreignKeys: z.ZodOptional<z.ZodBoolean>;
|
|
186
|
+
aliases: z.ZodOptional<z.ZodBoolean>;
|
|
187
|
+
}, z.core.$strict>]>>;
|
|
84
188
|
naming: z.ZodOptional<z.ZodObject<{
|
|
85
189
|
routerSuffix: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
86
190
|
procedureCase: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
@@ -215,16 +319,32 @@ declare const GeneratorSchema: z.ZodObject<{
|
|
|
215
319
|
}, z.core.$strip>>;
|
|
216
320
|
templateOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
217
321
|
}, z.core.$strip>;
|
|
322
|
+
/**
|
|
323
|
+
* One table's column rules. Strict, so `ommit` is refused by the parser rather than dropped.
|
|
324
|
+
*
|
|
325
|
+
* The whole option exists to remove a column, and a key zod strips in silence is a config that
|
|
326
|
+
* looks like it removed one and did not. `GeneratorSchema` is deliberately not strict and has
|
|
327
|
+
* already cost this repo two options that parsed and then did nothing.
|
|
328
|
+
*/
|
|
329
|
+
declare const ColumnRulesSchema: z.ZodObject<{
|
|
330
|
+
omit: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
331
|
+
pick: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
332
|
+
}, z.core.$strict>;
|
|
218
333
|
declare const AnalyzerSchema: z.ZodObject<{
|
|
219
334
|
includeRelations: z.ZodDefault<z.ZodBoolean>;
|
|
220
335
|
validateConstraints: z.ZodDefault<z.ZodBoolean>;
|
|
221
336
|
includeHeuristicRelations: z.ZodDefault<z.ZodBoolean>;
|
|
222
337
|
}, z.core.$strip>;
|
|
223
338
|
declare const ConfigSchema: z.ZodObject<{
|
|
224
|
-
schema: z.ZodString
|
|
339
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
340
|
+
drizzleKit: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
|
|
225
341
|
outDir: z.ZodDefault<z.ZodString>;
|
|
226
342
|
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
227
343
|
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
344
|
+
columns: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
345
|
+
omit: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
346
|
+
pick: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
347
|
+
}, z.core.$strict>>>;
|
|
228
348
|
importExtension: z.ZodDefault<z.ZodEnum<{
|
|
229
349
|
js: "js";
|
|
230
350
|
none: "none";
|
|
@@ -239,6 +359,11 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
239
359
|
kind: z.ZodEnum<{
|
|
240
360
|
orpc: "orpc";
|
|
241
361
|
trpc: "trpc";
|
|
362
|
+
hono: "hono";
|
|
363
|
+
express: "express";
|
|
364
|
+
fastify: "fastify";
|
|
365
|
+
nestjs: "nestjs";
|
|
366
|
+
graphql: "graphql";
|
|
242
367
|
service: "service";
|
|
243
368
|
zod: "zod";
|
|
244
369
|
valibot: "valibot";
|
|
@@ -247,6 +372,10 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
247
372
|
effect: "effect";
|
|
248
373
|
"json-schema": "json-schema";
|
|
249
374
|
}>;
|
|
375
|
+
validator: z.ZodOptional<z.ZodEnum<{
|
|
376
|
+
zod: "zod";
|
|
377
|
+
standard: "standard";
|
|
378
|
+
}>>;
|
|
250
379
|
importExtension: z.ZodOptional<z.ZodEnum<{
|
|
251
380
|
js: "js";
|
|
252
381
|
none: "none";
|
|
@@ -254,17 +383,32 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
254
383
|
}>>;
|
|
255
384
|
template: z.ZodOptional<z.ZodString>;
|
|
256
385
|
includeRelations: z.ZodOptional<z.ZodBoolean>;
|
|
386
|
+
sharedEnums: z.ZodOptional<z.ZodBoolean>;
|
|
257
387
|
coerceDates: z.ZodOptional<z.ZodEnum<{
|
|
258
|
-
none: "none";
|
|
259
388
|
input: "input";
|
|
389
|
+
none: "none";
|
|
260
390
|
all: "all";
|
|
261
391
|
}>>;
|
|
262
392
|
typedJson: z.ZodOptional<z.ZodBoolean>;
|
|
263
393
|
typedColumns: z.ZodOptional<z.ZodBoolean>;
|
|
264
394
|
applyDefaults: z.ZodOptional<z.ZodBoolean>;
|
|
265
395
|
duplicateFinder: z.ZodOptional<z.ZodBoolean>;
|
|
396
|
+
constraints: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
397
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
398
|
+
errorMap: z.ZodOptional<z.ZodBoolean>;
|
|
399
|
+
}, z.core.$strict>]>>;
|
|
400
|
+
meta: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
401
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
402
|
+
description: z.ZodOptional<z.ZodBoolean>;
|
|
403
|
+
}, z.core.$strict>]>>;
|
|
404
|
+
standardSchema: z.ZodOptional<z.ZodBoolean>;
|
|
266
405
|
nestedSchemas: z.ZodOptional<z.ZodBoolean>;
|
|
267
406
|
nestedDepth: z.ZodOptional<z.ZodNumber>;
|
|
407
|
+
branded: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
408
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
409
|
+
foreignKeys: z.ZodOptional<z.ZodBoolean>;
|
|
410
|
+
aliases: z.ZodOptional<z.ZodBoolean>;
|
|
411
|
+
}, z.core.$strict>]>>;
|
|
268
412
|
naming: z.ZodOptional<z.ZodObject<{
|
|
269
413
|
routerSuffix: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
270
414
|
procedureCase: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
@@ -403,6 +547,34 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
403
547
|
type DrzlConfigInput = z.input<typeof ConfigSchema>;
|
|
404
548
|
type DrzlConfig = z.output<typeof ConfigSchema>;
|
|
405
549
|
declare function defineConfig<T extends DrzlConfigInput>(cfg: T): T;
|
|
550
|
+
/**
|
|
551
|
+
* Every filename `drzl` will load a config from, in the order it tries them.
|
|
552
|
+
*
|
|
553
|
+
* One list because there were two. `computeWatchTargets` carried its own copy of four of these
|
|
554
|
+
* names, and the copy was missing `drzl.config.json`: a JSON config loaded fine, and then
|
|
555
|
+
* `drzl watch` never noticed an edit to it, because nothing was watching the file. The watcher's
|
|
556
|
+
* test spelled the same four names a third time, so it agreed with the bug.
|
|
557
|
+
*/
|
|
558
|
+
declare const CONFIG_FILE_NAMES: readonly ["drzl.config.ts", "drzl.config.mjs", "drzl.config.js", "drzl.config.cjs", "drzl.config.json"];
|
|
559
|
+
/** Where the published schema answers from, and what `$schema` in a config should point at. */
|
|
560
|
+
declare const CONFIG_SCHEMA_ID = "https://use-drzl.github.io/drzl/drzl.config.schema.json";
|
|
561
|
+
/**
|
|
562
|
+
* `ConfigSchema` as a JSON Schema, for editors pointed at a `drzl.config.json`.
|
|
563
|
+
*
|
|
564
|
+
* Two things about `z.toJSONSchema` decide the arguments here, both measured rather than assumed:
|
|
565
|
+
*
|
|
566
|
+
* - `io` defaults to `'output'`, which marks every key carrying a `.default()` as `required`.
|
|
567
|
+
* That is four of the nine top-level keys, so the default would produce a schema that flags
|
|
568
|
+
* all 32 configs in the docs and every minimal config a reader writes. `'input'` describes
|
|
569
|
+
* what a user writes, which is what a config file is.
|
|
570
|
+
* - refinements are dropped silently. The only one here is the affix `.superRefine`; its
|
|
571
|
+
* character half is carried by the `pattern` annotations on `affixValueSchema`, and its
|
|
572
|
+
* collision half cannot be stated in JSON Schema at all and stays a CLI-only error.
|
|
573
|
+
*
|
|
574
|
+
* draft-07 rather than 2020-12 because that is the dialect every editor implements fully, and
|
|
575
|
+
* this schema uses nothing newer.
|
|
576
|
+
*/
|
|
577
|
+
declare function buildConfigJsonSchema(): Record<string, unknown>;
|
|
406
578
|
/**
|
|
407
579
|
* Where the tRPC generator writes.
|
|
408
580
|
*
|
|
@@ -419,6 +591,87 @@ declare function trpcOutDir(g: {
|
|
|
419
591
|
}, cfg: {
|
|
420
592
|
outDir: string;
|
|
421
593
|
}): string;
|
|
594
|
+
/**
|
|
595
|
+
* Where the Hono generator writes.
|
|
596
|
+
*
|
|
597
|
+
* The same rule as the other two routers, and for the same reason: it writes an `index.ts` of its
|
|
598
|
+
* own, so a config running two router generators has to give at least one of them a `path`.
|
|
599
|
+
*
|
|
600
|
+
* Its own function rather than a call to `trpcOutDir`, because these are three separate decisions
|
|
601
|
+
* that happen to agree today, and a reader following `computeGeneratorOutputDirs` should not have
|
|
602
|
+
* to work out whether a function named for tRPC is authoritative for Hono.
|
|
603
|
+
*/
|
|
604
|
+
declare function honoOutDir(g: {
|
|
605
|
+
path?: string;
|
|
606
|
+
}, cfg: {
|
|
607
|
+
outDir: string;
|
|
608
|
+
}): string;
|
|
609
|
+
/**
|
|
610
|
+
* Where the Express generator writes.
|
|
611
|
+
*
|
|
612
|
+
* The same rule as the other three routers, and for the same reason: it writes an `index.ts` of
|
|
613
|
+
* its own, so a config running two router generators has to give at least one of them a `path`.
|
|
614
|
+
*
|
|
615
|
+
* Its own function rather than a call to one of the others, for the reason `honoOutDir` records:
|
|
616
|
+
* these are separate decisions that happen to agree today, and a reader following
|
|
617
|
+
* `computeGeneratorOutputDirs` should not have to work out which router's function is
|
|
618
|
+
* authoritative for which kind.
|
|
619
|
+
*/
|
|
620
|
+
declare function expressOutDir(g: {
|
|
621
|
+
path?: string;
|
|
622
|
+
}, cfg: {
|
|
623
|
+
outDir: string;
|
|
624
|
+
}): string;
|
|
625
|
+
/**
|
|
626
|
+
* Where the Fastify generator writes.
|
|
627
|
+
*
|
|
628
|
+
* The same rule as the other four routers, and for the same reason: it writes an `index.ts` of
|
|
629
|
+
* its own, so a config running two router generators has to give at least one of them a `path`.
|
|
630
|
+
*
|
|
631
|
+
* Its own function rather than a call to one of the others, for the reason `honoOutDir` records:
|
|
632
|
+
* these are separate decisions that happen to agree today, and a reader following
|
|
633
|
+
* `computeGeneratorOutputDirs` should not have to work out which router's function is
|
|
634
|
+
* authoritative for which kind.
|
|
635
|
+
*/
|
|
636
|
+
declare function fastifyOutDir(g: {
|
|
637
|
+
path?: string;
|
|
638
|
+
}, cfg: {
|
|
639
|
+
outDir: string;
|
|
640
|
+
}): string;
|
|
641
|
+
/**
|
|
642
|
+
* Where the NestJS generator writes.
|
|
643
|
+
*
|
|
644
|
+
* The same rule as the five routers, though this one emits DTO modules rather than routes: it
|
|
645
|
+
* still writes an `index.ts` barrel and a `validation.ts` of its own, so a config that runs it
|
|
646
|
+
* beside a router generator has to give at least one of them a `path`.
|
|
647
|
+
*
|
|
648
|
+
* Its own function rather than a call to one of the others, for the reason `honoOutDir` records:
|
|
649
|
+
* these are separate decisions that happen to agree today, and a reader following
|
|
650
|
+
* `computeGeneratorOutputDirs` should not have to work out which kind's function is
|
|
651
|
+
* authoritative for which.
|
|
652
|
+
*/
|
|
653
|
+
declare function nestjsOutDir(g: {
|
|
654
|
+
path?: string;
|
|
655
|
+
}, cfg: {
|
|
656
|
+
outDir: string;
|
|
657
|
+
}): string;
|
|
658
|
+
/**
|
|
659
|
+
* Where the GraphQL generator writes.
|
|
660
|
+
*
|
|
661
|
+
* The same rule as the routers and the NestJS kind, though this one emits SDL modules rather
|
|
662
|
+
* than routes: it still writes an `index.ts` barrel and a `scalars.ts` of its own, so a config
|
|
663
|
+
* that runs it beside a router generator has to give at least one of them a `path`.
|
|
664
|
+
*
|
|
665
|
+
* Its own function rather than a call to one of the others, for the reason `honoOutDir`
|
|
666
|
+
* records: these are separate decisions that happen to agree today, and a reader following
|
|
667
|
+
* `computeGeneratorOutputDirs` should not have to work out which kind's function is
|
|
668
|
+
* authoritative for which.
|
|
669
|
+
*/
|
|
670
|
+
declare function graphqlOutDir(g: {
|
|
671
|
+
path?: string;
|
|
672
|
+
}, cfg: {
|
|
673
|
+
outDir: string;
|
|
674
|
+
}): string;
|
|
422
675
|
/**
|
|
423
676
|
* Fill in cross-generator defaults and refuse configs whose generators would disagree.
|
|
424
677
|
*
|
|
@@ -440,7 +693,45 @@ declare function resolveConfig(cfg: DrzlConfig): {
|
|
|
440
693
|
config: DrzlConfig;
|
|
441
694
|
warnings: string[];
|
|
442
695
|
};
|
|
443
|
-
|
|
696
|
+
/**
|
|
697
|
+
* Load a config module fresh from disk: JSON parsed directly, everything else through jiti
|
|
698
|
+
* with cache-busting, exactly as `loadConfig` always has.
|
|
699
|
+
*
|
|
700
|
+
* Extracted so the drizzle-kit interop reads `drizzle.config.ts` through the same loader that
|
|
701
|
+
* reads `drzl.config.ts`, rather than through a second dependency or a second set of jiti
|
|
702
|
+
* options that could drift from this one.
|
|
703
|
+
*/
|
|
704
|
+
declare function importFreshConfigModule(p: string): Promise<unknown>;
|
|
705
|
+
/**
|
|
706
|
+
* The config, or `null` when there is none.
|
|
707
|
+
*
|
|
708
|
+
* `onWarn` exists so the config's warnings reach the output layer rather than the process. They
|
|
709
|
+
* went to `console.warn` until now, which is stderr with no route through `--quiet` or `--json`:
|
|
710
|
+
* `drzl generate --json` printed them beside the document it promises is the only thing on
|
|
711
|
+
* stdout's channel, and `--quiet` could not remove them. Item 79 adds a warning to exactly this
|
|
712
|
+
* path, so the path is fixed here rather than gaining a second writer that bypasses `Output`.
|
|
713
|
+
*
|
|
714
|
+
* The default keeps the old behaviour for any caller that has no output layer to hand.
|
|
715
|
+
*/
|
|
716
|
+
declare function loadConfig(customPath?: string, onWarn?: (warning: string) => void): Promise<DrzlConfig | null>;
|
|
717
|
+
/**
|
|
718
|
+
* A config nobody wrote to a file, built from what the command line said.
|
|
719
|
+
*
|
|
720
|
+
* `drzl generate --schema src/db/schema.ts --only orpc` is the config route with the config
|
|
721
|
+
* inlined, and it is what replaces the two per-kind commands: those took a schema path and a kind
|
|
722
|
+
* and could reach none of the config's features, because they had no config at all. This produces
|
|
723
|
+
* a real one, so everything downstream, the filters, the naming, the write plan, `--check`, is the
|
|
724
|
+
* same code reading the same shape whether the config came from disk or from two flags.
|
|
725
|
+
*
|
|
726
|
+
* Through `ConfigSchema` and `resolveConfig` rather than by hand, and that is the whole point: the
|
|
727
|
+
* defaults a config file gets are applied here too, `importExtension` is pushed down onto each
|
|
728
|
+
* generator exactly as it is for a file, and a hand-built object that skipped either would emit
|
|
729
|
+
* different bytes from the equivalent config for no reason a user could see.
|
|
730
|
+
*
|
|
731
|
+
* `schema` may be omitted, in which case the drizzle-kit config answers for it, exactly as it does
|
|
732
|
+
* for a `drzl.config.ts` with no `schema` key.
|
|
733
|
+
*/
|
|
734
|
+
declare function configFromKinds(kinds: readonly GeneratorKind[], schema?: string, onWarn?: (warning: string) => void): DrzlConfig;
|
|
444
735
|
/** Absolute output dirs for all generators (to ignore in watcher). */
|
|
445
736
|
declare function computeGeneratorOutputDirs(cfg: DrzlConfig, cwd?: string): string[];
|
|
446
737
|
/** Resolve custom template directories (local path or installed package). */
|
|
@@ -452,13 +743,30 @@ declare function resolveTemplateDirsSync(cfg: DrzlConfig, cwd?: string): string[
|
|
|
452
743
|
* Matching is on the database table name, anchored, with `*` as the only metacharacter. Anchored
|
|
453
744
|
* matters: `user` must not also drop `users`, and a substring match would. `exclude` is applied
|
|
454
745
|
* after `include`, so the safer direction wins when both name the same table.
|
|
746
|
+
*
|
|
747
|
+
* A table also answers to its schema-qualified name, so `reporting.users` addresses one of two
|
|
748
|
+
* same-named tables and `reporting.*` addresses a whole schema. See `tableAliases`.
|
|
455
749
|
*/
|
|
456
750
|
declare function filterTables<T extends {
|
|
457
751
|
name: string;
|
|
752
|
+
schema?: string;
|
|
458
753
|
}>(tables: T[], opts: {
|
|
459
754
|
include?: string[];
|
|
460
755
|
exclude?: string[];
|
|
461
756
|
}): T[];
|
|
462
|
-
|
|
757
|
+
/**
|
|
758
|
+
* What to warn about the table filter, before it is applied.
|
|
759
|
+
*
|
|
760
|
+
* Separate from `filterTables` so that returns a plain array, as every caller and every test
|
|
761
|
+
* already expects it to.
|
|
762
|
+
*/
|
|
763
|
+
declare function tableFilterWarnings(tables: readonly {
|
|
764
|
+
name: string;
|
|
765
|
+
schema?: string;
|
|
766
|
+
}[], opts: {
|
|
767
|
+
include?: string[];
|
|
768
|
+
exclude?: string[];
|
|
769
|
+
}): string[];
|
|
770
|
+
declare function computeWatchTargets(cfg: DrzlConfig, cwd?: string, source?: ResolvedSchemaSource): string[];
|
|
463
771
|
|
|
464
|
-
export { AffixSchema, AnalyzerSchema, ConfigSchema, type DrzlConfig, type DrzlConfigInput, GeneratorSchema, ImportExtensionSchema, NamingSchema, computeGeneratorOutputDirs, computeWatchTargets, defineConfig, filterTables, loadConfig, resolveConfig, resolveTemplateDirsSync, trpcOutDir };
|
|
772
|
+
export { AffixSchema, AnalyzerSchema, CONFIG_FILE_NAMES, CONFIG_SCHEMA_ID, ColumnRulesSchema, ConfigSchema, type DrzlConfig, type DrzlConfigInput, GENERATOR_KINDS, type GeneratorKind, GeneratorKindSchema, GeneratorSchema, ImportExtensionSchema, NamingSchema, buildConfigJsonSchema, computeGeneratorOutputDirs, computeWatchTargets, configFromKinds, defineConfig, expressOutDir, fastifyOutDir, filterTables, graphqlOutDir, honoOutDir, importFreshConfigModule, loadConfig, nestjsOutDir, resolveConfig, resolveTemplateDirsSync, tableFilterWarnings, trpcOutDir };
|