@bastani/atomic-storage-libsql 0.9.90 → 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/README.md +2 -2
- package/libsql.js +4 -4
- package/package.json +2 -2
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
|
|
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 }
|
|
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
|
|
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
|
|
1721
|
-
//
|
|
1722
|
-
//
|
|
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.
|
|
4
|
-
"description": "libSQL / Turso storage adapter for Atomic sessions
|
|
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"
|