Hey 👋
The introduction of dehydration in JSON functions/helpers caused an unexpected bug for consumers that have some columns defined as '${number}', e.g. '1' | '2' (also when wrapped in ColumnType or similar). Such columns, when participating in a JSON function/helper would dehydrate to number instead of staying as string.
Why dehydrate numeric strings to numbers in the first place? Select types in kysely describe the data after underlying driver's (e.g. pg) data transformation. Some drivers transform numeric columns to strings to be safe. When these columns participate in JSON functions, they lose original column data types - drivers don't know they need to transform to string - they return as-is.
This release introduces a special helper type that wraps your column type definition and tells kysely to NOT dehydrate it in JSON functions/helpers.
import type { NonDehydrateable } from 'kysely'
interface Database {
my_table: {
a_column: '1' | '2' | '3', // dehydrates to `number`
another_column: NonDehydrateable<'1' | '2' | '3'>, // stays `'1' | '2' | '3'`
column_too: NonDehydrateable<ColumnType<'1' | '2' | '3'>> // stays `'1' | '2' | '3'`
}
}🚀 Features
- feat: add
NonDehydrateable<T>to allow opt-out from dehydration in JSON functions/helpers. by @igalklebanov in #1697
🐞 Bugfixes
PostgreSQL 🐘
- fix: PostgreSQL introspector unnecessarily slow in result processing. by @igalklebanov & @rubenferreira97 in #1774
📖 Documentation
- Add complex function helpers section to documentation by @mifi & @igalklebanov in #1758
📦 CICD & Tooling
- chore: bump TypeScript to 6. by @igalklebanov in #1769
- chore: bump dependencies. by @igalklebanov in #1775
⚠️ Breaking Changes
🐤 New Contributors
- @rubenferreira97 made their first contribution in #1774
Full Changelog: v0.28.14...v0.28.15