@drzl/validation-core 3.15.0 → 3.15.1

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.cjs CHANGED
@@ -508,7 +508,7 @@ function insertColumns(table) {
508
508
  }
509
509
  function updateColumns(table) {
510
510
  const pkCols = table.primaryKey?.columns ?? [];
511
- return table.columns.filter((c) => !pkCols.includes(c.name));
511
+ return table.columns.filter((c) => !isGeneratedColumn(c) && !pkCols.includes(c.name));
512
512
  }
513
513
  function selectColumns(table) {
514
514
  return table.columns;
package/dist/index.d.cts CHANGED
@@ -488,6 +488,19 @@ declare const COLUMN_FORMATS: Record<string, string>;
488
488
  declare const CODEPOINT_LENGTH = "[...v].length";
489
489
  declare function isIntegerColumn(c: Column): boolean;
490
490
  declare function insertColumns(table: Table): Column[];
491
+ /**
492
+ * Which columns belong in an update schema.
493
+ *
494
+ * A primary key identifies the row rather than changing it, and a generated column cannot be
495
+ * written at all. This asked only the first question, so every `generatedAlwaysAs` column landed
496
+ * in the patch type. Measured against real servers: all three refuse an UPDATE naming one with any
497
+ * value, including NULL. Postgres 428C9, MySQL 3105, SQLite "cannot UPDATE generated column". The
498
+ * one accepted form is `SET col = DEFAULT`, which no validator can express and no Drizzle `.set()`
499
+ * produces.
500
+ *
501
+ * `isGeneratedColumn` rather than `c.isGenerated`, so this and `insertColumns` cannot drift apart
502
+ * on what counts as generated.
503
+ */
491
504
  declare function updateColumns(table: Table): Column[];
492
505
  declare function selectColumns(table: Table): Column[];
493
506
  /**
package/dist/index.d.ts CHANGED
@@ -488,6 +488,19 @@ declare const COLUMN_FORMATS: Record<string, string>;
488
488
  declare const CODEPOINT_LENGTH = "[...v].length";
489
489
  declare function isIntegerColumn(c: Column): boolean;
490
490
  declare function insertColumns(table: Table): Column[];
491
+ /**
492
+ * Which columns belong in an update schema.
493
+ *
494
+ * A primary key identifies the row rather than changing it, and a generated column cannot be
495
+ * written at all. This asked only the first question, so every `generatedAlwaysAs` column landed
496
+ * in the patch type. Measured against real servers: all three refuse an UPDATE naming one with any
497
+ * value, including NULL. Postgres 428C9, MySQL 3105, SQLite "cannot UPDATE generated column". The
498
+ * one accepted form is `SET col = DEFAULT`, which no validator can express and no Drizzle `.set()`
499
+ * produces.
500
+ *
501
+ * `isGeneratedColumn` rather than `c.isGenerated`, so this and `insertColumns` cannot drift apart
502
+ * on what counts as generated.
503
+ */
491
504
  declare function updateColumns(table: Table): Column[];
492
505
  declare function selectColumns(table: Table): Column[];
493
506
  /**
package/dist/index.js CHANGED
@@ -445,7 +445,7 @@ function insertColumns(table) {
445
445
  }
446
446
  function updateColumns(table) {
447
447
  const pkCols = table.primaryKey?.columns ?? [];
448
- return table.columns.filter((c) => !pkCols.includes(c.name));
448
+ return table.columns.filter((c) => !isGeneratedColumn(c) && !pkCols.includes(c.name));
449
449
  }
450
450
  function selectColumns(table) {
451
451
  return table.columns;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drzl/validation-core",
3
- "version": "3.15.0",
3
+ "version": "3.15.1",
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.0"
14
+ "@drzl/analyzer": "^1.15.0"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "prettier": ">=3"