Skip to content

Releases

v0.3.12

Choose a tag to compare

@github-actions github-actions released this 19 Nov 00:25
e35199d

This version fixes the error that readTransaction and syncedTransaction throw after a failed work. The API is the same.

  • Each function sets a pragma again at the end: query_only or synchronous. Before this version, an error of that restore hid the error of the work.
  • After an error of the work, the work error stays the error of the function, and onRollbackError gets the error of the restore. For example, SQLite refuses a change of synchronous in a transaction that a failed rollback did not end.
  • After a work with no error, an error of the restore is still the error of the function. The commit stays, and the connection keeps the setting of the work.

Runtime dependencies: none.

v0.3.11

Choose a tag to compare

@github-actions github-actions released this 18 Nov 23:34
fa7ac61

This version changes only doc comments. The code and the API are the same as in 0.3.10.

  • Each field of Integrity (ok, problems) and of Snapshot (path, bytes) has a doc comment.
  • A generator of procedures reads these comments. They become the descriptions of the output fields of the tools sqlite.checkIntegrity and sqlite.snapshot.

Runtime dependencies: none.

v0.3.10

Choose a tag to compare

@github-actions github-actions released this 18 Nov 22:51
8c9e5c9

This version adds the synced transaction. The change is backward compatible.

  • syncedTransaction(db, work, options) does the work in one BEGIN IMMEDIATE transaction whose commit is on the disk when the function ends.
  • On a connection with NORMAL, it sets synchronous to FULL for its commit, and sets the earlier value again at the end. A connection with FULL or EXTRA does not change.
  • A call in a transaction in progress throws. The rules of transaction apply to the rollback, the synchronous work and the dry run.
  • The type SyncedTransactionDatabase is the part of a connection that the function uses.
  • The power-cut test has two new cases. With NORMAL, the disk keeps each commit up to the last synced transaction.

Runtime dependencies: none.

v0.3.9

Choose a tag to compare

@github-actions github-actions released this 17 Nov 01:05
ec6de66

This version changes only the README. The code and the API are the same as in 0.3.8.

  • The README has the section "What a power cut keeps". It gives the commits that each journal and synchronous setting kept in a power-cut test on LazyFS.
  • FULL and EXTRA kept each commit. With WAL, NORMAL kept the commits up to the last checkpoint. OFF kept no commit.
  • The row synchronous of the options table links to the section.

Runtime dependencies: none.

v0.3.8

Choose a tag to compare

@github-actions github-actions released this 16 Nov 15:21
777948d

This version corrects the read of salvageEventLog on Node.js 22.13. The change is backward compatible.

  • On Node.js 22.13, a garbage collection during the read of the broken log can finalize the statement of the read.
  • Then the salvage stops with the error ERR_INVALID_STATE, and openCheckedEventLog cannot recover the file.
  • The salvage reads the broken log in pages of 500 rows with all(). It does not use iterate().
  • A test does a garbage collection after each 1000 events of a salvage of 50000 events. With the old read, it fails on Node.js 22.13.1.

Runtime dependencies: none.

v0.3.7

Choose a tag to compare

@github-actions github-actions released this 16 Nov 13:00
db9e476

This version adds the checked open of an event log. The change is backward compatible.

  • openCheckedEventLog(path, parse, options) opens a log in its own file after an integrity check. The default check is quick_check.
  • The result is a tagged union with the kinds created, opened, recovered and orphan-journal. Its type is CheckedEventLog.
  • A broken file goes into quarantine, and a new file gets each readable event. The field salvage has the counts kept and lost.
  • A WAL, SHM or journal file with no database file goes into quarantine. The function does not put that WAL into a new file.
  • Each step of the recovery can be done again. The record <path>.recovery.json keeps the quarantine folder and the counts across a crash.
  • A test stops the recovery after each step and opens the file again. The events and the quarantine are the same as after a recovery with no stop.
  • listRecoveries(path) gives each recovery from the records in the quarantine folders, in the sequence of at and then of id.
  • The id of an entry is the name of its quarantine folder. A caller can report each recovery at each start with this id, and a grow-only log keeps one report.
  • A folder with no record, or with a record that does not parse, gives an entry of the kind no-read. A recovery that is not complete is not in the list.
  • The types CheckedEventLogOptions, RecoveryCause, RecoveryEntry and SalvageCounts are new.

Runtime dependencies: none.

v0.3.6

Choose a tag to compare

@github-actions github-actions released this 16 Nov 04:10
feea17c

This version corrects the parameter type of confineToFile. The change is backward compatible.

  • confineToFile takes a DatabaseSync of each version of @types/node. Before, TypeScript refused the DatabaseSync of @types/node 22 with the error TS2559. That type has no setAuthorizer, so it had no member in common with ConfinableDatabase.
  • The parameter type is DatabaseSync | ConfinableDatabase. Each call that compiled before still compiles. The check at run time does not change.
  • The typecheck of the package also examines the source and a type test with @types/node 22 (tsconfig.node22.json). The type test gives a DatabaseSync of that version to each public function that takes a connection.

Runtime dependencies: none.

v0.3.5

Choose a tag to compare

@github-actions github-actions released this 16 Nov 01:55
8faaff0

This version adds a guard for the SQL text of a caller, and a function that gives each statement of a text. The change is backward compatible.

  • confineToFile(db) keeps the SQL of a node:sqlite connection on its file. It refuses ATTACH of a file, VACUUM INTO, the pragmas temp_store_directory and data_store_directory, and the function load_extension.
  • Each other statement runs as before. A plain VACUUM and clearDatabase also work.
  • The guard does not limit the time or the size of the work of a caller. An ATTACH '' can fill the temporary folder until the close. The host sets these limits.
  • The guard is the authorizer of SQLite, so it sees the statement after the parse. Comments, case and quotes do not change the result.
  • The guard needs setAuthorizer of Node.js 24.10 or later. On an earlier Node.js, confineToFile throws the new ConfineUnavailableError (code: "CONFINE_UNAVAILABLE"). The package still runs on Node.js 22.13.
  • The type ConfinableDatabase is the part of a connection that the guard uses.
  • eachStatement(db, sql) gives each statement of a SQL text in order. The function prepare of node:sqlite compiles only the first statement, and it ignores the rest with no error.
  • eachStatement compiles the next statement after the run of the statement before it. Thus a script can make a table and then write to it.
  • The types SourcedStatement and StatementSource are the parts of a statement and a connection that eachStatement uses.

Runtime dependencies: none.

v0.3.4

Choose a tag to compare

@github-actions github-actions released this 15 Nov 21:52
2b24b5a

This version runs on Node.js 22.13 or later, and the adapter of sql.js operates after a save. The change is backward compatible.

  • The engines field asks for Node.js 22.13, not 22.16. CI runs the tests on Node.js 22.13 in a second job.
  • transaction, readTransaction, checkpoint, clearDatabase and eventLog read the transaction state through one function. A connection with no isTransaction gets the probe. Before, a connection from new DatabaseSync() on Node.js 22.13 to 22.15 had no state, so a failed work stayed in its transaction.
  • eventLog and salvageEventLog keep a reference to the statement of a read. Before, Node.js 22.13 finalized that statement during some reads ("statement has been finalized").
  • sqlJsConnection compiles a statement for each call and frees it after the call. Before, it kept one statement for each SQL text, and an export() of sql.js frees each statement. So each call after the first save threw "Statement closed". The type SqlJsStatement has no reset, because the adapter does not use it. A Statement of sql.js still matches the type.
  • The tests do not use isOpen or FTS5, because Node.js 22.13 has neither.

Runtime dependencies: none.

v0.3.3

Choose a tag to compare

@github-actions github-actions released this 15 Nov 20:50
c4b7a4a

This version adds the parts that the SQLite stores of other packages keep as local copies. The change is backward compatible.

  • openDatabase takes readOnly: the connection reads an existing file and does not change it. The option wal also takes "when-writable": a file that the process cannot write keeps its journal mode. The type WalMode is new.
  • transaction takes commit: false: a dry run. The function rolls back after the work and gives the result of the work. This also applies to a savepoint.
  • checkpoint runs PRAGMA wal_checkpoint and gives its counts. The types CheckpointMode, Checkpointed and CheckpointDatabase are new.
  • clearDatabase drops each view and each table, and sets user_version to 0, for a cache that makes its tables again. The type ClearOptions is new.
  • sqlJsConnection gives a SqlConnection over a database of sql.js. The types SqlJsDatabase, SqlJsStatement, SqlJsValue and SqlJsConnection are structural, so the package has no new dependency.
  • Both entries export the new functions and types. WalMode is only in the main entry.
  • openDatabase and salvageEventLog use the class Database of node:sqlite when it is there. Node.js 26.11 renamed DatabaseSync to Database, and the old name gives a deprecation warning (DEP0210).
  • A Node.js before 22.16 has no isTransaction. Then openDatabase adds it to the connection as a probe: a BEGIN, which SQLite refuses in a transaction. sqlJsConnection uses the same probe. The engines field does not change.
  • One suite of tests runs the portable entry on node:sqlite, SQLite in WebAssembly and sql.js.

Runtime dependencies: none.