@sproutboat/wire 0.17.0 → 0.19.0
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 +70 -0
- package/package.json +2 -2
- package/src/broker.test.ts +370 -97
- package/src/broker.ts +348 -170
- package/src/d1.ts +19 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,75 @@
|
|
|
1
1
|
# @sproutboat/wire
|
|
2
2
|
|
|
3
|
+
## 0.19.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 140f0f7: Durable Objects `ctx.storage.sql` from compatibility date `2026-10-29`, on every
|
|
8
|
+
transport. Each object gets its own SQLite database.
|
|
9
|
+
|
|
10
|
+
- `exec(query, ...bindings)` runs one statement and returns a cursor with `toArray()`,
|
|
11
|
+
`one()`, `raw()`, `next()`, iteration, `columnNames`, `rowsRead` and `rowsWritten`.
|
|
12
|
+
- BLOBs come back as ArrayBuffers.
|
|
13
|
+
- Foreign keys are enforced.
|
|
14
|
+
- `BEGIN`, `SAVEPOINT` and the other transaction statements throw workerd's error. Use
|
|
15
|
+
`storage.transactionSync(fn)`, which rolls back if `fn` throws.
|
|
16
|
+
- `sql.databaseSize` gives the database's size in bytes.
|
|
17
|
+
- Errors read as in workerd, for example `near "SELEKT": syntax error at offset 0:
|
|
18
|
+
SQLITE_ERROR`.
|
|
19
|
+
|
|
20
|
+
Every Durable Object class gets `sql`, since `sproutboat.jsonc` has no
|
|
21
|
+
`new_sqlite_classes`. The key-value API keeps its own store.
|
|
22
|
+
|
|
23
|
+
Where the databases live:
|
|
24
|
+
- **Standalone executables and sproutd:** in `<data>/do-sql/CLASS/ID.sqlite`. At most 8
|
|
25
|
+
stay open, and the one used longest ago closes for the next one.
|
|
26
|
+
- **Broker (wire):** new op `do.sql`. With `doDb`, the databases sit in
|
|
27
|
+
`<doDb without .sqlite>.do-sql/` next to it, so they survive a redeploy and stay
|
|
28
|
+
separate per project. Without a SQL pool, the broker keeps at most 64 open
|
|
29
|
+
(`createD1Store`'s new `maxOpen`).
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [9167b44]
|
|
34
|
+
- Updated dependencies [140f0f7]
|
|
35
|
+
- @sproutboat/runtime@0.30.0
|
|
36
|
+
|
|
37
|
+
## 0.18.0
|
|
38
|
+
|
|
39
|
+
### Minor Changes
|
|
40
|
+
|
|
41
|
+
- 8df17ef: Durable Objects like workerd from compatibility date `2026-10-28`:
|
|
42
|
+
|
|
43
|
+
- **Input gate.** While an object's storage read is in flight, no other event
|
|
44
|
+
(`stub.fetch()`, an alarm) enters it, so `const v = await storage.get("n"); await
|
|
45
|
+
storage.put("n", v + 1)` is safe under concurrent calls. Ten concurrent increments used
|
|
46
|
+
to end at 1. An event that awaits anything else (a fetch, a timer) lets the next one
|
|
47
|
+
in, as in workerd. `blockConcurrencyWhile()` and `transaction()` hold the gate until
|
|
48
|
+
they settle, and `stub.fetch()` always returns a Promise.
|
|
49
|
+
- **Storage returns Promises** (`get`, `put`, `delete`, `deleteAll`, `list`, the alarm
|
|
50
|
+
methods), and adds `sync()` and `transaction()` (with `txn.rollback()`; a throw rolls
|
|
51
|
+
back; a transaction reads its own writes).
|
|
52
|
+
- **Structured values.** Date, Map, Set, RegExp, ArrayBuffer and typed arrays, BigInt,
|
|
53
|
+
`undefined` inside containers, NaN, the infinities and -0 round-trip.
|
|
54
|
+
`put(k, undefined)` throws a TypeError and a function throws a DataCloneError, before
|
|
55
|
+
anything is written.
|
|
56
|
+
- `list()` takes `start`, `startAfter`, `end` and `reverse`, and `limit: 0` throws.
|
|
57
|
+
`setAlarm()` refuses a value that is not a Date or a number. `deleteAll()` also drops
|
|
58
|
+
the alarm.
|
|
59
|
+
|
|
60
|
+
Earlier dates keep synchronous JSON storage and no gate. Values written from
|
|
61
|
+
`2026-10-28` start with `#sb1:`, and every date reads both formats.
|
|
62
|
+
|
|
63
|
+
Both transports' `do.storage.list` take `start`, `startAfter`, `end` and `reverse`, and
|
|
64
|
+
match the prefix exactly (SQL `LIKE` also matched `_` and `%` as wildcards, ignoring
|
|
65
|
+
case, so a prefix such as `user_` listed other keys).
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- Updated dependencies [8df17ef]
|
|
70
|
+
- Updated dependencies [8df17ef]
|
|
71
|
+
- @sproutboat/runtime@0.29.0
|
|
72
|
+
|
|
3
73
|
## 0.17.0
|
|
4
74
|
|
|
5
75
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sproutboat/wire",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@sproutboat/assets": "^0.3.0",
|
|
26
|
-
"@sproutboat/runtime": "^0.
|
|
26
|
+
"@sproutboat/runtime": "^0.30.0"
|
|
27
27
|
}
|
|
28
28
|
}
|