Registry / database / station-adapter-sqlite

station-adapter-sqlite

JSON →
library1.0.4jsnpmunverified

SQLite storage adapter for station-signal using better-sqlite3. Version 1.0.4. Synchronous better-sqlite3 wrapped in async interface matching SignalQueueAdapter. Defaults to WAL mode. Auto-creates tables and indexes. Requires peer dependencies station-signal, station-broadcast, station-schedules. ESM-only, ships TypeScript types. Requires Node >=18.

npm install station-adapter-sqlite
INSTALL
IMPORT
SIG · STATION-ADAPTER-SQ
S
station-adapter-sqlite
databasejavascriptv1.0.4
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.

SqliteAdapter
import { SqliteAdapter } from 'station-adapter-sqlite'
const SqliteAdapter = require('station-adapter-sqlite')
Package is ESM-only. CommonJS require will fail.
SqliteAdapterOptions
import type { SqliteAdapterOptions } from 'station-adapter-sqlite'
import { SqliteAdapterOptions } from 'station-adapter-sqlite'
Use type-only import for TypeScript interfaces to avoid runtime overhead.
default
import { SqliteAdapter } from 'station-adapter-sqlite'
import SqliteAdapter from 'station-adapter-sqlite'
Package does not export a default. Named import only.

Configures the SQLite adapter globally, shows custom options, integrates with SignalRunner with configModule, and handles graceful shutdown.

import { configure } from 'station-signal'; import { SqliteAdapter } from 'station-adapter-sqlite'; // Configure globally with default options (creates station-signal.db) configure({ adapter: new SqliteAdapter() }); // With custom options const adapter = new SqliteAdapter({ dbPath: process.env.SIGNAL_DB_PATH ?? './data/jobs.db', tableName: 'signal_entries', }); // Use in SignalRunner import { SignalRunner } from 'station-signal'; import { fileURLToPath } from 'node:url'; const runner = new SignalRunner({ signalsDir: './src/signals', configModule: fileURLToPath(new URL('./adapter.config.ts', import.meta.url)), }); await runner.start(); // Graceful shutdown process.on('SIGINT', () => { adapter.close(); process.exit(0); });
Debug
Known issues
breakingpnpm 10 blocks lifecycle scripts by default. better-sqlite3 will fail to compile.
fix
Add 'better-sqlite3' to pnpm.onlyBuiltDependencies in package.json and reinstall.
affects: >=10
gotchaMethods are async but use synchronous better-sqlite3 under the hood. This can block the event loop.
fix
Do not rely on concurrency benefits from async IO; consider offloading to worker threads if many operations.
affects: >=1.0.0
deprecatedNo deprecation warnings issued yet. Adapter is stable as of v1.0.4.
fix
N/A
affects: >=1.0.0
gotchaDefault dbPath is 'station-signal.db' relative to CWD. May not be writable in production environments.
fix
Always specify an absolute path for production deployments.
affects: >=1.0.0
gotchaWAL mode enabled by default. Table and indexes are created automatically on first use (CREATE TABLE IF NOT EXISTS).
fix
Ensure running user has write permissions to the database directory.
affects: >=1.0.0
Errors
Common errors & fixes
The native binary for better-sqlite3 hasn't been compiled.
pnpm 10 blocks lifecycle scripts needed to compile native modules.
fix
Add 'better-sqlite3' to pnpm.onlyBuiltDependencies and run pnpm install.
ERR_REQUIRE_ESM: require() of ES Module
Using CommonJS require() on an ESM-only package.
fix
Use import { SqliteAdapter } from 'station-adapter-sqlite' or switch to ESM.
TypeError: SqliteAdapter is not a constructor
Trying to use default import or calling without new.
fix
Use new SqliteAdapter() with proper named import.
Error: Cannot find module 'better-sqlite3'
better-sqlite3 not installed or platform-specific build missing.
fix
Install better-sqlite3: pnpm add better-sqlite3 (must compile native binaries).
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies
better-sqlite3requiredSynchronous SQLite driver used under the hood
station-signalrequiredPeer dependency providing configure and SignalRunner
station-broadcastrequiredPeer dependency for broadcasting
station-schedulesrequiredPeer dependency for scheduling
Agent activity
19 hits · last 30 days
node
16
Meta
1
OpenAI (training)
1
Resources
station-adapter-sqlite — npm install station-adapter-sqlite · libregistry