An undo log for SQLite 3
First, wrap the SQLite client...
const database = new NodeSqlite3DatabaseImpl(":memory:");
const connection = await database.connect();
Then, create and install the undo log services...
const api = createUndoLogServices(connection)
const { setup } = api;
const log = await setup.initializeSingle();
Last, but not least: Record your actions and undo them if required.
await log.trackWithin(async () => {
// <-- record all your INSERT, DELETE & UPDATE statements
});
await log.undo();