@crvouga/mockingbird-service-clerk 0.8.0 → 0.9.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-JI6YQC2W.js → chunk-55MWVOBD.js} +3 -3
- package/dist/{chunk-3ZTD6IED.js → chunk-5Z3IICQM.js} +21 -12
- package/dist/chunk-5Z3IICQM.js.map +7 -0
- 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-3ZTD6IED.js.map +0 -7
- /package/dist/{chunk-JI6YQC2W.js.map → chunk-55MWVOBD.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-clerk
|
|
2
2
|
|
|
3
|
+
## 0.9.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
|
## 0.8.0 (2026-10-21)
|
|
4
15
|
|
|
5
16
|
### Features
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
parseFaultHeader,
|
|
10
10
|
resolveAdminPrefix,
|
|
11
11
|
restoreClock
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-5Z3IICQM.js";
|
|
13
13
|
|
|
14
14
|
// ../../adapters/node/dist/cli.js
|
|
15
15
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
@@ -3057,7 +3057,7 @@ async function preflightFleet(config, options) {
|
|
|
3057
3057
|
break;
|
|
3058
3058
|
}
|
|
3059
3059
|
}
|
|
3060
|
-
targets.set(name, { ...target, packageVersion: packageVersion ?? "0.
|
|
3060
|
+
targets.set(name, { ...target, packageVersion: packageVersion ?? "0.9.0" });
|
|
3061
3061
|
} catch (error) {
|
|
3062
3062
|
throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
3063
3063
|
}
|
|
@@ -5062,4 +5062,4 @@ export {
|
|
|
5062
5062
|
createServer2 as createServer,
|
|
5063
5063
|
serveTarget
|
|
5064
5064
|
};
|
|
5065
|
-
//# sourceMappingURL=chunk-
|
|
5065
|
+
//# sourceMappingURL=chunk-55MWVOBD.js.map
|
|
@@ -465,15 +465,24 @@ var Collection = class {
|
|
|
465
465
|
sqlite;
|
|
466
466
|
namespace;
|
|
467
467
|
collectionName;
|
|
468
|
+
statements = /* @__PURE__ */ new Map();
|
|
469
|
+
prepare(sql) {
|
|
470
|
+
let statement = this.statements.get(sql);
|
|
471
|
+
if (!statement) {
|
|
472
|
+
statement = this.sqlite.prepare(sql);
|
|
473
|
+
this.statements.set(sql, statement);
|
|
474
|
+
}
|
|
475
|
+
return statement;
|
|
476
|
+
}
|
|
468
477
|
constructor(sqlite, namespace, collectionName) {
|
|
469
478
|
this.sqlite = sqlite;
|
|
470
479
|
this.namespace = namespace;
|
|
471
480
|
this.collectionName = collectionName;
|
|
472
481
|
}
|
|
473
482
|
bumpCollectionSeq() {
|
|
474
|
-
const row = this.
|
|
483
|
+
const row = this.prepare("SELECT value FROM mockingbird_sequences WHERE namespace = ? AND name = ? AND kind = 'collection'").get(this.namespace, this.collectionName);
|
|
475
484
|
const next = (row?.value ?? 0) + 1;
|
|
476
|
-
this.
|
|
485
|
+
this.prepare(`INSERT INTO mockingbird_sequences (namespace, name, kind, value) VALUES (?, ?, 'collection', ?)
|
|
477
486
|
ON CONFLICT(namespace, name, kind) DO UPDATE SET value = excluded.value`).run(this.namespace, this.collectionName, next);
|
|
478
487
|
return next;
|
|
479
488
|
}
|
|
@@ -481,13 +490,13 @@ var Collection = class {
|
|
|
481
490
|
return this.sqlite.transaction(() => this.bumpCollectionSeq());
|
|
482
491
|
}
|
|
483
492
|
get(id) {
|
|
484
|
-
const row = this.
|
|
493
|
+
const row = this.prepare("SELECT value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
|
|
485
494
|
if (!row)
|
|
486
495
|
return void 0;
|
|
487
496
|
return JSON.parse(row.value).value;
|
|
488
497
|
}
|
|
489
498
|
has(id) {
|
|
490
|
-
const row = this.
|
|
499
|
+
const row = this.prepare("SELECT 1 AS ok FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
|
|
491
500
|
return row !== void 0;
|
|
492
501
|
}
|
|
493
502
|
/** Insert a new record, assigning it the next sequence number. */
|
|
@@ -495,7 +504,7 @@ var Collection = class {
|
|
|
495
504
|
return this.sqlite.transaction(() => {
|
|
496
505
|
const seq = this.bumpCollectionSeq();
|
|
497
506
|
const stored = { seq, value };
|
|
498
|
-
this.
|
|
507
|
+
this.prepare(`INSERT INTO mockingbird_records (namespace, collection, id, seq, value)
|
|
499
508
|
VALUES (?, ?, ?, ?, ?)
|
|
500
509
|
ON CONFLICT(namespace, collection, id) DO UPDATE SET seq = excluded.seq, value = excluded.value`).run(this.namespace, this.collectionName, id, seq, JSON.stringify(stored));
|
|
501
510
|
return stored;
|
|
@@ -504,25 +513,25 @@ var Collection = class {
|
|
|
504
513
|
/** Replace an existing record's value, keeping its position. */
|
|
505
514
|
update(id, value) {
|
|
506
515
|
return this.sqlite.transaction(() => {
|
|
507
|
-
const row = this.
|
|
516
|
+
const row = this.prepare("SELECT seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
|
|
508
517
|
if (!row)
|
|
509
518
|
return void 0;
|
|
510
519
|
const stored = { seq: row.seq, value };
|
|
511
|
-
this.
|
|
520
|
+
this.prepare("UPDATE mockingbird_records SET value = ? WHERE namespace = ? AND collection = ? AND id = ?").run(JSON.stringify(stored), this.namespace, this.collectionName, id);
|
|
512
521
|
return stored;
|
|
513
522
|
});
|
|
514
523
|
}
|
|
515
524
|
delete(id) {
|
|
516
|
-
const result = this.
|
|
525
|
+
const result = this.prepare("DELETE FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").run(this.namespace, this.collectionName, id);
|
|
517
526
|
return result.changes > 0;
|
|
518
527
|
}
|
|
519
528
|
/** How many records the collection holds, without reading them. */
|
|
520
529
|
count() {
|
|
521
|
-
const row = this.
|
|
530
|
+
const row = this.prepare("SELECT COUNT(*) AS n FROM mockingbird_records WHERE namespace = ? AND collection = ?").get(this.namespace, this.collectionName);
|
|
522
531
|
return Number(row?.n ?? 0);
|
|
523
532
|
}
|
|
524
533
|
list(options = {}) {
|
|
525
|
-
const rows = this.
|
|
534
|
+
const rows = this.prepare("SELECT id, seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ?").all(this.namespace, this.collectionName);
|
|
526
535
|
const out = [];
|
|
527
536
|
for (const row of rows) {
|
|
528
537
|
const stored = JSON.parse(row.value);
|
|
@@ -3813,7 +3822,7 @@ var stateAdminRoutes = (routes) => {
|
|
|
3813
3822
|
};
|
|
3814
3823
|
|
|
3815
3824
|
// ../core/dist/version.js
|
|
3816
|
-
var PACKAGE_VERSION = true ? "0.
|
|
3825
|
+
var PACKAGE_VERSION = true ? "0.9.0" : UNRELEASED_VERSION;
|
|
3817
3826
|
|
|
3818
3827
|
// ../core/dist/webhooks.js
|
|
3819
3828
|
var json4 = (status, body) => new Response(JSON.stringify(body), {
|
|
@@ -8096,4 +8105,4 @@ export {
|
|
|
8096
8105
|
* Copyright (c) 2021 - present, Yusuke Wada and Hono contributors
|
|
8097
8106
|
* MIT license: see THIRD_PARTY_NOTICES.md in the repository and npm packages.
|
|
8098
8107
|
*/
|
|
8099
|
-
//# sourceMappingURL=chunk-
|
|
8108
|
+
//# sourceMappingURL=chunk-5Z3IICQM.js.map
|