@sentropic/cluster-mesh 0.19.1 → 0.20.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.
Files changed (36) hide show
  1. package/dist/modules/catalog.js +1 -1
  2. package/dist/storage/instance-ownership.d.ts +30 -0
  3. package/dist/storage/instance-ownership.d.ts.map +1 -0
  4. package/dist/storage/instance-ownership.js +90 -0
  5. package/dist/storage/instance-ownership.js.map +1 -0
  6. package/dist/storage/postgres/ordinary-transactions.d.ts.map +1 -1
  7. package/dist/storage/postgres/ordinary-transactions.js +2 -0
  8. package/dist/storage/postgres/ordinary-transactions.js.map +1 -1
  9. package/dist/storage/postgres/protocol.d.ts +7 -0
  10. package/dist/storage/postgres/protocol.d.ts.map +1 -1
  11. package/dist/storage/postgres/protocol.js.map +1 -1
  12. package/dist/storage/sqlite/backend.d.ts +38 -0
  13. package/dist/storage/sqlite/backend.d.ts.map +1 -0
  14. package/dist/storage/sqlite/backend.js +159 -0
  15. package/dist/storage/sqlite/backend.js.map +1 -0
  16. package/dist/storage/sqlite/connection.d.ts +11 -0
  17. package/dist/storage/sqlite/connection.d.ts.map +1 -0
  18. package/dist/storage/sqlite/connection.js +108 -0
  19. package/dist/storage/sqlite/connection.js.map +1 -0
  20. package/dist/storage/sqlite/engine.d.ts +44 -0
  21. package/dist/storage/sqlite/engine.d.ts.map +1 -0
  22. package/dist/storage/sqlite/engine.js +262 -0
  23. package/dist/storage/sqlite/engine.js.map +1 -0
  24. package/dist/storage/sqlite/index.d.ts +28 -0
  25. package/dist/storage/sqlite/index.d.ts.map +1 -0
  26. package/dist/storage/sqlite/index.js +161 -0
  27. package/dist/storage/sqlite/index.js.map +1 -0
  28. package/dist/storage/sqlite/owner-source.d.ts +2 -0
  29. package/dist/storage/sqlite/owner-source.d.ts.map +1 -0
  30. package/dist/storage/sqlite/owner-source.js +52 -0
  31. package/dist/storage/sqlite/owner-source.js.map +1 -0
  32. package/dist/storage/sqlite/transaction-port.d.ts +6 -0
  33. package/dist/storage/sqlite/transaction-port.d.ts.map +1 -0
  34. package/dist/storage/sqlite/transaction-port.js +27 -0
  35. package/dist/storage/sqlite/transaction-port.js.map +1 -0
  36. package/package.json +5 -1
@@ -0,0 +1,27 @@
1
+ import { CanonicalOwnershipError } from '../instance-ownership.js';
2
+ /** The callback owns this port only until it returns. Results are released
3
+ * after revalidation, including reads prepared before ownership loss. */
4
+ export const withSqliteTransaction = async (engine, tx, callback) => {
5
+ let active = true;
6
+ const verify = () => {
7
+ if (!active)
8
+ throw new CanonicalOwnershipError('terminal-loss', 'SQLite transaction callback has ended');
9
+ engine.assertOwnership();
10
+ };
11
+ const port = Object.freeze(Object.fromEntries(Object.entries(tx).map(([property, value]) => [property, async (...args) => {
12
+ verify();
13
+ const result = await value.apply(tx, args);
14
+ verify();
15
+ return result;
16
+ }])));
17
+ try {
18
+ verify();
19
+ const result = await callback(port);
20
+ verify();
21
+ return result;
22
+ }
23
+ finally {
24
+ active = false;
25
+ }
26
+ };
27
+ //# sourceMappingURL=transaction-port.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-port.js","sourceRoot":"","sources":["../../../src/storage/sqlite/transaction-port.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAGnE;yEACyE;AACzE,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,EAAK,MAAoB,EAAE,EAAqB,EACxF,QAAiD,EAAc,EAAE;IACjE,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,MAAM,MAAM,GAAG,GAAS,EAAE;QACxB,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,uBAAuB,CAAC,eAAe,EAAE,uCAAuC,CAAC,CAAC;QACzG,MAAM,CAAC,eAAe,EAAE,CAAC;IAC3B,CAAC,CAAC;IACF,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAC3C,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,GAAG,IAAe,EAAE,EAAE;YAClF,MAAM,EAAE,CAAC;YACT,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;YAC3C,MAAM,EAAE,CAAC;YACT,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC,CAAC,CACJ,CAAiC,CAAC;IACnC,IAAI,CAAC;QACH,MAAM,EAAE,CAAC;QACT,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpC,MAAM,EAAE,CAAC;QACT,OAAO,MAAM,CAAC;IAChB,CAAC;YAAS,CAAC;QAAC,MAAM,GAAG,KAAK,CAAC;IAAC,CAAC;AAC/B,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentropic/cluster-mesh",
3
- "version": "0.19.1",
3
+ "version": "0.20.0",
4
4
  "description": "Injectable Cluster Mesh control-plane contracts, namespace modules, and single-instance runtime.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -28,6 +28,10 @@
28
28
  "types": "./dist/storage/postgres/index.d.ts",
29
29
  "import": "./dist/storage/postgres/index.js"
30
30
  },
31
+ "./storage/sqlite": {
32
+ "types": "./dist/storage/sqlite/index.d.ts",
33
+ "import": "./dist/storage/sqlite/index.js"
34
+ },
31
35
  "./comments": {
32
36
  "types": "./dist/integrations/comments/index.d.ts",
33
37
  "import": "./dist/integrations/comments/index.js"