@drzl/validation-core 3.3.0 → 3.4.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.cjs CHANGED
@@ -84452,6 +84452,7 @@ __export(index_exports2, {
84452
84452
  importSpecifier: () => importSpecifier,
84453
84453
  insertColumns: () => insertColumns,
84454
84454
  isGeneratedColumn: () => isGeneratedColumn,
84455
+ isIntegerColumn: () => isIntegerColumn,
84455
84456
  moduleFileName: () => moduleFileName,
84456
84457
  moduleSpecifier: () => moduleSpecifier,
84457
84458
  parseCheck: () => parseCheck,
@@ -84673,6 +84674,10 @@ function validateAffix(affix, schemaSuffix) {
84673
84674
  function isGeneratedColumn(c5, _primaryKeyColumns = []) {
84674
84675
  return c5.isGenerated;
84675
84676
  }
84677
+ function isIntegerColumn(c5) {
84678
+ if (typeof c5.integer === "boolean") return c5.integer;
84679
+ return c5.dbType === "INTEGER" || c5.min !== void 0 && c5.max !== void 0;
84680
+ }
84676
84681
  function insertColumns(table) {
84677
84682
  return table.columns.filter((c5) => !isGeneratedColumn(c5));
84678
84683
  }
@@ -84722,6 +84727,7 @@ async function formatCode(code, filePath, fmt) {
84722
84727
  importSpecifier,
84723
84728
  insertColumns,
84724
84729
  isGeneratedColumn,
84730
+ isIntegerColumn,
84725
84731
  moduleFileName,
84726
84732
  moduleSpecifier,
84727
84733
  parseCheck,
package/dist/index.d.cts CHANGED
@@ -313,9 +313,18 @@ interface ValidationRenderer<TOptions extends ValidationGenerateOptions = Valida
313
313
  * optional.
314
314
  */
315
315
  declare function isGeneratedColumn(c: Column, _primaryKeyColumns?: string[]): boolean;
316
+ /**
317
+ * Whether a numeric column accepts whole numbers only.
318
+ *
319
+ * The analyzer states this outright from Drizzle v1's `dataType`. The fallback is what the
320
+ * generators each used to do on their own: read "declares both bounds" as "is an integer". That
321
+ * was true only while integers were the sole bounded type, so it is kept strictly for an
322
+ * analysis produced before `Column.integer` existed, and never consulted when the flag is set.
323
+ */
324
+ declare function isIntegerColumn(c: Column): boolean;
316
325
  declare function insertColumns(table: Table): Column[];
317
326
  declare function updateColumns(table: Table): Column[];
318
327
  declare function selectColumns(table: Table): Column[];
319
328
  declare function formatCode(code: string, filePath: string, fmt?: FormatOptions): Promise<any>;
320
329
 
321
- export { AFFIX_PROBE_TABLE, type AffixIssue, type AffixOptions, type AffixValue, type ColumnCheck, DEFAULT_IMPORT_EXTENSION, DEFAULT_MODE_PREFIX, DEFAULT_SCHEMA_SUFFIX, DEFAULT_TYPE_SUFFIX, type FormatOptions, IMPORT_EXTENSIONS, type ImportExtension, NAME_MODES, type NameMode, type ParsedCheck, type ResolvedAffix, type Table, type TableCase, type ValidationGenerateOptions, type ValidationLibrary, type ValidationRenderer, applyTableCase, formatCode, importSpecifier, insertColumns, isGeneratedColumn, moduleFileName, moduleSpecifier, parseCheck, pascalCase, resolveAffix, resolveConfiguredImport, schemaName, selectColumns, typeName, updateColumns, validateAffix };
330
+ export { AFFIX_PROBE_TABLE, type AffixIssue, type AffixOptions, type AffixValue, type ColumnCheck, DEFAULT_IMPORT_EXTENSION, DEFAULT_MODE_PREFIX, DEFAULT_SCHEMA_SUFFIX, DEFAULT_TYPE_SUFFIX, type FormatOptions, IMPORT_EXTENSIONS, type ImportExtension, NAME_MODES, type NameMode, type ParsedCheck, type ResolvedAffix, type Table, type TableCase, type ValidationGenerateOptions, type ValidationLibrary, type ValidationRenderer, applyTableCase, formatCode, importSpecifier, insertColumns, isGeneratedColumn, isIntegerColumn, moduleFileName, moduleSpecifier, parseCheck, pascalCase, resolveAffix, resolveConfiguredImport, schemaName, selectColumns, typeName, updateColumns, validateAffix };
package/dist/index.d.ts CHANGED
@@ -313,9 +313,18 @@ interface ValidationRenderer<TOptions extends ValidationGenerateOptions = Valida
313
313
  * optional.
314
314
  */
315
315
  declare function isGeneratedColumn(c: Column, _primaryKeyColumns?: string[]): boolean;
316
+ /**
317
+ * Whether a numeric column accepts whole numbers only.
318
+ *
319
+ * The analyzer states this outright from Drizzle v1's `dataType`. The fallback is what the
320
+ * generators each used to do on their own: read "declares both bounds" as "is an integer". That
321
+ * was true only while integers were the sole bounded type, so it is kept strictly for an
322
+ * analysis produced before `Column.integer` existed, and never consulted when the flag is set.
323
+ */
324
+ declare function isIntegerColumn(c: Column): boolean;
316
325
  declare function insertColumns(table: Table): Column[];
317
326
  declare function updateColumns(table: Table): Column[];
318
327
  declare function selectColumns(table: Table): Column[];
319
328
  declare function formatCode(code: string, filePath: string, fmt?: FormatOptions): Promise<any>;
320
329
 
321
- export { AFFIX_PROBE_TABLE, type AffixIssue, type AffixOptions, type AffixValue, type ColumnCheck, DEFAULT_IMPORT_EXTENSION, DEFAULT_MODE_PREFIX, DEFAULT_SCHEMA_SUFFIX, DEFAULT_TYPE_SUFFIX, type FormatOptions, IMPORT_EXTENSIONS, type ImportExtension, NAME_MODES, type NameMode, type ParsedCheck, type ResolvedAffix, type Table, type TableCase, type ValidationGenerateOptions, type ValidationLibrary, type ValidationRenderer, applyTableCase, formatCode, importSpecifier, insertColumns, isGeneratedColumn, moduleFileName, moduleSpecifier, parseCheck, pascalCase, resolveAffix, resolveConfiguredImport, schemaName, selectColumns, typeName, updateColumns, validateAffix };
330
+ export { AFFIX_PROBE_TABLE, type AffixIssue, type AffixOptions, type AffixValue, type ColumnCheck, DEFAULT_IMPORT_EXTENSION, DEFAULT_MODE_PREFIX, DEFAULT_SCHEMA_SUFFIX, DEFAULT_TYPE_SUFFIX, type FormatOptions, IMPORT_EXTENSIONS, type ImportExtension, NAME_MODES, type NameMode, type ParsedCheck, type ResolvedAffix, type Table, type TableCase, type ValidationGenerateOptions, type ValidationLibrary, type ValidationRenderer, applyTableCase, formatCode, importSpecifier, insertColumns, isGeneratedColumn, isIntegerColumn, moduleFileName, moduleSpecifier, parseCheck, pascalCase, resolveAffix, resolveConfiguredImport, schemaName, selectColumns, typeName, updateColumns, validateAffix };
package/dist/index.js CHANGED
@@ -207,6 +207,10 @@ function validateAffix(affix, schemaSuffix) {
207
207
  function isGeneratedColumn(c, _primaryKeyColumns = []) {
208
208
  return c.isGenerated;
209
209
  }
210
+ function isIntegerColumn(c) {
211
+ if (typeof c.integer === "boolean") return c.integer;
212
+ return c.dbType === "INTEGER" || c.min !== void 0 && c.max !== void 0;
213
+ }
210
214
  function insertColumns(table) {
211
215
  return table.columns.filter((c) => !isGeneratedColumn(c));
212
216
  }
@@ -255,6 +259,7 @@ export {
255
259
  importSpecifier,
256
260
  insertColumns,
257
261
  isGeneratedColumn,
262
+ isIntegerColumn,
258
263
  moduleFileName,
259
264
  moduleSpecifier,
260
265
  parseCheck,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drzl/validation-core",
3
- "version": "3.3.0",
3
+ "version": "3.4.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.6.0"
14
+ "@drzl/analyzer": "^1.7.0"
15
15
  },
16
16
  "devDependencies": {
17
17
  "tsup": "^8.5.1",