github gajus/slonik slonik@49.10.5

latest releases: @slonik/sql-tag@49.10.7, slonik-interceptor-query-logging@49.10.7, @slonik/utilities@49.10.7...
9 hours ago

Patch Changes

  • 86c123c Thanks @gajus! - Fix the value-binding-only query guard for tagged queries

    A query whose entire body is a single value binding (e.g.
    pool.query(sql.unsafe\${'something'}`)) is meant to be rejected with InvalidInputError("Unexpected SQL input. Query cannot be empty. Found only value binding."). Since the migration to Slonik's internal$slonik_Nplaceholders, the guard ran against the not-yet-converted SQL and compared it to$1, while the tag actually produces $slonik_1` at that point — so the check
    never fired for real tagged queries and they were forwarded to PostgreSQL
    instead (where they fail with a less helpful syntax error).

    The placeholder conversion now happens before the validation, so the guard
    correctly detects value-only queries regardless of how they are constructed. The
    existing test only exercised a hand-built $1 token; a regression test that goes
    through the tag has been added.

  • Updated dependencies []:

    • @slonik/driver@49.10.5
    • @slonik/errors@49.10.5
    • @slonik/pg-driver@49.10.5
    • @slonik/sql-tag@49.10.5
    • @slonik/utilities@49.10.5

Don't miss a new slonik release

NewReleases is sending notifications on new releases.