Skip to content

Graphorin API reference v0.1.0


Graphorin API reference / @graphorin/store-sqlite / connection

connection

Classes

ClassDescription
SqliteVecMissingError-
WalCheckpointManagerPeriodic wal_checkpoint(RESTART) runner. Invoked by the worker pool every intervalMs to bound WAL growth on long-running servers.

Interfaces

InterfaceDescription
BetterSqlite3DatabaseSubset of the better-sqlite3 Database surface used by the store. Declared structurally so the package can defer the peer dependency load to runtime and keep the module load free of side effects.
BetterSqlite3StatementSubset of the better-sqlite3 prepared-statement surface used by the store.
OpenConnectionOptionsOptions for openConnection.
SqliteConnectionThe runtime contract every higher-level store interacts with. The concrete adapter is built by openConnection and wraps either better-sqlite3 (default) or better-sqlite3-multiple-ciphers (encryption-at-rest opt-in).

Type Aliases

Type AliasDescription
BetterSqlite3ConstructorConstructor signature exposed by both better-sqlite3 and better-sqlite3-multiple-ciphers (the cipher peer is a drop-in replacement of the default driver).

Variables

VariableDescription
WAL_HARDENING_PRAGMASMandatory WAL hardening pragmas applied at connection open. Any deviation must be documented in the calling site's TSDoc per the Phase 05 acceptance criteria.

Functions

FunctionDescription
_resetDriverCacheForTestingTest-only helper. Drops cached driver / loader handles so the next openConnection(...) call resolves them again.
openConnectionOpens a connection. Side effects (in this order): 1. Resolve the encryption passphrase if encryption.enabled === true. 2. Load the cipher driver or the default better-sqlite3 peer. 3. Create the parent directory if absent (recursive: true). 4. Open the database file. 5. Apply WAL hardening pragmas. 6. Apply the cipher passphrase (PRAGMA key = ...). 7. Load sqlite-vec (unless skipSqliteVec is set).
readPragmaPragma helper that surfaces the runtime value of a single setting as a typed scalar. Used by the integration tests to verify the WAL hardening defaults landed correctly.
readWalSizeReturns the byte size of the WAL file, or 0 when the file is absent / empty. Surfaced as graphorin.storage.wal.size_bytes.