@crvouga/mockingbird-runtime 0.2.0 → 0.2.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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_NAMESPACE
3
- } from "./chunk-OISPHKE2.js";
3
+ } from "./chunk-4BRVNPWR.js";
4
4
  import {
5
5
  fromBase64,
6
6
  matchNamespacePath
@@ -775,4 +775,4 @@ export {
775
775
  connectNamespace,
776
776
  brokerAdminRoutes
777
777
  };
778
- //# sourceMappingURL=chunk-5WW5N4TU.js.map
778
+ //# sourceMappingURL=chunk-RO7FHXO3.js.map
@@ -329,6 +329,8 @@ declare class Collection$1<T> {
329
329
  namespace: string,
330
330
  /** Table name inside the namespace. Stable across resets of the rows themselves. */
331
331
  collectionName: string);
332
+ /** Note the record's current row in every open rollback journal that has not seen it yet. */
333
+ private journalRecord;
332
334
  private bumpCollectionSeq;
333
335
  nextSequence(): number;
334
336
  get(id: string): T | undefined;
@@ -18,7 +18,7 @@ import {
18
18
  import {
19
19
  Collection,
20
20
  bootSqlite
21
- } from "./chunk-OISPHKE2.js";
21
+ } from "./chunk-4BRVNPWR.js";
22
22
  import {
23
23
  clearNamespace
24
24
  } from "./chunk-2KDYLZXC.js";
@@ -58,6 +58,8 @@ declare class Collection<T> {
58
58
  namespace: string,
59
59
  /** Table name inside the namespace. Stable across resets of the rows themselves. */
60
60
  collectionName: string);
61
+ /** Note the record's current row in every open rollback journal that has not seen it yet. */
62
+ private journalRecord;
61
63
  private bumpCollectionSeq;
62
64
  nextSequence(): number;
63
65
  get(id: string): T | undefined;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  MAX_VARIABLE_BYTE_INTEGER,
3
3
  MQTT_WEBSOCKET_PATH
4
- } from "../chunk-5WW5N4TU.js";
5
- import "../chunk-OISPHKE2.js";
4
+ } from "../chunk-RO7FHXO3.js";
5
+ import "../chunk-4BRVNPWR.js";
6
6
  import "../chunk-2KDYLZXC.js";
7
7
  import "../chunk-LL6NKAJO.js";
8
8
  import "../chunk-2Y25NPCV.js";
@@ -333,6 +333,8 @@ declare class Collection<T> {
333
333
  namespace: string,
334
334
  /** Table name inside the namespace. Stable across resets of the rows themselves. */
335
335
  collectionName: string);
336
+ /** Note the record's current row in every open rollback journal that has not seen it yet. */
337
+ private journalRecord;
336
338
  private bumpCollectionSeq;
337
339
  nextSequence(): number;
338
340
  get(id: string): T | undefined;
@@ -14,11 +14,11 @@ import {
14
14
  observeClock,
15
15
  takeConnackFault,
16
16
  webSocketNamespace
17
- } from "./chunk-5WW5N4TU.js";
17
+ } from "./chunk-RO7FHXO3.js";
18
18
  import {
19
19
  Collection,
20
20
  IdSequence
21
- } from "./chunk-OISPHKE2.js";
21
+ } from "./chunk-4BRVNPWR.js";
22
22
  import "./chunk-2KDYLZXC.js";
23
23
  import {
24
24
  fromBase64,
package/dist/service.d.ts CHANGED
@@ -1517,9 +1517,12 @@ declare const snapshotNamespace: (sqlite: SqliteClient, namespace: string) => Na
1517
1517
  */
1518
1518
  declare const restoreNamespace: (sqlite: SqliteClient, namespace: string, snapshot: NamespaceSnapshot) => void;
1519
1519
  /**
1520
- * Execute asynchronous service work atomically using the canonical Timeline rollback primitive.
1521
- * This is the prescribed escape hatch when the SQLite adapter cannot hold a transaction across
1522
- * `await`; service code should not coordinate raw namespace snapshots itself.
1520
+ * Execute asynchronous service work atomically: on a throw, every record and collection
1521
+ * sequence `run` wrote in `namespace` goes back to how it was. Only the rows the work touched
1522
+ * are saved and restored, so the cost follows the write, not the size of the namespace. Every
1523
+ * namespace write goes through {@link Collection}, which records into the open journal. This is
1524
+ * the prescribed escape hatch when the SQLite adapter cannot hold a transaction across `await`;
1525
+ * service code should not coordinate raw namespace snapshots itself.
1523
1526
  */
1524
1527
  declare const withNamespaceRollback: <T>(sqlite: SqliteClient, namespace: string, run: () => Promise<T>) => Promise<T>;
1525
1528
 
@@ -1551,6 +1554,8 @@ declare class Collection<T> {
1551
1554
  namespace: string,
1552
1555
  /** Table name inside the namespace. Stable across resets of the rows themselves. */
1553
1556
  collectionName: string);
1557
+ /** Note the record's current row in every open rollback journal that has not seen it yet. */
1558
+ private journalRecord;
1554
1559
  private bumpCollectionSeq;
1555
1560
  nextSequence(): number;
1556
1561
  get(id: string): T | undefined;
package/dist/service.js CHANGED
@@ -65,7 +65,7 @@ import {
65
65
  verifyOperations,
66
66
  webhookAdminRoutes,
67
67
  withNamespaceRollback
68
- } from "./chunk-OISPHKE2.js";
68
+ } from "./chunk-4BRVNPWR.js";
69
69
  import "./chunk-2KDYLZXC.js";
70
70
  import {
71
71
  ADMIN_CONTROL_PAGES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crvouga/mockingbird-runtime",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "The shared Mockingbird runtime every emulator service depends on: router, admin API and page, snapshots, faults and clock, installed once however many emulators an application uses.",
5
5
  "license": "MIT",
6
6
  "type": "module",