@crvouga/mockingbird-service-payload-cms 3.9.0 → 3.10.1

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,18 @@
1
1
  # Changelog — @crvouga/mockingbird-service-payload-cms
2
2
 
3
+ ## 3.10.1 (2026-11-02)
4
+
5
+ ### Fixes and improvements
6
+
7
+ - schedule packages whose tasks read another package's files ([7df459d](https://github.com/crvouga/mockingbird/commit/7df459d96132b4f84fa3553b1f907871c7e4f739))
8
+
9
+ ## 3.10.0 (2026-10-24)
10
+
11
+ ### Features
12
+
13
+ - add buffered SQL durability ([288bdcc](https://github.com/crvouga/mockingbird/commit/288bdcca84582787a54c4fdf9e803db9aac0b8d7))
14
+ - add efficient browser durability ([a8be579](https://github.com/crvouga/mockingbird/commit/a8be5799a883ddf6f731208e06f399410de4661a))
15
+
3
16
  ## 3.9.0 (2026-10-21)
4
17
 
5
18
  ### Features
@@ -503,15 +503,24 @@ var Collection = class {
503
503
  sqlite;
504
504
  namespace;
505
505
  collectionName;
506
+ statements = /* @__PURE__ */ new Map();
507
+ prepare(sql) {
508
+ let statement = this.statements.get(sql);
509
+ if (!statement) {
510
+ statement = this.sqlite.prepare(sql);
511
+ this.statements.set(sql, statement);
512
+ }
513
+ return statement;
514
+ }
506
515
  constructor(sqlite, namespace, collectionName) {
507
516
  this.sqlite = sqlite;
508
517
  this.namespace = namespace;
509
518
  this.collectionName = collectionName;
510
519
  }
511
520
  bumpCollectionSeq() {
512
- const row = this.sqlite.prepare("SELECT value FROM mockingbird_sequences WHERE namespace = ? AND name = ? AND kind = 'collection'").get(this.namespace, this.collectionName);
521
+ const row = this.prepare("SELECT value FROM mockingbird_sequences WHERE namespace = ? AND name = ? AND kind = 'collection'").get(this.namespace, this.collectionName);
513
522
  const next = (row?.value ?? 0) + 1;
514
- this.sqlite.prepare(`INSERT INTO mockingbird_sequences (namespace, name, kind, value) VALUES (?, ?, 'collection', ?)
523
+ this.prepare(`INSERT INTO mockingbird_sequences (namespace, name, kind, value) VALUES (?, ?, 'collection', ?)
515
524
  ON CONFLICT(namespace, name, kind) DO UPDATE SET value = excluded.value`).run(this.namespace, this.collectionName, next);
516
525
  return next;
517
526
  }
@@ -519,13 +528,13 @@ var Collection = class {
519
528
  return this.sqlite.transaction(() => this.bumpCollectionSeq());
520
529
  }
521
530
  get(id) {
522
- const row = this.sqlite.prepare("SELECT value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
531
+ const row = this.prepare("SELECT value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
523
532
  if (!row)
524
533
  return void 0;
525
534
  return JSON.parse(row.value).value;
526
535
  }
527
536
  has(id) {
528
- const row = this.sqlite.prepare("SELECT 1 AS ok FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
537
+ const row = this.prepare("SELECT 1 AS ok FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
529
538
  return row !== void 0;
530
539
  }
531
540
  /** Insert a new record, assigning it the next sequence number. */
@@ -533,7 +542,7 @@ var Collection = class {
533
542
  return this.sqlite.transaction(() => {
534
543
  const seq = this.bumpCollectionSeq();
535
544
  const stored = { seq, value };
536
- this.sqlite.prepare(`INSERT INTO mockingbird_records (namespace, collection, id, seq, value)
545
+ this.prepare(`INSERT INTO mockingbird_records (namespace, collection, id, seq, value)
537
546
  VALUES (?, ?, ?, ?, ?)
538
547
  ON CONFLICT(namespace, collection, id) DO UPDATE SET seq = excluded.seq, value = excluded.value`).run(this.namespace, this.collectionName, id, seq, JSON.stringify(stored));
539
548
  return stored;
@@ -542,25 +551,25 @@ var Collection = class {
542
551
  /** Replace an existing record's value, keeping its position. */
543
552
  update(id, value) {
544
553
  return this.sqlite.transaction(() => {
545
- const row = this.sqlite.prepare("SELECT seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
554
+ const row = this.prepare("SELECT seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").get(this.namespace, this.collectionName, id);
546
555
  if (!row)
547
556
  return void 0;
548
557
  const stored = { seq: row.seq, value };
549
- this.sqlite.prepare("UPDATE mockingbird_records SET value = ? WHERE namespace = ? AND collection = ? AND id = ?").run(JSON.stringify(stored), this.namespace, this.collectionName, id);
558
+ this.prepare("UPDATE mockingbird_records SET value = ? WHERE namespace = ? AND collection = ? AND id = ?").run(JSON.stringify(stored), this.namespace, this.collectionName, id);
550
559
  return stored;
551
560
  });
552
561
  }
553
562
  delete(id) {
554
- const result = this.sqlite.prepare("DELETE FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").run(this.namespace, this.collectionName, id);
563
+ const result = this.prepare("DELETE FROM mockingbird_records WHERE namespace = ? AND collection = ? AND id = ?").run(this.namespace, this.collectionName, id);
555
564
  return result.changes > 0;
556
565
  }
557
566
  /** How many records the collection holds, without reading them. */
558
567
  count() {
559
- const row = this.sqlite.prepare("SELECT COUNT(*) AS n FROM mockingbird_records WHERE namespace = ? AND collection = ?").get(this.namespace, this.collectionName);
568
+ const row = this.prepare("SELECT COUNT(*) AS n FROM mockingbird_records WHERE namespace = ? AND collection = ?").get(this.namespace, this.collectionName);
560
569
  return Number(row?.n ?? 0);
561
570
  }
562
571
  list(options = {}) {
563
- const rows = this.sqlite.prepare("SELECT id, seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ?").all(this.namespace, this.collectionName);
572
+ const rows = this.prepare("SELECT id, seq, value FROM mockingbird_records WHERE namespace = ? AND collection = ?").all(this.namespace, this.collectionName);
564
573
  const out = [];
565
574
  for (const row of rows) {
566
575
  const stored = JSON.parse(row.value);
@@ -3758,7 +3767,7 @@ var stateAdminRoutes = (routes) => {
3758
3767
  };
3759
3768
 
3760
3769
  // ../core/dist/version.js
3761
- var PACKAGE_VERSION = true ? "3.9.0" : UNRELEASED_VERSION;
3770
+ var PACKAGE_VERSION = true ? "3.10.1" : UNRELEASED_VERSION;
3762
3771
 
3763
3772
  // ../core/dist/webhooks.js
3764
3773
  var json4 = (status, body) => new Response(JSON.stringify(body), {
@@ -5522,4 +5531,4 @@ export {
5522
5531
  compileWhere,
5523
5532
  PayloadCmsAPI
5524
5533
  };
5525
- //# sourceMappingURL=chunk-QDWBFUEC.js.map
5534
+ //# sourceMappingURL=chunk-PKHJ6HMZ.js.map