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

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 (307) hide show
  1. package/dist/{api-NAY63UIE.js → api-FRFEJ6WR.js} +6 -6
  2. package/dist/attestation/index.js +12 -12
  3. package/dist/{backup-M2VND2VS.js → backup-OLBRFYY7.js} +10 -10
  4. package/dist/{backup-M2VND2VS.js.map → backup-OLBRFYY7.js.map} +1 -1
  5. package/dist/blobs/index.js +8 -8
  6. package/dist/broker/index.js +6 -6
  7. package/dist/cargo/index.js +26 -26
  8. package/dist/{chunk-4CSG6KBX.js → chunk-2ION5ZRH.js} +17 -14
  9. package/dist/chunk-2ION5ZRH.js.map +1 -0
  10. package/dist/{chunk-466KGOQB.js → chunk-2NE7ILO7.js} +2 -2
  11. package/dist/{chunk-CZV57HHC.js → chunk-3KXIGMZ4.js} +2 -2
  12. package/dist/{chunk-5CH4DWQA.js → chunk-3ODOWQMV.js} +13 -14
  13. package/dist/chunk-3ODOWQMV.js.map +1 -0
  14. package/dist/{chunk-3OEWD45V.js → chunk-3RZ7QLJ4.js} +5 -5
  15. package/dist/{chunk-SFY6NT7D.js → chunk-3Y4OFWQJ.js} +1 -1
  16. package/dist/chunk-3Y4OFWQJ.js.map +1 -0
  17. package/dist/{chunk-FZ2SSI5R.js → chunk-6AL6O4CS.js} +2 -2
  18. package/dist/{chunk-4XEUSZWN.js → chunk-6D3CN2JR.js} +2 -2
  19. package/dist/{chunk-6UAVKAG6.js → chunk-6QCXMCLZ.js} +3 -3
  20. package/dist/{chunk-B4G3JPH5.js → chunk-7EH322GJ.js} +14 -7
  21. package/dist/chunk-7EH322GJ.js.map +1 -0
  22. package/dist/{chunk-AMKCY454.js → chunk-7WD2G6K4.js} +7 -2
  23. package/dist/{chunk-AMKCY454.js.map → chunk-7WD2G6K4.js.map} +1 -1
  24. package/dist/{chunk-VUUUIKRG.js → chunk-A5QQKWCK.js} +14 -23
  25. package/dist/chunk-A5QQKWCK.js.map +1 -0
  26. package/dist/{chunk-RRMXMJUP.js → chunk-AA2WWTS3.js} +9 -7
  27. package/dist/chunk-AA2WWTS3.js.map +1 -0
  28. package/dist/{chunk-WMUN7ZUD.js → chunk-AA7LM2A3.js} +2 -2
  29. package/dist/{chunk-PJGMBELR.js → chunk-AIZNLHKN.js} +4 -4
  30. package/dist/chunk-AIZNLHKN.js.map +1 -0
  31. package/dist/{chunk-MKSTUVMJ.js → chunk-AMMYIT7F.js} +35 -31
  32. package/dist/chunk-AMMYIT7F.js.map +1 -0
  33. package/dist/{chunk-TWPTRJEU.js → chunk-BBU3OD3D.js} +2 -2
  34. package/dist/{chunk-OJEDR25M.js → chunk-BVIGGV6D.js} +33 -45
  35. package/dist/chunk-BVIGGV6D.js.map +1 -0
  36. package/dist/{chunk-IQGIPRSE.js → chunk-CFTPERGL.js} +14 -11
  37. package/dist/chunk-CFTPERGL.js.map +1 -0
  38. package/dist/{chunk-T6CCRXD3.js → chunk-CGQUSSW7.js} +26 -142
  39. package/dist/chunk-CGQUSSW7.js.map +1 -0
  40. package/dist/{chunk-4JDTLWUZ.js → chunk-DFFSCYIW.js} +9 -9
  41. package/dist/{chunk-JZVXGOJE.js → chunk-DKYEVHZH.js} +7 -10
  42. package/dist/chunk-DKYEVHZH.js.map +1 -0
  43. package/dist/{chunk-YVOW35HH.js → chunk-DL4GDOWL.js} +4 -6
  44. package/dist/chunk-DL4GDOWL.js.map +1 -0
  45. package/dist/{chunk-LGGLPURL.js → chunk-DWO55ZWE.js} +13 -22
  46. package/dist/chunk-DWO55ZWE.js.map +1 -0
  47. package/dist/{chunk-MKV2KYRV.js → chunk-ER3BQCCE.js} +2 -2
  48. package/dist/{chunk-JU3JKOY5.js → chunk-EWAGI3EM.js} +2 -2
  49. package/dist/{chunk-WMZQCXZ5.js → chunk-EZ3UHHND.js} +13 -15
  50. package/dist/chunk-EZ3UHHND.js.map +1 -0
  51. package/dist/{chunk-5TF5DUQ5.js → chunk-FDIZHZ3C.js} +29 -47
  52. package/dist/chunk-FDIZHZ3C.js.map +1 -0
  53. package/dist/{chunk-56W3T5O2.js → chunk-FOABWV7L.js} +45 -18
  54. package/dist/chunk-FOABWV7L.js.map +1 -0
  55. package/dist/{chunk-H5U4T6JK.js → chunk-FRGF56PD.js} +11 -14
  56. package/dist/chunk-FRGF56PD.js.map +1 -0
  57. package/dist/{chunk-53PWELSC.js → chunk-FY33DKPH.js} +2 -2
  58. package/dist/{chunk-KKRFL5E2.js → chunk-GSRW5MTU.js} +220 -169
  59. package/dist/chunk-GSRW5MTU.js.map +1 -0
  60. package/dist/{chunk-4VRZDYRE.js → chunk-HJRTFXAA.js} +7 -10
  61. package/dist/chunk-HJRTFXAA.js.map +1 -0
  62. package/dist/chunk-HK67PX4J.js +27 -0
  63. package/dist/chunk-HK67PX4J.js.map +1 -0
  64. package/dist/{chunk-A3WHDOWI.js → chunk-IN5EZWYQ.js} +13 -14
  65. package/dist/chunk-IN5EZWYQ.js.map +1 -0
  66. package/dist/{chunk-PZLIA5R3.js → chunk-ITXPKEDP.js} +23 -29
  67. package/dist/chunk-ITXPKEDP.js.map +1 -0
  68. package/dist/{chunk-343FH4S5.js → chunk-JYFJNSTW.js} +9 -9
  69. package/dist/chunk-JYFJNSTW.js.map +1 -0
  70. package/dist/{chunk-35RIRCGW.js → chunk-KLVGF2D4.js} +11 -9
  71. package/dist/{chunk-35RIRCGW.js.map → chunk-KLVGF2D4.js.map} +1 -1
  72. package/dist/{chunk-7LLKPODL.js → chunk-LPAGIMXJ.js} +2 -2
  73. package/dist/{chunk-3JQVA527.js → chunk-LU6NPJWN.js} +3 -3
  74. package/dist/{chunk-UVFO25FJ.js → chunk-NAAPSNCS.js} +90 -33
  75. package/dist/chunk-NAAPSNCS.js.map +1 -0
  76. package/dist/{chunk-OPGKH5RD.js → chunk-NFPSC2HL.js} +3 -3
  77. package/dist/{chunk-55B3KHZW.js → chunk-NRNTXBHT.js} +7 -10
  78. package/dist/chunk-NRNTXBHT.js.map +1 -0
  79. package/dist/{chunk-I5OLA3H6.js → chunk-O4QDBAB6.js} +7 -10
  80. package/dist/{chunk-I5OLA3H6.js.map → chunk-O4QDBAB6.js.map} +1 -1
  81. package/dist/{chunk-4DJQU3PH.js → chunk-OCCNYGKG.js} +7 -7
  82. package/dist/{chunk-76FBDG6M.js → chunk-OZD3D2DZ.js} +10 -13
  83. package/dist/chunk-OZD3D2DZ.js.map +1 -0
  84. package/dist/{chunk-YX6J3Z3Z.js → chunk-PBPYQZDW.js} +2 -2
  85. package/dist/{chunk-TTAND7MR.js → chunk-PBRIHUQ5.js} +5 -5
  86. package/dist/{chunk-TTAND7MR.js.map → chunk-PBRIHUQ5.js.map} +1 -1
  87. package/dist/{chunk-NBLLQOMR.js → chunk-Q67P7S2I.js} +14 -15
  88. package/dist/chunk-Q67P7S2I.js.map +1 -0
  89. package/dist/{chunk-NY6RQBUN.js → chunk-RAYGDC4A.js} +50 -63
  90. package/dist/chunk-RAYGDC4A.js.map +1 -0
  91. package/dist/{chunk-RVTOCAHQ.js → chunk-SQSZRCYT.js} +1 -1
  92. package/dist/chunk-SQSZRCYT.js.map +1 -0
  93. package/dist/{chunk-JN64WH3U.js → chunk-T7IR4N2S.js} +1 -1
  94. package/dist/{chunk-JN64WH3U.js.map → chunk-T7IR4N2S.js.map} +1 -1
  95. package/dist/{chunk-THUITYH7.js → chunk-TNOQNU3R.js} +5 -4
  96. package/dist/{chunk-THUITYH7.js.map → chunk-TNOQNU3R.js.map} +1 -1
  97. package/dist/{chunk-TY6N3PAC.js → chunk-TXDOMADN.js} +9 -6
  98. package/dist/chunk-TXDOMADN.js.map +1 -0
  99. package/dist/{chunk-6EF3N2MH.js → chunk-U6D5XTI5.js} +13 -13
  100. package/dist/{chunk-6EF3N2MH.js.map → chunk-U6D5XTI5.js.map} +1 -1
  101. package/dist/{chunk-HNX47VTC.js → chunk-UE72AQDZ.js} +6 -6
  102. package/dist/chunk-UIYZ5SOU.js +190 -0
  103. package/dist/chunk-UIYZ5SOU.js.map +1 -0
  104. package/dist/{chunk-IGE6XWKK.js → chunk-VXVKEWYC.js} +3 -3
  105. package/dist/{chunk-LTVETWDH.js → chunk-X3AXSYBL.js} +217 -123
  106. package/dist/chunk-X3AXSYBL.js.map +1 -0
  107. package/dist/{chunk-AD2PJGSS.js → chunk-ZDATYUYG.js} +2 -2
  108. package/dist/{chunk-LJDW6LQJ.js → chunk-ZSOTZ2RZ.js} +41 -24
  109. package/dist/chunk-ZSOTZ2RZ.js.map +1 -0
  110. package/dist/{chunk-6E2JZRBD.js → chunk-ZVAFJQZB.js} +25 -19
  111. package/dist/chunk-ZVAFJQZB.js.map +1 -0
  112. package/dist/classified/index.js +4 -4
  113. package/dist/{classified-marker-L7LXKS6Q.js → classified-marker-GWQTNDSL.js} +3 -3
  114. package/dist/{collection-facade-KN3UFKZ4.js → collection-facade-56RTPO4G.js} +12 -12
  115. package/dist/consent/index.js +4 -4
  116. package/dist/cover/index.js +9 -2
  117. package/dist/custody/index.js +6 -6
  118. package/dist/{dead-filter-6HG5FP3I.js → dead-filter-XP7MPHCJ.js} +2 -2
  119. package/dist/{delegation-7EGBYBRN.js → delegation-Q3HEAVLA.js} +18 -19
  120. package/dist/delegation-Q3HEAVLA.js.map +1 -0
  121. package/dist/derivations/index.js +3 -3
  122. package/dist/{derive-XKAYJ2OA.js → derive-SVDY36ER.js} +4 -4
  123. package/dist/directory/index.js +5 -5
  124. package/dist/{dispatch-56T7VPGE.js → dispatch-MG5KNMWG.js} +5 -5
  125. package/dist/{dispatch-BM5GNCE2.js → dispatch-RVJQ4BOL.js} +11 -11
  126. package/dist/{enclave-KDLGVX5Z.js → enclave-AOZTWFZK.js} +16 -4
  127. package/dist/{executor-LFHRV6JH.js → executor-FRUVM36Q.js} +12 -12
  128. package/dist/{export-accessible-HFBJ4JJY.js → export-accessible-HDDHZYPM.js} +7 -7
  129. package/dist/{extract-partition-7ZRFN6QP.js → extract-partition-TRADP234.js} +12 -12
  130. package/dist/{fanout-sidecar-MT2OBMZB.js → fanout-sidecar-NZA6J7QB.js} +13 -22
  131. package/dist/fanout-sidecar-NZA6J7QB.js.map +1 -0
  132. package/dist/forget/index.js +4 -4
  133. package/dist/history/index.js +18 -15
  134. package/dist/history/index.js.map +1 -1
  135. package/dist/i18n/index.js +9 -9
  136. package/dist/index.d.ts +16 -0
  137. package/dist/index.js +129 -127
  138. package/dist/index.js.map +1 -1
  139. package/dist/introspection/index.js +5 -5
  140. package/dist/{issue-LCOOEH45.js → issue-GZQDW5TQ.js} +6 -6
  141. package/dist/kernel/enclave/index.d.ts +7 -5
  142. package/dist/kernel/enclave/record-aad.d.ts +79 -7
  143. package/dist/kernel/enclave/record-envelope.d.ts +54 -7
  144. package/dist/kernel/enclave/record-keys/envelope-body.d.ts +34 -2
  145. package/dist/kernel/enclave/record-keys/lifecycle.d.ts +22 -5
  146. package/dist/kernel/enclave/record-keys/record-codec.d.ts +47 -14
  147. package/dist/kernel/enclave/record-keys/rekey.d.ts +68 -0
  148. package/dist/kernel/enclave/record-keys/tombstone.d.ts +3 -3
  149. package/dist/kernel/merge-authority.d.ts +25 -0
  150. package/dist/kernel/tier-visibility.d.ts +15 -0
  151. package/dist/kernel/types.d.ts +23 -0
  152. package/dist/kernel/vault.d.ts +1 -1
  153. package/dist/kernel/via/index.d.ts +11 -2
  154. package/dist/{ledger-6IHXJHDD.js → ledger-KQAJPEMZ.js} +6 -6
  155. package/dist/liberate-Z2EXJY2S.js +24 -0
  156. package/dist/{link-set-XRVHGYWC.js → link-set-XKN5V7VM.js} +5 -5
  157. package/dist/{managed-secret-IDAOXSSX.js → managed-secret-7WIIVMJ5.js} +11 -3
  158. package/dist/materialized-views/index.js +14 -14
  159. package/dist/money/index.js +3 -3
  160. package/dist/{noydb-M5WII7RP.js → noydb-NPW3C2EX.js} +39 -38
  161. package/dist/periods/index.js +6 -6
  162. package/dist/pod/index.js +42 -41
  163. package/dist/{pod-handle-BYUSBXCT.js → pod-handle-SKDKRPOR.js} +6 -6
  164. package/dist/{pod-handle-BYUSBXCT.js.map → pod-handle-SKDKRPOR.js.map} +1 -1
  165. package/dist/policy/index.js +10 -3
  166. package/dist/port/with/merge-authority.d.ts +52 -0
  167. package/dist/port/with/strategies.d.ts +2 -0
  168. package/dist/portability/index.js +6 -6
  169. package/dist/{post-register-O3YW6CGS.js → post-register-CVS7CCJE.js} +4 -4
  170. package/dist/reduce/index.js +3 -3
  171. package/dist/{register-XHOOX37G.js → register-GJ6PW4KP.js} +10 -10
  172. package/dist/{registry-OFMM4WAC.js → registry-6LUJ5IJW.js} +4 -4
  173. package/dist/{registry-CYAFB35H.js → registry-KI77RVK7.js} +4 -4
  174. package/dist/{request-withdrawal-GCE2SLNW.js → request-withdrawal-LICOUGXG.js} +9 -9
  175. package/dist/{reveal-UHBP5IH3.js → reveal-PWM47FQN.js} +3 -3
  176. package/dist/{revoke-6KY4VGZY.js → revoke-AWZKZLZB.js} +6 -6
  177. package/dist/sealed-record/index.js +14 -7
  178. package/dist/sealed-record/index.js.map +1 -1
  179. package/dist/search/index.js +3 -3
  180. package/dist/{seed-DGLQTCIO.js → seed-LNTLU2A3.js} +14 -17
  181. package/dist/seed-LNTLU2A3.js.map +1 -0
  182. package/dist/sequence/index.js +4 -4
  183. package/dist/session/index.js +3 -3
  184. package/dist/{signer-SLOMB6HS.js → signer-JE6NEURY.js} +5 -5
  185. package/dist/snapshots/index.js +5 -5
  186. package/dist/{stale-26ZJLNLG.js → stale-ZWTKUVZX.js} +5 -5
  187. package/dist/{storage-N3IMFNGS.js → storage-WCZOCA46.js} +5 -5
  188. package/dist/{store-coordination-provider-RGHCIRWV.js → store-coordination-provider-7H62VO2C.js} +18 -12
  189. package/dist/store-coordination-provider-7H62VO2C.js.map +1 -0
  190. package/dist/sync/index.js +5 -5
  191. package/dist/team/index.js +10 -9
  192. package/dist/tiers/index.js +6 -5
  193. package/dist/vault-head/index.js +111 -0
  194. package/dist/vault-head/index.js.map +1 -0
  195. package/dist/{walk-B4YFJJ7S.js → walk-HSS3NLQ3.js} +6 -6
  196. package/dist/with-audit/periods/periods.d.ts +1 -1
  197. package/dist/with-audit/periods/strategy.d.ts +1 -1
  198. package/dist/with-audit/sealed-record/index.d.ts +13 -0
  199. package/dist/with-audit/tiers/index.d.ts +17 -2
  200. package/dist/with-commit/history/history.d.ts +26 -0
  201. package/dist/with-commit/history/index.d.ts +2 -1
  202. package/dist/with-commit/history/ledger/store.d.ts +7 -1
  203. package/dist/with-commit/history/strategy.d.ts +11 -1
  204. package/dist/with-commit/vault-head/active.d.ts +2 -0
  205. package/dist/with-commit/vault-head/head.d.ts +28 -0
  206. package/dist/with-commit/vault-head/index.d.ts +10 -0
  207. package/dist/with-commit/vault-head/strategy.d.ts +127 -0
  208. package/dist/with-commit/vault-head/verify.d.ts +50 -0
  209. package/dist/with-party/directory/cover/storage.d.ts +0 -8
  210. package/dist/with-party/directory/storage.d.ts +0 -11
  211. package/dist/with-party/directory/visibility.d.ts +0 -21
  212. package/dist/with-party/policy/storage.d.ts +0 -10
  213. package/dist/with-party/team/keyring.d.ts +5 -0
  214. package/dist/with-party/team/tiers.d.ts +2 -1
  215. package/dist/with-sync/engine.d.ts +33 -5
  216. package/dist/with-sync/strategy.d.ts +3 -0
  217. package/dist/{withdraw-accessible-OYG7YZUR.js → withdraw-accessible-GHBA4DAA.js} +8 -8
  218. package/package.json +7 -3
  219. package/dist/chunk-343FH4S5.js.map +0 -1
  220. package/dist/chunk-4CSG6KBX.js.map +0 -1
  221. package/dist/chunk-4VRZDYRE.js.map +0 -1
  222. package/dist/chunk-55B3KHZW.js.map +0 -1
  223. package/dist/chunk-56W3T5O2.js.map +0 -1
  224. package/dist/chunk-5CH4DWQA.js.map +0 -1
  225. package/dist/chunk-5TF5DUQ5.js.map +0 -1
  226. package/dist/chunk-6E2JZRBD.js.map +0 -1
  227. package/dist/chunk-76FBDG6M.js.map +0 -1
  228. package/dist/chunk-A3WHDOWI.js.map +0 -1
  229. package/dist/chunk-AFHQATY4.js +0 -47
  230. package/dist/chunk-AFHQATY4.js.map +0 -1
  231. package/dist/chunk-B4G3JPH5.js.map +0 -1
  232. package/dist/chunk-H5U4T6JK.js.map +0 -1
  233. package/dist/chunk-IQGIPRSE.js.map +0 -1
  234. package/dist/chunk-JZVXGOJE.js.map +0 -1
  235. package/dist/chunk-KKRFL5E2.js.map +0 -1
  236. package/dist/chunk-LGGLPURL.js.map +0 -1
  237. package/dist/chunk-LJDW6LQJ.js.map +0 -1
  238. package/dist/chunk-LTVETWDH.js.map +0 -1
  239. package/dist/chunk-MKSTUVMJ.js.map +0 -1
  240. package/dist/chunk-NBLLQOMR.js.map +0 -1
  241. package/dist/chunk-NY6RQBUN.js.map +0 -1
  242. package/dist/chunk-OJEDR25M.js.map +0 -1
  243. package/dist/chunk-PJGMBELR.js.map +0 -1
  244. package/dist/chunk-PZLIA5R3.js.map +0 -1
  245. package/dist/chunk-RRMXMJUP.js.map +0 -1
  246. package/dist/chunk-RVTOCAHQ.js.map +0 -1
  247. package/dist/chunk-SFY6NT7D.js.map +0 -1
  248. package/dist/chunk-T6CCRXD3.js.map +0 -1
  249. package/dist/chunk-TY6N3PAC.js.map +0 -1
  250. package/dist/chunk-UVFO25FJ.js.map +0 -1
  251. package/dist/chunk-VUUUIKRG.js.map +0 -1
  252. package/dist/chunk-WMZQCXZ5.js.map +0 -1
  253. package/dist/chunk-YVOW35HH.js.map +0 -1
  254. package/dist/delegation-7EGBYBRN.js.map +0 -1
  255. package/dist/fanout-sidecar-MT2OBMZB.js.map +0 -1
  256. package/dist/liberate-UEYC4QLJ.js +0 -24
  257. package/dist/seed-DGLQTCIO.js.map +0 -1
  258. package/dist/store-coordination-provider-RGHCIRWV.js.map +0 -1
  259. /package/dist/{api-NAY63UIE.js.map → api-FRFEJ6WR.js.map} +0 -0
  260. /package/dist/{chunk-466KGOQB.js.map → chunk-2NE7ILO7.js.map} +0 -0
  261. /package/dist/{chunk-CZV57HHC.js.map → chunk-3KXIGMZ4.js.map} +0 -0
  262. /package/dist/{chunk-3OEWD45V.js.map → chunk-3RZ7QLJ4.js.map} +0 -0
  263. /package/dist/{chunk-FZ2SSI5R.js.map → chunk-6AL6O4CS.js.map} +0 -0
  264. /package/dist/{chunk-4XEUSZWN.js.map → chunk-6D3CN2JR.js.map} +0 -0
  265. /package/dist/{chunk-6UAVKAG6.js.map → chunk-6QCXMCLZ.js.map} +0 -0
  266. /package/dist/{chunk-WMUN7ZUD.js.map → chunk-AA7LM2A3.js.map} +0 -0
  267. /package/dist/{chunk-TWPTRJEU.js.map → chunk-BBU3OD3D.js.map} +0 -0
  268. /package/dist/{chunk-4JDTLWUZ.js.map → chunk-DFFSCYIW.js.map} +0 -0
  269. /package/dist/{chunk-MKV2KYRV.js.map → chunk-ER3BQCCE.js.map} +0 -0
  270. /package/dist/{chunk-JU3JKOY5.js.map → chunk-EWAGI3EM.js.map} +0 -0
  271. /package/dist/{chunk-53PWELSC.js.map → chunk-FY33DKPH.js.map} +0 -0
  272. /package/dist/{chunk-7LLKPODL.js.map → chunk-LPAGIMXJ.js.map} +0 -0
  273. /package/dist/{chunk-3JQVA527.js.map → chunk-LU6NPJWN.js.map} +0 -0
  274. /package/dist/{chunk-OPGKH5RD.js.map → chunk-NFPSC2HL.js.map} +0 -0
  275. /package/dist/{chunk-4DJQU3PH.js.map → chunk-OCCNYGKG.js.map} +0 -0
  276. /package/dist/{chunk-YX6J3Z3Z.js.map → chunk-PBPYQZDW.js.map} +0 -0
  277. /package/dist/{chunk-HNX47VTC.js.map → chunk-UE72AQDZ.js.map} +0 -0
  278. /package/dist/{chunk-IGE6XWKK.js.map → chunk-VXVKEWYC.js.map} +0 -0
  279. /package/dist/{chunk-AD2PJGSS.js.map → chunk-ZDATYUYG.js.map} +0 -0
  280. /package/dist/{classified-marker-L7LXKS6Q.js.map → classified-marker-GWQTNDSL.js.map} +0 -0
  281. /package/dist/{collection-facade-KN3UFKZ4.js.map → collection-facade-56RTPO4G.js.map} +0 -0
  282. /package/dist/{dead-filter-6HG5FP3I.js.map → dead-filter-XP7MPHCJ.js.map} +0 -0
  283. /package/dist/{derive-XKAYJ2OA.js.map → derive-SVDY36ER.js.map} +0 -0
  284. /package/dist/{dispatch-56T7VPGE.js.map → dispatch-MG5KNMWG.js.map} +0 -0
  285. /package/dist/{dispatch-BM5GNCE2.js.map → dispatch-RVJQ4BOL.js.map} +0 -0
  286. /package/dist/{enclave-KDLGVX5Z.js.map → enclave-AOZTWFZK.js.map} +0 -0
  287. /package/dist/{executor-LFHRV6JH.js.map → executor-FRUVM36Q.js.map} +0 -0
  288. /package/dist/{export-accessible-HFBJ4JJY.js.map → export-accessible-HDDHZYPM.js.map} +0 -0
  289. /package/dist/{extract-partition-7ZRFN6QP.js.map → extract-partition-TRADP234.js.map} +0 -0
  290. /package/dist/{issue-LCOOEH45.js.map → issue-GZQDW5TQ.js.map} +0 -0
  291. /package/dist/{ledger-6IHXJHDD.js.map → ledger-KQAJPEMZ.js.map} +0 -0
  292. /package/dist/{liberate-UEYC4QLJ.js.map → liberate-Z2EXJY2S.js.map} +0 -0
  293. /package/dist/{link-set-XRVHGYWC.js.map → link-set-XKN5V7VM.js.map} +0 -0
  294. /package/dist/{managed-secret-IDAOXSSX.js.map → managed-secret-7WIIVMJ5.js.map} +0 -0
  295. /package/dist/{noydb-M5WII7RP.js.map → noydb-NPW3C2EX.js.map} +0 -0
  296. /package/dist/{post-register-O3YW6CGS.js.map → post-register-CVS7CCJE.js.map} +0 -0
  297. /package/dist/{register-XHOOX37G.js.map → register-GJ6PW4KP.js.map} +0 -0
  298. /package/dist/{registry-CYAFB35H.js.map → registry-6LUJ5IJW.js.map} +0 -0
  299. /package/dist/{registry-OFMM4WAC.js.map → registry-KI77RVK7.js.map} +0 -0
  300. /package/dist/{request-withdrawal-GCE2SLNW.js.map → request-withdrawal-LICOUGXG.js.map} +0 -0
  301. /package/dist/{reveal-UHBP5IH3.js.map → reveal-PWM47FQN.js.map} +0 -0
  302. /package/dist/{revoke-6KY4VGZY.js.map → revoke-AWZKZLZB.js.map} +0 -0
  303. /package/dist/{signer-SLOMB6HS.js.map → signer-JE6NEURY.js.map} +0 -0
  304. /package/dist/{stale-26ZJLNLG.js.map → stale-ZWTKUVZX.js.map} +0 -0
  305. /package/dist/{storage-N3IMFNGS.js.map → storage-WCZOCA46.js.map} +0 -0
  306. /package/dist/{walk-B4YFJJ7S.js.map → walk-HSS3NLQ3.js.map} +0 -0
  307. /package/dist/{withdraw-accessible-OYG7YZUR.js.map → withdraw-accessible-GHBA4DAA.js.map} +0 -0
@@ -1,3 +1,10 @@
1
+ import {
2
+ LinkIntegrityError,
3
+ declareLink,
4
+ isLinkCollectionName,
5
+ linkCollectionName,
6
+ linkRowKey
7
+ } from "./chunk-S6CP5FWF.js";
1
8
  import {
2
9
  hashFields,
3
10
  validateSatelliteDeclaration
@@ -9,38 +16,42 @@ import {
9
16
  isManifestReservedCollection
10
17
  } from "./chunk-EPFF7LOX.js";
11
18
  import {
12
- LinkIntegrityError,
13
- declareLink,
14
- isLinkCollectionName,
15
- linkCollectionName,
16
- linkRowKey
17
- } from "./chunk-S6CP5FWF.js";
19
+ VectorSet,
20
+ buildPersistedIndexCallbacks,
21
+ encodeVecId,
22
+ syncTierSearch
23
+ } from "./chunk-JYFJNSTW.js";
18
24
  import {
19
25
  isBaseLive,
20
26
  liveBaseIdSet
21
27
  } from "./chunk-GYGLAVCX.js";
22
28
  import {
23
29
  loadFence
24
- } from "./chunk-4VRZDYRE.js";
30
+ } from "./chunk-HJRTFXAA.js";
25
31
  import {
26
- VectorSet,
27
- buildPersistedIndexCallbacks,
28
- encodeVecId,
29
- syncTierSearch
30
- } from "./chunk-343FH4S5.js";
32
+ fallbackDerivationName,
33
+ jsonSchemaToFields
34
+ } from "./chunk-KHKKD62N.js";
35
+ import {
36
+ derivePersistedSchema,
37
+ isZod4Schema
38
+ } from "./chunk-HNOBRU24.js";
31
39
  import {
32
40
  SchemaUpdateGate
33
41
  } from "./chunk-6LJY7X5A.js";
42
+ import {
43
+ NO_ATTESTATION
44
+ } from "./chunk-TQLYMYOK.js";
34
45
  import {
35
46
  NO_CLASSIFIED,
36
47
  guardClassifiedCompat,
37
48
  resolveClassifiedFields
38
- } from "./chunk-6UAVKAG6.js";
49
+ } from "./chunk-6QCXMCLZ.js";
39
50
  import {
40
51
  NO_TIERS,
41
52
  classifySealedShred,
42
53
  syncDerivedOutputs
43
- } from "./chunk-UVFO25FJ.js";
54
+ } from "./chunk-NAAPSNCS.js";
44
55
  import {
45
56
  NO_PORTABILITY
46
57
  } from "./chunk-TQ7IRULX.js";
@@ -50,22 +61,20 @@ import {
50
61
  } from "./chunk-42IDLU5V.js";
51
62
  import {
52
63
  saveSealedSecret
53
- } from "./chunk-55B3KHZW.js";
54
- import {
55
- fallbackDerivationName,
56
- jsonSchemaToFields
57
- } from "./chunk-KHKKD62N.js";
58
- import {
59
- derivePersistedSchema,
60
- isZod4Schema
61
- } from "./chunk-HNOBRU24.js";
64
+ } from "./chunk-NRNTXBHT.js";
62
65
  import {
63
66
  loadPersistedSchema
64
- } from "./chunk-A3WHDOWI.js";
67
+ } from "./chunk-IN5EZWYQ.js";
68
+ import {
69
+ NO_SEQUENCE,
70
+ SEQUENCE_COLLECTION,
71
+ compileSequenceFormat,
72
+ resolveSequenceKey
73
+ } from "./chunk-AA2WWTS3.js";
65
74
  import {
66
75
  CustodyApi,
67
76
  NO_CUSTODY
68
- } from "./chunk-IGE6XWKK.js";
77
+ } from "./chunk-VXVKEWYC.js";
69
78
  import {
70
79
  DEFAULT_POSTURE,
71
80
  ViaGraph
@@ -93,17 +102,14 @@ import {
93
102
  selfWriteFieldEqual,
94
103
  touchFor,
95
104
  updateReferencingRecords
96
- } from "./chunk-OPGKH5RD.js";
105
+ } from "./chunk-NFPSC2HL.js";
97
106
  import {
98
107
  OverlayedCollection
99
108
  } from "./chunk-RDPZMUCX.js";
100
109
  import {
101
110
  INDEXED_STORE_POLICY,
102
111
  NO_SYNC
103
- } from "./chunk-JN64WH3U.js";
104
- import {
105
- NO_ATTESTATION
106
- } from "./chunk-TQLYMYOK.js";
112
+ } from "./chunk-T7IR4N2S.js";
107
113
  import {
108
114
  NO_CONSENT
109
115
  } from "./chunk-PEOZ34EM.js";
@@ -114,7 +120,7 @@ import {
114
120
  resolvePeriodKey,
115
121
  resolveReopenState,
116
122
  samePartition
117
- } from "./chunk-TTAND7MR.js";
123
+ } from "./chunk-PBRIHUQ5.js";
118
124
  import {
119
125
  PERIODS_COLLECTION,
120
126
  PERIOD_ARCHIVES_COLLECTION,
@@ -140,13 +146,10 @@ import {
140
146
  InvertedIndex,
141
147
  MemoryIndexStore,
142
148
  NO_SEARCH
143
- } from "./chunk-4JDTLWUZ.js";
149
+ } from "./chunk-DFFSCYIW.js";
144
150
  import {
145
- NO_SEQUENCE,
146
- SEQUENCE_COLLECTION,
147
- compileSequenceFormat,
148
- resolveSequenceKey
149
- } from "./chunk-RRMXMJUP.js";
151
+ NO_SEALED_RECORD
152
+ } from "./chunk-QLMUW7OC.js";
150
153
  import {
151
154
  Query,
152
155
  ScanBuilder
@@ -156,7 +159,7 @@ import {
156
159
  NO_BLOBS,
157
160
  createExportBlobsHandle,
158
161
  runCompaction
159
- } from "./chunk-LGGLPURL.js";
162
+ } from "./chunk-DWO55ZWE.js";
160
163
  import {
161
164
  LazyQuery,
162
165
  NO_INDEXING,
@@ -185,7 +188,7 @@ import {
185
188
  } from "./chunk-PVEWA2DU.js";
186
189
  import {
187
190
  dictCollectionName
188
- } from "./chunk-IQGIPRSE.js";
191
+ } from "./chunk-CFTPERGL.js";
189
192
  import {
190
193
  NO_I18N,
191
194
  getAtPath,
@@ -193,11 +196,11 @@ import {
193
196
  isDictKeyDescriptor,
194
197
  isI18nTextDescriptor,
195
198
  isStaticDictDescriptor
196
- } from "./chunk-7LLKPODL.js";
199
+ } from "./chunk-LPAGIMXJ.js";
197
200
  import {
198
201
  isViaInstalled,
199
202
  viaBinder
200
- } from "./chunk-RVTOCAHQ.js";
203
+ } from "./chunk-SQSZRCYT.js";
201
204
  import {
202
205
  NO_TEAM,
203
206
  describeAllUsersAuth,
@@ -220,7 +223,7 @@ import {
220
223
  saveShamirRecoveryEntries,
221
224
  updateAuthenticator,
222
225
  writeMagicLinkGrant
223
- } from "./chunk-OJEDR25M.js";
226
+ } from "./chunk-BVIGGV6D.js";
224
227
  import {
225
228
  assertKeyringOpenAllowed,
226
229
  buildRecipientKeyringFile,
@@ -235,11 +238,11 @@ import {
235
238
  listUsers,
236
239
  loadKeyring,
237
240
  updateKeyringIdentity
238
- } from "./chunk-LJDW6LQJ.js";
241
+ } from "./chunk-ZSOTZ2RZ.js";
239
242
  import {
240
243
  persistDirectoryConfig,
241
244
  readDirectoryConfig
242
- } from "./chunk-PZLIA5R3.js";
245
+ } from "./chunk-ITXPKEDP.js";
243
246
  import {
244
247
  NO_BROKER,
245
248
  buildCredentialBrokerHandle
@@ -252,15 +255,19 @@ import {
252
255
  } from "./chunk-4AOERLTV.js";
253
256
  import {
254
257
  NO_HISTORY
255
- } from "./chunk-AFHQATY4.js";
258
+ } from "./chunk-UIYZ5SOU.js";
259
+ import {
260
+ sha256Hex
261
+ } from "./chunk-FY33DKPH.js";
256
262
  import {
257
263
  assertCutoverTierSafe,
258
264
  assertTierWritable,
265
+ dekKey,
259
266
  liveRecordIsElevated
260
- } from "./chunk-AMKCY454.js";
267
+ } from "./chunk-7WD2G6K4.js";
261
268
  import {
262
- sha256Hex
263
- } from "./chunk-53PWELSC.js";
269
+ NO_VAULT_HEAD
270
+ } from "./chunk-HK67PX4J.js";
264
271
  import {
265
272
  NO_FORGET,
266
273
  addSubjectRef,
@@ -269,35 +276,36 @@ import {
269
276
  readDottedPath,
270
277
  rebuildSubjectIndex,
271
278
  removeSubjectRef
272
- } from "./chunk-35RIRCGW.js";
273
- import {
274
- NO_SEALED_RECORD
275
- } from "./chunk-QLMUW7OC.js";
279
+ } from "./chunk-KLVGF2D4.js";
276
280
  import {
277
281
  RecordCodec,
278
282
  SEALED_CEK_NS,
283
+ applyRewrappedBody,
284
+ buildRecordAad,
279
285
  findByDet,
280
286
  hasPerRecordKey,
287
+ hasSealedBody,
281
288
  makeReservedEnvelopes,
282
289
  openEnvelopeJson,
283
290
  queryByDet,
284
291
  resolveStableCek,
285
- validateSchemaInput
286
- } from "./chunk-LTVETWDH.js";
292
+ rewrapBodyToDek,
293
+ validateSchemaInput,
294
+ verifyRecordIdentity
295
+ } from "./chunk-X3AXSYBL.js";
287
296
  import {
288
297
  buildDeleteMarker,
289
298
  buildRecordEnvelope,
290
299
  buildTombstone,
291
300
  isDeleteMarker,
292
301
  isTombstone
293
- } from "./chunk-6E2JZRBD.js";
302
+ } from "./chunk-ZVAFJQZB.js";
294
303
  import {
295
304
  encrypt
296
305
  } from "./chunk-QTDAPDDV.js";
297
306
  import {
298
- NOYDB_FORMAT_VERSION,
299
307
  SealedHandle
300
- } from "./chunk-SFY6NT7D.js";
308
+ } from "./chunk-3Y4OFWQJ.js";
301
309
  import {
302
310
  AlreadyElevatedError,
303
311
  AttestationError,
@@ -342,6 +350,35 @@ import {
342
350
  isConflictError
343
351
  } from "./chunk-I64WQSN3.js";
344
352
 
353
+ // src/kernel/merge-authority.ts
354
+ function buildMergeAuthority(keyring) {
355
+ return {
356
+ verify: async (collection, id, envelope) => {
357
+ const dek = keyring.deks.get(dekKey(collection, envelope._tier ?? 0));
358
+ if (dek === void 0) return true;
359
+ return verifyRecordIdentity({ collection, id }, envelope, dek);
360
+ },
361
+ advance: async (collection, id, envelope, toVersion) => {
362
+ if (!hasSealedBody(envelope)) return { ...envelope, _v: toVersion };
363
+ const dek = keyring.deks.get(dekKey(collection, envelope._tier ?? 0));
364
+ if (dek === void 0) {
365
+ throw new ValidationError(
366
+ `sync: cannot advance "${collection}/${id}" past the remote \u2014 no key for it, so its body cannot be re-sealed at the new version. The local copy is unchanged.`
367
+ );
368
+ }
369
+ const from = {
370
+ collection,
371
+ id,
372
+ version: envelope._v,
373
+ ...envelope._tier !== void 0 ? { tier: envelope._tier } : {},
374
+ ...envelope._by !== void 0 ? { by: envelope._by } : {}
375
+ };
376
+ const body = await rewrapBodyToDek(from, { ...from, version: toVersion }, envelope, dek, dek);
377
+ return { ...applyRewrappedBody(envelope, body), _v: toVersion };
378
+ }
379
+ };
380
+ }
381
+
345
382
  // src/with-commit/tx/strategy.ts
346
383
  var NOT_ENABLED = new Error(
347
384
  'Multi-record transactions require the tx strategy. Import `{ withTransactions }` from "@noy-db/hub/transactions" and pass it to `createNoydb({ transactionsStrategy: withTransactions() })`.'
@@ -377,6 +414,7 @@ var STRATEGY_DEFAULTS = {
377
414
  custody: NO_CUSTODY,
378
415
  forget: NO_FORGET,
379
416
  history: NO_HISTORY,
417
+ vaultHead: NO_VAULT_HEAD,
380
418
  i18n: NO_I18N,
381
419
  indexing: NO_INDEXING,
382
420
  lazy: IMPLICIT_LAZY,
@@ -470,7 +508,7 @@ function validateSecretModeOptions(options) {
470
508
  }
471
509
  async function resolveEffectiveSecret(options, store, vault) {
472
510
  if (options.secretMode === "managed") {
473
- const { resolveManagedSecret } = await import("./managed-secret-IDAOXSSX.js");
511
+ const { resolveManagedSecret } = await import("./managed-secret-7WIIVMJ5.js");
474
512
  return resolveManagedSecret(store, vault, options.sealingKey);
475
513
  }
476
514
  return options.secret;
@@ -488,7 +526,7 @@ function ownerKeyringOptions(options, secret) {
488
526
 
489
527
  // src/port/by/default-provider.ts
490
528
  async function createDefaultCoordinationProvider(store) {
491
- const { StoreCoordinationProvider } = await import("./store-coordination-provider-RGHCIRWV.js");
529
+ const { StoreCoordinationProvider } = await import("./store-coordination-provider-7H62VO2C.js");
492
530
  return new StoreCoordinationProvider(store);
493
531
  }
494
532
 
@@ -943,13 +981,13 @@ async function applyCutoverTransform(ctx) {
943
981
  for (const id of ids) {
944
982
  const env = await ctx.adapter.get(ctx.vault, ctx.name, id);
945
983
  if (!env || isTombstone(env, ctx.storeCiphertext) || isDeleteMarker(env)) continue;
946
- const decoded = await ctx.codec.decryptRecord(env, { skipValidation: true, id });
984
+ const decoded = await ctx.codec.decryptRecord({ collection: ctx.name, id }, env, { skipValidation: true });
947
985
  if (decoded === null) continue;
948
986
  const record = decoded;
949
987
  const next = ctx.transform(record);
950
988
  const nextVersion = (env._v ?? 0) + 1;
951
989
  const cek = ctx.perRecordCek ? await ctx.resolveRecordCek(id) : void 0;
952
- const migEnvelope = await ctx.codec.encryptRecord(next, nextVersion, cek, void 0, void 0, ctx.vdigFields !== null ? { id, prev: env } : void 0, id);
990
+ const migEnvelope = await ctx.codec.encryptRecord({ collection: ctx.name, id }, next, nextVersion, cek, void 0, void 0, ctx.vdigFields !== null ? { id, prev: env } : void 0);
953
991
  await ctx.adapter.put(ctx.vault, ctx.name, id, migEnvelope);
954
992
  await ctx.onRecordMutated(id, "put", "cutover");
955
993
  if (ctx.ledger) {
@@ -1055,7 +1093,7 @@ async function rebuildIndexes(ctx) {
1055
1093
  const envelope = await ctx.adapter.get(ctx.vault, ctx.name, recordId);
1056
1094
  if (!envelope) continue;
1057
1095
  if ((envelope._tier ?? 0) > 0) continue;
1058
- const record = await ctx.codec.decryptRecord(envelope, { skipValidation: true, id: recordId });
1096
+ const record = await ctx.codec.decryptRecord({ collection: ctx.name, id: recordId }, envelope, { skipValidation: true });
1059
1097
  if (record === null) continue;
1060
1098
  await maintainPersistedIndexesOnPut(ctx, recordId, record, null, envelope._v);
1061
1099
  }
@@ -1089,7 +1127,7 @@ async function reconcileIndex(ctx, field, opts = {}) {
1089
1127
  const env = await ctx.adapter.get(ctx.vault, ctx.name, id);
1090
1128
  if (!env) continue;
1091
1129
  try {
1092
- const sidecarJson = await ctx.codec.decryptJsonString(env);
1130
+ const sidecarJson = await ctx.codec.decryptJsonString({ collection: ctx.name, id }, env);
1093
1131
  if (sidecarJson === null) {
1094
1132
  sidecar.set(decoded.recordId, void 0);
1095
1133
  } else {
@@ -1109,7 +1147,7 @@ async function reconcileIndex(ctx, field, opts = {}) {
1109
1147
  const env = await ctx.adapter.get(ctx.vault, ctx.name, id);
1110
1148
  if (!env) continue;
1111
1149
  if ((env._tier ?? 0) > 0) continue;
1112
- const record = await ctx.codec.decryptRecord(env, { skipValidation: true, id });
1150
+ const record = await ctx.codec.decryptRecord({ collection: ctx.name, id }, env, { skipValidation: true });
1113
1151
  if (record === null) continue;
1114
1152
  const live = readPersistedValue(record, field);
1115
1153
  const stored = sidecar.get(id);
@@ -1170,7 +1208,7 @@ async function maintainPersistedIndexesOnPut(ctx, id, newRecord, previousRecord,
1170
1208
  recordId: id,
1171
1209
  writtenAt: (/* @__PURE__ */ new Date()).toISOString()
1172
1210
  });
1173
- const envelope = await ctx.codec.encryptJsonString(body, version);
1211
+ const envelope = await ctx.codec.encryptJsonString({ collection: ctx.name, id: idxId }, body, version);
1174
1212
  await ctx.adapter.put(ctx.vault, ctx.name, idxId, envelope);
1175
1213
  }
1176
1214
  } catch (cause) {
@@ -1239,7 +1277,7 @@ async function resolveTierSyncPrior(ctx, id, priorEnvelope) {
1239
1277
  const cached = ctx.cache.get(id)?.record;
1240
1278
  if (cached !== void 0) return cached;
1241
1279
  if (!ctx.lazy || !priorEnvelope || (priorEnvelope._tier ?? 0) > 0) return null;
1242
- return await ctx.codec.decryptRecord(priorEnvelope, { skipValidation: true, id });
1280
+ return await ctx.codec.decryptRecord({ collection: ctx.name, id }, priorEnvelope, { skipValidation: true });
1243
1281
  }
1244
1282
 
1245
1283
  // src/with-lookup/search/serialize.ts
@@ -2878,14 +2916,14 @@ var Collection = class {
2878
2916
  if (crdtMode === "yjs") {
2879
2917
  return local._v >= remote._v ? local : remote;
2880
2918
  }
2881
- const localJson = await this.codec.decryptJsonString(local, id);
2882
- const remoteJson = await this.codec.decryptJsonString(remote, id);
2919
+ const localJson = await this.codec.decryptJsonString({ collection: this.name, id }, local);
2920
+ const remoteJson = await this.codec.decryptJsonString({ collection: this.name, id }, remote);
2883
2921
  if (localJson === null) return local;
2884
2922
  if (remoteJson === null) return remote;
2885
2923
  const merged = this.strategies.crdt.mergeCrdtStates(JSON.parse(localJson), JSON.parse(remoteJson));
2886
2924
  const mergedVersion = Math.max(local._v, remote._v) + 1;
2887
2925
  const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
2888
- return this.codec.encryptJsonString(JSON.stringify(merged), mergedVersion, cek);
2926
+ return this.codec.encryptJsonString({ collection: this.name, id }, JSON.stringify(merged), mergedVersion, cek);
2889
2927
  };
2890
2928
  opts.onRegisterConflictResolver(this.name, crdtResolver);
2891
2929
  }
@@ -2926,14 +2964,14 @@ var Collection = class {
2926
2964
  } else {
2927
2965
  const mergeFn = policy;
2928
2966
  resolver = async (id, local, remote) => {
2929
- const localRecord = await this.codec.decryptRecord(local, { skipValidation: true, id });
2930
- const remoteRecord = await this.codec.decryptRecord(remote, { skipValidation: true, id });
2967
+ const localRecord = await this.codec.decryptRecord({ collection: this.name, id }, local, { skipValidation: true });
2968
+ const remoteRecord = await this.codec.decryptRecord({ collection: this.name, id }, remote, { skipValidation: true });
2931
2969
  if (localRecord === null) return local;
2932
2970
  if (remoteRecord === null) return remote;
2933
2971
  const merged = mergeFn(localRecord, remoteRecord);
2934
2972
  const mergedVersion = Math.max(local._v, remote._v) + 1;
2935
2973
  const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
2936
- return this.codec.encryptRecord(merged, mergedVersion, cek, void 0, void 0, void 0, id);
2974
+ return this.codec.encryptRecord({ collection: this.name, id }, merged, mergedVersion, cek);
2937
2975
  };
2938
2976
  }
2939
2977
  opts.onRegisterConflictResolver(collectionName, resolver);
@@ -3410,7 +3448,7 @@ var Collection = class {
3410
3448
  }
3411
3449
  }
3412
3450
  if (this.materializedViewSource !== void 0) {
3413
- const { resolveStaleMVOnRead } = await import("./stale-26ZJLNLG.js");
3451
+ const { resolveStaleMVOnRead } = await import("./stale-ZWTKUVZX.js");
3414
3452
  await resolveStaleMVOnRead(this.materializedViewSource, this.name, this.#dispatchCtx({ collection: this.name, id: "resolve-on-read" }));
3415
3453
  }
3416
3454
  let record;
@@ -3422,7 +3460,7 @@ var Collection = class {
3422
3460
  const envelope = await this.adapter.get(this.vault, this.name, id);
3423
3461
  if (!envelope) return null;
3424
3462
  if (isTombstone(envelope, this.storeCiphertext) || isDeleteMarker(envelope) || (envelope._tier ?? 0) > 0) return null;
3425
- record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
3463
+ record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
3426
3464
  if (record === null) return null;
3427
3465
  this.lru.set(id, { record, version: envelope._v }, estimateRecordBytes(record));
3428
3466
  }
@@ -3449,7 +3487,7 @@ var Collection = class {
3449
3487
  }
3450
3488
  const envelope = await this.adapter.get(this.vault, this.name, id);
3451
3489
  if (!envelope || (envelope._tier ?? 0) > 0) return null;
3452
- const json = await this.codec.decryptJsonString(envelope);
3490
+ const json = await this.codec.decryptJsonString({ collection: this.name, id }, envelope);
3453
3491
  if (json === null) return null;
3454
3492
  return JSON.parse(json);
3455
3493
  }
@@ -3566,7 +3604,7 @@ var Collection = class {
3566
3604
  if (cached) return cached.record;
3567
3605
  const env = await this.adapter.get(this.vault, this.name, id);
3568
3606
  if (!env || (env._tier ?? 0) > 0) return void 0;
3569
- const rec = await this.codec.decryptRecord(env, { id });
3607
+ const rec = await this.codec.decryptRecord({ collection: this.name, id }, env, {});
3570
3608
  return rec === null ? void 0 : rec;
3571
3609
  }
3572
3610
  await this.ensureHydrated();
@@ -3614,7 +3652,7 @@ var Collection = class {
3614
3652
  if (cached2) return { record: cached2.record, version: cached2.version };
3615
3653
  const env = await this.adapter.get(this.vault, this.name, id);
3616
3654
  if (!env || (env._tier ?? 0) > 0) return { record: null, version: 0 };
3617
- return { record: await this.codec.decryptRecord(env, { skipValidation: true, id }) ?? null, version: env._v };
3655
+ return { record: await this.codec.decryptRecord({ collection: this.name, id }, env, { skipValidation: true }) ?? null, version: env._v };
3618
3656
  }
3619
3657
  await this.ensureHydrated();
3620
3658
  const cached = this.cache.get(id);
@@ -3636,7 +3674,7 @@ var Collection = class {
3636
3674
  if (this.sensitiveFields.size > 0 || this.via?.hasAtRestHooks === true) {
3637
3675
  const env = await this.adapter.get(this.vault, this.name, id);
3638
3676
  if (!env || isTombstone(env, this.storeCiphertext) || (env._tier ?? 0) > 0) return void 0;
3639
- const rec = await this.codec.decryptRecord(env, { skipValidation: true, id });
3677
+ const rec = await this.codec.decryptRecord({ collection: this.name, id }, env, { skipValidation: true });
3640
3678
  return rec === null ? void 0 : { record: rec, version: env._v };
3641
3679
  }
3642
3680
  const cached = this.cache.get(id);
@@ -3648,7 +3686,7 @@ var Collection = class {
3648
3686
  const env = await this.adapter.get(this.vault, this.name, id);
3649
3687
  if (!env) return { env: null, record: null, elided: false };
3650
3688
  if ((env._tier ?? 0) > 0) return { env, record: null, elided: false };
3651
- return { env, record: await this.codec.decryptRecord(env, { skipValidation: true, id }), elided: false };
3689
+ return { env, record: await this.codec.decryptRecord({ collection: this.name, id }, env, { skipValidation: true }), elided: false };
3652
3690
  }
3653
3691
  /**
3654
3692
  * Wraps {@link RecordCodec.toCacheRecord} with an additional strip for
@@ -3672,9 +3710,9 @@ var Collection = class {
3672
3710
  * payload that is not a CRDT state. The `lww-map` and `rga` branches each
3673
3711
  * carried a copy, byte-identical apart from the cast (#842).
3674
3712
  */
3675
- async #decodePriorCrdtState(envelope) {
3713
+ async #decodePriorCrdtState(id, envelope) {
3676
3714
  if (!envelope) return void 0;
3677
- const prevJson = await this.codec.decryptJsonString(envelope);
3715
+ const prevJson = await this.codec.decryptJsonString({ collection: this.name, id }, envelope);
3678
3716
  if (prevJson === null) return void 0;
3679
3717
  const prevParsed = JSON.parse(prevJson);
3680
3718
  if (prevParsed === null || typeof prevParsed !== "object" || !("_crdt" in prevParsed)) {
@@ -3711,7 +3749,8 @@ var Collection = class {
3711
3749
  this.vault,
3712
3750
  this.name,
3713
3751
  id,
3714
- await this.codec.encryptRecord(prior.record, prior.version, cek, void 0, void 0, vdigCtx, id)
3752
+ await this.codec.encryptRecord(this.strategies.history.historyIdentity(this.name, id, prior.version), prior.record, prior.version, cek, void 0, void 0, vdigCtx)
3753
+ // sealed against its _history STORAGE identity (#1041)
3715
3754
  );
3716
3755
  this.emitter.emit("history:save", { vault: this.vault, collection: this.name, id, version: prior.version });
3717
3756
  if (this.historyConfig.maxVersions) {
@@ -3821,20 +3860,20 @@ var Collection = class {
3821
3860
  const now = (/* @__PURE__ */ new Date()).toISOString();
3822
3861
  let crdtState;
3823
3862
  if (this.crdtMode === "lww-map") {
3824
- const existingState = await this.#decodePriorCrdtState(existingEnvelope);
3863
+ const existingState = await this.#decodePriorCrdtState(id, existingEnvelope);
3825
3864
  crdtState = this.strategies.crdt.buildLwwMapState(record, existingState, now);
3826
3865
  } else if (this.crdtMode === "rga") {
3827
- const existingState = await this.#decodePriorCrdtState(existingEnvelope);
3866
+ const existingState = await this.#decodePriorCrdtState(id, existingEnvelope);
3828
3867
  crdtState = this.strategies.crdt.buildRgaState(Array.isArray(record) ? record : [record], existingState, generateULID);
3829
3868
  } else {
3830
3869
  crdtState = { _crdt: "yjs", update: record };
3831
3870
  }
3832
3871
  const version = existingVersion + 1;
3833
3872
  const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
3834
- const envelope = await this.codec.encryptJsonString(JSON.stringify(crdtState), version, cek, options?.source, options?.sourceTs);
3873
+ const envelope = await this.codec.encryptJsonString({ collection: this.name, id }, JSON.stringify(crdtState), version, cek, options?.source, options?.sourceTs);
3835
3874
  await this.adapter.put(this.vault, this.name, id, envelope);
3836
3875
  const resolvedRecord = this.strategies.crdt.resolveCrdtSnapshot(crdtState);
3837
- const existingResolvedRecord = existingEnvelope ? await this.codec.decryptRecord(existingEnvelope, { skipValidation: true }) : null;
3876
+ const existingResolvedRecord = existingEnvelope ? await this.codec.decryptRecord({ collection: this.name, id }, existingEnvelope, { skipValidation: true }) : null;
3838
3877
  const existingResolved = existingResolvedRecord !== null ? { record: existingResolvedRecord, version: existingVersion } : void 0;
3839
3878
  if (existingResolved) {
3840
3879
  await this.#savePriorHistory(id, existingResolved, cek, this.vdigFields !== null ? { id, prev: existingEnvelope } : void 0);
@@ -3874,7 +3913,7 @@ var Collection = class {
3874
3913
  if (!existing) {
3875
3914
  priorRaw = await this.adapter.get(this.vault, this.name, id);
3876
3915
  if (priorRaw) {
3877
- const previousRecord = await this.codec.decryptRecord(priorRaw, { id });
3916
+ const previousRecord = await this.codec.decryptRecord({ collection: this.name, id }, priorRaw, {});
3878
3917
  if (previousRecord !== null) {
3879
3918
  existing = { record: previousRecord, version: priorRaw._v };
3880
3919
  }
@@ -3894,7 +3933,7 @@ var Collection = class {
3894
3933
  this.uniqueConstraints?.check(id, record);
3895
3934
  const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
3896
3935
  const vdigCtx = this.vdigFields !== null ? { id, prev: await this.adapter.get(this.vault, this.name, id) } : void 0;
3897
- const envelope = await this.codec.encryptRecord(record, version, cek, options?.source, options?.sourceTs, vdigCtx, id);
3936
+ const envelope = await this.codec.encryptRecord({ collection: this.name, id }, record, version, cek, options?.source, options?.sourceTs, vdigCtx);
3898
3937
  return { id, envelope, version, indexed: record, event: record, prior: existing, cek, vdigCtx, reason: options?.reason };
3899
3938
  }
3900
3939
  /**
@@ -3940,7 +3979,7 @@ var Collection = class {
3940
3979
  */
3941
3980
  async dispatchMaterializedViews(id, record, wave) {
3942
3981
  if (this.materializedViewSource === void 0) return;
3943
- const { dispatchMaterializedViews } = await import("./dispatch-56T7VPGE.js");
3982
+ const { dispatchMaterializedViews } = await import("./dispatch-MG5KNMWG.js");
3944
3983
  return dispatchMaterializedViews(this.#mvDispatchCtx(this.materializedViewSource), id, record, wave);
3945
3984
  }
3946
3985
  /**
@@ -3968,7 +4007,7 @@ var Collection = class {
3968
4007
  const cached = this.lru.get(id);
3969
4008
  const env = await this.adapter.get(this.vault, this.name, id);
3970
4009
  if (!env || isTombstone(env, this.storeCiphertext) || isDeleteMarker(env)) return null;
3971
- raw = await this.codec.decryptRecord(env, { id });
4010
+ raw = await this.codec.decryptRecord({ collection: this.name, id }, env, {});
3972
4011
  if (raw === null) return null;
3973
4012
  if (!cached) {
3974
4013
  this.lru.set(id, { record: await this.codec.toCacheRecord(raw, env, id), version: env._v }, estimateRecordBytes(raw));
@@ -3979,7 +4018,7 @@ var Collection = class {
3979
4018
  else {
3980
4019
  const env = await this.adapter.get(this.vault, this.name, id);
3981
4020
  if (!env || isTombstone(env, this.storeCiphertext) || isDeleteMarker(env)) return null;
3982
- raw = await this.codec.decryptRecord(env, { id });
4021
+ raw = await this.codec.decryptRecord({ collection: this.name, id }, env, {});
3983
4022
  if (raw === null) return null;
3984
4023
  this.lru.set(id, { record: raw, version: env._v }, estimateRecordBytes(raw));
3985
4024
  }
@@ -3996,7 +4035,7 @@ var Collection = class {
3996
4035
  async _getStoredRecordForDispatch(id) {
3997
4036
  const env = await this.adapter.get(this.vault, this.name, id);
3998
4037
  if (!env || isTombstone(env, this.storeCiphertext) || isDeleteMarker(env)) return null;
3999
- const record = await this.codec.decryptRecord(env, { id });
4038
+ const record = await this.codec.decryptRecord({ collection: this.name, id }, env, {});
4000
4039
  return record === null ? null : { record, version: env._v };
4001
4040
  }
4002
4041
  /**
@@ -4113,7 +4152,7 @@ var Collection = class {
4113
4152
  * dispatch wave's per-target dedup; `undefined` on the local-write path (byte-identical). */
4114
4153
  async dispatchDerivations(id, record, version, wave) {
4115
4154
  if (this.derivationSource === void 0) return;
4116
- const { dispatchDerivations } = await import("./dispatch-BM5GNCE2.js");
4155
+ const { dispatchDerivations } = await import("./dispatch-RVJQ4BOL.js");
4117
4156
  return dispatchDerivations({
4118
4157
  ...this.#derivationDeleteCtx(this.derivationSource),
4119
4158
  via: this.via,
@@ -4296,7 +4335,7 @@ var Collection = class {
4296
4335
  if (!existing && this.historyConfig.enabled !== false) {
4297
4336
  const previousEnvelope2 = await this.adapter.get(this.vault, this.name, id);
4298
4337
  if (previousEnvelope2) {
4299
- const previousRecord = await this.codec.decryptRecord(previousEnvelope2, { id });
4338
+ const previousRecord = await this.codec.decryptRecord({ collection: this.name, id }, previousEnvelope2, {});
4300
4339
  if (previousRecord !== null) {
4301
4340
  existing = { record: previousRecord, version: previousEnvelope2._v };
4302
4341
  }
@@ -4333,7 +4372,7 @@ var Collection = class {
4333
4372
  async _commitDelete(prepared, persist = true) {
4334
4373
  const { id, internal, existing, previousPayloadHash, marker, cek, vdigCtx } = prepared;
4335
4374
  if (existing && this.historyConfig.enabled !== false) {
4336
- await this.strategies.history.saveHistory(this.adapter, this.vault, this.name, id, await this.codec.encryptRecord(existing.record, existing.version, cek, void 0, void 0, vdigCtx, id));
4375
+ await this.strategies.history.saveHistory(this.adapter, this.vault, this.name, id, await this.codec.encryptRecord(this.strategies.history.historyIdentity(this.name, id, existing.version), existing.record, existing.version, cek, void 0, void 0, vdigCtx));
4337
4376
  }
4338
4377
  if (marker) {
4339
4378
  if (persist) await this.adapter.put(this.vault, this.name, id, marker);
@@ -4400,7 +4439,7 @@ var Collection = class {
4400
4439
  */
4401
4440
  async _decodeEnvelope(envelope, id) {
4402
4441
  try {
4403
- const rec = await this.codec.decryptRecord(envelope, { skipValidation: true, id });
4442
+ const rec = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { skipValidation: true });
4404
4443
  return rec === null ? null : rec;
4405
4444
  } catch {
4406
4445
  return null;
@@ -4428,7 +4467,7 @@ var Collection = class {
4428
4467
  */
4429
4468
  async dispatchArrayDerivationsOnDelete(id, eraseRecordShapeToo = false) {
4430
4469
  if (this.derivationSource === void 0) return 0;
4431
- const { dispatchArrayDerivationsOnDelete } = await import("./dispatch-BM5GNCE2.js");
4470
+ const { dispatchArrayDerivationsOnDelete } = await import("./dispatch-RVJQ4BOL.js");
4432
4471
  return dispatchArrayDerivationsOnDelete(this.#derivationDeleteCtx(this.derivationSource), id, eraseRecordShapeToo);
4433
4472
  }
4434
4473
  /**
@@ -4442,7 +4481,7 @@ var Collection = class {
4442
4481
  */
4443
4482
  async dispatchMaterializedViewsOnDelete(id) {
4444
4483
  if (this.materializedViewSource === void 0) return { deleted: 0, residueUndecodable: [], residueDeclined: [] };
4445
- const { dispatchMaterializedViewsOnDelete } = await import("./dispatch-56T7VPGE.js");
4484
+ const { dispatchMaterializedViewsOnDelete } = await import("./dispatch-MG5KNMWG.js");
4446
4485
  return dispatchMaterializedViewsOnDelete(this.#mvDispatchCtx(this.materializedViewSource), id);
4447
4486
  }
4448
4487
  /**
@@ -4462,7 +4501,7 @@ var Collection = class {
4462
4501
  );
4463
4502
  }
4464
4503
  if (this.materializedViewSource !== void 0) {
4465
- const { resolveStaleMVOnRead } = await import("./stale-26ZJLNLG.js");
4504
+ const { resolveStaleMVOnRead } = await import("./stale-ZWTKUVZX.js");
4466
4505
  await resolveStaleMVOnRead(this.materializedViewSource, this.name, this.#dispatchCtx({ collection: this.name, id: "resolve-on-read" }));
4467
4506
  }
4468
4507
  await this.ensureHydrated();
@@ -4796,7 +4835,7 @@ var Collection = class {
4796
4835
  const entries = [];
4797
4836
  for (const env of envelopes) {
4798
4837
  if ((env._tier ?? 0) > 0) continue;
4799
- const record = await this.codec.decryptRecord(env, { skipValidation: true, id });
4838
+ const record = await this.codec.decryptRecord(this.strategies.history.historyIdentity(this.name, id, env._v), env, { skipValidation: true });
4800
4839
  if (record === null) continue;
4801
4840
  entries.push({
4802
4841
  version: env._v,
@@ -4825,7 +4864,7 @@ var Collection = class {
4825
4864
  version
4826
4865
  );
4827
4866
  if (!envelope || (envelope._tier ?? 0) > 0 || await liveRecordIsElevated(this.adapter, this.vault, this.name, id)) return null;
4828
- return this.codec.decryptRecord(envelope, { skipValidation: true, id });
4867
+ return this.codec.decryptRecord(this.strategies.history.historyIdentity(this.name, id, envelope._v), envelope, { skipValidation: true });
4829
4868
  }
4830
4869
  /** Revert a record to a past version. Creates a new version with the old content. */
4831
4870
  async revert(id, version) {
@@ -4931,7 +4970,7 @@ var Collection = class {
4931
4970
  const id = ids[i];
4932
4971
  const envelope = await this.adapter.get(this.vault, this.name, id);
4933
4972
  if (envelope && (envelope._tier ?? 0) === 0) {
4934
- const record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
4973
+ const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
4935
4974
  if (record === null) continue;
4936
4975
  items.push(record);
4937
4976
  if (!this.lazy && !this.cache.has(id)) {
@@ -5013,7 +5052,7 @@ var Collection = class {
5013
5052
  const out = [];
5014
5053
  for (const { id, envelope } of items) {
5015
5054
  if ((envelope._tier ?? 0) > 0) continue;
5016
- const record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
5055
+ const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
5017
5056
  if (record === null) continue;
5018
5057
  out.push({ id, record, version: envelope._v });
5019
5058
  }
@@ -5074,7 +5113,7 @@ var Collection = class {
5074
5113
  }
5075
5114
  return;
5076
5115
  }
5077
- const record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
5116
+ const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
5078
5117
  if (record === null) {
5079
5118
  this.cache.delete(id);
5080
5119
  if (previous) {
@@ -5170,7 +5209,7 @@ var Collection = class {
5170
5209
  for (const id of ids) {
5171
5210
  const envelope = await this.adapter.get(this.vault, this.name, id);
5172
5211
  if (envelope && !isTombstone(envelope, this.storeCiphertext) && !isDeleteMarker(envelope) && (envelope._tier ?? 0) === 0) {
5173
- const record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
5212
+ const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
5174
5213
  if (record === null) continue;
5175
5214
  this.cache.set(id, { record, version: envelope._v });
5176
5215
  } else if (envelope && isDeleteMarker(envelope)) {
@@ -5189,7 +5228,7 @@ var Collection = class {
5189
5228
  continue;
5190
5229
  }
5191
5230
  if (isTombstone(envelope, this.storeCiphertext) || (envelope._tier ?? 0) > 0) continue;
5192
- const record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
5231
+ const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
5193
5232
  if (record === null) continue;
5194
5233
  this.cache.set(id, { record, version: envelope._v });
5195
5234
  }
@@ -5323,7 +5362,7 @@ var Collection = class {
5323
5362
  for (const [id, entry] of this.cache) {
5324
5363
  const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
5325
5364
  const prevForVdig = this.vdigFields !== null ? await this.adapter.get(this.vault, this.name, id) : null;
5326
- result[id] = await this.codec.encryptRecord(entry.record, entry.version, cek, void 0, void 0, this.vdigFields !== null ? { id, prev: prevForVdig } : void 0, id);
5365
+ result[id] = await this.codec.encryptRecord({ collection: this.name, id }, entry.record, entry.version, cek, void 0, void 0, this.vdigFields !== null ? { id, prev: prevForVdig } : void 0);
5327
5366
  }
5328
5367
  return result;
5329
5368
  }
@@ -5438,7 +5477,7 @@ var Collection = class {
5438
5477
  const envelope = await this.adapter.get(this.vault, this.name, id);
5439
5478
  if (!envelope) continue;
5440
5479
  try {
5441
- const json = await this.codec.decryptJsonString(envelope);
5480
+ const json = await this.codec.decryptJsonString({ collection: this.name, id }, envelope);
5442
5481
  if (json === null) continue;
5443
5482
  const body = JSON.parse(json);
5444
5483
  if (typeof body.recordId !== "string") continue;
@@ -5572,14 +5611,14 @@ var Collection = class {
5572
5611
  /** C-A/R10: persist the classified marker once per classified handle (store I/O in config-drift.ts). */
5573
5612
  async _ensureClassifiedMarker() {
5574
5613
  if (this._markerPersisted || this.vdigFields === null) return;
5575
- const { persistClassifiedMarkerForFields } = await import("./classified-marker-L7LXKS6Q.js");
5614
+ const { persistClassifiedMarkerForFields } = await import("./classified-marker-GWQTNDSL.js");
5576
5615
  await persistClassifiedMarkerForFields(this.adapter, this.vault, this.name, this.vdigFields, await this.getDEK(this.name));
5577
5616
  this._markerPersisted = true;
5578
5617
  }
5579
5618
  /** C-A/R10 drift signal — the marker's declared digest-only set, memoized to one store read per handle (see config-drift.ts). */
5580
5619
  async _classifiedMarkerDigestOnly() {
5581
5620
  if (this._markerDigestOnlyCache !== void 0) return this._markerDigestOnlyCache;
5582
- const { readClassifiedMarkerDigestOnly } = await import("./classified-marker-L7LXKS6Q.js");
5621
+ const { readClassifiedMarkerDigestOnly } = await import("./classified-marker-GWQTNDSL.js");
5583
5622
  this._markerDigestOnlyCache = await readClassifiedMarkerDigestOnly(this.adapter, this.vault, this.name, await this.getDEK(this.name));
5584
5623
  return this._markerDigestOnlyCache;
5585
5624
  }
@@ -5731,8 +5770,9 @@ var Collection = class {
5731
5770
  syncIndexes: (id, rec, version, priorEnvelope) => syncTierIndexes(this.indexingContext(), id, rec, version, priorEnvelope),
5732
5771
  syncSearch: (id, rec, version) => syncTierSearch(this.searchContext(), id, rec, version),
5733
5772
  syncHistory: async (id, fromDek, toDek) => this.strategies.history.rewrapHistory(this.adapter, this.vault, this.name, id, fromDek, toDek, await this.getDEK(this.name)),
5734
- saveHistorySnapshot: async (id, envelope) => {
5773
+ saveHistorySnapshot: async (id, version, seal) => {
5735
5774
  if (this.historyConfig.enabled === false) return;
5775
+ const envelope = await seal(this.strategies.history.historyIdentity(this.name, id, version));
5736
5776
  await this.strategies.history.saveHistory(this.adapter, this.vault, this.name, id, envelope);
5737
5777
  this.emitter.emit("history:save", { vault: this.vault, collection: this.name, id, version: envelope._v });
5738
5778
  if (this.historyConfig.maxVersions) await this.strategies.history.pruneHistory(this.adapter, this.vault, this.name, id, { keepVersions: this.historyConfig.maxVersions });
@@ -6016,17 +6056,18 @@ var DeferredNumberingStore = class {
6016
6056
  async readJson(collection, id) {
6017
6057
  const env = await this.adapter.get(this.vault, collection, id);
6018
6058
  if (!env) return { env: null, value: null };
6019
- const json = this.encrypted ? await openEnvelopeJson(env, await this.dek(collection)) : env._data;
6059
+ const json = this.encrypted ? await openEnvelopeJson({ collection, id }, env, await this.dek(collection)) : env._data;
6020
6060
  return { env, value: JSON.parse(json) };
6021
6061
  }
6022
6062
  async writeJson(collection, id, value, expectedVersion) {
6023
6063
  const json = JSON.stringify(value);
6024
6064
  let env;
6025
6065
  if (!this.encrypted) {
6026
- env = buildRecordEnvelope({ collection, id }, { version: expectedVersion + 1, iv: "", data: json, by: this.actor });
6066
+ env = buildRecordEnvelope({ collection, id, version: expectedVersion + 1 }, { iv: "", data: json });
6027
6067
  } else {
6028
- const { iv, data } = await encrypt(json, await this.dek(collection));
6029
- env = buildRecordEnvelope({ collection, id }, { version: expectedVersion + 1, iv, data, by: this.actor });
6068
+ const identity = { collection, id, version: expectedVersion + 1 };
6069
+ const { iv, data } = await encrypt(json, await this.dek(collection), buildRecordAad(identity));
6070
+ env = buildRecordEnvelope(identity, { iv, data });
6030
6071
  }
6031
6072
  await this.adapter.put(this.vault, collection, id, env, expectedVersion);
6032
6073
  }
@@ -6576,7 +6617,7 @@ var VaultPeriods = class {
6576
6617
  const loaded = await this.deps.strategy.loadPeriods(
6577
6618
  this.deps.adapter,
6578
6619
  this.deps.vault,
6579
- (env) => this.decryptPeriodRecord(env)
6620
+ (id, env) => this.decryptPeriodRecord(id, env)
6580
6621
  );
6581
6622
  this.periodCache = await this.mergeReopenState(loaded);
6582
6623
  }
@@ -6593,7 +6634,7 @@ var VaultPeriods = class {
6593
6634
  const loaded = await this.deps.strategy.loadPeriods(
6594
6635
  this.deps.adapter,
6595
6636
  this.deps.vault,
6596
- (env) => this.decryptPeriodRecord(env)
6637
+ (id, env) => this.decryptPeriodRecord(id, env)
6597
6638
  );
6598
6639
  this.periodCache = loaded;
6599
6640
  return loaded;
@@ -6601,27 +6642,15 @@ var VaultPeriods = class {
6601
6642
  /** Generic reserved-collection writer — serves `_periods` and `_period_freezes` alike. */
6602
6643
  async writeReserved(collection, key, value) {
6603
6644
  const json = JSON.stringify(value);
6645
+ const actor = this.deps.userId();
6646
+ const identity = { collection, id: key, by: actor, version: 1 };
6604
6647
  let envelope;
6605
6648
  if (this.deps.encrypted) {
6606
6649
  const dek = await this.deps.getDEK(collection);
6607
- const { iv, data } = await encrypt(json, dek);
6608
- envelope = {
6609
- _noydb: NOYDB_FORMAT_VERSION,
6610
- _v: 1,
6611
- _ts: (/* @__PURE__ */ new Date()).toISOString(),
6612
- _iv: iv,
6613
- _data: data,
6614
- _by: this.deps.userId()
6615
- };
6650
+ const { iv, data } = await encrypt(json, dek, buildRecordAad(identity));
6651
+ envelope = buildRecordEnvelope(identity, { iv, data });
6616
6652
  } else {
6617
- envelope = {
6618
- _noydb: NOYDB_FORMAT_VERSION,
6619
- _v: 1,
6620
- _ts: (/* @__PURE__ */ new Date()).toISOString(),
6621
- _iv: "",
6622
- _data: json,
6623
- _by: this.deps.userId()
6624
- };
6653
+ envelope = buildRecordEnvelope(identity, { iv: "", data: json });
6625
6654
  }
6626
6655
  await this.deps.adapter.put(this.deps.vault, collection, key, envelope);
6627
6656
  if (collection === PERIODS_COLLECTION && this.deps.onDirty) {
@@ -6633,14 +6662,14 @@ var VaultPeriods = class {
6633
6662
  async readReserved(collection, key) {
6634
6663
  const env = await this.deps.adapter.get(this.deps.vault, collection, key);
6635
6664
  if (!env) return null;
6636
- const json = this.deps.encrypted ? await openEnvelopeJson(env, await this.deps.getDEK(collection)) : env._data;
6665
+ const json = this.deps.encrypted ? await openEnvelopeJson({ collection, id: key }, env, await this.deps.getDEK(collection)) : env._data;
6637
6666
  return JSON.parse(json);
6638
6667
  }
6639
- async decryptPeriodRecord(envelope) {
6668
+ async decryptPeriodRecord(periodId, envelope) {
6640
6669
  let json;
6641
6670
  if (this.deps.encrypted) {
6642
6671
  const dek = await this.deps.getDEK(PERIODS_COLLECTION);
6643
- json = await openEnvelopeJson(envelope, dek);
6672
+ json = await openEnvelopeJson({ collection: PERIODS_COLLECTION, id: periodId }, envelope, dek);
6644
6673
  } else {
6645
6674
  json = envelope._data;
6646
6675
  }
@@ -7215,7 +7244,7 @@ var VaultLinks = class {
7215
7244
  // src/with-shape/links/lazy-handle.ts
7216
7245
  function makeLazyLinkSetHandle(d) {
7217
7246
  let engine = null;
7218
- const load = () => engine ??= import("./link-set-XRVHGYWC.js").then(
7247
+ const load = () => engine ??= import("./link-set-XKN5V7VM.js").then(
7219
7248
  ({ LinkSet }) => new LinkSet(d.adapter, d.vault, d.name, d.spec, d.encrypted, d.getDEK, d.actor, d.emitter, d.endpointExists)
7220
7249
  );
7221
7250
  return {
@@ -7862,7 +7891,7 @@ function declareSatellite(ctx, collectionName, options, existingRegistry) {
7862
7891
  ctx.forEachSyncEngine((e) => e.remirrorPairResolvers([spec.base, spec.satellite]));
7863
7892
  const registry = reg;
7864
7893
  const baseSchema = ctx.getBaseSchema(spec.base);
7865
- void import("./post-register-O3YW6CGS.js").then((m) => m.postRegister(ctx.adapter, ctx.vaultName, spec, ctx.getDEK, baseSchema, registry)).catch(() => {
7894
+ void import("./post-register-CVS7CCJE.js").then((m) => m.postRegister(ctx.adapter, ctx.vaultName, spec, ctx.getDEK, baseSchema, registry)).catch(() => {
7866
7895
  });
7867
7896
  return reg;
7868
7897
  }
@@ -8845,7 +8874,7 @@ var Vault = class {
8845
8874
  const strategies = options.schemaUpdate ?? [];
8846
8875
  const work = (async () => {
8847
8876
  const dek = await this.getDEK(collectionName);
8848
- const { persistSchemaIfNeeded } = await import("./register-XHOOX37G.js");
8877
+ const { persistSchemaIfNeeded } = await import("./register-GJ6PW4KP.js");
8849
8878
  const result = await persistSchemaIfNeeded({
8850
8879
  store: this.adapter,
8851
8880
  vault: this.name,
@@ -8995,7 +9024,7 @@ var Vault = class {
8995
9024
  const work = (async () => {
8996
9025
  try {
8997
9026
  const dek = await this.getDEK(collectionName);
8998
- await (await import("./register-XHOOX37G.js")).persistSchemaIfNeeded({
9027
+ await (await import("./register-GJ6PW4KP.js")).persistSchemaIfNeeded({
8999
9028
  store: this.adapter,
9000
9029
  vault: this.name,
9001
9030
  collectionName,
@@ -9671,21 +9700,22 @@ var Vault = class {
9671
9700
  */
9672
9701
  // eslint-disable-next-line @typescript-eslint/consistent-type-imports
9673
9702
  async _loadPodSigner() {
9674
- const { loadSigner } = await import("./signer-SLOMB6HS.js");
9703
+ const { loadSigner } = await import("./signer-JE6NEURY.js");
9675
9704
  return loadSigner(this.adapter, this.name, this.getDEK);
9676
9705
  }
9677
9706
  async writeExportAudit(entry) {
9678
9707
  const json = JSON.stringify(entry);
9708
+ const exportAuditIdentity = { collection: EXPORT_AUDIT_COLLECTION, id: entry.id, by: entry.actor, version: 1 };
9679
9709
  const envelope = this.encrypted ? await (async () => {
9680
9710
  const dek = await this.getDEK(EXPORT_AUDIT_COLLECTION);
9681
- const { iv, data } = await encrypt(json, dek);
9711
+ const { iv, data } = await encrypt(json, dek, buildRecordAad(exportAuditIdentity));
9682
9712
  return buildRecordEnvelope(
9683
- { collection: EXPORT_AUDIT_COLLECTION, id: entry.id },
9684
- { version: 1, ts: entry.startedAt, iv, data, by: entry.actor }
9713
+ exportAuditIdentity,
9714
+ { ts: entry.startedAt, iv, data }
9685
9715
  );
9686
9716
  })() : buildRecordEnvelope(
9687
- { collection: EXPORT_AUDIT_COLLECTION, id: entry.id },
9688
- { version: 1, ts: entry.startedAt, iv: "", data: json, by: entry.actor }
9717
+ exportAuditIdentity,
9718
+ { ts: entry.startedAt, iv: "", data: json }
9689
9719
  );
9690
9720
  await this.adapter.put(this.name, EXPORT_AUDIT_COLLECTION, entry.id, envelope);
9691
9721
  }
@@ -9700,12 +9730,12 @@ var Vault = class {
9700
9730
  *
9701
9731
  * @internal
9702
9732
  */
9703
- async _decryptEnvelopeForBundleFilter(env, collectionName) {
9733
+ async _decryptEnvelopeForBundleFilter(env, collectionName, recordId) {
9704
9734
  if (!this.encrypted) {
9705
9735
  return JSON.parse(env._data);
9706
9736
  }
9707
9737
  const dek = await this.getDEK(collectionName);
9708
- const json = await openEnvelopeJson(env, dek);
9738
+ const json = await openEnvelopeJson({ collection: collectionName, id: recordId }, env, dek);
9709
9739
  return JSON.parse(json);
9710
9740
  }
9711
9741
  canImport(tier, format) {
@@ -10188,7 +10218,7 @@ var Vault = class {
10188
10218
  async _initDerivations(handles) {
10189
10219
  if (handles.length === 0) return;
10190
10220
  const [{ DerivationRegistry }, { ReadOnlyVaultFacade }] = await Promise.all([
10191
- import("./registry-CYAFB35H.js"),
10221
+ import("./registry-KI77RVK7.js"),
10192
10222
  import("./read-only-facade-CHCKSEPD.js")
10193
10223
  ]);
10194
10224
  const registry = new DerivationRegistry();
@@ -10220,7 +10250,7 @@ var Vault = class {
10220
10250
  */
10221
10251
  async _initMaterializedViews(handles) {
10222
10252
  if (handles.length === 0) return;
10223
- const { MaterializedViewRegistry } = await import("./registry-OFMM4WAC.js");
10253
+ const { MaterializedViewRegistry } = await import("./registry-6LUJ5IJW.js");
10224
10254
  const registry = new MaterializedViewRegistry();
10225
10255
  this.materializedViewRegistry = registry;
10226
10256
  const db = this;
@@ -10307,14 +10337,14 @@ var Vault = class {
10307
10337
  if (!reg) {
10308
10338
  throw new Error(`refreshView: no MV registered with name "${name}"`);
10309
10339
  }
10310
- const { MaterializedViewExecutor } = await import("./executor-LFHRV6JH.js");
10340
+ const { MaterializedViewExecutor } = await import("./executor-FRUVM36Q.js");
10311
10341
  const result = await MaterializedViewExecutor.refresh(reg, {
10312
10342
  getCollection: (n) => this.collection(n),
10313
10343
  getActiveTxContext: () => this.noydb._activeTxContextOrNull,
10314
10344
  getQueryContext: () => this,
10315
10345
  dispatchCtx: this._dispatchCtx({ collection: name, id: "refreshView" })
10316
10346
  });
10317
- const { clearMVStaleFully } = await import("./stale-26ZJLNLG.js");
10347
+ const { clearMVStaleFully } = await import("./stale-ZWTKUVZX.js");
10318
10348
  await clearMVStaleFully(this.adapter, this.name, registry, name);
10319
10349
  return result;
10320
10350
  }
@@ -10354,7 +10384,7 @@ var Vault = class {
10354
10384
  if (!outSpec) continue;
10355
10385
  const outputColl = this.collection(outSpec.collection);
10356
10386
  if (out.kind === "array") {
10357
- const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-MT2OBMZB.js");
10387
+ const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-NZA6J7QB.js");
10358
10388
  const prior = await loadFanoutSidecar(this.adapter, this.name, spec.source, id, key, this.getDEK, this.encrypted);
10359
10389
  const prevKeys = new Set(prior?.keys ?? []);
10360
10390
  const newKeysList = out.entries.map((e) => e.key);
@@ -10581,7 +10611,7 @@ var Vault = class {
10581
10611
  * collection.
10582
10612
  */
10583
10613
  async delegate(opts) {
10584
- const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-7EGBYBRN.js");
10614
+ const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-Q3HEAVLA.js");
10585
10615
  if (!this.keyring.kek) {
10586
10616
  throw new ValidationError(
10587
10617
  "issueDelegation: keyring.kek is null \u2014 issuing a delegation requires a tier-1 unlock. Re-authenticate at tier 1 (secret) first."
@@ -10603,7 +10633,7 @@ var Vault = class {
10603
10633
  * if the id does not exist.
10604
10634
  */
10605
10635
  async revokeDelegation(id) {
10606
- const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-7EGBYBRN.js");
10636
+ const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-Q3HEAVLA.js");
10607
10637
  await revokeDelegation(this.adapter, this.name, id);
10608
10638
  void DELEGATIONS_COLLECTION;
10609
10639
  }
@@ -10699,16 +10729,17 @@ var Vault = class {
10699
10729
  async writeElevationAudit(entry) {
10700
10730
  const id = `elev-${Date.now().toString(36)}-${Math.random().toString(16).slice(2, 10)}`;
10701
10731
  const json = JSON.stringify({ id, ...entry });
10732
+ const elevationAuditIdentity = { collection: ELEVATION_AUDIT_COLLECTION, id, by: entry.actor, version: 1 };
10702
10733
  const envelope = this.encrypted ? await (async () => {
10703
10734
  const dek = await this.getDEK(ELEVATION_AUDIT_COLLECTION);
10704
- const { iv, data } = await encrypt(json, dek);
10735
+ const { iv, data } = await encrypt(json, dek, buildRecordAad(elevationAuditIdentity));
10705
10736
  return buildRecordEnvelope(
10706
- { collection: ELEVATION_AUDIT_COLLECTION, id },
10707
- { version: 1, ts: entry.startedAt, iv, data, by: entry.actor }
10737
+ elevationAuditIdentity,
10738
+ { ts: entry.startedAt, iv, data }
10708
10739
  );
10709
10740
  })() : buildRecordEnvelope(
10710
- { collection: ELEVATION_AUDIT_COLLECTION, id },
10711
- { version: 1, ts: entry.startedAt, iv: "", data: json, by: entry.actor }
10741
+ elevationAuditIdentity,
10742
+ { ts: entry.startedAt, iv: "", data: json }
10712
10743
  );
10713
10744
  await this.adapter.put(this.name, ELEVATION_AUDIT_COLLECTION, id, envelope);
10714
10745
  }
@@ -10855,7 +10886,7 @@ var Vault = class {
10855
10886
  * @see design-history/2026-05-22-schema-dump-design.md
10856
10887
  */
10857
10888
  async dumpSchema(opts = {}) {
10858
- const { dumpVaultSchema } = await import("./walk-B4YFJJ7S.js");
10889
+ const { dumpVaultSchema } = await import("./walk-HSS3NLQ3.js");
10859
10890
  return dumpVaultSchema(this, opts);
10860
10891
  }
10861
10892
  /**
@@ -10951,7 +10982,7 @@ var Vault = class {
10951
10982
  * separate vault instances now.
10952
10983
  */
10953
10984
  async getPodHandle() {
10954
- const { buildPodHandle } = await import("./pod-handle-BYUSBXCT.js");
10985
+ const { buildPodHandle } = await import("./pod-handle-SKDKRPOR.js");
10955
10986
  return buildPodHandle(this.adapter, this.name);
10956
10987
  }
10957
10988
  /**
@@ -10983,7 +11014,7 @@ var Vault = class {
10983
11014
  * both modes round-trip cleanly.
10984
11015
  */
10985
11016
  async dump() {
10986
- const { dumpVault } = await import("./backup-M2VND2VS.js");
11017
+ const { dumpVault } = await import("./backup-OLBRFYY7.js");
10987
11018
  return dumpVault(this.backupContext());
10988
11019
  }
10989
11020
  /**
@@ -11035,7 +11066,7 @@ var Vault = class {
11035
11066
  * — there's no chain to verify against.
11036
11067
  */
11037
11068
  async load(backupJson) {
11038
- const { loadVault } = await import("./backup-M2VND2VS.js");
11069
+ const { loadVault } = await import("./backup-OLBRFYY7.js");
11039
11070
  return loadVault(this.backupContext(), backupJson);
11040
11071
  }
11041
11072
  /**
@@ -11067,7 +11098,7 @@ var Vault = class {
11067
11098
  * way to detect tampering of an in-place vault.
11068
11099
  */
11069
11100
  async verifyBackupIntegrity() {
11070
- const { verifyBackupIntegrity } = await import("./backup-M2VND2VS.js");
11101
+ const { verifyBackupIntegrity } = await import("./backup-OLBRFYY7.js");
11071
11102
  return verifyBackupIntegrity(this.backupContext());
11072
11103
  }
11073
11104
  /**
@@ -11285,7 +11316,7 @@ var Vault = class {
11285
11316
  * is the live validator object, not a serialization of it).
11286
11317
  */
11287
11318
  async exportJSON(opts = {}) {
11288
- const { exportVaultJSON } = await import("./backup-M2VND2VS.js");
11319
+ const { exportVaultJSON } = await import("./backup-OLBRFYY7.js");
11289
11320
  return exportVaultJSON(this.backupContext(), opts);
11290
11321
  }
11291
11322
  };
@@ -13101,6 +13132,7 @@ var Noydb = class {
13101
13132
  this.#registerGuardGate();
13102
13133
  this.#registerPeriodGate();
13103
13134
  this.#registerForgetHooks();
13135
+ this.#registerVaultHeadObserver();
13104
13136
  this.resetSessionTimer();
13105
13137
  }
13106
13138
  /** @internal — resolved forget strategy (NO_FORGET when not configured). */
@@ -13117,6 +13149,22 @@ var Noydb = class {
13117
13149
  // - the subsystemBus `afterDelete` observer fires on delete (onAfterWrite
13118
13150
  // does NOT) — drop the ref so a deleted record never lingers in the
13119
13151
  // index (RISK #2). Without it, forget() would try to shred a ghost.
13152
+ /** #1044 — see `with-commit/vault-head/strategy.ts` for why this is an observer. */
13153
+ #registerVaultHeadObserver() {
13154
+ if (!this.strategies.vaultHead.enabled) return;
13155
+ for (const point of ["afterPut", "afterDelete"]) {
13156
+ this.subsystemBus.register(point, async (event) => {
13157
+ const vault = this.vaultCache.get(event.vault);
13158
+ if (!vault) return;
13159
+ const { adapter, getDEK } = vault._introspectState();
13160
+ await this.strategies.vaultHead.note(adapter, event.vault, getDEK, {
13161
+ collection: event.collection,
13162
+ id: event.docId,
13163
+ version: event.version
13164
+ });
13165
+ });
13166
+ }
13167
+ }
13120
13168
  #registerForgetHooks() {
13121
13169
  const subjects = this.strategies.forget.subjects;
13122
13170
  if (Object.keys(subjects).length === 0) return;
@@ -13303,6 +13351,7 @@ var Noydb = class {
13303
13351
  if (this.options.encrypt !== false && !this.policyCache.has(name)) {
13304
13352
  await this.bootstrapPolicy(name);
13305
13353
  }
13354
+ const mergeAuthority = buildMergeAuthority(keyring);
13306
13355
  let syncEngine;
13307
13356
  const targets = normalizeSyncTargets(this.options.sync);
13308
13357
  if (targets.length > 0) {
@@ -13317,6 +13366,7 @@ var Noydb = class {
13317
13366
  emitter: this.emitter,
13318
13367
  syncPolicy: effectivePolicy,
13319
13368
  role: primary.role,
13369
+ mergeAuthority,
13320
13370
  ...primary.label !== void 0 ? { label: primary.label } : {}
13321
13371
  });
13322
13372
  this.syncEngines.set(name, syncEngine);
@@ -13332,6 +13382,7 @@ var Noydb = class {
13332
13382
  emitter: this.emitter,
13333
13383
  syncPolicy: targetPolicy,
13334
13384
  role: target.role,
13385
+ mergeAuthority,
13335
13386
  ...target.label !== void 0 ? { label: target.label } : {}
13336
13387
  });
13337
13388
  this.syncEngines.set(`${name}::${index}`, engine);
@@ -14530,7 +14581,7 @@ async function createNoydb(options) {
14530
14581
  if (!options.store) options = { ...options, store: memoryStore() };
14531
14582
  validateSecretModeOptions(options);
14532
14583
  if (!options.coordinationStrategy) options = { ...options, coordinationStrategy: await createDefaultCoordinationProvider(options.store) };
14533
- if (!options.userApiFactory) options = { ...options, userApiFactory: (await import("./api-NAY63UIE.js")).createUserApi };
14584
+ if (!options.userApiFactory) options = { ...options, userApiFactory: (await import("./api-FRFEJ6WR.js")).createUserApi };
14534
14585
  if (!options.policyFactory) {
14535
14586
  const policyModule = await import("./policy/index.js");
14536
14587
  options = { ...options, policyFactory: policyModule.createNoydbPolicy, policyCheckGateFn: policyModule.checkGate };
@@ -14565,4 +14616,4 @@ export {
14565
14616
  Noydb,
14566
14617
  createNoydb
14567
14618
  };
14568
- //# sourceMappingURL=chunk-KKRFL5E2.js.map
14619
+ //# sourceMappingURL=chunk-GSRW5MTU.js.map