@drzl/validation-core 3.4.0 → 3.6.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/README.md +1 -1
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ Shared interfaces and helpers used by validation generators.
|
|
|
29
29
|
|
|
30
30
|
## Exports (essentials)
|
|
31
31
|
|
|
32
|
-
- ValidationLibrary: `'zod' | 'valibot' | 'arktype'`
|
|
32
|
+
- ValidationLibrary: `'zod' | 'valibot' | 'arktype' | 'typebox'`
|
|
33
33
|
- ValidationRenderer<TOptions>
|
|
34
34
|
- `library`
|
|
35
35
|
- `renderTable(table, opts)`
|
package/dist/index.d.cts
CHANGED
|
@@ -85,7 +85,7 @@ declare function resolveConfiguredImport(configured: string, outDirAbs: string,
|
|
|
85
85
|
* One place that decides what a generated identifier is called.
|
|
86
86
|
*
|
|
87
87
|
* Every generator used to build these names by hand with template literals, which is why
|
|
88
|
-
* the oRPC router and the zod/valibot/arktype generators could silently disagree about the
|
|
88
|
+
* the oRPC router and the zod/valibot/arktype/typebox generators could silently disagree about the
|
|
89
89
|
* same name. They all call through here now, so a single resolved value describes both
|
|
90
90
|
* sides of the import.
|
|
91
91
|
*
|
|
@@ -264,6 +264,23 @@ interface ValidationGenerateOptions {
|
|
|
264
264
|
* should be a choice rather than a surprise.
|
|
265
265
|
*/
|
|
266
266
|
typedJson?: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Take every column's static type from Drizzle's inference, not just the untyped ones.
|
|
269
|
+
*
|
|
270
|
+
* `typedJson` covers the columns that have no runtime type worth checking. This covers the
|
|
271
|
+
* rest, and exists for `.$type<T>()`, which is a compile-time cast on any column at all:
|
|
272
|
+
* `text().$type<'admin' | 'member'>()` is a `string` to every runtime-derived validator, so
|
|
273
|
+
* `drizzle-orm/zod` and DRZL alike emitted a plain `z.string()` and the narrowing was lost.
|
|
274
|
+
*
|
|
275
|
+
* The runtime schema is untouched. The reference is appended with `.pipe()` rather than
|
|
276
|
+
* replacing anything, so a `varchar(50)` keeps its length check and only its *type* narrows
|
|
277
|
+
* from `string` to the union you declared. Nothing can narrow it at runtime, since the cast
|
|
278
|
+
* leaves no trace there.
|
|
279
|
+
*
|
|
280
|
+
* Implies `typedJson`, since both need the schema imported back. Off by default: it adds a
|
|
281
|
+
* `.pipe()` to every field, which is noise unless you use `.$type<T>()`.
|
|
282
|
+
*/
|
|
283
|
+
typedColumns?: boolean;
|
|
267
284
|
format?: FormatOptions;
|
|
268
285
|
/**
|
|
269
286
|
* What every generated file is called after the Drizzle export name, e.g. `.zod.ts`
|
package/dist/index.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ declare function resolveConfiguredImport(configured: string, outDirAbs: string,
|
|
|
85
85
|
* One place that decides what a generated identifier is called.
|
|
86
86
|
*
|
|
87
87
|
* Every generator used to build these names by hand with template literals, which is why
|
|
88
|
-
* the oRPC router and the zod/valibot/arktype generators could silently disagree about the
|
|
88
|
+
* the oRPC router and the zod/valibot/arktype/typebox generators could silently disagree about the
|
|
89
89
|
* same name. They all call through here now, so a single resolved value describes both
|
|
90
90
|
* sides of the import.
|
|
91
91
|
*
|
|
@@ -264,6 +264,23 @@ interface ValidationGenerateOptions {
|
|
|
264
264
|
* should be a choice rather than a surprise.
|
|
265
265
|
*/
|
|
266
266
|
typedJson?: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Take every column's static type from Drizzle's inference, not just the untyped ones.
|
|
269
|
+
*
|
|
270
|
+
* `typedJson` covers the columns that have no runtime type worth checking. This covers the
|
|
271
|
+
* rest, and exists for `.$type<T>()`, which is a compile-time cast on any column at all:
|
|
272
|
+
* `text().$type<'admin' | 'member'>()` is a `string` to every runtime-derived validator, so
|
|
273
|
+
* `drizzle-orm/zod` and DRZL alike emitted a plain `z.string()` and the narrowing was lost.
|
|
274
|
+
*
|
|
275
|
+
* The runtime schema is untouched. The reference is appended with `.pipe()` rather than
|
|
276
|
+
* replacing anything, so a `varchar(50)` keeps its length check and only its *type* narrows
|
|
277
|
+
* from `string` to the union you declared. Nothing can narrow it at runtime, since the cast
|
|
278
|
+
* leaves no trace there.
|
|
279
|
+
*
|
|
280
|
+
* Implies `typedJson`, since both need the schema imported back. Off by default: it adds a
|
|
281
|
+
* `.pipe()` to every field, which is noise unless you use `.$type<T>()`.
|
|
282
|
+
*/
|
|
283
|
+
typedColumns?: boolean;
|
|
267
284
|
format?: FormatOptions;
|
|
268
285
|
/**
|
|
269
286
|
* What every generated file is called after the Drizzle export name, e.g. `.zod.ts`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drzl/validation-core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"sideEffects": false,
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@drzl/analyzer": "^1.
|
|
14
|
+
"@drzl/analyzer": "^1.8.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"tsup": "^8.5.1",
|