@flow-state-dev/store-sqlite/host
Type Aliases
CreateSQLiteRequestStoreOptions
type CreateSQLiteRequestStoreOptions = object;
Options for the SQLite-backed request store.
Properties
subscribePollIntervalMs?
subscribePollIntervalMs?: number;
Poll interval for subscribeToEvents in milliseconds. Default 100ms.
Lower values reduce live-tail latency at the cost of read load on the
request_events table.
SQLiteStoreRegistry
type SQLiteStoreRegistry = StoreRegistry & object;
@flow-state-dev/store-sqlite/host: what a host or adapter author builds
with — the registry factory, the per-store constructors and the schema
helpers. Public and semver-covered. App code imports sqliteStores from
@flow-state-dev/store-sqlite.
Type Declaration
close()
close(): void;
Close the underlying SQLite connection
Returns
void
SQLiteTraceStoreOptions
type SQLiteTraceStoreOptions = object;
Properties
maxRequests?
maxRequests?: number;
Functions
applyConnectionPragmas()
function applyConnectionPragmas(db): void;
Apply per-connection PRAGMAs (busy_timeout, synchronous, cache_size,
temp_store, foreign_keys) plus journal_mode (persisted on the database
file but cheap to re-issue). Every new better-sqlite3 connection starts
with SQLite defaults — notably busy_timeout = 0, which fails concurrent
writes immediately with SQLITE_BUSY instead of waiting. This MUST run
on every fresh connection, including ones constructed with
skipSchemaInit: true.
Parameters
db
Database
Returns
void
createSQLiteActiveRequestRegistry()
function createSQLiteActiveRequestRegistry(db): ActiveRequestRegistry;
Parameters
db
Database
Returns
ActiveRequestRegistry
createSQLiteCheckpointStore()
function createSQLiteCheckpointStore(db): CheckpointStore;
Parameters
db
Database
Returns
CheckpointStore
createSQLiteLeaseStore()
function createSQLiteLeaseStore(db): LeaseStore;
Parameters
db
Database
Returns
LeaseStore
createSQLiteOrgStore()
function createSQLiteOrgStore(db): OrgStore;
Parameters
db
Database
Returns
OrgStore
createSQLiteRequestStore()
function createSQLiteRequestStore(db, options?): RequestStore;
Create a SQLite-backed RequestStore using the provided database handle.
Parameters
db
Database
options?
CreateSQLiteRequestStoreOptions
Returns
RequestStore
createSQLiteSessionStore()
function createSQLiteSessionStore(db): SessionStore;
Parameters
db
Database
Returns
SessionStore
createSQLiteStores()
function createSQLiteStores(options): SQLiteStoreRegistry;
Create a StoreRegistry backed by SQLite. Per-connection PRAGMAs are
always applied. Schema DDL auto-initializes on first call unless
skipSchemaInit: true.
Parameters
options
Returns
createSQLiteSuspensionStore()
function createSQLiteSuspensionStore(db): SuspensionStore;
Parameters
db
Database
Returns
SuspensionStore
createSQLiteTraceStore()
function createSQLiteTraceStore(db, options?): TraceStore;
Parameters
db
Database
options?
Returns
TraceStore
createSQLiteUserStore()
function createSQLiteUserStore(db): UserStore;
Parameters
db
Database
Returns
UserStore
createSQLiteWakeStore()
function createSQLiteWakeStore(db): WakeStore;
Parameters
db
Database
Returns
WakeStore
initializeSchema()
function initializeSchema(db): void;
Apply per-connection pragmas and run schema DDL. Convenience wrapper for
standalone callers that own their own Database instance and want both
in one call.
createSQLiteStores does not use this — it calls applyConnectionPragmas
unconditionally and initializeSchemaDDL only when skipSchemaInit is
not set, so a runtime registry constructed with skipSchemaInit: true
still gets the pragmas required for safe concurrent access.
Parameters
db
Database
Returns
void
initializeSchemaDDL()
function initializeSchemaDDL(db): void;
Run schema DDL: rename migrations + create-table-if-not-exists +
create-index-if-not-exists. Idempotent. Does NOT apply per-connection
pragmas — call applyConnectionPragmas for that.
Parameters
db
Database
Returns
void