kysely
0.29.9 · 12 Nov 2026MIT32M / weekRepositoryHomepagenpmAtom feed
0.29.9 is the newest release of 0.26.x.
In short
3 new1 fixed1 changed
Security
3 advisories affect 0.26.0; 0.28.17 fixes them
- HighKysely: JSON-path traversal injection via unsanitized path-leg metacharacters in `JSONPathBuilder.key()` / `.at()`GHSA-pv5w-4p9q-p3v2 · 11 May 2026Fixed in 0.28.17
- HighKysely has a MySQL SQL Injection via Insufficient Backslash Escaping in `sql.lit(string)` usage or similar methods that append string literal values into the compiled SQL stringsGHSA-8cpq-38p9-67gx · 20 Mar 2026Fixed in 0.28.14
- HighSQL Injection via unsanitized JSON path keys when ignoring/silencing compilation errors or using `Kysely<any>`.GHSA-wmrf-hv6w-mr66 · 18 Mar 2026Fixed in 0.28.12
Release note
Expression builder improvements
We improved the expression builder based on excellent feedback from the community in this issue in addition to many discord discussions. Unfortunately this means deprecating the recently added cmpr and bxp methods, but the migration should be painless. Read more @ #565.
Before you could create comparisons and arbitrary binary expressions using cmpr and bxp respectively:
where((eb) => eb.or([
eb.cmpr('first_name', '=', 'Jennifer'),
eb.cmpr('first_name', '=', 'Sylvester'),
]))
set((eb) => ({
age: eb.bxp('age', '+', 1)
}))After this release, you'd do this instead:
where((eb) => eb.or([
eb('first_name', '=', 'Jennifer'),
eb('first_name', '=', 'Sylvester'),
]))
set((eb) => ({
age: eb('age', '+', 1)
}))As you can see we made the expression builder callable and it can create all kinds of binary expressions. You can still use destructuring as before since the expression builder has a new property eb that returns itself:
where(({ eb, or }) => or([
eb('first_name', '=', 'Jennifer'),
eb('first_name', '=', 'Sylvester'),
]))or and and chaining
We've also added new way to create and and or expressions using chaining
where((eb) =>
eb('first_name', '=', 'Jennifer').or('first_name', '=', 'Sylvester')
]))The old and and or methods are still there and are not going anywhere.
JSON references
The expression builder's ref function can now be used to reference nested JSON columns' fields and array items in a type-safe way:
// Postgres syntax: "addresses"->0->'postalCode'
where(({ eb, ref }) =>
eb(ref('addresses', '->').at(0).key('postalCode'), '=', '61710')
)
// MySQL syntax: `addresses`->'$[0].postalCode'
where(({ eb, ref }) =>
eb(ref('addresses', '->$').at(0).key('postalCode'), '=', '61710')
)The JSON reference builder is just our first guess of a good API. We're eager to hear your feedback. More examples and a recipe on the subject will follow shortly after this release. Read more @ #440.
Other changes
Fix onConflict compilation errors starting from TypeScript 5.1.6 #568. Thanks @igalklebanov ❤️
Disallow AlterColumn method chaining. #468 Thanks @soanvig ❤️
Allow arbitrary expressions in count and sum
Allow parameters in raw sql. #512 Thanks @nicksrandall ❤️
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.