import type { DataStore, DataStoreOpenOptions } from './data-store.js'; export declare const DataStoreFactory: { /** * Open a DataStore (SQLite or in-memory) and run pending migrations. * * For SQLite, a version guard runs first: if the file was stamped by a NEWER * CLI than this one (`PRAGMA user_version` ahead of the bundled migration * count), it throws {@link DataStoreVersionError} instead of letting Drizzle * silently no-op into a runtime column error. After a successful migrate, the * stamp is refreshed to this CLI's supported version. * * @throws {DataStoreVersionError} When the SQLite file was written by a newer * opensip-cli than this CLI supports (the downgrade direction). * @throws {DataStoreMigrationError} When the SQLite file cannot be opened * (corrupt header, missing parent directory, permission errors), when the * native `better-sqlite3` binding fails to load (an ABI mismatch — the file * is fine, the addon was built for a different Node.js version), or when * running the migrations folder fails. The original cause is preserved via * the `cause` field; the message distinguishes the binding case so callers * are not told to delete a healthy data store. */ open(opts: DataStoreOpenOptions & { migrationsFolder?: string; }): DataStore; }; /** * Detect a native-binding load failure: `better-sqlite3`'s compiled addon was * built for a different Node.js ABI than the one now running (e.g. the binding * was compiled under Node 22 and the CLI is run under Node 24). This is NOT a * data problem — the SQLite file is intact and must not be deleted; the fix is * to rebuild the native module for the current Node.js. * * Identified by the Node loader's `ERR_DLOPEN_FAILED` code or the * `NODE_MODULE_VERSION` / "compiled against a different Node.js version" text, * scanned across the whole `cause` chain (the error may be wrapped). */ export declare function isNativeBindingError(error: unknown): boolean; /** * Build the user-facing message for a data-store open failure, choosing the * remediation that matches the actual cause: a native-binding ABI mismatch * (rebuild the addon — the data is fine) vs a genuine corrupt/permission/ * non-writable SQLite file (delete to start fresh) vs an in-memory programming * error. Separated from the throw site so the cause→message mapping is unit * testable without exercising the real binding. */ export declare function openFailureMessage(opts: DataStoreOpenOptions, error: unknown): string; //# sourceMappingURL=factory.d.ts.map