/** * lib/sqliteUnavailable — the one refusal for "this Node has no `node:sqlite`". * * Pattern: leaf error type (imports nothing). * Role: shared by `hosting/sqliteSessions` and `adapters/memory/sqliteVector`. * It lives here rather than in either of them because two adapters * hitting the same missing module must raise the same error: a * consumer catching `SqliteUnavailableError` should not have to know * which of our stores was being constructed, and two classes of one * name is a duplicate type the build refuses anyway. * Emits: N/A. * * Node 20 does not have the module at all; Node 22.5 through 22.12 have it * behind `--experimental-sqlite`; Node 22.13+ and 23.4+ have it as-is (still * marked experimental by Node, which is why it prints a warning on first use). * * The refusal names the version you are on and the three ways out, because * "cannot find module 'node:sqlite'" out of a library's guts tells you what * broke and nothing about what to do. * * **There is deliberately no fallback.** Each caller supplies its own last * sentence saying what a silent fallback would have looked like from the * outside, because that sentence is the argument — not decoration. */ /** What the refusal says about the caller that raised it. */ export interface SqliteUnavailableContext { /** The factory the consumer actually wrote, e.g. `sqliteSessions()`. */ readonly factory: string; /** The honest in-memory alternative, named so it can be reached for. */ readonly alternative: string; /** Why falling back to that alternative silently would be worse than refusing. */ readonly whyNotFallback: string; /** Which door the message belongs to, for the `[prefix]` tag. */ readonly door: string; } /** * Raised when `node:sqlite` is not available in the running Node. * * @example * ```ts * try { * const store = sqliteVectorStore({ file: './corpus.db' }); * } catch (err) { * if (err instanceof SqliteUnavailableError) { * console.error(`Node ${err.nodeVersion} cannot do this`, err.message); * } * } * ``` */ export declare class SqliteUnavailableError extends Error { readonly code: "ERR_SQLITE_UNAVAILABLE"; /** The Node version this process is running. */ readonly nodeVersion: string; constructor(nodeVersion: string, reason: string, context?: SqliteUnavailableContext); }