@bastani/atomic-storage-libsql 0.9.90-alpha.1 → 0.10.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.90] - 2026-11-19
6
+
7
+ ### Fixed
8
+
9
+ - A `CREATE TRIGGER` sent alone in `exec` now retries after `SQLITE_SCHEMA` while other connections change a libSQL server's schema. Semicolons inside the trigger body no longer make it look like several statements. An `exec` containing additional statements is still never replayed, also when names in the trigger use characters outside ASCII such as combining accents. One statement followed by white space outside ASCII after its `;`, such as a byte-order mark or a no-break space, counts as one statement again: it runs again after `SQLITE_SCHEMA` or a busy answer, falls back to a write transaction of its own while other connections keep changing the schema, and a `SELECT` written so runs on the reused stream, as before that trigger change ([#5509](https://github.com/bastani-inc/atomic/issues/5509), [#5676](https://github.com/bastani-inc/atomic/issues/5676))
10
+ - Write batches now refresh their schema after taking the write lock. A connection opened before another connection's schema change could otherwise report `no such table` for an existing table, including when a single write retried after `SQLITE_SCHEMA` ([#5536](https://github.com/bastani-inc/atomic/issues/5536))
11
+ - On a libSQL server (sqld) whose schema other connections keep changing, an `exec` of several statements outside a transaction no longer fails now and then with `SQLITE_SCHEMA: database schema has changed`, or with `SQLITE_BUSY`. The server refuses one statement this way without running it, after the statements before it committed, and the adapter used to report the failure without saying which statements ran. Such an `exec` is now sent as its statements, still in one request that runs them in order and stops at the first failure. A statement the server refused this way is sent again on its own, the way a single statement is, and the statements after it follow in another request. A statement that ran is never sent again. If a later request fails before reaching the server, the error is a `StorageTransientError` with an `unknown` outcome rather than `not-applied`, so the whole `exec` is not run again. A text with a `PRAGMA`, transaction control, a temporary table, a statement that returns rows (`SELECT`, `VALUES`, `WITH` or `RETURNING`), `last_insert_rowid()`, `changes()` or a parameter, or one the adapter cannot split exactly, is still sent as one text and not sent again. A text the server cannot read fails with the server's error for the whole text, which names the line and column in it, and an error inside a statement gives the same position as before ([#5652](https://github.com/bastani-inc/atomic/issues/5652))
12
+
5
13
  ## [0.9.90-alpha.1] - 2026-11-19
6
14
 
7
15
  ### Fixed
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @bastani/atomic-storage-libsql
2
2
 
3
- A libSQL / [Turso](https://turso.tech) storage adapter for [Atomic](https://github.com/bastani-inc/atomic). It stores sessions, workflow journals, and Intercom multi-node routing in one shared database, so several machines can use the same state. It is a separate package: install it only where you want remote storage.
3
+ A libSQL / [Turso](https://turso.tech) storage adapter for [Atomic](https://github.com/bastani-inc/atomic). It stores sessions and Intercom multi-node routing in one shared database, so several machines can use the same state. It is a separate package: install it only where you want remote storage.
4
4
 
5
5
  ## Install
6
6
 
@@ -49,7 +49,7 @@ import { openLibsqlDatabase } from "@bastani/atomic-storage-libsql";
49
49
  const database = await openLibsqlDatabase({ url: "libsql://<db>.turso.io", authToken });
50
50
  ```
51
51
 
52
- `openLibsqlDatabase` also accepts `namespace` and `headers` (extra request headers, redacted from errors), both for `libsql:`, `https:`, or `http:` URLs. The returned `SqliteDatabase` can be passed as SDK `sessionStore: { kind: "database", database }` or workflow `journal: { database }`; it sends a workflow journal's batch of appends to the database in one request.
52
+ `openLibsqlDatabase` also accepts `namespace` and `headers` (extra request headers, redacted from errors), both for `libsql:`, `https:`, or `http:` URLs. The returned `SqliteDatabase` can be passed as SDK `sessionStore: { kind: "database", database }`; it sends a batch of statements to the database in one request.
53
53
 
54
54
  The package ships plain ESM JavaScript with TypeScript declarations. This import works in supported Node versions without a TypeScript loader.
55
55
 
package/libsql.js CHANGED
@@ -1107,7 +1107,7 @@ function driverResult(result) {
1107
1107
  /**
1108
1108
  * How long a connection to a local `file:` database waits for a lock another connection holds before failing with
1109
1109
  * `SQLITE_BUSY`, as Atomic's own SQLite stores wait. Without it the driver fails at once, so two processes writing
1110
- * one file, such as a workflow root, its coordinator and its workers, lose statements to each other.
1110
+ * one file, such as two Atomic processes that share a session store, lose statements to each other.
1111
1111
  */
1112
1112
  const FILE_BUSY_TIMEOUT_MS = 5000;
1113
1113
 
@@ -1717,9 +1717,9 @@ function createConnection(url, authToken, added, redact, createClient, protocol)
1717
1717
  local ? undefined : writeTransaction,
1718
1718
  protocol === undefined ? undefined : (separate) => stepBatch(protocol[0], protocol[3], remote(), separate),
1719
1719
  ),
1720
- // One request for the whole batch, in a write transaction: the journal sends a batch of appends this way. Only
1721
- // its `BEGIN IMMEDIATE` waits for the write lock, so a batch the busy timeout ended wrote nothing (`lockBusy`). A
1722
- // server's batch counts against this process's writes in flight to that server, unless it has priority.
1720
+ // One request for the whole batch, in a write transaction. Only its `BEGIN IMMEDIATE` waits for the write lock,
1721
+ // so a batch the busy timeout ended wrote nothing (`lockBusy`). A server's batch counts against this process's
1722
+ // writes in flight to that server, unless it has priority.
1723
1723
  batch: (batched, options) => {
1724
1724
  const send = () => writeTransaction(batched);
1725
1725
  if (local) return waitForLock(send);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bastani/atomic-storage-libsql",
3
- "version": "0.9.90-alpha.1",
4
- "description": "libSQL / Turso storage adapter for Atomic sessions, workflow journals, and Intercom.",
3
+ "version": "0.10.0-alpha.1",
4
+ "description": "libSQL / Turso storage adapter for Atomic sessions and Intercom.",
5
5
  "contributors": [
6
6
  "Norin Lavaee",
7
7
  "Alex Lavaee"