@noy-db/hub 0.2.0-pre.29 → 0.2.0-pre.30

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 (170) hide show
  1. package/dist/aggregate/index.js +1 -0
  2. package/dist/aggregate/index.js.map +1 -1
  3. package/dist/attestation/index.d.cts +1 -1
  4. package/dist/attestation/index.d.ts +1 -1
  5. package/dist/attestation/index.js +4 -3
  6. package/dist/attestation/index.js.map +1 -1
  7. package/dist/blobs/index.d.cts +3 -3
  8. package/dist/blobs/index.d.ts +3 -3
  9. package/dist/blobs/index.js +2 -1
  10. package/dist/blobs/index.js.map +1 -1
  11. package/dist/bundle/index.cjs +16825 -893
  12. package/dist/bundle/index.cjs.map +1 -1
  13. package/dist/bundle/index.d.cts +3 -3
  14. package/dist/bundle/index.d.ts +3 -3
  15. package/dist/bundle/index.js +2 -1
  16. package/dist/bundle/index.js.map +1 -1
  17. package/dist/{chunk-DJO4OYCJ.js → chunk-33EQCZXE.js} +2 -2
  18. package/dist/{chunk-ZDW22N3E.js → chunk-BVKLJBJJ.js} +694 -191
  19. package/dist/chunk-BVKLJBJJ.js.map +1 -0
  20. package/dist/{chunk-REHF3HSJ.js → chunk-K4JID2ZE.js} +16 -3
  21. package/dist/chunk-K4JID2ZE.js.map +1 -0
  22. package/dist/{chunk-553CK4E2.js → chunk-OCYFFBZS.js} +2 -2
  23. package/dist/chunk-PZ5AY32C.js +10 -0
  24. package/dist/{chunk-45QJXLLS.js → chunk-Y6YUWZTS.js} +2 -2
  25. package/dist/{chunk-6BSYMFYS.js → chunk-ZK66B5EY.js} +2 -2
  26. package/dist/{chunk-BITB3T5Z.js → chunk-ZPJSQPQH.js} +2 -2
  27. package/dist/consent/index.d.cts +2 -2
  28. package/dist/consent/index.d.ts +2 -2
  29. package/dist/consent/index.js +1 -0
  30. package/dist/consent/index.js.map +1 -1
  31. package/dist/crdt/index.js +1 -0
  32. package/dist/crdt/index.js.map +1 -1
  33. package/dist/{crypto-G6XU2V2Y.js → crypto-OSIV2IIW.js} +2 -1
  34. package/dist/{decrypt-partition-DDSArPPW.d.cts → decrypt-partition-C0iDpbSd.d.cts} +1 -1
  35. package/dist/{decrypt-partition-5Gt0EcTc.d.ts → decrypt-partition-Mhjh6nnG.d.ts} +1 -1
  36. package/dist/{delegation-ZEH4LKEM.js → delegation-BQTRJATI.js} +2 -1
  37. package/dist/derivations/index.d.cts +3 -3
  38. package/dist/derivations/index.d.ts +3 -3
  39. package/dist/derivations/index.js +1 -0
  40. package/dist/{dev-unlock-CIkHrcRm.d.cts → dev-unlock-0Z6yxfS7.d.cts} +1 -1
  41. package/dist/{dev-unlock-BF9IhLPn.d.ts → dev-unlock-DJ3IhgY9.d.ts} +1 -1
  42. package/dist/{executor-DWVP4BSJ.js → executor-KYSKFJ2R.js} +2 -1
  43. package/dist/{executor-HO3SIRSF.js → executor-M7W3NEKR.js} +2 -1
  44. package/dist/{executor-HB2YMIYC.js → executor-VDTDGWO6.js} +2 -1
  45. package/dist/{fanout-sidecar-BMT7I6FI.js → fanout-sidecar-AZALISHB.js} +2 -1
  46. package/dist/{fanout-sidecar-BMT7I6FI.js.map → fanout-sidecar-AZALISHB.js.map} +1 -1
  47. package/dist/forget/index.js +1 -0
  48. package/dist/guards/index.d.cts +3 -3
  49. package/dist/guards/index.d.ts +3 -3
  50. package/dist/guards/index.js +1 -0
  51. package/dist/{hash-Jl0qarQx.d.ts → hash-DLwkYf1d.d.ts} +1 -1
  52. package/dist/{hash-DfhndFcd.d.cts → hash-Db8ncXGr.d.cts} +1 -1
  53. package/dist/history/index.d.cts +3 -3
  54. package/dist/history/index.d.ts +3 -3
  55. package/dist/history/index.js +1 -0
  56. package/dist/history/index.js.map +1 -1
  57. package/dist/i18n/index.cjs +15 -2
  58. package/dist/i18n/index.cjs.map +1 -1
  59. package/dist/i18n/index.d.cts +2 -2
  60. package/dist/i18n/index.d.ts +2 -2
  61. package/dist/i18n/index.js +2 -1
  62. package/dist/i18n/index.js.map +1 -1
  63. package/dist/{index-DcxTv3zx.d.ts → index-CMRIx_zx.d.ts} +1 -1
  64. package/dist/{index-DPG2nFmT.d.cts → index-xJEPkvMb.d.cts} +1 -1
  65. package/dist/index.cjs +16956 -1011
  66. package/dist/index.cjs.map +1 -1
  67. package/dist/index.d.cts +19 -16
  68. package/dist/index.d.ts +19 -16
  69. package/dist/index.js +8 -7
  70. package/dist/index.js.map +1 -1
  71. package/dist/indexing/index.js +1 -0
  72. package/dist/indexing/index.js.map +1 -1
  73. package/dist/{issue-FZRTVGRE.js → issue-DPHRF2TI.js} +2 -1
  74. package/dist/kernel/index.cjs.map +1 -1
  75. package/dist/kernel/index.d.cts +2 -2
  76. package/dist/kernel/index.d.ts +2 -2
  77. package/dist/kernel/index.js +1 -0
  78. package/dist/{ledger-PMTR2Q62.js → ledger-CI7GSMLB.js} +2 -1
  79. package/dist/materialized-views/index.d.cts +3 -3
  80. package/dist/materialized-views/index.d.ts +3 -3
  81. package/dist/materialized-views/index.js +2 -1
  82. package/dist/{mime-magic-BOI-I5dq.d.ts → mime-magic-CacDBwYp.d.ts} +1 -1
  83. package/dist/{mime-magic-C0TM7FtF.d.cts → mime-magic-sdMzsfVK.d.cts} +1 -1
  84. package/dist/{noydb-Y3ZLZNXA.js → noydb-5MIBD77B.js} +6 -5
  85. package/dist/overlay-views/index.d.cts +3 -3
  86. package/dist/overlay-views/index.d.ts +3 -3
  87. package/dist/overlay-views/index.js +1 -0
  88. package/dist/periods/index.d.cts +2 -2
  89. package/dist/periods/index.d.ts +2 -2
  90. package/dist/periods/index.js +2 -1
  91. package/dist/{public-envelope-S2S2VR3F.js → public-envelope-MFMBFJLZ.js} +2 -1
  92. package/dist/query/index.js +1 -0
  93. package/dist/{read-only-facade-EX6WZZBP.js → read-only-facade-3OQRZ3VS.js} +2 -1
  94. package/dist/{registry-DKEXOJVO.js → registry-IX5WKK4F.js} +2 -1
  95. package/dist/{registry-53A55ZZE.js → registry-LMHO5265.js} +2 -1
  96. package/dist/{registry-IEU6ATO7.js → registry-TXCKWH26.js} +2 -1
  97. package/dist/{registry-FKL4SLU4.js → registry-VFEDQSYV.js} +2 -1
  98. package/dist/{revoke-AOCAVR56.js → revoke-5PUOZPJJ.js} +2 -1
  99. package/dist/sealed-record/index.js +1 -0
  100. package/dist/sealed-record/index.js.map +1 -1
  101. package/dist/session/index.d.cts +3 -3
  102. package/dist/session/index.d.ts +3 -3
  103. package/dist/session/index.js +1 -0
  104. package/dist/session/index.js.map +1 -1
  105. package/dist/shadow/index.d.cts +2 -2
  106. package/dist/shadow/index.d.ts +2 -2
  107. package/dist/shadow/index.js +1 -0
  108. package/dist/shadow/index.js.map +1 -1
  109. package/dist/{signer-JMK6W2Y6.js → signer-UB5TQOZ6.js} +2 -1
  110. package/dist/snapshots/index.d.cts +2 -2
  111. package/dist/snapshots/index.d.ts +2 -2
  112. package/dist/snapshots/index.js +1 -0
  113. package/dist/snapshots/index.js.map +1 -1
  114. package/dist/{stale-IIIGOHBW.js → stale-J3TUF5C5.js} +3 -2
  115. package/dist/store/index.d.cts +2 -2
  116. package/dist/store/index.d.ts +2 -2
  117. package/dist/store/index.js +1 -0
  118. package/dist/sync/index.d.cts +1 -1
  119. package/dist/sync/index.d.ts +1 -1
  120. package/dist/sync/index.js +1 -0
  121. package/dist/sync/index.js.map +1 -1
  122. package/dist/team/index.d.cts +2 -2
  123. package/dist/team/index.d.ts +2 -2
  124. package/dist/team/index.js +1 -0
  125. package/dist/{transition-guard-BixCDmBI.d.ts → transition-guard-J04-jime.d.ts} +1 -1
  126. package/dist/{transition-guard-DnAlUf9R.d.cts → transition-guard-tWZIsaXe.d.cts} +1 -1
  127. package/dist/tx/index.d.cts +2 -2
  128. package/dist/tx/index.d.ts +2 -2
  129. package/dist/tx/index.js +3 -2
  130. package/dist/tx/index.js.map +1 -1
  131. package/dist/{types-Ba1vQ3AY.d.cts → types-CdVfiQgt.d.cts} +444 -161
  132. package/dist/{types-CUmZYJwN.d.ts → types-DHn9lEP0.d.ts} +444 -161
  133. package/dist/{ulid-COREQ2RQ.js → ulid-KEPZMD2N.js} +2 -1
  134. package/dist/ulid-KEPZMD2N.js.map +1 -0
  135. package/dist/util/index.js +1 -0
  136. package/dist/util/index.js.map +1 -1
  137. package/dist/{with-materialized-view-Bjx6VYPc.d.ts → with-materialized-view-DNfzC5lH.d.ts} +1 -1
  138. package/dist/{with-materialized-view-Z_aHLln6.d.cts → with-materialized-view-DfgPcvi9.d.cts} +1 -1
  139. package/dist/{with-overlayed-view-pTOFgHRq.d.cts → with-overlayed-view-Cvfkx1lg.d.cts} +1 -1
  140. package/dist/{with-overlayed-view-B8PkL179.d.ts → with-overlayed-view-qk3lbhOd.d.ts} +1 -1
  141. package/dist/{with-rollup-Cd3t01Mz.d.ts → with-rollup-Dd3_ZG4b.d.ts} +1 -1
  142. package/dist/{with-rollup-D9qQoffP.d.cts → with-rollup-nIxo7h9z.d.cts} +1 -1
  143. package/dist/zod-HAJM7LMS.js +14763 -0
  144. package/dist/zod-HAJM7LMS.js.map +1 -0
  145. package/package.json +4 -4
  146. package/dist/chunk-REHF3HSJ.js.map +0 -1
  147. package/dist/chunk-ZDW22N3E.js.map +0 -1
  148. /package/dist/{chunk-DJO4OYCJ.js.map → chunk-33EQCZXE.js.map} +0 -0
  149. /package/dist/{chunk-553CK4E2.js.map → chunk-OCYFFBZS.js.map} +0 -0
  150. /package/dist/{crypto-G6XU2V2Y.js.map → chunk-PZ5AY32C.js.map} +0 -0
  151. /package/dist/{chunk-45QJXLLS.js.map → chunk-Y6YUWZTS.js.map} +0 -0
  152. /package/dist/{chunk-6BSYMFYS.js.map → chunk-ZK66B5EY.js.map} +0 -0
  153. /package/dist/{chunk-BITB3T5Z.js.map → chunk-ZPJSQPQH.js.map} +0 -0
  154. /package/dist/{delegation-ZEH4LKEM.js.map → crypto-OSIV2IIW.js.map} +0 -0
  155. /package/dist/{executor-DWVP4BSJ.js.map → delegation-BQTRJATI.js.map} +0 -0
  156. /package/dist/{executor-HB2YMIYC.js.map → executor-KYSKFJ2R.js.map} +0 -0
  157. /package/dist/{executor-HO3SIRSF.js.map → executor-M7W3NEKR.js.map} +0 -0
  158. /package/dist/{issue-FZRTVGRE.js.map → executor-VDTDGWO6.js.map} +0 -0
  159. /package/dist/{ledger-PMTR2Q62.js.map → issue-DPHRF2TI.js.map} +0 -0
  160. /package/dist/{noydb-Y3ZLZNXA.js.map → ledger-CI7GSMLB.js.map} +0 -0
  161. /package/dist/{public-envelope-S2S2VR3F.js.map → noydb-5MIBD77B.js.map} +0 -0
  162. /package/dist/{read-only-facade-EX6WZZBP.js.map → public-envelope-MFMBFJLZ.js.map} +0 -0
  163. /package/dist/{registry-53A55ZZE.js.map → read-only-facade-3OQRZ3VS.js.map} +0 -0
  164. /package/dist/{registry-DKEXOJVO.js.map → registry-IX5WKK4F.js.map} +0 -0
  165. /package/dist/{registry-FKL4SLU4.js.map → registry-LMHO5265.js.map} +0 -0
  166. /package/dist/{registry-IEU6ATO7.js.map → registry-TXCKWH26.js.map} +0 -0
  167. /package/dist/{revoke-AOCAVR56.js.map → registry-VFEDQSYV.js.map} +0 -0
  168. /package/dist/{signer-JMK6W2Y6.js.map → revoke-5PUOZPJJ.js.map} +0 -0
  169. /package/dist/{stale-IIIGOHBW.js.map → signer-UB5TQOZ6.js.map} +0 -0
  170. /package/dist/{ulid-COREQ2RQ.js.map → stale-J3TUF5C5.js.map} +0 -0
@@ -1,8 +1,8 @@
1
1
  export { I as IndexDef, O as Operator, r as readPath } from '../predicate-BmhBSPCH.cjs';
2
2
  export { j as AggregateResult, k as AggregateSpec, w as LiveAggregation, D as groupAndReduce, H as reduceRecords } from '../strategy-mJExw4LQ.cjs';
3
3
  export { g as generateULID } from '../ulid-DRH25k3y.cjs';
4
- export { F as FuseOptions, h as fuseRetrieval, s as sha256Hex } from '../index-DPG2nFmT.cjs';
5
- export { bP as ChangeEvent, aN as Collection, go as CoordinationProvider, gp as DrainBarrierOptions, gq as FenceState, de as Noydb, dX as RetrieveHit, dY as RetrieveOptions, bh as Vault, gr as WriterPresence, gs as isQuorum, gt as runDrainBarrier } from '../types-Ba1vQ3AY.cjs';
4
+ export { F as FuseOptions, h as fuseRetrieval, s as sha256Hex } from '../index-xJEPkvMb.cjs';
5
+ export { bP as ChangeEvent, aN as Collection, bV as CollectionMeta, gw as CoordinationProvider, gx as DrainBarrierOptions, gy as FenceState, dk as Noydb, e1 as RetrieveHit, e2 as RetrieveOptions, bh as Vault, f1 as VaultMeta, gz as WriterPresence, gA as isQuorum, gB as runDrainBarrier } from '../types-CdVfiQgt.cjs';
6
6
  export { aL as CrossShardJoinError, W as DataResidencyError, ah as NoAccessError, au as ReservedVaultNameError, aB as ShardProvisioningError, aH as UnknownShardError, aJ as ValidationError, aK as VaultTemplateNotFoundError } from '../errors-BAWO5Z5a.cjs';
7
7
  export { c as JoinStrategy, L as LiveQuery, Q as Query } from '../index-C1SC1EPe.cjs';
8
8
  import '../lazy-builder-eYZzLEL1.cjs';
@@ -1,8 +1,8 @@
1
1
  export { I as IndexDef, O as Operator, r as readPath } from '../predicate-BmhBSPCH.js';
2
2
  export { j as AggregateResult, k as AggregateSpec, w as LiveAggregation, D as groupAndReduce, H as reduceRecords } from '../strategy-8QGs5KQE.js';
3
3
  export { g as generateULID } from '../ulid-DRH25k3y.js';
4
- export { F as FuseOptions, h as fuseRetrieval, s as sha256Hex } from '../index-DcxTv3zx.js';
5
- export { bP as ChangeEvent, aN as Collection, go as CoordinationProvider, gp as DrainBarrierOptions, gq as FenceState, de as Noydb, dX as RetrieveHit, dY as RetrieveOptions, bh as Vault, gr as WriterPresence, gs as isQuorum, gt as runDrainBarrier } from '../types-CUmZYJwN.js';
4
+ export { F as FuseOptions, h as fuseRetrieval, s as sha256Hex } from '../index-CMRIx_zx.js';
5
+ export { bP as ChangeEvent, aN as Collection, bV as CollectionMeta, gw as CoordinationProvider, gx as DrainBarrierOptions, gy as FenceState, dk as Noydb, e1 as RetrieveHit, e2 as RetrieveOptions, bh as Vault, f1 as VaultMeta, gz as WriterPresence, gA as isQuorum, gB as runDrainBarrier } from '../types-DHn9lEP0.js';
6
6
  export { aL as CrossShardJoinError, W as DataResidencyError, ah as NoAccessError, au as ReservedVaultNameError, aB as ShardProvisioningError, aH as UnknownShardError, aJ as ValidationError, aK as VaultTemplateNotFoundError } from '../errors-BAWO5Z5a.js';
7
7
  export { c as JoinStrategy, L as LiveQuery, Q as Query } from '../index-Ddm8D3Oo.js';
8
8
  import '../lazy-builder-ChSqcF5t.js';
@@ -28,6 +28,7 @@ import {
28
28
  ValidationError,
29
29
  VaultTemplateNotFoundError
30
30
  } from "../chunk-JZ5DS4DP.js";
31
+ import "../chunk-PZ5AY32C.js";
31
32
  export {
32
33
  CrossShardJoinError,
33
34
  DataResidencyError,
@@ -17,6 +17,7 @@ import {
17
17
  import "./chunk-A7DNZVAV.js";
18
18
  import "./chunk-E2MDPPOC.js";
19
19
  import "./chunk-JZ5DS4DP.js";
20
+ import "./chunk-PZ5AY32C.js";
20
21
  export {
21
22
  LEDGER_COLLECTION,
22
23
  LEDGER_DELTAS_COLLECTION,
@@ -30,4 +31,4 @@ export {
30
31
  parseIndex,
31
32
  sha256Hex
32
33
  };
33
- //# sourceMappingURL=ledger-PMTR2Q62.js.map
34
+ //# sourceMappingURL=ledger-CI7GSMLB.js.map
@@ -1,6 +1,6 @@
1
- export { w as withMaterializedView } from '../with-materialized-view-Z_aHLln6.cjs';
2
- import { aN as Collection, bk as TxContext, bl as MVQueryContext, bm as RegisteredMV, bn as MaterializedViewRegistry } from '../types-Ba1vQ3AY.cjs';
3
- export { bo as MaterializedFromMeta, bp as MaterializedViewOutput, aK as MaterializedViewStrategy, aL as MaterializedViewStrategyHandle, bq as UnionArmJoin, br as UnionSource } from '../types-Ba1vQ3AY.cjs';
1
+ export { w as withMaterializedView } from '../with-materialized-view-DfgPcvi9.cjs';
2
+ import { aN as Collection, bk as TxContext, bl as MVQueryContext, bm as RegisteredMV, bn as MaterializedViewRegistry } from '../types-CdVfiQgt.cjs';
3
+ export { bo as MaterializedFromMeta, bp as MaterializedViewOutput, aK as MaterializedViewStrategy, aL as MaterializedViewStrategyHandle, bq as UnionArmJoin, br as UnionSource } from '../types-CdVfiQgt.cjs';
4
4
  import { Q as Query } from '../index-C1SC1EPe.cjs';
5
5
  export { z as MaterializedViewConfigError, C as MaterializedViewCycleError, E as MaterializedViewSourceUnknownError, G as MaterializedViewTooLargeError } from '../errors-BAWO5Z5a.cjs';
6
6
  import '../lazy-builder-eYZzLEL1.cjs';
@@ -1,6 +1,6 @@
1
- export { w as withMaterializedView } from '../with-materialized-view-Bjx6VYPc.js';
2
- import { aN as Collection, bk as TxContext, bl as MVQueryContext, bm as RegisteredMV, bn as MaterializedViewRegistry } from '../types-CUmZYJwN.js';
3
- export { bo as MaterializedFromMeta, bp as MaterializedViewOutput, aK as MaterializedViewStrategy, aL as MaterializedViewStrategyHandle, bq as UnionArmJoin, br as UnionSource } from '../types-CUmZYJwN.js';
1
+ export { w as withMaterializedView } from '../with-materialized-view-DNfzC5lH.js';
2
+ import { aN as Collection, bk as TxContext, bl as MVQueryContext, bm as RegisteredMV, bn as MaterializedViewRegistry } from '../types-DHn9lEP0.js';
3
+ export { bo as MaterializedFromMeta, bp as MaterializedViewOutput, aK as MaterializedViewStrategy, aL as MaterializedViewStrategyHandle, bq as UnionArmJoin, br as UnionSource } from '../types-DHn9lEP0.js';
4
4
  import { Q as Query } from '../index-Ddm8D3Oo.js';
5
5
  export { z as MaterializedViewConfigError, C as MaterializedViewCycleError, E as MaterializedViewSourceUnknownError, G as MaterializedViewTooLargeError } from '../errors-BAWO5Z5a.js';
6
6
  import '../lazy-builder-ChSqcF5t.js';
@@ -16,7 +16,7 @@ import {
16
16
  isMVStale,
17
17
  markMVStale,
18
18
  resolveStaleMVOnRead
19
- } from "../chunk-DJO4OYCJ.js";
19
+ } from "../chunk-33EQCZXE.js";
20
20
  import "../chunk-K6NVSHAH.js";
21
21
  import "../chunk-KJ3K5VZM.js";
22
22
  import "../chunk-QXWJQ7UU.js";
@@ -26,6 +26,7 @@ import {
26
26
  MaterializedViewSourceUnknownError,
27
27
  MaterializedViewTooLargeError
28
28
  } from "../chunk-JZ5DS4DP.js";
29
+ import "../chunk-PZ5AY32C.js";
29
30
  export {
30
31
  MaterializedViewConfigError,
31
32
  MaterializedViewCycleError,
@@ -1,4 +1,4 @@
1
- import { V as ObjectProjection } from './types-CUmZYJwN.js';
1
+ import { V as ObjectProjection } from './types-DHn9lEP0.js';
2
2
 
3
3
  /**
4
4
  * Import / bootstrap (reverse projection) — walk an existing bucket/prefix in an
@@ -1,4 +1,4 @@
1
- import { V as ObjectProjection } from './types-Ba1vQ3AY.cjs';
1
+ import { V as ObjectProjection } from './types-CdVfiQgt.cjs';
2
2
 
3
3
  /**
4
4
  * Import / bootstrap (reverse projection) — walk an existing bucket/prefix in an
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  Noydb,
3
3
  createNoydb
4
- } from "./chunk-ZDW22N3E.js";
4
+ } from "./chunk-BVKLJBJJ.js";
5
5
  import "./chunk-GGXN73NM.js";
6
6
  import "./chunk-EMIGCR7X.js";
7
- import "./chunk-BITB3T5Z.js";
7
+ import "./chunk-ZPJSQPQH.js";
8
8
  import "./chunk-MPIZQGFA.js";
9
9
  import "./chunk-QGBBQKDS.js";
10
10
  import "./chunk-XYW2CSCI.js";
@@ -17,9 +17,9 @@ import "./chunk-MRJPSXPE.js";
17
17
  import "./chunk-QBLPY44S.js";
18
18
  import "./chunk-QWJCNXH2.js";
19
19
  import "./chunk-LXKBG52H.js";
20
- import "./chunk-553CK4E2.js";
20
+ import "./chunk-OCYFFBZS.js";
21
21
  import "./chunk-UF3BUNQZ.js";
22
- import "./chunk-REHF3HSJ.js";
22
+ import "./chunk-K4JID2ZE.js";
23
23
  import "./chunk-QXWJQ7UU.js";
24
24
  import "./chunk-AWU4JF7C.js";
25
25
  import "./chunk-MSMDDDDJ.js";
@@ -32,8 +32,9 @@ import "./chunk-SQXTKZL7.js";
32
32
  import "./chunk-A7DNZVAV.js";
33
33
  import "./chunk-E2MDPPOC.js";
34
34
  import "./chunk-JZ5DS4DP.js";
35
+ import "./chunk-PZ5AY32C.js";
35
36
  export {
36
37
  Noydb,
37
38
  createNoydb
38
39
  };
39
- //# sourceMappingURL=noydb-Y3ZLZNXA.js.map
40
+ //# sourceMappingURL=noydb-5MIBD77B.js.map
@@ -1,6 +1,6 @@
1
- export { w as withOverlayedView } from '../with-overlayed-view-pTOFgHRq.cjs';
2
- import { aM as OverlayedViewStrategy, aN as Collection } from '../types-Ba1vQ3AY.cjs';
3
- export { aO as OverlayFieldMergeMode, aP as OverlayFieldMergeRule, aQ as OverlayedViewRegistry, aR as OverlayedViewStrategyHandle } from '../types-Ba1vQ3AY.cjs';
1
+ export { w as withOverlayedView } from '../with-overlayed-view-Cvfkx1lg.cjs';
2
+ import { aM as OverlayedViewStrategy, aN as Collection } from '../types-CdVfiQgt.cjs';
3
+ export { aO as OverlayFieldMergeMode, aP as OverlayFieldMergeRule, aQ as OverlayedViewRegistry, aR as OverlayedViewStrategyHandle } from '../types-CdVfiQgt.cjs';
4
4
  export { O as OverlayBaseIsVirtualError, n as OverlayCollectionUnavailableError, o as OverlayIdMismatchError, p as OverlayNameCollisionError } from '../errors-BAWO5Z5a.cjs';
5
5
  import '../lazy-builder-eYZzLEL1.cjs';
6
6
  import '../predicate-BmhBSPCH.cjs';
@@ -1,6 +1,6 @@
1
- export { w as withOverlayedView } from '../with-overlayed-view-B8PkL179.js';
2
- import { aM as OverlayedViewStrategy, aN as Collection } from '../types-CUmZYJwN.js';
3
- export { aO as OverlayFieldMergeMode, aP as OverlayFieldMergeRule, aQ as OverlayedViewRegistry, aR as OverlayedViewStrategyHandle } from '../types-CUmZYJwN.js';
1
+ export { w as withOverlayedView } from '../with-overlayed-view-qk3lbhOd.js';
2
+ import { aM as OverlayedViewStrategy, aN as Collection } from '../types-DHn9lEP0.js';
3
+ export { aO as OverlayFieldMergeMode, aP as OverlayFieldMergeRule, aQ as OverlayedViewRegistry, aR as OverlayedViewStrategyHandle } from '../types-DHn9lEP0.js';
4
4
  export { O as OverlayBaseIsVirtualError, n as OverlayCollectionUnavailableError, o as OverlayIdMismatchError, p as OverlayNameCollisionError } from '../errors-BAWO5Z5a.js';
5
5
  import '../lazy-builder-ChSqcF5t.js';
6
6
  import '../predicate-BmhBSPCH.js';
@@ -13,6 +13,7 @@ import {
13
13
  OverlayIdMismatchError,
14
14
  OverlayNameCollisionError
15
15
  } from "../chunk-JZ5DS4DP.js";
16
+ import "../chunk-PZ5AY32C.js";
16
17
  export {
17
18
  OverlayBaseIsVirtualError,
18
19
  OverlayCollectionUnavailableError,
@@ -1,5 +1,5 @@
1
- import { ab as PeriodsStrategy } from '../types-Ba1vQ3AY.cjs';
2
- export { ac as CarryForwardContext, ad as ClosePeriodOptions, ae as OpenPeriodOptions, af as PERIODS_COLLECTION, ag as PeriodRecord, ah as ReadOnlyCollection, ai as appendPeriodLedgerEntry, aj as assertTsWritable, ak as chainAnchor, al as loadPeriods, am as validatePeriodName } from '../types-Ba1vQ3AY.cjs';
1
+ import { ab as PeriodsStrategy } from '../types-CdVfiQgt.cjs';
2
+ export { ac as CarryForwardContext, ad as ClosePeriodOptions, ae as OpenPeriodOptions, af as PERIODS_COLLECTION, ag as PeriodRecord, ah as ReadOnlyCollection, ai as appendPeriodLedgerEntry, aj as assertTsWritable, ak as chainAnchor, al as loadPeriods, am as validatePeriodName } from '../types-CdVfiQgt.cjs';
3
3
  import '../lazy-builder-eYZzLEL1.cjs';
4
4
  import '../predicate-BmhBSPCH.cjs';
5
5
  import '../strategy-mJExw4LQ.cjs';
@@ -1,5 +1,5 @@
1
- import { ab as PeriodsStrategy } from '../types-CUmZYJwN.js';
2
- export { ac as CarryForwardContext, ad as ClosePeriodOptions, ae as OpenPeriodOptions, af as PERIODS_COLLECTION, ag as PeriodRecord, ah as ReadOnlyCollection, ai as appendPeriodLedgerEntry, aj as assertTsWritable, ak as chainAnchor, al as loadPeriods, am as validatePeriodName } from '../types-CUmZYJwN.js';
1
+ import { ab as PeriodsStrategy } from '../types-DHn9lEP0.js';
2
+ export { ac as CarryForwardContext, ad as ClosePeriodOptions, ae as OpenPeriodOptions, af as PERIODS_COLLECTION, ag as PeriodRecord, ah as ReadOnlyCollection, ai as appendPeriodLedgerEntry, aj as assertTsWritable, ak as chainAnchor, al as loadPeriods, am as validatePeriodName } from '../types-DHn9lEP0.js';
3
3
  import '../lazy-builder-ChSqcF5t.js';
4
4
  import '../predicate-BmhBSPCH.js';
5
5
  import '../strategy-8QGs5KQE.js';
@@ -6,13 +6,14 @@ import {
6
6
  loadPeriods,
7
7
  validatePeriodName,
8
8
  withPeriods
9
- } from "../chunk-553CK4E2.js";
9
+ } from "../chunk-OCYFFBZS.js";
10
10
  import "../chunk-UF3BUNQZ.js";
11
11
  import "../chunk-2UT7HJJR.js";
12
12
  import "../chunk-PDVP3C2I.js";
13
13
  import "../chunk-A7DNZVAV.js";
14
14
  import "../chunk-E2MDPPOC.js";
15
15
  import "../chunk-JZ5DS4DP.js";
16
+ import "../chunk-PZ5AY32C.js";
16
17
  export {
17
18
  PERIODS_COLLECTION,
18
19
  appendPeriodLedgerEntry,
@@ -15,6 +15,7 @@ import {
15
15
  } from "./chunk-QWJCNXH2.js";
16
16
  import "./chunk-A7DNZVAV.js";
17
17
  import "./chunk-JZ5DS4DP.js";
18
+ import "./chunk-PZ5AY32C.js";
18
19
  export {
19
20
  DEFAULT_PUBLIC_ENVELOPE_SCHEMA,
20
21
  PUBLIC_ENVELOPE_FIELDS,
@@ -28,4 +29,4 @@ export {
28
29
  savePublicEnvelope,
29
30
  validatePublicEnvelopeInput
30
31
  };
31
- //# sourceMappingURL=public-envelope-S2S2VR3F.js.map
32
+ //# sourceMappingURL=public-envelope-MFMBFJLZ.js.map
@@ -45,6 +45,7 @@ import {
45
45
  IndexWriteFailureError,
46
46
  JoinTooLargeError
47
47
  } from "../chunk-JZ5DS4DP.js";
48
+ import "../chunk-PZ5AY32C.js";
48
49
  export {
49
50
  Aggregation,
50
51
  CollectionIndexes,
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  ReadOnlyVaultFacade
3
3
  } from "./chunk-ADB7GPM3.js";
4
+ import "./chunk-PZ5AY32C.js";
4
5
  export {
5
6
  ReadOnlyVaultFacade
6
7
  };
7
- //# sourceMappingURL=read-only-facade-EX6WZZBP.js.map
8
+ //# sourceMappingURL=read-only-facade-3OQRZ3VS.js.map
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  GuardRegistry
3
3
  } from "./chunk-A3JMGXPG.js";
4
+ import "./chunk-PZ5AY32C.js";
4
5
  export {
5
6
  GuardRegistry
6
7
  };
7
- //# sourceMappingURL=registry-DKEXOJVO.js.map
8
+ //# sourceMappingURL=registry-IX5WKK4F.js.map
@@ -3,8 +3,9 @@ import {
3
3
  wrapDbWithPredicates
4
4
  } from "./chunk-RCB6GWTC.js";
5
5
  import "./chunk-JZ5DS4DP.js";
6
+ import "./chunk-PZ5AY32C.js";
6
7
  export {
7
8
  MaterializedViewRegistry,
8
9
  wrapDbWithPredicates
9
10
  };
10
- //# sourceMappingURL=registry-53A55ZZE.js.map
11
+ //# sourceMappingURL=registry-LMHO5265.js.map
@@ -2,7 +2,8 @@ import {
2
2
  DerivationRegistry
3
3
  } from "./chunk-UBF5JEOJ.js";
4
4
  import "./chunk-JZ5DS4DP.js";
5
+ import "./chunk-PZ5AY32C.js";
5
6
  export {
6
7
  DerivationRegistry
7
8
  };
8
- //# sourceMappingURL=registry-IEU6ATO7.js.map
9
+ //# sourceMappingURL=registry-TXCKWH26.js.map
@@ -2,7 +2,8 @@ import {
2
2
  OverlayedViewRegistry
3
3
  } from "./chunk-TMUMMAWV.js";
4
4
  import "./chunk-JZ5DS4DP.js";
5
+ import "./chunk-PZ5AY32C.js";
5
6
  export {
6
7
  OverlayedViewRegistry
7
8
  };
8
- //# sourceMappingURL=registry-FKL4SLU4.js.map
9
+ //# sourceMappingURL=registry-VFEDQSYV.js.map
@@ -8,10 +8,11 @@ import "./chunk-5PTX7PKD.js";
8
8
  import "./chunk-A7DNZVAV.js";
9
9
  import "./chunk-E2MDPPOC.js";
10
10
  import "./chunk-JZ5DS4DP.js";
11
+ import "./chunk-PZ5AY32C.js";
11
12
  export {
12
13
  getRevokedDocIdsCore,
13
14
  publishRevocationListCore,
14
15
  revokeDocCore,
15
16
  unrevokeDocCore
16
17
  };
17
- //# sourceMappingURL=revoke-AOCAVR56.js.map
18
+ //# sourceMappingURL=revoke-5PUOZPJJ.js.map
@@ -6,6 +6,7 @@ import {
6
6
  SealedRecordExpiredError,
7
7
  SealedRecordMismatchError
8
8
  } from "../chunk-JZ5DS4DP.js";
9
+ import "../chunk-PZ5AY32C.js";
9
10
 
10
11
  // src/sealed-record/index.ts
11
12
  var subtle = globalThis.crypto.subtle;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/sealed-record/index.ts"],"sourcesContent":["/**\n * `@noy-db/hub/sealed-record` — host-side opener for record-scoped CEK\n * sealing (#306 slices 2-3).\n *\n * The **grantor** side (sealing a record's CEK to a host, revoking, and hard\n * rotation) lives on `Vault` (`vault.sealRecordToHost` /\n * `vault.revokeSealedRecord` / `vault.rotateRecordCek`) because it needs the\n * collection DEK. This subpath exposes the **recipient host** side:\n * {@link openSealedRecord} reconstructs a single record's plaintext from\n * (a) the sealed-CEK delivery envelope, (b) the record's encrypted envelope\n * body, and (c) the host's own unsealer — and **nothing else**. The host never\n * touches a vault DEK and can decrypt exactly the one bound record.\n *\n * @module\n */\n\nimport { decrypt, base64ToBuffer } from '../crypto.js'\nimport {\n SealedRecordExpiredError,\n SealedRecordMismatchError,\n} from '../errors.js'\nimport type {\n SealedCekDeliveryEnvelope,\n SealedCekBinding,\n} from './types.js'\n\nexport type { SealedCekDeliveryEnvelope, SealedCekBinding } from './types.js'\nexport { SealedRecordExpiredError, SealedRecordMismatchError } from '../errors.js'\n\nconst subtle = globalThis.crypto.subtle\n\n/**\n * Host-side: decrypt a single record whose CEK was sealed to this host by a\n * vault grantor via `vault.sealRecordToHost()`.\n *\n * Verification order (security-critical — do NOT reorder past the unseal):\n * 1. **Fast-path expiry** — reject on the delivery envelope's clear-text\n * `expiresAt` before doing any (potentially expensive) unseal work. This is\n * a hint only.\n * 2. **Unseal** the `payload` with the host's `recipientSealer.unseal` →\n * parse the {@link SealedCekBinding}.\n * 3. **Binding match** — the binding's `{collection, id}` MUST equal the\n * expected pair, else {@link SealedRecordMismatchError}. This is the\n * host-denial boundary (a CEK sealed for record A cannot open record B).\n * 4. **Authoritative expiry** — re-check `binding.expiresAt` (the copy that\n * cannot be forged by editing the delivery envelope), else\n * {@link SealedRecordExpiredError}.\n * 5. **Decrypt** the record body under the unsealed CEK. A CEK from a\n * PRE-rotation seal applied to a POST-rotation live envelope passes (1)-(4)\n * but fails the AES-GCM auth tag → `TamperedError` from `decrypt`.\n *\n * @param sealedCekEnvelope The `SealedCekDeliveryEnvelope` written by the grantor.\n * @param recordEnvelope The record's `{ _iv, _data }` (the encrypted body).\n * @param recipientSealer The host's unsealer (`{ unseal(bytes) }`) — e.g. a\n * KMS-backed sealer or `MemoryRecipientSealer`.\n * @param expectedCollection Collection the caller believes `recordEnvelope` is in.\n * @param expectedId Record id the caller believes `recordEnvelope` is.\n * @returns The decrypted record body as a JSON string.\n */\nexport async function openSealedRecord(\n sealedCekEnvelope: SealedCekDeliveryEnvelope,\n recordEnvelope: { readonly _iv: string; readonly _data: string },\n recipientSealer: { unseal(bytes: Uint8Array): Promise<Uint8Array> },\n expectedCollection: string,\n expectedId: string,\n): Promise<string> {\n // (1) Fast-path expiry on the (unauthenticated) delivery envelope.\n if (Date.parse(sealedCekEnvelope.expiresAt) <= Date.now()) {\n throw new SealedRecordExpiredError(sealedCekEnvelope.expiresAt)\n }\n\n // (2) Unseal → parse binding.\n const payloadBytes = base64ToBuffer(sealedCekEnvelope.payload)\n const openedBytes = await recipientSealer.unseal(payloadBytes)\n const binding = JSON.parse(new TextDecoder().decode(openedBytes)) as SealedCekBinding\n\n // (3) Binding match — host-denial boundary.\n if (binding.collection !== expectedCollection || binding.id !== expectedId) {\n throw new SealedRecordMismatchError(\n { collection: expectedCollection, id: expectedId },\n { collection: binding.collection, id: binding.id },\n )\n }\n\n // (4) Authoritative expiry — the copy that cannot be forged on the envelope.\n if (Date.parse(binding.expiresAt) <= Date.now()) {\n throw new SealedRecordExpiredError(binding.expiresAt)\n }\n\n // (5) Import the raw CEK + decrypt the body. Wrong-key (pre-rotation CEK vs\n // post-rotation body) surfaces as TamperedError from decrypt's GCM tag check.\n const cek = await subtle.importKey(\n 'raw',\n base64ToBuffer(binding.cek) as BufferSource,\n { name: 'AES-GCM', length: 256 },\n false,\n ['decrypt'],\n )\n return decrypt(recordEnvelope._iv, recordEnvelope._data, cek)\n}\n"],"mappings":";;;;;;;;;;AA6BA,IAAM,SAAS,WAAW,OAAO;AA8BjC,eAAsB,iBACpB,mBACA,gBACA,iBACA,oBACA,YACiB;AAEjB,MAAI,KAAK,MAAM,kBAAkB,SAAS,KAAK,KAAK,IAAI,GAAG;AACzD,UAAM,IAAI,yBAAyB,kBAAkB,SAAS;AAAA,EAChE;AAGA,QAAM,eAAe,eAAe,kBAAkB,OAAO;AAC7D,QAAM,cAAc,MAAM,gBAAgB,OAAO,YAAY;AAC7D,QAAM,UAAU,KAAK,MAAM,IAAI,YAAY,EAAE,OAAO,WAAW,CAAC;AAGhE,MAAI,QAAQ,eAAe,sBAAsB,QAAQ,OAAO,YAAY;AAC1E,UAAM,IAAI;AAAA,MACR,EAAE,YAAY,oBAAoB,IAAI,WAAW;AAAA,MACjD,EAAE,YAAY,QAAQ,YAAY,IAAI,QAAQ,GAAG;AAAA,IACnD;AAAA,EACF;AAGA,MAAI,KAAK,MAAM,QAAQ,SAAS,KAAK,KAAK,IAAI,GAAG;AAC/C,UAAM,IAAI,yBAAyB,QAAQ,SAAS;AAAA,EACtD;AAIA,QAAM,MAAM,MAAM,OAAO;AAAA,IACvB;AAAA,IACA,eAAe,QAAQ,GAAG;AAAA,IAC1B,EAAE,MAAM,WAAW,QAAQ,IAAI;AAAA,IAC/B;AAAA,IACA,CAAC,SAAS;AAAA,EACZ;AACA,SAAO,QAAQ,eAAe,KAAK,eAAe,OAAO,GAAG;AAC9D;","names":[]}
1
+ {"version":3,"sources":["../../src/sealed-record/index.ts"],"sourcesContent":["/**\n * `@noy-db/hub/sealed-record` — host-side opener for record-scoped CEK\n * sealing (#306 slices 2-3).\n *\n * The **grantor** side (sealing a record's CEK to a host, revoking, and hard\n * rotation) lives on `Vault` (`vault.sealRecordToHost` /\n * `vault.revokeSealedRecord` / `vault.rotateRecordCek`) because it needs the\n * collection DEK. This subpath exposes the **recipient host** side:\n * {@link openSealedRecord} reconstructs a single record's plaintext from\n * (a) the sealed-CEK delivery envelope, (b) the record's encrypted envelope\n * body, and (c) the host's own unsealer — and **nothing else**. The host never\n * touches a vault DEK and can decrypt exactly the one bound record.\n *\n * @module\n */\n\nimport { decrypt, base64ToBuffer } from '../crypto.js'\nimport {\n SealedRecordExpiredError,\n SealedRecordMismatchError,\n} from '../errors.js'\nimport type {\n SealedCekDeliveryEnvelope,\n SealedCekBinding,\n} from './types.js'\n\nexport type { SealedCekDeliveryEnvelope, SealedCekBinding } from './types.js'\nexport { SealedRecordExpiredError, SealedRecordMismatchError } from '../errors.js'\n\nconst subtle = globalThis.crypto.subtle\n\n/**\n * Host-side: decrypt a single record whose CEK was sealed to this host by a\n * vault grantor via `vault.sealRecordToHost()`.\n *\n * Verification order (security-critical — do NOT reorder past the unseal):\n * 1. **Fast-path expiry** — reject on the delivery envelope's clear-text\n * `expiresAt` before doing any (potentially expensive) unseal work. This is\n * a hint only.\n * 2. **Unseal** the `payload` with the host's `recipientSealer.unseal` →\n * parse the {@link SealedCekBinding}.\n * 3. **Binding match** — the binding's `{collection, id}` MUST equal the\n * expected pair, else {@link SealedRecordMismatchError}. This is the\n * host-denial boundary (a CEK sealed for record A cannot open record B).\n * 4. **Authoritative expiry** — re-check `binding.expiresAt` (the copy that\n * cannot be forged by editing the delivery envelope), else\n * {@link SealedRecordExpiredError}.\n * 5. **Decrypt** the record body under the unsealed CEK. A CEK from a\n * PRE-rotation seal applied to a POST-rotation live envelope passes (1)-(4)\n * but fails the AES-GCM auth tag → `TamperedError` from `decrypt`.\n *\n * @param sealedCekEnvelope The `SealedCekDeliveryEnvelope` written by the grantor.\n * @param recordEnvelope The record's `{ _iv, _data }` (the encrypted body).\n * @param recipientSealer The host's unsealer (`{ unseal(bytes) }`) — e.g. a\n * KMS-backed sealer or `MemoryRecipientSealer`.\n * @param expectedCollection Collection the caller believes `recordEnvelope` is in.\n * @param expectedId Record id the caller believes `recordEnvelope` is.\n * @returns The decrypted record body as a JSON string.\n */\nexport async function openSealedRecord(\n sealedCekEnvelope: SealedCekDeliveryEnvelope,\n recordEnvelope: { readonly _iv: string; readonly _data: string },\n recipientSealer: { unseal(bytes: Uint8Array): Promise<Uint8Array> },\n expectedCollection: string,\n expectedId: string,\n): Promise<string> {\n // (1) Fast-path expiry on the (unauthenticated) delivery envelope.\n if (Date.parse(sealedCekEnvelope.expiresAt) <= Date.now()) {\n throw new SealedRecordExpiredError(sealedCekEnvelope.expiresAt)\n }\n\n // (2) Unseal → parse binding.\n const payloadBytes = base64ToBuffer(sealedCekEnvelope.payload)\n const openedBytes = await recipientSealer.unseal(payloadBytes)\n const binding = JSON.parse(new TextDecoder().decode(openedBytes)) as SealedCekBinding\n\n // (3) Binding match — host-denial boundary.\n if (binding.collection !== expectedCollection || binding.id !== expectedId) {\n throw new SealedRecordMismatchError(\n { collection: expectedCollection, id: expectedId },\n { collection: binding.collection, id: binding.id },\n )\n }\n\n // (4) Authoritative expiry — the copy that cannot be forged on the envelope.\n if (Date.parse(binding.expiresAt) <= Date.now()) {\n throw new SealedRecordExpiredError(binding.expiresAt)\n }\n\n // (5) Import the raw CEK + decrypt the body. Wrong-key (pre-rotation CEK vs\n // post-rotation body) surfaces as TamperedError from decrypt's GCM tag check.\n const cek = await subtle.importKey(\n 'raw',\n base64ToBuffer(binding.cek) as BufferSource,\n { name: 'AES-GCM', length: 256 },\n false,\n ['decrypt'],\n )\n return decrypt(recordEnvelope._iv, recordEnvelope._data, cek)\n}\n"],"mappings":";;;;;;;;;;;AA6BA,IAAM,SAAS,WAAW,OAAO;AA8BjC,eAAsB,iBACpB,mBACA,gBACA,iBACA,oBACA,YACiB;AAEjB,MAAI,KAAK,MAAM,kBAAkB,SAAS,KAAK,KAAK,IAAI,GAAG;AACzD,UAAM,IAAI,yBAAyB,kBAAkB,SAAS;AAAA,EAChE;AAGA,QAAM,eAAe,eAAe,kBAAkB,OAAO;AAC7D,QAAM,cAAc,MAAM,gBAAgB,OAAO,YAAY;AAC7D,QAAM,UAAU,KAAK,MAAM,IAAI,YAAY,EAAE,OAAO,WAAW,CAAC;AAGhE,MAAI,QAAQ,eAAe,sBAAsB,QAAQ,OAAO,YAAY;AAC1E,UAAM,IAAI;AAAA,MACR,EAAE,YAAY,oBAAoB,IAAI,WAAW;AAAA,MACjD,EAAE,YAAY,QAAQ,YAAY,IAAI,QAAQ,GAAG;AAAA,IACnD;AAAA,EACF;AAGA,MAAI,KAAK,MAAM,QAAQ,SAAS,KAAK,KAAK,IAAI,GAAG;AAC/C,UAAM,IAAI,yBAAyB,QAAQ,SAAS;AAAA,EACtD;AAIA,QAAM,MAAM,MAAM,OAAO;AAAA,IACvB;AAAA,IACA,eAAe,QAAQ,GAAG;AAAA,IAC1B,EAAE,MAAM,WAAW,QAAQ,IAAI;AAAA,IAC/B;AAAA,IACA,CAAC,SAAS;AAAA,EACZ;AACA,SAAO,QAAQ,eAAe,KAAK,eAAe,OAAO,GAAG;AAC9D;","names":[]}
@@ -1,6 +1,6 @@
1
- export { C as CreateSessionOptions, a as CreateSessionResult, D as DevUnlockOptions, S as SessionToken, b as activeSessionCount, c as clearDevUnlock, d as createSession, e as enableDevUnlock, i as isDevUnlockActive, f as isSessionAlive, l as loadDevUnlock, r as resolveSession, g as revokeAllSessions, h as revokeSession } from '../dev-unlock-CIkHrcRm.cjs';
2
- import { m as SessionStrategy } from '../types-Ba1vQ3AY.cjs';
3
- export { P as PolicyEnforcer, n as createEnforcer, v as validateSessionPolicy } from '../types-Ba1vQ3AY.cjs';
1
+ export { C as CreateSessionOptions, a as CreateSessionResult, D as DevUnlockOptions, S as SessionToken, b as activeSessionCount, c as clearDevUnlock, d as createSession, e as enableDevUnlock, i as isDevUnlockActive, f as isSessionAlive, l as loadDevUnlock, r as resolveSession, g as revokeAllSessions, h as revokeSession } from '../dev-unlock-0Z6yxfS7.cjs';
2
+ import { m as SessionStrategy } from '../types-CdVfiQgt.cjs';
3
+ export { P as PolicyEnforcer, n as createEnforcer, v as validateSessionPolicy } from '../types-CdVfiQgt.cjs';
4
4
  export { c as SessionExpiredError, d as SessionNotFoundError, e as SessionPolicyError } from '../errors-BAWO5Z5a.cjs';
5
5
  import '../lazy-builder-eYZzLEL1.cjs';
6
6
  import '../predicate-BmhBSPCH.cjs';
@@ -1,6 +1,6 @@
1
- export { C as CreateSessionOptions, a as CreateSessionResult, D as DevUnlockOptions, S as SessionToken, b as activeSessionCount, c as clearDevUnlock, d as createSession, e as enableDevUnlock, i as isDevUnlockActive, f as isSessionAlive, l as loadDevUnlock, r as resolveSession, g as revokeAllSessions, h as revokeSession } from '../dev-unlock-BF9IhLPn.js';
2
- import { m as SessionStrategy } from '../types-CUmZYJwN.js';
3
- export { P as PolicyEnforcer, n as createEnforcer, v as validateSessionPolicy } from '../types-CUmZYJwN.js';
1
+ export { C as CreateSessionOptions, a as CreateSessionResult, D as DevUnlockOptions, S as SessionToken, b as activeSessionCount, c as clearDevUnlock, d as createSession, e as enableDevUnlock, i as isDevUnlockActive, f as isSessionAlive, l as loadDevUnlock, r as resolveSession, g as revokeAllSessions, h as revokeSession } from '../dev-unlock-DJ3IhgY9.js';
2
+ import { m as SessionStrategy } from '../types-DHn9lEP0.js';
3
+ export { P as PolicyEnforcer, n as createEnforcer, v as validateSessionPolicy } from '../types-DHn9lEP0.js';
4
4
  export { c as SessionExpiredError, d as SessionNotFoundError, e as SessionPolicyError } from '../errors-BAWO5Z5a.js';
5
5
  import '../lazy-builder-ChSqcF5t.js';
6
6
  import '../predicate-BmhBSPCH.js';
@@ -20,6 +20,7 @@ import {
20
20
  SessionNotFoundError,
21
21
  SessionPolicyError
22
22
  } from "../chunk-JZ5DS4DP.js";
23
+ import "../chunk-PZ5AY32C.js";
23
24
 
24
25
  // src/session/active.ts
25
26
  function withSession() {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/session/active.ts"],"sourcesContent":["/**\n * Active session strategy — `withSession()` returns the real\n * implementation that wires `SessionPolicy` validation, the\n * `PolicyEnforcer`, and the global session-token registry into the\n * Noydb lifecycle.\n *\n * Consumers opt in by:\n *\n * ```ts\n * import { createNoydb } from '@noy-db/hub'\n * import { withSession } from '@noy-db/hub/session'\n *\n * const db = await createNoydb({\n * store: ...,\n * user: ...,\n * sessionPolicy: { idleTimeoutMs: 15 * 60_000 },\n * sessionStrategy: withSession(),\n * })\n * ```\n *\n * The factory delegates to the existing `session-policy.ts` and\n * `session.ts` modules. Splitting the import chain through this file\n * is what lets tsup tree-shake the ~495 LOC of policy + token code\n * out of the default bundle when no `withSession()` import is\n * present.\n *\n * Note: dev-unlock (`devUnlock`, `cancelDevUnlock`) is a separate\n * named import from `@noy-db/hub` and tree-shakes independently —\n * apps that don't import it never include it.\n *\n * @public\n */\n\nimport type { SessionStrategy } from './strategy.js'\nimport { createEnforcer, validateSessionPolicy } from './session-policy.js'\nimport { revokeAllSessions } from './session.js'\n\nexport function withSession(): SessionStrategy {\n return {\n validateSessionPolicy,\n createEnforcer,\n revokeAllSessions,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqCO,SAAS,cAA+B;AAC7C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/session/active.ts"],"sourcesContent":["/**\n * Active session strategy — `withSession()` returns the real\n * implementation that wires `SessionPolicy` validation, the\n * `PolicyEnforcer`, and the global session-token registry into the\n * Noydb lifecycle.\n *\n * Consumers opt in by:\n *\n * ```ts\n * import { createNoydb } from '@noy-db/hub'\n * import { withSession } from '@noy-db/hub/session'\n *\n * const db = await createNoydb({\n * store: ...,\n * user: ...,\n * sessionPolicy: { idleTimeoutMs: 15 * 60_000 },\n * sessionStrategy: withSession(),\n * })\n * ```\n *\n * The factory delegates to the existing `session-policy.ts` and\n * `session.ts` modules. Splitting the import chain through this file\n * is what lets tsup tree-shake the ~495 LOC of policy + token code\n * out of the default bundle when no `withSession()` import is\n * present.\n *\n * Note: dev-unlock (`devUnlock`, `cancelDevUnlock`) is a separate\n * named import from `@noy-db/hub` and tree-shakes independently —\n * apps that don't import it never include it.\n *\n * @public\n */\n\nimport type { SessionStrategy } from './strategy.js'\nimport { createEnforcer, validateSessionPolicy } from './session-policy.js'\nimport { revokeAllSessions } from './session.js'\n\nexport function withSession(): SessionStrategy {\n return {\n validateSessionPolicy,\n createEnforcer,\n revokeAllSessions,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqCO,SAAS,cAA+B;AAC7C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -1,5 +1,5 @@
1
- import { at as ShadowStrategy } from '../types-Ba1vQ3AY.cjs';
2
- export { au as CollectionFrame, av as VaultFrame } from '../types-Ba1vQ3AY.cjs';
1
+ import { at as ShadowStrategy } from '../types-CdVfiQgt.cjs';
2
+ export { au as CollectionFrame, av as VaultFrame } from '../types-CdVfiQgt.cjs';
3
3
  import '../lazy-builder-eYZzLEL1.cjs';
4
4
  import '../predicate-BmhBSPCH.cjs';
5
5
  import '../strategy-mJExw4LQ.cjs';
@@ -1,5 +1,5 @@
1
- import { at as ShadowStrategy } from '../types-CUmZYJwN.js';
2
- export { au as CollectionFrame, av as VaultFrame } from '../types-CUmZYJwN.js';
1
+ import { at as ShadowStrategy } from '../types-DHn9lEP0.js';
2
+ export { au as CollectionFrame, av as VaultFrame } from '../types-DHn9lEP0.js';
3
3
  import '../lazy-builder-ChSqcF5t.js';
4
4
  import '../predicate-BmhBSPCH.js';
5
5
  import '../strategy-8QGs5KQE.js';
@@ -3,6 +3,7 @@ import {
3
3
  VaultFrame
4
4
  } from "../chunk-2ZYIN3BL.js";
5
5
  import "../chunk-JZ5DS4DP.js";
6
+ import "../chunk-PZ5AY32C.js";
6
7
 
7
8
  // src/shadow/active.ts
8
9
  function withShadow() {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/shadow/active.ts"],"sourcesContent":["/**\n * Active shadow strategy — the only place `VaultFrame` is constructed.\n * Only reachable through `@noy-db/hub/shadow`.\n */\n\nimport { VaultFrame } from './vault-frame.js'\nimport type { ShadowStrategy } from './strategy.js'\nimport type { Vault } from '../vault.js'\n\nexport function withShadow(): ShadowStrategy {\n return {\n buildFrame(vault) { return new VaultFrame(vault as Vault) },\n }\n}\n"],"mappings":";;;;;;;AASO,SAAS,aAA6B;AAC3C,SAAO;AAAA,IACL,WAAW,OAAO;AAAE,aAAO,IAAI,WAAW,KAAc;AAAA,IAAE;AAAA,EAC5D;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/shadow/active.ts"],"sourcesContent":["/**\n * Active shadow strategy — the only place `VaultFrame` is constructed.\n * Only reachable through `@noy-db/hub/shadow`.\n */\n\nimport { VaultFrame } from './vault-frame.js'\nimport type { ShadowStrategy } from './strategy.js'\nimport type { Vault } from '../vault.js'\n\nexport function withShadow(): ShadowStrategy {\n return {\n buildFrame(vault) { return new VaultFrame(vault as Vault) },\n }\n}\n"],"mappings":";;;;;;;;AASO,SAAS,aAA6B;AAC3C,SAAO;AAAA,IACL,WAAW,OAAO;AAAE,aAAO,IAAI,WAAW,KAAc;AAAA,IAAE;AAAA,EAC5D;AACF;","names":[]}
@@ -8,6 +8,7 @@ import {
8
8
  import "./chunk-A7DNZVAV.js";
9
9
  import "./chunk-E2MDPPOC.js";
10
10
  import "./chunk-JZ5DS4DP.js";
11
+ import "./chunk-PZ5AY32C.js";
11
12
  export {
12
13
  ATTESTATIONS_COLLECTION,
13
14
  REVOKED_RECORD_ID,
@@ -15,4 +16,4 @@ export {
15
16
  loadOrCreateSigner,
16
17
  loadSigner
17
18
  };
18
- //# sourceMappingURL=signer-JMK6W2Y6.js.map
19
+ //# sourceMappingURL=signer-UB5TQOZ6.js.map
@@ -1,5 +1,5 @@
1
- import { aw as NoydbBundleStore, ax as RetentionPolicy, ay as SnapshotPolicy, az as SnapshotStrategy } from '../types-Ba1vQ3AY.cjs';
2
- export { aA as SnapshotMeta, aB as SnapshotMode } from '../types-Ba1vQ3AY.cjs';
1
+ import { aw as NoydbBundleStore, ax as RetentionPolicy, ay as SnapshotPolicy, az as SnapshotStrategy } from '../types-CdVfiQgt.cjs';
2
+ export { aA as SnapshotMeta, aB as SnapshotMode } from '../types-CdVfiQgt.cjs';
3
3
  export { h as SnapshotNotFoundError } from '../errors-BAWO5Z5a.cjs';
4
4
  import '../lazy-builder-eYZzLEL1.cjs';
5
5
  import '../predicate-BmhBSPCH.cjs';
@@ -1,5 +1,5 @@
1
- import { aw as NoydbBundleStore, ax as RetentionPolicy, ay as SnapshotPolicy, az as SnapshotStrategy } from '../types-CUmZYJwN.js';
2
- export { aA as SnapshotMeta, aB as SnapshotMode } from '../types-CUmZYJwN.js';
1
+ import { aw as NoydbBundleStore, ax as RetentionPolicy, ay as SnapshotPolicy, az as SnapshotStrategy } from '../types-DHn9lEP0.js';
2
+ export { aA as SnapshotMeta, aB as SnapshotMode } from '../types-DHn9lEP0.js';
3
3
  export { h as SnapshotNotFoundError } from '../errors-BAWO5Z5a.js';
4
4
  import '../lazy-builder-ChSqcF5t.js';
5
5
  import '../predicate-BmhBSPCH.js';
@@ -7,6 +7,7 @@ import "../chunk-A7DNZVAV.js";
7
7
  import {
8
8
  SnapshotNotFoundError
9
9
  } from "../chunk-JZ5DS4DP.js";
10
+ import "../chunk-PZ5AY32C.js";
10
11
 
11
12
  // src/snapshots/engine.ts
12
13
  var SnapshotEngine = class {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/snapshots/engine.ts","../../src/snapshots/active.ts"],"sourcesContent":["import { writeNoydbBundle, readNoydbBundle } from '../bundle/bundle.js'\nimport { SnapshotNotFoundError } from '../errors.js'\nimport type { NoydbBundleStore } from '../types.js'\nimport type { Vault } from '../vault.js'\nimport type { SnapshotMeta, RetentionPolicy, SnapshotIndex } from './strategy.js'\n\nexport class SnapshotEngine {\n constructor(\n private readonly store: NoydbBundleStore,\n private readonly retention: RetentionPolicy,\n ) {}\n\n private indexKey(vaultName: string): string {\n return `${vaultName}__index`\n }\n\n private snapKey(vaultName: string, n: number): string {\n return `${vaultName}__snap_${n.toString().padStart(6, '0')}`\n }\n\n private autoKey(vaultName: string): string {\n return `${vaultName}__auto`\n }\n\n private async readIndex(\n vaultName: string,\n ): Promise<{ index: SnapshotIndex; indexVersion: string | null }> {\n const result = await this.store.readBundle(this.indexKey(vaultName))\n if (!result) return { index: { snapshots: [], nextCounter: 1 }, indexVersion: null }\n const text = new TextDecoder().decode(result.bytes)\n return { index: JSON.parse(text) as SnapshotIndex, indexVersion: result.version }\n }\n\n private async writeIndex(\n vaultName: string,\n index: SnapshotIndex,\n expectedVersion: string | null,\n ): Promise<void> {\n const bytes = new TextEncoder().encode(JSON.stringify(index))\n await this.store.writeBundle(this.indexKey(vaultName), bytes, expectedVersion)\n }\n\n async snapshot(\n vault: Vault,\n by: string,\n opts?: { label?: string; note?: string },\n ): Promise<SnapshotMeta> {\n const bytes = await writeNoydbBundle(vault, {})\n const { index, indexVersion } = await this.readIndex(vault.name)\n const key = this.snapKey(vault.name, index.nextCounter)\n\n // Write blob first. If the subsequent index write fails, the next snapshot()\n // call will re-derive the same key (counter not persisted) and overwrite this blob.\n // This is an accepted v1 trade-off: failure window is narrow and requires a store\n // error between the two writes. A retry produces a fresh snapshot at the same key.\n await this.store.writeBundle(key, bytes, null)\n\n const meta: SnapshotMeta = {\n version: key,\n ...(opts?.label !== undefined ? { label: opts.label } : {}),\n ...(opts?.note !== undefined ? { note: opts.note } : {}),\n exportedAt: new Date().toISOString(),\n exportedBy: by,\n size: bytes.length,\n integrity: 'verified',\n }\n\n const newIndex: SnapshotIndex = {\n snapshots: [...index.snapshots, meta],\n nextCounter: index.nextCounter + 1,\n // Preserve the rolling auto slot — on-demand snapshots never touch it.\n ...(index.auto ? { auto: index.auto } : {}),\n }\n const toDelete = this.applyRetention(newIndex)\n await this.writeIndex(vault.name, newIndex, indexVersion)\n\n for (const k of toDelete) {\n await this.store.deleteBundle(k)\n }\n\n return meta\n }\n\n /**\n * Rolling auto-snapshot. Overwrites the single fixed `<vault>__auto` key and\n * stores its meta in `index.auto`, separate from the immutable `snapshots`\n * pool — retention never prunes it. Used by the cadence scheduler.\n */\n async autoSnapshot(\n vault: Vault,\n by: string,\n opts?: { label?: string; note?: string },\n ): Promise<SnapshotMeta> {\n const bytes = await writeNoydbBundle(vault, {})\n const { index, indexVersion } = await this.readIndex(vault.name)\n const key = this.autoKey(vault.name)\n\n // Unconditional overwrite of the rolling slot.\n await this.store.writeBundle(key, bytes, null)\n\n const meta: SnapshotMeta = {\n version: key,\n label: opts?.label ?? 'auto',\n ...(opts?.note !== undefined ? { note: opts.note } : {}),\n exportedAt: new Date().toISOString(),\n exportedBy: by,\n size: bytes.length,\n integrity: 'verified',\n auto: true,\n }\n\n index.auto = meta\n await this.writeIndex(vault.name, index, indexVersion)\n return meta\n }\n\n async listSnapshots(vaultId: string): Promise<SnapshotMeta[]> {\n const { index } = await this.readIndex(vaultId)\n const immutable = [...index.snapshots].reverse()\n return index.auto ? [index.auto, ...immutable] : immutable\n }\n\n async restoreSnapshot(vault: Vault, version: string): Promise<void> {\n if (!version.startsWith(`${vault.name}__`)) throw new SnapshotNotFoundError(version)\n const result = await this.store.readBundle(version)\n if (!result) throw new SnapshotNotFoundError(version)\n const { dumpJson } = await readNoydbBundle(result.bytes)\n await vault.load(dumpJson)\n }\n\n /**\n * Applies the configured retention policy to `index`, mutating `index.snapshots`\n * in place and returning the blob keys that should be deleted from the store.\n * Called by `snapshot()` before the index is written.\n *\n * @internal — public for direct testing only\n */\n applyRetention(index: SnapshotIndex): string[] {\n const prune = this.retention.prune ?? true\n if (!prune) return []\n\n const toDelete: string[] = []\n let remaining = index.snapshots.slice()\n\n if (this.retention.keepLast !== undefined && remaining.length > this.retention.keepLast) {\n const excess = remaining.splice(0, remaining.length - this.retention.keepLast)\n toDelete.push(...excess.map(m => m.version))\n }\n\n if (this.retention.maxAgeDays !== undefined) {\n const cutoffMs = this.retention.maxAgeDays * 86_400_000\n const now = Date.now()\n const fresh = remaining.filter(m => now - new Date(m.exportedAt).getTime() <= cutoffMs)\n toDelete.push(...remaining.filter(m => !fresh.includes(m)).map(m => m.version))\n remaining = fresh\n }\n\n index.snapshots = remaining\n return toDelete\n }\n}\n","import { SnapshotEngine } from './engine.js'\nimport type { SnapshotStrategy, RetentionPolicy } from './strategy.js'\nimport type { SnapshotPolicy } from './policy.js'\nimport type { NoydbBundleStore } from '../types.js'\nimport type { Vault } from '../vault.js'\n\nexport interface WithSnapshotsOptions {\n /** Bundle store where snapshot blobs and the sidecar index are written. */\n store: NoydbBundleStore\n /**\n * Declarative retention policy. Enforced eagerly after each on-demand `snapshot()`.\n * Defaults to no retention (all on-demand snapshots kept forever). Never affects\n * the rolling auto-snapshot.\n */\n retention?: RetentionPolicy\n /**\n * Automatic-snapshot cadence. Default `mode:'manual'` ⇒ no timers; snapshots\n * stay on-demand. Set `mode:'debounce'`/`'interval'` to enable auto-snapshots\n * to the rolling `<vault>__auto` key.\n */\n snapshotPolicy?: SnapshotPolicy\n}\n\nexport function withSnapshots(opts: WithSnapshotsOptions): SnapshotStrategy {\n const engine = new SnapshotEngine(opts.store, opts.retention ?? {})\n return {\n snapshot(vault, by, snapOpts) {\n return engine.snapshot(vault as Vault, by, snapOpts)\n },\n listSnapshots(vaultId) {\n return engine.listSnapshots(vaultId)\n },\n restoreSnapshot(vault, version) {\n return engine.restoreSnapshot(vault as Vault, version)\n },\n autoSnapshot(vault, by, snapOpts) {\n return engine.autoSnapshot(vault as Vault, by, snapOpts)\n },\n ...(opts.snapshotPolicy ? { policy: opts.snapshotPolicy } : {}),\n }\n}\n"],"mappings":";;;;;;;;;;;AAMO,IAAM,iBAAN,MAAqB;AAAA,EAC1B,YACmB,OACA,WACjB;AAFiB;AACA;AAAA,EAChB;AAAA,EAFgB;AAAA,EACA;AAAA,EAGX,SAAS,WAA2B;AAC1C,WAAO,GAAG,SAAS;AAAA,EACrB;AAAA,EAEQ,QAAQ,WAAmB,GAAmB;AACpD,WAAO,GAAG,SAAS,UAAU,EAAE,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC;AAAA,EAC5D;AAAA,EAEQ,QAAQ,WAA2B;AACzC,WAAO,GAAG,SAAS;AAAA,EACrB;AAAA,EAEA,MAAc,UACZ,WACgE;AAChE,UAAM,SAAS,MAAM,KAAK,MAAM,WAAW,KAAK,SAAS,SAAS,CAAC;AACnE,QAAI,CAAC,OAAQ,QAAO,EAAE,OAAO,EAAE,WAAW,CAAC,GAAG,aAAa,EAAE,GAAG,cAAc,KAAK;AACnF,UAAM,OAAO,IAAI,YAAY,EAAE,OAAO,OAAO,KAAK;AAClD,WAAO,EAAE,OAAO,KAAK,MAAM,IAAI,GAAoB,cAAc,OAAO,QAAQ;AAAA,EAClF;AAAA,EAEA,MAAc,WACZ,WACA,OACA,iBACe;AACf,UAAM,QAAQ,IAAI,YAAY,EAAE,OAAO,KAAK,UAAU,KAAK,CAAC;AAC5D,UAAM,KAAK,MAAM,YAAY,KAAK,SAAS,SAAS,GAAG,OAAO,eAAe;AAAA,EAC/E;AAAA,EAEA,MAAM,SACJ,OACA,IACA,MACuB;AACvB,UAAM,QAAQ,MAAM,iBAAiB,OAAO,CAAC,CAAC;AAC9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W;AAC3C,YAAM,WAAW,KAAK,UAAU,aAAa;AAC7C,YAAM,MAAM,KAAK,IAAI;AACrB,YAAM,QAAQ,UAAU,OAAO,OAAK,MAAM,IAAI,KAAK,EAAE,UAAU,EAAE,QAAQ,KAAK,QAAQ;AACtF,eAAS,KAAK,GAAG,UAAU,OAAO,OAAK,CAAC,MAAM,SAAS,CAAC,CAAC,EAAE,IAAI,OAAK,EAAE,OAAO,CAAC;AAC9E,kBAAY;AAAA,IACd;AAEA,UAAM,YAAY;AAClB,WAAO;AAAA,EACT;AACF;;;ACzIO,SAAS,cAAc,MAA8C;AAC1E,QAAM,SAAS,IAAI,eAAe,KAAK,OAAO,KAAK,aAAa,CAAC,CAAC;AAClE,SAAO;AAAA,IACL,SAAS,OAAO,IAAI,UAAU;AAC5B,aAAO,OAAO,SAAS,OAAgB,IAAI,QAAQ;AAAA,IACrD;AAAA,IACA,cAAc,SAAS;AACrB,aAAO,OAAO,cAAc,OAAO;AAAA,IACrC;AAAA,IACA,gBAAgB,OAAO,SAAS;AAC9B,aAAO,OAAO,gBAAgB,OAAgB,OAAO;AAAA,IACvD;AAAA,IACA,aAAa,OAAO,IAAI,UAAU;AAChC,aAAO,OAAO,aAAa,OAAgB,IAAI,QAAQ;AAAA,IACzD;AAAA,IACA,GAAI,KAAK,iBAAiB,EAAE,QAAQ,KAAK,eAAe,IAAI,CAAC;AAAA,EAC/D;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/snapshots/engine.ts","../../src/snapshots/active.ts"],"sourcesContent":["import { writeNoydbBundle, readNoydbBundle } from '../bundle/bundle.js'\nimport { SnapshotNotFoundError } from '../errors.js'\nimport type { NoydbBundleStore } from '../types.js'\nimport type { Vault } from '../vault.js'\nimport type { SnapshotMeta, RetentionPolicy, SnapshotIndex } from './strategy.js'\n\nexport class SnapshotEngine {\n constructor(\n private readonly store: NoydbBundleStore,\n private readonly retention: RetentionPolicy,\n ) {}\n\n private indexKey(vaultName: string): string {\n return `${vaultName}__index`\n }\n\n private snapKey(vaultName: string, n: number): string {\n return `${vaultName}__snap_${n.toString().padStart(6, '0')}`\n }\n\n private autoKey(vaultName: string): string {\n return `${vaultName}__auto`\n }\n\n private async readIndex(\n vaultName: string,\n ): Promise<{ index: SnapshotIndex; indexVersion: string | null }> {\n const result = await this.store.readBundle(this.indexKey(vaultName))\n if (!result) return { index: { snapshots: [], nextCounter: 1 }, indexVersion: null }\n const text = new TextDecoder().decode(result.bytes)\n return { index: JSON.parse(text) as SnapshotIndex, indexVersion: result.version }\n }\n\n private async writeIndex(\n vaultName: string,\n index: SnapshotIndex,\n expectedVersion: string | null,\n ): Promise<void> {\n const bytes = new TextEncoder().encode(JSON.stringify(index))\n await this.store.writeBundle(this.indexKey(vaultName), bytes, expectedVersion)\n }\n\n async snapshot(\n vault: Vault,\n by: string,\n opts?: { label?: string; note?: string },\n ): Promise<SnapshotMeta> {\n const bytes = await writeNoydbBundle(vault, {})\n const { index, indexVersion } = await this.readIndex(vault.name)\n const key = this.snapKey(vault.name, index.nextCounter)\n\n // Write blob first. If the subsequent index write fails, the next snapshot()\n // call will re-derive the same key (counter not persisted) and overwrite this blob.\n // This is an accepted v1 trade-off: failure window is narrow and requires a store\n // error between the two writes. A retry produces a fresh snapshot at the same key.\n await this.store.writeBundle(key, bytes, null)\n\n const meta: SnapshotMeta = {\n version: key,\n ...(opts?.label !== undefined ? { label: opts.label } : {}),\n ...(opts?.note !== undefined ? { note: opts.note } : {}),\n exportedAt: new Date().toISOString(),\n exportedBy: by,\n size: bytes.length,\n integrity: 'verified',\n }\n\n const newIndex: SnapshotIndex = {\n snapshots: [...index.snapshots, meta],\n nextCounter: index.nextCounter + 1,\n // Preserve the rolling auto slot — on-demand snapshots never touch it.\n ...(index.auto ? { auto: index.auto } : {}),\n }\n const toDelete = this.applyRetention(newIndex)\n await this.writeIndex(vault.name, newIndex, indexVersion)\n\n for (const k of toDelete) {\n await this.store.deleteBundle(k)\n }\n\n return meta\n }\n\n /**\n * Rolling auto-snapshot. Overwrites the single fixed `<vault>__auto` key and\n * stores its meta in `index.auto`, separate from the immutable `snapshots`\n * pool — retention never prunes it. Used by the cadence scheduler.\n */\n async autoSnapshot(\n vault: Vault,\n by: string,\n opts?: { label?: string; note?: string },\n ): Promise<SnapshotMeta> {\n const bytes = await writeNoydbBundle(vault, {})\n const { index, indexVersion } = await this.readIndex(vault.name)\n const key = this.autoKey(vault.name)\n\n // Unconditional overwrite of the rolling slot.\n await this.store.writeBundle(key, bytes, null)\n\n const meta: SnapshotMeta = {\n version: key,\n label: opts?.label ?? 'auto',\n ...(opts?.note !== undefined ? { note: opts.note } : {}),\n exportedAt: new Date().toISOString(),\n exportedBy: by,\n size: bytes.length,\n integrity: 'verified',\n auto: true,\n }\n\n index.auto = meta\n await this.writeIndex(vault.name, index, indexVersion)\n return meta\n }\n\n async listSnapshots(vaultId: string): Promise<SnapshotMeta[]> {\n const { index } = await this.readIndex(vaultId)\n const immutable = [...index.snapshots].reverse()\n return index.auto ? [index.auto, ...immutable] : immutable\n }\n\n async restoreSnapshot(vault: Vault, version: string): Promise<void> {\n if (!version.startsWith(`${vault.name}__`)) throw new SnapshotNotFoundError(version)\n const result = await this.store.readBundle(version)\n if (!result) throw new SnapshotNotFoundError(version)\n const { dumpJson } = await readNoydbBundle(result.bytes)\n await vault.load(dumpJson)\n }\n\n /**\n * Applies the configured retention policy to `index`, mutating `index.snapshots`\n * in place and returning the blob keys that should be deleted from the store.\n * Called by `snapshot()` before the index is written.\n *\n * @internal — public for direct testing only\n */\n applyRetention(index: SnapshotIndex): string[] {\n const prune = this.retention.prune ?? true\n if (!prune) return []\n\n const toDelete: string[] = []\n let remaining = index.snapshots.slice()\n\n if (this.retention.keepLast !== undefined && remaining.length > this.retention.keepLast) {\n const excess = remaining.splice(0, remaining.length - this.retention.keepLast)\n toDelete.push(...excess.map(m => m.version))\n }\n\n if (this.retention.maxAgeDays !== undefined) {\n const cutoffMs = this.retention.maxAgeDays * 86_400_000\n const now = Date.now()\n const fresh = remaining.filter(m => now - new Date(m.exportedAt).getTime() <= cutoffMs)\n toDelete.push(...remaining.filter(m => !fresh.includes(m)).map(m => m.version))\n remaining = fresh\n }\n\n index.snapshots = remaining\n return toDelete\n }\n}\n","import { SnapshotEngine } from './engine.js'\nimport type { SnapshotStrategy, RetentionPolicy } from './strategy.js'\nimport type { SnapshotPolicy } from './policy.js'\nimport type { NoydbBundleStore } from '../types.js'\nimport type { Vault } from '../vault.js'\n\nexport interface WithSnapshotsOptions {\n /** Bundle store where snapshot blobs and the sidecar index are written. */\n store: NoydbBundleStore\n /**\n * Declarative retention policy. Enforced eagerly after each on-demand `snapshot()`.\n * Defaults to no retention (all on-demand snapshots kept forever). Never affects\n * the rolling auto-snapshot.\n */\n retention?: RetentionPolicy\n /**\n * Automatic-snapshot cadence. Default `mode:'manual'` ⇒ no timers; snapshots\n * stay on-demand. Set `mode:'debounce'`/`'interval'` to enable auto-snapshots\n * to the rolling `<vault>__auto` key.\n */\n snapshotPolicy?: SnapshotPolicy\n}\n\nexport function withSnapshots(opts: WithSnapshotsOptions): SnapshotStrategy {\n const engine = new SnapshotEngine(opts.store, opts.retention ?? {})\n return {\n snapshot(vault, by, snapOpts) {\n return engine.snapshot(vault as Vault, by, snapOpts)\n },\n listSnapshots(vaultId) {\n return engine.listSnapshots(vaultId)\n },\n restoreSnapshot(vault, version) {\n return engine.restoreSnapshot(vault as Vault, version)\n },\n autoSnapshot(vault, by, snapOpts) {\n return engine.autoSnapshot(vault as Vault, by, snapOpts)\n },\n ...(opts.snapshotPolicy ? { policy: opts.snapshotPolicy } : {}),\n }\n}\n"],"mappings":";;;;;;;;;;;;AAMO,IAAM,iBAAN,MAAqB;AAAA,EAC1B,YACmB,OACA,WACjB;AAFiB;AACA;AAAA,EAChB;AAAA,EAFgB;AAAA,EACA;AAAA,EAGX,SAAS,WAA2B;AAC1C,WAAO,GAAG,SAAS;AAAA,EACrB;AAAA,EAEQ,QAAQ,WAAmB,GAAmB;AACpD,WAAO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AAU;AAC5B,aAAO,OAAO,SAAS,OAAgB,IAAI,QAAQ;AAAA,IACrD;AAAA,IACA,cAAc,SAAS;AACrB,aAAO,OAAO,cAAc,OAAO;AAAA,IACrC;AAAA,IACA,gBAAgB,OAAO,SAAS;AAC9B,aAAO,OAAO,gBAAgB,OAAgB,OAAO;AAAA,IACvD;AAAA,IACA,aAAa,OAAO,IAAI,UAAU;AAChC,aAAO,OAAO,aAAa,OAAgB,IAAI,QAAQ;AAAA,IACzD;AAAA,IACA,GAAI,KAAK,iBAAiB,EAAE,QAAQ,KAAK,eAAe,IAAI,CAAC;AAAA,EAC/D;AACF;","names":[]}
@@ -3,11 +3,12 @@ import {
3
3
  isMVStale,
4
4
  markMVStale,
5
5
  resolveStaleMVOnRead
6
- } from "./chunk-DJO4OYCJ.js";
6
+ } from "./chunk-33EQCZXE.js";
7
+ import "./chunk-PZ5AY32C.js";
7
8
  export {
8
9
  clearMVStale,
9
10
  isMVStale,
10
11
  markMVStale,
11
12
  resolveStaleMVOnRead
12
13
  };
13
- //# sourceMappingURL=stale-IIIGOHBW.js.map
14
+ //# sourceMappingURL=stale-J3TUF5C5.js.map
@@ -1,5 +1,5 @@
1
- import { aW as NoydbStore, aw as NoydbBundleStore } from '../types-Ba1vQ3AY.cjs';
2
- export { bL as BUNDLE_STORE_POLICY, cD as INDEXED_STORE_POLICY, dz as PullMode, dB as PullPolicy, dD as PushMode, dF as PushPolicy, er as SyncPolicy, es as SyncScheduler, et as SyncSchedulerStatus } from '../types-Ba1vQ3AY.cjs';
1
+ import { aW as NoydbStore, aw as NoydbBundleStore } from '../types-CdVfiQgt.cjs';
2
+ export { bL as BUNDLE_STORE_POLICY, cJ as INDEXED_STORE_POLICY, dF as PullMode, dH as PullPolicy, dJ as PushMode, dL as PushPolicy, ey as SyncPolicy, ez as SyncScheduler, eA as SyncSchedulerStatus } from '../types-CdVfiQgt.cjs';
3
3
  export { aC as StoreCapabilityError } from '../errors-BAWO5Z5a.cjs';
4
4
  import '../lazy-builder-eYZzLEL1.cjs';
5
5
  import '../predicate-BmhBSPCH.cjs';
@@ -1,5 +1,5 @@
1
- import { aW as NoydbStore, aw as NoydbBundleStore } from '../types-CUmZYJwN.js';
2
- export { bL as BUNDLE_STORE_POLICY, cD as INDEXED_STORE_POLICY, dz as PullMode, dB as PullPolicy, dD as PushMode, dF as PushPolicy, er as SyncPolicy, es as SyncScheduler, et as SyncSchedulerStatus } from '../types-CUmZYJwN.js';
1
+ import { aW as NoydbStore, aw as NoydbBundleStore } from '../types-DHn9lEP0.js';
2
+ export { bL as BUNDLE_STORE_POLICY, cJ as INDEXED_STORE_POLICY, dF as PullMode, dH as PullPolicy, dJ as PushMode, dL as PushPolicy, ey as SyncPolicy, ez as SyncScheduler, eA as SyncSchedulerStatus } from '../types-DHn9lEP0.js';
3
3
  export { aC as StoreCapabilityError } from '../errors-BAWO5Z5a.js';
4
4
  import '../lazy-builder-ChSqcF5t.js';
5
5
  import '../predicate-BmhBSPCH.js';
@@ -18,6 +18,7 @@ import {
18
18
  import {
19
19
  StoreCapabilityError
20
20
  } from "../chunk-JZ5DS4DP.js";
21
+ import "../chunk-PZ5AY32C.js";
21
22
  export {
22
23
  BUNDLE_STORE_POLICY,
23
24
  INDEXED_STORE_POLICY,
@@ -1,4 +1,4 @@
1
- import { aS as SyncStrategy } from '../types-Ba1vQ3AY.cjs';
1
+ import { aS as SyncStrategy } from '../types-CdVfiQgt.cjs';
2
2
  import '../lazy-builder-eYZzLEL1.cjs';
3
3
  import '../predicate-BmhBSPCH.cjs';
4
4
  import '../strategy-mJExw4LQ.cjs';
@@ -1,4 +1,4 @@
1
- import { aS as SyncStrategy } from '../types-CUmZYJwN.js';
1
+ import { aS as SyncStrategy } from '../types-DHn9lEP0.js';
2
2
  import '../lazy-builder-ChSqcF5t.js';
3
3
  import '../predicate-BmhBSPCH.js';
4
4
  import '../strategy-8QGs5KQE.js';
@@ -7,6 +7,7 @@ import "../chunk-2QR2PQTT.js";
7
7
  import "../chunk-A7DNZVAV.js";
8
8
  import "../chunk-E2MDPPOC.js";
9
9
  import "../chunk-JZ5DS4DP.js";
10
+ import "../chunk-PZ5AY32C.js";
10
11
 
11
12
  // src/team/sync-active.ts
12
13
  function withSync() {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/team/sync-active.ts"],"sourcesContent":["/**\n * Active sync strategy — `withSync()` returns the real implementation\n * that wires the `SyncEngine`, `SyncTransaction`, and `PresenceHandle`\n * constructors into the Noydb / Vault / Collection hot paths.\n *\n * Consumers opt in by:\n *\n * ```ts\n * import { createNoydb } from '@noy-db/hub'\n * import { withSync } from '@noy-db/hub/sync'\n *\n * const db = await createNoydb({\n * store: localStore,\n * sync: remoteStore,\n * user: ...,\n * syncStrategy: withSync(),\n * })\n * ```\n *\n * The factory delegates to the existing `sync.ts`,\n * `sync-transaction.ts`, and `presence.ts` modules. Splitting the\n * import chain through this file is what lets tsup tree-shake the\n * ~856 LOC of replication + presence machinery out of the default\n * bundle when no `withSync()` import is present.\n *\n * Keyring + grant/revoke/magic-link/delegation stay in the always-on\n * core (or tree-shake via direct named imports) — those are required\n * for any multi-user vault, even purely local ones.\n *\n * @public\n */\n\nimport type { SyncStrategy, BuildSyncEngineOptions } from './sync-strategy.js'\nimport type { PresenceHandleOpts } from './presence.js'\nimport type { Vault } from '../vault.js'\nimport { SyncEngine } from './sync.js'\nimport { SyncTransaction } from './sync-transaction.js'\nimport { PresenceHandle } from './presence.js'\n\nexport function withSync(): SyncStrategy {\n return {\n buildSyncEngine(opts: BuildSyncEngineOptions): SyncEngine {\n return new SyncEngine(opts)\n },\n buildSyncTransaction(vault: Vault, engine: SyncEngine): SyncTransaction {\n return new SyncTransaction(vault, engine)\n },\n buildPresence<P>(opts: PresenceHandleOpts): PresenceHandle<P> {\n return new PresenceHandle<P>(opts)\n },\n }\n}\n"],"mappings":";;;;;;;;;;;AAuCO,SAAS,WAAyB;AACvC,SAAO;AAAA,IACL,gBAAgB,MAA0C;AACxD,aAAO,IAAI,WAAW,IAAI;AAAA,IAC5B;AAAA,IACA,qBAAqB,OAAc,QAAqC;AACtE,aAAO,IAAI,gBAAgB,OAAO,MAAM;AAAA,IAC1C;AAAA,IACA,cAAiB,MAA6C;AAC5D,aAAO,IAAI,eAAkB,IAAI;AAAA,IACnC;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/team/sync-active.ts"],"sourcesContent":["/**\n * Active sync strategy — `withSync()` returns the real implementation\n * that wires the `SyncEngine`, `SyncTransaction`, and `PresenceHandle`\n * constructors into the Noydb / Vault / Collection hot paths.\n *\n * Consumers opt in by:\n *\n * ```ts\n * import { createNoydb } from '@noy-db/hub'\n * import { withSync } from '@noy-db/hub/sync'\n *\n * const db = await createNoydb({\n * store: localStore,\n * sync: remoteStore,\n * user: ...,\n * syncStrategy: withSync(),\n * })\n * ```\n *\n * The factory delegates to the existing `sync.ts`,\n * `sync-transaction.ts`, and `presence.ts` modules. Splitting the\n * import chain through this file is what lets tsup tree-shake the\n * ~856 LOC of replication + presence machinery out of the default\n * bundle when no `withSync()` import is present.\n *\n * Keyring + grant/revoke/magic-link/delegation stay in the always-on\n * core (or tree-shake via direct named imports) — those are required\n * for any multi-user vault, even purely local ones.\n *\n * @public\n */\n\nimport type { SyncStrategy, BuildSyncEngineOptions } from './sync-strategy.js'\nimport type { PresenceHandleOpts } from './presence.js'\nimport type { Vault } from '../vault.js'\nimport { SyncEngine } from './sync.js'\nimport { SyncTransaction } from './sync-transaction.js'\nimport { PresenceHandle } from './presence.js'\n\nexport function withSync(): SyncStrategy {\n return {\n buildSyncEngine(opts: BuildSyncEngineOptions): SyncEngine {\n return new SyncEngine(opts)\n },\n buildSyncTransaction(vault: Vault, engine: SyncEngine): SyncTransaction {\n return new SyncTransaction(vault, engine)\n },\n buildPresence<P>(opts: PresenceHandleOpts): PresenceHandle<P> {\n return new PresenceHandle<P>(opts)\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;AAuCO,SAAS,WAAyB;AACvC,SAAO;AAAA,IACL,gBAAgB,MAA0C;AACxD,aAAO,IAAI,WAAW,IAAI;AAAA,IAC5B;AAAA,IACA,qBAAqB,OAAc,QAAqC;AACtE,aAAO,IAAI,gBAAgB,OAAO,MAAM;AAAA,IAC1C;AAAA,IACA,cAAiB,MAA6C;AAC5D,aAAO,IAAI,eAAkB,IAAI;AAAA,IACnC;AAAA,EACF;AACF;","names":[]}