@noy-db/hub 0.6.0-pre.17 → 0.6.0-pre.19

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 (426) hide show
  1. package/dist/api-Z5VHH24A.js +20 -0
  2. package/dist/attestation/index.js +18 -18
  3. package/dist/{backup-7X3PFTSI.js → backup-K62BFMYK.js} +16 -16
  4. package/dist/{backup-7X3PFTSI.js.map → backup-K62BFMYK.js.map} +1 -1
  5. package/dist/blobs/index.js +13 -13
  6. package/dist/broker/index.js +12 -12
  7. package/dist/cargo/index.js +32 -32
  8. package/dist/{chunk-5SK5AFYH.js → chunk-2E2MKBMI.js} +2 -2
  9. package/dist/{chunk-SDEHNGWW.js → chunk-2IK6AC6A.js} +7 -6
  10. package/dist/{chunk-SDEHNGWW.js.map → chunk-2IK6AC6A.js.map} +1 -1
  11. package/dist/{chunk-7TZTQS4H.js → chunk-32O2N2CH.js} +48 -21
  12. package/dist/chunk-32O2N2CH.js.map +1 -0
  13. package/dist/{chunk-QKRJUPAC.js → chunk-37P5VB4N.js} +13 -16
  14. package/dist/chunk-37P5VB4N.js.map +1 -0
  15. package/dist/{chunk-5UGEGEIJ.js → chunk-3Y4OFWQJ.js} +1 -1
  16. package/dist/chunk-3Y4OFWQJ.js.map +1 -0
  17. package/dist/{chunk-7LLKPODL.js → chunk-437FDIHO.js} +3 -3
  18. package/dist/{chunk-AMKCY454.js → chunk-47ZFULEZ.js} +8 -3
  19. package/dist/{chunk-AMKCY454.js.map → chunk-47ZFULEZ.js.map} +1 -1
  20. package/dist/{chunk-4GR422R5.js → chunk-4HVTRHSA.js} +16 -9
  21. package/dist/chunk-4HVTRHSA.js.map +1 -0
  22. package/dist/{chunk-VEA35MQP.js → chunk-5BS6IQZZ.js} +11 -14
  23. package/dist/chunk-5BS6IQZZ.js.map +1 -0
  24. package/dist/{chunk-QWNYUTI2.js → chunk-5EJQNA26.js} +2 -2
  25. package/dist/{chunk-C66T4W5P.js → chunk-5J5TTSGW.js} +3 -3
  26. package/dist/{chunk-JHYISAID.js → chunk-5JT4Y5UE.js} +10 -10
  27. package/dist/{chunk-VUQZYVYX.js → chunk-6S466CMQ.js} +92 -35
  28. package/dist/chunk-6S466CMQ.js.map +1 -0
  29. package/dist/{chunk-IRHOQFA7.js → chunk-7RCZ436O.js} +2 -2
  30. package/dist/{chunk-42IDLU5V.js → chunk-A3NTKHDB.js} +2 -2
  31. package/dist/{chunk-3JQVA527.js → chunk-A4K5GLE6.js} +4 -4
  32. package/dist/{chunk-K2MR7ROB.js → chunk-APV42WPR.js} +2 -2
  33. package/dist/{chunk-MVG67SMN.js → chunk-AQF7JSQR.js} +2 -2
  34. package/dist/{chunk-VTTRWLOR.js → chunk-BP4I7IBK.js} +2 -2
  35. package/dist/{chunk-T7AEAFEE.js → chunk-BTNKPDZM.js} +3 -3
  36. package/dist/{chunk-PCXAUC65.js → chunk-C7WJNVJG.js} +2 -2
  37. package/dist/{chunk-UNR6G3EJ.js → chunk-CV7WXCZD.js} +37 -33
  38. package/dist/chunk-CV7WXCZD.js.map +1 -0
  39. package/dist/{chunk-67XA44HH.js → chunk-CVYXIN5B.js} +3 -3
  40. package/dist/{chunk-BKYQNNO3.js → chunk-D5UDZANO.js} +203 -137
  41. package/dist/chunk-D5UDZANO.js.map +1 -0
  42. package/dist/{chunk-HVR74IBG.js → chunk-DJ23QZIN.js} +2 -2
  43. package/dist/{chunk-BMDF4TLU.js → chunk-DKYEVHZH.js} +7 -10
  44. package/dist/chunk-DKYEVHZH.js.map +1 -0
  45. package/dist/{chunk-N7HOHWKF.js → chunk-DYASJSKI.js} +8 -11
  46. package/dist/{chunk-N7HOHWKF.js.map → chunk-DYASJSKI.js.map} +1 -1
  47. package/dist/{chunk-OAWVM5L6.js → chunk-E6VDPBE3.js} +13 -15
  48. package/dist/chunk-E6VDPBE3.js.map +1 -0
  49. package/dist/{chunk-WBHQX6ME.js → chunk-E6WANBD6.js} +14 -15
  50. package/dist/chunk-E6WANBD6.js.map +1 -0
  51. package/dist/{chunk-VQQUOEON.js → chunk-EG6AQBYW.js} +10 -10
  52. package/dist/{chunk-GWI65NDQ.js → chunk-EJIVFOOQ.js} +6 -6
  53. package/dist/{chunk-YGJZLOSR.js → chunk-GDGTIWB4.js} +2 -2
  54. package/dist/{chunk-TQ7IRULX.js → chunk-GILI76SU.js} +2 -2
  55. package/dist/{chunk-4444HN72.js → chunk-GT72D4FO.js} +3 -3
  56. package/dist/{chunk-OXRPH6AR.js → chunk-GYUCRDAU.js} +15 -12
  57. package/dist/chunk-GYUCRDAU.js.map +1 -0
  58. package/dist/{chunk-JV2CNEX2.js → chunk-HGAR7H5M.js} +239 -188
  59. package/dist/chunk-HGAR7H5M.js.map +1 -0
  60. package/dist/{chunk-SGEI3IJK.js → chunk-HGJC7I5F.js} +2 -2
  61. package/dist/{chunk-C52CJDFO.js → chunk-HJRTFXAA.js} +7 -10
  62. package/dist/chunk-HJRTFXAA.js.map +1 -0
  63. package/dist/chunk-HK67PX4J.js +27 -0
  64. package/dist/chunk-HK67PX4J.js.map +1 -0
  65. package/dist/{chunk-V4M4BZNW.js → chunk-HTHRCGWP.js} +2 -2
  66. package/dist/{chunk-YVOW35HH.js → chunk-HTMQBBF3.js} +5 -7
  67. package/dist/chunk-HTMQBBF3.js.map +1 -0
  68. package/dist/{chunk-QC2HGYFX.js → chunk-HUYNPLTT.js} +4 -4
  69. package/dist/{chunk-APUP2J5M.js → chunk-I26TE27S.js} +7 -7
  70. package/dist/{chunk-DEP24EE3.js → chunk-ICCRAPWD.js} +4 -4
  71. package/dist/{chunk-ES36R3U2.js → chunk-IOURTXTM.js} +52 -65
  72. package/dist/chunk-IOURTXTM.js.map +1 -0
  73. package/dist/{chunk-JU3JKOY5.js → chunk-IPDS2TYW.js} +3 -3
  74. package/dist/{chunk-QJBXB4WU.js → chunk-JHO6FGZX.js} +25 -31
  75. package/dist/chunk-JHO6FGZX.js.map +1 -0
  76. package/dist/{chunk-YDJXGYYA.js → chunk-JIF3IBRK.js} +2 -2
  77. package/dist/{chunk-S6CP5FWF.js → chunk-KBOPY6W2.js} +2 -2
  78. package/dist/{chunk-RVTOCAHQ.js → chunk-KDX6VEYV.js} +2 -2
  79. package/dist/chunk-KDX6VEYV.js.map +1 -0
  80. package/dist/{chunk-H545OIWE.js → chunk-KM6YR5XF.js} +2 -2
  81. package/dist/{chunk-AFSMT3WI.js → chunk-KUXTWVAR.js} +3 -3
  82. package/dist/{chunk-466KGOQB.js → chunk-L2XQ776M.js} +2 -2
  83. package/dist/{chunk-QI2KXQOM.js → chunk-L6FSZFG7.js} +2 -2
  84. package/dist/{chunk-EEBMKMA7.js → chunk-LAFP5H5U.js} +35 -47
  85. package/dist/chunk-LAFP5H5U.js.map +1 -0
  86. package/dist/{chunk-I7JF5TNL.js → chunk-LBDTQM3R.js} +3 -3
  87. package/dist/{chunk-V3OLO4TK.js → chunk-M4IKEOJS.js} +20 -17
  88. package/dist/chunk-M4IKEOJS.js.map +1 -0
  89. package/dist/{chunk-5NKSNW25.js → chunk-MNMYHZVU.js} +2 -2
  90. package/dist/{chunk-IEA3TZJE.js → chunk-MNUTPZRQ.js} +31 -49
  91. package/dist/chunk-MNUTPZRQ.js.map +1 -0
  92. package/dist/{chunk-Z2OFE6IX.js → chunk-MQXYR65M.js} +15 -24
  93. package/dist/chunk-MQXYR65M.js.map +1 -0
  94. package/dist/{chunk-5VVBZ6E4.js → chunk-N2HKBESK.js} +4 -4
  95. package/dist/{chunk-HNOBRU24.js → chunk-N7YAQKAO.js} +2 -2
  96. package/dist/{chunk-6U7M7AX6.js → chunk-NH2MST6J.js} +2 -2
  97. package/dist/{chunk-JAHIL6WO.js → chunk-NRNTXBHT.js} +7 -10
  98. package/dist/chunk-NRNTXBHT.js.map +1 -0
  99. package/dist/{chunk-URVL4EKU.js → chunk-NYSD43OE.js} +15 -24
  100. package/dist/chunk-NYSD43OE.js.map +1 -0
  101. package/dist/{chunk-LUFZPROB.js → chunk-ODVIFBAQ.js} +16 -17
  102. package/dist/chunk-ODVIFBAQ.js.map +1 -0
  103. package/dist/{chunk-SJOK23XT.js → chunk-OIIAXFKM.js} +4 -4
  104. package/dist/chunk-OIIAXFKM.js.map +1 -0
  105. package/dist/{chunk-FSZPQCDR.js → chunk-OQLYMBJI.js} +3 -3
  106. package/dist/{chunk-EMFFWSAD.js → chunk-OWGEHDT2.js} +10 -10
  107. package/dist/chunk-OWGEHDT2.js.map +1 -0
  108. package/dist/{chunk-I64WQSN3.js → chunk-P7L3OQLL.js} +19 -2
  109. package/dist/chunk-P7L3OQLL.js.map +1 -0
  110. package/dist/{chunk-FZ2SSI5R.js → chunk-PG6PFMDC.js} +2 -2
  111. package/dist/{chunk-2RGQNFJB.js → chunk-PZSS7MUM.js} +11 -9
  112. package/dist/chunk-PZSS7MUM.js.map +1 -0
  113. package/dist/{chunk-UKKBKEUI.js → chunk-QPIUFRUC.js} +3 -3
  114. package/dist/{chunk-RJTGXZT6.js → chunk-REL4OLWW.js} +2 -2
  115. package/dist/{chunk-N4GAJSRQ.js → chunk-RNSC2ARR.js} +3 -3
  116. package/dist/{chunk-RWPNRCK2.js → chunk-RORE2GX2.js} +2 -2
  117. package/dist/{chunk-YH65A6WM.js → chunk-RSFG7XHM.js} +2 -2
  118. package/dist/{chunk-QLMUW7OC.js → chunk-S55DBWRC.js} +2 -2
  119. package/dist/{chunk-AKFNLRA2.js → chunk-SA77BQ7F.js} +27 -143
  120. package/dist/chunk-SA77BQ7F.js.map +1 -0
  121. package/dist/{chunk-RBTZLXZJ.js → chunk-SFD2LL7G.js} +2 -2
  122. package/dist/{chunk-XTC5EKST.js → chunk-SG3OQCRG.js} +3 -3
  123. package/dist/{chunk-JN64WH3U.js → chunk-T7IR4N2S.js} +1 -1
  124. package/dist/{chunk-JN64WH3U.js.map → chunk-T7IR4N2S.js.map} +1 -1
  125. package/dist/{chunk-P5ARVLNW.js → chunk-TC6MBEGH.js} +11 -8
  126. package/dist/chunk-TC6MBEGH.js.map +1 -0
  127. package/dist/{chunk-D6E5N2O3.js → chunk-TENLCGYD.js} +12 -10
  128. package/dist/{chunk-D6E5N2O3.js.map → chunk-TENLCGYD.js.map} +1 -1
  129. package/dist/{chunk-X2FXEEQT.js → chunk-VH2W6BOG.js} +7 -7
  130. package/dist/{chunk-FHFMWYGM.js → chunk-VHVMJWM6.js} +7 -7
  131. package/dist/{chunk-FHFMWYGM.js.map → chunk-VHVMJWM6.js.map} +1 -1
  132. package/dist/{chunk-QTDAPDDV.js → chunk-VJ4B3ZXY.js} +15 -3
  133. package/dist/chunk-VJ4B3ZXY.js.map +1 -0
  134. package/dist/{chunk-RDPZMUCX.js → chunk-W6NFONOV.js} +2 -2
  135. package/dist/{chunk-Z3U2YVNM.js → chunk-WBNXZU42.js} +4 -4
  136. package/dist/{chunk-7EIPPOEL.js → chunk-WKD5ESK4.js} +2 -2
  137. package/dist/{chunk-6VAM5THN.js → chunk-YEZW6UJA.js} +15 -15
  138. package/dist/{chunk-6VAM5THN.js.map → chunk-YEZW6UJA.js.map} +1 -1
  139. package/dist/chunk-YOT7D63X.js +190 -0
  140. package/dist/chunk-YOT7D63X.js.map +1 -0
  141. package/dist/{chunk-6JRIYG2C.js → chunk-YVTADFTC.js} +14 -15
  142. package/dist/chunk-YVTADFTC.js.map +1 -0
  143. package/dist/{chunk-C3YP5KKS.js → chunk-ZBDWKPBW.js} +15 -16
  144. package/dist/chunk-ZBDWKPBW.js.map +1 -0
  145. package/dist/{chunk-NWPR2V5W.js → chunk-ZPMXYPBR.js} +2 -2
  146. package/dist/{chunk-RGPB25DB.js → chunk-ZVAFJQZB.js} +25 -19
  147. package/dist/chunk-ZVAFJQZB.js.map +1 -0
  148. package/dist/{chunk-TQLYMYOK.js → chunk-ZWKF3CD3.js} +2 -2
  149. package/dist/classified/index.js +5 -5
  150. package/dist/{classified-marker-W2PUYC3K.js → classified-marker-PMDG3O36.js} +3 -3
  151. package/dist/collection-facade-ZJK5EB33.js +45 -0
  152. package/dist/{computed-5E2OM6EN.js → computed-UHCBRILW.js} +3 -3
  153. package/dist/consent/index.js +9 -9
  154. package/dist/cover/index.js +10 -3
  155. package/dist/custody/index.js +11 -11
  156. package/dist/{dead-filter-MVFQCLXY.js → dead-filter-777VWDER.js} +2 -2
  157. package/dist/debug/index.js +1 -1
  158. package/dist/{delegation-I7XXO5LL.js → delegation-4R5DU23X.js} +23 -24
  159. package/dist/delegation-4R5DU23X.js.map +1 -0
  160. package/dist/derivations/index.js +12 -12
  161. package/dist/derive-3WAS2G5T.js +22 -0
  162. package/dist/directory/index.js +10 -10
  163. package/dist/{dispatch-PY5RUHJF.js → dispatch-3EN6YCCS.js} +18 -18
  164. package/dist/{dispatch-K3MDLCXG.js → dispatch-ASL257KG.js} +5 -5
  165. package/dist/{enclave-77K7UDLS.js → enclave-ZJS5R5RH.js} +17 -9
  166. package/dist/executor-GPM6DNWV.js +9 -0
  167. package/dist/executor-LJSMZ4IB.js +9 -0
  168. package/dist/executor-SHUVRZUJ.js +29 -0
  169. package/dist/export-accessible-GNY6DC6U.js +23 -0
  170. package/dist/extract-partition-BG3AF4NZ.js +38 -0
  171. package/dist/{fanout-sidecar-JI3MUPQV.js → fanout-sidecar-TFPWDOME.js} +18 -27
  172. package/dist/fanout-sidecar-TFPWDOME.js.map +1 -0
  173. package/dist/find-KX6OKHDP.js +11 -0
  174. package/dist/forget/index.js +9 -9
  175. package/dist/guards/index.js +4 -4
  176. package/dist/history/index.js +23 -20
  177. package/dist/history/index.js.map +1 -1
  178. package/dist/i18n/index.js +14 -14
  179. package/dist/index.d.ts +16 -0
  180. package/dist/index.js +156 -154
  181. package/dist/index.js.map +1 -1
  182. package/dist/indexing/index.js +2 -2
  183. package/dist/introspection/index.js +11 -11
  184. package/dist/issue-PAUM7NCX.js +19 -0
  185. package/dist/kernel/enclave/index.d.ts +6 -5
  186. package/dist/kernel/enclave/record-aad.d.ts +79 -7
  187. package/dist/kernel/enclave/record-envelope.d.ts +54 -7
  188. package/dist/kernel/enclave/record-keys/envelope-body.d.ts +34 -2
  189. package/dist/kernel/enclave/record-keys/lifecycle.d.ts +22 -5
  190. package/dist/kernel/enclave/record-keys/record-codec.d.ts +47 -14
  191. package/dist/kernel/enclave/record-keys/rekey.d.ts +8 -2
  192. package/dist/kernel/enclave/record-keys/tombstone.d.ts +3 -3
  193. package/dist/kernel/errors.d.ts +17 -1
  194. package/dist/kernel/merge-authority.d.ts +25 -0
  195. package/dist/kernel/tier-visibility.d.ts +15 -0
  196. package/dist/kernel/types.d.ts +8 -0
  197. package/dist/kernel/vault.d.ts +1 -1
  198. package/dist/kernel/via/index.d.ts +11 -2
  199. package/dist/{ledger-3RDSSMGD.js → ledger-62CEPRPX.js} +11 -11
  200. package/dist/liberate-7QY7TULB.js +24 -0
  201. package/dist/{link-set-VJIWWUZO.js → link-set-ZRYNUHN3.js} +11 -11
  202. package/dist/{managed-secret-XGGJ3BC3.js → managed-secret-T2WB4O47.js} +11 -3
  203. package/dist/materialized-views/index.js +22 -22
  204. package/dist/money/index.js +4 -4
  205. package/dist/noydb-VZIVPDXG.js +84 -0
  206. package/dist/overlay-views/index.js +4 -4
  207. package/dist/periods/index.js +12 -12
  208. package/dist/pod/index.js +58 -57
  209. package/dist/{pod-handle-7BVSWP5B.js → pod-handle-UPLXOGIK.js} +11 -11
  210. package/dist/{pod-handle-7BVSWP5B.js.map → pod-handle-UPLXOGIK.js.map} +1 -1
  211. package/dist/policy/index.js +11 -4
  212. package/dist/port/with/merge-authority.d.ts +52 -0
  213. package/dist/port/with/strategies.d.ts +2 -0
  214. package/dist/portability/index.js +8 -8
  215. package/dist/{post-register-W3T4U57K.js → post-register-J4DEVNXK.js} +6 -6
  216. package/dist/query/index.js +3 -3
  217. package/dist/reduce/index.js +4 -4
  218. package/dist/register-UPD4GKBC.js +32 -0
  219. package/dist/registry-7KX2HWFS.js +18 -0
  220. package/dist/registry-PKYYEHEW.js +9 -0
  221. package/dist/registry-XHCYMD34.js +19 -0
  222. package/dist/registry-XIRTZHPC.js +9 -0
  223. package/dist/request-withdrawal-XZSESWZV.js +31 -0
  224. package/dist/{reveal-G7W7N3AZ.js → reveal-525XWQU2.js} +6 -6
  225. package/dist/revoke-QI7YHQ2B.js +24 -0
  226. package/dist/satellites/index.js +1 -1
  227. package/dist/schema-update/index.js +2 -2
  228. package/dist/sealed-record/index.js +20 -13
  229. package/dist/sealed-record/index.js.map +1 -1
  230. package/dist/search/index.js +4 -4
  231. package/dist/{seed-2FUULTQV.js → seed-2KZDTFS4.js} +19 -22
  232. package/dist/seed-2KZDTFS4.js.map +1 -0
  233. package/dist/sequence/index.js +9 -9
  234. package/dist/session/index.js +9 -9
  235. package/dist/shadow/index.js +2 -2
  236. package/dist/signer-BZWDPGGN.js +25 -0
  237. package/dist/snapshots/index.js +10 -10
  238. package/dist/{stale-42FPALK2.js → stale-PQYPVCER.js} +10 -10
  239. package/dist/storage-MJHKNQRO.js +23 -0
  240. package/dist/{store-coordination-provider-Y3VXBHPL.js → store-coordination-provider-TFHZLKHG.js} +18 -12
  241. package/dist/store-coordination-provider-TFHZLKHG.js.map +1 -0
  242. package/dist/sync/index.js +11 -11
  243. package/dist/team/index.js +15 -14
  244. package/dist/tiers/index.js +11 -10
  245. package/dist/to/index.js +1 -1
  246. package/dist/transactions/index.js +3 -3
  247. package/dist/util/index.js +1 -1
  248. package/dist/vault-head/index.js +111 -0
  249. package/dist/vault-head/index.js.map +1 -0
  250. package/dist/{verify-SHJXGZGM.js → verify-J6DEOXP3.js} +5 -5
  251. package/dist/walk-BX4NSB5L.js +21 -0
  252. package/dist/with-audit/periods/periods.d.ts +1 -1
  253. package/dist/with-audit/periods/strategy.d.ts +1 -1
  254. package/dist/with-audit/sealed-record/index.d.ts +13 -0
  255. package/dist/with-audit/tiers/index.d.ts +17 -2
  256. package/dist/with-commit/history/history.d.ts +26 -0
  257. package/dist/with-commit/history/index.d.ts +2 -1
  258. package/dist/with-commit/history/ledger/store.d.ts +7 -1
  259. package/dist/with-commit/history/strategy.d.ts +11 -1
  260. package/dist/with-commit/vault-head/active.d.ts +2 -0
  261. package/dist/with-commit/vault-head/head.d.ts +28 -0
  262. package/dist/with-commit/vault-head/index.d.ts +10 -0
  263. package/dist/with-commit/vault-head/strategy.d.ts +127 -0
  264. package/dist/with-commit/vault-head/verify.d.ts +50 -0
  265. package/dist/with-party/directory/cover/storage.d.ts +0 -8
  266. package/dist/with-party/directory/storage.d.ts +0 -11
  267. package/dist/with-party/directory/visibility.d.ts +0 -21
  268. package/dist/with-party/policy/storage.d.ts +0 -10
  269. package/dist/with-party/team/tiers.d.ts +2 -1
  270. package/dist/with-sync/engine.d.ts +33 -5
  271. package/dist/with-sync/strategy.d.ts +3 -0
  272. package/dist/withdraw-accessible-K4CPMH4C.js +28 -0
  273. package/package.json +7 -3
  274. package/dist/api-AEIN3KAQ.js +0 -20
  275. package/dist/chunk-2RGQNFJB.js.map +0 -1
  276. package/dist/chunk-4GR422R5.js.map +0 -1
  277. package/dist/chunk-5UGEGEIJ.js.map +0 -1
  278. package/dist/chunk-6JRIYG2C.js.map +0 -1
  279. package/dist/chunk-7TZTQS4H.js.map +0 -1
  280. package/dist/chunk-AFHQATY4.js +0 -47
  281. package/dist/chunk-AFHQATY4.js.map +0 -1
  282. package/dist/chunk-AKFNLRA2.js.map +0 -1
  283. package/dist/chunk-BKYQNNO3.js.map +0 -1
  284. package/dist/chunk-BMDF4TLU.js.map +0 -1
  285. package/dist/chunk-C3YP5KKS.js.map +0 -1
  286. package/dist/chunk-C52CJDFO.js.map +0 -1
  287. package/dist/chunk-EEBMKMA7.js.map +0 -1
  288. package/dist/chunk-EMFFWSAD.js.map +0 -1
  289. package/dist/chunk-ES36R3U2.js.map +0 -1
  290. package/dist/chunk-I64WQSN3.js.map +0 -1
  291. package/dist/chunk-IEA3TZJE.js.map +0 -1
  292. package/dist/chunk-JAHIL6WO.js.map +0 -1
  293. package/dist/chunk-JV2CNEX2.js.map +0 -1
  294. package/dist/chunk-LUFZPROB.js.map +0 -1
  295. package/dist/chunk-OAWVM5L6.js.map +0 -1
  296. package/dist/chunk-OXRPH6AR.js.map +0 -1
  297. package/dist/chunk-P5ARVLNW.js.map +0 -1
  298. package/dist/chunk-QJBXB4WU.js.map +0 -1
  299. package/dist/chunk-QKRJUPAC.js.map +0 -1
  300. package/dist/chunk-QTDAPDDV.js.map +0 -1
  301. package/dist/chunk-RGPB25DB.js.map +0 -1
  302. package/dist/chunk-RVTOCAHQ.js.map +0 -1
  303. package/dist/chunk-SJOK23XT.js.map +0 -1
  304. package/dist/chunk-UNR6G3EJ.js.map +0 -1
  305. package/dist/chunk-URVL4EKU.js.map +0 -1
  306. package/dist/chunk-V3OLO4TK.js.map +0 -1
  307. package/dist/chunk-VEA35MQP.js.map +0 -1
  308. package/dist/chunk-VUQZYVYX.js.map +0 -1
  309. package/dist/chunk-WBHQX6ME.js.map +0 -1
  310. package/dist/chunk-YVOW35HH.js.map +0 -1
  311. package/dist/chunk-Z2OFE6IX.js.map +0 -1
  312. package/dist/collection-facade-CRXN72DU.js +0 -45
  313. package/dist/delegation-I7XXO5LL.js.map +0 -1
  314. package/dist/derive-NL7X2EFT.js +0 -22
  315. package/dist/executor-FNGVGDW3.js +0 -29
  316. package/dist/executor-PCZN2LTY.js +0 -9
  317. package/dist/executor-WFTHIDT7.js +0 -9
  318. package/dist/export-accessible-QWUYY2OY.js +0 -23
  319. package/dist/extract-partition-CGCURVS4.js +0 -38
  320. package/dist/fanout-sidecar-JI3MUPQV.js.map +0 -1
  321. package/dist/find-VBNMB42N.js +0 -11
  322. package/dist/issue-7IPUNAFA.js +0 -19
  323. package/dist/liberate-2DNJ7AJ7.js +0 -24
  324. package/dist/noydb-CLQP36JR.js +0 -83
  325. package/dist/register-YUVC4G27.js +0 -32
  326. package/dist/registry-BPKJX562.js +0 -19
  327. package/dist/registry-E4FM32KD.js +0 -9
  328. package/dist/registry-HACMULJJ.js +0 -9
  329. package/dist/registry-HRFRBFDV.js +0 -18
  330. package/dist/request-withdrawal-CXTQLMJK.js +0 -31
  331. package/dist/revoke-ZX3TZUI6.js +0 -24
  332. package/dist/seed-2FUULTQV.js.map +0 -1
  333. package/dist/signer-FPUIX63Z.js +0 -25
  334. package/dist/storage-6QODT6K5.js +0 -23
  335. package/dist/store-coordination-provider-Y3VXBHPL.js.map +0 -1
  336. package/dist/walk-5PGJI3ND.js +0 -21
  337. package/dist/withdraw-accessible-PFCQQGNP.js +0 -28
  338. /package/dist/{api-AEIN3KAQ.js.map → api-Z5VHH24A.js.map} +0 -0
  339. /package/dist/{chunk-5SK5AFYH.js.map → chunk-2E2MKBMI.js.map} +0 -0
  340. /package/dist/{chunk-7LLKPODL.js.map → chunk-437FDIHO.js.map} +0 -0
  341. /package/dist/{chunk-QWNYUTI2.js.map → chunk-5EJQNA26.js.map} +0 -0
  342. /package/dist/{chunk-C66T4W5P.js.map → chunk-5J5TTSGW.js.map} +0 -0
  343. /package/dist/{chunk-JHYISAID.js.map → chunk-5JT4Y5UE.js.map} +0 -0
  344. /package/dist/{chunk-IRHOQFA7.js.map → chunk-7RCZ436O.js.map} +0 -0
  345. /package/dist/{chunk-42IDLU5V.js.map → chunk-A3NTKHDB.js.map} +0 -0
  346. /package/dist/{chunk-3JQVA527.js.map → chunk-A4K5GLE6.js.map} +0 -0
  347. /package/dist/{chunk-K2MR7ROB.js.map → chunk-APV42WPR.js.map} +0 -0
  348. /package/dist/{chunk-MVG67SMN.js.map → chunk-AQF7JSQR.js.map} +0 -0
  349. /package/dist/{chunk-VTTRWLOR.js.map → chunk-BP4I7IBK.js.map} +0 -0
  350. /package/dist/{chunk-T7AEAFEE.js.map → chunk-BTNKPDZM.js.map} +0 -0
  351. /package/dist/{chunk-PCXAUC65.js.map → chunk-C7WJNVJG.js.map} +0 -0
  352. /package/dist/{chunk-67XA44HH.js.map → chunk-CVYXIN5B.js.map} +0 -0
  353. /package/dist/{chunk-HVR74IBG.js.map → chunk-DJ23QZIN.js.map} +0 -0
  354. /package/dist/{chunk-VQQUOEON.js.map → chunk-EG6AQBYW.js.map} +0 -0
  355. /package/dist/{chunk-GWI65NDQ.js.map → chunk-EJIVFOOQ.js.map} +0 -0
  356. /package/dist/{chunk-YGJZLOSR.js.map → chunk-GDGTIWB4.js.map} +0 -0
  357. /package/dist/{chunk-TQ7IRULX.js.map → chunk-GILI76SU.js.map} +0 -0
  358. /package/dist/{chunk-4444HN72.js.map → chunk-GT72D4FO.js.map} +0 -0
  359. /package/dist/{chunk-SGEI3IJK.js.map → chunk-HGJC7I5F.js.map} +0 -0
  360. /package/dist/{chunk-V4M4BZNW.js.map → chunk-HTHRCGWP.js.map} +0 -0
  361. /package/dist/{chunk-QC2HGYFX.js.map → chunk-HUYNPLTT.js.map} +0 -0
  362. /package/dist/{chunk-APUP2J5M.js.map → chunk-I26TE27S.js.map} +0 -0
  363. /package/dist/{chunk-DEP24EE3.js.map → chunk-ICCRAPWD.js.map} +0 -0
  364. /package/dist/{chunk-JU3JKOY5.js.map → chunk-IPDS2TYW.js.map} +0 -0
  365. /package/dist/{chunk-YDJXGYYA.js.map → chunk-JIF3IBRK.js.map} +0 -0
  366. /package/dist/{chunk-S6CP5FWF.js.map → chunk-KBOPY6W2.js.map} +0 -0
  367. /package/dist/{chunk-H545OIWE.js.map → chunk-KM6YR5XF.js.map} +0 -0
  368. /package/dist/{chunk-AFSMT3WI.js.map → chunk-KUXTWVAR.js.map} +0 -0
  369. /package/dist/{chunk-466KGOQB.js.map → chunk-L2XQ776M.js.map} +0 -0
  370. /package/dist/{chunk-QI2KXQOM.js.map → chunk-L6FSZFG7.js.map} +0 -0
  371. /package/dist/{chunk-I7JF5TNL.js.map → chunk-LBDTQM3R.js.map} +0 -0
  372. /package/dist/{chunk-5NKSNW25.js.map → chunk-MNMYHZVU.js.map} +0 -0
  373. /package/dist/{chunk-5VVBZ6E4.js.map → chunk-N2HKBESK.js.map} +0 -0
  374. /package/dist/{chunk-HNOBRU24.js.map → chunk-N7YAQKAO.js.map} +0 -0
  375. /package/dist/{chunk-6U7M7AX6.js.map → chunk-NH2MST6J.js.map} +0 -0
  376. /package/dist/{chunk-FSZPQCDR.js.map → chunk-OQLYMBJI.js.map} +0 -0
  377. /package/dist/{chunk-FZ2SSI5R.js.map → chunk-PG6PFMDC.js.map} +0 -0
  378. /package/dist/{chunk-UKKBKEUI.js.map → chunk-QPIUFRUC.js.map} +0 -0
  379. /package/dist/{chunk-RJTGXZT6.js.map → chunk-REL4OLWW.js.map} +0 -0
  380. /package/dist/{chunk-N4GAJSRQ.js.map → chunk-RNSC2ARR.js.map} +0 -0
  381. /package/dist/{chunk-RWPNRCK2.js.map → chunk-RORE2GX2.js.map} +0 -0
  382. /package/dist/{chunk-YH65A6WM.js.map → chunk-RSFG7XHM.js.map} +0 -0
  383. /package/dist/{chunk-QLMUW7OC.js.map → chunk-S55DBWRC.js.map} +0 -0
  384. /package/dist/{chunk-RBTZLXZJ.js.map → chunk-SFD2LL7G.js.map} +0 -0
  385. /package/dist/{chunk-XTC5EKST.js.map → chunk-SG3OQCRG.js.map} +0 -0
  386. /package/dist/{chunk-X2FXEEQT.js.map → chunk-VH2W6BOG.js.map} +0 -0
  387. /package/dist/{chunk-RDPZMUCX.js.map → chunk-W6NFONOV.js.map} +0 -0
  388. /package/dist/{chunk-Z3U2YVNM.js.map → chunk-WBNXZU42.js.map} +0 -0
  389. /package/dist/{chunk-7EIPPOEL.js.map → chunk-WKD5ESK4.js.map} +0 -0
  390. /package/dist/{chunk-NWPR2V5W.js.map → chunk-ZPMXYPBR.js.map} +0 -0
  391. /package/dist/{chunk-TQLYMYOK.js.map → chunk-ZWKF3CD3.js.map} +0 -0
  392. /package/dist/{classified-marker-W2PUYC3K.js.map → classified-marker-PMDG3O36.js.map} +0 -0
  393. /package/dist/{collection-facade-CRXN72DU.js.map → collection-facade-ZJK5EB33.js.map} +0 -0
  394. /package/dist/{computed-5E2OM6EN.js.map → computed-UHCBRILW.js.map} +0 -0
  395. /package/dist/{dead-filter-MVFQCLXY.js.map → dead-filter-777VWDER.js.map} +0 -0
  396. /package/dist/{derive-NL7X2EFT.js.map → derive-3WAS2G5T.js.map} +0 -0
  397. /package/dist/{dispatch-PY5RUHJF.js.map → dispatch-3EN6YCCS.js.map} +0 -0
  398. /package/dist/{dispatch-K3MDLCXG.js.map → dispatch-ASL257KG.js.map} +0 -0
  399. /package/dist/{enclave-77K7UDLS.js.map → enclave-ZJS5R5RH.js.map} +0 -0
  400. /package/dist/{executor-FNGVGDW3.js.map → executor-GPM6DNWV.js.map} +0 -0
  401. /package/dist/{executor-PCZN2LTY.js.map → executor-LJSMZ4IB.js.map} +0 -0
  402. /package/dist/{executor-WFTHIDT7.js.map → executor-SHUVRZUJ.js.map} +0 -0
  403. /package/dist/{export-accessible-QWUYY2OY.js.map → export-accessible-GNY6DC6U.js.map} +0 -0
  404. /package/dist/{extract-partition-CGCURVS4.js.map → extract-partition-BG3AF4NZ.js.map} +0 -0
  405. /package/dist/{find-VBNMB42N.js.map → find-KX6OKHDP.js.map} +0 -0
  406. /package/dist/{issue-7IPUNAFA.js.map → issue-PAUM7NCX.js.map} +0 -0
  407. /package/dist/{ledger-3RDSSMGD.js.map → ledger-62CEPRPX.js.map} +0 -0
  408. /package/dist/{liberate-2DNJ7AJ7.js.map → liberate-7QY7TULB.js.map} +0 -0
  409. /package/dist/{link-set-VJIWWUZO.js.map → link-set-ZRYNUHN3.js.map} +0 -0
  410. /package/dist/{managed-secret-XGGJ3BC3.js.map → managed-secret-T2WB4O47.js.map} +0 -0
  411. /package/dist/{noydb-CLQP36JR.js.map → noydb-VZIVPDXG.js.map} +0 -0
  412. /package/dist/{post-register-W3T4U57K.js.map → post-register-J4DEVNXK.js.map} +0 -0
  413. /package/dist/{register-YUVC4G27.js.map → register-UPD4GKBC.js.map} +0 -0
  414. /package/dist/{registry-BPKJX562.js.map → registry-7KX2HWFS.js.map} +0 -0
  415. /package/dist/{registry-E4FM32KD.js.map → registry-PKYYEHEW.js.map} +0 -0
  416. /package/dist/{registry-HACMULJJ.js.map → registry-XHCYMD34.js.map} +0 -0
  417. /package/dist/{registry-HRFRBFDV.js.map → registry-XIRTZHPC.js.map} +0 -0
  418. /package/dist/{request-withdrawal-CXTQLMJK.js.map → request-withdrawal-XZSESWZV.js.map} +0 -0
  419. /package/dist/{reveal-G7W7N3AZ.js.map → reveal-525XWQU2.js.map} +0 -0
  420. /package/dist/{revoke-ZX3TZUI6.js.map → revoke-QI7YHQ2B.js.map} +0 -0
  421. /package/dist/{signer-FPUIX63Z.js.map → signer-BZWDPGGN.js.map} +0 -0
  422. /package/dist/{stale-42FPALK2.js.map → stale-PQYPVCER.js.map} +0 -0
  423. /package/dist/{storage-6QODT6K5.js.map → storage-MJHKNQRO.js.map} +0 -0
  424. /package/dist/{verify-SHJXGZGM.js.map → verify-J6DEOXP3.js.map} +0 -0
  425. /package/dist/{walk-5PGJI3ND.js.map → walk-BX4NSB5L.js.map} +0 -0
  426. /package/dist/{withdraw-accessible-PFCQQGNP.js.map → withdraw-accessible-K4CPMH4C.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ReadOnlyFrameError
3
- } from "./chunk-I64WQSN3.js";
3
+ } from "./chunk-P7L3OQLL.js";
4
4
 
5
5
  // src/with-fork/shadow/vault-frame.ts
6
6
  var VaultFrame = class {
@@ -71,4 +71,4 @@ export {
71
71
  VaultFrame,
72
72
  CollectionFrame
73
73
  };
74
- //# sourceMappingURL=chunk-SGEI3IJK.js.map
74
+ //# sourceMappingURL=chunk-HGJC7I5F.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
- NOYDB_FORMAT_VERSION
3
- } from "./chunk-5UGEGEIJ.js";
2
+ buildRecordEnvelope
3
+ } from "./chunk-ZVAFJQZB.js";
4
4
 
5
5
  // src/with-shape/schema-update/fence.ts
6
6
  var FENCE_RECORD_ID = "schema-fence";
@@ -18,13 +18,10 @@ async function loadFence(store, vault) {
18
18
  }
19
19
  }
20
20
  async function saveFence(store, vault, fence) {
21
- const envelope = {
22
- _noydb: NOYDB_FORMAT_VERSION,
23
- _v: 1,
24
- _ts: (/* @__PURE__ */ new Date()).toISOString(),
25
- _iv: "",
26
- _data: JSON.stringify(fence)
27
- };
21
+ const envelope = buildRecordEnvelope(
22
+ { collection: META_COLLECTION, id: FENCE_RECORD_ID, version: 1 },
23
+ { iv: "", data: JSON.stringify(fence) }
24
+ );
28
25
  await store.put(vault, META_COLLECTION, FENCE_RECORD_ID, envelope);
29
26
  }
30
27
  function isFenceDoc(x) {
@@ -39,4 +36,4 @@ export {
39
36
  loadFence,
40
37
  saveFence
41
38
  };
42
- //# sourceMappingURL=chunk-C52CJDFO.js.map
39
+ //# sourceMappingURL=chunk-HJRTFXAA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-shape/schema-update/fence.ts"],"sourcesContent":["/**\n * Schema-fence document. Vault-level generation counter + drain\n * state, stored at `_meta/schema-fence` using the plaintext-envelope\n * pattern of `_meta/policy` (no PII — a counter + a state enum).\n */\nimport type { NoydbStore } from '../../kernel/types.js'\nimport { buildRecordEnvelope } from '../../kernel/enclave/index.js'\n\nexport type FenceState = 'normal' | 'draining' | 'migrating' | 'complete'\n\nexport interface FenceDoc {\n readonly currentSchemaVersion: number\n readonly fenceState: FenceState\n /**\n * Content hash (`PersistedSchemaEnvelope.hash`) of the schema most\n * recently persisted while the vault sat at `currentSchemaVersion` —\n * binds \"generation N\" to a concrete schema-content hash (#946), so\n * \"which schema is generation N\" is answerable from `schemaFenceState()`\n * alone. Optional: absent on a fresh vault (generation 0, nothing\n * persisted yet) and on a fence document written before #946.\n */\n readonly schemaHash?: string\n}\n\nexport const FENCE_RECORD_ID = 'schema-fence'\nconst META_COLLECTION = '_meta'\n\nexport const DEFAULT_FENCE: FenceDoc = { currentSchemaVersion: 0, fenceState: 'normal' }\n\nexport async function loadFence(store: NoydbStore, vault: string): Promise<FenceDoc> {\n const envelope = await store.get(vault, META_COLLECTION, FENCE_RECORD_ID)\n if (!envelope) return DEFAULT_FENCE\n try {\n const parsed = JSON.parse(envelope._data) as unknown\n if (!isFenceDoc(parsed)) return DEFAULT_FENCE\n return parsed\n } catch {\n return DEFAULT_FENCE\n }\n}\n\nexport async function saveFence(store: NoydbStore, vault: string, fence: FenceDoc): Promise<void> {\n const envelope = buildRecordEnvelope(\n { collection: META_COLLECTION, id: FENCE_RECORD_ID, version: 1 },\n { iv: '', data: JSON.stringify(fence) },\n )\n await store.put(vault, META_COLLECTION, FENCE_RECORD_ID, envelope)\n}\n\nfunction isFenceDoc(x: unknown): x is FenceDoc {\n if (x === null || typeof x !== 'object') return false\n const o = x as Record<string, unknown>\n if (typeof o['currentSchemaVersion'] !== 'number') return false\n if (o['fenceState'] !== 'normal' && o['fenceState'] !== 'draining'\n && o['fenceState'] !== 'migrating' && o['fenceState'] !== 'complete') return false\n // schemaHash is optional (#946) — a legacy fence doc without it is still valid.\n return o['schemaHash'] === undefined || typeof o['schemaHash'] === 'string'\n}\n"],"mappings":";;;;;AAwBO,IAAM,kBAAkB;AAC/B,IAAM,kBAAkB;AAEjB,IAAM,gBAA0B,EAAE,sBAAsB,GAAG,YAAY,SAAS;AAEvF,eAAsB,UAAU,OAAmB,OAAkC;AACnF,QAAM,WAAW,MAAM,MAAM,IAAI,OAAO,iBAAiB,eAAe;AACxE,MAAI,CAAC,SAAU,QAAO;AACtB,MAAI;AACF,UAAM,SAAS,KAAK,MAAM,SAAS,KAAK;AACxC,QAAI,CAAC,WAAW,MAAM,EAAG,QAAO;AAChC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAsB,UAAU,OAAmB,OAAe,OAAgC;AAChG,QAAM,WAAW;AAAA,IACf,EAAE,YAAY,iBAAiB,IAAI,iBAAiB,SAAS,EAAE;AAAA,IAC/D,EAAE,IAAI,IAAI,MAAM,KAAK,UAAU,KAAK,EAAE;AAAA,EACxC;AACA,QAAM,MAAM,IAAI,OAAO,iBAAiB,iBAAiB,QAAQ;AACnE;AAEA,SAAS,WAAW,GAA2B;AAC7C,MAAI,MAAM,QAAQ,OAAO,MAAM,SAAU,QAAO;AAChD,QAAM,IAAI;AACV,MAAI,OAAO,EAAE,sBAAsB,MAAM,SAAU,QAAO;AAC1D,MAAI,EAAE,YAAY,MAAM,YAAY,EAAE,YAAY,MAAM,cACnD,EAAE,YAAY,MAAM,eAAe,EAAE,YAAY,MAAM,WAAY,QAAO;AAE/E,SAAO,EAAE,YAAY,MAAM,UAAa,OAAO,EAAE,YAAY,MAAM;AACrE;","names":[]}
@@ -0,0 +1,27 @@
1
+ // src/with-commit/vault-head/strategy.ts
2
+ var VAULT_HEAD_COLLECTION = "_head";
3
+ var DEFAULT_HEAD_BUCKETS = 256;
4
+ function notEnabled(op) {
5
+ return new Error(
6
+ `${op} requires the vault-head capability. Pass \`vaultHeadStrategy: withVaultHead()\` from "@noy-db/hub/vault-head" to createNoydb().`
7
+ );
8
+ }
9
+ var NO_VAULT_HEAD = {
10
+ enabled: false,
11
+ bucketFor: () => "",
12
+ async note() {
13
+ },
14
+ async expected() {
15
+ throw notEnabled("vault.verifyHead()");
16
+ },
17
+ async knownIn() {
18
+ throw notEnabled("vault.verifyHead()");
19
+ }
20
+ };
21
+
22
+ export {
23
+ VAULT_HEAD_COLLECTION,
24
+ DEFAULT_HEAD_BUCKETS,
25
+ NO_VAULT_HEAD
26
+ };
27
+ //# sourceMappingURL=chunk-HK67PX4J.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-commit/vault-head/strategy.ts"],"sourcesContent":["/**\n * `withVaultHead()` — the opt-in detector for **omission** (#1044).\n *\n * ## What it is for, and what it deliberately is not\n *\n * #1041 made every envelope self-authenticating at its identity, and #1042\n * made the merge reject one that is not. What neither can catch is **absence**:\n * a store that serves a genuine, unmodified `v1` when `v7` exists, or serves\n * nothing at all. An authentic old envelope is indistinguishable from an\n * authentic current one without external knowledge of what *should* be there.\n *\n * The head is that external knowledge: an authenticated `{id → version}`\n * manifest the client writes and the store cannot forge. It is **not** a Merkle\n * chain over content — content integrity is already handled, so the head needs\n * only versions.\n *\n * ## Why it is opt-in when AAD is not\n *\n * AAD costs nothing to coordinate and closes *alteration*, so it is kernel. The\n * head costs a write per commit and needs anti-entropy; on a single-device\n * offline vault it defends against nothing. Making it kernel would tax every\n * user for a multi-writer property. ADR 0003, Decision 3.\n *\n * `SECURITY.md` states the split exactly: a store cannot alter, relocate,\n * re-tier, re-author or rewind a record; **without `withVaultHead()` it can\n * still withhold or omit.**\n *\n * ## Bucketed, and why that is not a compromise\n *\n * ADR 0003 left head granularity open and asked for it to be sized early.\n * Measured, at the documented 50K-record vault ceiling:\n *\n * | shape | write cost per commit | detection |\n * |---|---|---|\n * | one per-vault manifest | **1.1 MiB** | per-record |\n * | one per collection | the same problem, renamed | per-record |\n * | **bucketed, 256 buckets** | **~4.4 KiB** | per-record |\n *\n * Bucketing changes *only* write amplification. Each bucket still lists every\n * one of its records' versions, so detection stays per-record — which is why\n * this is not a trade-off between cost and strength. Verifying one pulled\n * record reads one bucket rather than a megabyte.\n *\n * ## Wired as a bus OBSERVER, not a call in `collection.ts`\n *\n * That is what `kernel-surface` means by \"register on the ServiceBus instead of\n * growing this file\", and it keeps the hot write path untouched for anyone who\n * has not opted in: nothing is registered at all, so `hasHandlers` stays false\n * and the dispatch never happens.\n *\n * Both `afterPut` AND `afterDelete`, because a delete is a version bump like\n * any other. A head that stopped tracking deleted records would let a store\n * resurrect one by withholding the tombstone — precisely the omission this\n * exists to catch.\n *\n * ⚠️ The registration must be UNCONDITIONAL on anything but `enabled`. Its first\n * draft sat inside `#registerForgetHooks()`, which returns early when no forget\n * subjects are declared, so the head silently recorded nothing unless the vault\n * happened to use an unrelated feature. The tests caught it only because they\n * asserted a COUNT rather than \"no error\" — a head that records nothing raises\n * no errors and sweeps perfectly clean.\n *\n * @packageDocumentation\n */\nimport type { NoydbStore, EncryptedEnvelope } from '../../kernel/types.js'\nimport type { EnclaveKey } from '../../kernel/enclave/index.js'\n\n/** Reserved collection the head's buckets live in. */\nexport const VAULT_HEAD_COLLECTION = '_head' as const\n\n/** Default bucket count — see the sizing table above. */\nexport const DEFAULT_HEAD_BUCKETS = 256\n\nexport interface WithVaultHeadOptions {\n /**\n * How many buckets the manifest is split across. Higher means smaller writes\n * and more reads to sweep the whole vault; lower means the opposite.\n * Changing it on an existing vault re-homes every entry, so treat it as a\n * layout decision rather than a tuning knob.\n */\n readonly buckets?: number\n}\n\n/** One record's expected state, as the client last committed it. */\nexport interface HeadEntry {\n readonly collection: string\n readonly id: string\n readonly version: number\n}\n\nexport interface VaultHeadStrategy {\n /**\n * Is the head actually keeping a manifest?\n *\n * An explicit flag rather than an identity check against the stub: the kernel\n * decides whether to register the write-path observer at all, and\n * `port-layering` forbids it importing `NO_VAULT_HEAD` to compare. Without\n * this, every write in a vault that never opted in would still pay a cache\n * lookup and a no-op call.\n */\n readonly enabled: boolean\n\n /** Bucket a record id lands in — pure, so callers can pre-group a batch. */\n bucketFor(collection: string, id: string): string\n\n /**\n * Record `entry` as the client's expectation for that record.\n *\n * Called on every committed write, INSIDE the same logical operation, so\n * there is no window where the record exists and the head does not know it.\n */\n note(\n store: NoydbStore,\n vault: string,\n getDEK: (collection: string) => Promise<EnclaveKey>,\n entry: HeadEntry,\n ): Promise<void>\n\n /**\n * What the client expects for `collection/id`, or `null` if the head has\n * never seen it.\n */\n expected(\n store: NoydbStore,\n vault: string,\n getDEK: (collection: string) => Promise<EnclaveKey>,\n collection: string,\n id: string,\n ): Promise<number | null>\n\n /**\n * Every record the head knows about in `collection` — the set a sweep\n * compares against what the store actually serves, which is how DELETION\n * SUPPRESSION is caught. A withheld record is absent from the store but\n * present here.\n */\n knownIn(\n store: NoydbStore,\n vault: string,\n getDEK: (collection: string) => Promise<EnclaveKey>,\n collection: string,\n ): Promise<ReadonlyMap<string, number>>\n}\n\nfunction notEnabled(op: string): Error {\n return new Error(\n `${op} requires the vault-head capability. Pass \\`vaultHeadStrategy: withVaultHead()\\` ` +\n 'from \"@noy-db/hub/vault-head\" to createNoydb().',\n )\n}\n\n/**\n * The un-opted-in stub. `note` is a NO-OP rather than a throw: the write path\n * calls it unconditionally, and a vault without the head must simply not keep\n * one. The READ side throws, because asking what the head expects when there is\n * no head is a caller error, not a silent \"nothing to report\" — the latter\n * would look exactly like a clean sweep.\n */\nexport const NO_VAULT_HEAD: VaultHeadStrategy = {\n enabled: false,\n bucketFor: () => '',\n async note() {},\n async expected() { throw notEnabled('vault.verifyHead()') },\n async knownIn() { throw notEnabled('vault.verifyHead()') },\n}\n\nexport type { EncryptedEnvelope }\n"],"mappings":";AAoEO,IAAM,wBAAwB;AAG9B,IAAM,uBAAuB;AAyEpC,SAAS,WAAW,IAAmB;AACrC,SAAO,IAAI;AAAA,IACT,GAAG,EAAE;AAAA,EAEP;AACF;AASO,IAAM,gBAAmC;AAAA,EAC9C,SAAS;AAAA,EACT,WAAW,MAAM;AAAA,EACjB,MAAM,OAAO;AAAA,EAAC;AAAA,EACd,MAAM,WAAW;AAAE,UAAM,WAAW,oBAAoB;AAAA,EAAE;AAAA,EAC1D,MAAM,UAAU;AAAE,UAAM,WAAW,oBAAoB;AAAA,EAAE;AAC3D;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ValidationError
3
- } from "./chunk-I64WQSN3.js";
3
+ } from "./chunk-P7L3OQLL.js";
4
4
 
5
5
  // src/with-audit/periods/window.ts
6
6
  var PERIODS_COLLECTION = "_periods";
@@ -23,4 +23,4 @@ export {
23
23
  PERIOD_REOPENS_COLLECTION,
24
24
  periodExclusiveUpperBound
25
25
  };
26
- //# sourceMappingURL=chunk-V4M4BZNW.js.map
26
+ //# sourceMappingURL=chunk-HTHRCGWP.js.map
@@ -1,12 +1,11 @@
1
+ import {
2
+ dekKey
3
+ } from "./chunk-47ZFULEZ.js";
1
4
  import {
2
5
  TierNotGrantedError
3
- } from "./chunk-I64WQSN3.js";
6
+ } from "./chunk-P7L3OQLL.js";
4
7
 
5
8
  // src/with-party/team/tiers.ts
6
- function dekKey(collection, tier) {
7
- if (tier <= 0) return collection;
8
- return `${collection}#${tier}`;
9
- }
10
9
  function assertTierAccess(keyring, collection, tier) {
11
10
  if (tier <= 0) return;
12
11
  if (keyring.role === "owner" || keyring.role === "admin" || keyring.role === "custodian") return;
@@ -16,7 +15,6 @@ function assertTierAccess(keyring, collection, tier) {
16
15
  }
17
16
 
18
17
  export {
19
- dekKey,
20
18
  assertTierAccess
21
19
  };
22
- //# sourceMappingURL=chunk-YVOW35HH.js.map
20
+ //# sourceMappingURL=chunk-HTMQBBF3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-party/team/tiers.ts"],"sourcesContent":["/**\n * Hierarchical access — tier-aware keyring helpers.\n *\n * The keyring's existing `deks: Map<string, CryptoKey>` is keyed by\n * collection name. extends the key space:\n *\n * `'invoices'` — tier-0 DEK (unchanged from v0.x)\n * `'invoices#1'` — tier-1 DEK\n * `'invoices#2'` — tier-2 DEK\n *\n * Tier 0 keeps the bare collection name so any keyring written\n * before tiers existed loads without migration. Tiers ≥ 1 use `#N`\n * suffixes that\n * would be invalid as user-supplied collection names (see\n * `ReservedCollectionNameError` — `#` is reserved).\n *\n * @module\n */\n\nimport type { UnlockedKeyring } from './keyring.js'\nimport { TierNotGrantedError } from '../../kernel/errors.js'\n\n/** Canonical DEK key for a given collection + tier. Tier 0 → bare name. */\n// Moved to `kernel/tier-visibility.ts` (#1042): the kernel needs it to resolve\n// a pulled envelope's DEK, and `port-layering` forbids the spine importing a\n// `with-*` service. Re-exported so every existing importer is unchanged.\nimport { dekKey } from '../../kernel/tier-visibility.js'\nexport { dekKey }\n\n/**\n * Returns the user's effective clearance for a given collection: the\n * maximum tier for which their keyring holds a DEK. Falls back to 0\n * when the user has only the tier-0 DEK (or none — the getDEK caller\n * will raise separately).\n */\nexport function effectiveClearance(keyring: UnlockedKeyring, collection: string): number {\n let max = 0\n const prefix = `${collection}#`\n for (const key of keyring.deks.keys()) {\n if (!key.startsWith(prefix)) continue\n const suffix = key.slice(prefix.length)\n const n = Number.parseInt(suffix, 10)\n if (Number.isFinite(n) && n > max) max = n\n }\n return max\n}\n\n/**\n * Assert the caller is cleared for the requested tier. Owners and\n * admins always pass (they can mint any new tier DEK on demand);\n * other roles must already hold the tier DEK — via a prior grant or\n * an active delegation — otherwise this throws `TierNotGrantedError`.\n *\n * This gate runs BEFORE `getDEK()` on the mutation path so a\n * non-cleared operator never has the opportunity to silently\n * auto-create a tier DEK they shouldn't have.\n */\nexport function assertTierAccess(\n keyring: UnlockedKeyring,\n collection: string,\n tier: number,\n): void {\n if (tier <= 0) return\n // FR-6: custodian operates every collection at every tier (admin-level\n // operational authority), so it may mint a tier DEK on demand like admin.\n if (keyring.role === 'owner' || keyring.role === 'admin' || keyring.role === 'custodian') return\n if (!keyring.deks.has(dekKey(collection, tier))) {\n throw new TierNotGrantedError(collection, tier)\n }\n}\n"],"mappings":";;;;;;;;AAyDO,SAAS,iBACd,SACA,YACA,MACM;AACN,MAAI,QAAQ,EAAG;AAGf,MAAI,QAAQ,SAAS,WAAW,QAAQ,SAAS,WAAW,QAAQ,SAAS,YAAa;AAC1F,MAAI,CAAC,QAAQ,KAAK,IAAI,OAAO,YAAY,IAAI,CAAC,GAAG;AAC/C,UAAM,IAAI,oBAAoB,YAAY,IAAI;AAAA,EAChD;AACF;","names":[]}
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  grant,
3
3
  revoke
4
- } from "./chunk-WBHQX6ME.js";
4
+ } from "./chunk-E6WANBD6.js";
5
5
  import {
6
6
  CustodyNotEnabledError
7
- } from "./chunk-I64WQSN3.js";
7
+ } from "./chunk-P7L3OQLL.js";
8
8
 
9
9
  // src/with-party/custody/active.ts
10
10
  function withCustody() {
@@ -16,7 +16,7 @@ function withCustody() {
16
16
  return host._revokeCustodianImpl(revoke, vault, options, factors);
17
17
  },
18
18
  async liberate(vault, opts) {
19
- const { liberateVault } = await import("./liberate-2DNJ7AJ7.js");
19
+ const { liberateVault } = await import("./liberate-7QY7TULB.js");
20
20
  return liberateVault(vault, opts);
21
21
  }
22
22
  };
@@ -74,4 +74,4 @@ export {
74
74
  withCustody,
75
75
  CustodyApi
76
76
  };
77
- //# sourceMappingURL=chunk-QC2HGYFX.js.map
77
+ //# sourceMappingURL=chunk-HUYNPLTT.js.map
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  createNoydb
3
- } from "./chunk-JV2CNEX2.js";
3
+ } from "./chunk-HGAR7H5M.js";
4
4
  import {
5
5
  deriveSchemaManifest
6
- } from "./chunk-OAWVM5L6.js";
6
+ } from "./chunk-E6VDPBE3.js";
7
7
  import {
8
8
  loadFence
9
- } from "./chunk-C52CJDFO.js";
9
+ } from "./chunk-HJRTFXAA.js";
10
10
  import {
11
11
  readPod,
12
12
  readPodRedirect,
13
13
  signRecord,
14
14
  verifyPodHeader,
15
15
  verifyRecord
16
- } from "./chunk-SDEHNGWW.js";
16
+ } from "./chunk-2IK6AC6A.js";
17
17
  import {
18
18
  loadKeyring
19
- } from "./chunk-WBHQX6ME.js";
19
+ } from "./chunk-E6WANBD6.js";
20
20
  import {
21
21
  ConflictError,
22
22
  MigrationRequiredError,
@@ -26,7 +26,7 @@ import {
26
26
  RedirectDepthExceededError,
27
27
  RedirectLoopError,
28
28
  RedirectUnreachableError
29
- } from "./chunk-I64WQSN3.js";
29
+ } from "./chunk-P7L3OQLL.js";
30
30
 
31
31
  // src/with-pod/pod-store.ts
32
32
  var BUNDLE_STORE_VERSION = 1;
@@ -286,4 +286,4 @@ export {
286
286
  followRedirects,
287
287
  open
288
288
  };
289
- //# sourceMappingURL=chunk-APUP2J5M.js.map
289
+ //# sourceMappingURL=chunk-I26TE27S.js.map
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  dictCollectionName
3
- } from "./chunk-OXRPH6AR.js";
3
+ } from "./chunk-GYUCRDAU.js";
4
4
  import {
5
5
  getAtPath,
6
6
  presentI18nForJoin
7
- } from "./chunk-7LLKPODL.js";
7
+ } from "./chunk-437FDIHO.js";
8
8
  import {
9
9
  PeriodClosedError,
10
10
  UnknownDictCodeError,
11
11
  ValidationError
12
- } from "./chunk-I64WQSN3.js";
12
+ } from "./chunk-P7L3OQLL.js";
13
13
 
14
14
  // src/via/lookup/registry.ts
15
15
  function enforceStaticDictOnPut(staticFields, record) {
@@ -487,4 +487,4 @@ export {
487
487
  forgetDerivedFanout,
488
488
  selfWriteFieldEqual
489
489
  };
490
- //# sourceMappingURL=chunk-DEP24EE3.js.map
490
+ //# sourceMappingURL=chunk-ICCRAPWD.js.map
@@ -1,15 +1,20 @@
1
1
  import {
2
- assertTierAccess,
3
- dekKey
4
- } from "./chunk-YVOW35HH.js";
2
+ assertTierAccess
3
+ } from "./chunk-HTMQBBF3.js";
5
4
  import {
5
+ dekKey,
6
6
  liveRecordIsElevated,
7
7
  liveRecordTier
8
- } from "./chunk-AMKCY454.js";
8
+ } from "./chunk-47ZFULEZ.js";
9
9
  import {
10
+ buildRecordAad,
10
11
  openEnvelopeJson,
11
12
  writeEnvelopeBody
12
- } from "./chunk-BKYQNNO3.js";
13
+ } from "./chunk-D5UDZANO.js";
14
+ import {
15
+ buildRecordEnvelope,
16
+ buildSealedRecordEnvelope
17
+ } from "./chunk-ZVAFJQZB.js";
13
18
  import {
14
19
  base64ToBuffer,
15
20
  bufferToBase64,
@@ -21,10 +26,7 @@ import {
21
26
  sha256Hex,
22
27
  unwrapCek,
23
28
  wrapCek
24
- } from "./chunk-QTDAPDDV.js";
25
- import {
26
- NOYDB_FORMAT_VERSION
27
- } from "./chunk-5UGEGEIJ.js";
29
+ } from "./chunk-VJ4B3ZXY.js";
28
30
  import {
29
31
  BlobIntentPendingError,
30
32
  BlobOfflineError,
@@ -35,7 +37,7 @@ import {
35
37
  UnsupportedTierCompositionError,
36
38
  ValidationError,
37
39
  isConflictError
38
- } from "./chunk-I64WQSN3.js";
40
+ } from "./chunk-P7L3OQLL.js";
39
41
 
40
42
  // src/with-shape/blobs/blob-pinning.ts
41
43
  function memoryBlobPinStore() {
@@ -301,30 +303,28 @@ function parseIntentKey(key) {
301
303
  if (idx === -1) return null;
302
304
  return { collection: key.slice(0, idx), recordId: key.slice(idx + 2) };
303
305
  }
304
- async function encodeIntentEnvelope(intent, dek, newVersion = 1) {
306
+ async function encodeIntentEnvelope(intent, dek, key, newVersion = 1) {
305
307
  const json = JSON.stringify(intent);
306
- const body = await writeEnvelopeBody(json, dek);
307
- return {
308
- _noydb: NOYDB_FORMAT_VERSION,
309
- _v: newVersion,
310
- _ts: (/* @__PURE__ */ new Date()).toISOString(),
311
- ...body
312
- };
308
+ return buildSealedRecordEnvelope(
309
+ { collection: BLOB_INTENT_COLLECTION, id: key, version: newVersion },
310
+ (identity) => writeEnvelopeBody(identity, json, dek),
311
+ {}
312
+ );
313
313
  }
314
- async function decodeIntentEnvelope(envelope, dek) {
315
- const json = await openEnvelopeJson(envelope, dek);
314
+ async function decodeIntentEnvelope(key, envelope, dek) {
315
+ const json = await openEnvelopeJson({ collection: BLOB_INTENT_COLLECTION, id: key }, envelope, dek);
316
316
  return JSON.parse(json);
317
317
  }
318
318
  async function getIntent(adapter, vault, collection, recordId, getDEK) {
319
319
  const envelope = await adapter.get(vault, BLOB_INTENT_COLLECTION, intentKey(collection, recordId));
320
320
  if (!envelope) return null;
321
321
  const dek = await getDEK(collection);
322
- return decodeIntentEnvelope(envelope, dek);
322
+ return decodeIntentEnvelope(intentKey(collection, recordId), envelope, dek);
323
323
  }
324
324
  async function createIntent(adapter, vault, collection, recordId, getDEK, intent) {
325
325
  const key = intentKey(collection, recordId);
326
326
  const dek = await getDEK(collection);
327
- const envelope = await encodeIntentEnvelope(intent, dek);
327
+ const envelope = await encodeIntentEnvelope(intent, dek, key);
328
328
  try {
329
329
  await adapter.put(vault, BLOB_INTENT_COLLECTION, key, envelope, 0);
330
330
  } catch (err) {
@@ -344,10 +344,10 @@ async function recordAppliedStamp(adapter, vault, collection, recordId, getDEK,
344
344
  for (let attempt = 0; attempt < MAX_APPLIED_STAMP_RETRIES; attempt++) {
345
345
  const envelope = await adapter.get(vault, BLOB_INTENT_COLLECTION, key);
346
346
  if (!envelope) return;
347
- const intent = await decodeIntentEnvelope(envelope, dek);
347
+ const intent = await decodeIntentEnvelope(key, envelope, dek);
348
348
  if (intent.op !== "rehome" || intent.appliedStamps?.includes(stamp)) return;
349
349
  const updated = { ...intent, appliedStamps: [...intent.appliedStamps ?? [], stamp] };
350
- const newEnvelope = await encodeIntentEnvelope(updated, dek, envelope._v + 1);
350
+ const newEnvelope = await encodeIntentEnvelope(updated, dek, key, envelope._v + 1);
351
351
  try {
352
352
  await adapter.put(vault, BLOB_INTENT_COLLECTION, key, newEnvelope, envelope._v);
353
353
  return;
@@ -366,7 +366,7 @@ async function sweepBlobIntents(adapter, vault, getDEK, resume, onResumeError) {
366
366
  const envelope = await adapter.get(vault, BLOB_INTENT_COLLECTION, key);
367
367
  if (!envelope) continue;
368
368
  const dek = await getDEK(parsed.collection);
369
- const intent = await decodeIntentEnvelope(envelope, dek);
369
+ const intent = await decodeIntentEnvelope(key, envelope, dek);
370
370
  await resume(parsed.collection, parsed.recordId, intent);
371
371
  } catch (err) {
372
372
  onResumeError?.(parsed.collection, parsed.recordId, err);
@@ -654,7 +654,7 @@ var BlobSet = class _BlobSet {
654
654
  };
655
655
  }
656
656
  const dek = await this.getDEK(dekKey(this.collection, tier ?? await this.ownerTier()));
657
- const json = await openEnvelopeJson(envelope, dek);
657
+ const json = await openEnvelopeJson({ collection: this.slotsCollection, id: this.recordId }, envelope, dek);
658
658
  return {
659
659
  slots: JSON.parse(json),
660
660
  version: envelope._v
@@ -678,38 +678,28 @@ var BlobSet = class _BlobSet {
678
678
  }
679
679
  const fromDek = await this.getDEK(dekKey(this.collection, fromTier));
680
680
  try {
681
- const json2 = await openEnvelopeJson(envelope, fromDek);
681
+ const json2 = await openEnvelopeJson({ collection: this.slotsCollection, id: this.recordId }, envelope, fromDek);
682
682
  return { slots: JSON.parse(json2), version: envelope._v, atTier: fromTier };
683
683
  } catch (err) {
684
684
  if (!(err instanceof TamperedError) || fromTier === toTier) throw err;
685
685
  }
686
686
  const toDek = await this.getDEK(dekKey(this.collection, toTier));
687
- const json = await openEnvelopeJson(envelope, toDek);
687
+ const json = await openEnvelopeJson({ collection: this.slotsCollection, id: this.recordId }, envelope, toDek);
688
688
  return { slots: JSON.parse(json), version: envelope._v, atTier: toTier };
689
689
  }
690
690
  /** @param tier See {@link loadSlots}'s `tier` param — same resolution. */
691
691
  async saveSlots(slots, currentVersion, tier) {
692
692
  const json = JSON.stringify(slots);
693
693
  const now = (/* @__PURE__ */ new Date()).toISOString();
694
+ const identity = { collection: this.slotsCollection, id: this.recordId, version: currentVersion + 1 };
695
+ const body = { ts: now };
694
696
  let envelope;
695
697
  if (this.encrypted) {
696
698
  const dek = await this.getDEK(dekKey(this.collection, tier ?? await this.ownerTier()));
697
- const { iv, data } = await encrypt(json, dek);
698
- envelope = {
699
- _noydb: NOYDB_FORMAT_VERSION,
700
- _v: currentVersion + 1,
701
- _ts: now,
702
- _iv: iv,
703
- _data: data
704
- };
699
+ const { iv, data } = await encrypt(json, dek, buildRecordAad(identity));
700
+ envelope = buildRecordEnvelope(identity, { ...body, iv, data });
705
701
  } else {
706
- envelope = {
707
- _noydb: NOYDB_FORMAT_VERSION,
708
- _v: currentVersion + 1,
709
- _ts: now,
710
- _iv: "",
711
- _data: json
712
- };
702
+ envelope = buildRecordEnvelope(identity, { ...body, iv: "", data: json });
713
703
  }
714
704
  await this.store.put(
715
705
  this.vault,
@@ -844,14 +834,14 @@ var BlobSet = class _BlobSet {
844
834
  const fallbackTier = alsoTryTier ?? (t > 0 ? 0 : void 0);
845
835
  const primaryDek = await this.getDEK(dekKey(BLOB_COLLECTION, t));
846
836
  try {
847
- const json2 = await openEnvelopeJson(envelope, primaryDek);
837
+ const json2 = await openEnvelopeJson({ collection: BLOB_INDEX_COLLECTION, id: eTag }, envelope, primaryDek);
848
838
  return { blob: JSON.parse(json2), version: envelope._v, atTier: t };
849
839
  } catch (err) {
850
840
  if (!(err instanceof TamperedError)) throw err;
851
841
  if (fallbackTier === void 0 || fallbackTier === t) throw err;
852
842
  }
853
843
  const fallbackDek = await this.getDEK(dekKey(BLOB_COLLECTION, fallbackTier));
854
- const json = await openEnvelopeJson(envelope, fallbackDek);
844
+ const json = await openEnvelopeJson({ collection: BLOB_INDEX_COLLECTION, id: eTag }, envelope, fallbackDek);
855
845
  return { blob: JSON.parse(json), version: envelope._v, atTier: fallbackTier };
856
846
  }
857
847
  /**
@@ -891,12 +881,13 @@ var BlobSet = class _BlobSet {
891
881
  const now = (/* @__PURE__ */ new Date()).toISOString();
892
882
  const newVersion = (expectedVersion ?? 0) + 1;
893
883
  let envelope;
884
+ const identity = { collection: BLOB_INDEX_COLLECTION, id: blob.eTag, version: newVersion };
894
885
  if (this.encrypted) {
895
886
  const dek = await this.getDEK(dekKey(BLOB_COLLECTION, tier ?? await this.ownerTier()));
896
- const { iv, data } = await encrypt(json, dek);
897
- envelope = { _noydb: NOYDB_FORMAT_VERSION, _v: newVersion, _ts: now, _iv: iv, _data: data };
887
+ const { iv, data } = await encrypt(json, dek, buildRecordAad(identity));
888
+ envelope = buildRecordEnvelope(identity, { ts: now, iv, data });
898
889
  } else {
899
- envelope = { _noydb: NOYDB_FORMAT_VERSION, _v: newVersion, _ts: now, _iv: "", _data: json };
890
+ envelope = buildRecordEnvelope(identity, { ts: now, iv: "", data: json });
900
891
  }
901
892
  await this.store.put(
902
893
  this.vault,
@@ -1449,7 +1440,7 @@ var BlobSet = class _BlobSet {
1449
1440
  const envelope = await this.store.get(this.vault, this.versionsCollection, key);
1450
1441
  if (!envelope) continue;
1451
1442
  try {
1452
- const record = this.encrypted ? JSON.parse(await openEnvelopeJson(envelope, dek)) : JSON.parse(envelope._data);
1443
+ const record = this.encrypted ? JSON.parse(await openEnvelopeJson({ collection: this.versionsCollection, id: key }, envelope, dek)) : JSON.parse(envelope._data);
1453
1444
  holds.set(record.eTag, (holds.get(record.eTag) ?? 0) + 1);
1454
1445
  readable.push(key);
1455
1446
  } catch {
@@ -1733,13 +1724,13 @@ var BlobSet = class _BlobSet {
1733
1724
  if (!this.encrypted) return { record: JSON.parse(envelope._data), atTier: fromTier };
1734
1725
  const fromDek = await this.getDEK(dekKey(this.collection, fromTier));
1735
1726
  try {
1736
- const json2 = await openEnvelopeJson(envelope, fromDek);
1727
+ const json2 = await openEnvelopeJson({ collection: this.versionsCollection, id: key }, envelope, fromDek);
1737
1728
  return { record: JSON.parse(json2), atTier: fromTier };
1738
1729
  } catch (err) {
1739
1730
  if (!(err instanceof TamperedError) || fromTier === toTier) throw err;
1740
1731
  }
1741
1732
  const toDek = await this.getDEK(dekKey(this.collection, toTier));
1742
- const json = await openEnvelopeJson(envelope, toDek);
1733
+ const json = await openEnvelopeJson({ collection: this.versionsCollection, id: key }, envelope, toDek);
1743
1734
  return { record: JSON.parse(json), atTier: toTier };
1744
1735
  }
1745
1736
  /**
@@ -1901,18 +1892,13 @@ var BlobSet = class _BlobSet {
1901
1892
  const id = `${eTag}_${index}`;
1902
1893
  const now = (/* @__PURE__ */ new Date()).toISOString();
1903
1894
  let envelope;
1895
+ const identity = { collection: BLOB_CHUNKS_COLLECTION, id, version: 1 };
1904
1896
  if (dek) {
1905
1897
  const aad = chunkAAD(eTag, index, chunkCount);
1906
1898
  const { iv, data } = await encryptBytesWithAAD(chunk, dek, aad);
1907
- envelope = { _noydb: NOYDB_FORMAT_VERSION, _v: 1, _ts: now, _iv: iv, _data: data };
1899
+ envelope = buildRecordEnvelope(identity, { ts: now, iv, data });
1908
1900
  } else {
1909
- envelope = {
1910
- _noydb: NOYDB_FORMAT_VERSION,
1911
- _v: 1,
1912
- _ts: now,
1913
- _iv: "",
1914
- _data: bufferToBase64(chunk)
1915
- };
1901
+ envelope = buildRecordEnvelope(identity, { ts: now, iv: "", data: bufferToBase64(chunk) });
1916
1902
  }
1917
1903
  await this.store.put(this.vault, BLOB_CHUNKS_COLLECTION, id, envelope);
1918
1904
  }
@@ -1962,7 +1948,7 @@ var BlobSet = class _BlobSet {
1962
1948
  return JSON.parse(envelope._data);
1963
1949
  }
1964
1950
  const dek = await this.getDEK(dekKey(this.collection, tier ?? await this.ownerTier()));
1965
- const json = await openEnvelopeJson(envelope, dek);
1951
+ const json = await openEnvelopeJson({ collection: this.versionsCollection, id: key }, envelope, dek);
1966
1952
  return JSON.parse(json);
1967
1953
  }
1968
1954
  /** @param tier See {@link loadVersionRecord}'s `tier` param — same resolution. */
@@ -1983,12 +1969,13 @@ var BlobSet = class _BlobSet {
1983
1969
  const json = JSON.stringify(record);
1984
1970
  const now = (/* @__PURE__ */ new Date()).toISOString();
1985
1971
  let envelope;
1972
+ const identity = { collection: this.versionsCollection, id: key, version: 1 };
1986
1973
  if (this.encrypted) {
1987
1974
  const dek = await this.getDEK(dekKey(this.collection, tier));
1988
- const { iv, data } = await encrypt(json, dek);
1989
- envelope = { _noydb: NOYDB_FORMAT_VERSION, _v: 1, _ts: now, _iv: iv, _data: data };
1975
+ const { iv, data } = await encrypt(json, dek, buildRecordAad(identity));
1976
+ envelope = buildRecordEnvelope(identity, { ts: now, iv, data });
1990
1977
  } else {
1991
- envelope = { _noydb: NOYDB_FORMAT_VERSION, _v: 1, _ts: now, _iv: "", _data: json };
1978
+ envelope = buildRecordEnvelope(identity, { ts: now, iv: "", data: json });
1992
1979
  }
1993
1980
  await this.store.put(this.vault, this.versionsCollection, key, envelope);
1994
1981
  }
@@ -2887,7 +2874,7 @@ var BlobSet = class _BlobSet {
2887
2874
  versions.push(JSON.parse(envelope._data));
2888
2875
  } else {
2889
2876
  const dek = await this.getDEK(this.collection);
2890
- const json = await openEnvelopeJson(envelope, dek);
2877
+ const json = await openEnvelopeJson({ collection: this.versionsCollection, id: key }, envelope, dek);
2891
2878
  versions.push(JSON.parse(json));
2892
2879
  }
2893
2880
  }
@@ -3070,4 +3057,4 @@ export {
3070
3057
  DEFAULT_CHUNK_SIZE,
3071
3058
  BlobSet
3072
3059
  };
3073
- //# sourceMappingURL=chunk-ES36R3U2.js.map
3060
+ //# sourceMappingURL=chunk-IOURTXTM.js.map