@rulvar/store-sqlite 1.3.0 → 1.3.2
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 +26 -0
- package/dist/index.js +2 -2
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# @rulvar/store-sqlite
|
|
2
|
+
|
|
3
|
+
SQLite journal store implementing the rulvar storage SPI with the lease
|
|
4
|
+
capability and a fencing epoch, on the builtin `node:sqlite` driver; the
|
|
5
|
+
reference implementation for community stores. Exports `SqliteStore`.
|
|
6
|
+
|
|
7
|
+
Part of [rulvar](https://rulvar.com), an embeddable TypeScript engine
|
|
8
|
+
for durable, budget-bounded multi-agent LLM workflows, where a completed
|
|
9
|
+
LLM call is never paid for twice. Full documentation:
|
|
10
|
+
[docs.rulvar.com](https://docs.rulvar.com).
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add @rulvar/core @rulvar/store-sqlite
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Documentation
|
|
19
|
+
|
|
20
|
+
- [Stores](https://docs.rulvar.com/guide/stores)
|
|
21
|
+
- [Store authors](https://docs.rulvar.com/guide/store-authors)
|
|
22
|
+
- [API reference](https://docs.rulvar.com/api/%40rulvar/store-sqlite/)
|
|
23
|
+
|
|
24
|
+
## License
|
|
25
|
+
|
|
26
|
+
[Apache-2.0](https://github.com/o-stepper/rulvar/blob/main/LICENSE)
|
package/dist/index.js
CHANGED
|
@@ -66,7 +66,7 @@ var SqliteStore = class {
|
|
|
66
66
|
/** Rejects unless `lease` is the CURRENT live lease for its run. */
|
|
67
67
|
assertFencing(lease) {
|
|
68
68
|
const live = this.liveLease(lease.runId);
|
|
69
|
-
if (live === void 0 || live.owner !== lease.owner || live.epoch !== lease.epoch) throw new LeaseHeldError(`stale fencing epoch for run '${lease.runId}': lease (owner ${lease.owner}, epoch ${lease.epoch}) is not the current holder; the append or renew is rejected and nothing became visible
|
|
69
|
+
if (live === void 0 || live.owner !== lease.owner || live.epoch !== lease.epoch) throw new LeaseHeldError(`stale fencing epoch for run '${lease.runId}': lease (owner ${lease.owner}, epoch ${lease.epoch}) is not the current holder; the append or renew is rejected and nothing became visible`);
|
|
70
70
|
}
|
|
71
71
|
async append(runId, e, lease) {
|
|
72
72
|
if (lease !== void 0) this.assertFencing(lease);
|
|
@@ -103,7 +103,7 @@ var SqliteStore = class {
|
|
|
103
103
|
this.db.exec("BEGIN IMMEDIATE");
|
|
104
104
|
try {
|
|
105
105
|
const live = this.liveLease(runId);
|
|
106
|
-
if (live !== void 0) throw new LeaseHeldError(`run '${runId}' is leased by '${live.owner}' (epoch ${live.epoch}); acquire on a held lease rejects
|
|
106
|
+
if (live !== void 0) throw new LeaseHeldError(`run '${runId}' is leased by '${live.owner}' (epoch ${live.epoch}); acquire on a held lease rejects`);
|
|
107
107
|
const epoch = (this.db.prepare("SELECT epoch FROM epochs WHERE run_id = ?").get(runId)?.epoch ?? 0) + 1;
|
|
108
108
|
this.db.prepare("INSERT INTO epochs (run_id, epoch) VALUES (?, ?) ON CONFLICT(run_id) DO UPDATE SET epoch = excluded.epoch").run(runId, epoch);
|
|
109
109
|
this.db.prepare("INSERT INTO leases (run_id, owner, epoch, expires_at) VALUES (?, ?, ?, ?) ON CONFLICT(run_id) DO UPDATE SET owner = excluded.owner, epoch = excluded.epoch, expires_at = excluded.expires_at").run(runId, owner, epoch, this.now() + this.ttlMs);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/store-sqlite",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "rulvar SQLite store implementing JournalStore and LeasableStore with a fencing epoch.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@rulvar/core": "1.3.
|
|
25
|
+
"@rulvar/core": "1.3.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.20.0",
|
|
29
29
|
"tsdown": "^0.22.3",
|
|
30
30
|
"typescript": "~6.0.3",
|
|
31
|
-
"@rulvar/store-conformance": "1.3.
|
|
31
|
+
"@rulvar/store-conformance": "1.3.2"
|
|
32
32
|
},
|
|
33
33
|
"repository": {
|
|
34
34
|
"type": "git",
|