@crvouga/mockingbird-service-dynamodb-streams 1.9.0 → 1.10.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 +11 -0
- package/dist/{chunk-VR6MPV3X.js → chunk-QEV4CKKG.js} +21 -12
- package/dist/chunk-QEV4CKKG.js.map +7 -0
- package/dist/{chunk-YYGOL6VS.js → chunk-TDHYEV6F.js} +3 -3
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/server.d.ts +2 -0
- package/dist/server.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-VR6MPV3X.js.map +0 -7
- /package/dist/{chunk-YYGOL6VS.js.map → chunk-TDHYEV6F.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-dynamodb-streams
|
|
2
2
|
|
|
3
|
+
## 1.10.0 (2026-10-24)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- add buffered SQL durability ([288bdcc](https://github.com/crvouga/mockingbird/commit/288bdcca84582787a54c4fdf9e803db9aac0b8d7))
|
|
8
|
+
- add efficient browser durability ([a8be579](https://github.com/crvouga/mockingbird/commit/a8be5799a883ddf6f731208e06f399410de4661a))
|
|
9
|
+
|
|
10
|
+
### Dependencies
|
|
11
|
+
|
|
12
|
+
- `@crvouga/mockingbird-service-sqlite`
|
|
13
|
+
|
|
3
14
|
## 1.9.0 (2026-10-21)
|
|
4
15
|
|
|
5
16
|
### Features
|
|
@@ -4477,15 +4477,24 @@ var Collection = class {
|
|
|
4477
4477
|
sqlite;
|
|
4478
4478
|
namespace;
|
|
4479
4479
|
collectionName;
|
|
4480
|
+
statements = /* @__PURE__ */ new Map();
|
|
4481
|
+
prepare(sql) {
|
|
4482
|
+
let statement = this.statements.get(sql);
|
|
4483
|
+
if (!statement) {
|
|
4484
|
+
statement = this.sqlite.prepare(sql);
|
|
4485
|
+
this.statements.set(sql, statement);
|
|
4486
|
+
}
|
|
4487
|
+
return statement;
|
|
4488
|
+
}
|
|
4480
4489
|
constructor(sqlite, namespace, collectionName) {
|
|
4481
4490
|
this.sqlite = sqlite;
|
|
4482
4491
|
this.namespace = namespace;
|
|
4483
4492
|
this.collectionName = collectionName;
|
|
4484
4493
|
}
|
|
4485
4494
|
bumpCollectionSeq() {
|
|
4486
|
-
const row = this.
|
|
4495
|
+
const row = this.prepare("SELECT value FROM mockingbird_sequences WHERE namespace = ? AND name = ? AND kind = 'collection'").get(this.namespace, this.collectionName);
|
|
4487
4496
|
const next = (row?.value ?? 0) + 1;
|
|
4488
|
-
this.
|
|
4497
|
+
this.prepare(`INSERT INTO mockingbird_sequences (namespace, name, kind, value) VALUES (?, ?, 'collection', ?)
|
|
4489
4498
|
ON CONFLICT(namespace, name, kind) DO UPDATE SET value = excluded.value`).run(this.namespace, this.collectionName, next);
|
|
4490
4499
|
return next;
|
|
4491
4500
|
}
|
|
@@ -4493,13 +4502,13 @@ var Collection = class {
|
|
|
4493
4502
|
return this.sqlite.transaction(() => this.bumpCollectionSeq());
|
|
4494
4503
|
}
|
|
4495
4504
|
get(id) {
|
|
4496
|
-
const row = this.
|
|
4505
|
+
const row = this.prepare("SELECT value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
|
|
4497
4506
|
if (!row)
|
|
4498
4507
|
return void 0;
|
|
4499
4508
|
return JSON.parse(row.value).value;
|
|
4500
4509
|
}
|
|
4501
4510
|
has(id) {
|
|
4502
|
-
const row = this.
|
|
4511
|
+
const row = this.prepare("SELECT 1 AS ok FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
|
|
4503
4512
|
return row !== void 0;
|
|
4504
4513
|
}
|
|
4505
4514
|
/** Insert a new record, assigning it the next sequence number. */
|
|
@@ -4507,7 +4516,7 @@ var Collection = class {
|
|
|
4507
4516
|
return this.sqlite.transaction(() => {
|
|
4508
4517
|
const seq = this.bumpCollectionSeq();
|
|
4509
4518
|
const stored = { seq, value };
|
|
4510
|
-
this.
|
|
4519
|
+
this.prepare(`INSERT INTO mockingbird_records (namespace, collection, id, seq, value)
|
|
4511
4520
|
VALUES (?, ?, ?, ?, ?)
|
|
4512
4521
|
ON CONFLICT(namespace, collection, id) DO UPDATE SET seq = excluded.seq, value = excluded.value`).run(this.namespace, this.collectionName, id, seq, JSON.stringify(stored));
|
|
4513
4522
|
return stored;
|
|
@@ -4516,25 +4525,25 @@ var Collection = class {
|
|
|
4516
4525
|
/** Replace an existing record's value, keeping its position. */
|
|
4517
4526
|
update(id, value) {
|
|
4518
4527
|
return this.sqlite.transaction(() => {
|
|
4519
|
-
const row = this.
|
|
4528
|
+
const row = this.prepare("SELECT seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
|
|
4520
4529
|
if (!row)
|
|
4521
4530
|
return void 0;
|
|
4522
4531
|
const stored = { seq: row.seq, value };
|
|
4523
|
-
this.
|
|
4532
|
+
this.prepare("UPDATE mockingbird_records SET value = ? WHERE namespace = ? AND collection = ? AND id = ?").run(JSON.stringify(stored), this.namespace, this.collectionName, id);
|
|
4524
4533
|
return stored;
|
|
4525
4534
|
});
|
|
4526
4535
|
}
|
|
4527
4536
|
delete(id) {
|
|
4528
|
-
const result = this.
|
|
4537
|
+
const result = this.prepare("DELETE FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").run(this.namespace, this.collectionName, id);
|
|
4529
4538
|
return result.changes > 0;
|
|
4530
4539
|
}
|
|
4531
4540
|
/** How many records the collection holds, without reading them. */
|
|
4532
4541
|
count() {
|
|
4533
|
-
const row = this.
|
|
4542
|
+
const row = this.prepare("SELECT COUNT(*) AS n FROM mockingbird_records WHERE namespace = ? AND collection = ?").get(this.namespace, this.collectionName);
|
|
4534
4543
|
return Number(row?.n ?? 0);
|
|
4535
4544
|
}
|
|
4536
4545
|
list(options = {}) {
|
|
4537
|
-
const rows = this.
|
|
4546
|
+
const rows = this.prepare("SELECT id, seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ?").all(this.namespace, this.collectionName);
|
|
4538
4547
|
const out = [];
|
|
4539
4548
|
for (const row of rows) {
|
|
4540
4549
|
const stored = JSON.parse(row.value);
|
|
@@ -8136,7 +8145,7 @@ var stateAdminRoutes = (routes) => {
|
|
|
8136
8145
|
};
|
|
8137
8146
|
|
|
8138
8147
|
// ../core/dist/version.js
|
|
8139
|
-
var PACKAGE_VERSION = true ? "1.
|
|
8148
|
+
var PACKAGE_VERSION = true ? "1.10.0" : UNRELEASED_VERSION;
|
|
8140
8149
|
|
|
8141
8150
|
// ../core/dist/webhooks.js
|
|
8142
8151
|
var json4 = (status, body) => new Response(JSON.stringify(body), {
|
|
@@ -9468,4 +9477,4 @@ export {
|
|
|
9468
9477
|
createRuntime2 as createRuntime,
|
|
9469
9478
|
DynamodbStreamsAPI
|
|
9470
9479
|
};
|
|
9471
|
-
//# sourceMappingURL=chunk-
|
|
9480
|
+
//# sourceMappingURL=chunk-QEV4CKKG.js.map
|