@crvouga/mockingbird-service-s3 3.9.0 → 3.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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog — @crvouga/mockingbird-service-s3
2
2
 
3
+ ## 3.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
  ## 3.9.0 (2026-10-21)
4
15
 
5
16
  ### Features
@@ -4518,15 +4518,24 @@ var Collection = class {
4518
4518
  sqlite;
4519
4519
  namespace;
4520
4520
  collectionName;
4521
+ statements = /* @__PURE__ */ new Map();
4522
+ prepare(sql) {
4523
+ let statement = this.statements.get(sql);
4524
+ if (!statement) {
4525
+ statement = this.sqlite.prepare(sql);
4526
+ this.statements.set(sql, statement);
4527
+ }
4528
+ return statement;
4529
+ }
4521
4530
  constructor(sqlite, namespace, collectionName) {
4522
4531
  this.sqlite = sqlite;
4523
4532
  this.namespace = namespace;
4524
4533
  this.collectionName = collectionName;
4525
4534
  }
4526
4535
  bumpCollectionSeq() {
4527
- const row = this.sqlite.prepare("SELECT value FROM mockingbird_sequences WHERE namespace = ? AND name = ? AND kind = 'collection'").get(this.namespace, this.collectionName);
4536
+ const row = this.prepare("SELECT value FROM mockingbird_sequences WHERE namespace = ? AND name = ? AND kind = 'collection'").get(this.namespace, this.collectionName);
4528
4537
  const next = (row?.value ?? 0) + 1;
4529
- this.sqlite.prepare(`INSERT INTO mockingbird_sequences (namespace, name, kind, value) VALUES (?, ?, 'collection', ?)
4538
+ this.prepare(`INSERT INTO mockingbird_sequences (namespace, name, kind, value) VALUES (?, ?, 'collection', ?)
4530
4539
  ON CONFLICT(namespace, name, kind) DO UPDATE SET value = excluded.value`).run(this.namespace, this.collectionName, next);
4531
4540
  return next;
4532
4541
  }
@@ -4534,13 +4543,13 @@ var Collection = class {
4534
4543
  return this.sqlite.transaction(() => this.bumpCollectionSeq());
4535
4544
  }
4536
4545
  get(id) {
4537
- const row = this.sqlite.prepare("SELECT value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
4546
+ const row = this.prepare("SELECT value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
4538
4547
  if (!row)
4539
4548
  return void 0;
4540
4549
  return JSON.parse(row.value).value;
4541
4550
  }
4542
4551
  has(id) {
4543
- const row = this.sqlite.prepare("SELECT 1 AS ok FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
4552
+ const row = this.prepare("SELECT 1 AS ok FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
4544
4553
  return row !== void 0;
4545
4554
  }
4546
4555
  /** Insert a new record, assigning it the next sequence number. */
@@ -4548,7 +4557,7 @@ var Collection = class {
4548
4557
  return this.sqlite.transaction(() => {
4549
4558
  const seq = this.bumpCollectionSeq();
4550
4559
  const stored = { seq, value };
4551
- this.sqlite.prepare(`INSERT INTO mockingbird_records (namespace, collection, id, seq, value)
4560
+ this.prepare(`INSERT INTO mockingbird_records (namespace, collection, id, seq, value)
4552
4561
  VALUES (?, ?, ?, ?, ?)
4553
4562
  ON CONFLICT(namespace, collection, id) DO UPDATE SET seq = excluded.seq, value = excluded.value`).run(this.namespace, this.collectionName, id, seq, JSON.stringify(stored));
4554
4563
  return stored;
@@ -4557,25 +4566,25 @@ var Collection = class {
4557
4566
  /** Replace an existing record's value, keeping its position. */
4558
4567
  update(id, value) {
4559
4568
  return this.sqlite.transaction(() => {
4560
- const row = this.sqlite.prepare("SELECT seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
4569
+ const row = this.prepare("SELECT seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
4561
4570
  if (!row)
4562
4571
  return void 0;
4563
4572
  const stored = { seq: row.seq, value };
4564
- this.sqlite.prepare("UPDATE mockingbird_records SET value = ? WHERE namespace = ? AND collection = ? AND id = ?").run(JSON.stringify(stored), this.namespace, this.collectionName, id);
4573
+ this.prepare("UPDATE mockingbird_records SET value = ? WHERE namespace = ? AND collection = ? AND id = ?").run(JSON.stringify(stored), this.namespace, this.collectionName, id);
4565
4574
  return stored;
4566
4575
  });
4567
4576
  }
4568
4577
  delete(id) {
4569
- const result = this.sqlite.prepare("DELETE FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").run(this.namespace, this.collectionName, id);
4578
+ const result = this.prepare("DELETE FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").run(this.namespace, this.collectionName, id);
4570
4579
  return result.changes > 0;
4571
4580
  }
4572
4581
  /** How many records the collection holds, without reading them. */
4573
4582
  count() {
4574
- const row = this.sqlite.prepare("SELECT COUNT(*) AS n FROM mockingbird_records WHERE namespace = ? AND collection = ?").get(this.namespace, this.collectionName);
4583
+ const row = this.prepare("SELECT COUNT(*) AS n FROM mockingbird_records WHERE namespace = ? AND collection = ?").get(this.namespace, this.collectionName);
4575
4584
  return Number(row?.n ?? 0);
4576
4585
  }
4577
4586
  list(options = {}) {
4578
- const rows = this.sqlite.prepare("SELECT id, seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ?").all(this.namespace, this.collectionName);
4587
+ const rows = this.prepare("SELECT id, seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ?").all(this.namespace, this.collectionName);
4579
4588
  const out = [];
4580
4589
  for (const row of rows) {
4581
4590
  const stored = JSON.parse(row.value);
@@ -8039,7 +8048,7 @@ var stateAdminRoutes = (routes) => {
8039
8048
  };
8040
8049
 
8041
8050
  // ../core/dist/version.js
8042
- var PACKAGE_VERSION = true ? "3.9.0" : UNRELEASED_VERSION;
8051
+ var PACKAGE_VERSION = true ? "3.10.0" : UNRELEASED_VERSION;
8043
8052
 
8044
8053
  // ../core/dist/signing.js
8045
8054
  var encoder = new TextEncoder();
@@ -11166,4 +11175,4 @@ export {
11166
11175
  accessKeyCredential,
11167
11176
  S3API
11168
11177
  };
11169
- //# sourceMappingURL=chunk-IULKWCQO.js.map
11178
+ //# sourceMappingURL=chunk-5QCRU4MS.js.map