@drzl/validation-core 3.5.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/dist/index.d.cts CHANGED
@@ -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
@@ -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.5.0",
3
+ "version": "3.6.0",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",