@noy-db/hub 0.6.0-pre.9 → 0.7.0-pre.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (572) hide show
  1. package/CHANGELOG.md +7127 -0
  2. package/README.md +1 -1
  3. package/codemods/0.4.0-pre.json +24 -0
  4. package/codemods/0.6.0-pre.json +229 -0
  5. package/codemods/0.7.0-pre.json +258 -0
  6. package/dist/api-EQYRTZO2.js +20 -0
  7. package/dist/as/index.js +146 -0
  8. package/dist/as/index.js.map +1 -0
  9. package/dist/at/index.js +23 -0
  10. package/dist/attestation/index.js +19 -19
  11. package/dist/{backup-KULFZ2T4.js → backup-Z7ZBTAQ6.js} +36 -18
  12. package/dist/backup-Z7ZBTAQ6.js.map +1 -0
  13. package/dist/blobs/index.js +22 -20
  14. package/dist/blobs/index.js.map +1 -1
  15. package/dist/broker/index.js +12 -12
  16. package/dist/by/index.js +11 -0
  17. package/dist/cargo/index.js +40 -36
  18. package/dist/{chunk-YAWK6AWF.js → chunk-225O5CXQ.js} +2 -2
  19. package/dist/{chunk-MSWYQLMQ.js → chunk-2GXEQUEX.js} +2 -2
  20. package/dist/chunk-2GXEQUEX.js.map +1 -0
  21. package/dist/{chunk-3URQC7EH.js → chunk-2LPVI4PX.js} +355 -132
  22. package/dist/chunk-2LPVI4PX.js.map +1 -0
  23. package/dist/{chunk-JJNOLSG5.js → chunk-3L2MVE36.js} +15 -16
  24. package/dist/chunk-3L2MVE36.js.map +1 -0
  25. package/dist/{chunk-OF3L2SD6.js → chunk-3QARDAYW.js} +2 -2
  26. package/dist/{chunk-WLZ47GSL.js → chunk-467SKJ65.js} +12 -10
  27. package/dist/{chunk-WLZ47GSL.js.map → chunk-467SKJ65.js.map} +1 -1
  28. package/dist/{chunk-W3TVWF6N.js → chunk-4A4TYISP.js} +2 -2
  29. package/dist/{chunk-ZJADGNYF.js → chunk-4AOERLTV.js} +1 -1
  30. package/dist/chunk-4AOERLTV.js.map +1 -0
  31. package/dist/{chunk-CCZJJ4I2.js → chunk-4G25SDQL.js} +6 -6
  32. package/dist/{chunk-4I72F5DF.js → chunk-4LPF226H.js} +11 -14
  33. package/dist/chunk-4LPF226H.js.map +1 -0
  34. package/dist/{chunk-7F4DBNSP.js → chunk-4ZPE6SKS.js} +135 -18
  35. package/dist/chunk-4ZPE6SKS.js.map +1 -0
  36. package/dist/{chunk-7TSYBD3E.js → chunk-5263OEM3.js} +2 -2
  37. package/dist/{chunk-WFUIE565.js → chunk-57JTHWLQ.js} +17 -14
  38. package/dist/chunk-57JTHWLQ.js.map +1 -0
  39. package/dist/{chunk-FNSMZQS4.js → chunk-5ACAVJUI.js} +2 -2
  40. package/dist/{chunk-PDLLCOGD.js → chunk-5AFMP532.js} +20 -17
  41. package/dist/chunk-5AFMP532.js.map +1 -0
  42. package/dist/{chunk-JRKZTEZZ.js → chunk-5W7YXFV5.js} +444 -73
  43. package/dist/chunk-5W7YXFV5.js.map +1 -0
  44. package/dist/chunk-6EW2UCVF.js +190 -0
  45. package/dist/chunk-6EW2UCVF.js.map +1 -0
  46. package/dist/{chunk-4VUPLMZ6.js → chunk-6FOGTKBY.js} +68 -73
  47. package/dist/chunk-6FOGTKBY.js.map +1 -0
  48. package/dist/{chunk-VMCCGUQB.js → chunk-7LYUJNU3.js} +2 -2
  49. package/dist/{chunk-52JPHN5N.js → chunk-A2YW5EMU.js} +27 -149
  50. package/dist/chunk-A2YW5EMU.js.map +1 -0
  51. package/dist/{chunk-WLYIROCJ.js → chunk-AB5P32RE.js} +2 -2
  52. package/dist/{chunk-PL2GHSCM.js → chunk-ALB64CZM.js} +157 -90
  53. package/dist/chunk-ALB64CZM.js.map +1 -0
  54. package/dist/{chunk-SUFG5E73.js → chunk-ALUNQEBY.js} +2 -2
  55. package/dist/{chunk-CADUYBQD.js → chunk-ATL3ZVXT.js} +2 -2
  56. package/dist/{chunk-BWVKEOPE.js → chunk-ATV637J7.js} +7 -11
  57. package/dist/chunk-ATV637J7.js.map +1 -0
  58. package/dist/{chunk-DG27IUVI.js → chunk-CBRS2NEK.js} +2 -11
  59. package/dist/chunk-CBRS2NEK.js.map +1 -0
  60. package/dist/{chunk-7MNBICB5.js → chunk-CN6B5PEN.js} +16 -14
  61. package/dist/chunk-CN6B5PEN.js.map +1 -0
  62. package/dist/{chunk-6FJWSWFT.js → chunk-DBNYPLWY.js} +3 -3
  63. package/dist/{chunk-5JY5TSVY.js → chunk-DFAUMLD7.js} +25 -31
  64. package/dist/chunk-DFAUMLD7.js.map +1 -0
  65. package/dist/{chunk-FFDNKRCY.js → chunk-DKWPJOYH.js} +2 -2
  66. package/dist/chunk-DKWPJOYH.js.map +1 -0
  67. package/dist/{chunk-VJFMXYKP.js → chunk-E6YA6UAP.js} +2 -2
  68. package/dist/{chunk-WASHZV34.js → chunk-F23WQK3G.js} +65 -27
  69. package/dist/chunk-F23WQK3G.js.map +1 -0
  70. package/dist/{chunk-JIUVJ4M7.js → chunk-F7ZFRPGQ.js} +3 -3
  71. package/dist/{chunk-HXGUIPQB.js → chunk-FOG7YEJP.js} +3 -3
  72. package/dist/{chunk-QULVCV3M.js → chunk-GK4DRVUD.js} +6 -6
  73. package/dist/chunk-GK4DRVUD.js.map +1 -0
  74. package/dist/{chunk-BRVW2GS5.js → chunk-H36KSN6X.js} +87 -34
  75. package/dist/chunk-H36KSN6X.js.map +1 -0
  76. package/dist/{chunk-O2ERS4UJ.js → chunk-H4M7ADXY.js} +81 -52
  77. package/dist/chunk-H4M7ADXY.js.map +1 -0
  78. package/dist/{chunk-FZ6NYJ7L.js → chunk-H7HP56F6.js} +11 -8
  79. package/dist/chunk-H7HP56F6.js.map +1 -0
  80. package/dist/chunk-HK67PX4J.js +27 -0
  81. package/dist/chunk-HK67PX4J.js.map +1 -0
  82. package/dist/{chunk-X56RTUK3.js → chunk-HM4JSXX2.js} +3 -3
  83. package/dist/{chunk-AHLJSVRL.js → chunk-HTGRQZFB.js} +5 -7
  84. package/dist/chunk-HTGRQZFB.js.map +1 -0
  85. package/dist/{chunk-GQ3BX5EA.js → chunk-I3ISCYT7.js} +2 -2
  86. package/dist/{chunk-Q6TEJXBX.js → chunk-IESNYJXZ.js} +31 -49
  87. package/dist/chunk-IESNYJXZ.js.map +1 -0
  88. package/dist/{chunk-FUHKW252.js → chunk-J4MN6XIU.js} +2 -2
  89. package/dist/{chunk-ADW22QSB.js → chunk-J4UJ5FRV.js} +4 -4
  90. package/dist/{chunk-HNGSV2YC.js → chunk-JBIV4FLR.js} +67 -10
  91. package/dist/chunk-JBIV4FLR.js.map +1 -0
  92. package/dist/{chunk-HVQGCKY4.js → chunk-JVLSU7S2.js} +2 -2
  93. package/dist/{chunk-AR2JDFAE.js → chunk-KDJGJR7F.js} +2 -2
  94. package/dist/{chunk-NPP5R7FF.js → chunk-KN4W2OQ4.js} +22 -18
  95. package/dist/chunk-KN4W2OQ4.js.map +1 -0
  96. package/dist/{chunk-G6S5VVHP.js → chunk-L6GTLZRK.js} +10 -10
  97. package/dist/chunk-L6GTLZRK.js.map +1 -0
  98. package/dist/{chunk-2BMRJ6LQ.js → chunk-LF6DMX4C.js} +8 -11
  99. package/dist/{chunk-2BMRJ6LQ.js.map → chunk-LF6DMX4C.js.map} +1 -1
  100. package/dist/chunk-LFUID7OW.js +163 -0
  101. package/dist/chunk-LFUID7OW.js.map +1 -0
  102. package/dist/{chunk-747LRSOO.js → chunk-LKFKXS5K.js} +2 -2
  103. package/dist/{chunk-U5O6GIWZ.js → chunk-LR4Z47QD.js} +3 -3
  104. package/dist/{chunk-VZ3XFUQ7.js → chunk-MTBXJAS4.js} +16 -22
  105. package/dist/chunk-MTBXJAS4.js.map +1 -0
  106. package/dist/chunk-N4CNVSUF.js +66 -0
  107. package/dist/chunk-N4CNVSUF.js.map +1 -0
  108. package/dist/{chunk-RTAMLDWP.js → chunk-NLKLXXTO.js} +2 -2
  109. package/dist/{chunk-IGJCYUT5.js → chunk-NSITFOCJ.js} +1 -1
  110. package/dist/chunk-NSITFOCJ.js.map +1 -0
  111. package/dist/{chunk-FDX7OWWI.js → chunk-OPXR4PB2.js} +2 -2
  112. package/dist/{chunk-4GZ6XOVW.js → chunk-OWLVBOWO.js} +44 -42
  113. package/dist/chunk-OWLVBOWO.js.map +1 -0
  114. package/dist/{chunk-Z45YRGFO.js → chunk-P6ASQOZR.js} +2 -2
  115. package/dist/{chunk-5O5HRRTV.js → chunk-PCQDY6QN.js} +7 -7
  116. package/dist/{chunk-5O5HRRTV.js.map → chunk-PCQDY6QN.js.map} +1 -1
  117. package/dist/{chunk-BEFVYAR5.js → chunk-PGFKIOR3.js} +4 -4
  118. package/dist/chunk-PGFKIOR3.js.map +1 -0
  119. package/dist/{chunk-3FSX6LDG.js → chunk-POS53FG6.js} +18 -3
  120. package/dist/{chunk-3FSX6LDG.js.map → chunk-POS53FG6.js.map} +1 -1
  121. package/dist/{chunk-3IXIU6FP.js → chunk-PQ6Z2TAP.js} +7 -10
  122. package/dist/chunk-PQ6Z2TAP.js.map +1 -0
  123. package/dist/{chunk-CEJWMBXO.js → chunk-PUJTKLPL.js} +6 -2
  124. package/dist/chunk-PUJTKLPL.js.map +1 -0
  125. package/dist/{chunk-GAG7QOVO.js → chunk-QGJ4XIA7.js} +53 -18
  126. package/dist/chunk-QGJ4XIA7.js.map +1 -0
  127. package/dist/{chunk-2DHSSLOD.js → chunk-QHJKK77B.js} +13 -15
  128. package/dist/chunk-QHJKK77B.js.map +1 -0
  129. package/dist/{chunk-2Z3NCLNX.js → chunk-QI5NWLVW.js} +7 -7
  130. package/dist/{chunk-6SAFL5YE.js → chunk-RC4BROYR.js} +3 -3
  131. package/dist/{chunk-NJDQ4YSV.js → chunk-RDHUZ674.js} +4 -4
  132. package/dist/{chunk-YPYHVOXP.js → chunk-RK7N4OQ5.js} +2 -2
  133. package/dist/chunk-RK7N4OQ5.js.map +1 -0
  134. package/dist/{chunk-3737A6EA.js → chunk-S2VG3ABP.js} +127 -31
  135. package/dist/chunk-S2VG3ABP.js.map +1 -0
  136. package/dist/{chunk-3JVXVJ7L.js → chunk-S35S77YU.js} +10 -10
  137. package/dist/{chunk-KUDZVJKQ.js → chunk-SHILAQH5.js} +2 -2
  138. package/dist/{chunk-4UVDI4XE.js → chunk-T3PHCEN4.js} +4 -4
  139. package/dist/{chunk-55LKVALY.js → chunk-T7IR4N2S.js} +1 -3
  140. package/dist/chunk-T7IR4N2S.js.map +1 -0
  141. package/dist/{chunk-RXYYFSBB.js → chunk-TOV6VMHF.js} +6 -6
  142. package/dist/chunk-TOV6VMHF.js.map +1 -0
  143. package/dist/{chunk-W77KZHCW.js → chunk-TVIFAHZR.js} +16 -17
  144. package/dist/chunk-TVIFAHZR.js.map +1 -0
  145. package/dist/chunk-UBSFPGVJ.js +1 -0
  146. package/dist/{chunk-FAXZQ5UF.js → chunk-UCUALOSM.js} +2 -2
  147. package/dist/{chunk-4HDYQL3J.js → chunk-VAG47QHV.js} +2 -2
  148. package/dist/{chunk-35EBKWQU.js → chunk-VFIWDPXZ.js} +4 -4
  149. package/dist/{chunk-5ZKS6ZE2.js → chunk-VTG7327U.js} +4 -4
  150. package/dist/chunk-VTG7327U.js.map +1 -0
  151. package/dist/{chunk-VCETL77O.js → chunk-W5LHQXZU.js} +36 -7
  152. package/dist/chunk-W5LHQXZU.js.map +1 -0
  153. package/dist/{chunk-6NVPFKN3.js → chunk-WK5FSW7T.js} +92 -35
  154. package/dist/chunk-WK5FSW7T.js.map +1 -0
  155. package/dist/{chunk-HNHCQ556.js → chunk-WLLUM35R.js} +2 -2
  156. package/dist/{chunk-YJ6IONGA.js → chunk-X62MEF2O.js} +13 -5
  157. package/dist/chunk-X62MEF2O.js.map +1 -0
  158. package/dist/{chunk-7G6VDWXB.js → chunk-X67FCULK.js} +5 -5
  159. package/dist/chunk-X67FCULK.js.map +1 -0
  160. package/dist/{chunk-UHXCLPGC.js → chunk-XDVVBETV.js} +2 -2
  161. package/dist/chunk-XDVVBETV.js.map +1 -0
  162. package/dist/chunk-XJ3FEKEY.js +15 -0
  163. package/dist/chunk-XJ3FEKEY.js.map +1 -0
  164. package/dist/{chunk-E6427JU2.js → chunk-XSN63FUS.js} +19 -3
  165. package/dist/chunk-XSN63FUS.js.map +1 -0
  166. package/dist/{chunk-JRCYZEHU.js → chunk-XVU7J43V.js} +2 -2
  167. package/dist/{chunk-2GAJGUNM.js → chunk-Y3YLJORD.js} +408 -260
  168. package/dist/chunk-Y3YLJORD.js.map +1 -0
  169. package/dist/{chunk-6BU3L4UE.js → chunk-Y6GZ2P4M.js} +7 -10
  170. package/dist/chunk-Y6GZ2P4M.js.map +1 -0
  171. package/dist/{chunk-DMQCLZ4Z.js → chunk-YCSM3GZU.js} +2 -2
  172. package/dist/{chunk-RV3ARMPN.js → chunk-YKPGQJFU.js} +30 -180
  173. package/dist/chunk-YKPGQJFU.js.map +1 -0
  174. package/dist/{chunk-FMQJZH4R.js → chunk-YMLQBZFJ.js} +6 -6
  175. package/dist/{chunk-6HFM7EIT.js → chunk-YPSOHDNC.js} +2 -2
  176. package/dist/{chunk-CDB2HVQW.js → chunk-YXA2TCTZ.js} +14 -15
  177. package/dist/chunk-YXA2TCTZ.js.map +1 -0
  178. package/dist/{chunk-N35NC4JH.js → chunk-Z2PWOSCJ.js} +2 -2
  179. package/dist/{chunk-XWX7GL56.js → chunk-Z2WK53N6.js} +47 -23
  180. package/dist/chunk-Z2WK53N6.js.map +1 -0
  181. package/dist/{chunk-HPLWFNG4.js → chunk-Z7ZXZL6Y.js} +2 -2
  182. package/dist/{chunk-PNKHAKQ7.js → chunk-ZO252Q5S.js} +17 -10
  183. package/dist/chunk-ZO252Q5S.js.map +1 -0
  184. package/dist/classified/index.js +5 -5
  185. package/dist/{classified-marker-2KJAXRRO.js → classified-marker-BSQHU4JT.js} +3 -3
  186. package/dist/collection-facade-LG3NYZVB.js +45 -0
  187. package/dist/{computed-6G5M3UPH.js → computed-ASBNTLOK.js} +3 -3
  188. package/dist/consent/index.js +10 -10
  189. package/dist/cover/index.js +10 -3
  190. package/dist/custody/index.js +12 -11
  191. package/dist/{dead-filter-DCB62VWW.js → dead-filter-QKU56XTQ.js} +2 -2
  192. package/dist/debug/index.js +1 -1
  193. package/dist/{delegation-MO7YZYJS.js → delegation-XWRPYODW.js} +24 -23
  194. package/dist/delegation-XWRPYODW.js.map +1 -0
  195. package/dist/derivations/index.js +12 -12
  196. package/dist/derive-CXHCY46K.js +22 -0
  197. package/dist/directory/index.js +10 -10
  198. package/dist/{dispatch-MJ6SHB3Y.js → dispatch-4AP4PUZU.js} +18 -18
  199. package/dist/{dispatch-FZEAWKVM.js → dispatch-VR4LRXZ7.js} +9 -6
  200. package/dist/dispatch-VR4LRXZ7.js.map +1 -0
  201. package/dist/{enclave-JU4YIEPB.js → enclave-NYPT7WA7.js} +31 -9
  202. package/dist/executor-3KFRQETS.js +29 -0
  203. package/dist/executor-AFHQYRAU.js +9 -0
  204. package/dist/executor-YYDW6XQI.js +9 -0
  205. package/dist/export-accessible-BX2ILB4C.js +23 -0
  206. package/dist/extract-partition-UPOVITFI.js +38 -0
  207. package/dist/{fanout-sidecar-NNAJQXMX.js → fanout-sidecar-IWP3R4RC.js} +18 -27
  208. package/dist/fanout-sidecar-IWP3R4RC.js.map +1 -0
  209. package/dist/{fence-watcher-DHQ775JB.js → fence-watcher-ZVSMLKQD.js} +1 -1
  210. package/dist/fence-watcher-ZVSMLKQD.js.map +1 -0
  211. package/dist/find-SZBL2HPB.js +11 -0
  212. package/dist/forget/index.js +9 -9
  213. package/dist/guards/index.js +4 -4
  214. package/dist/history/index.js +23 -20
  215. package/dist/history/index.js.map +1 -1
  216. package/dist/i18n/index.js +14 -14
  217. package/dist/index.d.ts +35 -18
  218. package/dist/index.js +199 -204
  219. package/dist/index.js.map +1 -1
  220. package/dist/indexing/index.js +4 -4
  221. package/dist/introspection/index.js +12 -11
  222. package/dist/issue-G53NB6EW.js +19 -0
  223. package/dist/kernel/collection-config.d.ts +9 -9
  224. package/dist/kernel/collection.d.ts +9 -3
  225. package/dist/kernel/constants.d.ts +36 -0
  226. package/dist/kernel/enclave/crypto.d.ts +52 -4
  227. package/dist/kernel/enclave/index.d.ts +10 -3
  228. package/dist/kernel/enclave/record-aad.d.ts +131 -0
  229. package/dist/kernel/enclave/record-envelope.d.ts +76 -0
  230. package/dist/kernel/enclave/record-keys/envelope-body.d.ts +34 -2
  231. package/dist/kernel/enclave/record-keys/lifecycle.d.ts +22 -5
  232. package/dist/kernel/enclave/record-keys/record-codec.d.ts +47 -14
  233. package/dist/kernel/enclave/record-keys/rekey-blob.d.ts +88 -0
  234. package/dist/kernel/enclave/record-keys/rekey.d.ts +91 -0
  235. package/dist/kernel/enclave/record-keys/tombstone.d.ts +3 -2
  236. package/dist/kernel/errors.d.ts +134 -14
  237. package/dist/kernel/merge-authority.d.ts +25 -0
  238. package/dist/kernel/noydb.d.ts +33 -10
  239. package/dist/kernel/query/builder.d.ts +51 -4
  240. package/dist/kernel/query/join.d.ts +27 -0
  241. package/dist/kernel/query/live.d.ts +31 -9
  242. package/dist/kernel/query/predicate.d.ts +9 -0
  243. package/dist/kernel/refs.d.ts +3 -1
  244. package/dist/kernel/secret-mode.d.ts +1 -1
  245. package/dist/kernel/sync-policy.d.ts +0 -2
  246. package/dist/kernel/tier-visibility.d.ts +34 -0
  247. package/dist/kernel/types.d.ts +145 -28
  248. package/dist/kernel/vault.d.ts +16 -7
  249. package/dist/kernel/via/compose.d.ts +3 -3
  250. package/dist/kernel/via/index.d.ts +15 -6
  251. package/dist/kernel/via/pipeline.d.ts +6 -6
  252. package/dist/kernel/via/reconcile.d.ts +14 -2
  253. package/dist/kernel/via/taint-binding.d.ts +3 -3
  254. package/dist/{ledger-AETNF4OM.js → ledger-T5K4P2D7.js} +11 -11
  255. package/dist/liberate-VEOZRESE.js +25 -0
  256. package/dist/{link-set-E5HNY67I.js → link-set-76JZ6YB4.js} +11 -11
  257. package/dist/{managed-secret-CWQ6PND5.js → managed-secret-6YC32VXG.js} +13 -5
  258. package/dist/materialized-views/index.js +27 -27
  259. package/dist/migrate-cek-LBRKYUZZ.js +19 -0
  260. package/dist/migrate-cek-LBRKYUZZ.js.map +1 -0
  261. package/dist/money/index.js +5 -5
  262. package/dist/noydb-EDJA4JNJ.js +86 -0
  263. package/dist/on/index.js +1 -0
  264. package/dist/overlay-views/index.js +4 -4
  265. package/dist/periods/index.js +12 -12
  266. package/dist/pod/index.js +79 -88
  267. package/dist/pod-handle-P6DPBM5U.js +41 -0
  268. package/dist/pod-handle-P6DPBM5U.js.map +1 -0
  269. package/dist/policy/index.js +11 -4
  270. package/dist/port/as/active.d.ts +10 -0
  271. package/dist/port/as/index.d.ts +32 -0
  272. package/dist/port/as/types.d.ts +113 -0
  273. package/dist/port/at/index.d.ts +37 -0
  274. package/dist/port/by/default-provider.d.ts +3 -3
  275. package/dist/port/by/index.d.ts +32 -10
  276. package/dist/port/by/types.d.ts +29 -11
  277. package/dist/port/on/index.d.ts +50 -0
  278. package/dist/port/to/index.d.ts +4 -4
  279. package/dist/port/to/locator.d.ts +54 -8
  280. package/dist/port/with/computed-strategy.d.ts +1 -1
  281. package/dist/port/with/device-seal-strategy.d.ts +2 -2
  282. package/dist/port/with/formats-strategy.d.ts +76 -0
  283. package/dist/port/with/i18n-strategy.d.ts +4 -1
  284. package/dist/port/with/lookup-strategy.d.ts +4 -1
  285. package/dist/port/with/merge-authority.d.ts +52 -0
  286. package/dist/port/with/service-bus.d.ts +0 -4
  287. package/dist/port/with/strategies.d.ts +13 -5
  288. package/dist/port/with/team-strategy.d.ts +5 -1
  289. package/dist/portability/index.js +8 -8
  290. package/dist/{post-register-2XSSMGEQ.js → post-register-53O7AJRZ.js} +6 -6
  291. package/dist/query/index.js +6 -6
  292. package/dist/reduce/index.js +6 -6
  293. package/dist/register-6TCBR6XD.js +32 -0
  294. package/dist/registry-DH2L4O2V.js +18 -0
  295. package/dist/registry-IWFMXCHX.js +9 -0
  296. package/dist/registry-Q3FG3OAX.js +9 -0
  297. package/dist/registry-YC3IFG3A.js +19 -0
  298. package/dist/request-withdrawal-NM5VYR6F.js +31 -0
  299. package/dist/{reveal-BW36KCOQ.js → reveal-XBIMHAXR.js} +6 -6
  300. package/dist/revoke-MJNYWO72.js +24 -0
  301. package/dist/satellites/index.js +1 -1
  302. package/dist/schema-update/index.js +2 -2
  303. package/dist/sealed-record/index.js +20 -13
  304. package/dist/sealed-record/index.js.map +1 -1
  305. package/dist/search/index.js +4 -4
  306. package/dist/{seed-GDV5PT4R.js → seed-NSNIGYXE.js} +20 -22
  307. package/dist/seed-NSNIGYXE.js.map +1 -0
  308. package/dist/sequence/index.js +9 -9
  309. package/dist/session/index.js +10 -10
  310. package/dist/shadow/index.js +2 -2
  311. package/dist/share-link/index.js +1 -1
  312. package/dist/signer-6XVS2AU3.js +25 -0
  313. package/dist/snapshots/index.js +10 -10
  314. package/dist/snapshots/index.js.map +1 -1
  315. package/dist/{stale-ARHFVL5U.js → stale-MCS46TFO.js} +10 -10
  316. package/dist/storage-ZXUT476I.js +23 -0
  317. package/dist/storage-ZXUT476I.js.map +1 -0
  318. package/dist/{store-coordination-provider-GFCUOBR6.js → store-coordination-provider-6FM26VQM.js} +22 -15
  319. package/dist/store-coordination-provider-6FM26VQM.js.map +1 -0
  320. package/dist/sync/index.js +11 -11
  321. package/dist/team/index.js +17 -16
  322. package/dist/tiers/index.js +11 -10
  323. package/dist/to/index.js +17 -9
  324. package/dist/to/index.js.map +1 -1
  325. package/dist/transactions/index.js +4 -4
  326. package/dist/{ulid-PTAIMDG4.js → ulid-VQW6ERQN.js} +2 -2
  327. package/dist/ulid-VQW6ERQN.js.map +1 -0
  328. package/dist/util/index.js +1 -1
  329. package/dist/vault-diff-FE5J35NJ.js +9 -0
  330. package/dist/vault-diff-FE5J35NJ.js.map +1 -0
  331. package/dist/vault-head/index.js +115 -0
  332. package/dist/vault-head/index.js.map +1 -0
  333. package/dist/{verify-RO5RTZOJ.js → verify-WYOFLSNA.js} +5 -5
  334. package/dist/via/blob/binding.d.ts +6 -6
  335. package/dist/via/blob/index.d.ts +3 -0
  336. package/dist/via/classified/binding.d.ts +9 -9
  337. package/dist/via/computed/binding.d.ts +2 -2
  338. package/dist/via/i18n/binding.d.ts +4 -4
  339. package/dist/via/lookup/binding.d.ts +5 -5
  340. package/dist/via/lookup/handle.d.ts +4 -1
  341. package/dist/via/lookup/index.d.ts +1 -1
  342. package/dist/via/lookup/snapshot.d.ts +1 -1
  343. package/dist/via/money/binding.d.ts +3 -3
  344. package/dist/via/money/normalize.d.ts +1 -1
  345. package/dist/via/money/where.d.ts +3 -3
  346. package/dist/walk-JNEOYCAU.js +21 -0
  347. package/dist/walk-JNEOYCAU.js.map +1 -0
  348. package/dist/with-audit/periods/periods.d.ts +1 -1
  349. package/dist/with-audit/periods/strategy.d.ts +1 -1
  350. package/dist/with-audit/sealed-record/index.d.ts +13 -0
  351. package/dist/with-audit/tiers/index.d.ts +17 -2
  352. package/dist/with-cargo/adopt-partition.d.ts +7 -7
  353. package/dist/with-cargo/extract-partition.d.ts +1 -1
  354. package/dist/with-cargo/floor.d.ts +1 -1
  355. package/dist/with-cargo/index.d.ts +2 -2
  356. package/dist/with-commit/history/history.d.ts +26 -0
  357. package/dist/with-commit/history/index.d.ts +2 -1
  358. package/dist/with-commit/history/ledger/store.d.ts +7 -1
  359. package/dist/with-commit/history/strategy.d.ts +11 -1
  360. package/dist/with-commit/numbering/index.d.ts +0 -5
  361. package/dist/with-commit/vault-head/active.d.ts +2 -0
  362. package/dist/with-commit/vault-head/head.d.ts +28 -0
  363. package/dist/with-commit/vault-head/index.d.ts +10 -0
  364. package/dist/with-commit/vault-head/strategy.d.ts +127 -0
  365. package/dist/with-commit/vault-head/verify.d.ts +90 -0
  366. package/dist/with-formula/materialized-views/dependency-analyzer.d.ts +4 -0
  367. package/dist/with-formula/materialized-views/projection-legs.d.ts +59 -0
  368. package/dist/with-formula/materialized-views/registry.d.ts +50 -0
  369. package/dist/with-formula/materialized-views/types.d.ts +68 -10
  370. package/dist/with-party/directory/cover/storage.d.ts +0 -8
  371. package/dist/with-party/directory/storage.d.ts +0 -11
  372. package/dist/with-party/directory/visibility.d.ts +0 -21
  373. package/dist/with-party/policy/storage.d.ts +0 -10
  374. package/dist/with-party/team/deed.d.ts +4 -4
  375. package/dist/with-party/team/device-seal.d.ts +5 -5
  376. package/dist/with-party/team/echo-ceremony.d.ts +2 -2
  377. package/dist/with-party/team/echo-secret.d.ts +4 -4
  378. package/dist/with-party/team/index.d.ts +3 -3
  379. package/dist/with-party/team/keyring.d.ts +141 -4
  380. package/dist/with-party/team/managed-secret.d.ts +21 -11
  381. package/dist/with-party/team/noydb-facade.d.ts +7 -3
  382. package/dist/with-party/team/{shamir-recovery-provider.d.ts → noydb-shamir.d.ts} +1 -1
  383. package/dist/with-party/team/recovery.d.ts +3 -3
  384. package/dist/with-party/team/roster-tag.d.ts +101 -0
  385. package/dist/with-party/team/rotate-recover.d.ts +5 -5
  386. package/dist/with-party/team/tiers.d.ts +2 -1
  387. package/dist/with-pod/format.d.ts +11 -13
  388. package/dist/with-pod/index.d.ts +10 -10
  389. package/dist/with-pod/open.d.ts +2 -2
  390. package/dist/with-pod/pod-handle.d.ts +19 -0
  391. package/dist/with-pod/pod-store.d.ts +0 -8
  392. package/dist/with-pod/{bundle.d.ts → pod.d.ts} +17 -25
  393. package/dist/with-pod/ulid.d.ts +1 -1
  394. package/dist/with-shape/blobs/blob-compaction.d.ts +13 -0
  395. package/dist/with-shape/blobs/blob-set.d.ts +83 -11
  396. package/dist/with-shape/blobs/orphan-report.d.ts +62 -0
  397. package/dist/with-shape/introspection/describe.d.ts +2 -2
  398. package/dist/with-shape/schema-update/fence-controller.d.ts +4 -4
  399. package/dist/with-shape/schema-update/fence-watcher.d.ts +4 -4
  400. package/dist/with-shape/schema-update/store-coordination-provider.d.ts +7 -6
  401. package/dist/with-sync/engine.d.ts +54 -5
  402. package/dist/with-sync/strategy.d.ts +3 -0
  403. package/dist/withdraw-accessible-ILTSXTIE.js +28 -0
  404. package/dist/withdraw-accessible-ILTSXTIE.js.map +1 -0
  405. package/package.json +29 -5
  406. package/dist/api-RXUMEKT3.js +0 -20
  407. package/dist/backup-KULFZ2T4.js.map +0 -1
  408. package/dist/bundle-handle-GFNHT52M.js +0 -36
  409. package/dist/bundle-handle-GFNHT52M.js.map +0 -1
  410. package/dist/chunk-2DHSSLOD.js.map +0 -1
  411. package/dist/chunk-2GAJGUNM.js.map +0 -1
  412. package/dist/chunk-3737A6EA.js.map +0 -1
  413. package/dist/chunk-3IXIU6FP.js.map +0 -1
  414. package/dist/chunk-3URQC7EH.js.map +0 -1
  415. package/dist/chunk-4GZ6XOVW.js.map +0 -1
  416. package/dist/chunk-4I72F5DF.js.map +0 -1
  417. package/dist/chunk-4VUPLMZ6.js.map +0 -1
  418. package/dist/chunk-52JPHN5N.js.map +0 -1
  419. package/dist/chunk-55LKVALY.js.map +0 -1
  420. package/dist/chunk-5JY5TSVY.js.map +0 -1
  421. package/dist/chunk-5ZKS6ZE2.js.map +0 -1
  422. package/dist/chunk-6BU3L4UE.js.map +0 -1
  423. package/dist/chunk-6NVPFKN3.js.map +0 -1
  424. package/dist/chunk-7F4DBNSP.js.map +0 -1
  425. package/dist/chunk-7G6VDWXB.js.map +0 -1
  426. package/dist/chunk-7H73RIE3.js +0 -45
  427. package/dist/chunk-7H73RIE3.js.map +0 -1
  428. package/dist/chunk-7MNBICB5.js.map +0 -1
  429. package/dist/chunk-AFHQATY4.js +0 -47
  430. package/dist/chunk-AFHQATY4.js.map +0 -1
  431. package/dist/chunk-AHLJSVRL.js.map +0 -1
  432. package/dist/chunk-BEFVYAR5.js.map +0 -1
  433. package/dist/chunk-BRVW2GS5.js.map +0 -1
  434. package/dist/chunk-BWVKEOPE.js.map +0 -1
  435. package/dist/chunk-CDB2HVQW.js.map +0 -1
  436. package/dist/chunk-CEJWMBXO.js.map +0 -1
  437. package/dist/chunk-DG27IUVI.js.map +0 -1
  438. package/dist/chunk-E6427JU2.js.map +0 -1
  439. package/dist/chunk-FFDNKRCY.js.map +0 -1
  440. package/dist/chunk-FZ6NYJ7L.js.map +0 -1
  441. package/dist/chunk-G6S5VVHP.js.map +0 -1
  442. package/dist/chunk-GAG7QOVO.js.map +0 -1
  443. package/dist/chunk-HNGSV2YC.js.map +0 -1
  444. package/dist/chunk-IGJCYUT5.js.map +0 -1
  445. package/dist/chunk-JJNOLSG5.js.map +0 -1
  446. package/dist/chunk-JRKZTEZZ.js.map +0 -1
  447. package/dist/chunk-MSWYQLMQ.js.map +0 -1
  448. package/dist/chunk-NPP5R7FF.js.map +0 -1
  449. package/dist/chunk-O2ERS4UJ.js.map +0 -1
  450. package/dist/chunk-PDLLCOGD.js.map +0 -1
  451. package/dist/chunk-PL2GHSCM.js.map +0 -1
  452. package/dist/chunk-PNKHAKQ7.js.map +0 -1
  453. package/dist/chunk-Q6TEJXBX.js.map +0 -1
  454. package/dist/chunk-QULVCV3M.js.map +0 -1
  455. package/dist/chunk-RV3ARMPN.js.map +0 -1
  456. package/dist/chunk-RXYYFSBB.js.map +0 -1
  457. package/dist/chunk-UHXCLPGC.js.map +0 -1
  458. package/dist/chunk-VCETL77O.js.map +0 -1
  459. package/dist/chunk-VZ3XFUQ7.js.map +0 -1
  460. package/dist/chunk-W77KZHCW.js.map +0 -1
  461. package/dist/chunk-WASHZV34.js.map +0 -1
  462. package/dist/chunk-WFUIE565.js.map +0 -1
  463. package/dist/chunk-XWX7GL56.js.map +0 -1
  464. package/dist/chunk-YJ6IONGA.js.map +0 -1
  465. package/dist/chunk-YPYHVOXP.js.map +0 -1
  466. package/dist/chunk-ZJADGNYF.js.map +0 -1
  467. package/dist/collection-facade-QEJIM6BC.js +0 -45
  468. package/dist/delegation-MO7YZYJS.js.map +0 -1
  469. package/dist/derive-IUA6JFLB.js +0 -22
  470. package/dist/dispatch-FZEAWKVM.js.map +0 -1
  471. package/dist/executor-CYJQLKKI.js +0 -9
  472. package/dist/executor-S4QIKEHW.js +0 -9
  473. package/dist/executor-YIQB2S6N.js +0 -29
  474. package/dist/export-accessible-4S36PQNR.js +0 -23
  475. package/dist/extract-partition-IO7FDZ2P.js +0 -38
  476. package/dist/fanout-sidecar-NNAJQXMX.js.map +0 -1
  477. package/dist/fence-watcher-DHQ775JB.js.map +0 -1
  478. package/dist/find-RBBYKXI7.js +0 -11
  479. package/dist/issue-RIVHSY2S.js +0 -19
  480. package/dist/liberate-GFN4C7RR.js +0 -24
  481. package/dist/noydb-ASEXNJS6.js +0 -83
  482. package/dist/register-4EFJCVYD.js +0 -32
  483. package/dist/registry-4SDHHOJ7.js +0 -18
  484. package/dist/registry-CZVINVQH.js +0 -9
  485. package/dist/registry-IKUR2MXD.js +0 -9
  486. package/dist/registry-OYTFGWVK.js +0 -19
  487. package/dist/request-withdrawal-KGXGDPVQ.js +0 -31
  488. package/dist/revoke-JFN773KF.js +0 -24
  489. package/dist/seed-GDV5PT4R.js.map +0 -1
  490. package/dist/signer-TA55QB6R.js +0 -25
  491. package/dist/storage-V7MTFAQJ.js +0 -23
  492. package/dist/store-coordination-provider-GFCUOBR6.js.map +0 -1
  493. package/dist/walk-3ZECBFDA.js +0 -21
  494. package/dist/with-pod/bundle-handle.d.ts +0 -9
  495. package/dist/withdraw-accessible-7PG4DYQK.js +0 -28
  496. /package/dist/{api-RXUMEKT3.js.map → api-EQYRTZO2.js.map} +0 -0
  497. /package/dist/{collection-facade-QEJIM6BC.js.map → at/index.js.map} +0 -0
  498. /package/dist/{computed-6G5M3UPH.js.map → by/index.js.map} +0 -0
  499. /package/dist/{chunk-YAWK6AWF.js.map → chunk-225O5CXQ.js.map} +0 -0
  500. /package/dist/{chunk-OF3L2SD6.js.map → chunk-3QARDAYW.js.map} +0 -0
  501. /package/dist/{chunk-W3TVWF6N.js.map → chunk-4A4TYISP.js.map} +0 -0
  502. /package/dist/{chunk-CCZJJ4I2.js.map → chunk-4G25SDQL.js.map} +0 -0
  503. /package/dist/{chunk-7TSYBD3E.js.map → chunk-5263OEM3.js.map} +0 -0
  504. /package/dist/{chunk-FNSMZQS4.js.map → chunk-5ACAVJUI.js.map} +0 -0
  505. /package/dist/{chunk-VMCCGUQB.js.map → chunk-7LYUJNU3.js.map} +0 -0
  506. /package/dist/{chunk-WLYIROCJ.js.map → chunk-AB5P32RE.js.map} +0 -0
  507. /package/dist/{chunk-SUFG5E73.js.map → chunk-ALUNQEBY.js.map} +0 -0
  508. /package/dist/{chunk-CADUYBQD.js.map → chunk-ATL3ZVXT.js.map} +0 -0
  509. /package/dist/{chunk-6FJWSWFT.js.map → chunk-DBNYPLWY.js.map} +0 -0
  510. /package/dist/{chunk-VJFMXYKP.js.map → chunk-E6YA6UAP.js.map} +0 -0
  511. /package/dist/{chunk-JIUVJ4M7.js.map → chunk-F7ZFRPGQ.js.map} +0 -0
  512. /package/dist/{chunk-HXGUIPQB.js.map → chunk-FOG7YEJP.js.map} +0 -0
  513. /package/dist/{chunk-X56RTUK3.js.map → chunk-HM4JSXX2.js.map} +0 -0
  514. /package/dist/{chunk-GQ3BX5EA.js.map → chunk-I3ISCYT7.js.map} +0 -0
  515. /package/dist/{chunk-FUHKW252.js.map → chunk-J4MN6XIU.js.map} +0 -0
  516. /package/dist/{chunk-ADW22QSB.js.map → chunk-J4UJ5FRV.js.map} +0 -0
  517. /package/dist/{chunk-HVQGCKY4.js.map → chunk-JVLSU7S2.js.map} +0 -0
  518. /package/dist/{chunk-AR2JDFAE.js.map → chunk-KDJGJR7F.js.map} +0 -0
  519. /package/dist/{chunk-747LRSOO.js.map → chunk-LKFKXS5K.js.map} +0 -0
  520. /package/dist/{chunk-U5O6GIWZ.js.map → chunk-LR4Z47QD.js.map} +0 -0
  521. /package/dist/{chunk-RTAMLDWP.js.map → chunk-NLKLXXTO.js.map} +0 -0
  522. /package/dist/{chunk-FDX7OWWI.js.map → chunk-OPXR4PB2.js.map} +0 -0
  523. /package/dist/{chunk-Z45YRGFO.js.map → chunk-P6ASQOZR.js.map} +0 -0
  524. /package/dist/{chunk-2Z3NCLNX.js.map → chunk-QI5NWLVW.js.map} +0 -0
  525. /package/dist/{chunk-6SAFL5YE.js.map → chunk-RC4BROYR.js.map} +0 -0
  526. /package/dist/{chunk-NJDQ4YSV.js.map → chunk-RDHUZ674.js.map} +0 -0
  527. /package/dist/{chunk-3JVXVJ7L.js.map → chunk-S35S77YU.js.map} +0 -0
  528. /package/dist/{chunk-KUDZVJKQ.js.map → chunk-SHILAQH5.js.map} +0 -0
  529. /package/dist/{chunk-4UVDI4XE.js.map → chunk-T3PHCEN4.js.map} +0 -0
  530. /package/dist/{derive-IUA6JFLB.js.map → chunk-UBSFPGVJ.js.map} +0 -0
  531. /package/dist/{chunk-FAXZQ5UF.js.map → chunk-UCUALOSM.js.map} +0 -0
  532. /package/dist/{chunk-4HDYQL3J.js.map → chunk-VAG47QHV.js.map} +0 -0
  533. /package/dist/{chunk-35EBKWQU.js.map → chunk-VFIWDPXZ.js.map} +0 -0
  534. /package/dist/{chunk-HNHCQ556.js.map → chunk-WLLUM35R.js.map} +0 -0
  535. /package/dist/{chunk-JRCYZEHU.js.map → chunk-XVU7J43V.js.map} +0 -0
  536. /package/dist/{chunk-DMQCLZ4Z.js.map → chunk-YCSM3GZU.js.map} +0 -0
  537. /package/dist/{chunk-FMQJZH4R.js.map → chunk-YMLQBZFJ.js.map} +0 -0
  538. /package/dist/{chunk-6HFM7EIT.js.map → chunk-YPSOHDNC.js.map} +0 -0
  539. /package/dist/{chunk-N35NC4JH.js.map → chunk-Z2PWOSCJ.js.map} +0 -0
  540. /package/dist/{chunk-HPLWFNG4.js.map → chunk-Z7ZXZL6Y.js.map} +0 -0
  541. /package/dist/{classified-marker-2KJAXRRO.js.map → classified-marker-BSQHU4JT.js.map} +0 -0
  542. /package/dist/{enclave-JU4YIEPB.js.map → collection-facade-LG3NYZVB.js.map} +0 -0
  543. /package/dist/{executor-CYJQLKKI.js.map → computed-ASBNTLOK.js.map} +0 -0
  544. /package/dist/{dead-filter-DCB62VWW.js.map → dead-filter-QKU56XTQ.js.map} +0 -0
  545. /package/dist/{executor-S4QIKEHW.js.map → derive-CXHCY46K.js.map} +0 -0
  546. /package/dist/{dispatch-MJ6SHB3Y.js.map → dispatch-4AP4PUZU.js.map} +0 -0
  547. /package/dist/{executor-YIQB2S6N.js.map → enclave-NYPT7WA7.js.map} +0 -0
  548. /package/dist/{export-accessible-4S36PQNR.js.map → executor-3KFRQETS.js.map} +0 -0
  549. /package/dist/{extract-partition-IO7FDZ2P.js.map → executor-AFHQYRAU.js.map} +0 -0
  550. /package/dist/{find-RBBYKXI7.js.map → executor-YYDW6XQI.js.map} +0 -0
  551. /package/dist/{issue-RIVHSY2S.js.map → export-accessible-BX2ILB4C.js.map} +0 -0
  552. /package/dist/{ledger-AETNF4OM.js.map → extract-partition-UPOVITFI.js.map} +0 -0
  553. /package/dist/{liberate-GFN4C7RR.js.map → find-SZBL2HPB.js.map} +0 -0
  554. /package/dist/{link-set-E5HNY67I.js.map → issue-G53NB6EW.js.map} +0 -0
  555. /package/dist/{managed-secret-CWQ6PND5.js.map → ledger-T5K4P2D7.js.map} +0 -0
  556. /package/dist/{noydb-ASEXNJS6.js.map → liberate-VEOZRESE.js.map} +0 -0
  557. /package/dist/{register-4EFJCVYD.js.map → link-set-76JZ6YB4.js.map} +0 -0
  558. /package/dist/{registry-4SDHHOJ7.js.map → managed-secret-6YC32VXG.js.map} +0 -0
  559. /package/dist/{registry-CZVINVQH.js.map → noydb-EDJA4JNJ.js.map} +0 -0
  560. /package/dist/{registry-IKUR2MXD.js.map → on/index.js.map} +0 -0
  561. /package/dist/{post-register-2XSSMGEQ.js.map → post-register-53O7AJRZ.js.map} +0 -0
  562. /package/dist/{registry-OYTFGWVK.js.map → register-6TCBR6XD.js.map} +0 -0
  563. /package/dist/{request-withdrawal-KGXGDPVQ.js.map → registry-DH2L4O2V.js.map} +0 -0
  564. /package/dist/{revoke-JFN773KF.js.map → registry-IWFMXCHX.js.map} +0 -0
  565. /package/dist/{signer-TA55QB6R.js.map → registry-Q3FG3OAX.js.map} +0 -0
  566. /package/dist/{stale-ARHFVL5U.js.map → registry-YC3IFG3A.js.map} +0 -0
  567. /package/dist/{storage-V7MTFAQJ.js.map → request-withdrawal-NM5VYR6F.js.map} +0 -0
  568. /package/dist/{reveal-BW36KCOQ.js.map → reveal-XBIMHAXR.js.map} +0 -0
  569. /package/dist/{ulid-PTAIMDG4.js.map → revoke-MJNYWO72.js.map} +0 -0
  570. /package/dist/{walk-3ZECBFDA.js.map → signer-6XVS2AU3.js.map} +0 -0
  571. /package/dist/{withdraw-accessible-7PG4DYQK.js.map → stale-MCS46TFO.js.map} +0 -0
  572. /package/dist/{verify-RO5RTZOJ.js.map → verify-WYOFLSNA.js.map} +0 -0
@@ -1,10 +1,6 @@
1
- import {
2
- hashFields,
3
- validateSatelliteDeclaration
4
- } from "./chunk-HVQGCKY4.js";
5
1
  import {
6
2
  resolveStaleOnRead
7
- } from "./chunk-4HDYQL3J.js";
3
+ } from "./chunk-VAG47QHV.js";
8
4
  import {
9
5
  isManifestReservedCollection
10
6
  } from "./chunk-EPFF7LOX.js";
@@ -14,43 +10,52 @@ import {
14
10
  isLinkCollectionName,
15
11
  linkCollectionName,
16
12
  linkRowKey
17
- } from "./chunk-HNHCQ556.js";
13
+ } from "./chunk-WLLUM35R.js";
18
14
  import {
19
- isBaseLive,
20
- liveBaseIdSet
21
- } from "./chunk-GYGLAVCX.js";
15
+ hashFields,
16
+ validateSatelliteDeclaration
17
+ } from "./chunk-JVLSU7S2.js";
22
18
  import {
23
19
  loadFence
24
- } from "./chunk-6BU3L4UE.js";
20
+ } from "./chunk-Y6GZ2P4M.js";
25
21
  import {
26
22
  VectorSet,
27
23
  buildPersistedIndexCallbacks,
28
24
  encodeVecId,
29
25
  syncTierSearch
30
- } from "./chunk-G6S5VVHP.js";
26
+ } from "./chunk-L6GTLZRK.js";
27
+ import {
28
+ isBaseLive,
29
+ liveBaseIdSet
30
+ } from "./chunk-GYGLAVCX.js";
31
31
  import {
32
32
  SchemaUpdateGate
33
33
  } from "./chunk-6LJY7X5A.js";
34
+ import {
35
+ NO_ATTESTATION
36
+ } from "./chunk-E6YA6UAP.js";
34
37
  import {
35
38
  NO_CLASSIFIED,
36
39
  guardClassifiedCompat,
37
40
  resolveClassifiedFields
38
- } from "./chunk-QULVCV3M.js";
41
+ } from "./chunk-GK4DRVUD.js";
39
42
  import {
40
43
  NO_TIERS,
41
44
  classifySealedShred,
42
45
  syncDerivedOutputs
43
- } from "./chunk-6NVPFKN3.js";
46
+ } from "./chunk-WK5FSW7T.js";
44
47
  import {
45
48
  NO_PORTABILITY
46
- } from "./chunk-FUHKW252.js";
49
+ } from "./chunk-J4MN6XIU.js";
47
50
  import {
48
- NO_CARGO,
49
- runDrainBarrier
50
- } from "./chunk-DG27IUVI.js";
51
+ NO_CARGO
52
+ } from "./chunk-XJ3FEKEY.js";
51
53
  import {
52
54
  saveSealedSecret
53
- } from "./chunk-XWX7GL56.js";
55
+ } from "./chunk-Z2WK53N6.js";
56
+ import {
57
+ runDrainBarrier
58
+ } from "./chunk-CBRS2NEK.js";
54
59
  import {
55
60
  fallbackDerivationName,
56
61
  jsonSchemaToFields
@@ -58,18 +63,24 @@ import {
58
63
  import {
59
64
  derivePersistedSchema,
60
65
  isZod4Schema
61
- } from "./chunk-Z45YRGFO.js";
66
+ } from "./chunk-P6ASQOZR.js";
62
67
  import {
63
68
  loadPersistedSchema
64
- } from "./chunk-CDB2HVQW.js";
69
+ } from "./chunk-YXA2TCTZ.js";
70
+ import {
71
+ NO_SEQUENCE,
72
+ SEQUENCE_COLLECTION,
73
+ compileSequenceFormat,
74
+ resolveSequenceKey
75
+ } from "./chunk-CN6B5PEN.js";
65
76
  import {
66
77
  CustodyApi,
67
78
  NO_CUSTODY
68
- } from "./chunk-ADW22QSB.js";
79
+ } from "./chunk-J4UJ5FRV.js";
69
80
  import {
70
81
  DEFAULT_POSTURE,
71
82
  ViaGraph
72
- } from "./chunk-7TSYBD3E.js";
83
+ } from "./chunk-5263OEM3.js";
73
84
  import {
74
85
  buildLookupAltIndex,
75
86
  buildLookupSnapshotRows,
@@ -93,17 +104,14 @@ import {
93
104
  selfWriteFieldEqual,
94
105
  touchFor,
95
106
  updateReferencingRecords
96
- } from "./chunk-5ZKS6ZE2.js";
107
+ } from "./chunk-VTG7327U.js";
97
108
  import {
98
109
  OverlayedCollection
99
- } from "./chunk-OF3L2SD6.js";
110
+ } from "./chunk-3QARDAYW.js";
100
111
  import {
101
112
  INDEXED_STORE_POLICY,
102
113
  NO_SYNC
103
- } from "./chunk-55LKVALY.js";
104
- import {
105
- NO_ATTESTATION
106
- } from "./chunk-VJFMXYKP.js";
114
+ } from "./chunk-T7IR4N2S.js";
107
115
  import {
108
116
  NO_CONSENT
109
117
  } from "./chunk-PEOZ34EM.js";
@@ -114,7 +122,7 @@ import {
114
122
  resolvePeriodKey,
115
123
  resolveReopenState,
116
124
  samePartition
117
- } from "./chunk-5O5HRRTV.js";
125
+ } from "./chunk-PCQDY6QN.js";
118
126
  import {
119
127
  PERIODS_COLLECTION,
120
128
  PERIOD_ARCHIVES_COLLECTION,
@@ -122,7 +130,7 @@ import {
122
130
  PERIOD_REOPENS_COLLECTION,
123
131
  PERIOD_TARGET_PURGES_COLLECTION,
124
132
  periodExclusiveUpperBound
125
- } from "./chunk-HPLWFNG4.js";
133
+ } from "./chunk-Z7ZXZL6Y.js";
126
134
  import {
127
135
  NO_SHADOW
128
136
  } from "./chunk-SMY5X46Z.js";
@@ -132,7 +140,7 @@ import {
132
140
  import {
133
141
  TxContext,
134
142
  bestEffortRevert
135
- } from "./chunk-35EBKWQU.js";
143
+ } from "./chunk-VFIWDPXZ.js";
136
144
  import {
137
145
  lazy
138
146
  } from "./chunk-5D2ALSM5.js";
@@ -140,32 +148,29 @@ import {
140
148
  InvertedIndex,
141
149
  MemoryIndexStore,
142
150
  NO_SEARCH
143
- } from "./chunk-3JVXVJ7L.js";
151
+ } from "./chunk-S35S77YU.js";
144
152
  import {
145
- NO_SEQUENCE,
146
- SEQUENCE_COLLECTION,
147
- compileSequenceFormat,
148
- resolveSequenceKey
149
- } from "./chunk-7MNBICB5.js";
153
+ NO_SEALED_RECORD
154
+ } from "./chunk-UCUALOSM.js";
150
155
  import {
151
156
  Query,
152
157
  ScanBuilder
153
- } from "./chunk-3737A6EA.js";
158
+ } from "./chunk-S2VG3ABP.js";
154
159
  import {
155
160
  EXPORT_AUDIT_COLLECTION,
156
161
  NO_BLOBS,
157
162
  createExportBlobsHandle,
158
163
  runCompaction
159
- } from "./chunk-WASHZV34.js";
164
+ } from "./chunk-F23WQK3G.js";
160
165
  import {
161
166
  LazyQuery,
162
167
  NO_INDEXING,
163
168
  decodeIdxId,
164
169
  encodeIdxId
165
- } from "./chunk-JIUVJ4M7.js";
170
+ } from "./chunk-F7ZFRPGQ.js";
166
171
  import {
167
172
  normalizeIndexDefs
168
- } from "./chunk-GQ3BX5EA.js";
173
+ } from "./chunk-I3ISCYT7.js";
169
174
  import {
170
175
  IMPLICIT_LAZY,
171
176
  Lru,
@@ -179,13 +184,13 @@ import {
179
184
  } from "./chunk-YMUFFJCO.js";
180
185
  import {
181
186
  readPath
182
- } from "./chunk-IGJCYUT5.js";
187
+ } from "./chunk-NSITFOCJ.js";
183
188
  import {
184
189
  NO_CRDT
185
190
  } from "./chunk-PVEWA2DU.js";
186
191
  import {
187
192
  dictCollectionName
188
- } from "./chunk-WFUIE565.js";
193
+ } from "./chunk-57JTHWLQ.js";
189
194
  import {
190
195
  NO_I18N,
191
196
  getAtPath,
@@ -193,11 +198,11 @@ import {
193
198
  isDictKeyDescriptor,
194
199
  isI18nTextDescriptor,
195
200
  isStaticDictDescriptor
196
- } from "./chunk-7G6VDWXB.js";
201
+ } from "./chunk-X67FCULK.js";
197
202
  import {
198
203
  isViaInstalled,
199
204
  viaBinder
200
- } from "./chunk-UHXCLPGC.js";
205
+ } from "./chunk-XDVVBETV.js";
201
206
  import {
202
207
  NO_TEAM,
203
208
  describeAllUsersAuth,
@@ -220,7 +225,7 @@ import {
220
225
  saveShamirRecoveryEntries,
221
226
  updateAuthenticator,
222
227
  writeMagicLinkGrant
223
- } from "./chunk-O2ERS4UJ.js";
228
+ } from "./chunk-H4M7ADXY.js";
224
229
  import {
225
230
  assertKeyringOpenAllowed,
226
231
  buildRecipientKeyringFile,
@@ -235,32 +240,36 @@ import {
235
240
  listUsers,
236
241
  loadKeyring,
237
242
  updateKeyringIdentity
238
- } from "./chunk-JRKZTEZZ.js";
243
+ } from "./chunk-5W7YXFV5.js";
239
244
  import {
240
245
  persistDirectoryConfig,
241
246
  readDirectoryConfig
242
- } from "./chunk-5JY5TSVY.js";
247
+ } from "./chunk-DFAUMLD7.js";
243
248
  import {
244
249
  NO_BROKER,
245
250
  buildCredentialBrokerHandle
246
- } from "./chunk-W3TVWF6N.js";
251
+ } from "./chunk-4A4TYISP.js";
247
252
  import {
248
253
  NO_SESSION
249
254
  } from "./chunk-VKQCVU2Z.js";
250
255
  import {
251
256
  generateULID
252
- } from "./chunk-ZJADGNYF.js";
257
+ } from "./chunk-4AOERLTV.js";
253
258
  import {
254
259
  NO_HISTORY
255
- } from "./chunk-AFHQATY4.js";
260
+ } from "./chunk-6EW2UCVF.js";
261
+ import {
262
+ sha256Hex
263
+ } from "./chunk-RC4BROYR.js";
256
264
  import {
257
265
  assertCutoverTierSafe,
258
266
  assertTierWritable,
267
+ dekKey,
259
268
  liveRecordIsElevated
260
- } from "./chunk-3FSX6LDG.js";
269
+ } from "./chunk-POS53FG6.js";
261
270
  import {
262
- sha256Hex
263
- } from "./chunk-6SAFL5YE.js";
271
+ NO_VAULT_HEAD
272
+ } from "./chunk-HK67PX4J.js";
264
273
  import {
265
274
  NO_FORGET,
266
275
  addSubjectRef,
@@ -269,34 +278,36 @@ import {
269
278
  readDottedPath,
270
279
  rebuildSubjectIndex,
271
280
  removeSubjectRef
272
- } from "./chunk-WLZ47GSL.js";
273
- import {
274
- NO_SEALED_RECORD
275
- } from "./chunk-FAXZQ5UF.js";
281
+ } from "./chunk-467SKJ65.js";
276
282
  import {
277
283
  RecordCodec,
278
284
  SEALED_CEK_NS,
285
+ applyRewrappedBody,
286
+ buildRecordAad,
279
287
  findByDet,
280
288
  hasPerRecordKey,
289
+ hasSealedBody,
281
290
  makeReservedEnvelopes,
282
291
  openEnvelopeJson,
283
292
  queryByDet,
284
293
  resolveStableCek,
285
- validateSchemaInput
286
- } from "./chunk-3URQC7EH.js";
294
+ rewrapBodyToDek,
295
+ validateSchemaInput,
296
+ verifyRecordIdentity
297
+ } from "./chunk-2LPVI4PX.js";
287
298
  import {
288
299
  buildDeleteMarker,
300
+ buildRecordEnvelope,
289
301
  buildTombstone,
290
302
  isDeleteMarker,
291
303
  isTombstone
292
- } from "./chunk-7H73RIE3.js";
304
+ } from "./chunk-N4CNVSUF.js";
293
305
  import {
294
306
  encrypt
295
- } from "./chunk-VCETL77O.js";
307
+ } from "./chunk-W5LHQXZU.js";
296
308
  import {
297
- NOYDB_FORMAT_VERSION,
298
309
  SealedHandle
299
- } from "./chunk-YPYHVOXP.js";
310
+ } from "./chunk-RK7N4OQ5.js";
300
311
  import {
301
312
  AlreadyElevatedError,
302
313
  AttestationError,
@@ -339,7 +350,55 @@ import {
339
350
  UnsupportedTierCompositionError,
340
351
  ValidationError,
341
352
  isConflictError
342
- } from "./chunk-HNGSV2YC.js";
353
+ } from "./chunk-JBIV4FLR.js";
354
+
355
+ // src/kernel/merge-authority.ts
356
+ function buildMergeAuthority(keyring) {
357
+ return {
358
+ verify: async (collection, id, envelope) => {
359
+ const dek = keyring.deks.get(dekKey(collection, envelope._tier ?? 0));
360
+ if (dek === void 0) return true;
361
+ return verifyRecordIdentity({ collection, id }, envelope, dek);
362
+ },
363
+ advance: async (collection, id, envelope, toVersion) => {
364
+ if (!hasSealedBody(envelope)) return { ...envelope, _v: toVersion };
365
+ const dek = keyring.deks.get(dekKey(collection, envelope._tier ?? 0));
366
+ if (dek === void 0) {
367
+ throw new ValidationError(
368
+ `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.`
369
+ );
370
+ }
371
+ const from = {
372
+ collection,
373
+ id,
374
+ version: envelope._v,
375
+ ...envelope._tier !== void 0 ? { tier: envelope._tier } : {},
376
+ ...envelope._by !== void 0 ? { by: envelope._by } : {}
377
+ };
378
+ const body = await rewrapBodyToDek(from, { ...from, version: toVersion }, envelope, dek, dek);
379
+ return { ...applyRewrappedBody(envelope, body), _v: toVersion };
380
+ }
381
+ };
382
+ }
383
+
384
+ // src/port/with/formats-strategy.ts
385
+ var FormatsNotEnabledError = class extends Error {
386
+ constructor(op) {
387
+ super(
388
+ `vault.${op}() requires the formats service. Import { withFormats } from "@noy-db/hub/as" and pass formatsStrategy: withFormats() to createNoydb().`
389
+ );
390
+ this.name = "FormatsNotEnabledError";
391
+ }
392
+ };
393
+ var NO_FORMATS = {
394
+ enabled: false,
395
+ exportWith() {
396
+ throw new FormatsNotEnabledError("export");
397
+ },
398
+ importWith() {
399
+ throw new FormatsNotEnabledError("import");
400
+ }
401
+ };
343
402
 
344
403
  // src/with-commit/tx/strategy.ts
345
404
  var NOT_ENABLED = new Error(
@@ -364,6 +423,7 @@ var NO_ARCHIVE = {
364
423
 
365
424
  // src/port/with/strategies.ts
366
425
  var STRATEGY_DEFAULTS = {
426
+ formats: NO_FORMATS,
367
427
  reduce: NO_REDUCE,
368
428
  archive: NO_ARCHIVE,
369
429
  attestation: NO_ATTESTATION,
@@ -376,6 +436,7 @@ var STRATEGY_DEFAULTS = {
376
436
  custody: NO_CUSTODY,
377
437
  forget: NO_FORGET,
378
438
  history: NO_HISTORY,
439
+ vaultHead: NO_VAULT_HEAD,
379
440
  i18n: NO_I18N,
380
441
  indexing: NO_INDEXING,
381
442
  lazy: IMPLICIT_LAZY,
@@ -424,7 +485,7 @@ function validateSecretModeOptions(options) {
424
485
  }
425
486
  if (!options.sealingKey) {
426
487
  throw new ValidationError(
427
- '`secretMode: "managed"` requires `sealingKey: SealingKeyProvider` (see @noy-db/seal-macos-keychain / @noy-db/seal-aws-kms / etc.).'
488
+ '`secretMode: "managed"` requires `sealingKey: NoydbSealer` (see @noy-db/seal-macos-keychain / @noy-db/seal-aws-kms / etc.).'
428
489
  );
429
490
  }
430
491
  }
@@ -469,7 +530,7 @@ function validateSecretModeOptions(options) {
469
530
  }
470
531
  async function resolveEffectiveSecret(options, store, vault) {
471
532
  if (options.secretMode === "managed") {
472
- const { resolveManagedSecret } = await import("./managed-secret-CWQ6PND5.js");
533
+ const { resolveManagedSecret } = await import("./managed-secret-6YC32VXG.js");
473
534
  return resolveManagedSecret(store, vault, options.sealingKey);
474
535
  }
475
536
  return options.secret;
@@ -486,9 +547,9 @@ function ownerKeyringOptions(options, secret) {
486
547
  }
487
548
 
488
549
  // src/port/by/default-provider.ts
489
- async function createDefaultCoordinationProvider(store) {
490
- const { StoreCoordinationProvider } = await import("./store-coordination-provider-GFCUOBR6.js");
491
- return new StoreCoordinationProvider(store);
550
+ async function createDefaultMesh(store) {
551
+ const { StoreMesh } = await import("./store-coordination-provider-6FM26VQM.js");
552
+ return new StoreMesh(store);
492
553
  }
493
554
 
494
555
  // src/port/with/collection-registries.ts
@@ -547,11 +608,11 @@ var ViaPipeline = class _ViaPipeline {
547
608
  constructor(bindings, taint) {
548
609
  this.bindings = bindings;
549
610
  this.taint = taint;
550
- const moneyBindings = bindings.filter((b) => b.brand === "money");
551
- const computedBindings = bindings.filter((b) => b.brand === "computed");
611
+ const moneyVias = bindings.filter((b) => b.brand === "money");
612
+ const computedVias = bindings.filter((b) => b.brand === "computed");
552
613
  const restBindings = bindings.filter((b) => b.brand !== "money" && b.brand !== "computed");
553
- this._presentOrder = [...moneyBindings, ...computedBindings, ...restBindings];
554
- this._presentLateBoundary = moneyBindings.length + computedBindings.length;
614
+ this._presentOrder = [...moneyVias, ...computedVias, ...restBindings];
615
+ this._presentLateBoundary = moneyVias.length + computedVias.length;
555
616
  }
556
617
  bindings;
557
618
  taint;
@@ -563,7 +624,7 @@ var ViaPipeline = class _ViaPipeline {
563
624
  * everything else (existing relative order). `present()` folds over this
564
625
  * instead of `bindings` so a `mode: 'virtual'` computed field's value
565
626
  * exists before i18n/lookup's dressing `present()` hooks run on it
566
- * (today's `compileViaBindings` order is money→i18n→lookup→classified→
627
+ * (today's `compileVias` order is money→i18n→lookup→classified→
567
628
  * blob→computed, `collection-config.ts:554`, so dressing unconditionally
568
629
  * ran BEFORE the value it dresses existed). This reorder is binding-level,
569
630
  * not conditioned on any particular field composition — it applies to
@@ -602,7 +663,7 @@ var ViaPipeline = class _ViaPipeline {
602
663
  * Money-dressing a virtual computed field's OWN output (the composed
603
664
  * `computed(virtual) + money` case) is NOT resolved by this partition
604
665
  * alone — #669 resolves it with a separate mid-fold hook instead:
605
- * `ViaBinding.presentLate` runs after every binding's `present()` in this
666
+ * `NoydbVia.presentLate` runs after every binding's `present()` in this
606
667
  * money+computed segment, before the "everything else" segment below, so
607
668
  * money can quantize/reinterpret a virtual field's fresh MAJOR-UNITS
608
669
  * output as if it were a stored value, without perturbing this ordering
@@ -611,7 +672,7 @@ var ViaPipeline = class _ViaPipeline {
611
672
  */
612
673
  _presentOrder;
613
674
  /** #669 — index into `_presentOrder` where the money+computed segment ends and the
614
- * "everything else" segment begins (`moneyBindings.length + computedBindings.length`);
675
+ * "everything else" segment begins (`moneyVias.length + computedVias.length`);
615
676
  * `present()` runs every binding's `presentLate` at exactly this boundary. */
616
677
  _presentLateBoundary;
617
678
  /** undefined when there is nothing to enforce — the zero-via fast path is
@@ -942,13 +1003,13 @@ async function applyCutoverTransform(ctx) {
942
1003
  for (const id of ids) {
943
1004
  const env = await ctx.adapter.get(ctx.vault, ctx.name, id);
944
1005
  if (!env || isTombstone(env, ctx.storeCiphertext) || isDeleteMarker(env)) continue;
945
- const decoded = await ctx.codec.decryptRecord(env, { skipValidation: true, id });
1006
+ const decoded = await ctx.codec.decryptRecord({ collection: ctx.name, id }, env, { skipValidation: true });
946
1007
  if (decoded === null) continue;
947
1008
  const record = decoded;
948
1009
  const next = ctx.transform(record);
949
1010
  const nextVersion = (env._v ?? 0) + 1;
950
1011
  const cek = ctx.perRecordCek ? await ctx.resolveRecordCek(id) : void 0;
951
- const migEnvelope = await ctx.codec.encryptRecord(next, nextVersion, cek, void 0, void 0, ctx.vdigFields !== null ? { id, prev: env } : void 0, id);
1012
+ 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);
952
1013
  await ctx.adapter.put(ctx.vault, ctx.name, id, migEnvelope);
953
1014
  await ctx.onRecordMutated(id, "put", "cutover");
954
1015
  if (ctx.ledger) {
@@ -1054,7 +1115,7 @@ async function rebuildIndexes(ctx) {
1054
1115
  const envelope = await ctx.adapter.get(ctx.vault, ctx.name, recordId);
1055
1116
  if (!envelope) continue;
1056
1117
  if ((envelope._tier ?? 0) > 0) continue;
1057
- const record = await ctx.codec.decryptRecord(envelope, { skipValidation: true, id: recordId });
1118
+ const record = await ctx.codec.decryptRecord({ collection: ctx.name, id: recordId }, envelope, { skipValidation: true });
1058
1119
  if (record === null) continue;
1059
1120
  await maintainPersistedIndexesOnPut(ctx, recordId, record, null, envelope._v);
1060
1121
  }
@@ -1088,7 +1149,7 @@ async function reconcileIndex(ctx, field, opts = {}) {
1088
1149
  const env = await ctx.adapter.get(ctx.vault, ctx.name, id);
1089
1150
  if (!env) continue;
1090
1151
  try {
1091
- const sidecarJson = await ctx.codec.decryptJsonString(env);
1152
+ const sidecarJson = await ctx.codec.decryptJsonString({ collection: ctx.name, id }, env);
1092
1153
  if (sidecarJson === null) {
1093
1154
  sidecar.set(decoded.recordId, void 0);
1094
1155
  } else {
@@ -1108,7 +1169,7 @@ async function reconcileIndex(ctx, field, opts = {}) {
1108
1169
  const env = await ctx.adapter.get(ctx.vault, ctx.name, id);
1109
1170
  if (!env) continue;
1110
1171
  if ((env._tier ?? 0) > 0) continue;
1111
- const record = await ctx.codec.decryptRecord(env, { skipValidation: true, id });
1172
+ const record = await ctx.codec.decryptRecord({ collection: ctx.name, id }, env, { skipValidation: true });
1112
1173
  if (record === null) continue;
1113
1174
  const live = readPersistedValue(record, field);
1114
1175
  const stored = sidecar.get(id);
@@ -1169,7 +1230,7 @@ async function maintainPersistedIndexesOnPut(ctx, id, newRecord, previousRecord,
1169
1230
  recordId: id,
1170
1231
  writtenAt: (/* @__PURE__ */ new Date()).toISOString()
1171
1232
  });
1172
- const envelope = await ctx.codec.encryptJsonString(body, version);
1233
+ const envelope = await ctx.codec.encryptJsonString({ collection: ctx.name, id: idxId }, body, version);
1173
1234
  await ctx.adapter.put(ctx.vault, ctx.name, idxId, envelope);
1174
1235
  }
1175
1236
  } catch (cause) {
@@ -1238,7 +1299,7 @@ async function resolveTierSyncPrior(ctx, id, priorEnvelope) {
1238
1299
  const cached = ctx.cache.get(id)?.record;
1239
1300
  if (cached !== void 0) return cached;
1240
1301
  if (!ctx.lazy || !priorEnvelope || (priorEnvelope._tier ?? 0) > 0) return null;
1241
- return await ctx.codec.decryptRecord(priorEnvelope, { skipValidation: true, id });
1302
+ return await ctx.codec.decryptRecord({ collection: ctx.name, id }, priorEnvelope, { skipValidation: true });
1242
1303
  }
1243
1304
 
1244
1305
  // src/with-lookup/search/serialize.ts
@@ -2033,7 +2094,7 @@ var VIA_FIELD_MAP_FAMILY = {
2033
2094
  blobFields: "blob",
2034
2095
  computed: "computed"
2035
2096
  };
2036
- function guardCrossBindingFieldCollisions(fieldMaps, callerPrefix = "compileViaBindings()") {
2097
+ function guardCrossBindingFieldCollisions(fieldMaps, callerPrefix = "compileVias()") {
2037
2098
  const claimantsByField = /* @__PURE__ */ new Map();
2038
2099
  for (const [sourceKey, map] of Object.entries(fieldMaps)) {
2039
2100
  for (const field of Object.keys(map ?? {})) {
@@ -2087,7 +2148,7 @@ function computedEntryParts(entry) {
2087
2148
  function unifyComputedFields(opts, viaComputedFields) {
2088
2149
  return { ...opts.computed ?? {}, ...viaComputedFields ?? {} };
2089
2150
  }
2090
- function compileViaBindings(opts, classifiedGuardCtx, eraseCfgOut) {
2151
+ function compileVias(opts, classifiedGuardCtx, eraseCfgOut) {
2091
2152
  const { moneyFields, i18nFields, dictKeyFields, computedFields, lookupFields } = mergeViaFields(opts);
2092
2153
  const allComputedFields = unifyComputedFields(opts, computedFields);
2093
2154
  guardCrossBindingFieldCollisions({
@@ -2210,7 +2271,7 @@ function resolveComputedEdges(collectionName, computed, hasClassifiedFields, kno
2210
2271
  }
2211
2272
  return edges;
2212
2273
  }
2213
- function resolveViaBindingDepsEdges(collectionName, bindings, knownFields) {
2274
+ function resolveViaDepsEdges(collectionName, bindings, knownFields) {
2214
2275
  const edges = [];
2215
2276
  for (const binding of bindings) {
2216
2277
  if (!binding.deps || binding.deps.length === 0) continue;
@@ -2330,7 +2391,7 @@ function resolveCollectionConfig(opts) {
2330
2391
  const perRecordCek = opts.perRecordKeys === true;
2331
2392
  const cekCache = perRecordCek ? new Lru({ maxRecords: 4096 }) : null;
2332
2393
  const viaEraseCfgOut = {};
2333
- const via2 = ViaPipeline.build(compileViaBindings(opts, classifiedGuardCtx, viaEraseCfgOut));
2394
+ const via2 = ViaPipeline.build(compileVias(opts, classifiedGuardCtx, viaEraseCfgOut));
2334
2395
  const knownFields = collectKnownFieldNames({
2335
2396
  moneyFields: effectiveViaFields.moneyFields,
2336
2397
  i18nFields: effectiveViaFields.i18nFields,
@@ -2340,7 +2401,7 @@ function resolveCollectionConfig(opts) {
2340
2401
  lookupFields: effectiveViaFields.lookupFields
2341
2402
  });
2342
2403
  const computedEdges = resolveComputedEdges(opts.name, allComputed, resolvedClassified !== void 0, knownFields);
2343
- const viaDepsEdges = resolveViaBindingDepsEdges(opts.name, via2?.bindings ?? [], knownFields);
2404
+ const viaDepsEdges = resolveViaDepsEdges(opts.name, via2?.bindings ?? [], knownFields);
2344
2405
  return {
2345
2406
  adapter: opts.adapter,
2346
2407
  vault: opts.vault,
@@ -2421,7 +2482,7 @@ function resolveCollectionConfig(opts) {
2421
2482
  }
2422
2483
 
2423
2484
  // src/with-formula/computed/lazy.ts
2424
- var loadComputed = lazy(() => import("./computed-6G5M3UPH.js"));
2485
+ var loadComputed = lazy(() => import("./computed-ASBNTLOK.js"));
2425
2486
  async function loadEvalComputedFields() {
2426
2487
  return (await loadComputed()).evalComputedFields;
2427
2488
  }
@@ -2607,7 +2668,8 @@ var Collection = class {
2607
2668
  fieldMeta;
2608
2669
  /** Collection-level descriptive metadata declared via `meta`; read by `getMeta()`, surfaced in `describe()`. */
2609
2670
  meta;
2610
- /** Outbound ref declarations (snapshot from vault refRegistry at construction time); used by `describe()`. */
2671
+ /** Outbound ref declarations (snapshot from the vault refRegistry); read by `describe()` and
2672
+ * {@link _txAtomicSafe}. Mutable for {@link _attachDeclaredRefs} (#1141). */
2611
2673
  _refs;
2612
2674
  /** Money field descriptors keyed by field path, typed as the opaque {@link ViaDescriptor} marker
2613
2675
  * (the kernel never inspects the concrete shape); `put()` quantizes to a scaled-int string,
@@ -2877,14 +2939,14 @@ var Collection = class {
2877
2939
  if (crdtMode === "yjs") {
2878
2940
  return local._v >= remote._v ? local : remote;
2879
2941
  }
2880
- const localJson = await this.codec.decryptJsonString(local, id);
2881
- const remoteJson = await this.codec.decryptJsonString(remote, id);
2942
+ const localJson = await this.codec.decryptJsonString({ collection: this.name, id }, local);
2943
+ const remoteJson = await this.codec.decryptJsonString({ collection: this.name, id }, remote);
2882
2944
  if (localJson === null) return local;
2883
2945
  if (remoteJson === null) return remote;
2884
2946
  const merged = this.strategies.crdt.mergeCrdtStates(JSON.parse(localJson), JSON.parse(remoteJson));
2885
2947
  const mergedVersion = Math.max(local._v, remote._v) + 1;
2886
2948
  const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
2887
- return this.codec.encryptJsonString(JSON.stringify(merged), mergedVersion, cek);
2949
+ return this.codec.encryptJsonString({ collection: this.name, id }, JSON.stringify(merged), mergedVersion, cek);
2888
2950
  };
2889
2951
  opts.onRegisterConflictResolver(this.name, crdtResolver);
2890
2952
  }
@@ -2925,14 +2987,14 @@ var Collection = class {
2925
2987
  } else {
2926
2988
  const mergeFn = policy;
2927
2989
  resolver = async (id, local, remote) => {
2928
- const localRecord = await this.codec.decryptRecord(local, { skipValidation: true, id });
2929
- const remoteRecord = await this.codec.decryptRecord(remote, { skipValidation: true, id });
2990
+ const localRecord = await this.codec.decryptRecord({ collection: this.name, id }, local, { skipValidation: true });
2991
+ const remoteRecord = await this.codec.decryptRecord({ collection: this.name, id }, remote, { skipValidation: true });
2930
2992
  if (localRecord === null) return local;
2931
2993
  if (remoteRecord === null) return remote;
2932
2994
  const merged = mergeFn(localRecord, remoteRecord);
2933
2995
  const mergedVersion = Math.max(local._v, remote._v) + 1;
2934
2996
  const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
2935
- return this.codec.encryptRecord(merged, mergedVersion, cek, void 0, void 0, void 0, id);
2997
+ return this.codec.encryptRecord({ collection: this.name, id }, merged, mergedVersion, cek);
2936
2998
  };
2937
2999
  }
2938
3000
  opts.onRegisterConflictResolver(collectionName, resolver);
@@ -3203,7 +3265,7 @@ var Collection = class {
3203
3265
  }
3204
3266
  await this.onAccess?.("find", "*");
3205
3267
  if (hits.length === 0) return [];
3206
- const { verifyDigestField } = await import("./verify-RO5RTZOJ.js");
3268
+ const { verifyDigestField } = await import("./verify-WYOFLSNA.js");
3207
3269
  const policy = {
3208
3270
  normalize: spec.verifyNormalize ?? "password",
3209
3271
  notLastN: spec.notLastN ?? 0,
@@ -3291,7 +3353,7 @@ var Collection = class {
3291
3353
  * `openVault`, before the user's `collection(name, { moneyFields })`
3292
3354
  * declaration; this reconciles that ordering. First-wins. Not public.
3293
3355
  *
3294
- * PREPENDS money rather than appending: {@link compileViaBindings} always
3356
+ * PREPENDS money rather than appending: {@link compileVias} always
3295
3357
  * compiles money before i18n (money-first pipeline order — see its
3296
3358
  * docstring), and by the time this reconcile runs an i18n binding may
3297
3359
  * already be sitting in `this.via.bindings` (declared at construction).
@@ -3317,6 +3379,12 @@ var Collection = class {
3317
3379
  _applyMeta(meta) {
3318
3380
  if (this.meta === void 0) this.meta = meta;
3319
3381
  }
3382
+ /** @internal #1141 — refresh the ref snapshot after a late `refs` declaration. Overwrites rather
3383
+ * than first-wins, deliberately: the argument is the ref registry's own merged view (see
3384
+ * `reconcileViaAttach`), which `RefRegistry.register` has already refused to let conflict. */
3385
+ _attachDeclaredRefs(refs) {
3386
+ this._refs = refs;
3387
+ }
3320
3388
  /**
3321
3389
  * @internal — attach classified fields post-construction. See {@link _applyMoneyFields}.
3322
3390
  * First-wins. Note: unlike money/computed/meta, this cannot retro-seal a
@@ -3409,7 +3477,7 @@ var Collection = class {
3409
3477
  }
3410
3478
  }
3411
3479
  if (this.materializedViewSource !== void 0) {
3412
- const { resolveStaleMVOnRead } = await import("./stale-ARHFVL5U.js");
3480
+ const { resolveStaleMVOnRead } = await import("./stale-MCS46TFO.js");
3413
3481
  await resolveStaleMVOnRead(this.materializedViewSource, this.name, this.#dispatchCtx({ collection: this.name, id: "resolve-on-read" }));
3414
3482
  }
3415
3483
  let record;
@@ -3421,7 +3489,7 @@ var Collection = class {
3421
3489
  const envelope = await this.adapter.get(this.vault, this.name, id);
3422
3490
  if (!envelope) return null;
3423
3491
  if (isTombstone(envelope, this.storeCiphertext) || isDeleteMarker(envelope) || (envelope._tier ?? 0) > 0) return null;
3424
- record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
3492
+ record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
3425
3493
  if (record === null) return null;
3426
3494
  this.lru.set(id, { record, version: envelope._v }, estimateRecordBytes(record));
3427
3495
  }
@@ -3448,7 +3516,7 @@ var Collection = class {
3448
3516
  }
3449
3517
  const envelope = await this.adapter.get(this.vault, this.name, id);
3450
3518
  if (!envelope || (envelope._tier ?? 0) > 0) return null;
3451
- const json = await this.codec.decryptJsonString(envelope);
3519
+ const json = await this.codec.decryptJsonString({ collection: this.name, id }, envelope);
3452
3520
  if (json === null) return null;
3453
3521
  return JSON.parse(json);
3454
3522
  }
@@ -3565,7 +3633,7 @@ var Collection = class {
3565
3633
  if (cached) return cached.record;
3566
3634
  const env = await this.adapter.get(this.vault, this.name, id);
3567
3635
  if (!env || (env._tier ?? 0) > 0) return void 0;
3568
- const rec = await this.codec.decryptRecord(env, { id });
3636
+ const rec = await this.codec.decryptRecord({ collection: this.name, id }, env, {});
3569
3637
  return rec === null ? void 0 : rec;
3570
3638
  }
3571
3639
  await this.ensureHydrated();
@@ -3613,7 +3681,7 @@ var Collection = class {
3613
3681
  if (cached2) return { record: cached2.record, version: cached2.version };
3614
3682
  const env = await this.adapter.get(this.vault, this.name, id);
3615
3683
  if (!env || (env._tier ?? 0) > 0) return { record: null, version: 0 };
3616
- return { record: await this.codec.decryptRecord(env, { skipValidation: true, id }) ?? null, version: env._v };
3684
+ return { record: await this.codec.decryptRecord({ collection: this.name, id }, env, { skipValidation: true }) ?? null, version: env._v };
3617
3685
  }
3618
3686
  await this.ensureHydrated();
3619
3687
  const cached = this.cache.get(id);
@@ -3635,7 +3703,7 @@ var Collection = class {
3635
3703
  if (this.sensitiveFields.size > 0 || this.via?.hasAtRestHooks === true) {
3636
3704
  const env = await this.adapter.get(this.vault, this.name, id);
3637
3705
  if (!env || isTombstone(env, this.storeCiphertext) || (env._tier ?? 0) > 0) return void 0;
3638
- const rec = await this.codec.decryptRecord(env, { skipValidation: true, id });
3706
+ const rec = await this.codec.decryptRecord({ collection: this.name, id }, env, { skipValidation: true });
3639
3707
  return rec === null ? void 0 : { record: rec, version: env._v };
3640
3708
  }
3641
3709
  const cached = this.cache.get(id);
@@ -3647,7 +3715,7 @@ var Collection = class {
3647
3715
  const env = await this.adapter.get(this.vault, this.name, id);
3648
3716
  if (!env) return { env: null, record: null, elided: false };
3649
3717
  if ((env._tier ?? 0) > 0) return { env, record: null, elided: false };
3650
- return { env, record: await this.codec.decryptRecord(env, { skipValidation: true, id }), elided: false };
3718
+ return { env, record: await this.codec.decryptRecord({ collection: this.name, id }, env, { skipValidation: true }), elided: false };
3651
3719
  }
3652
3720
  /**
3653
3721
  * Wraps {@link RecordCodec.toCacheRecord} with an additional strip for
@@ -3671,9 +3739,9 @@ var Collection = class {
3671
3739
  * payload that is not a CRDT state. The `lww-map` and `rga` branches each
3672
3740
  * carried a copy, byte-identical apart from the cast (#842).
3673
3741
  */
3674
- async #decodePriorCrdtState(envelope) {
3742
+ async #decodePriorCrdtState(id, envelope) {
3675
3743
  if (!envelope) return void 0;
3676
- const prevJson = await this.codec.decryptJsonString(envelope);
3744
+ const prevJson = await this.codec.decryptJsonString({ collection: this.name, id }, envelope);
3677
3745
  if (prevJson === null) return void 0;
3678
3746
  const prevParsed = JSON.parse(prevJson);
3679
3747
  if (prevParsed === null || typeof prevParsed !== "object" || !("_crdt" in prevParsed)) {
@@ -3710,7 +3778,8 @@ var Collection = class {
3710
3778
  this.vault,
3711
3779
  this.name,
3712
3780
  id,
3713
- await this.codec.encryptRecord(prior.record, prior.version, cek, void 0, void 0, vdigCtx, id)
3781
+ await this.codec.encryptRecord(this.strategies.history.historyIdentity(this.name, id, prior.version), prior.record, prior.version, cek, void 0, void 0, vdigCtx)
3782
+ // sealed against its _history STORAGE identity (#1041)
3714
3783
  );
3715
3784
  this.emitter.emit("history:save", { vault: this.vault, collection: this.name, id, version: prior.version });
3716
3785
  if (this.historyConfig.maxVersions) {
@@ -3820,20 +3889,20 @@ var Collection = class {
3820
3889
  const now = (/* @__PURE__ */ new Date()).toISOString();
3821
3890
  let crdtState;
3822
3891
  if (this.crdtMode === "lww-map") {
3823
- const existingState = await this.#decodePriorCrdtState(existingEnvelope);
3892
+ const existingState = await this.#decodePriorCrdtState(id, existingEnvelope);
3824
3893
  crdtState = this.strategies.crdt.buildLwwMapState(record, existingState, now);
3825
3894
  } else if (this.crdtMode === "rga") {
3826
- const existingState = await this.#decodePriorCrdtState(existingEnvelope);
3895
+ const existingState = await this.#decodePriorCrdtState(id, existingEnvelope);
3827
3896
  crdtState = this.strategies.crdt.buildRgaState(Array.isArray(record) ? record : [record], existingState, generateULID);
3828
3897
  } else {
3829
3898
  crdtState = { _crdt: "yjs", update: record };
3830
3899
  }
3831
3900
  const version = existingVersion + 1;
3832
3901
  const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
3833
- const envelope = await this.codec.encryptJsonString(JSON.stringify(crdtState), version, cek, options?.source, options?.sourceTs);
3902
+ const envelope = await this.codec.encryptJsonString({ collection: this.name, id }, JSON.stringify(crdtState), version, cek, options?.source, options?.sourceTs);
3834
3903
  await this.adapter.put(this.vault, this.name, id, envelope);
3835
3904
  const resolvedRecord = this.strategies.crdt.resolveCrdtSnapshot(crdtState);
3836
- const existingResolvedRecord = existingEnvelope ? await this.codec.decryptRecord(existingEnvelope, { skipValidation: true }) : null;
3905
+ const existingResolvedRecord = existingEnvelope ? await this.codec.decryptRecord({ collection: this.name, id }, existingEnvelope, { skipValidation: true }) : null;
3837
3906
  const existingResolved = existingResolvedRecord !== null ? { record: existingResolvedRecord, version: existingVersion } : void 0;
3838
3907
  if (existingResolved) {
3839
3908
  await this.#savePriorHistory(id, existingResolved, cek, this.vdigFields !== null ? { id, prev: existingEnvelope } : void 0);
@@ -3873,7 +3942,7 @@ var Collection = class {
3873
3942
  if (!existing) {
3874
3943
  priorRaw = await this.adapter.get(this.vault, this.name, id);
3875
3944
  if (priorRaw) {
3876
- const previousRecord = await this.codec.decryptRecord(priorRaw, { id });
3945
+ const previousRecord = await this.codec.decryptRecord({ collection: this.name, id }, priorRaw, {});
3877
3946
  if (previousRecord !== null) {
3878
3947
  existing = { record: previousRecord, version: priorRaw._v };
3879
3948
  }
@@ -3893,7 +3962,7 @@ var Collection = class {
3893
3962
  this.uniqueConstraints?.check(id, record);
3894
3963
  const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
3895
3964
  const vdigCtx = this.vdigFields !== null ? { id, prev: await this.adapter.get(this.vault, this.name, id) } : void 0;
3896
- const envelope = await this.codec.encryptRecord(record, version, cek, options?.source, options?.sourceTs, vdigCtx, id);
3965
+ const envelope = await this.codec.encryptRecord({ collection: this.name, id }, record, version, cek, options?.source, options?.sourceTs, vdigCtx);
3897
3966
  return { id, envelope, version, indexed: record, event: record, prior: existing, cek, vdigCtx, reason: options?.reason };
3898
3967
  }
3899
3968
  /**
@@ -3939,7 +4008,7 @@ var Collection = class {
3939
4008
  */
3940
4009
  async dispatchMaterializedViews(id, record, wave) {
3941
4010
  if (this.materializedViewSource === void 0) return;
3942
- const { dispatchMaterializedViews } = await import("./dispatch-FZEAWKVM.js");
4011
+ const { dispatchMaterializedViews } = await import("./dispatch-VR4LRXZ7.js");
3943
4012
  return dispatchMaterializedViews(this.#mvDispatchCtx(this.materializedViewSource), id, record, wave);
3944
4013
  }
3945
4014
  /**
@@ -3967,7 +4036,7 @@ var Collection = class {
3967
4036
  const cached = this.lru.get(id);
3968
4037
  const env = await this.adapter.get(this.vault, this.name, id);
3969
4038
  if (!env || isTombstone(env, this.storeCiphertext) || isDeleteMarker(env)) return null;
3970
- raw = await this.codec.decryptRecord(env, { id });
4039
+ raw = await this.codec.decryptRecord({ collection: this.name, id }, env, {});
3971
4040
  if (raw === null) return null;
3972
4041
  if (!cached) {
3973
4042
  this.lru.set(id, { record: await this.codec.toCacheRecord(raw, env, id), version: env._v }, estimateRecordBytes(raw));
@@ -3978,7 +4047,7 @@ var Collection = class {
3978
4047
  else {
3979
4048
  const env = await this.adapter.get(this.vault, this.name, id);
3980
4049
  if (!env || isTombstone(env, this.storeCiphertext) || isDeleteMarker(env)) return null;
3981
- raw = await this.codec.decryptRecord(env, { id });
4050
+ raw = await this.codec.decryptRecord({ collection: this.name, id }, env, {});
3982
4051
  if (raw === null) return null;
3983
4052
  this.lru.set(id, { record: raw, version: env._v }, estimateRecordBytes(raw));
3984
4053
  }
@@ -3995,7 +4064,7 @@ var Collection = class {
3995
4064
  async _getStoredRecordForDispatch(id) {
3996
4065
  const env = await this.adapter.get(this.vault, this.name, id);
3997
4066
  if (!env || isTombstone(env, this.storeCiphertext) || isDeleteMarker(env)) return null;
3998
- const record = await this.codec.decryptRecord(env, { id });
4067
+ const record = await this.codec.decryptRecord({ collection: this.name, id }, env, {});
3999
4068
  return record === null ? null : { record, version: env._v };
4000
4069
  }
4001
4070
  /**
@@ -4112,7 +4181,7 @@ var Collection = class {
4112
4181
  * dispatch wave's per-target dedup; `undefined` on the local-write path (byte-identical). */
4113
4182
  async dispatchDerivations(id, record, version, wave) {
4114
4183
  if (this.derivationSource === void 0) return;
4115
- const { dispatchDerivations } = await import("./dispatch-MJ6SHB3Y.js");
4184
+ const { dispatchDerivations } = await import("./dispatch-4AP4PUZU.js");
4116
4185
  return dispatchDerivations({
4117
4186
  ...this.#derivationDeleteCtx(this.derivationSource),
4118
4187
  via: this.via,
@@ -4295,7 +4364,7 @@ var Collection = class {
4295
4364
  if (!existing && this.historyConfig.enabled !== false) {
4296
4365
  const previousEnvelope2 = await this.adapter.get(this.vault, this.name, id);
4297
4366
  if (previousEnvelope2) {
4298
- const previousRecord = await this.codec.decryptRecord(previousEnvelope2, { id });
4367
+ const previousRecord = await this.codec.decryptRecord({ collection: this.name, id }, previousEnvelope2, {});
4299
4368
  if (previousRecord !== null) {
4300
4369
  existing = { record: previousRecord, version: previousEnvelope2._v };
4301
4370
  }
@@ -4310,7 +4379,7 @@ var Collection = class {
4310
4379
  if (this.onDirty) {
4311
4380
  const live = previousEnvelope;
4312
4381
  if (!live || isTombstone(live, this.storeCiphertext) || isDeleteMarker(live)) return null;
4313
- marker = buildDeleteMarker(live._v + 1, this.keyring.userId);
4382
+ marker = buildDeleteMarker({ collection: this.name, id }, live._v + 1, this.keyring.userId);
4314
4383
  }
4315
4384
  const snapshots = existing !== void 0 && this.historyConfig.enabled !== false;
4316
4385
  const cek = snapshots && this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
@@ -4332,7 +4401,7 @@ var Collection = class {
4332
4401
  async _commitDelete(prepared, persist = true) {
4333
4402
  const { id, internal, existing, previousPayloadHash, marker, cek, vdigCtx } = prepared;
4334
4403
  if (existing && this.historyConfig.enabled !== false) {
4335
- 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));
4404
+ 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));
4336
4405
  }
4337
4406
  if (marker) {
4338
4407
  if (persist) await this.adapter.put(this.vault, this.name, id, marker);
@@ -4399,7 +4468,7 @@ var Collection = class {
4399
4468
  */
4400
4469
  async _decodeEnvelope(envelope, id) {
4401
4470
  try {
4402
- const rec = await this.codec.decryptRecord(envelope, { skipValidation: true, id });
4471
+ const rec = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { skipValidation: true });
4403
4472
  return rec === null ? null : rec;
4404
4473
  } catch {
4405
4474
  return null;
@@ -4408,7 +4477,7 @@ var Collection = class {
4408
4477
  async _writeTombstone(id, actor) {
4409
4478
  const live = await this.adapter.get(this.vault, this.name, id);
4410
4479
  if (!live || isTombstone(live, this.storeCiphertext) || isDeleteMarker(live)) return null;
4411
- await this.adapter.put(this.vault, this.name, id, buildTombstone(live._v, actor));
4480
+ await this.adapter.put(this.vault, this.name, id, buildTombstone({ collection: this.name, id }, live._v, actor));
4412
4481
  this.cache.delete(id);
4413
4482
  this.lru?.remove(id);
4414
4483
  this.cekCache?.remove(id);
@@ -4427,7 +4496,7 @@ var Collection = class {
4427
4496
  */
4428
4497
  async dispatchArrayDerivationsOnDelete(id, eraseRecordShapeToo = false) {
4429
4498
  if (this.derivationSource === void 0) return 0;
4430
- const { dispatchArrayDerivationsOnDelete } = await import("./dispatch-MJ6SHB3Y.js");
4499
+ const { dispatchArrayDerivationsOnDelete } = await import("./dispatch-4AP4PUZU.js");
4431
4500
  return dispatchArrayDerivationsOnDelete(this.#derivationDeleteCtx(this.derivationSource), id, eraseRecordShapeToo);
4432
4501
  }
4433
4502
  /**
@@ -4441,7 +4510,7 @@ var Collection = class {
4441
4510
  */
4442
4511
  async dispatchMaterializedViewsOnDelete(id) {
4443
4512
  if (this.materializedViewSource === void 0) return { deleted: 0, residueUndecodable: [], residueDeclined: [] };
4444
- const { dispatchMaterializedViewsOnDelete } = await import("./dispatch-FZEAWKVM.js");
4513
+ const { dispatchMaterializedViewsOnDelete } = await import("./dispatch-VR4LRXZ7.js");
4445
4514
  return dispatchMaterializedViewsOnDelete(this.#mvDispatchCtx(this.materializedViewSource), id);
4446
4515
  }
4447
4516
  /**
@@ -4461,7 +4530,7 @@ var Collection = class {
4461
4530
  );
4462
4531
  }
4463
4532
  if (this.materializedViewSource !== void 0) {
4464
- const { resolveStaleMVOnRead } = await import("./stale-ARHFVL5U.js");
4533
+ const { resolveStaleMVOnRead } = await import("./stale-MCS46TFO.js");
4465
4534
  await resolveStaleMVOnRead(this.materializedViewSource, this.name, this.#dispatchCtx({ collection: this.name, id: "resolve-on-read" }));
4466
4535
  }
4467
4536
  await this.ensureHydrated();
@@ -4795,7 +4864,7 @@ var Collection = class {
4795
4864
  const entries = [];
4796
4865
  for (const env of envelopes) {
4797
4866
  if ((env._tier ?? 0) > 0) continue;
4798
- const record = await this.codec.decryptRecord(env, { skipValidation: true, id });
4867
+ const record = await this.codec.decryptRecord(this.strategies.history.historyIdentity(this.name, id, env._v), env, { skipValidation: true });
4799
4868
  if (record === null) continue;
4800
4869
  entries.push({
4801
4870
  version: env._v,
@@ -4824,7 +4893,7 @@ var Collection = class {
4824
4893
  version
4825
4894
  );
4826
4895
  if (!envelope || (envelope._tier ?? 0) > 0 || await liveRecordIsElevated(this.adapter, this.vault, this.name, id)) return null;
4827
- return this.codec.decryptRecord(envelope, { skipValidation: true, id });
4896
+ return this.codec.decryptRecord(this.strategies.history.historyIdentity(this.name, id, envelope._v), envelope, { skipValidation: true });
4828
4897
  }
4829
4898
  /** Revert a record to a past version. Creates a new version with the old content. */
4830
4899
  async revert(id, version) {
@@ -4930,7 +4999,7 @@ var Collection = class {
4930
4999
  const id = ids[i];
4931
5000
  const envelope = await this.adapter.get(this.vault, this.name, id);
4932
5001
  if (envelope && (envelope._tier ?? 0) === 0) {
4933
- const record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
5002
+ const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
4934
5003
  if (record === null) continue;
4935
5004
  items.push(record);
4936
5005
  if (!this.lazy && !this.cache.has(id)) {
@@ -5012,7 +5081,7 @@ var Collection = class {
5012
5081
  const out = [];
5013
5082
  for (const { id, envelope } of items) {
5014
5083
  if ((envelope._tier ?? 0) > 0) continue;
5015
- const record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
5084
+ const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
5016
5085
  if (record === null) continue;
5017
5086
  out.push({ id, record, version: envelope._v });
5018
5087
  }
@@ -5073,7 +5142,7 @@ var Collection = class {
5073
5142
  }
5074
5143
  return;
5075
5144
  }
5076
- const record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
5145
+ const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
5077
5146
  if (record === null) {
5078
5147
  this.cache.delete(id);
5079
5148
  if (previous) {
@@ -5169,7 +5238,7 @@ var Collection = class {
5169
5238
  for (const id of ids) {
5170
5239
  const envelope = await this.adapter.get(this.vault, this.name, id);
5171
5240
  if (envelope && !isTombstone(envelope, this.storeCiphertext) && !isDeleteMarker(envelope) && (envelope._tier ?? 0) === 0) {
5172
- const record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
5241
+ const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
5173
5242
  if (record === null) continue;
5174
5243
  this.cache.set(id, { record, version: envelope._v });
5175
5244
  } else if (envelope && isDeleteMarker(envelope)) {
@@ -5188,7 +5257,7 @@ var Collection = class {
5188
5257
  continue;
5189
5258
  }
5190
5259
  if (isTombstone(envelope, this.storeCiphertext) || (envelope._tier ?? 0) > 0) continue;
5191
- const record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
5260
+ const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
5192
5261
  if (record === null) continue;
5193
5262
  this.cache.set(id, { record, version: envelope._v });
5194
5263
  }
@@ -5322,7 +5391,7 @@ var Collection = class {
5322
5391
  for (const [id, entry] of this.cache) {
5323
5392
  const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
5324
5393
  const prevForVdig = this.vdigFields !== null ? await this.adapter.get(this.vault, this.name, id) : null;
5325
- result[id] = await this.codec.encryptRecord(entry.record, entry.version, cek, void 0, void 0, this.vdigFields !== null ? { id, prev: prevForVdig } : void 0, id);
5394
+ 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);
5326
5395
  }
5327
5396
  return result;
5328
5397
  }
@@ -5437,7 +5506,7 @@ var Collection = class {
5437
5506
  const envelope = await this.adapter.get(this.vault, this.name, id);
5438
5507
  if (!envelope) continue;
5439
5508
  try {
5440
- const json = await this.codec.decryptJsonString(envelope);
5509
+ const json = await this.codec.decryptJsonString({ collection: this.name, id }, envelope);
5441
5510
  if (json === null) continue;
5442
5511
  const body = JSON.parse(json);
5443
5512
  if (typeof body.recordId !== "string") continue;
@@ -5571,14 +5640,14 @@ var Collection = class {
5571
5640
  /** C-A/R10: persist the classified marker once per classified handle (store I/O in config-drift.ts). */
5572
5641
  async _ensureClassifiedMarker() {
5573
5642
  if (this._markerPersisted || this.vdigFields === null) return;
5574
- const { persistClassifiedMarkerForFields } = await import("./classified-marker-2KJAXRRO.js");
5643
+ const { persistClassifiedMarkerForFields } = await import("./classified-marker-BSQHU4JT.js");
5575
5644
  await persistClassifiedMarkerForFields(this.adapter, this.vault, this.name, this.vdigFields, await this.getDEK(this.name));
5576
5645
  this._markerPersisted = true;
5577
5646
  }
5578
5647
  /** C-A/R10 drift signal — the marker's declared digest-only set, memoized to one store read per handle (see config-drift.ts). */
5579
5648
  async _classifiedMarkerDigestOnly() {
5580
5649
  if (this._markerDigestOnlyCache !== void 0) return this._markerDigestOnlyCache;
5581
- const { readClassifiedMarkerDigestOnly } = await import("./classified-marker-2KJAXRRO.js");
5650
+ const { readClassifiedMarkerDigestOnly } = await import("./classified-marker-BSQHU4JT.js");
5582
5651
  this._markerDigestOnlyCache = await readClassifiedMarkerDigestOnly(this.adapter, this.vault, this.name, await this.getDEK(this.name));
5583
5652
  return this._markerDigestOnlyCache;
5584
5653
  }
@@ -5700,10 +5769,10 @@ var Collection = class {
5700
5769
  if (busActive) await this.subsystemBus.dispatch(busPoint, event);
5701
5770
  }
5702
5771
  _txAtomicSafe(opType) {
5703
- if (this.materializedViewSource !== void 0 && this.materializedViewSource.registry().mvsForSource(this.name).length > 0 || this.derivationSource !== void 0 && this.derivationSource.registry().strategiesForSource(this.name).length > 0 || this.crdtMode !== void 0 || this.uniqueConstraints !== null || this.writeHooks !== void 0 && this.writeHooks.hasBeforeHandlers && !this.writeHooks.suppressed) return false;
5772
+ if (this.materializedViewSource !== void 0 && (this.materializedViewSource.registry().hasPendingPlans() || this.materializedViewSource.registry().mvsForSource(this.name).length > 0) || this.derivationSource !== void 0 && this.derivationSource.registry().strategiesForSource(this.name).length > 0 || this.crdtMode !== void 0 || this.uniqueConstraints !== null || this.writeHooks !== void 0 && this.writeHooks.hasBeforeHandlers && !this.writeHooks.suppressed) return false;
5704
5773
  return opType === "put" ? Object.keys(this._refs).length === 0 : this.refEnforcer === void 0 || !this.refEnforcer._deleteCascadesPossible(this.name);
5705
5774
  }
5706
- // @internal #893/#906-prep atomic-commit eligibility gate (Task 4) — false on any derivation/MV source (any lifecycle), CRDT mode, unique constraints, or refs on this write direction. Put uses precise outbound `_refs`; delete (#922) consults the enforcer's `_deleteCascadesPossible(name)` — Vault unions ALL THREE cascade sources `enforceRefsOnDelete` (with-shape/links/vault-facade.ts) fires from (lookup-ref edges, classic inbound refs, managed links); anything narrower (e.g. `getInbound` alone) would admit unsafe atomic deletes, because `_prepareDelete` runs those cascades DURING prepare. #931 narrows #906's hooks blanket: only BEFORE-hooks gate (they can REFUSE a write, which only `put()`/`delete()` honors); after-hooks and the `afterPut`/`afterDelete` observe bus cannot refuse, so the atomic path fires them itself post-finalize via `_fireAtomicAfterWrite` instead of forfeiting the batch (the pre-#931 db-global blanket cost multi-tab write-relay and forget-subject apps the atomic path entirely). See atomic-eligibility.ts.
5775
+ // @internal #893/#906-prep atomic-commit eligibility gate (Task 4) — false on any derivation/MV source (any lifecycle), false while ANY query-form MV plan is still parked (#1139: an unplanned strategy has no `_bySource` entry, so `mvsForSource` cannot see that this collection is one of its sources — and the atomic path skips MV dispatch, which is the very thing that would replan it), CRDT mode, unique constraints, or refs on this write direction. Put uses precise outbound `_refs`; delete (#922) consults the enforcer's `_deleteCascadesPossible(name)` — Vault unions ALL THREE cascade sources `enforceRefsOnDelete` (with-shape/links/vault-facade.ts) fires from (lookup-ref edges, classic inbound refs, managed links); anything narrower (e.g. `getInbound` alone) would admit unsafe atomic deletes, because `_prepareDelete` runs those cascades DURING prepare. #931 narrows #906's hooks blanket: only BEFORE-hooks gate (they can REFUSE a write, which only `put()`/`delete()` honors); after-hooks and the `afterPut`/`afterDelete` observe bus cannot refuse, so the atomic path fires them itself post-finalize via `_fireAtomicAfterWrite` instead of forfeiting the batch (the pre-#931 db-global blanket cost multi-tab write-relay and forget-subject apps the atomic path entirely). See atomic-eligibility.ts.
5707
5776
  _reconcileReadState(patch) {
5708
5777
  if (patch.dictKeyFields) this.dictKeyFields = { ...patch.dictKeyFields, ...this.dictKeyFields };
5709
5778
  if (patch.i18nFields) this.i18nFields = { ...patch.i18nFields, ...this.i18nFields };
@@ -5730,8 +5799,9 @@ var Collection = class {
5730
5799
  syncIndexes: (id, rec, version, priorEnvelope) => syncTierIndexes(this.indexingContext(), id, rec, version, priorEnvelope),
5731
5800
  syncSearch: (id, rec, version) => syncTierSearch(this.searchContext(), id, rec, version),
5732
5801
  syncHistory: async (id, fromDek, toDek) => this.strategies.history.rewrapHistory(this.adapter, this.vault, this.name, id, fromDek, toDek, await this.getDEK(this.name)),
5733
- saveHistorySnapshot: async (id, envelope) => {
5802
+ saveHistorySnapshot: async (id, version, seal) => {
5734
5803
  if (this.historyConfig.enabled === false) return;
5804
+ const envelope = await seal(this.strategies.history.historyIdentity(this.name, id, version));
5735
5805
  await this.strategies.history.saveHistory(this.adapter, this.vault, this.name, id, envelope);
5736
5806
  this.emitter.emit("history:save", { vault: this.vault, collection: this.name, id, version: envelope._v });
5737
5807
  if (this.historyConfig.maxVersions) await this.strategies.history.pruneHistory(this.adapter, this.vault, this.name, id, { keepVersions: this.historyConfig.maxVersions });
@@ -6015,17 +6085,18 @@ var DeferredNumberingStore = class {
6015
6085
  async readJson(collection, id) {
6016
6086
  const env = await this.adapter.get(this.vault, collection, id);
6017
6087
  if (!env) return { env: null, value: null };
6018
- const json = this.encrypted ? await openEnvelopeJson(env, await this.dek(collection)) : env._data;
6088
+ const json = this.encrypted ? await openEnvelopeJson({ collection, id }, env, await this.dek(collection)) : env._data;
6019
6089
  return { env, value: JSON.parse(json) };
6020
6090
  }
6021
6091
  async writeJson(collection, id, value, expectedVersion) {
6022
6092
  const json = JSON.stringify(value);
6023
6093
  let env;
6024
6094
  if (!this.encrypted) {
6025
- env = { _noydb: NOYDB_FORMAT_VERSION, _v: expectedVersion + 1, _ts: (/* @__PURE__ */ new Date()).toISOString(), _iv: "", _data: json, _by: this.actor };
6095
+ env = buildRecordEnvelope({ collection, id, version: expectedVersion + 1 }, { iv: "", data: json });
6026
6096
  } else {
6027
- const { iv, data } = await encrypt(json, await this.dek(collection));
6028
- env = { _noydb: NOYDB_FORMAT_VERSION, _v: expectedVersion + 1, _ts: (/* @__PURE__ */ new Date()).toISOString(), _iv: iv, _data: data, _by: this.actor };
6097
+ const identity = { collection, id, version: expectedVersion + 1 };
6098
+ const { iv, data } = await encrypt(json, await this.dek(collection), buildRecordAad(identity));
6099
+ env = buildRecordEnvelope(identity, { iv, data });
6029
6100
  }
6030
6101
  await this.adapter.put(this.vault, collection, id, env, expectedVersion);
6031
6102
  }
@@ -6575,7 +6646,7 @@ var VaultPeriods = class {
6575
6646
  const loaded = await this.deps.strategy.loadPeriods(
6576
6647
  this.deps.adapter,
6577
6648
  this.deps.vault,
6578
- (env) => this.decryptPeriodRecord(env)
6649
+ (id, env) => this.decryptPeriodRecord(id, env)
6579
6650
  );
6580
6651
  this.periodCache = await this.mergeReopenState(loaded);
6581
6652
  }
@@ -6592,7 +6663,7 @@ var VaultPeriods = class {
6592
6663
  const loaded = await this.deps.strategy.loadPeriods(
6593
6664
  this.deps.adapter,
6594
6665
  this.deps.vault,
6595
- (env) => this.decryptPeriodRecord(env)
6666
+ (id, env) => this.decryptPeriodRecord(id, env)
6596
6667
  );
6597
6668
  this.periodCache = loaded;
6598
6669
  return loaded;
@@ -6600,27 +6671,15 @@ var VaultPeriods = class {
6600
6671
  /** Generic reserved-collection writer — serves `_periods` and `_period_freezes` alike. */
6601
6672
  async writeReserved(collection, key, value) {
6602
6673
  const json = JSON.stringify(value);
6674
+ const actor = this.deps.userId();
6675
+ const identity = { collection, id: key, by: actor, version: 1 };
6603
6676
  let envelope;
6604
6677
  if (this.deps.encrypted) {
6605
6678
  const dek = await this.deps.getDEK(collection);
6606
- const { iv, data } = await encrypt(json, dek);
6607
- envelope = {
6608
- _noydb: NOYDB_FORMAT_VERSION,
6609
- _v: 1,
6610
- _ts: (/* @__PURE__ */ new Date()).toISOString(),
6611
- _iv: iv,
6612
- _data: data,
6613
- _by: this.deps.userId()
6614
- };
6679
+ const { iv, data } = await encrypt(json, dek, buildRecordAad(identity));
6680
+ envelope = buildRecordEnvelope(identity, { iv, data });
6615
6681
  } else {
6616
- envelope = {
6617
- _noydb: NOYDB_FORMAT_VERSION,
6618
- _v: 1,
6619
- _ts: (/* @__PURE__ */ new Date()).toISOString(),
6620
- _iv: "",
6621
- _data: json,
6622
- _by: this.deps.userId()
6623
- };
6682
+ envelope = buildRecordEnvelope(identity, { iv: "", data: json });
6624
6683
  }
6625
6684
  await this.deps.adapter.put(this.deps.vault, collection, key, envelope);
6626
6685
  if (collection === PERIODS_COLLECTION && this.deps.onDirty) {
@@ -6632,14 +6691,14 @@ var VaultPeriods = class {
6632
6691
  async readReserved(collection, key) {
6633
6692
  const env = await this.deps.adapter.get(this.deps.vault, collection, key);
6634
6693
  if (!env) return null;
6635
- const json = this.deps.encrypted ? await openEnvelopeJson(env, await this.deps.getDEK(collection)) : env._data;
6694
+ const json = this.deps.encrypted ? await openEnvelopeJson({ collection, id: key }, env, await this.deps.getDEK(collection)) : env._data;
6636
6695
  return JSON.parse(json);
6637
6696
  }
6638
- async decryptPeriodRecord(envelope) {
6697
+ async decryptPeriodRecord(periodId, envelope) {
6639
6698
  let json;
6640
6699
  if (this.deps.encrypted) {
6641
6700
  const dek = await this.deps.getDEK(PERIODS_COLLECTION);
6642
- json = await openEnvelopeJson(envelope, dek);
6701
+ json = await openEnvelopeJson({ collection: PERIODS_COLLECTION, id: periodId }, envelope, dek);
6643
6702
  } else {
6644
6703
  json = envelope._data;
6645
6704
  }
@@ -7214,7 +7273,7 @@ var VaultLinks = class {
7214
7273
  // src/with-shape/links/lazy-handle.ts
7215
7274
  function makeLazyLinkSetHandle(d) {
7216
7275
  let engine = null;
7217
- const load = () => engine ??= import("./link-set-E5HNY67I.js").then(
7276
+ const load = () => engine ??= import("./link-set-76JZ6YB4.js").then(
7218
7277
  ({ LinkSet }) => new LinkSet(d.adapter, d.vault, d.name, d.spec, d.encrypted, d.getDEK, d.actor, d.emitter, d.endpointExists)
7219
7278
  );
7220
7279
  return {
@@ -7332,7 +7391,7 @@ function registerCollectionGraphSources(graph, name, opts) {
7332
7391
  ...Object.keys(cfg.i18nFields ?? {}),
7333
7392
  ...Object.keys(cfg.dictKeyFields ?? {}),
7334
7393
  // #650 Task 2 — native lookup()/enumOf()/dict() fields register their
7335
- // posture (`lookupBinding().posture`) the same generic way every other
7394
+ // posture (`lookupVia().posture`) the same generic way every other
7336
7395
  // binding does; no `'ref'` EdgeKind / graph edge yet (Task 5).
7337
7396
  ...Object.keys(cfg.lookupFields ?? {}),
7338
7397
  ...cfg.classified !== void 0 ? Object.keys(cfg.classified.byField) : []
@@ -7444,16 +7503,16 @@ var EMPTY_POSTURE_MAP = /* @__PURE__ */ new Map();
7444
7503
  function hasI18nBinding(coll) {
7445
7504
  return (coll._via?.bindings ?? []).some((b) => b.brand === "i18n");
7446
7505
  }
7447
- function insertI18nBinding(existing, i18nBinding) {
7506
+ function insertI18nBinding(existing, i18nVia) {
7448
7507
  const idx = existing.findIndex((b) => b.brand === "lookup" || b.brand === "classified" || b.brand === "blob" || b.brand === "computed" || b.brand === "taint");
7449
- return idx === -1 ? [...existing, i18nBinding] : [...existing.slice(0, idx), i18nBinding, ...existing.slice(idx)];
7508
+ return idx === -1 ? [...existing, i18nVia] : [...existing.slice(0, idx), i18nVia, ...existing.slice(idx)];
7450
7509
  }
7451
7510
  function hasLookupBinding(coll) {
7452
7511
  return (coll._via?.bindings ?? []).some((b) => b.brand === "lookup");
7453
7512
  }
7454
- function insertLookupBinding(existing, lookupBindingObj) {
7513
+ function insertLookupBinding(existing, lookupViaObj) {
7455
7514
  const idx = existing.findIndex((b) => b.brand === "classified" || b.brand === "blob" || b.brand === "computed" || b.brand === "taint");
7456
- return idx === -1 ? [...existing, lookupBindingObj] : [...existing.slice(0, idx), lookupBindingObj, ...existing.slice(idx)];
7515
+ return idx === -1 ? [...existing, lookupViaObj] : [...existing.slice(0, idx), lookupViaObj, ...existing.slice(idx)];
7457
7516
  }
7458
7517
  function refuseUnattachableMatrixLookupFields(vaultCtx, lookupFields) {
7459
7518
  for (const [field, desc] of Object.entries(lookupFields)) {
@@ -7620,6 +7679,10 @@ function reconcileViaAttach(coll, graph, name, vaultCtx, plan) {
7620
7679
  classifiedFields: plan.classifiedFields,
7621
7680
  computed: plan.computed
7622
7681
  }) : void 0;
7682
+ if (plan.refs !== void 0) {
7683
+ vaultCtx.refRegistry.register(name, plan.refs);
7684
+ coll._attachDeclaredRefs(vaultCtx.refRegistry.getOutbound(name));
7685
+ }
7623
7686
  if (plan.effectiveViaFields.moneyFields) coll._applyMoneyFields(plan.effectiveViaFields.moneyFields);
7624
7687
  if (plan.computed) coll._applyComputed(plan.computed);
7625
7688
  if (plan.fieldMeta) coll._applyFieldMeta(plan.fieldMeta);
@@ -7861,7 +7924,7 @@ function declareSatellite(ctx, collectionName, options, existingRegistry) {
7861
7924
  ctx.forEachSyncEngine((e) => e.remirrorPairResolvers([spec.base, spec.satellite]));
7862
7925
  const registry = reg;
7863
7926
  const baseSchema = ctx.getBaseSchema(spec.base);
7864
- void import("./post-register-2XSSMGEQ.js").then((m) => m.postRegister(ctx.adapter, ctx.vaultName, spec, ctx.getDEK, baseSchema, registry)).catch(() => {
7927
+ void import("./post-register-53O7AJRZ.js").then((m) => m.postRegister(ctx.adapter, ctx.vaultName, spec, ctx.getDEK, baseSchema, registry)).catch(() => {
7865
7928
  });
7866
7929
  return reg;
7867
7930
  }
@@ -8181,17 +8244,6 @@ function expandRefsWithSatellites(refs, registry) {
8181
8244
  return anySat ? out : refs;
8182
8245
  }
8183
8246
 
8184
- // src/with-shape/satellites/migrate-cek.ts
8185
- async function migrateSatelliteCek(name, coll) {
8186
- if (coll.getConfig()?.perRecordKeys !== true) {
8187
- throw new SatelliteConfigError(
8188
- `migrateSatellitePerRecordKeys: collection "${name}" was already opened this session without perRecordKeys (construction-only); migrate before its first open, or restart the session.`
8189
- );
8190
- }
8191
- const migrated = await coll._applyCutoverTransform((doc) => doc);
8192
- return { migrated };
8193
- }
8194
-
8195
8247
  // src/with-shape/schema-update/fence-controller.ts
8196
8248
  function schemaBumpAuditHook(getLedger, actor) {
8197
8249
  return async (generation) => {
@@ -8629,7 +8681,7 @@ var Vault = class {
8629
8681
  this.keyring = opts.keyring;
8630
8682
  this.encrypted = opts.encrypted;
8631
8683
  this.schemaFence = new SchemaFenceController({
8632
- coordination: this.noydb.coordination,
8684
+ coordination: this.noydb.mesh,
8633
8685
  vault: this.name,
8634
8686
  onFlush: () => this.noydb._writeQueueTracker.onFlush(),
8635
8687
  clientId: this.noydb._clientId,
@@ -8754,6 +8806,7 @@ var Vault = class {
8754
8806
  * dispatch reads/writes — from this vault's OWN privates, rather than passing `this` itself. */
8755
8807
  _viaReconcileCtx() {
8756
8808
  return {
8809
+ refRegistry: this.refRegistry,
8757
8810
  i18nStrategy: this.strategies.i18n,
8758
8811
  locale: this.locale,
8759
8812
  translateText: this.translateText,
@@ -8829,6 +8882,8 @@ var Vault = class {
8829
8882
  if (coll) {
8830
8883
  reconcileViaAttach(coll, this.graph, collectionName, this._viaReconcileCtx(), {
8831
8884
  effectiveViaFields,
8885
+ ...options?.refs !== void 0 ? { refs: options.refs } : {},
8886
+ // #1141 — late `refs` declaration
8832
8887
  ...options?.computed !== void 0 ? { computed: options.computed } : {},
8833
8888
  ...options?.fieldMeta !== void 0 ? { fieldMeta: options.fieldMeta } : {},
8834
8889
  ...options?.meta !== void 0 ? { meta: options.meta } : {},
@@ -8844,7 +8899,7 @@ var Vault = class {
8844
8899
  const strategies = options.schemaUpdate ?? [];
8845
8900
  const work = (async () => {
8846
8901
  const dek = await this.getDEK(collectionName);
8847
- const { persistSchemaIfNeeded } = await import("./register-4EFJCVYD.js");
8902
+ const { persistSchemaIfNeeded } = await import("./register-6TCBR6XD.js");
8848
8903
  const result = await persistSchemaIfNeeded({
8849
8904
  store: this.adapter,
8850
8905
  vault: this.name,
@@ -8994,7 +9049,7 @@ var Vault = class {
8994
9049
  const work = (async () => {
8995
9050
  try {
8996
9051
  const dek = await this.getDEK(collectionName);
8997
- await (await import("./register-4EFJCVYD.js")).persistSchemaIfNeeded({
9052
+ await (await import("./register-6TCBR6XD.js")).persistSchemaIfNeeded({
8998
9053
  store: this.adapter,
8999
9054
  vault: this.name,
9000
9055
  collectionName,
@@ -9037,9 +9092,10 @@ var Vault = class {
9037
9092
  * unblocks R-S7 when a base gains forget coverage after its satellite was
9038
9093
  * already declared without `perRecordKeys`. Call BEFORE re-declaring with
9039
9094
  * `{ satelliteOf, perRecordKeys: true }` AND before this collection serves
9040
- * writes (unfenced walk — see {@link migrateSatelliteCek}); resumable.
9095
+ * writes (unfenced walk — see `with-shape/satellites/migrate-cek.ts`); resumable.
9041
9096
  */
9042
9097
  async migrateSatellitePerRecordKeys(satelliteName) {
9098
+ const { migrateSatelliteCek } = await import("./migrate-cek-LBRKYUZZ.js");
9043
9099
  return migrateSatelliteCek(satelliteName, this.collection(satelliteName, { perRecordKeys: true }));
9044
9100
  }
9045
9101
  /**
@@ -9221,10 +9277,10 @@ var Vault = class {
9221
9277
  async _ensureFenceCoordination() {
9222
9278
  if (this.#fenceCoordinationStarted) return;
9223
9279
  this.#fenceCoordinationStarted = true;
9224
- const { FenceWatcher } = await import("./fence-watcher-DHQ775JB.js");
9280
+ const { FenceWatcher } = await import("./fence-watcher-ZVSMLKQD.js");
9225
9281
  if (!this.#fenceCoordinationStarted) return;
9226
9282
  this.#fenceWatcher = new FenceWatcher({
9227
- coordination: this.noydb.coordination,
9283
+ coordination: this.noydb.mesh,
9228
9284
  vault: this.name,
9229
9285
  clientId: this.noydb._clientId,
9230
9286
  sessionId: this.noydb._sessionId,
@@ -9670,16 +9726,23 @@ var Vault = class {
9670
9726
  */
9671
9727
  // eslint-disable-next-line @typescript-eslint/consistent-type-imports
9672
9728
  async _loadPodSigner() {
9673
- const { loadSigner } = await import("./signer-TA55QB6R.js");
9729
+ const { loadSigner } = await import("./signer-6XVS2AU3.js");
9674
9730
  return loadSigner(this.adapter, this.name, this.getDEK);
9675
9731
  }
9676
9732
  async writeExportAudit(entry) {
9677
9733
  const json = JSON.stringify(entry);
9734
+ const exportAuditIdentity = { collection: EXPORT_AUDIT_COLLECTION, id: entry.id, by: entry.actor, version: 1 };
9678
9735
  const envelope = this.encrypted ? await (async () => {
9679
9736
  const dek = await this.getDEK(EXPORT_AUDIT_COLLECTION);
9680
- const { iv, data } = await encrypt(json, dek);
9681
- return { _noydb: NOYDB_FORMAT_VERSION, _v: 1, _ts: entry.startedAt, _iv: iv, _data: data, _by: entry.actor };
9682
- })() : { _noydb: NOYDB_FORMAT_VERSION, _v: 1, _ts: entry.startedAt, _iv: "", _data: json, _by: entry.actor };
9737
+ const { iv, data } = await encrypt(json, dek, buildRecordAad(exportAuditIdentity));
9738
+ return buildRecordEnvelope(
9739
+ exportAuditIdentity,
9740
+ { ts: entry.startedAt, iv, data }
9741
+ );
9742
+ })() : buildRecordEnvelope(
9743
+ exportAuditIdentity,
9744
+ { ts: entry.startedAt, iv: "", data: json }
9745
+ );
9683
9746
  await this.adapter.put(this.name, EXPORT_AUDIT_COLLECTION, entry.id, envelope);
9684
9747
  }
9685
9748
  canExport(tier, format) {
@@ -9693,12 +9756,12 @@ var Vault = class {
9693
9756
  *
9694
9757
  * @internal
9695
9758
  */
9696
- async _decryptEnvelopeForBundleFilter(env, collectionName) {
9759
+ async _decryptEnvelopeForBundleFilter(env, collectionName, recordId) {
9697
9760
  if (!this.encrypted) {
9698
9761
  return JSON.parse(env._data);
9699
9762
  }
9700
9763
  const dek = await this.getDEK(collectionName);
9701
- const json = await openEnvelopeJson(env, dek);
9764
+ const json = await openEnvelopeJson({ collection: collectionName, id: recordId }, env, dek);
9702
9765
  return JSON.parse(json);
9703
9766
  }
9704
9767
  canImport(tier, format) {
@@ -10153,7 +10216,7 @@ var Vault = class {
10153
10216
  async _initGuards(handles) {
10154
10217
  if (handles.length === 0) return;
10155
10218
  const [{ GuardRegistry }, { ReadOnlyVaultFacade }] = await Promise.all([
10156
- import("./registry-IKUR2MXD.js"),
10219
+ import("./registry-IWFMXCHX.js"),
10157
10220
  import("./read-only-facade-CHCKSEPD.js")
10158
10221
  ]);
10159
10222
  const registry = new GuardRegistry();
@@ -10181,7 +10244,7 @@ var Vault = class {
10181
10244
  async _initDerivations(handles) {
10182
10245
  if (handles.length === 0) return;
10183
10246
  const [{ DerivationRegistry }, { ReadOnlyVaultFacade }] = await Promise.all([
10184
- import("./registry-4SDHHOJ7.js"),
10247
+ import("./registry-DH2L4O2V.js"),
10185
10248
  import("./read-only-facade-CHCKSEPD.js")
10186
10249
  ]);
10187
10250
  const registry = new DerivationRegistry();
@@ -10213,7 +10276,7 @@ var Vault = class {
10213
10276
  */
10214
10277
  async _initMaterializedViews(handles) {
10215
10278
  if (handles.length === 0) return;
10216
- const { MaterializedViewRegistry } = await import("./registry-OYTFGWVK.js");
10279
+ const { MaterializedViewRegistry } = await import("./registry-YC3IFG3A.js");
10217
10280
  const registry = new MaterializedViewRegistry();
10218
10281
  this.materializedViewRegistry = registry;
10219
10282
  const db = this;
@@ -10238,7 +10301,7 @@ var Vault = class {
10238
10301
  */
10239
10302
  async _initOverlayedViews(handles) {
10240
10303
  if (handles.length === 0) return;
10241
- const { OverlayedViewRegistry } = await import("./registry-CZVINVQH.js");
10304
+ const { OverlayedViewRegistry } = await import("./registry-Q3FG3OAX.js");
10242
10305
  const registry = new OverlayedViewRegistry();
10243
10306
  const mvRegistry = this.materializedViewRegistry;
10244
10307
  const overlayNames = /* @__PURE__ */ new Set();
@@ -10296,18 +10359,19 @@ var Vault = class {
10296
10359
  if (registry === null) {
10297
10360
  return { written: 0, deleted: 0, failed: 0, residueUndecodable: [], residueDeclined: [] };
10298
10361
  }
10362
+ await registry.resolvePendingPlans();
10299
10363
  const reg = registry.byName(name);
10300
10364
  if (!reg) {
10301
10365
  throw new Error(`refreshView: no MV registered with name "${name}"`);
10302
10366
  }
10303
- const { MaterializedViewExecutor } = await import("./executor-YIQB2S6N.js");
10367
+ const { MaterializedViewExecutor } = await import("./executor-3KFRQETS.js");
10304
10368
  const result = await MaterializedViewExecutor.refresh(reg, {
10305
10369
  getCollection: (n) => this.collection(n),
10306
10370
  getActiveTxContext: () => this.noydb._activeTxContextOrNull,
10307
10371
  getQueryContext: () => this,
10308
10372
  dispatchCtx: this._dispatchCtx({ collection: name, id: "refreshView" })
10309
10373
  });
10310
- const { clearMVStaleFully } = await import("./stale-ARHFVL5U.js");
10374
+ const { clearMVStaleFully } = await import("./stale-MCS46TFO.js");
10311
10375
  await clearMVStaleFully(this.adapter, this.name, registry, name);
10312
10376
  return result;
10313
10377
  }
@@ -10320,7 +10384,7 @@ var Vault = class {
10320
10384
  if (registry === null) return { derived: 0, failed: 0, skippedFrozen: 0 };
10321
10385
  const strategies = registry.strategiesForSource(sourceCollection);
10322
10386
  if (strategies.length === 0) return { derived: 0, failed: 0, skippedFrozen: 0 };
10323
- const { DerivationExecutor } = await import("./executor-S4QIKEHW.js");
10387
+ const { DerivationExecutor } = await import("./executor-YYDW6XQI.js");
10324
10388
  const sourceColl = this.collection(sourceCollection);
10325
10389
  const records = await sourceColl.list();
10326
10390
  const ctx = { vault: this.derivationFacade ?? new (await import("./read-only-facade-CHCKSEPD.js")).ReadOnlyVaultFacade(this, "derivation") };
@@ -10347,7 +10411,7 @@ var Vault = class {
10347
10411
  if (!outSpec) continue;
10348
10412
  const outputColl = this.collection(outSpec.collection);
10349
10413
  if (out.kind === "array") {
10350
- const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-NNAJQXMX.js");
10414
+ const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-IWP3R4RC.js");
10351
10415
  const prior = await loadFanoutSidecar(this.adapter, this.name, spec.source, id, key, this.getDEK, this.encrypted);
10352
10416
  const prevKeys = new Set(prior?.keys ?? []);
10353
10417
  const newKeysList = out.entries.map((e) => e.key);
@@ -10574,7 +10638,7 @@ var Vault = class {
10574
10638
  * collection.
10575
10639
  */
10576
10640
  async delegate(opts) {
10577
- const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-MO7YZYJS.js");
10641
+ const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-XWRPYODW.js");
10578
10642
  if (!this.keyring.kek) {
10579
10643
  throw new ValidationError(
10580
10644
  "issueDelegation: keyring.kek is null \u2014 issuing a delegation requires a tier-1 unlock. Re-authenticate at tier 1 (secret) first."
@@ -10596,7 +10660,7 @@ var Vault = class {
10596
10660
  * if the id does not exist.
10597
10661
  */
10598
10662
  async revokeDelegation(id) {
10599
- const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-MO7YZYJS.js");
10663
+ const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-XWRPYODW.js");
10600
10664
  await revokeDelegation(this.adapter, this.name, id);
10601
10665
  void DELEGATIONS_COLLECTION;
10602
10666
  }
@@ -10612,7 +10676,7 @@ var Vault = class {
10612
10676
  * - The keyring must already carry a wrap for the target tier on
10613
10677
  * at least one collection (or be `owner` / `admin`, who can
10614
10678
  * auto-mint). Otherwise throws {@link TierNotGrantedError}.
10615
- * - Per-collection capability gates (`canExportPlaintext`,
10679
+ * - Per-collection capability gates (`assertCanExport`,
10616
10680
  * `canExportBundle`) are NOT bypassed — elevation is a tier
10617
10681
  * projection, not a privilege escalation path.
10618
10682
  * - Only one elevation can be active per vault at a time.
@@ -10692,25 +10756,18 @@ var Vault = class {
10692
10756
  async writeElevationAudit(entry) {
10693
10757
  const id = `elev-${Date.now().toString(36)}-${Math.random().toString(16).slice(2, 10)}`;
10694
10758
  const json = JSON.stringify({ id, ...entry });
10759
+ const elevationAuditIdentity = { collection: ELEVATION_AUDIT_COLLECTION, id, by: entry.actor, version: 1 };
10695
10760
  const envelope = this.encrypted ? await (async () => {
10696
10761
  const dek = await this.getDEK(ELEVATION_AUDIT_COLLECTION);
10697
- const { iv, data } = await encrypt(json, dek);
10698
- return {
10699
- _noydb: NOYDB_FORMAT_VERSION,
10700
- _v: 1,
10701
- _ts: entry.startedAt,
10702
- _iv: iv,
10703
- _data: data,
10704
- _by: entry.actor
10705
- };
10706
- })() : {
10707
- _noydb: NOYDB_FORMAT_VERSION,
10708
- _v: 1,
10709
- _ts: entry.startedAt,
10710
- _iv: "",
10711
- _data: json,
10712
- _by: entry.actor
10713
- };
10762
+ const { iv, data } = await encrypt(json, dek, buildRecordAad(elevationAuditIdentity));
10763
+ return buildRecordEnvelope(
10764
+ elevationAuditIdentity,
10765
+ { ts: entry.startedAt, iv, data }
10766
+ );
10767
+ })() : buildRecordEnvelope(
10768
+ elevationAuditIdentity,
10769
+ { ts: entry.startedAt, iv: "", data: json }
10770
+ );
10714
10771
  await this.adapter.put(this.name, ELEVATION_AUDIT_COLLECTION, id, envelope);
10715
10772
  }
10716
10773
  /**
@@ -10856,7 +10913,7 @@ var Vault = class {
10856
10913
  * @see design-history/2026-05-22-schema-dump-design.md
10857
10914
  */
10858
10915
  async dumpSchema(opts = {}) {
10859
- const { dumpVaultSchema } = await import("./walk-3ZECBFDA.js");
10916
+ const { dumpVaultSchema } = await import("./walk-JNEOYCAU.js");
10860
10917
  return dumpVaultSchema(this, opts);
10861
10918
  }
10862
10919
  /**
@@ -10951,15 +11008,15 @@ var Vault = class {
10951
11008
  * distinct handles, which is the right behavior — they're
10952
11009
  * separate vault instances now.
10953
11010
  */
10954
- async getBundleHandle() {
10955
- const { buildBundleHandle } = await import("./bundle-handle-GFNHT52M.js");
10956
- return buildBundleHandle(this.adapter, this.name);
11011
+ async getPodHandle() {
11012
+ const { buildPodHandle } = await import("./pod-handle-P6DPBM5U.js");
11013
+ return buildPodHandle(this.adapter, this.name);
10957
11014
  }
10958
11015
  /**
10959
11016
  * Read the owner-curated cover for this vault (or `undefined` if
10960
11017
  * none is persisted). The cover lives in `_meta/public-envelope`
10961
11018
  * (the frozen wire name) as plaintext — readable without any KEK
10962
- * — so `getBundleHandle`-style callers can label a vault before
11019
+ * — so `getPodHandle`-style callers can label a vault before
10963
11020
  * unlock.
10964
11021
  *
10965
11022
  * Mirrors `Noydb.getCover(vault, opts)` but scoped to a
@@ -10984,7 +11041,7 @@ var Vault = class {
10984
11041
  * both modes round-trip cleanly.
10985
11042
  */
10986
11043
  async dump() {
10987
- const { dumpVault } = await import("./backup-KULFZ2T4.js");
11044
+ const { dumpVault } = await import("./backup-Z7ZBTAQ6.js");
10988
11045
  return dumpVault(this.backupContext());
10989
11046
  }
10990
11047
  /**
@@ -11036,7 +11093,7 @@ var Vault = class {
11036
11093
  * — there's no chain to verify against.
11037
11094
  */
11038
11095
  async load(backupJson) {
11039
- const { loadVault } = await import("./backup-KULFZ2T4.js");
11096
+ const { loadVault } = await import("./backup-Z7ZBTAQ6.js");
11040
11097
  return loadVault(this.backupContext(), backupJson);
11041
11098
  }
11042
11099
  /**
@@ -11068,7 +11125,7 @@ var Vault = class {
11068
11125
  * way to detect tampering of an in-place vault.
11069
11126
  */
11070
11127
  async verifyBackupIntegrity() {
11071
- const { verifyBackupIntegrity } = await import("./backup-KULFZ2T4.js");
11128
+ const { verifyBackupIntegrity } = await import("./backup-Z7ZBTAQ6.js");
11072
11129
  return verifyBackupIntegrity(this.backupContext());
11073
11130
  }
11074
11131
  /**
@@ -11133,6 +11190,18 @@ var Vault = class {
11133
11190
  * }
11134
11191
  * ```
11135
11192
  */
11193
+ /**
11194
+ * Serialise this vault through an `as-*` format. The gate runs before a
11195
+ * record is read and the format never receives a vault — see
11196
+ * `docs/adr/0004-as-format-port.md` and `port/as/active.ts`.
11197
+ */
11198
+ async export(format, options) {
11199
+ return this.strategies.formats.exportWith(this, format, options);
11200
+ }
11201
+ /** Plan an import from an `as-*` format. Nothing is written until `apply()`. */
11202
+ async import(format, input, options) {
11203
+ return this.strategies.formats.importWith(this, format, input, options);
11204
+ }
11136
11205
  async *exportStream(opts = {}) {
11137
11206
  const granularity = opts.granularity ?? "collection";
11138
11207
  const exportLocale = opts.resolveLabels;
@@ -11286,7 +11355,7 @@ var Vault = class {
11286
11355
  * is the live validator object, not a serialization of it).
11287
11356
  */
11288
11357
  async exportJSON(opts = {}) {
11289
- const { exportVaultJSON } = await import("./backup-KULFZ2T4.js");
11358
+ const { exportVaultJSON } = await import("./backup-Z7ZBTAQ6.js");
11290
11359
  return exportVaultJSON(this.backupContext(), opts);
11291
11360
  }
11292
11361
  };
@@ -12162,7 +12231,7 @@ var TeamFacade = class {
12162
12231
  const p = this.deps.options.shamirRecovery;
12163
12232
  if (!p) {
12164
12233
  throw new Error(
12165
- "shamir recovery requires a ShamirRecoveryProvider \u2014 pass shamirRecovery: shamirRecoveryProvider() from '@noy-db/on-shamir' to createNoydb()"
12234
+ "shamir recovery requires a NoydbShamir \u2014 pass shamirRecovery: shamirRecoveryProvider() from '@noy-db/on-shamir' to createNoydb()"
12166
12235
  );
12167
12236
  }
12168
12237
  return p;
@@ -12197,6 +12266,20 @@ var TeamFacade = class {
12197
12266
  this.deps.keyringCache.set(vault, keyring);
12198
12267
  return result;
12199
12268
  }
12269
+ /** Gate + run the `verifyRoster` engine (#1121). See `Noydb.verifyRoster`. */
12270
+ async runVerifyRoster(engine, vault) {
12271
+ const keyring = await this.deps.getKeyringInternal(vault);
12272
+ return engine(this.deps.options.store, vault, keyring);
12273
+ }
12274
+ /** Gate + run the `quarantineKeyring` engine (#1121). See `Noydb.quarantineKeyring`. */
12275
+ async runQuarantine(engine, vault, userId, factors) {
12276
+ this.deps.checkPolicyOperation(vault, "revoke");
12277
+ await this.deps.checkGate(vault, "revoke-user", factors);
12278
+ const keyring = await this.deps.getKeyringInternal(vault);
12279
+ const result = await engine(this.deps.options.store, vault, keyring, userId);
12280
+ this.deps.keyringCache.set(vault, keyring);
12281
+ return result;
12282
+ }
12200
12283
  // ─── Tier-2 enroll / remove ─────────────────────────────────────
12201
12284
  /**
12202
12285
  * Add a tier-2 authenticator slot to the calling user's keyring.
@@ -12411,7 +12494,7 @@ var TeamFacade = class {
12411
12494
  "rotate-secret",
12412
12495
  "disabled",
12413
12496
  { minTier: 1, enabled: false },
12414
- "Managed-secret mode (#14): the secret is hub-generated and sealed under the SealingKeyProvider \u2014 there is no plaintext to rotate. Use the recovery flow (follow-up issue) to mint a fresh sealed secret."
12497
+ "Managed-secret mode (#14): the secret is hub-generated and sealed under the NoydbSealer \u2014 there is no plaintext to rotate. Use the recovery flow (follow-up issue) to mint a fresh sealed secret."
12415
12498
  );
12416
12499
  }
12417
12500
  await this.deps.checkGate(vault, "rotate-secret", factors);
@@ -12589,7 +12672,7 @@ var TeamFacade = class {
12589
12672
  * const db = await createNoydb({
12590
12673
  * store, user: 'alice',
12591
12674
  * secretMode: 'managed',
12592
- * sealingKey: macosKeychainSealingProvider({ ... }),
12675
+ * sealingKey: atMacosKeychain({ ... }),
12593
12676
  * })
12594
12677
  *
12595
12678
  * const { vault, recoveryEnrollments } = await db.team.openVaultAndEnrollRecovery('acme', {
@@ -12641,7 +12724,7 @@ var TeamFacade = class {
12641
12724
  *
12642
12725
  * Replaces the sealed secret of a managed-mode vault with a
12643
12726
  * fresh 256-bit random, sealed under the configured
12644
- * `SealingKeyProvider`. The user never sees the new secret.
12727
+ * `NoydbSealer`. The user never sees the new secret.
12645
12728
  *
12646
12729
  * Internally:
12647
12730
  * 1. Verify the recovery proof (Shamir today) and unwrap the
@@ -12939,8 +13022,8 @@ var Noydb = class {
12939
13022
  /** Session that owns this instance's writers (one user's writers across vaults). */
12940
13023
  sessionId;
12941
13024
  /** Drain-barrier coordination transport for the schema fence. */
12942
- coordinationProvider;
12943
- /** Pre-resolved `vault.user` API factory (mirrors `coordinationProvider` above). Public so `Vault` can call it. */
13025
+ meshPort;
13026
+ /** Pre-resolved `vault.user` API factory (mirrors `meshPort` above). Public so `Vault` can call it. */
12944
13027
  userApiFactory;
12945
13028
  vaultCache = /* @__PURE__ */ new Map();
12946
13029
  /**
@@ -13001,7 +13084,7 @@ var Noydb = class {
13001
13084
  }
13002
13085
  snapshots;
13003
13086
  policyManager;
13004
- /** Pre-resolved policy-gate engine function (mirrors `coordinationProvider`/`userApiFactory` above). */
13087
+ /** Pre-resolved policy-gate engine function (mirrors `meshPort`/`userApiFactory` above). */
13005
13088
  policyCheckGate;
13006
13089
  /**
13007
13090
  * Credential and multi-user operations — enrolment, secret rotation,
@@ -13048,12 +13131,12 @@ var Noydb = class {
13048
13131
  );
13049
13132
  }
13050
13133
  this.sessionId = options.sessionId ?? generateULID();
13051
- if (!options.coordinationStrategy) {
13134
+ if (!options.mesh) {
13052
13135
  throw new ValidationError(
13053
- "Noydb must be constructed via createNoydb(), which resolves the default coordination provider."
13136
+ "Noydb must be constructed via createNoydb(), which resolves the default mesh."
13054
13137
  );
13055
13138
  }
13056
- this.coordinationProvider = options.coordinationStrategy;
13139
+ this.meshPort = options.mesh;
13057
13140
  if (!options.userApiFactory) throw new ValidationError("Noydb must be constructed via createNoydb(), which resolves the default user-envelope API factory.");
13058
13141
  this.userApiFactory = options.userApiFactory;
13059
13142
  if (!options.policyFactory || !options.policyCheckGateFn) throw new ValidationError("Noydb must be constructed via createNoydb(), which resolves the default policy service.");
@@ -13102,6 +13185,7 @@ var Noydb = class {
13102
13185
  this.#registerGuardGate();
13103
13186
  this.#registerPeriodGate();
13104
13187
  this.#registerForgetHooks();
13188
+ this.#registerVaultHeadObserver();
13105
13189
  this.resetSessionTimer();
13106
13190
  }
13107
13191
  /** @internal — resolved forget strategy (NO_FORGET when not configured). */
@@ -13118,6 +13202,22 @@ var Noydb = class {
13118
13202
  // - the subsystemBus `afterDelete` observer fires on delete (onAfterWrite
13119
13203
  // does NOT) — drop the ref so a deleted record never lingers in the
13120
13204
  // index (RISK #2). Without it, forget() would try to shred a ghost.
13205
+ /** #1044 — see `with-commit/vault-head/strategy.ts` for why this is an observer. */
13206
+ #registerVaultHeadObserver() {
13207
+ if (!this.strategies.vaultHead.enabled) return;
13208
+ for (const point of ["afterPut", "afterDelete"]) {
13209
+ this.subsystemBus.register(point, async (event) => {
13210
+ const vault = this.vaultCache.get(event.vault);
13211
+ if (!vault) return;
13212
+ const { adapter, getDEK } = vault._introspectState();
13213
+ await this.strategies.vaultHead.note(adapter, event.vault, getDEK, {
13214
+ collection: event.collection,
13215
+ id: event.docId,
13216
+ version: event.version
13217
+ });
13218
+ });
13219
+ }
13220
+ }
13121
13221
  #registerForgetHooks() {
13122
13222
  const subjects = this.strategies.forget.subjects;
13123
13223
  if (Object.keys(subjects).length === 0) return;
@@ -13183,7 +13283,7 @@ var Noydb = class {
13183
13283
  if (!facade) return;
13184
13284
  const ctx = { existing, vault: facade, userId: e.userId, role: e.role };
13185
13285
  await registry.runChecks(e.collection, incoming, ctx);
13186
- const { GuardExecutor } = await import("./executor-CYJQLKKI.js");
13286
+ const { GuardExecutor } = await import("./executor-AFHQYRAU.js");
13187
13287
  for (const g of guards) {
13188
13288
  await GuardExecutor.checkFrozenFields(g, e.docId, existing, incoming, e.computedFieldNames);
13189
13289
  }
@@ -13304,6 +13404,7 @@ var Noydb = class {
13304
13404
  if (this.options.encrypt !== false && !this.policyCache.has(name)) {
13305
13405
  await this.bootstrapPolicy(name);
13306
13406
  }
13407
+ const mergeAuthority = buildMergeAuthority(keyring);
13307
13408
  let syncEngine;
13308
13409
  const targets = normalizeSyncTargets(this.options.sync);
13309
13410
  if (targets.length > 0) {
@@ -13318,11 +13419,12 @@ var Noydb = class {
13318
13419
  emitter: this.emitter,
13319
13420
  syncPolicy: effectivePolicy,
13320
13421
  role: primary.role,
13422
+ mergeAuthority,
13321
13423
  ...primary.label !== void 0 ? { label: primary.label } : {}
13322
13424
  });
13323
13425
  this.syncEngines.set(name, syncEngine);
13324
13426
  if (declaredPolicy) syncEngine.startScheduler();
13325
- for (const target of targets) {
13427
+ for (const [index, target] of targets.entries()) {
13326
13428
  if (target === primary) continue;
13327
13429
  const targetPolicy = target.policy ?? this.options.syncPolicy ?? INDEXED_STORE_POLICY;
13328
13430
  const engine = this.strategies.sync.buildSyncEngine({
@@ -13333,10 +13435,10 @@ var Noydb = class {
13333
13435
  emitter: this.emitter,
13334
13436
  syncPolicy: targetPolicy,
13335
13437
  role: target.role,
13438
+ mergeAuthority,
13336
13439
  ...target.label !== void 0 ? { label: target.label } : {}
13337
13440
  });
13338
- const key = `${name}::${target.label ?? target.role}`;
13339
- this.syncEngines.set(key, engine);
13441
+ this.syncEngines.set(`${name}::${index}`, engine);
13340
13442
  if (target.policy ?? this.options.syncPolicy) engine.startScheduler();
13341
13443
  }
13342
13444
  }
@@ -13557,8 +13659,8 @@ var Noydb = class {
13557
13659
  * collection) pair that was dropped. Re-run `grant()` for those pairs, or
13558
13660
  * they stay locked out.
13559
13661
  *
13560
- * Unlike `revoke({ rotateKeys: true })`, this call does not REMOVE any
13561
- * user from the vault — they keep membership and their other collections.
13662
+ * Unlike `revoke()`, this call does not REMOVE any user from the vault —
13663
+ * they keep membership and their other collections.
13562
13664
  * This is the "just rotate" path; "revoke and rotate" lives in `revoke()`.
13563
13665
  *
13564
13666
  * Exposed on Noydb (rather than only on the lower-level keyring
@@ -13569,6 +13671,27 @@ var Noydb = class {
13569
13671
  async rotate(vault, collections) {
13570
13672
  return this.strategies.team.rotate(this.team, vault, collections);
13571
13673
  }
13674
+ /**
13675
+ * Verify every `_keyring` file in the vault. Read-only (#1121).
13676
+ *
13677
+ * Names each failing file and why, so the bad one need not be found by trial.
13678
+ * Reports `checked` too: "nothing unverified" is equally true of a sweep that
13679
+ * examined nothing.
13680
+ */
13681
+ async verifyRoster(vault) {
13682
+ return this.strategies.team.verifyRoster(this.team, vault);
13683
+ }
13684
+ /**
13685
+ * Remove a `_keyring` file that cannot be authenticated, and re-key behind it
13686
+ * (#1121). Owner-only; refuses a file that verifies (use {@link revoke}).
13687
+ *
13688
+ * `revoke` consults the target's own `role`, so it cannot act on a file it
13689
+ * will not trust. This ignores every claim the file makes — which is exactly
13690
+ * why it is restricted to files that already fail authentication.
13691
+ */
13692
+ async quarantineKeyring(vault, userId, factors) {
13693
+ return this.strategies.team.quarantineKeyring(this.team, vault, userId, factors);
13694
+ }
13572
13695
  /** List all users with access to a vault. */
13573
13696
  async listUsers(vault) {
13574
13697
  return listUsers(this.options.store, vault);
@@ -13962,6 +14085,21 @@ var Noydb = class {
13962
14085
  }
13963
14086
  return engine.status();
13964
14087
  }
14088
+ /**
14089
+ * Per-target sync state for `vault` (#1034) — `syncStatus()` reads only the
14090
+ * primary engine, so it cannot express "the LAN store is behind, the cloud
14091
+ * is current". Registration order, primary first. See {@link SyncTargetStatus}.
14092
+ */
14093
+ syncTargetStatus(vault) {
14094
+ const targets = [];
14095
+ for (const [key, engine] of this.syncEngines) {
14096
+ if (key !== vault && !key.startsWith(`${vault}::`)) continue;
14097
+ const { dirty, lastPush, lastPull } = engine.status();
14098
+ const { label, role } = engine;
14099
+ targets.push({ label, role, dirty, lastPush, lastPull, caughtUp: dirty === 0 });
14100
+ }
14101
+ return targets;
14102
+ }
13965
14103
  /**
13966
14104
  * Enumerate the sync targets wired for `vault` (#948) — the primary engine
13967
14105
  * (keyed by vault name) plus any additional targets (keyed `vault::label`
@@ -13984,7 +14122,14 @@ var Noydb = class {
13984
14122
  getSyncEngine(vault) {
13985
14123
  const engine = this.syncEngines.get(vault);
13986
14124
  if (!engine) {
13987
- throw new ValidationError("No sync adapter configured. Pass a `sync` adapter to createNoydb().");
14125
+ if (this.syncEngines.size === 0) {
14126
+ throw new ValidationError(
14127
+ "No sync adapter configured. Pass a `sync` adapter to createNoydb() \u2014 a NoydbStore, a SyncTarget (`{ store, role }`), or an array of them \u2014 and `syncStrategy: withSync()` to enable the engine."
14128
+ );
14129
+ }
14130
+ throw new ValidationError(
14131
+ `No sync engine for vault "${String(vault)}". Sync is configured, but for [${[...this.syncEngines.keys()].map((k) => `"${k}"`).join(", ")}] \u2014 an engine is built per vault when it is opened, so open this vault first. Note the vault name is a REQUIRED argument: \`db.pull(vaultName)\`, not \`db.pull()\`.`
14132
+ );
13988
14133
  }
13989
14134
  return engine;
13990
14135
  }
@@ -14136,10 +14281,10 @@ var Noydb = class {
14136
14281
  /**
14137
14282
  * @internal Drain-barrier coordination transport for the schema fence.
14138
14283
  * The default store-backed provider reproduces today's fence behavior; a
14139
- * `by-*` real-time transport is injected via `coordinationStrategy`.
14284
+ * `by-*` real-time transport is injected via `mesh`.
14140
14285
  */
14141
- get coordination() {
14142
- return this.coordinationProvider;
14286
+ get mesh() {
14287
+ return this.meshPort;
14143
14288
  }
14144
14289
  /**
14145
14290
  * #693: true when multi-tab coordination is active at all — presence/election
@@ -14169,8 +14314,11 @@ var Noydb = class {
14169
14314
  * No-op when `vault` is not currently in cache (idempotent).
14170
14315
  */
14171
14316
  lockVault(vault) {
14172
- this.syncEngines.get(vault)?.stopAutoSync();
14173
- this.syncEngines.delete(vault);
14317
+ for (const [key, engine] of [...this.syncEngines]) {
14318
+ if (key !== vault && !key.startsWith(`${vault}::`)) continue;
14319
+ engine.stopAutoSync();
14320
+ this.syncEngines.delete(key);
14321
+ }
14174
14322
  this.policyEnforcers.get(vault)?.destroy();
14175
14323
  this.policyEnforcers.delete(vault);
14176
14324
  this.vaultCache.get(vault)?._stopFenceCoordination();
@@ -14506,8 +14654,8 @@ var Noydb = class {
14506
14654
  async function createNoydb(options) {
14507
14655
  if (!options.store) options = { ...options, store: memoryStore() };
14508
14656
  validateSecretModeOptions(options);
14509
- if (!options.coordinationStrategy) options = { ...options, coordinationStrategy: await createDefaultCoordinationProvider(options.store) };
14510
- if (!options.userApiFactory) options = { ...options, userApiFactory: (await import("./api-RXUMEKT3.js")).createUserApi };
14657
+ if (!options.mesh) options = { ...options, mesh: await createDefaultMesh(options.store) };
14658
+ if (!options.userApiFactory) options = { ...options, userApiFactory: (await import("./api-EQYRTZO2.js")).createUserApi };
14511
14659
  if (!options.policyFactory) {
14512
14660
  const policyModule = await import("./policy/index.js");
14513
14661
  options = { ...options, policyFactory: policyModule.createNoydbPolicy, policyCheckGateFn: policyModule.checkGate };
@@ -14542,4 +14690,4 @@ export {
14542
14690
  Noydb,
14543
14691
  createNoydb
14544
14692
  };
14545
- //# sourceMappingURL=chunk-2GAJGUNM.js.map
14693
+ //# sourceMappingURL=chunk-Y3YLJORD.js.map