Graphorin API reference v0.1.0
Graphorin API reference / @graphorin/store-sqlite / connection
connection
Classes
| Class | Description |
|---|---|
| SqliteVecMissingError | - |
| WalCheckpointManager | Periodic wal_checkpoint(RESTART) runner. Invoked by the worker pool every intervalMs to bound WAL growth on long-running servers. |
Interfaces
| Interface | Description |
|---|---|
| BetterSqlite3Database | Subset 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. |
| BetterSqlite3Statement | Subset of the better-sqlite3 prepared-statement surface used by the store. |
| OpenConnectionOptions | Options for openConnection. |
| SqliteConnection | The 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 Alias | Description |
|---|---|
| BetterSqlite3Constructor | Constructor signature exposed by both better-sqlite3 and better-sqlite3-multiple-ciphers (the cipher peer is a drop-in replacement of the default driver). |
Variables
| Variable | Description |
|---|---|
| WAL_HARDENING_PRAGMAS | Mandatory 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
| Function | Description |
|---|---|
| _resetDriverCacheForTesting | Test-only helper. Drops cached driver / loader handles so the next openConnection(...) call resolves them again. |
| openConnection | Opens 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). |
| readPragma | Pragma 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. |
| readWalSize | Returns the byte size of the WAL file, or 0 when the file is absent / empty. Surfaced as graphorin.storage.wal.size_bytes. |