Registry / database / kysely-sqlite-utils

kysely-sqlite-utils

JSON →
library0.5.8jsnpmunverified

Utility functions for Kysely SQL query builder with SQLite backend. Version 0.5.8 provides helpers for logging, savepoints, integrity checking, version management, pragma optimization, foreign key control, query precompilation, and soft delete wrapper. Release is stable with MIT license. Key differentiators: type-safe pragma optimization, savepoint-based nested transactions, precompiled queries for performance. Minimal dependencies (only peer dep kysely >=0.26). Ships TypeScript types.

npm install kysely-sqlite-utils
INSTALL
IMPORT
SIG · KYSELY-SQLITE-UTIL
K
kysely-sqlite-utils
databasejavascriptv0.5.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createKyselyLogger
import { createKyselyLogger } from 'kysely-sqlite-utils'
const createKyselyLogger = require('kysely-sqlite-utils').createKyselyLogger
ESM named export; CommonJS require works but prefer import.
savePoint
import { savePoint } from 'kysely-sqlite-utils'
import { savePoint } from 'kysely-sqlite-utils/savePoint'
All utilities are exported from the main package.
createSoftDeleteExecutorFn
import { createSoftDeleteExecutorFn } from 'kysely-sqlite-utils'
Named export; no default export exists.
type SavePoint
import type { SavePoint } from 'kysely-sqlite-utils'
import { SavePoint } from 'kysely-sqlite-utils'
SavePoint is a type-only export; use type import to avoid runtime issues.

Shows importing and using createKyselyLogger and runWithSavePoint with Kysely SQLite.

import { Kysely, sqlite } from 'kysely' import { createKyselyLogger, savePoint, runWithSavePoint } from 'kysely-sqlite-utils' const db = new Kysely({ dialect: new SqliteDialect({ database: new Database('test.db') }), log: createKyselyLogger({ level: 'query', format: 'pretty' }) }) // Savepoint example await runWithSavePoint(db, async (trx) => { await trx.insertInto('users').values({ name: 'Alice' }).execute() // auto rollback on error }) console.log('Done')
Debug
Known issues
gotchaforeignKeys function does not perform param check; passing invalid boolean may cause unexpected behavior.
fix
Ensure enable parameter is strictly boolean; avoid truthy/falsy values.
affects: >=0.0.0
deprecatedprecompileQuery function is deprecated; use createPrecompile instead.
fix
Replace precompileQuery with createPrecompile.
affects: >=0.5.0
breakingPeer dependency kysely >=0.26 required; older versions may cause type errors.
fix
Upgrade kysely to 0.26 or later.
affects: >=0.5.0
gotchaSavePoint type is not a constructor; using it as a value will cause runtime error.
fix
Use import type { SavePoint } from 'kysely-sqlite-utils'.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: kysely_sqlite_utils_1.savePoint is not a function
Importing savePoint as default import or from wrong path.
fix
Use named import: import { savePoint } from 'kysely-sqlite-utils'
Cannot find module 'kysely-sqlite-utils/savePoint'
Attempting to import from a subpath that doesn't exist.
fix
Import from main package: import { savePoint } from 'kysely-sqlite-utils'
Module has no exported member 'SavePoint'. Did you mean to use 'import type'?
SavePoint is a type and cannot be imported as a value.
fix
Use import type { SavePoint } from 'kysely-sqlite-utils'
Cannot use namespace 'SavePoint' as a type.
Old TypeScript version or incorrect import.
fix
Ensure TypeScript >=4.5 and use type-only import.
Upgrade
Version history
0.5.8latest on npm
Audit
Dependencies
kyselyrequiredPeer dependency; library provides utilities for Kysely SQL query builder.
Agent activity
2 hits · last 30 days
node
2
Resources
kysely-sqlite-utils — npm install kysely-sqlite-utils · libregistry