Skip to content

Release v0.4.0

Choose a tag to compare

@github-actions github-actions released this 04 Feb 18:41
· 21 commits to main since this release
Immutable release. Only release title and notes can be modified.
v0.4.0
84b7374

API compatible with node:sqlite from Node.js v25.6.1.

Added

  • enhance() function: Adds better-sqlite3-style .pragma() and .transaction() methods to any compatible database instance
  • isEnhanced() type guard: Check if a database has enhanced methods
  • Transaction helper: Automatic BEGIN/COMMIT/ROLLBACK with savepoint support for nested transactions
  • Pragma convenience method: Simple API for reading and setting SQLite pragmas with simple option
  • Node.js test sync script: npm run sync:tests downloads and adapts upstream Node.js SQLite tests
  • Percentile extension: SQLITE_ENABLE_PERCENTILE now enabled, adding percentile(), median(), percentile_cont(), percentile_disc() SQL functions (Node.js v25+)
  • Prepare options: db.prepare(sql, options) now accepts per-statement options (readBigInts, returnArrays, allowBareNamedParameters, allowUnknownNamedParameters) to override database-level defaults. This is a Node.js v25+ feature; node:sqlite on v24 and earlier silently ignores these options.
  • StatementColumnMetadata type: stmt.columns() now returns richer metadata including column, database, table, and type properties alongside name
  • SQLite 3.51.2: Updated from 3.51.1

Changed

  • BREAKING: Removed API extensions to achieve exact parity with node:sqlite:
    • Removed stmt.finalize() method (use database close for cleanup)
    • Removed stmt.finalized property
    • Removed stmt[Symbol.dispose] (still available on DatabaseSync and Session)
    • Removed db.backup() instance method (use standalone backup(db, path) function instead)
  • BREAKING: Session.changeset() and Session.patchset() now return Uint8Array instead of Buffer to match node:sqlite API
  • BREAKING: Defensive mode now defaults to true instead of false to match Node.js v25+ behavior. Use { defensive: false } to restore old behavior.

Fixed

  • Alpine Linux / musl stability: Fixed native crashes by removing N-API reference cleanup from destructors that corrupted V8 JIT state
  • Session lifecycle management: Fixed use-after-free, double-free, and mutex deadlock when databases are garbage collected before their sessions
  • Worker thread stability: Added cleanup hooks and exception handling for worker thread termination
  • Callback error preservation: applyChangeset() now preserves the original error message when JavaScript callbacks throw
  • createTagStore() now throws errors with code: 'ERR_INVALID_STATE' property when database is closed, matching Node.js error format

Full Changelog: v0.3.0...v0.4.0