@crvouga/mockingbird-service-google 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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog — @crvouga/mockingbird-service-google
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-KTWLZPSG.js";
12
+ } from "./chunk-TGBZJR3A.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.8.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-TH2YG7Q6.js.map
5065
+ //# sourceMappingURL=chunk-LWSATDR2.js.map
@@ -459,15 +459,24 @@ var Collection = class {
459
459
  sqlite;
460
460
  namespace;
461
461
  collectionName;
462
+ statements = /* @__PURE__ */ new Map();
463
+ prepare(sql) {
464
+ let statement = this.statements.get(sql);
465
+ if (!statement) {
466
+ statement = this.sqlite.prepare(sql);
467
+ this.statements.set(sql, statement);
468
+ }
469
+ return statement;
470
+ }
462
471
  constructor(sqlite, namespace, collectionName) {
463
472
  this.sqlite = sqlite;
464
473
  this.namespace = namespace;
465
474
  this.collectionName = collectionName;
466
475
  }
467
476
  bumpCollectionSeq() {
468
- const row = this.sqlite.prepare("SELECT value FROM mockingbird_sequences WHERE namespace = ? AND name = ? AND kind = 'collection'").get(this.namespace, this.collectionName);
477
+ const row = this.prepare("SELECT value FROM mockingbird_sequences WHERE namespace = ? AND name = ? AND kind = 'collection'").get(this.namespace, this.collectionName);
469
478
  const next = (row?.value ?? 0) + 1;
470
- this.sqlite.prepare(`INSERT INTO mockingbird_sequences (namespace, name, kind, value) VALUES (?, ?, 'collection', ?)
479
+ this.prepare(`INSERT INTO mockingbird_sequences (namespace, name, kind, value) VALUES (?, ?, 'collection', ?)
471
480
  ON CONFLICT(namespace, name, kind) DO UPDATE SET value = excluded.value`).run(this.namespace, this.collectionName, next);
472
481
  return next;
473
482
  }
@@ -475,13 +484,13 @@ var Collection = class {
475
484
  return this.sqlite.transaction(() => this.bumpCollectionSeq());
476
485
  }
477
486
  get(id) {
478
- const row = this.sqlite.prepare("SELECT value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
487
+ const row = this.prepare("SELECT value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
479
488
  if (!row)
480
489
  return void 0;
481
490
  return JSON.parse(row.value).value;
482
491
  }
483
492
  has(id) {
484
- const row = this.sqlite.prepare("SELECT 1 AS ok FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
493
+ const row = this.prepare("SELECT 1 AS ok FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
485
494
  return row !== void 0;
486
495
  }
487
496
  /** Insert a new record, assigning it the next sequence number. */
@@ -489,7 +498,7 @@ var Collection = class {
489
498
  return this.sqlite.transaction(() => {
490
499
  const seq = this.bumpCollectionSeq();
491
500
  const stored = { seq, value };
492
- this.sqlite.prepare(`INSERT INTO mockingbird_records (namespace, collection, id, seq, value)
501
+ this.prepare(`INSERT INTO mockingbird_records (namespace, collection, id, seq, value)
493
502
  VALUES (?, ?, ?, ?, ?)
494
503
  ON CONFLICT(namespace, collection, id) DO UPDATE SET seq = excluded.seq, value = excluded.value`).run(this.namespace, this.collectionName, id, seq, JSON.stringify(stored));
495
504
  return stored;
@@ -498,25 +507,25 @@ var Collection = class {
498
507
  /** Replace an existing record's value, keeping its position. */
499
508
  update(id, value) {
500
509
  return this.sqlite.transaction(() => {
501
- const row = this.sqlite.prepare("SELECT seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
510
+ const row = this.prepare("SELECT seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
502
511
  if (!row)
503
512
  return void 0;
504
513
  const stored = { seq: row.seq, value };
505
- this.sqlite.prepare("UPDATE mockingbird_records SET value = ? WHERE namespace = ? AND collection = ? AND id = ?").run(JSON.stringify(stored), this.namespace, this.collectionName, id);
514
+ this.prepare("UPDATE mockingbird_records SET value = ? WHERE namespace = ? AND collection = ? AND id = ?").run(JSON.stringify(stored), this.namespace, this.collectionName, id);
506
515
  return stored;
507
516
  });
508
517
  }
509
518
  delete(id) {
510
- const result = this.sqlite.prepare("DELETE FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").run(this.namespace, this.collectionName, id);
519
+ const result = this.prepare("DELETE FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").run(this.namespace, this.collectionName, id);
511
520
  return result.changes > 0;
512
521
  }
513
522
  /** How many records the collection holds, without reading them. */
514
523
  count() {
515
- const row = this.sqlite.prepare("SELECT COUNT(*) AS n FROM mockingbird_records WHERE namespace = ? AND collection = ?").get(this.namespace, this.collectionName);
524
+ const row = this.prepare("SELECT COUNT(*) AS n FROM mockingbird_records WHERE namespace = ? AND collection = ?").get(this.namespace, this.collectionName);
516
525
  return Number(row?.n ?? 0);
517
526
  }
518
527
  list(options = {}) {
519
- const rows = this.sqlite.prepare("SELECT id, seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ?").all(this.namespace, this.collectionName);
528
+ const rows = this.prepare("SELECT id, seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ?").all(this.namespace, this.collectionName);
520
529
  const out = [];
521
530
  for (const row of rows) {
522
531
  const stored = JSON.parse(row.value);
@@ -3807,7 +3816,7 @@ var stateAdminRoutes = (routes) => {
3807
3816
  };
3808
3817
 
3809
3818
  // ../core/dist/version.js
3810
- var PACKAGE_VERSION = true ? "0.8.0" : UNRELEASED_VERSION;
3819
+ var PACKAGE_VERSION = true ? "0.9.0" : UNRELEASED_VERSION;
3811
3820
 
3812
3821
  // ../core/dist/webhooks.js
3813
3822
  var json4 = (status, body) => new Response(JSON.stringify(body), {
@@ -10354,4 +10363,4 @@ export {
10354
10363
  * Copyright (c) 2021 - present, Yusuke Wada and Hono contributors
10355
10364
  * MIT license: see THIRD_PARTY_NOTICES.md in the repository and npm packages.
10356
10365
  */
10357
- //# sourceMappingURL=chunk-KTWLZPSG.js.map
10366
+ //# sourceMappingURL=chunk-TGBZJR3A.js.map