@noy-db/hub 0.6.0-pre.15 → 0.6.0-pre.16

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 (208) hide show
  1. package/dist/{api-VRTBOCY7.js → api-NAY63UIE.js} +5 -5
  2. package/dist/attestation/index.js +11 -11
  3. package/dist/{backup-BXS6GNCA.js → backup-M2VND2VS.js} +12 -14
  4. package/dist/backup-M2VND2VS.js.map +1 -0
  5. package/dist/blobs/index.js +3 -3
  6. package/dist/broker/index.js +5 -5
  7. package/dist/cargo/index.js +17 -17
  8. package/dist/{chunk-X24QHSG5.js → chunk-343FH4S5.js} +3 -3
  9. package/dist/{chunk-6R4QXE43.js → chunk-35RIRCGW.js} +2 -2
  10. package/dist/{chunk-ESABIXMQ.js → chunk-3JQVA527.js} +2 -2
  11. package/dist/{chunk-PF3E6ABL.js → chunk-3OEWD45V.js} +4 -4
  12. package/dist/{chunk-5AV6FENP.js → chunk-4CSG6KBX.js} +2 -2
  13. package/dist/{chunk-MMXMJXAE.js → chunk-4DJQU3PH.js} +4 -4
  14. package/dist/{chunk-KNAZGJFG.js → chunk-4JDTLWUZ.js} +9 -9
  15. package/dist/{chunk-GWJNBTZA.js → chunk-4XEUSZWN.js} +2 -2
  16. package/dist/{chunk-62KVBIBU.js → chunk-53PWELSC.js} +2 -2
  17. package/dist/{chunk-AIR3LSJH.js → chunk-56W3T5O2.js} +12 -18
  18. package/dist/chunk-56W3T5O2.js.map +1 -0
  19. package/dist/{chunk-DU27P4LO.js → chunk-5CH4DWQA.js} +2 -2
  20. package/dist/{chunk-RQ5G2YER.js → chunk-5TF5DUQ5.js} +3 -3
  21. package/dist/chunk-6E2JZRBD.js +60 -0
  22. package/dist/chunk-6E2JZRBD.js.map +1 -0
  23. package/dist/{chunk-A5BGC3GR.js → chunk-6EF3N2MH.js} +20 -18
  24. package/dist/chunk-6EF3N2MH.js.map +1 -0
  25. package/dist/{chunk-WVS62P45.js → chunk-76FBDG6M.js} +3 -3
  26. package/dist/{chunk-SZZEDEIU.js → chunk-7LLKPODL.js} +1 -1
  27. package/dist/chunk-7LLKPODL.js.map +1 -0
  28. package/dist/{chunk-FINIMZ55.js → chunk-A3WHDOWI.js} +2 -2
  29. package/dist/{chunk-TWSFSH32.js → chunk-AD2PJGSS.js} +2 -2
  30. package/dist/{chunk-SX7MAZ5U.js → chunk-B4G3JPH5.js} +2 -2
  31. package/dist/{chunk-CJ4KXDD4.js → chunk-CZV57HHC.js} +2 -2
  32. package/dist/{chunk-PJ5TGJ7U.js → chunk-FZ2SSI5R.js} +2 -2
  33. package/dist/{chunk-6N5PZ6G5.js → chunk-H5U4T6JK.js} +3 -3
  34. package/dist/{chunk-6O3PVUYJ.js → chunk-HNX47VTC.js} +5 -5
  35. package/dist/{chunk-LAVPHX2V.js → chunk-IGE6XWKK.js} +3 -3
  36. package/dist/{chunk-PE6R44GS.js → chunk-IQGIPRSE.js} +4 -4
  37. package/dist/chunk-IQGIPRSE.js.map +1 -0
  38. package/dist/{chunk-YZGKXIYY.js → chunk-KKRFL5E2.js} +66 -67
  39. package/dist/chunk-KKRFL5E2.js.map +1 -0
  40. package/dist/{chunk-RERAMZK5.js → chunk-LJDW6LQJ.js} +2 -2
  41. package/dist/{chunk-PWJSO7HH.js → chunk-LTVETWDH.js} +38 -36
  42. package/dist/{chunk-PWJSO7HH.js.map → chunk-LTVETWDH.js.map} +1 -1
  43. package/dist/{chunk-ELHNLDXB.js → chunk-MKSTUVMJ.js} +14 -16
  44. package/dist/chunk-MKSTUVMJ.js.map +1 -0
  45. package/dist/{chunk-7F4TMKXC.js → chunk-MKV2KYRV.js} +2 -2
  46. package/dist/{chunk-ELA2THEC.js → chunk-NBLLQOMR.js} +3 -3
  47. package/dist/{chunk-BPT4W6CI.js → chunk-NY6RQBUN.js} +2 -2
  48. package/dist/{chunk-QVDK5AR7.js → chunk-OJEDR25M.js} +3 -3
  49. package/dist/{chunk-5CK7VSSK.js → chunk-OPGKH5RD.js} +3 -3
  50. package/dist/chunk-OPGKH5RD.js.map +1 -0
  51. package/dist/{chunk-UZ2J7OKF.js → chunk-PJGMBELR.js} +3 -3
  52. package/dist/{chunk-PNEV2TBR.js → chunk-PZLIA5R3.js} +2 -2
  53. package/dist/{chunk-4FNR5YZI.js → chunk-RRMXMJUP.js} +10 -10
  54. package/dist/chunk-RRMXMJUP.js.map +1 -0
  55. package/dist/{chunk-FBG62BUQ.js → chunk-T6CCRXD3.js} +8 -14
  56. package/dist/chunk-T6CCRXD3.js.map +1 -0
  57. package/dist/{chunk-T7XUDZ7N.js → chunk-THUITYH7.js} +2 -2
  58. package/dist/{chunk-TEJILTMY.js → chunk-TTAND7MR.js} +4 -4
  59. package/dist/{chunk-HAN2PHLM.js → chunk-TWPTRJEU.js} +2 -2
  60. package/dist/{chunk-WVCOS4XA.js → chunk-TY6N3PAC.js} +2 -2
  61. package/dist/{chunk-5LKPMDBC.js → chunk-UVFO25FJ.js} +3 -3
  62. package/dist/{chunk-KIZOCPHS.js → chunk-VUUUIKRG.js} +2 -2
  63. package/dist/{chunk-U26JILS3.js → chunk-WMZQCXZ5.js} +4 -4
  64. package/dist/{chunk-RLK57SMS.js → chunk-YX6J3Z3Z.js} +2 -2
  65. package/dist/classified/index.js +1 -1
  66. package/dist/{classified-marker-BCYBGITH.js → classified-marker-L7LXKS6Q.js} +3 -3
  67. package/dist/{collection-facade-YCJHWX64.js → collection-facade-KN3UFKZ4.js} +9 -9
  68. package/dist/consent/index.js +3 -3
  69. package/dist/custody/index.js +5 -5
  70. package/dist/{dead-filter-5ROD2DCQ.js → dead-filter-6HG5FP3I.js} +2 -2
  71. package/dist/{delegation-IULC56LW.js → delegation-7EGBYBRN.js} +3 -3
  72. package/dist/derivations/index.js +2 -2
  73. package/dist/{derive-AP2NXZDC.js → derive-XKAYJ2OA.js} +3 -3
  74. package/dist/directory/index.js +4 -4
  75. package/dist/{dispatch-Z6C35BGM.js → dispatch-56T7VPGE.js} +5 -5
  76. package/dist/{dispatch-4KKOMKWJ.js → dispatch-BM5GNCE2.js} +9 -9
  77. package/dist/{enclave-KJID436X.js → enclave-KDLGVX5Z.js} +5 -3
  78. package/dist/{executor-GD32BQQK.js → executor-LFHRV6JH.js} +9 -9
  79. package/dist/{export-accessible-H4Y2RTTD.js → export-accessible-HFBJ4JJY.js} +5 -5
  80. package/dist/{extract-partition-PIJZX4G4.js → extract-partition-7ZRFN6QP.js} +8 -8
  81. package/dist/{fanout-sidecar-6QGMG5MA.js → fanout-sidecar-MT2OBMZB.js} +3 -3
  82. package/dist/forget/index.js +3 -3
  83. package/dist/history/index.js +5 -5
  84. package/dist/i18n/index.js +7 -7
  85. package/dist/index.js +48 -50
  86. package/dist/index.js.map +1 -1
  87. package/dist/introspection/index.js +4 -4
  88. package/dist/{issue-Q6STVPV5.js → issue-LCOOEH45.js} +5 -5
  89. package/dist/kernel/enclave/index.d.ts +2 -0
  90. package/dist/kernel/enclave/record-envelope.d.ts +29 -0
  91. package/dist/kernel/enclave/record-keys/tombstone.d.ts +3 -2
  92. package/dist/{ledger-HLINHILR.js → ledger-6IHXJHDD.js} +5 -5
  93. package/dist/{liberate-C3XBBLYM.js → liberate-UEYC4QLJ.js} +9 -9
  94. package/dist/{link-set-S47JZWHV.js → link-set-XRVHGYWC.js} +4 -4
  95. package/dist/materialized-views/index.js +9 -9
  96. package/dist/{noydb-HT56GCTQ.js → noydb-M5WII7RP.js} +21 -21
  97. package/dist/periods/index.js +5 -5
  98. package/dist/pod/index.js +23 -23
  99. package/dist/{pod-handle-N6HQMAAV.js → pod-handle-BYUSBXCT.js} +15 -10
  100. package/dist/pod-handle-BYUSBXCT.js.map +1 -0
  101. package/dist/port/with/i18n-strategy.d.ts +4 -1
  102. package/dist/port/with/lookup-strategy.d.ts +4 -1
  103. package/dist/portability/index.js +6 -6
  104. package/dist/{post-register-KW557BUZ.js → post-register-O3YW6CGS.js} +4 -4
  105. package/dist/reduce/index.js +2 -2
  106. package/dist/{register-OMH3WVVL.js → register-XHOOX37G.js} +8 -8
  107. package/dist/{registry-ZE2OG4TN.js → registry-CYAFB35H.js} +3 -3
  108. package/dist/{registry-SAEOPHFF.js → registry-OFMM4WAC.js} +3 -3
  109. package/dist/{request-withdrawal-HTSROWCL.js → request-withdrawal-GCE2SLNW.js} +7 -7
  110. package/dist/{reveal-T4N65GUG.js → reveal-UHBP5IH3.js} +2 -2
  111. package/dist/{revoke-NE4CU2T3.js → revoke-6KY4VGZY.js} +5 -5
  112. package/dist/sealed-record/index.js +5 -5
  113. package/dist/search/index.js +2 -2
  114. package/dist/{seed-TC42KFUK.js → seed-DGLQTCIO.js} +5 -5
  115. package/dist/sequence/index.js +3 -3
  116. package/dist/session/index.js +2 -2
  117. package/dist/{signer-W2LX2FPA.js → signer-SLOMB6HS.js} +4 -4
  118. package/dist/snapshots/index.js +3 -3
  119. package/dist/{stale-WSC6Z7SB.js → stale-26ZJLNLG.js} +4 -4
  120. package/dist/{storage-EWT5HIX5.js → storage-N3IMFNGS.js} +4 -4
  121. package/dist/sync/index.js +3 -3
  122. package/dist/team/index.js +6 -6
  123. package/dist/tiers/index.js +3 -3
  124. package/dist/via/lookup/handle.d.ts +4 -1
  125. package/dist/{walk-OLQC4JFV.js → walk-B4YFJJ7S.js} +5 -5
  126. package/dist/with-commit/numbering/index.d.ts +0 -5
  127. package/dist/with-pod/pod-handle.d.ts +10 -0
  128. package/dist/{withdraw-accessible-Y7OEPWXM.js → withdraw-accessible-OYG7YZUR.js} +6 -6
  129. package/package.json +3 -3
  130. package/dist/backup-BXS6GNCA.js.map +0 -1
  131. package/dist/chunk-4FNR5YZI.js.map +0 -1
  132. package/dist/chunk-5CK7VSSK.js.map +0 -1
  133. package/dist/chunk-A5BGC3GR.js.map +0 -1
  134. package/dist/chunk-AIR3LSJH.js.map +0 -1
  135. package/dist/chunk-ELHNLDXB.js.map +0 -1
  136. package/dist/chunk-FBG62BUQ.js.map +0 -1
  137. package/dist/chunk-P3AFV6EA.js +0 -45
  138. package/dist/chunk-P3AFV6EA.js.map +0 -1
  139. package/dist/chunk-PE6R44GS.js.map +0 -1
  140. package/dist/chunk-SZZEDEIU.js.map +0 -1
  141. package/dist/chunk-YZGKXIYY.js.map +0 -1
  142. package/dist/pod-handle-N6HQMAAV.js.map +0 -1
  143. /package/dist/{api-VRTBOCY7.js.map → api-NAY63UIE.js.map} +0 -0
  144. /package/dist/{chunk-X24QHSG5.js.map → chunk-343FH4S5.js.map} +0 -0
  145. /package/dist/{chunk-6R4QXE43.js.map → chunk-35RIRCGW.js.map} +0 -0
  146. /package/dist/{chunk-ESABIXMQ.js.map → chunk-3JQVA527.js.map} +0 -0
  147. /package/dist/{chunk-PF3E6ABL.js.map → chunk-3OEWD45V.js.map} +0 -0
  148. /package/dist/{chunk-5AV6FENP.js.map → chunk-4CSG6KBX.js.map} +0 -0
  149. /package/dist/{chunk-MMXMJXAE.js.map → chunk-4DJQU3PH.js.map} +0 -0
  150. /package/dist/{chunk-KNAZGJFG.js.map → chunk-4JDTLWUZ.js.map} +0 -0
  151. /package/dist/{chunk-GWJNBTZA.js.map → chunk-4XEUSZWN.js.map} +0 -0
  152. /package/dist/{chunk-62KVBIBU.js.map → chunk-53PWELSC.js.map} +0 -0
  153. /package/dist/{chunk-DU27P4LO.js.map → chunk-5CH4DWQA.js.map} +0 -0
  154. /package/dist/{chunk-RQ5G2YER.js.map → chunk-5TF5DUQ5.js.map} +0 -0
  155. /package/dist/{chunk-WVS62P45.js.map → chunk-76FBDG6M.js.map} +0 -0
  156. /package/dist/{chunk-FINIMZ55.js.map → chunk-A3WHDOWI.js.map} +0 -0
  157. /package/dist/{chunk-TWSFSH32.js.map → chunk-AD2PJGSS.js.map} +0 -0
  158. /package/dist/{chunk-SX7MAZ5U.js.map → chunk-B4G3JPH5.js.map} +0 -0
  159. /package/dist/{chunk-CJ4KXDD4.js.map → chunk-CZV57HHC.js.map} +0 -0
  160. /package/dist/{chunk-PJ5TGJ7U.js.map → chunk-FZ2SSI5R.js.map} +0 -0
  161. /package/dist/{chunk-6N5PZ6G5.js.map → chunk-H5U4T6JK.js.map} +0 -0
  162. /package/dist/{chunk-6O3PVUYJ.js.map → chunk-HNX47VTC.js.map} +0 -0
  163. /package/dist/{chunk-LAVPHX2V.js.map → chunk-IGE6XWKK.js.map} +0 -0
  164. /package/dist/{chunk-RERAMZK5.js.map → chunk-LJDW6LQJ.js.map} +0 -0
  165. /package/dist/{chunk-7F4TMKXC.js.map → chunk-MKV2KYRV.js.map} +0 -0
  166. /package/dist/{chunk-ELA2THEC.js.map → chunk-NBLLQOMR.js.map} +0 -0
  167. /package/dist/{chunk-BPT4W6CI.js.map → chunk-NY6RQBUN.js.map} +0 -0
  168. /package/dist/{chunk-QVDK5AR7.js.map → chunk-OJEDR25M.js.map} +0 -0
  169. /package/dist/{chunk-UZ2J7OKF.js.map → chunk-PJGMBELR.js.map} +0 -0
  170. /package/dist/{chunk-PNEV2TBR.js.map → chunk-PZLIA5R3.js.map} +0 -0
  171. /package/dist/{chunk-T7XUDZ7N.js.map → chunk-THUITYH7.js.map} +0 -0
  172. /package/dist/{chunk-TEJILTMY.js.map → chunk-TTAND7MR.js.map} +0 -0
  173. /package/dist/{chunk-HAN2PHLM.js.map → chunk-TWPTRJEU.js.map} +0 -0
  174. /package/dist/{chunk-WVCOS4XA.js.map → chunk-TY6N3PAC.js.map} +0 -0
  175. /package/dist/{chunk-5LKPMDBC.js.map → chunk-UVFO25FJ.js.map} +0 -0
  176. /package/dist/{chunk-KIZOCPHS.js.map → chunk-VUUUIKRG.js.map} +0 -0
  177. /package/dist/{chunk-U26JILS3.js.map → chunk-WMZQCXZ5.js.map} +0 -0
  178. /package/dist/{chunk-RLK57SMS.js.map → chunk-YX6J3Z3Z.js.map} +0 -0
  179. /package/dist/{classified-marker-BCYBGITH.js.map → classified-marker-L7LXKS6Q.js.map} +0 -0
  180. /package/dist/{collection-facade-YCJHWX64.js.map → collection-facade-KN3UFKZ4.js.map} +0 -0
  181. /package/dist/{dead-filter-5ROD2DCQ.js.map → dead-filter-6HG5FP3I.js.map} +0 -0
  182. /package/dist/{delegation-IULC56LW.js.map → delegation-7EGBYBRN.js.map} +0 -0
  183. /package/dist/{derive-AP2NXZDC.js.map → derive-XKAYJ2OA.js.map} +0 -0
  184. /package/dist/{dispatch-Z6C35BGM.js.map → dispatch-56T7VPGE.js.map} +0 -0
  185. /package/dist/{dispatch-4KKOMKWJ.js.map → dispatch-BM5GNCE2.js.map} +0 -0
  186. /package/dist/{enclave-KJID436X.js.map → enclave-KDLGVX5Z.js.map} +0 -0
  187. /package/dist/{executor-GD32BQQK.js.map → executor-LFHRV6JH.js.map} +0 -0
  188. /package/dist/{export-accessible-H4Y2RTTD.js.map → export-accessible-HFBJ4JJY.js.map} +0 -0
  189. /package/dist/{extract-partition-PIJZX4G4.js.map → extract-partition-7ZRFN6QP.js.map} +0 -0
  190. /package/dist/{fanout-sidecar-6QGMG5MA.js.map → fanout-sidecar-MT2OBMZB.js.map} +0 -0
  191. /package/dist/{issue-Q6STVPV5.js.map → issue-LCOOEH45.js.map} +0 -0
  192. /package/dist/{ledger-HLINHILR.js.map → ledger-6IHXJHDD.js.map} +0 -0
  193. /package/dist/{liberate-C3XBBLYM.js.map → liberate-UEYC4QLJ.js.map} +0 -0
  194. /package/dist/{link-set-S47JZWHV.js.map → link-set-XRVHGYWC.js.map} +0 -0
  195. /package/dist/{noydb-HT56GCTQ.js.map → noydb-M5WII7RP.js.map} +0 -0
  196. /package/dist/{post-register-KW557BUZ.js.map → post-register-O3YW6CGS.js.map} +0 -0
  197. /package/dist/{register-OMH3WVVL.js.map → register-XHOOX37G.js.map} +0 -0
  198. /package/dist/{registry-SAEOPHFF.js.map → registry-CYAFB35H.js.map} +0 -0
  199. /package/dist/{registry-ZE2OG4TN.js.map → registry-OFMM4WAC.js.map} +0 -0
  200. /package/dist/{request-withdrawal-HTSROWCL.js.map → request-withdrawal-GCE2SLNW.js.map} +0 -0
  201. /package/dist/{reveal-T4N65GUG.js.map → reveal-UHBP5IH3.js.map} +0 -0
  202. /package/dist/{revoke-NE4CU2T3.js.map → revoke-6KY4VGZY.js.map} +0 -0
  203. /package/dist/{seed-TC42KFUK.js.map → seed-DGLQTCIO.js.map} +0 -0
  204. /package/dist/{signer-W2LX2FPA.js.map → signer-SLOMB6HS.js.map} +0 -0
  205. /package/dist/{stale-WSC6Z7SB.js.map → stale-26ZJLNLG.js.map} +0 -0
  206. /package/dist/{storage-EWT5HIX5.js.map → storage-N3IMFNGS.js.map} +0 -0
  207. /package/dist/{walk-OLQC4JFV.js.map → walk-B4YFJJ7S.js.map} +0 -0
  208. /package/dist/{withdraw-accessible-Y7OEPWXM.js.map → withdraw-accessible-OYG7YZUR.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-commit/sequence/active.ts","../src/with-commit/sequence/strategy.ts","../src/with-commit/sequence/index.ts"],"sourcesContent":["/**\n * Enable the atomic-sequence capability.\n * Pass to `createNoydb({ sequenceStrategy: withSequence() })` to make\n * `vault.sequence('name').next()` / `.peek()` / `.seedTo()` live. The\n * {@link SequenceStore} CAS engine is statically imported here, so it is pulled\n * into the bundle only when `withSequence()` is referenced (the floor never\n * imports it).\n */\nimport type { SequenceStrategy } from './strategy.js'\nimport { SequenceStore } from './index.js'\n\nexport function withSequence(): SequenceStrategy {\n return {\n createStore(opts) {\n return new SequenceStore(opts)\n },\n }\n}\n","/**\n * Sequence capability strategy — the single on-demand factory the vault routes\n * `vault.sequence()` through to build its atomic-CAS {@link SequenceStore}. The\n * active engine ({@link withSequence}) constructs the real store (kept out of\n * the floor bundle — the store class is reached only via the opt-in\n * `active.ts` chunk); {@link NO_SEQUENCE} throws. The vault always assembles the\n * per-call {@link SequenceStoreOptions} and delegates here, so an un-opted-in\n * caller hits `NO_SEQUENCE`'s throw at `vault.sequence()`.\n *\n * Note: `vault.sequence()` is synchronous, so the factory is a plain (sync)\n * constructor — the engine is tree-shaken by reachability (only `withSequence()`\n * pulls `active.ts`, which statically imports the store), not by a dynamic\n * import. Deferred-numbering series (`withDeferredNumbering`) are a distinct\n * capability and are NOT routed through this strategy.\n * @internal\n */\nimport type { SequenceStore, SequenceStoreOptions } from './index.js'\nimport { SequenceNotEnabledError } from '../../kernel/errors.js'\n\nexport interface SequenceStrategy {\n createStore(opts: SequenceStoreOptions): SequenceStore\n}\n\n/**\n * No-op stub — the floor default. The capability factory throws\n * {@link SequenceNotEnabledError}; opt in with `sequenceStrategy: withSequence()`\n * in createNoydb. @internal\n */\nexport const NO_SEQUENCE: SequenceStrategy = {\n createStore(): SequenceStore {\n throw new SequenceNotEnabledError()\n },\n}\n","/**\n * Atomic sequence primitive — online-coordinated gap-free numbering.\n *\n * `vault.sequence('invoice-2026').next()` returns 1, 2, 3, … with no\n * gaps and no duplicates, even under concurrent callers. Each named\n * sequence is an independent counter record at `_sequences/<name>`,\n * incremented with an optimistic compare-and-swap retry loop — the same\n * proven pattern as the ledger head (`history/ledger/store.ts`).\n *\n * **Explicitly online-only.** Gap-free numbering requires single-authority\n * serialization, which an offline / non-CAS store cannot provide. `next()`\n * throws {@link SequenceOfflineError} unless the backing store advertises\n * `capabilities.casAtomic`. This is a deliberate, honest wall — an offline\n * writer cannot safely allocate a global sequence number.\n *\n * Note on \"gap-free\": the *sequence* is gap-free (each `next()` yields a\n * unique, +1 value). If a caller discards a value without using it, that\n * is a gap in *usage*, not in the sequence — assign each `next()` result\n * to its record in the same operation.\n */\n\nimport { buildRecordEnvelope } from '../../kernel/enclave/index.js'\nimport type { NoydbStore, EncryptedEnvelope } from '../../kernel/types.js'\nimport { encrypt, openEnvelopeJson, type EnclaveKey } from '../../kernel/enclave/index.js'\nimport type { ConflictError} from '../../kernel/errors.js';\nimport { isConflictError, SequenceContentionError, SequenceOfflineError, ValidationError } from '../../kernel/errors.js'\n\n// Capability opt-in seam (S4): `vault.sequence()` builds its CAS store through\n// the sequenceStrategy, so it throws SequenceNotEnabledError unless opted in.\nexport { withSequence } from './active.js'\nexport { NO_SEQUENCE, type SequenceStrategy } from './strategy.js'\nexport { SequenceNotEnabledError } from '../../kernel/errors.js'\n\nexport const SEQUENCE_COLLECTION = '_sequences'\n// A sequence is a single hot CAS row — higher contention than a ledger\n// append. A larger budget + jittered backoff absorbs moderate concurrency;\n// a genuine burst beyond this surfaces SequenceContentionError so the\n// caller can retry / queue (the honest online-only contract).\nconst MAX_NEXT_ATTEMPTS = 16\n\ninterface SequenceState {\n value: number\n}\n\n/** Options for `SequenceHandle.next`. Deferred-numbering series use `for`; the CAS counter ignores all of these. */\nexport interface NextOptions {\n /** Deferred mode: the record id to number. Ignored by the CAS counter. */\n readonly for?: string\n /** Deferred mode: reject after this many ms if still unsealed (reserved; not yet enforced in this slice). */\n readonly timeoutMs?: number\n}\n\n/**\n * Partitioning for a CAS sequence. A partitioned sequence is an\n * independent counter scoped to one tuple of values — e.g.\n * `sequence('invoice', { partition: [2026, 'EU'] })` numbers EU-2026 invoices\n * separately from `[2026, 'US']` and from the bare `invoice` series.\n *\n * Partition components are URI-encoded (so `/`, null bytes and other\n * separators in a value can never collide with the structural separators) and\n * `'/'`-joined, then appended to the series with a null-byte (`\\x00`)\n * separator. The null byte is illegal in a plain series name, which guarantees\n * a partitioned key is always disjoint from any unpartitioned series.\n */\nexport interface SequenceOptions {\n /** Partition tuple. Each component is URI-encoded and `'/'`-joined. */\n readonly partition?: readonly (string | number)[]\n /**\n * Render template for the serial string. When set, `vault.sequence`\n * returns a {@link FormattedSequenceHandle} whose `next()` resolves to\n * `{ serial, formatted }`. Tokens:\n * - `{seq}` — the allocated integer\n * - `{seq:0N}` — zero-padded to width N (e.g. `{seq:04}` → `0001`)\n * - `{partition.i}` — the i-th `partition` component (original value)\n *\n * Any other token, or a `{partition.i}` index beyond the supplied\n * `partition`, throws `ValidationError` at `vault.sequence()` construction.\n * Per-partition reset is inherent: a new partition tuple starts at 1.\n */\n readonly format?: string\n}\n\n/**\n * A formatted sequence handle. Identical to {@link SequenceHandle}\n * except `next()` also returns the rendered `formatted` string. `peek()` /\n * `seedTo()` operate on the underlying integer counter, unchanged.\n */\nexport interface FormattedSequenceHandle {\n /** Allocate the next value and return it with its rendered serial string. */\n next(opts?: NextOptions): Promise<{ serial: number; formatted: string }>\n /** Read the current integer value without allocating. Returns 0 if never used. */\n peek(): Promise<number>\n /** Set-if-greater on the underlying integer counter. See {@link SequenceHandle.seedTo}. */\n seedTo(n: number): Promise<void>\n}\n\n// Matches a single `{...}` token with no nested braces.\nconst SEQ_FORMAT_TOKEN = /\\{([^{}]*)\\}/g\nconst SEQ_PAD_TOKEN = /^seq:0(\\d+)$/\nconst SEQ_PARTITION_TOKEN = /^partition\\.(\\d+)$/\n\n/**\n * Validate a sequence `format` against the supplied partition and return a\n * pure `(serial) => string` renderer. Eager validation: every token is\n * checked now, so a bad pattern throws `ValidationError` at construction —\n * never at `next()` time.\n */\nexport function compileSequenceFormat(\n format: string,\n series: string,\n partition: readonly (string | number)[] | undefined,\n): (serial: number) => string {\n const parts = partition ?? []\n for (const m of format.matchAll(SEQ_FORMAT_TOKEN)) {\n const token = m[1] ?? ''\n if (token === 'seq') continue\n if (SEQ_PAD_TOKEN.test(token)) continue\n const partMatch = SEQ_PARTITION_TOKEN.exec(token)\n if (partMatch) {\n const idx = Number(partMatch[1])\n if (idx >= parts.length) {\n throw new ValidationError(\n `sequence(\"${series}\"): format token \"{${token}}\" references partition index ${idx}, ` +\n `but only ${parts.length} partition component(s) were supplied.`,\n )\n }\n continue\n }\n throw new ValidationError(\n `sequence(\"${series}\"): format contains unknown token \"{${token}}\". ` +\n `Accepted tokens: {seq}, {seq:0N}, {partition.i}.`,\n )\n }\n return (serial: number): string =>\n format.replace(SEQ_FORMAT_TOKEN, (full, token: string) => {\n if (token === 'seq') return String(serial)\n const padMatch = SEQ_PAD_TOKEN.exec(token)\n if (padMatch) return String(serial).padStart(Number(padMatch[1]), '0')\n const partMatch = SEQ_PARTITION_TOKEN.exec(token)\n if (partMatch) return String(parts[Number(partMatch[1])])\n return full // unreachable — validated above\n })\n}\n\n/**\n * Resolve the CAS storage key for a (series, partition) pair.\n *\n * With no partition the key is `series` verbatim. With a partition the key is\n * `${series}\\x00${parts}` where `parts` is each component passed through\n * `encodeURIComponent(String(part))` and `'/'`-joined. The null-byte separator\n * is illegal in a plain series name, so partitioned keys never collide with\n * unpartitioned ones; URI-encoding keeps any component containing `/` distinct\n * from a multi-component partition.\n *\n * @throws {ValidationError} if any partition component is empty after `String()`\n * or is a non-finite number (`NaN`, `±Infinity`).\n */\nexport function resolveSequenceKey(series: string, opts?: SequenceOptions): string {\n const partition = opts?.partition\n if (!partition || partition.length === 0) return series\n const parts = partition.map((p) => {\n if (typeof p === 'number' && !Number.isFinite(p)) {\n throw new ValidationError(`sequence partition component must be a finite number, got ${p}`)\n }\n const s = String(p)\n if (s === '') {\n throw new ValidationError('sequence partition component must not be empty')\n }\n return encodeURIComponent(s)\n })\n return `${series}\\x00${parts.join('/')}`\n}\n\nexport interface SequenceHandle {\n /** Atomically allocate and return the next value (1, 2, 3, …). Deferred series resolve at the next pass. */\n next(opts?: NextOptions): Promise<number>\n /** Read the current value without allocating. Returns 0 if never used. */\n peek(): Promise<number>\n /**\n * Set-if-greater: advance the counter to at least `n`. A no-op if the\n * current value is already `>= n` (so it never rewinds), and `seedTo(0)` is\n * a no-op. Idempotent and CAS-safe under concurrent `next()` / `seedTo()`.\n *\n * Use after a bundle / CSV import to fast-forward the counter past the\n * highest imported serial, so subsequent `next()` calls cannot re-use a\n * number that is already on a record.\n *\n * Online-only: throws {@link SequenceOfflineError} on a non-CAS store.\n */\n seedTo(n: number): Promise<void>\n}\n\nasync function sleepBackoff(attempt: number): Promise<void> {\n // Exponential backoff with full jitter to break the thundering herd\n // when many writers contend on the same counter row.\n const ceil = Math.min(2 ** attempt, 32)\n const ms = Math.floor(Math.random() * ceil)\n await new Promise((r) => setTimeout(r, ms))\n}\n\n/** Per-call context the vault assembles to build a {@link SequenceStore}. */\nexport interface SequenceStoreOptions {\n adapter: NoydbStore\n vault: string\n encrypted: boolean\n getDEK: (collectionName: string) => Promise<EnclaveKey>\n actor: string\n}\n\nexport class SequenceStore {\n private readonly adapter: NoydbStore\n private readonly vault: string\n private readonly encrypted: boolean\n private readonly getDEK: (collectionName: string) => Promise<EnclaveKey>\n private readonly actor: string\n /**\n * Memoized DEK promise. The `_sequences` collection DEK is created on\n * first access; without sharing one promise, a burst of concurrent\n * `next()` calls would each trigger DEK creation and diverge (one\n * writer's ciphertext unreadable by another). One shared promise → one\n * DEK.\n */\n private dekPromise: Promise<EnclaveKey> | null = null\n\n constructor(opts: SequenceStoreOptions) {\n this.adapter = opts.adapter\n this.vault = opts.vault\n this.encrypted = opts.encrypted\n this.getDEK = opts.getDEK\n this.actor = opts.actor\n }\n\n /** A handle bound to one sequence name. */\n handle(name: string): SequenceHandle {\n return {\n next: () => this.next(name),\n peek: () => this.peek(name),\n seedTo: (n) => this.seedTo(name, n),\n }\n }\n\n private assertOnline(): void {\n if (this.adapter.capabilities?.casAtomic !== true) {\n throw new SequenceOfflineError()\n }\n }\n\n private dek(): Promise<EnclaveKey> {\n if (!this.dekPromise) this.dekPromise = this.getDEK(SEQUENCE_COLLECTION)\n return this.dekPromise\n }\n\n private async read(name: string): Promise<{ env: EncryptedEnvelope | null; value: number }> {\n const env = await this.adapter.get(this.vault, SEQUENCE_COLLECTION, name)\n if (!env) return { env: null, value: 0 }\n const json = this.encrypted ? await openEnvelopeJson(env, await this.dek()) : env._data\n const state = JSON.parse(json) as SequenceState\n return { env, value: state.value }\n }\n\n private async encryptState(name: string, state: SequenceState, version: number): Promise<EncryptedEnvelope> {\n const json = JSON.stringify(state)\n if (!this.encrypted) {\n return buildRecordEnvelope({ collection: SEQUENCE_COLLECTION, id: name }, { version, iv: '', data: json, by: this.actor })\n }\n const { iv, data } = await encrypt(json, await this.dek())\n return buildRecordEnvelope({ collection: SEQUENCE_COLLECTION, id: name }, { version, iv, data, by: this.actor })\n }\n\n async peek(name: string): Promise<number> {\n return (await this.read(name)).value\n }\n\n async next(name: string): Promise<number> {\n this.assertOnline()\n let lastConflict: ConflictError | undefined\n for (let attempt = 0; attempt < MAX_NEXT_ATTEMPTS; attempt++) {\n const { env, value } = await this.read(name)\n const nextValue = value + 1\n const expectedVersion = env?._v ?? 0 // 0 ≡ \"must not yet exist\" (create)\n const envelope = await this.encryptState(name, { value: nextValue }, expectedVersion + 1)\n try {\n await this.adapter.put(this.vault, SEQUENCE_COLLECTION, name, envelope, expectedVersion)\n return nextValue\n } catch (err) {\n if (isConflictError(err)) {\n lastConflict = err\n if (attempt < MAX_NEXT_ATTEMPTS - 1) await sleepBackoff(attempt)\n continue\n }\n throw err\n }\n }\n void lastConflict\n throw new SequenceContentionError(name, MAX_NEXT_ATTEMPTS)\n }\n\n async seedTo(name: string, n: number): Promise<void> {\n this.assertOnline()\n if (n <= 0) return // set-if-greater: 0 (and any non-positive seed) is a no-op\n let lastConflict: ConflictError | undefined\n for (let attempt = 0; attempt < MAX_NEXT_ATTEMPTS; attempt++) {\n const { env, value } = await this.read(name)\n if (value >= n) return // already at or past the floor — no write, idempotent\n const expectedVersion = env?._v ?? 0 // 0 ≡ \"must not yet exist\" (create)\n const envelope = await this.encryptState(name, { value: n }, expectedVersion + 1)\n try {\n await this.adapter.put(this.vault, SEQUENCE_COLLECTION, name, envelope, expectedVersion)\n return\n } catch (err) {\n if (isConflictError(err)) {\n lastConflict = err\n if (attempt < MAX_NEXT_ATTEMPTS - 1) await sleepBackoff(attempt)\n continue\n }\n throw err\n }\n }\n void lastConflict\n throw new SequenceContentionError(name, MAX_NEXT_ATTEMPTS)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAWO,SAAS,eAAiC;AAC/C,SAAO;AAAA,IACL,YAAY,MAAM;AAChB,aAAO,IAAI,cAAc,IAAI;AAAA,IAC/B;AAAA,EACF;AACF;;;ACWO,IAAM,cAAgC;AAAA,EAC3C,cAA6B;AAC3B,UAAM,IAAI,wBAAwB;AAAA,EACpC;AAC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e;AACvF,eAAO;AAAA,MACT,SAAS,KAAK;AACZ,YAAI,gBAAgB,GAAG,GAAG;AACxB,yBAAe;AACf,cAAI,UAAU,oBAAoB,EAAG,OAAM,aAAa,OAAO;AAC/D;AAAA,QACF;AACA,cAAM;AAAA,MACR;AAAA,IACF;AACA,SAAK;AACL,UAAM,IAAI,wBAAwB,MAAM,iBAAiB;AAAA,EAC3D;AAAA,EAEA,MAAM,OAAO,MAAc,GAA0B;AACnD,SAAK,aAAa;AAClB,QAAI,KAAK,EAAG;AACZ,QAAI;AACJ,aAAS,UAAU,GAAG,UAAU,mBAAmB,WAAW;AAC5D,YAAM,EAAE,KAAK,MAAM,IAAI,MAAM,KAAK,KAAK,IAAI;AAC3C,UAAI,SAAS,EAAG;AAChB,YAAM,kBAAkB,KAAK,MAAM;AACnC,YAAM,WAAW,MAAM,KAAK,aAAa,MAAM,EAAE,OAAO,EAAE,GAAG,kBAAkB,CAAC;AAChF,UAAI;AACF,cAAM,KAAK,QAAQ,IAAI,KAAK,OAAO,qBAAqB,MAAM,UAAU,eAAe;AACvF;AAAA,MACF,SAAS,KAAK;AACZ,YAAI,gBAAgB,GAAG,GAAG;AACxB,yBAAe;AACf,cAAI,UAAU,oBAAoB,EAAG,OAAM,aAAa,OAAO;AAC/D;AAAA,QACF;AACA,cAAM;AAAA,MACR;AAAA,IACF;AACA,SAAK;AACL,UAAM,IAAI,wBAAwB,MAAM,iBAAiB;AAAA,EAC3D;AACF;","names":[]}
@@ -5,14 +5,12 @@ import {
5
5
  isRewrappedUnder,
6
6
  openEnvelopeJson,
7
7
  rewrapEnvelope
8
- } from "./chunk-PWJSO7HH.js";
8
+ } from "./chunk-LTVETWDH.js";
9
9
  import {
10
+ buildRecordEnvelope,
10
11
  isTombstone,
11
12
  isTombstoneShape
12
- } from "./chunk-P3AFV6EA.js";
13
- import {
14
- NOYDB_FORMAT_VERSION
15
- } from "./chunk-SFY6NT7D.js";
13
+ } from "./chunk-6E2JZRBD.js";
16
14
  import {
17
15
  ReadOnlyAtInstantError
18
16
  } from "./chunk-I64WQSN3.js";
@@ -100,14 +98,10 @@ async function tombstoneHistory(adapter, vault, collection, recordId, actor, enc
100
98
  const env = await adapter.get(vault, HISTORY_COLLECTION, id);
101
99
  if (!env) continue;
102
100
  if (isTombstone(env, encrypted)) continue;
103
- const tombstone = {
104
- _noydb: NOYDB_FORMAT_VERSION,
105
- _v: env._v,
106
- _ts: now,
107
- _iv: "",
108
- _data: "",
109
- ...actor ? { _by: actor } : {}
110
- };
101
+ const tombstone = buildRecordEnvelope(
102
+ { collection: HISTORY_COLLECTION, id },
103
+ { version: env._v, ts: now, iv: "", data: "", ...actor ? { by: actor } : {} }
104
+ );
111
105
  await adapter.put(vault, HISTORY_COLLECTION, id, tombstone);
112
106
  count++;
113
107
  }
@@ -330,4 +324,4 @@ export {
330
324
  VaultInstant,
331
325
  CollectionInstant
332
326
  };
333
- //# sourceMappingURL=chunk-FBG62BUQ.js.map
327
+ //# sourceMappingURL=chunk-T6CCRXD3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-commit/history/history.ts","../src/with-commit/history/time-machine.ts"],"sourcesContent":["import { buildRecordEnvelope } from '../../kernel/enclave/index.js'\nimport type { NoydbStore, EncryptedEnvelope, HistoryOptions, PruneOptions } from '../../kernel/types.js'\nimport { isTombstone, isTombstoneShape, rewrapEnvelope, isRewrappedUnder, type EnclaveKey } from '../../kernel/enclave/index.js'\n\n/**\n * History storage convention:\n * Collection: `_history`\n * ID format: `{collection}:{recordId}:{paddedVersion}`\n * Version is zero-padded to 10 digits for lexicographic sorting.\n */\n\nconst HISTORY_COLLECTION = '_history'\nconst VERSION_PAD = 10\n\nfunction historyId(collection: string, recordId: string, version: number): string {\n return `${collection}:${recordId}:${String(version).padStart(VERSION_PAD, '0')}`\n}\n\n// Unused today, kept for future history-id parsing utilities.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction parseHistoryId(id: string): { collection: string; recordId: string; version: number } | null {\n const lastColon = id.lastIndexOf(':')\n if (lastColon < 0) return null\n const versionStr = id.slice(lastColon + 1)\n const rest = id.slice(0, lastColon)\n const firstColon = rest.indexOf(':')\n if (firstColon < 0) return null\n return {\n collection: rest.slice(0, firstColon),\n recordId: rest.slice(firstColon + 1),\n version: parseInt(versionStr, 10),\n }\n}\n\nfunction matchesPrefix(id: string, collection: string, recordId?: string): boolean {\n if (recordId) {\n return id.startsWith(`${collection}:${recordId}:`)\n }\n return id.startsWith(`${collection}:`)\n}\n\n/** Save a history entry (a complete encrypted envelope snapshot). */\nexport async function saveHistory(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n envelope: EncryptedEnvelope,\n): Promise<void> {\n const id = historyId(collection, recordId, envelope._v)\n await adapter.put(vault, HISTORY_COLLECTION, id, envelope)\n}\n\n/** Get history entries for a record, sorted newest-first. */\nexport async function getHistory(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n options?: HistoryOptions,\n): Promise<EncryptedEnvelope[]> {\n const allIds = await adapter.list(vault, HISTORY_COLLECTION)\n const matchingIds = allIds\n .filter(id => matchesPrefix(id, collection, recordId))\n .sort()\n .reverse() // newest first\n\n const entries: EncryptedEnvelope[] = []\n\n for (const id of matchingIds) {\n const envelope = await adapter.get(vault, HISTORY_COLLECTION, id)\n if (!envelope) continue\n\n // Apply time filters\n if (options?.from && envelope._ts < options.from) continue\n if (options?.to && envelope._ts > options.to) continue\n\n entries.push(envelope)\n\n if (options?.limit && entries.length >= options.limit) break\n }\n\n return entries\n}\n\n/** Get a specific version's envelope from history. */\nexport async function getVersionEnvelope(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n version: number,\n): Promise<EncryptedEnvelope | null> {\n const id = historyId(collection, recordId, version)\n return adapter.get(vault, HISTORY_COLLECTION, id)\n}\n\n/** Prune history entries. Returns the number of entries deleted. */\nexport async function pruneHistory(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string | undefined,\n options: PruneOptions,\n): Promise<number> {\n const allIds = await adapter.list(vault, HISTORY_COLLECTION)\n const matchingIds = allIds\n .filter(id => recordId ? matchesPrefix(id, collection, recordId) : matchesPrefix(id, collection))\n .sort()\n\n let toDelete: string[] = []\n\n if (options.keepVersions !== undefined) {\n // Keep only the N most recent, delete the rest\n const keep = options.keepVersions\n if (matchingIds.length > keep) {\n toDelete = matchingIds.slice(0, matchingIds.length - keep)\n }\n }\n\n if (options.beforeDate) {\n // Delete entries older than the specified date\n for (const id of matchingIds) {\n if (toDelete.includes(id)) continue\n const envelope = await adapter.get(vault, HISTORY_COLLECTION, id)\n if (envelope && envelope._ts < options.beforeDate) {\n toDelete.push(id)\n }\n }\n }\n\n // Deduplicate\n const uniqueDeletes = [...new Set(toDelete)]\n\n for (const id of uniqueDeletes) {\n await adapter.delete(vault, HISTORY_COLLECTION, id)\n }\n\n return uniqueDeletes.length\n}\n\n/** Clear all history for a vault, optionally scoped to a collection or record. */\nexport async function clearHistory(\n adapter: NoydbStore,\n vault: string,\n collection?: string,\n recordId?: string,\n): Promise<number> {\n const allIds = await adapter.list(vault, HISTORY_COLLECTION)\n let toDelete: string[]\n\n if (collection && recordId) {\n toDelete = allIds.filter(id => matchesPrefix(id, collection, recordId))\n } else if (collection) {\n toDelete = allIds.filter(id => matchesPrefix(id, collection))\n } else {\n toDelete = allIds\n }\n\n for (const id of toDelete) {\n await adapter.delete(vault, HISTORY_COLLECTION, id)\n }\n\n return toDelete.length\n}\n\n/**\n * Crypto-shred every `_history` version of a record. Each non-tombstone\n * history envelope is OVERWRITTEN in place with a tombstone\n * `{ _noydb, _v, _ts: now, _by: actor, _iv: '', _data: '' }` — dropping\n * `_iv`/`_data`/`_cek`/`_det`, so the prior ciphertext (and the wrapped CEK\n * that could decrypt it) is gone everywhere this store reaches. The version\n * counter (`_v`) is preserved so the audit trail still shows \"N versions\n * existed and were erased.\"\n *\n * Overwrite — NOT delete — so the history key itself survives as proof the\n * version existed. Already-tombstoned versions (re-run / idempotent forget)\n * are left untouched and not counted.\n *\n * Returns the number of history versions newly tombstoned.\n */\nexport async function tombstoneHistory(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n actor: string,\n encrypted: boolean,\n): Promise<number> {\n const allIds = await adapter.list(vault, HISTORY_COLLECTION)\n const matchingIds = allIds.filter(id => matchesPrefix(id, collection, recordId))\n\n const now = new Date().toISOString()\n let count = 0\n for (const id of matchingIds) {\n const env = await adapter.get(vault, HISTORY_COLLECTION, id)\n if (!env) continue\n // Already a tombstone (no body and no wrapped CEK)? Skip — idempotent.\n if (isTombstone(env, encrypted)) continue\n const tombstone: EncryptedEnvelope = buildRecordEnvelope(\n { collection: HISTORY_COLLECTION, id },\n { version: env._v, ts: now, iv: '', data: '', ...(actor ? { by: actor } : {}) },\n )\n await adapter.put(vault, HISTORY_COLLECTION, id, tombstone)\n count++\n }\n return count\n}\n\n/**\n * Re-key every `_history` snapshot of a record from `fromDek` to `toDek`.\n * Mirrors what `rewrapBodyToDek` already does for a record's LIVE body on a\n * tier move (elevate/demote/putAtTier) — each `_history` envelope also\n * carries its own `_cek`, wrapped under the collection's tier-0 DEK at write\n * time (`record-codec.ts`), so a tier move that rewraps only the live\n * envelope leaves prior versions decryptable at rest under the tier the\n * record left. This is defense-in-depth *beneath* the read-gate\n * (`history()`/`getVersion()` already return empty for an elevated record;\n * this protects the ciphertext even if that gate is bypassed).\n *\n * Rewraps content in place — unlike `tombstoneHistory`, it does NOT blank\n * `_iv`/`_data`/`_cek` — so a subsequent `demote()` restores tier-0\n * readability. Tombstone-shaped entries (a forgotten/shredded version —\n * blanked `_data`, no `_cek`) are skipped: there is no key material left to\n * rewrap.\n *\n * **Legacy fallback.** A snapshot written before this fix stays wrapped\n * under the tier-0 DEK even after its live record has since moved tiers, so\n * a rewrap attempted with a tier-N `fromDek` fails to unwrap/decrypt. When\n * the caller supplies `tier0Dek`, a failed rewrap is retried once with\n * `tier0Dek` as `fromDek` (the only other key a pre-fix snapshot can be\n * wrapped under — history is written only by tier-0 `put()`). The output is\n * always wrapped under `toDek` regardless of which `fromDek` succeeded. A\n * rewrap that fails under BOTH keys re-throws — that is real corruption, not\n * a tier mismatch, and must not be swallowed.\n *\n * **Crash-atomicity / idempotency (#712 whole-branch-fix-3).** This loop has\n * no transaction around it: a crash after some entries have been rewritten\n * under `toDek` but before the loop finishes leaves the record's history\n * split across two keys. A retry of the SAME call must not re-fail on the\n * entries that already made it — so each entry is probed with\n * `isRewrappedUnder(env, toDek)` FIRST; a match means it's already at the\n * target key and is skipped (put nothing). This makes same-target retries\n * and demote-after-crash fully self-healing. It does NOT close every crash\n * window: a crash that lands SOME entries under `toDek` while the record's\n * NEXT move target differs from this call's `toDek` (an intermediate-tier\n * crash — e.g. elevate 0→1 crashes mid-loop, then the record is moved 1→2)\n * still finds those entries unreadable under either `fromDek` or the\n * tier-0 fallback, since `toDek` is a third key the next call never probes\n * for. That residual window is an accepted, fail-closed limitation (see\n * `.changeset/history-at-rest.md` and the design doc) — availability is\n * lost, never confidentiality.\n */\nexport async function rewrapHistory(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n fromDek: EnclaveKey,\n toDek: EnclaveKey,\n tier0Dek?: EnclaveKey,\n): Promise<void> {\n const allIds = await adapter.list(vault, HISTORY_COLLECTION)\n const matchingIds = allIds.filter(id => matchesPrefix(id, collection, recordId))\n\n for (const id of matchingIds) {\n const env = await adapter.get(vault, HISTORY_COLLECTION, id)\n if (!env) continue\n // Already a tombstone (forgotten/shredded version)? Nothing to rewrap.\n if (isTombstoneShape(env)) continue\n // #712/whole-branch-fix-3: toDek-first idempotency skip — already at the\n // target key (a same-target retry, or demote-after-crash landing back on\n // a key it already reached)? Nothing to do; put nothing.\n if (await isRewrappedUnder(env, toDek)) continue\n\n let next: EncryptedEnvelope\n try {\n next = await rewrapEnvelope(env, fromDek, toDek)\n } catch (err) {\n if (!tier0Dek) throw err\n // Legacy fallback: retry once under the tier-0 DEK. A failure here is\n // real corruption, not a tier mismatch — let it propagate.\n next = await rewrapEnvelope(env, tier0Dek, toDek)\n }\n\n await adapter.put(vault, HISTORY_COLLECTION, id, next)\n }\n}\n","/**\n * Time-machine queries — point-in-time reads reconstructed from the\n * existing history + ledger infrastructure.\n *\n * ## Usage\n *\n * ```ts\n * const vault = await db.openVault('acme', { secret })\n * const q1End = vault.at('2026-03-31T23:59:59Z')\n * const invoice = await q1End.collection<Invoice>('invoices').get('inv-001')\n * // → the record as it stood at the close of Q1 2026\n * ```\n *\n * ## How it works\n *\n * Every write path already fans out into two persistence lanes:\n *\n * 1. `saveHistory(...)` persists a **full encrypted envelope snapshot**\n * per version under the `_history` collection (one envelope per\n * version, keyed by `{collection}:{id}:{paddedVersion}`). Each\n * envelope carries its own `_ts` (the write timestamp).\n * 2. `ledger.append(...)` appends a hash-chained audit entry that\n * records the `op` (put / delete), `version`, and `ts`.\n *\n * Reconstruction at a target timestamp T is therefore:\n *\n * - Find the newest history envelope for `(collection, id)` whose\n * `_ts ≤ T` — that's the state the record was in at T.\n * - Check the ledger for any `op: 'delete'` entry for the same\n * `(collection, id)` with `entry.ts` in `(latestEnvelope._ts, T]` —\n * if present, the record was deleted before T, so return `null`.\n * - Decrypt the surviving envelope with the current collection DEK\n * (DEKs are per-collection but stable across versions — the same\n * key encrypts v1 and v15 of a record).\n *\n * No delta replay. The existing `history.ts` module already stores\n * complete snapshots; we just pick the right one.\n *\n * ## Read-only contract\n *\n * Every write method on `CollectionInstant` throws\n * {@link ReadOnlyAtInstantError}. A historical view is a *read*\n * surface — mutating the past would require either a branch/shadow\n * mechanism (tracked under shadow vaults) or a rewrite of\n * history, which breaks the ledger's tamper-evidence guarantee.\n *\n * @module\n */\nimport type { EncryptedEnvelope, NoydbStore } from '../../kernel/types.js'\nimport type { LedgerStore } from './ledger/store.js'\nimport { getHistory } from './history.js'\nimport { openEnvelopeJson, type EnclaveKey } from '../../kernel/enclave/index.js'\nimport { ReadOnlyAtInstantError } from '../../kernel/errors.js'\nimport { liveRecordIsElevated } from '../../kernel/tier-visibility.js'\n\n/**\n * Narrow view of a {@link Vault}'s internals that\n * {@link VaultInstant} needs. Passed in by `Vault.at()` rather than\n * constructed here so all crypto + adapter access stays inside the\n * Vault class.\n *\n * Not exported from the public barrel — consumers should get a\n * `VaultInstant` via `vault.at(ts)`, never by constructing one\n * directly.\n */\nexport interface VaultEngine {\n readonly adapter: NoydbStore\n /** Vault name (the compartment). */\n readonly name: string\n /**\n * `true` when the vault was opened with a secret (the normal\n * case). `false` in plaintext-mode vaults (`encrypt: false`) — in\n * that case `envelope._data` is raw JSON and we skip the DEK lookup.\n */\n readonly encrypted: boolean\n /**\n * Resolves the DEK used to decrypt a given collection's envelopes.\n * Not called when `encrypted` is false.\n */\n getDEK(collection: string): Promise<EnclaveKey>\n /**\n * Lazily-initialised ledger. We consult it to detect deletes that\n * happened between the latest history snapshot and the target\n * timestamp. `null` when history is disabled for this vault — in\n * that case time-machine reads fall back to history-only\n * reconstruction (which may miss deletes).\n */\n getLedger(): LedgerStore | null\n}\n\n/**\n * A vault at a fixed instant. Produced by `vault.at(timestamp)`.\n * Carries no session state of its own — every read is a fresh\n * lookup through the vault's adapter.\n *\n * Cheap to construct; safe to throw away. Create one per query.\n */\nexport class VaultInstant {\n constructor(\n private readonly engine: VaultEngine,\n /** Fully-resolved target timestamp (ISO-8601 UTC). */\n public readonly timestamp: string,\n ) {}\n\n /** Get a point-in-time view of a collection. */\n collection<T = unknown>(name: string): CollectionInstant<T> {\n return new CollectionInstant<T>(this.engine, this.timestamp, name)\n }\n}\n\n/**\n * A read-only collection view anchored to a past instant.\n *\n * Every write method throws {@link ReadOnlyAtInstantError} — see the\n * module docstring for why. The read surface is intentionally smaller\n * than the live {@link Collection}: `get` and `list` cover the\n * \"what did the books look like on date X\" use case without pulling\n * in the full query DSL / joins / aggregates at this stage. Follow-up\n * work tracked under.\n */\nexport class CollectionInstant<T = unknown> {\n constructor(\n private readonly engine: VaultEngine,\n private readonly targetTs: string,\n public readonly name: string,\n ) {}\n\n /**\n * Return the record as it existed at the target timestamp, or\n * `null` if the record had not been created yet or had already been\n * deleted by then.\n *\n * Gated on the LIVE record's current tier — #730, mirroring the #712\n * read-gate `history()`/`getVersion()` already apply: an elevated record\n * is invisible through the whole time-machine surface, not just a\n * decrypt failure. See {@link resolveVisibleEnvelope}.\n *\n * Decrypts through {@link openEnvelopeJson}, the `_cek`-aware envelope\n * body opener — a snapshot from a `perRecordKeys` collection is encrypted\n * under its own per-record CEK (wrapped in `_cek`), not the collection\n * DEK directly.\n */\n async get(id: string): Promise<T | null> {\n const envelope = await this.resolveVisibleEnvelope(id)\n if (!envelope) return null\n const plaintext = this.engine.encrypted\n ? await openEnvelopeJson(envelope, await this.engine.getDEK(this.name))\n : envelope._data\n return JSON.parse(plaintext) as T\n }\n\n /**\n * IDs of records that existed (had at least one `put` and were not\n * subsequently deleted) at the target timestamp.\n *\n * Implemented as a linear scan over history + ledger. Performance\n * is bounded by total history size (not live-vault size), so the\n * memory-first vault-scale cap (1K–50K records × average history\n * depth) still applies.\n */\n async list(): Promise<string[]> {\n const historyIds = await collectHistoryIds(this.engine.adapter, this.engine.name, this.name)\n const liveIds = await this.engine.adapter.list(this.engine.name, this.name)\n const candidateIds = new Set<string>([...historyIds, ...liveIds])\n const alive: string[] = []\n for (const id of candidateIds) {\n const env = await this.resolveVisibleEnvelope(id)\n if (env) alive.push(id)\n }\n return alive.sort()\n }\n\n // ── write guards ───────────────────────────────────────────────────\n\n async put(_id: string, _record: T): Promise<never> {\n throw new ReadOnlyAtInstantError('put', this.targetTs)\n }\n async delete(_id: string): Promise<never> {\n throw new ReadOnlyAtInstantError('delete', this.targetTs)\n }\n async update(_id: string, _patch: Partial<T>): Promise<never> {\n throw new ReadOnlyAtInstantError('update', this.targetTs)\n }\n\n // ── internals ─────────────────────────────────────────────────────\n\n /**\n * {@link resolveEnvelope}, additionally gated on the record's LIVE\n * (current, not historical) tier — #730. Mirrors the #712 read-gate\n * `history()`/`getVersion()` apply: history snapshots keep their\n * tier-0-wrapped CEKs and carry no `_tier` of their own, so an elevated\n * record's prior versions would otherwise stay tier-0-decryptable here.\n * `null` for a resolved envelope carrying its own `_tier > 0` (a\n * tier-aware snapshot reached some other way) or whose LIVE record is\n * currently elevated — both `get()` and `list()` route through this so\n * the invisibility law holds on the whole time-machine read surface, not\n * just a decrypt failure.\n */\n private async resolveVisibleEnvelope(id: string): Promise<EncryptedEnvelope | null> {\n const envelope = await this.resolveEnvelope(id)\n if (!envelope || (envelope._tier ?? 0) > 0) return null\n if (await liveRecordIsElevated(this.engine.adapter, this.engine.name, this.name, id)) return null\n return envelope\n }\n\n /**\n * Return the envelope that represents the record's state at\n * `targetTs`, accounting for deletes. `null` if the record didn't\n * exist at that instant.\n *\n * ## Why we use the ledger as the authoritative timeline\n *\n * The per-version history snapshots saved by `saveHistory()` do\n * carry a `_ts` field, but that timestamp is the moment the\n * snapshot was *captured* (i.e. the instant right before the\n * subsequent overwrite), not the original write time. The ledger,\n * by contrast, records `ts` at the moment of each `put` / `delete`\n * — it's the only source that tracks the real timeline. So:\n *\n * 1. Walk the ledger; find the latest entry for `(collection, id)`\n * with `ts ≤ targetTs`.\n * 2. If that entry is a `delete`, the record was gone at the\n * target instant — return null.\n * 3. Otherwise it's a `put` with a specific `version`. Load the\n * envelope for that version from history, falling back to the\n * live collection for the most recent version.\n *\n * ## Fallback when the ledger is disabled\n *\n * If the vault has history disabled, `getLedger()` returns null and\n * we fall back to comparing envelope `_ts` fields. This is\n * approximate and gets the *last write* right but may confuse the\n * intermediate versions; adopters needing accurate time-machine\n * reads should leave history enabled.\n */\n private async resolveEnvelope(id: string): Promise<EncryptedEnvelope | null> {\n const ledger = this.engine.getLedger()\n if (ledger) {\n return this.resolveViaLedger(id, ledger)\n }\n return this.resolveViaEnvelopeTs(id)\n }\n\n private async resolveViaLedger(id: string, ledger: LedgerStore): Promise<EncryptedEnvelope | null> {\n const entries = await ledger.entries()\n // Entries are already ordered by index which is the mutation order.\n let latest: { op: 'put' | 'delete'; version: number } | null = null\n for (const e of entries) {\n if (e.collection !== this.name || e.id !== id) continue\n if (e.ts > this.targetTs) break // entries are time-ordered by index\n // `amendment` + `lifecycle` entries are audit-only summaries — they\n // carry no (collection, id) tuple of their own and would never match\n // the filter above. The narrow here is a type guard, not a runtime\n // skip.\n // `forget` is a subject-erasure summary with empty (collection, id) —\n // never matches the filter above; the narrow is a type guard.\n if (e.op === 'amendment' || e.op === 'lifecycle' || e.op === 'forget') continue\n // `migration` is a record rewrite (cutover) — resolve it like a put.\n latest = { op: e.op === 'migration' ? 'put' : e.op, version: e.version }\n }\n if (!latest) return null\n if (latest.op === 'delete') return null\n return this.loadVersion(id, latest.version)\n }\n\n private async resolveViaEnvelopeTs(id: string): Promise<EncryptedEnvelope | null> {\n const history = await getHistory(\n this.engine.adapter, this.engine.name, this.name, id,\n )\n const live = await this.engine.adapter.get(this.engine.name, this.name, id)\n const byVersion = new Map<number, EncryptedEnvelope>()\n for (const e of history) byVersion.set(e._v, e)\n if (live) byVersion.set(live._v, live)\n const sorted = [...byVersion.values()].sort((a, b) =>\n a._ts < b._ts ? 1 : a._ts > b._ts ? -1 : 0,\n )\n return sorted.find((e) => e._ts <= this.targetTs) ?? null\n }\n\n /**\n * Fetch the envelope for a specific version. The live record (most\n * recent put) lives in the main collection; prior versions live in\n * `_history`. We check live first because the common case after a\n * delete is that we're trying to load the last-live version from\n * history, and skipping live for the current-version case avoids a\n * redundant lookup.\n */\n private async loadVersion(id: string, version: number): Promise<EncryptedEnvelope | null> {\n const live = await this.engine.adapter.get(this.engine.name, this.name, id)\n if (live && live._v === version) return live\n\n // Direct lookup by (collection, id, version) — avoids scanning all history.\n const historyId = `${this.name}:${id}:${String(version).padStart(10, '0')}`\n return await this.engine.adapter.get(this.engine.name, '_history', historyId)\n }\n}\n\n/**\n * Scan the `_history` collection once and collect every distinct\n * `recordId` for the given collection. History keys follow the\n * shape `<collection>:<recordId>:<paddedVersion>`; we split on the\n * last two colons (delimiter-safe because `paddedVersion` is\n * exactly 10 digits).\n */\nasync function collectHistoryIds(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n): Promise<string[]> {\n const all = await adapter.list(vault, '_history')\n const prefix = `${collection}:`\n const seen = new Set<string>()\n for (const key of all) {\n if (!key.startsWith(prefix)) continue\n const lastColon = key.lastIndexOf(':')\n if (lastColon <= prefix.length) continue\n const middle = key.slice(prefix.length, lastColon)\n seen.add(middle)\n }\n return [...seen]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAWA,IAAM,qBAAqB;AAC3B,IAAM,cAAc;AAEpB,SAAS,UAAU,YAAoB,UAAkB,SAAyB;AAChF,SAAO,GAAG,UAAU,IAAI,QAAQ,IAAI,OAAO,OAAO,EAAE,SAAS,aAAa,GAAG,CAAC;AAChF;AAkBA,SAAS,cAAc,IAAY,YAAoB,UAA4B;AACjF,MAAI,UAAU;AACZ,WAAO,GAAG,WAAW,GAAG,UAAU,IAAI,QAAQ,GAAG;AAAA,EACnD;AACA,SAAO,GAAG,WAAW,GAAG,UAAU,GAAG;AACvC;AAGA,eAAsB,YACpB,SACA,OACA,YACA,UACA,UACe;AACf,QAAM,KAAK,UAAU,YAAY,UAAU,SAAS,EAAE;AACtD,QAAM,QAAQ,IAAI,OAAO,oBAAoB,IAAI,QAAQ;AAC3D;AAGA,eAAsB,WACpB,SACA,OACA,YACA,UACA,SAC8B;AAC9B,QAAM,SAAS,MAAM,QAAQ,KAAK,OAAO,kBAAkB;AAC3D,QAAM,cAAc,OACjB,OAAO,QAAM,cAAc,IAAI,YAAY,QAAQ,CAAC,EACpD,KAAK,EACL,QAAQ;AAEX,QAAM,UAA+B,CAAC;AAEtC,aAAW,MAAM,aAAa;AAC5B,UAAM,WAAW,MAAM,QAAQ,IAAI,OAAO,oBAAoB,EAAE;AAChE,QAAI,CAAC,SAAU;AAGf,QAAI,SAAS,QAAQ,SAAS,MAAM,QAAQ,KAAM;AAClD,QAAI,SAAS,MAAM,SAAS,M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AAO,MAAM,KAAK,MAAM,EAAE;AAC1E,QAAI,QAAQ,KAAK,OAAO,QAAS,QAAO;AAGxC,UAAMA,aAAY,GAAG,KAAK,IAAI,IAAI,EAAE,IAAI,OAAO,OAAO,EAAE,SAAS,IAAI,GAAG,CAAC;AACzE,WAAO,MAAM,KAAK,OAAO,QAAQ,IAAI,KAAK,OAAO,MAAM,YAAYA,UAAS;AAAA,EAC9E;AACF;AASA,eAAe,kBACb,SACA,OACA,YACmB;AACnB,QAAM,MAAM,MAAM,QAAQ,KAAK,OAAO,UAAU;AAChD,QAAM,SAAS,GAAG,UAAU;AAC5B,QAAM,OAAO,oBAAI,IAAY;AAC7B,aAAW,OAAO,KAAK;AACrB,QAAI,CAAC,IAAI,WAAW,MAAM,EAAG;AAC7B,UAAM,YAAY,IAAI,YAAY,GAAG;AACrC,QAAI,aAAa,OAAO,OAAQ;AAChC,UAAM,SAAS,IAAI,MAAM,OAAO,QAAQ,SAAS;AACjD,SAAK,IAAI,MAAM;AAAA,EACjB;AACA,SAAO,CAAC,GAAG,IAAI;AACjB;","names":["historyId"]}
@@ -812,7 +812,7 @@ async function applySatelliteLivenessFilter(vault, dumpJson) {
812
812
  if (!backup.collections || typeof backup.collections !== "object") return dumpJson;
813
813
  if (typeof vault._introspectState !== "function") return dumpJson;
814
814
  const { adapter, name, getDEK } = vault._introspectState();
815
- const { liveBaseIdSetsForBundle } = await import("./dead-filter-5ROD2DCQ.js");
815
+ const { liveBaseIdSetsForBundle } = await import("./dead-filter-6HG5FP3I.js");
816
816
  const satLive = await liveBaseIdSetsForBundle(adapter, name, Object.keys(backup.collections), getDEK);
817
817
  if (satLive.size === 0) return dumpJson;
818
818
  const next = {};
@@ -1058,4 +1058,4 @@ export {
1058
1058
  readPodRedirect,
1059
1059
  readPod
1060
1060
  };
1061
- //# sourceMappingURL=chunk-T7XUDZ7N.js.map
1061
+ //# sourceMappingURL=chunk-THUITYH7.js.map
@@ -4,10 +4,10 @@ import {
4
4
  import {
5
5
  canonicalJson,
6
6
  sha256Hex
7
- } from "./chunk-62KVBIBU.js";
7
+ } from "./chunk-53PWELSC.js";
8
8
  import {
9
9
  isDeleteMarker
10
- } from "./chunk-P3AFV6EA.js";
10
+ } from "./chunk-6E2JZRBD.js";
11
11
  import {
12
12
  PeriodClosedError,
13
13
  ValidationError
@@ -124,7 +124,7 @@ function validatePeriodName(name, existing, partition) {
124
124
  }
125
125
  async function appendPeriodLedgerEntry(ledger, actor, envelope, name, collection = PERIODS_COLLECTION) {
126
126
  if (!ledger) return;
127
- const { envelopePayloadHash } = await import("./ledger-HLINHILR.js");
127
+ const { envelopePayloadHash } = await import("./ledger-6IHXJHDD.js");
128
128
  await ledger.append({
129
129
  op: "put",
130
130
  collection,
@@ -198,4 +198,4 @@ export {
198
198
  purgeMarkersOn,
199
199
  withPeriods
200
200
  };
201
- //# sourceMappingURL=chunk-TEJILTMY.js.map
201
+ //# sourceMappingURL=chunk-TTAND7MR.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  writePod
3
- } from "./chunk-T7XUDZ7N.js";
3
+ } from "./chunk-THUITYH7.js";
4
4
 
5
5
  // src/with-audit/portability/export-accessible.ts
6
6
  function resolveAccessibleCollections(keyring, scope, writableOnly = false) {
@@ -42,4 +42,4 @@ export {
42
42
  buildAccessibleBundle,
43
43
  exportAccessibleData
44
44
  };
45
- //# sourceMappingURL=chunk-HAN2PHLM.js.map
45
+ //# sourceMappingURL=chunk-TWPTRJEU.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  buildAccessibleBundle,
3
3
  resolveAccessibleCollections
4
- } from "./chunk-HAN2PHLM.js";
4
+ } from "./chunk-TWPTRJEU.js";
5
5
  import {
6
6
  sha256Hex
7
7
  } from "./chunk-QTDAPDDV.js";
@@ -114,4 +114,4 @@ export {
114
114
  freezeAndDeleteClosure,
115
115
  withdrawAccessibleData
116
116
  };
117
- //# sourceMappingURL=chunk-WVCOS4XA.js.map
117
+ //# sourceMappingURL=chunk-TY6N3PAC.js.map
@@ -5,11 +5,11 @@ import {
5
5
  import {
6
6
  applyRewrappedBody,
7
7
  rewrapBodyToDek
8
- } from "./chunk-PWJSO7HH.js";
8
+ } from "./chunk-LTVETWDH.js";
9
9
  import {
10
10
  isDeleteMarker,
11
11
  isTombstoneShape
12
- } from "./chunk-P3AFV6EA.js";
12
+ } from "./chunk-6E2JZRBD.js";
13
13
  import {
14
14
  decrypt,
15
15
  encrypt,
@@ -378,4 +378,4 @@ export {
378
378
  demote,
379
379
  classifySealedShred
380
380
  };
381
- //# sourceMappingURL=chunk-5LKPMDBC.js.map
381
+ //# sourceMappingURL=chunk-UVFO25FJ.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-4AOERLTV.js";
4
4
  import {
5
5
  openEnvelopeJson
6
- } from "./chunk-PWJSO7HH.js";
6
+ } from "./chunk-LTVETWDH.js";
7
7
  import {
8
8
  encrypt
9
9
  } from "./chunk-QTDAPDDV.js";
@@ -75,4 +75,4 @@ export {
75
75
  writeConsentEntry,
76
76
  loadConsentEntries
77
77
  };
78
- //# sourceMappingURL=chunk-KIZOCPHS.js.map
78
+ //# sourceMappingURL=chunk-VUUUIKRG.js.map
@@ -7,15 +7,15 @@ import {
7
7
  import {
8
8
  SCHEMAS_COLLECTION,
9
9
  loadPersistedSchema
10
- } from "./chunk-FINIMZ55.js";
10
+ } from "./chunk-A3WHDOWI.js";
11
11
  import {
12
12
  canonicalJson,
13
13
  sha256Hex
14
- } from "./chunk-62KVBIBU.js";
14
+ } from "./chunk-53PWELSC.js";
15
15
  import {
16
16
  openEnvelopeJson,
17
17
  writeEnvelopeBody
18
- } from "./chunk-PWJSO7HH.js";
18
+ } from "./chunk-LTVETWDH.js";
19
19
  import {
20
20
  NOYDB_FORMAT_VERSION
21
21
  } from "./chunk-SFY6NT7D.js";
@@ -88,4 +88,4 @@ export {
88
88
  saveSchemaManifest,
89
89
  deriveSchemaManifest
90
90
  };
91
- //# sourceMappingURL=chunk-U26JILS3.js.map
91
+ //# sourceMappingURL=chunk-WMZQCXZ5.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  LookupHandle
3
- } from "./chunk-PE6R44GS.js";
3
+ } from "./chunk-IQGIPRSE.js";
4
4
 
5
5
  // src/via/lookup/active.ts
6
6
  function withLookup() {
@@ -33,4 +33,4 @@ function withLookup() {
33
33
  export {
34
34
  withLookup
35
35
  };
36
- //# sourceMappingURL=chunk-RLK57SMS.js.map
36
+ //# sourceMappingURL=chunk-YX6J3Z3Z.js.map
@@ -2,7 +2,7 @@ import {
2
2
  classified,
3
3
  luhnCheck,
4
4
  withClassified
5
- } from "../chunk-CJ4KXDD4.js";
5
+ } from "../chunk-CZV57HHC.js";
6
6
  import {
7
7
  ClassifiedNeverStoredError,
8
8
  ClassifiedValidationError,
@@ -13,11 +13,11 @@ function markerForFields(vdigFields) {
13
13
  async function persistClassifiedMarkerForFields(store, vault, collectionName, vdigFields, dek) {
14
14
  const marker = markerForFields(vdigFields);
15
15
  if (marker === null) return;
16
- const { persistClassifiedMarker } = await import("./register-OMH3WVVL.js");
16
+ const { persistClassifiedMarker } = await import("./register-XHOOX37G.js");
17
17
  await persistClassifiedMarker({ store, vault, collectionName, dek, marker });
18
18
  }
19
19
  async function readClassifiedMarkerDigestOnly(store, vault, collectionName, dek) {
20
- const { loadPersistedSchema } = await import("./storage-EWT5HIX5.js");
20
+ const { loadPersistedSchema } = await import("./storage-N3IMFNGS.js");
21
21
  const persisted = await loadPersistedSchema(store, vault, collectionName, dek);
22
22
  return persisted?.classified?.digestOnly ?? [];
23
23
  }
@@ -25,4 +25,4 @@ export {
25
25
  persistClassifiedMarkerForFields,
26
26
  readClassifiedMarkerDigestOnly
27
27
  };
28
- //# sourceMappingURL=classified-marker-BCYBGITH.js.map
28
+ //# sourceMappingURL=classified-marker-L7LXKS6Q.js.map
@@ -10,17 +10,17 @@ import {
10
10
  similarTo,
11
11
  syncTierSearch,
12
12
  warmIndex
13
- } from "./chunk-X24QHSG5.js";
14
- import "./chunk-KNAZGJFG.js";
13
+ } from "./chunk-343FH4S5.js";
14
+ import "./chunk-4JDTLWUZ.js";
15
15
  import "./chunk-AURFOK3D.js";
16
- import "./chunk-PJ5TGJ7U.js";
17
- import "./chunk-PE6R44GS.js";
18
- import "./chunk-SZZEDEIU.js";
16
+ import "./chunk-FZ2SSI5R.js";
17
+ import "./chunk-IQGIPRSE.js";
18
+ import "./chunk-7LLKPODL.js";
19
19
  import "./chunk-RVTOCAHQ.js";
20
20
  import "./chunk-AMKCY454.js";
21
- import "./chunk-62KVBIBU.js";
22
- import "./chunk-PWJSO7HH.js";
23
- import "./chunk-P3AFV6EA.js";
21
+ import "./chunk-53PWELSC.js";
22
+ import "./chunk-LTVETWDH.js";
23
+ import "./chunk-6E2JZRBD.js";
24
24
  import "./chunk-FSZPQCDR.js";
25
25
  import "./chunk-HVR74IBG.js";
26
26
  import "./chunk-RBTZLXZJ.js";
@@ -42,4 +42,4 @@ export {
42
42
  syncTierSearch,
43
43
  warmIndex
44
44
  };
45
- //# sourceMappingURL=collection-facade-YCJHWX64.js.map
45
+ //# sourceMappingURL=collection-facade-KN3UFKZ4.js.map
@@ -2,13 +2,13 @@ import {
2
2
  CONSENT_AUDIT_COLLECTION,
3
3
  loadConsentEntries,
4
4
  writeConsentEntry
5
- } from "../chunk-KIZOCPHS.js";
5
+ } from "../chunk-VUUUIKRG.js";
6
6
  import {
7
7
  NO_CONSENT
8
8
  } from "../chunk-PEOZ34EM.js";
9
9
  import "../chunk-4AOERLTV.js";
10
- import "../chunk-PWJSO7HH.js";
11
- import "../chunk-P3AFV6EA.js";
10
+ import "../chunk-LTVETWDH.js";
11
+ import "../chunk-6E2JZRBD.js";
12
12
  import "../chunk-FSZPQCDR.js";
13
13
  import "../chunk-HVR74IBG.js";
14
14
  import "../chunk-RBTZLXZJ.js";
@@ -2,11 +2,11 @@ import {
2
2
  CustodyApi,
3
3
  NO_CUSTODY,
4
4
  withCustody
5
- } from "../chunk-LAVPHX2V.js";
6
- import "../chunk-RERAMZK5.js";
7
- import "../chunk-PNEV2TBR.js";
8
- import "../chunk-PWJSO7HH.js";
9
- import "../chunk-P3AFV6EA.js";
5
+ } from "../chunk-IGE6XWKK.js";
6
+ import "../chunk-LJDW6LQJ.js";
7
+ import "../chunk-PZLIA5R3.js";
8
+ import "../chunk-LTVETWDH.js";
9
+ import "../chunk-6E2JZRBD.js";
10
10
  import "../chunk-FSZPQCDR.js";
11
11
  import "../chunk-HVR74IBG.js";
12
12
  import "../chunk-RBTZLXZJ.js";
@@ -5,7 +5,7 @@ import "./chunk-PZ5AY32C.js";
5
5
 
6
6
  // src/with-shape/satellites/dead-filter.ts
7
7
  async function liveBaseIdSetsForBundle(store, vaultName, collectionNames, getDEK) {
8
- const { loadPersistedSchema } = await import("./storage-EWT5HIX5.js");
8
+ const { loadPersistedSchema } = await import("./storage-N3IMFNGS.js");
9
9
  const out = /* @__PURE__ */ new Map();
10
10
  for (const name of collectionNames) {
11
11
  if (name.startsWith("_")) continue;
@@ -25,4 +25,4 @@ async function liveBaseIdSetsForBundle(store, vaultName, collectionNames, getDEK
25
25
  export {
26
26
  liveBaseIdSetsForBundle
27
27
  };
28
- //# sourceMappingURL=dead-filter-5ROD2DCQ.js.map
28
+ //# sourceMappingURL=dead-filter-6HG5FP3I.js.map
@@ -6,8 +6,8 @@ import {
6
6
  } from "./chunk-4AOERLTV.js";
7
7
  import {
8
8
  openEnvelopeJson
9
- } from "./chunk-PWJSO7HH.js";
10
- import "./chunk-P3AFV6EA.js";
9
+ } from "./chunk-LTVETWDH.js";
10
+ import "./chunk-6E2JZRBD.js";
11
11
  import "./chunk-FSZPQCDR.js";
12
12
  import "./chunk-HVR74IBG.js";
13
13
  import "./chunk-RBTZLXZJ.js";
@@ -104,4 +104,4 @@ export {
104
104
  loadActiveDelegations,
105
105
  revokeDelegation
106
106
  };
107
- //# sourceMappingURL=delegation-IULC56LW.js.map
107
+ //# sourceMappingURL=delegation-7EGBYBRN.js.map
@@ -9,8 +9,8 @@ import {
9
9
  DerivationExecutor
10
10
  } from "../chunk-YDJXGYYA.js";
11
11
  import "../chunk-YH65A6WM.js";
12
- import "../chunk-PWJSO7HH.js";
13
- import "../chunk-P3AFV6EA.js";
12
+ import "../chunk-LTVETWDH.js";
13
+ import "../chunk-6E2JZRBD.js";
14
14
  import "../chunk-FSZPQCDR.js";
15
15
  import "../chunk-HVR74IBG.js";
16
16
  import "../chunk-RBTZLXZJ.js";
@@ -4,8 +4,8 @@ import {
4
4
  isZodSchema
5
5
  } from "./chunk-HNOBRU24.js";
6
6
  import "./chunk-Y2NBBT6K.js";
7
- import "./chunk-PWJSO7HH.js";
8
- import "./chunk-P3AFV6EA.js";
7
+ import "./chunk-LTVETWDH.js";
8
+ import "./chunk-6E2JZRBD.js";
9
9
  import "./chunk-FSZPQCDR.js";
10
10
  import "./chunk-HVR74IBG.js";
11
11
  import "./chunk-RBTZLXZJ.js";
@@ -19,4 +19,4 @@ export {
19
19
  isZod4Schema,
20
20
  isZodSchema
21
21
  };
22
- //# sourceMappingURL=derive-AP2NXZDC.js.map
22
+ //# sourceMappingURL=derive-XKAYJ2OA.js.map
@@ -1,7 +1,7 @@
1
1
  import "../chunk-GJW4HX2O.js";
2
2
  import {
3
3
  UserApi
4
- } from "../chunk-GWJNBTZA.js";
4
+ } from "../chunk-4XEUSZWN.js";
5
5
  import {
6
6
  DIRECTORY_RECORD_ID,
7
7
  META_COLLECTION,
@@ -16,9 +16,9 @@ import {
16
16
  readUserVisibility,
17
17
  saveUserEnvelope,
18
18
  visibilityRecordId
19
- } from "../chunk-PNEV2TBR.js";
20
- import "../chunk-PWJSO7HH.js";
21
- import "../chunk-P3AFV6EA.js";
19
+ } from "../chunk-PZLIA5R3.js";
20
+ import "../chunk-LTVETWDH.js";
21
+ import "../chunk-6E2JZRBD.js";
22
22
  import "../chunk-FSZPQCDR.js";
23
23
  import "../chunk-HVR74IBG.js";
24
24
  import "../chunk-RBTZLXZJ.js";
@@ -15,7 +15,7 @@ async function dispatchMaterializedViews(ctx, id, record, wave) {
15
15
  if (wave?.seen(`mv\0${reg.spec.name}`)) continue;
16
16
  if (executor === null) {
17
17
  ;
18
- ({ MaterializedViewExecutor: executor } = await import("./executor-GD32BQQK.js"));
18
+ ({ MaterializedViewExecutor: executor } = await import("./executor-LFHRV6JH.js"));
19
19
  }
20
20
  await executor.refresh(reg, {
21
21
  getCollection: (name) => source.getCollection(name),
@@ -24,7 +24,7 @@ async function dispatchMaterializedViews(ctx, id, record, wave) {
24
24
  dispatchCtx: dispatchCtx({ collection: collectionName, id })
25
25
  });
26
26
  } else if (mode === "lazy") {
27
- if (staleHelpers === null) staleHelpers = await import("./stale-WSC6Z7SB.js");
27
+ if (staleHelpers === null) staleHelpers = await import("./stale-26ZJLNLG.js");
28
28
  staleHelpers.markMVStale(registry, reg.spec.name);
29
29
  }
30
30
  }
@@ -44,7 +44,7 @@ async function dispatchMaterializedViewsOnDelete(ctx, id) {
44
44
  if (mode === "eager") {
45
45
  if (executor === null) {
46
46
  ;
47
- ({ MaterializedViewExecutor: executor } = await import("./executor-GD32BQQK.js"));
47
+ ({ MaterializedViewExecutor: executor } = await import("./executor-LFHRV6JH.js"));
48
48
  }
49
49
  const rr = await executor.refresh(reg, {
50
50
  getCollection: (name) => source.getCollection(name),
@@ -57,7 +57,7 @@ async function dispatchMaterializedViewsOnDelete(ctx, id) {
57
57
  residueDeclined.push(...rr.residueDeclined);
58
58
  continue;
59
59
  }
60
- if (staleHelpers === null) staleHelpers = await import("./stale-WSC6Z7SB.js");
60
+ if (staleHelpers === null) staleHelpers = await import("./stale-26ZJLNLG.js");
61
61
  const inv = await staleHelpers.invalidateMVAtRest(source, reg, mode);
62
62
  deleted += inv.deleted;
63
63
  residueUndecodable.push(...inv.residueUndecodable.map((rid) => `${reg.outputCollection}:${rid}`));
@@ -69,4 +69,4 @@ export {
69
69
  dispatchMaterializedViews,
70
70
  dispatchMaterializedViewsOnDelete
71
71
  };
72
- //# sourceMappingURL=dispatch-Z6C35BGM.js.map
72
+ //# sourceMappingURL=dispatch-56T7VPGE.js.map
@@ -4,14 +4,14 @@ import {
4
4
  import {
5
5
  putDerivedOutput,
6
6
  selfWriteFieldEqual
7
- } from "./chunk-5CK7VSSK.js";
7
+ } from "./chunk-OPGKH5RD.js";
8
8
  import "./chunk-5D2ALSM5.js";
9
- import "./chunk-PE6R44GS.js";
10
- import "./chunk-SZZEDEIU.js";
9
+ import "./chunk-IQGIPRSE.js";
10
+ import "./chunk-7LLKPODL.js";
11
11
  import "./chunk-RVTOCAHQ.js";
12
- import "./chunk-62KVBIBU.js";
13
- import "./chunk-PWJSO7HH.js";
14
- import "./chunk-P3AFV6EA.js";
12
+ import "./chunk-53PWELSC.js";
13
+ import "./chunk-LTVETWDH.js";
14
+ import "./chunk-6E2JZRBD.js";
15
15
  import "./chunk-FSZPQCDR.js";
16
16
  import "./chunk-HVR74IBG.js";
17
17
  import "./chunk-RBTZLXZJ.js";
@@ -28,7 +28,7 @@ async function dispatchArrayDerivationsOnDelete(ctx, id, eraseRecordShapeToo = f
28
28
  const { derivationSource, collectionName, adapter, vault, getDEK, storeCiphertext } = ctx;
29
29
  const strategies = derivationSource.registry().strategiesForSource(collectionName);
30
30
  if (strategies.length === 0) return 0;
31
- const { loadFanoutSidecar, deleteFanoutSidecar } = await import("./fanout-sidecar-6QGMG5MA.js");
31
+ const { loadFanoutSidecar, deleteFanoutSidecar } = await import("./fanout-sidecar-MT2OBMZB.js");
32
32
  const txCtx = derivationSource.getActiveTxContext();
33
33
  let erased = 0;
34
34
  for (const { spec } of strategies) {
@@ -134,7 +134,7 @@ async function dispatchDerivations(ctx, id, record, version, wave) {
134
134
  const outputCollection = derivationSource.getCollection(outSpec.collection);
135
135
  const txCtx = derivationSource.getActiveTxContext();
136
136
  if (out.kind === "array") {
137
- const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-6QGMG5MA.js");
137
+ const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-MT2OBMZB.js");
138
138
  const prior = await loadFanoutSidecar(adapter, vault, spec.source, run.runId, key, getDEK, storeCiphertext);
139
139
  const prevKeys = new Set(prior?.keys ?? []);
140
140
  const newKeysList = out.entries.map((e) => e.key);
@@ -191,4 +191,4 @@ export {
191
191
  dispatchArrayDerivationsOnDelete,
192
192
  dispatchDerivations
193
193
  };
194
- //# sourceMappingURL=dispatch-4KKOMKWJ.js.map
194
+ //# sourceMappingURL=dispatch-BM5GNCE2.js.map
@@ -23,14 +23,15 @@ import {
23
23
  sealRecordToHost,
24
24
  verifyBrokerProof,
25
25
  writeEnvelopeBody
26
- } from "./chunk-PWJSO7HH.js";
26
+ } from "./chunk-LTVETWDH.js";
27
27
  import {
28
28
  buildDeleteMarker,
29
+ buildRecordEnvelope,
29
30
  buildTombstone,
30
31
  isDeleteMarker,
31
32
  isTombstone,
32
33
  isTombstoneShape
33
- } from "./chunk-P3AFV6EA.js";
34
+ } from "./chunk-6E2JZRBD.js";
34
35
  import {
35
36
  ctEqualTags,
36
37
  deriveVdigSlotKey,
@@ -87,6 +88,7 @@ export {
87
88
  bufferToBase64,
88
89
  buildDeleteMarker,
89
90
  buildRecordAad,
91
+ buildRecordEnvelope,
90
92
  buildTombstone,
91
93
  computeBidxTarget,
92
94
  computeBrokerProof,
@@ -146,4 +148,4 @@ export {
146
148
  wrapKey,
147
149
  writeEnvelopeBody
148
150
  };
149
- //# sourceMappingURL=enclave-KJID436X.js.map
151
+ //# sourceMappingURL=enclave-KDLGVX5Z.js.map