OptionaldbIndexedDB database name (default: 'app-db')
OptionalstoreIndexedDB object store name (default: 'sqliteDb')
OptionalautoAuto-save to IndexedDB on a timer (default: true)
OptionalsaveSave interval in milliseconds for batched writes (default: 5000)
Optionalsqlsql.js configuration (e.g., locateFile for wasm)
OptionaldurabilityWhen a write is stored in IndexedDB.
'interval', the default: the auto-save tick stores the writes made
since the last save, every saveIntervalMs; flush() and close()
store them at once. A write can be lost when the page goes before the
next tick.'commit': run(), exec(), a write through all() or get()
(INSERT ... RETURNING) and transaction() resolve once their write is
in IndexedDB, and reject when IndexedDB refuses it (the write stays in
the database and the next save stores it, unless crossTab's
rollbackRefusedSaves gives it up). Each save writes the whole
database image, so batch many writes in one transaction(). While a
transaction a caller opened with BEGIN is open, nothing can be saved:
its statements resolve at once, and its rows are stored when its
COMMIT resolves.OptionalcrossKeeps the writes of two tabs of the site that open the same database. Each tab holds the whole database in memory and writes it back whole, so without this the tab that saves last overwrites the other's writes.
With crossTab, every statement and transaction runs under a Web Lock on
the database, on the newest stored image (a tab reloads it when another
has saved), and is stored before the lock is let go: durability is
'commit' whatever it says. Where the browser has no Web Locks (Safari
before 15.4, an insecure origin, Lockdown Mode), the version stamp stored
beside the image keeps both tabs' writes alone: a statement that finds
another tab saved first runs again on the newer image, and a
transaction() is refused with IndexedDbConflictError, storing
nothing, for its caller to run again. The adapter says once when it runs
without Web Locks.
A transaction begun with BEGIN through run() or exec() cannot be
held across tabs: it is rolled back and refused. Use transaction().
OptionalsegmentA database of its own: the segment is appended to dbName
(app-db becomes app-db-agentos). Lower-case letters, digits and
underscores.
OptionalmemoryKeeps the database in memory alone: IndexedDB is never opened, nothing is
stored, and capabilities carries no persistence. durability reads
'interval' and crossTab is off, since there is nothing to store or to
share. For a browser that refuses IndexedDB (a private window, a blocked
storage setting), where open() would otherwise reject.
Configuration for IndexedDB adapter.