@drzl/validation-core 3.9.0 → 3.10.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
@@ -314,6 +314,21 @@ interface ValidationGenerateOptions {
314
314
  * `.pipe()` to every field, which is noise unless you use `.$type<T>()`.
315
315
  */
316
316
  typedColumns?: boolean;
317
+ /**
318
+ * Reproduce literal column defaults in the insert schema, so parsing fills them in.
319
+ *
320
+ * Off by default because it changes what parsing *returns*: `parse({})` on a table with
321
+ * `country: text().default('GB')` yields `{ country: 'GB' }` rather than `{}`. That is usually
322
+ * what you want from a schema that models the row, but it is a change in behaviour rather than
323
+ * only in strictness, so it is asked for rather than assumed.
324
+ *
325
+ * Only literal defaults are reproduced. `defaultNow()`, `defaultRandom()` and any `sql` default
326
+ * are evaluated by the database, and `$defaultFn` is called by Drizzle at insert time; a schema
327
+ * that guessed at any of them would produce a different value than the one actually stored.
328
+ *
329
+ * `drizzle-orm/zod` reproduces none of them, literal or otherwise.
330
+ */
331
+ applyDefaults?: boolean;
317
332
  format?: FormatOptions;
318
333
  /**
319
334
  * What every generated file is called after the Drizzle export name, e.g. `.zod.ts`
package/dist/index.d.ts CHANGED
@@ -314,6 +314,21 @@ interface ValidationGenerateOptions {
314
314
  * `.pipe()` to every field, which is noise unless you use `.$type<T>()`.
315
315
  */
316
316
  typedColumns?: boolean;
317
+ /**
318
+ * Reproduce literal column defaults in the insert schema, so parsing fills them in.
319
+ *
320
+ * Off by default because it changes what parsing *returns*: `parse({})` on a table with
321
+ * `country: text().default('GB')` yields `{ country: 'GB' }` rather than `{}`. That is usually
322
+ * what you want from a schema that models the row, but it is a change in behaviour rather than
323
+ * only in strictness, so it is asked for rather than assumed.
324
+ *
325
+ * Only literal defaults are reproduced. `defaultNow()`, `defaultRandom()` and any `sql` default
326
+ * are evaluated by the database, and `$defaultFn` is called by Drizzle at insert time; a schema
327
+ * that guessed at any of them would produce a different value than the one actually stored.
328
+ *
329
+ * `drizzle-orm/zod` reproduces none of them, literal or otherwise.
330
+ */
331
+ applyDefaults?: boolean;
317
332
  format?: FormatOptions;
318
333
  /**
319
334
  * 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.9.0",
3
+ "version": "3.10.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.10.0"
14
+ "@drzl/analyzer": "^1.11.0"
15
15
  },
16
16
  "devDependencies": {
17
17
  "tsup": "^8.5.1",