@noy-db/hub 0.6.0-pre.9 → 0.6.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 (506) hide show
  1. package/CHANGELOG.md +7079 -0
  2. package/codemods/0.6.0-pre.json +211 -0
  3. package/dist/api-6X2VLZ7J.js +20 -0
  4. package/dist/attestation/index.js +19 -19
  5. package/dist/{backup-KULFZ2T4.js → backup-VL4GRIEW.js} +36 -18
  6. package/dist/backup-VL4GRIEW.js.map +1 -0
  7. package/dist/blobs/index.js +22 -20
  8. package/dist/blobs/index.js.map +1 -1
  9. package/dist/broker/index.js +12 -12
  10. package/dist/cargo/index.js +35 -35
  11. package/dist/{chunk-KUDZVJKQ.js → chunk-22GR3O4J.js} +2 -2
  12. package/dist/{chunk-CCZJJ4I2.js → chunk-2CBFYXJX.js} +6 -6
  13. package/dist/{chunk-JJNOLSG5.js → chunk-2J5IT37K.js} +15 -16
  14. package/dist/chunk-2J5IT37K.js.map +1 -0
  15. package/dist/{chunk-PNKHAKQ7.js → chunk-2ZCWHCLF.js} +17 -10
  16. package/dist/chunk-2ZCWHCLF.js.map +1 -0
  17. package/dist/{chunk-2BMRJ6LQ.js → chunk-2ZT4INZ4.js} +8 -11
  18. package/dist/{chunk-2BMRJ6LQ.js.map → chunk-2ZT4INZ4.js.map} +1 -1
  19. package/dist/{chunk-FAXZQ5UF.js → chunk-323MN67Z.js} +2 -2
  20. package/dist/{chunk-VMCCGUQB.js → chunk-36CEG6CM.js} +2 -2
  21. package/dist/{chunk-PDLLCOGD.js → chunk-3OE2QNSM.js} +20 -17
  22. package/dist/chunk-3OE2QNSM.js.map +1 -0
  23. package/dist/{chunk-AHLJSVRL.js → chunk-3YGUHUJA.js} +5 -7
  24. package/dist/chunk-3YGUHUJA.js.map +1 -0
  25. package/dist/{chunk-ZJADGNYF.js → chunk-4AOERLTV.js} +1 -1
  26. package/dist/chunk-4AOERLTV.js.map +1 -0
  27. package/dist/{chunk-BRVW2GS5.js → chunk-4ATF4BLF.js} +87 -34
  28. package/dist/chunk-4ATF4BLF.js.map +1 -0
  29. package/dist/{chunk-747LRSOO.js → chunk-4K6BIMLF.js} +2 -2
  30. package/dist/{chunk-5O5HRRTV.js → chunk-5ATC6UT4.js} +7 -7
  31. package/dist/{chunk-5O5HRRTV.js.map → chunk-5ATC6UT4.js.map} +1 -1
  32. package/dist/{chunk-4GZ6XOVW.js → chunk-5F7BZAGV.js} +44 -42
  33. package/dist/chunk-5F7BZAGV.js.map +1 -0
  34. package/dist/{chunk-FNSMZQS4.js → chunk-5IHGJHWC.js} +2 -2
  35. package/dist/{chunk-4I72F5DF.js → chunk-5LZZQMIC.js} +11 -14
  36. package/dist/chunk-5LZZQMIC.js.map +1 -0
  37. package/dist/{chunk-HPLWFNG4.js → chunk-5O5ZSW7N.js} +2 -2
  38. package/dist/{chunk-CEJWMBXO.js → chunk-5OT4G5N5.js} +6 -2
  39. package/dist/chunk-5OT4G5N5.js.map +1 -0
  40. package/dist/{chunk-GAG7QOVO.js → chunk-64WHKBMP.js} +53 -18
  41. package/dist/chunk-64WHKBMP.js.map +1 -0
  42. package/dist/{chunk-7TSYBD3E.js → chunk-65JXA63J.js} +2 -2
  43. package/dist/{chunk-Z45YRGFO.js → chunk-6NR36UNB.js} +2 -2
  44. package/dist/{chunk-W77KZHCW.js → chunk-6RH7PRTL.js} +16 -17
  45. package/dist/chunk-6RH7PRTL.js.map +1 -0
  46. package/dist/{chunk-3JVXVJ7L.js → chunk-7OBIBPCV.js} +10 -10
  47. package/dist/{chunk-AR2JDFAE.js → chunk-7Q3RHOA5.js} +2 -2
  48. package/dist/chunk-7ZGPQOFV.js +190 -0
  49. package/dist/chunk-7ZGPQOFV.js.map +1 -0
  50. package/dist/{chunk-QULVCV3M.js → chunk-AJGGBXWA.js} +4 -4
  51. package/dist/{chunk-CADUYBQD.js → chunk-ATL3ZVXT.js} +2 -2
  52. package/dist/{chunk-DMQCLZ4Z.js → chunk-ATY3ZASK.js} +2 -2
  53. package/dist/{chunk-4HDYQL3J.js → chunk-B4CRUZPR.js} +2 -2
  54. package/dist/{chunk-RV3ARMPN.js → chunk-BMU2DS3S.js} +30 -21
  55. package/dist/chunk-BMU2DS3S.js.map +1 -0
  56. package/dist/{chunk-6SAFL5YE.js → chunk-BZ3WMOYX.js} +3 -3
  57. package/dist/{chunk-UHXCLPGC.js → chunk-C3XWJCG7.js} +2 -2
  58. package/dist/chunk-C3XWJCG7.js.map +1 -0
  59. package/dist/{chunk-HXGUIPQB.js → chunk-CKKN25P2.js} +3 -3
  60. package/dist/{chunk-3URQC7EH.js → chunk-CXPOG3ZY.js} +355 -132
  61. package/dist/chunk-CXPOG3ZY.js.map +1 -0
  62. package/dist/{chunk-3FSX6LDG.js → chunk-D2YFQ7XG.js} +18 -3
  63. package/dist/{chunk-3FSX6LDG.js.map → chunk-D2YFQ7XG.js.map} +1 -1
  64. package/dist/{chunk-52JPHN5N.js → chunk-D6SXRMZZ.js} +27 -149
  65. package/dist/chunk-D6SXRMZZ.js.map +1 -0
  66. package/dist/{chunk-2DHSSLOD.js → chunk-DECNV4QK.js} +13 -15
  67. package/dist/chunk-DECNV4QK.js.map +1 -0
  68. package/dist/{chunk-6BU3L4UE.js → chunk-DNKVKO7K.js} +7 -10
  69. package/dist/chunk-DNKVKO7K.js.map +1 -0
  70. package/dist/{chunk-6HFM7EIT.js → chunk-EHRIDNZX.js} +2 -2
  71. package/dist/{chunk-3737A6EA.js → chunk-EHW7NLGD.js} +127 -31
  72. package/dist/chunk-EHW7NLGD.js.map +1 -0
  73. package/dist/{chunk-BEFVYAR5.js → chunk-EQOTJL76.js} +4 -4
  74. package/dist/chunk-EQOTJL76.js.map +1 -0
  75. package/dist/{chunk-E6427JU2.js → chunk-EV2TDHQZ.js} +19 -3
  76. package/dist/chunk-EV2TDHQZ.js.map +1 -0
  77. package/dist/{chunk-WFUIE565.js → chunk-FNYCT27B.js} +17 -14
  78. package/dist/chunk-FNYCT27B.js.map +1 -0
  79. package/dist/{chunk-RTAMLDWP.js → chunk-FU5VYEYK.js} +2 -2
  80. package/dist/chunk-FX3UIDCS.js +66 -0
  81. package/dist/chunk-FX3UIDCS.js.map +1 -0
  82. package/dist/{chunk-7F4DBNSP.js → chunk-GANFIM2M.js} +135 -18
  83. package/dist/chunk-GANFIM2M.js.map +1 -0
  84. package/dist/{chunk-4VUPLMZ6.js → chunk-GCU42IG7.js} +66 -71
  85. package/dist/chunk-GCU42IG7.js.map +1 -0
  86. package/dist/{chunk-RXYYFSBB.js → chunk-GKTW3KLV.js} +4 -4
  87. package/dist/chunk-HK67PX4J.js +27 -0
  88. package/dist/chunk-HK67PX4J.js.map +1 -0
  89. package/dist/{chunk-OF3L2SD6.js → chunk-HOPNIR5R.js} +2 -2
  90. package/dist/{chunk-WLZ47GSL.js → chunk-HSJBJIB2.js} +12 -10
  91. package/dist/{chunk-WLZ47GSL.js.map → chunk-HSJBJIB2.js.map} +1 -1
  92. package/dist/{chunk-ADW22QSB.js → chunk-HWI7GHJZ.js} +4 -4
  93. package/dist/{chunk-GQ3BX5EA.js → chunk-I3ISCYT7.js} +2 -2
  94. package/dist/{chunk-YJ6IONGA.js → chunk-IWKCJCLP.js} +11 -3
  95. package/dist/{chunk-YJ6IONGA.js.map → chunk-IWKCJCLP.js.map} +1 -1
  96. package/dist/{chunk-NJDQ4YSV.js → chunk-IWQPYT6S.js} +4 -4
  97. package/dist/{chunk-JRKZTEZZ.js → chunk-J6I5VR6P.js} +444 -73
  98. package/dist/chunk-J6I5VR6P.js.map +1 -0
  99. package/dist/{chunk-2Z3NCLNX.js → chunk-JHYKSMVX.js} +7 -7
  100. package/dist/{chunk-6FJWSWFT.js → chunk-JIHWBKMQ.js} +3 -3
  101. package/dist/{chunk-YAWK6AWF.js → chunk-JKATP6OE.js} +2 -2
  102. package/dist/{chunk-PL2GHSCM.js → chunk-JMJSCI7U.js} +157 -90
  103. package/dist/chunk-JMJSCI7U.js.map +1 -0
  104. package/dist/{chunk-Q6TEJXBX.js → chunk-JXHNUYQO.js} +31 -49
  105. package/dist/chunk-JXHNUYQO.js.map +1 -0
  106. package/dist/{chunk-2GAJGUNM.js → chunk-JYPRZWCZ.js} +343 -229
  107. package/dist/chunk-JYPRZWCZ.js.map +1 -0
  108. package/dist/{chunk-5ZKS6ZE2.js → chunk-K6CPIK3R.js} +4 -4
  109. package/dist/chunk-K6CPIK3R.js.map +1 -0
  110. package/dist/{chunk-CDB2HVQW.js → chunk-KM6ZXG7U.js} +14 -15
  111. package/dist/chunk-KM6ZXG7U.js.map +1 -0
  112. package/dist/{chunk-DG27IUVI.js → chunk-LC6NE4IQ.js} +2 -2
  113. package/dist/{chunk-WASHZV34.js → chunk-LIR2DJWP.js} +63 -25
  114. package/dist/chunk-LIR2DJWP.js.map +1 -0
  115. package/dist/{chunk-VZ3XFUQ7.js → chunk-LUYPYCHY.js} +16 -22
  116. package/dist/chunk-LUYPYCHY.js.map +1 -0
  117. package/dist/{chunk-G6S5VVHP.js → chunk-M7WBE3OR.js} +10 -10
  118. package/dist/chunk-M7WBE3OR.js.map +1 -0
  119. package/dist/{chunk-VJFMXYKP.js → chunk-MPKP6L5E.js} +2 -2
  120. package/dist/{chunk-IGJCYUT5.js → chunk-NSITFOCJ.js} +1 -1
  121. package/dist/chunk-NSITFOCJ.js.map +1 -0
  122. package/dist/{chunk-FUHKW252.js → chunk-OCJ3JA4O.js} +2 -2
  123. package/dist/{chunk-VCETL77O.js → chunk-ONPVHX2Y.js} +36 -7
  124. package/dist/chunk-ONPVHX2Y.js.map +1 -0
  125. package/dist/{chunk-WLYIROCJ.js → chunk-OQMCFHUX.js} +2 -2
  126. package/dist/{chunk-JRCYZEHU.js → chunk-OR2FYRYR.js} +2 -2
  127. package/dist/{chunk-HNHCQ556.js → chunk-PFWE7FJG.js} +2 -2
  128. package/dist/{chunk-NPP5R7FF.js → chunk-PJX72ICF.js} +22 -18
  129. package/dist/chunk-PJX72ICF.js.map +1 -0
  130. package/dist/{chunk-U5O6GIWZ.js → chunk-POFYIGQ2.js} +3 -3
  131. package/dist/{chunk-35EBKWQU.js → chunk-QH47SQLD.js} +4 -4
  132. package/dist/{chunk-FZ6NYJ7L.js → chunk-QQRRKO7W.js} +11 -8
  133. package/dist/chunk-QQRRKO7W.js.map +1 -0
  134. package/dist/{chunk-HVQGCKY4.js → chunk-QVXZFJBU.js} +2 -2
  135. package/dist/{chunk-FMQJZH4R.js → chunk-RDB66EKD.js} +6 -6
  136. package/dist/{chunk-X56RTUK3.js → chunk-RJZQ2PVD.js} +3 -3
  137. package/dist/{chunk-SUFG5E73.js → chunk-RPRASGEY.js} +2 -2
  138. package/dist/{chunk-XWX7GL56.js → chunk-S2I5MYSA.js} +7 -10
  139. package/dist/chunk-S2I5MYSA.js.map +1 -0
  140. package/dist/{chunk-FFDNKRCY.js → chunk-S6PJ6ZKE.js} +2 -2
  141. package/dist/chunk-S6PJ6ZKE.js.map +1 -0
  142. package/dist/{chunk-JIUVJ4M7.js → chunk-S7PM7Z4K.js} +3 -3
  143. package/dist/{chunk-55LKVALY.js → chunk-T7IR4N2S.js} +1 -3
  144. package/dist/chunk-T7IR4N2S.js.map +1 -0
  145. package/dist/{chunk-N35NC4JH.js → chunk-TKBB62DN.js} +2 -2
  146. package/dist/{chunk-YPYHVOXP.js → chunk-UJ4Z67UQ.js} +2 -2
  147. package/dist/chunk-UJ4Z67UQ.js.map +1 -0
  148. package/dist/{chunk-7MNBICB5.js → chunk-W3HAIN6U.js} +16 -14
  149. package/dist/chunk-W3HAIN6U.js.map +1 -0
  150. package/dist/{chunk-4UVDI4XE.js → chunk-WPZ5FVAS.js} +4 -4
  151. package/dist/{chunk-MSWYQLMQ.js → chunk-XINT4VJA.js} +2 -2
  152. package/dist/{chunk-7G6VDWXB.js → chunk-XPEPMK4Y.js} +3 -3
  153. package/dist/chunk-XPEPMK4Y.js.map +1 -0
  154. package/dist/{chunk-W3TVWF6N.js → chunk-YCGLAANM.js} +2 -2
  155. package/dist/{chunk-O2ERS4UJ.js → chunk-YTUFV7U7.js} +80 -51
  156. package/dist/chunk-YTUFV7U7.js.map +1 -0
  157. package/dist/{chunk-FDX7OWWI.js → chunk-YYV53EHO.js} +2 -2
  158. package/dist/{chunk-HNGSV2YC.js → chunk-Z3BZXPRO.js} +67 -10
  159. package/dist/chunk-Z3BZXPRO.js.map +1 -0
  160. package/dist/{chunk-6NVPFKN3.js → chunk-ZIMQDXTQ.js} +92 -35
  161. package/dist/chunk-ZIMQDXTQ.js.map +1 -0
  162. package/dist/{chunk-5JY5TSVY.js → chunk-ZJUZOJVW.js} +25 -31
  163. package/dist/chunk-ZJUZOJVW.js.map +1 -0
  164. package/dist/{chunk-3IXIU6FP.js → chunk-ZY6P7M52.js} +7 -10
  165. package/dist/chunk-ZY6P7M52.js.map +1 -0
  166. package/dist/{chunk-BWVKEOPE.js → chunk-ZYZJLYNS.js} +7 -11
  167. package/dist/chunk-ZYZJLYNS.js.map +1 -0
  168. package/dist/classified/index.js +5 -5
  169. package/dist/{classified-marker-2KJAXRRO.js → classified-marker-AZDSDG6V.js} +3 -3
  170. package/dist/collection-facade-WSUAYFJ4.js +45 -0
  171. package/dist/{computed-6G5M3UPH.js → computed-VG2PCM4L.js} +3 -3
  172. package/dist/consent/index.js +10 -10
  173. package/dist/cover/index.js +10 -3
  174. package/dist/custody/index.js +12 -11
  175. package/dist/{dead-filter-DCB62VWW.js → dead-filter-JNQNB3TA.js} +2 -2
  176. package/dist/debug/index.js +1 -1
  177. package/dist/{delegation-MO7YZYJS.js → delegation-5F36DRDH.js} +24 -23
  178. package/dist/delegation-5F36DRDH.js.map +1 -0
  179. package/dist/derivations/index.js +12 -12
  180. package/dist/derive-MPOGZ4NR.js +22 -0
  181. package/dist/directory/index.js +10 -10
  182. package/dist/{dispatch-MJ6SHB3Y.js → dispatch-3ZA733EY.js} +18 -18
  183. package/dist/{dispatch-FZEAWKVM.js → dispatch-TNM5CRLZ.js} +9 -6
  184. package/dist/dispatch-TNM5CRLZ.js.map +1 -0
  185. package/dist/{enclave-JU4YIEPB.js → enclave-Y2ALNDRD.js} +31 -9
  186. package/dist/executor-BBEEUFO3.js +9 -0
  187. package/dist/executor-G6G3YEWR.js +9 -0
  188. package/dist/executor-ZUTUMTPA.js +29 -0
  189. package/dist/export-accessible-S3KEB763.js +23 -0
  190. package/dist/extract-partition-KVCTSUVE.js +38 -0
  191. package/dist/{fanout-sidecar-NNAJQXMX.js → fanout-sidecar-3QZU7ZZX.js} +18 -27
  192. package/dist/fanout-sidecar-3QZU7ZZX.js.map +1 -0
  193. package/dist/find-V4FN5ITT.js +11 -0
  194. package/dist/forget/index.js +9 -9
  195. package/dist/guards/index.js +7 -7
  196. package/dist/history/index.js +23 -20
  197. package/dist/history/index.js.map +1 -1
  198. package/dist/i18n/index.js +14 -14
  199. package/dist/index.d.ts +30 -13
  200. package/dist/index.js +180 -188
  201. package/dist/index.js.map +1 -1
  202. package/dist/indexing/index.js +4 -4
  203. package/dist/introspection/index.js +11 -11
  204. package/dist/issue-5CFBWBRX.js +19 -0
  205. package/dist/kernel/collection.d.ts +8 -2
  206. package/dist/kernel/constants.d.ts +36 -0
  207. package/dist/kernel/enclave/crypto.d.ts +52 -4
  208. package/dist/kernel/enclave/index.d.ts +10 -3
  209. package/dist/kernel/enclave/record-aad.d.ts +131 -0
  210. package/dist/kernel/enclave/record-envelope.d.ts +76 -0
  211. package/dist/kernel/enclave/record-keys/envelope-body.d.ts +34 -2
  212. package/dist/kernel/enclave/record-keys/lifecycle.d.ts +22 -5
  213. package/dist/kernel/enclave/record-keys/record-codec.d.ts +47 -14
  214. package/dist/kernel/enclave/record-keys/rekey-blob.d.ts +88 -0
  215. package/dist/kernel/enclave/record-keys/rekey.d.ts +91 -0
  216. package/dist/kernel/enclave/record-keys/tombstone.d.ts +3 -2
  217. package/dist/kernel/errors.d.ts +132 -12
  218. package/dist/kernel/merge-authority.d.ts +25 -0
  219. package/dist/kernel/noydb.d.ts +27 -4
  220. package/dist/kernel/query/builder.d.ts +51 -4
  221. package/dist/kernel/query/join.d.ts +27 -0
  222. package/dist/kernel/query/live.d.ts +31 -9
  223. package/dist/kernel/query/predicate.d.ts +9 -0
  224. package/dist/kernel/refs.d.ts +3 -1
  225. package/dist/kernel/sync-policy.d.ts +0 -2
  226. package/dist/kernel/tier-visibility.d.ts +34 -0
  227. package/dist/kernel/types.d.ts +111 -13
  228. package/dist/kernel/vault.d.ts +6 -6
  229. package/dist/kernel/via/index.d.ts +11 -2
  230. package/dist/kernel/via/reconcile.d.ts +12 -0
  231. package/dist/{ledger-AETNF4OM.js → ledger-MQIIOTZB.js} +11 -11
  232. package/dist/liberate-LW7OKVBH.js +25 -0
  233. package/dist/{link-set-E5HNY67I.js → link-set-5PJBBR63.js} +11 -11
  234. package/dist/{managed-secret-CWQ6PND5.js → managed-secret-ETDG6AAE.js} +11 -3
  235. package/dist/materialized-views/index.js +24 -24
  236. package/dist/migrate-cek-V3VDRV24.js +19 -0
  237. package/dist/migrate-cek-V3VDRV24.js.map +1 -0
  238. package/dist/money/index.js +5 -5
  239. package/dist/noydb-LFDRMYZ5.js +85 -0
  240. package/dist/overlay-views/index.js +4 -4
  241. package/dist/periods/index.js +12 -12
  242. package/dist/pod/index.js +79 -89
  243. package/dist/pod-handle-AZ3CXY5Y.js +41 -0
  244. package/dist/pod-handle-AZ3CXY5Y.js.map +1 -0
  245. package/dist/policy/index.js +11 -4
  246. package/dist/port/to/index.d.ts +4 -4
  247. package/dist/port/to/locator.d.ts +54 -8
  248. package/dist/port/with/i18n-strategy.d.ts +4 -1
  249. package/dist/port/with/lookup-strategy.d.ts +4 -1
  250. package/dist/port/with/merge-authority.d.ts +52 -0
  251. package/dist/port/with/service-bus.d.ts +0 -4
  252. package/dist/port/with/strategies.d.ts +2 -0
  253. package/dist/port/with/team-strategy.d.ts +5 -1
  254. package/dist/portability/index.js +8 -8
  255. package/dist/{post-register-2XSSMGEQ.js → post-register-QCJYRMIK.js} +6 -6
  256. package/dist/query/index.js +6 -6
  257. package/dist/reduce/index.js +6 -6
  258. package/dist/register-JBOEHTVX.js +32 -0
  259. package/dist/registry-5DYHQFJS.js +9 -0
  260. package/dist/registry-EANV44W2.js +9 -0
  261. package/dist/registry-J25H6VB4.js +19 -0
  262. package/dist/registry-R23SQUQH.js +18 -0
  263. package/dist/request-withdrawal-KQ4W4UT5.js +31 -0
  264. package/dist/{reveal-BW36KCOQ.js → reveal-W7BKZSUP.js} +6 -6
  265. package/dist/revoke-H3VSTAIE.js +24 -0
  266. package/dist/satellites/index.js +1 -1
  267. package/dist/schema-update/index.js +2 -2
  268. package/dist/sealed-record/index.js +20 -13
  269. package/dist/sealed-record/index.js.map +1 -1
  270. package/dist/search/index.js +4 -4
  271. package/dist/{seed-GDV5PT4R.js → seed-55FPOMYP.js} +20 -22
  272. package/dist/seed-55FPOMYP.js.map +1 -0
  273. package/dist/sequence/index.js +9 -9
  274. package/dist/session/index.js +10 -10
  275. package/dist/shadow/index.js +2 -2
  276. package/dist/share-link/index.js +1 -1
  277. package/dist/signer-53AQ3BU2.js +25 -0
  278. package/dist/snapshots/index.js +10 -10
  279. package/dist/snapshots/index.js.map +1 -1
  280. package/dist/{stale-ARHFVL5U.js → stale-TH7SSVRV.js} +10 -10
  281. package/dist/storage-WSF7ZKTL.js +23 -0
  282. package/dist/{store-coordination-provider-GFCUOBR6.js → store-coordination-provider-R27VRD6K.js} +18 -12
  283. package/dist/store-coordination-provider-R27VRD6K.js.map +1 -0
  284. package/dist/sync/index.js +11 -11
  285. package/dist/team/index.js +15 -14
  286. package/dist/tiers/index.js +11 -10
  287. package/dist/to/index.js +17 -9
  288. package/dist/to/index.js.map +1 -1
  289. package/dist/transactions/index.js +4 -4
  290. package/dist/{ulid-PTAIMDG4.js → ulid-VQW6ERQN.js} +2 -2
  291. package/dist/util/index.js +1 -1
  292. package/dist/vault-head/index.js +115 -0
  293. package/dist/vault-head/index.js.map +1 -0
  294. package/dist/{verify-RO5RTZOJ.js → verify-M5LQH43C.js} +5 -5
  295. package/dist/via/blob/index.d.ts +3 -0
  296. package/dist/via/lookup/handle.d.ts +4 -1
  297. package/dist/walk-NABCHDZN.js +21 -0
  298. package/dist/with-audit/periods/periods.d.ts +1 -1
  299. package/dist/with-audit/periods/strategy.d.ts +1 -1
  300. package/dist/with-audit/sealed-record/index.d.ts +13 -0
  301. package/dist/with-audit/tiers/index.d.ts +17 -2
  302. package/dist/with-cargo/adopt-partition.d.ts +1 -1
  303. package/dist/with-cargo/extract-partition.d.ts +1 -1
  304. package/dist/with-cargo/index.d.ts +1 -1
  305. package/dist/with-commit/history/history.d.ts +26 -0
  306. package/dist/with-commit/history/index.d.ts +2 -1
  307. package/dist/with-commit/history/ledger/store.d.ts +7 -1
  308. package/dist/with-commit/history/strategy.d.ts +11 -1
  309. package/dist/with-commit/numbering/index.d.ts +0 -5
  310. package/dist/with-commit/vault-head/active.d.ts +2 -0
  311. package/dist/with-commit/vault-head/head.d.ts +28 -0
  312. package/dist/with-commit/vault-head/index.d.ts +10 -0
  313. package/dist/with-commit/vault-head/strategy.d.ts +127 -0
  314. package/dist/with-commit/vault-head/verify.d.ts +90 -0
  315. package/dist/with-formula/materialized-views/dependency-analyzer.d.ts +4 -0
  316. package/dist/with-formula/materialized-views/projection-legs.d.ts +59 -0
  317. package/dist/with-formula/materialized-views/registry.d.ts +50 -0
  318. package/dist/with-formula/materialized-views/types.d.ts +68 -10
  319. package/dist/with-party/directory/cover/storage.d.ts +0 -8
  320. package/dist/with-party/directory/storage.d.ts +0 -11
  321. package/dist/with-party/directory/visibility.d.ts +0 -21
  322. package/dist/with-party/policy/storage.d.ts +0 -10
  323. package/dist/with-party/team/index.d.ts +1 -1
  324. package/dist/with-party/team/keyring.d.ts +139 -2
  325. package/dist/with-party/team/noydb-facade.d.ts +5 -1
  326. package/dist/with-party/team/roster-tag.d.ts +101 -0
  327. package/dist/with-party/team/tiers.d.ts +2 -1
  328. package/dist/with-pod/format.d.ts +10 -12
  329. package/dist/with-pod/index.d.ts +10 -10
  330. package/dist/with-pod/open.d.ts +2 -2
  331. package/dist/with-pod/pod-handle.d.ts +19 -0
  332. package/dist/with-pod/pod-store.d.ts +0 -8
  333. package/dist/with-pod/{bundle.d.ts → pod.d.ts} +11 -19
  334. package/dist/with-pod/ulid.d.ts +1 -1
  335. package/dist/with-shape/blobs/blob-compaction.d.ts +13 -0
  336. package/dist/with-shape/blobs/blob-set.d.ts +83 -11
  337. package/dist/with-shape/blobs/orphan-report.d.ts +62 -0
  338. package/dist/with-sync/engine.d.ts +54 -5
  339. package/dist/with-sync/strategy.d.ts +3 -0
  340. package/dist/withdraw-accessible-VCINIG6V.js +28 -0
  341. package/package.json +10 -4
  342. package/dist/api-RXUMEKT3.js +0 -20
  343. package/dist/backup-KULFZ2T4.js.map +0 -1
  344. package/dist/bundle-handle-GFNHT52M.js +0 -36
  345. package/dist/bundle-handle-GFNHT52M.js.map +0 -1
  346. package/dist/chunk-2DHSSLOD.js.map +0 -1
  347. package/dist/chunk-2GAJGUNM.js.map +0 -1
  348. package/dist/chunk-3737A6EA.js.map +0 -1
  349. package/dist/chunk-3IXIU6FP.js.map +0 -1
  350. package/dist/chunk-3URQC7EH.js.map +0 -1
  351. package/dist/chunk-4GZ6XOVW.js.map +0 -1
  352. package/dist/chunk-4I72F5DF.js.map +0 -1
  353. package/dist/chunk-4VUPLMZ6.js.map +0 -1
  354. package/dist/chunk-52JPHN5N.js.map +0 -1
  355. package/dist/chunk-55LKVALY.js.map +0 -1
  356. package/dist/chunk-5JY5TSVY.js.map +0 -1
  357. package/dist/chunk-5ZKS6ZE2.js.map +0 -1
  358. package/dist/chunk-6BU3L4UE.js.map +0 -1
  359. package/dist/chunk-6NVPFKN3.js.map +0 -1
  360. package/dist/chunk-7F4DBNSP.js.map +0 -1
  361. package/dist/chunk-7G6VDWXB.js.map +0 -1
  362. package/dist/chunk-7H73RIE3.js +0 -45
  363. package/dist/chunk-7H73RIE3.js.map +0 -1
  364. package/dist/chunk-7MNBICB5.js.map +0 -1
  365. package/dist/chunk-AFHQATY4.js +0 -47
  366. package/dist/chunk-AFHQATY4.js.map +0 -1
  367. package/dist/chunk-AHLJSVRL.js.map +0 -1
  368. package/dist/chunk-BEFVYAR5.js.map +0 -1
  369. package/dist/chunk-BRVW2GS5.js.map +0 -1
  370. package/dist/chunk-BWVKEOPE.js.map +0 -1
  371. package/dist/chunk-CDB2HVQW.js.map +0 -1
  372. package/dist/chunk-CEJWMBXO.js.map +0 -1
  373. package/dist/chunk-E6427JU2.js.map +0 -1
  374. package/dist/chunk-FFDNKRCY.js.map +0 -1
  375. package/dist/chunk-FZ6NYJ7L.js.map +0 -1
  376. package/dist/chunk-G6S5VVHP.js.map +0 -1
  377. package/dist/chunk-GAG7QOVO.js.map +0 -1
  378. package/dist/chunk-HNGSV2YC.js.map +0 -1
  379. package/dist/chunk-IGJCYUT5.js.map +0 -1
  380. package/dist/chunk-JJNOLSG5.js.map +0 -1
  381. package/dist/chunk-JRKZTEZZ.js.map +0 -1
  382. package/dist/chunk-NPP5R7FF.js.map +0 -1
  383. package/dist/chunk-O2ERS4UJ.js.map +0 -1
  384. package/dist/chunk-PDLLCOGD.js.map +0 -1
  385. package/dist/chunk-PL2GHSCM.js.map +0 -1
  386. package/dist/chunk-PNKHAKQ7.js.map +0 -1
  387. package/dist/chunk-Q6TEJXBX.js.map +0 -1
  388. package/dist/chunk-RV3ARMPN.js.map +0 -1
  389. package/dist/chunk-UHXCLPGC.js.map +0 -1
  390. package/dist/chunk-VCETL77O.js.map +0 -1
  391. package/dist/chunk-VZ3XFUQ7.js.map +0 -1
  392. package/dist/chunk-W77KZHCW.js.map +0 -1
  393. package/dist/chunk-WASHZV34.js.map +0 -1
  394. package/dist/chunk-WFUIE565.js.map +0 -1
  395. package/dist/chunk-XWX7GL56.js.map +0 -1
  396. package/dist/chunk-YPYHVOXP.js.map +0 -1
  397. package/dist/chunk-ZJADGNYF.js.map +0 -1
  398. package/dist/collection-facade-QEJIM6BC.js +0 -45
  399. package/dist/delegation-MO7YZYJS.js.map +0 -1
  400. package/dist/derive-IUA6JFLB.js +0 -22
  401. package/dist/dispatch-FZEAWKVM.js.map +0 -1
  402. package/dist/executor-CYJQLKKI.js +0 -9
  403. package/dist/executor-S4QIKEHW.js +0 -9
  404. package/dist/executor-YIQB2S6N.js +0 -29
  405. package/dist/export-accessible-4S36PQNR.js +0 -23
  406. package/dist/extract-partition-IO7FDZ2P.js +0 -38
  407. package/dist/fanout-sidecar-NNAJQXMX.js.map +0 -1
  408. package/dist/find-RBBYKXI7.js +0 -11
  409. package/dist/issue-RIVHSY2S.js +0 -19
  410. package/dist/liberate-GFN4C7RR.js +0 -24
  411. package/dist/noydb-ASEXNJS6.js +0 -83
  412. package/dist/register-4EFJCVYD.js +0 -32
  413. package/dist/registry-4SDHHOJ7.js +0 -18
  414. package/dist/registry-CZVINVQH.js +0 -9
  415. package/dist/registry-IKUR2MXD.js +0 -9
  416. package/dist/registry-OYTFGWVK.js +0 -19
  417. package/dist/request-withdrawal-KGXGDPVQ.js +0 -31
  418. package/dist/revoke-JFN773KF.js +0 -24
  419. package/dist/seed-GDV5PT4R.js.map +0 -1
  420. package/dist/signer-TA55QB6R.js +0 -25
  421. package/dist/storage-V7MTFAQJ.js +0 -23
  422. package/dist/store-coordination-provider-GFCUOBR6.js.map +0 -1
  423. package/dist/walk-3ZECBFDA.js +0 -21
  424. package/dist/with-pod/bundle-handle.d.ts +0 -9
  425. package/dist/withdraw-accessible-7PG4DYQK.js +0 -28
  426. /package/dist/{api-RXUMEKT3.js.map → api-6X2VLZ7J.js.map} +0 -0
  427. /package/dist/{chunk-KUDZVJKQ.js.map → chunk-22GR3O4J.js.map} +0 -0
  428. /package/dist/{chunk-CCZJJ4I2.js.map → chunk-2CBFYXJX.js.map} +0 -0
  429. /package/dist/{chunk-FAXZQ5UF.js.map → chunk-323MN67Z.js.map} +0 -0
  430. /package/dist/{chunk-VMCCGUQB.js.map → chunk-36CEG6CM.js.map} +0 -0
  431. /package/dist/{chunk-747LRSOO.js.map → chunk-4K6BIMLF.js.map} +0 -0
  432. /package/dist/{chunk-FNSMZQS4.js.map → chunk-5IHGJHWC.js.map} +0 -0
  433. /package/dist/{chunk-HPLWFNG4.js.map → chunk-5O5ZSW7N.js.map} +0 -0
  434. /package/dist/{chunk-7TSYBD3E.js.map → chunk-65JXA63J.js.map} +0 -0
  435. /package/dist/{chunk-Z45YRGFO.js.map → chunk-6NR36UNB.js.map} +0 -0
  436. /package/dist/{chunk-3JVXVJ7L.js.map → chunk-7OBIBPCV.js.map} +0 -0
  437. /package/dist/{chunk-AR2JDFAE.js.map → chunk-7Q3RHOA5.js.map} +0 -0
  438. /package/dist/{chunk-QULVCV3M.js.map → chunk-AJGGBXWA.js.map} +0 -0
  439. /package/dist/{chunk-CADUYBQD.js.map → chunk-ATL3ZVXT.js.map} +0 -0
  440. /package/dist/{chunk-DMQCLZ4Z.js.map → chunk-ATY3ZASK.js.map} +0 -0
  441. /package/dist/{chunk-4HDYQL3J.js.map → chunk-B4CRUZPR.js.map} +0 -0
  442. /package/dist/{chunk-6SAFL5YE.js.map → chunk-BZ3WMOYX.js.map} +0 -0
  443. /package/dist/{chunk-HXGUIPQB.js.map → chunk-CKKN25P2.js.map} +0 -0
  444. /package/dist/{chunk-6HFM7EIT.js.map → chunk-EHRIDNZX.js.map} +0 -0
  445. /package/dist/{chunk-RTAMLDWP.js.map → chunk-FU5VYEYK.js.map} +0 -0
  446. /package/dist/{chunk-RXYYFSBB.js.map → chunk-GKTW3KLV.js.map} +0 -0
  447. /package/dist/{chunk-OF3L2SD6.js.map → chunk-HOPNIR5R.js.map} +0 -0
  448. /package/dist/{chunk-ADW22QSB.js.map → chunk-HWI7GHJZ.js.map} +0 -0
  449. /package/dist/{chunk-GQ3BX5EA.js.map → chunk-I3ISCYT7.js.map} +0 -0
  450. /package/dist/{chunk-NJDQ4YSV.js.map → chunk-IWQPYT6S.js.map} +0 -0
  451. /package/dist/{chunk-2Z3NCLNX.js.map → chunk-JHYKSMVX.js.map} +0 -0
  452. /package/dist/{chunk-6FJWSWFT.js.map → chunk-JIHWBKMQ.js.map} +0 -0
  453. /package/dist/{chunk-YAWK6AWF.js.map → chunk-JKATP6OE.js.map} +0 -0
  454. /package/dist/{chunk-DG27IUVI.js.map → chunk-LC6NE4IQ.js.map} +0 -0
  455. /package/dist/{chunk-VJFMXYKP.js.map → chunk-MPKP6L5E.js.map} +0 -0
  456. /package/dist/{chunk-FUHKW252.js.map → chunk-OCJ3JA4O.js.map} +0 -0
  457. /package/dist/{chunk-WLYIROCJ.js.map → chunk-OQMCFHUX.js.map} +0 -0
  458. /package/dist/{chunk-JRCYZEHU.js.map → chunk-OR2FYRYR.js.map} +0 -0
  459. /package/dist/{chunk-HNHCQ556.js.map → chunk-PFWE7FJG.js.map} +0 -0
  460. /package/dist/{chunk-U5O6GIWZ.js.map → chunk-POFYIGQ2.js.map} +0 -0
  461. /package/dist/{chunk-35EBKWQU.js.map → chunk-QH47SQLD.js.map} +0 -0
  462. /package/dist/{chunk-HVQGCKY4.js.map → chunk-QVXZFJBU.js.map} +0 -0
  463. /package/dist/{chunk-FMQJZH4R.js.map → chunk-RDB66EKD.js.map} +0 -0
  464. /package/dist/{chunk-X56RTUK3.js.map → chunk-RJZQ2PVD.js.map} +0 -0
  465. /package/dist/{chunk-SUFG5E73.js.map → chunk-RPRASGEY.js.map} +0 -0
  466. /package/dist/{chunk-JIUVJ4M7.js.map → chunk-S7PM7Z4K.js.map} +0 -0
  467. /package/dist/{chunk-N35NC4JH.js.map → chunk-TKBB62DN.js.map} +0 -0
  468. /package/dist/{chunk-4UVDI4XE.js.map → chunk-WPZ5FVAS.js.map} +0 -0
  469. /package/dist/{chunk-MSWYQLMQ.js.map → chunk-XINT4VJA.js.map} +0 -0
  470. /package/dist/{chunk-W3TVWF6N.js.map → chunk-YCGLAANM.js.map} +0 -0
  471. /package/dist/{chunk-FDX7OWWI.js.map → chunk-YYV53EHO.js.map} +0 -0
  472. /package/dist/{classified-marker-2KJAXRRO.js.map → classified-marker-AZDSDG6V.js.map} +0 -0
  473. /package/dist/{collection-facade-QEJIM6BC.js.map → collection-facade-WSUAYFJ4.js.map} +0 -0
  474. /package/dist/{computed-6G5M3UPH.js.map → computed-VG2PCM4L.js.map} +0 -0
  475. /package/dist/{dead-filter-DCB62VWW.js.map → dead-filter-JNQNB3TA.js.map} +0 -0
  476. /package/dist/{derive-IUA6JFLB.js.map → derive-MPOGZ4NR.js.map} +0 -0
  477. /package/dist/{dispatch-MJ6SHB3Y.js.map → dispatch-3ZA733EY.js.map} +0 -0
  478. /package/dist/{enclave-JU4YIEPB.js.map → enclave-Y2ALNDRD.js.map} +0 -0
  479. /package/dist/{executor-CYJQLKKI.js.map → executor-BBEEUFO3.js.map} +0 -0
  480. /package/dist/{executor-S4QIKEHW.js.map → executor-G6G3YEWR.js.map} +0 -0
  481. /package/dist/{executor-YIQB2S6N.js.map → executor-ZUTUMTPA.js.map} +0 -0
  482. /package/dist/{export-accessible-4S36PQNR.js.map → export-accessible-S3KEB763.js.map} +0 -0
  483. /package/dist/{extract-partition-IO7FDZ2P.js.map → extract-partition-KVCTSUVE.js.map} +0 -0
  484. /package/dist/{find-RBBYKXI7.js.map → find-V4FN5ITT.js.map} +0 -0
  485. /package/dist/{issue-RIVHSY2S.js.map → issue-5CFBWBRX.js.map} +0 -0
  486. /package/dist/{ledger-AETNF4OM.js.map → ledger-MQIIOTZB.js.map} +0 -0
  487. /package/dist/{liberate-GFN4C7RR.js.map → liberate-LW7OKVBH.js.map} +0 -0
  488. /package/dist/{link-set-E5HNY67I.js.map → link-set-5PJBBR63.js.map} +0 -0
  489. /package/dist/{managed-secret-CWQ6PND5.js.map → managed-secret-ETDG6AAE.js.map} +0 -0
  490. /package/dist/{noydb-ASEXNJS6.js.map → noydb-LFDRMYZ5.js.map} +0 -0
  491. /package/dist/{post-register-2XSSMGEQ.js.map → post-register-QCJYRMIK.js.map} +0 -0
  492. /package/dist/{register-4EFJCVYD.js.map → register-JBOEHTVX.js.map} +0 -0
  493. /package/dist/{registry-4SDHHOJ7.js.map → registry-5DYHQFJS.js.map} +0 -0
  494. /package/dist/{registry-CZVINVQH.js.map → registry-EANV44W2.js.map} +0 -0
  495. /package/dist/{registry-IKUR2MXD.js.map → registry-J25H6VB4.js.map} +0 -0
  496. /package/dist/{registry-OYTFGWVK.js.map → registry-R23SQUQH.js.map} +0 -0
  497. /package/dist/{request-withdrawal-KGXGDPVQ.js.map → request-withdrawal-KQ4W4UT5.js.map} +0 -0
  498. /package/dist/{reveal-BW36KCOQ.js.map → reveal-W7BKZSUP.js.map} +0 -0
  499. /package/dist/{revoke-JFN773KF.js.map → revoke-H3VSTAIE.js.map} +0 -0
  500. /package/dist/{signer-TA55QB6R.js.map → signer-53AQ3BU2.js.map} +0 -0
  501. /package/dist/{stale-ARHFVL5U.js.map → stale-TH7SSVRV.js.map} +0 -0
  502. /package/dist/{storage-V7MTFAQJ.js.map → storage-WSF7ZKTL.js.map} +0 -0
  503. /package/dist/{ulid-PTAIMDG4.js.map → ulid-VQW6ERQN.js.map} +0 -0
  504. /package/dist/{verify-RO5RTZOJ.js.map → verify-M5LQH43C.js.map} +0 -0
  505. /package/dist/{walk-3ZECBFDA.js.map → walk-NABCHDZN.js.map} +0 -0
  506. /package/dist/{withdraw-accessible-7PG4DYQK.js.map → withdraw-accessible-VCINIG6V.js.map} +0 -0
@@ -1,75 +1,84 @@
1
+ import {
2
+ LinkIntegrityError,
3
+ declareLink,
4
+ isLinkCollectionName,
5
+ linkCollectionName,
6
+ linkRowKey
7
+ } from "./chunk-PFWE7FJG.js";
1
8
  import {
2
9
  hashFields,
3
10
  validateSatelliteDeclaration
4
- } from "./chunk-HVQGCKY4.js";
11
+ } from "./chunk-QVXZFJBU.js";
5
12
  import {
6
13
  resolveStaleOnRead
7
- } from "./chunk-4HDYQL3J.js";
14
+ } from "./chunk-B4CRUZPR.js";
8
15
  import {
9
16
  isManifestReservedCollection
10
17
  } from "./chunk-EPFF7LOX.js";
11
18
  import {
12
- LinkIntegrityError,
13
- declareLink,
14
- isLinkCollectionName,
15
- linkCollectionName,
16
- linkRowKey
17
- } from "./chunk-HNHCQ556.js";
19
+ VectorSet,
20
+ buildPersistedIndexCallbacks,
21
+ encodeVecId,
22
+ syncTierSearch
23
+ } from "./chunk-M7WBE3OR.js";
18
24
  import {
19
25
  isBaseLive,
20
26
  liveBaseIdSet
21
27
  } from "./chunk-GYGLAVCX.js";
22
28
  import {
23
29
  loadFence
24
- } from "./chunk-6BU3L4UE.js";
30
+ } from "./chunk-DNKVKO7K.js";
25
31
  import {
26
- VectorSet,
27
- buildPersistedIndexCallbacks,
28
- encodeVecId,
29
- syncTierSearch
30
- } from "./chunk-G6S5VVHP.js";
32
+ fallbackDerivationName,
33
+ jsonSchemaToFields
34
+ } from "./chunk-KHKKD62N.js";
35
+ import {
36
+ derivePersistedSchema,
37
+ isZod4Schema
38
+ } from "./chunk-6NR36UNB.js";
31
39
  import {
32
40
  SchemaUpdateGate
33
41
  } from "./chunk-6LJY7X5A.js";
42
+ import {
43
+ NO_ATTESTATION
44
+ } from "./chunk-MPKP6L5E.js";
34
45
  import {
35
46
  NO_CLASSIFIED,
36
47
  guardClassifiedCompat,
37
48
  resolveClassifiedFields
38
- } from "./chunk-QULVCV3M.js";
49
+ } from "./chunk-AJGGBXWA.js";
39
50
  import {
40
51
  NO_TIERS,
41
52
  classifySealedShred,
42
53
  syncDerivedOutputs
43
- } from "./chunk-6NVPFKN3.js";
54
+ } from "./chunk-ZIMQDXTQ.js";
44
55
  import {
45
56
  NO_PORTABILITY
46
- } from "./chunk-FUHKW252.js";
57
+ } from "./chunk-OCJ3JA4O.js";
47
58
  import {
48
59
  NO_CARGO,
49
60
  runDrainBarrier
50
- } from "./chunk-DG27IUVI.js";
61
+ } from "./chunk-LC6NE4IQ.js";
51
62
  import {
52
63
  saveSealedSecret
53
- } from "./chunk-XWX7GL56.js";
54
- import {
55
- fallbackDerivationName,
56
- jsonSchemaToFields
57
- } from "./chunk-KHKKD62N.js";
58
- import {
59
- derivePersistedSchema,
60
- isZod4Schema
61
- } from "./chunk-Z45YRGFO.js";
64
+ } from "./chunk-S2I5MYSA.js";
62
65
  import {
63
66
  loadPersistedSchema
64
- } from "./chunk-CDB2HVQW.js";
67
+ } from "./chunk-KM6ZXG7U.js";
68
+ import {
69
+ NO_SEQUENCE,
70
+ SEQUENCE_COLLECTION,
71
+ compileSequenceFormat,
72
+ resolveSequenceKey
73
+ } from "./chunk-W3HAIN6U.js";
65
74
  import {
66
75
  CustodyApi,
67
76
  NO_CUSTODY
68
- } from "./chunk-ADW22QSB.js";
77
+ } from "./chunk-HWI7GHJZ.js";
69
78
  import {
70
79
  DEFAULT_POSTURE,
71
80
  ViaGraph
72
- } from "./chunk-7TSYBD3E.js";
81
+ } from "./chunk-65JXA63J.js";
73
82
  import {
74
83
  buildLookupAltIndex,
75
84
  buildLookupSnapshotRows,
@@ -93,17 +102,14 @@ import {
93
102
  selfWriteFieldEqual,
94
103
  touchFor,
95
104
  updateReferencingRecords
96
- } from "./chunk-5ZKS6ZE2.js";
105
+ } from "./chunk-K6CPIK3R.js";
97
106
  import {
98
107
  OverlayedCollection
99
- } from "./chunk-OF3L2SD6.js";
108
+ } from "./chunk-HOPNIR5R.js";
100
109
  import {
101
110
  INDEXED_STORE_POLICY,
102
111
  NO_SYNC
103
- } from "./chunk-55LKVALY.js";
104
- import {
105
- NO_ATTESTATION
106
- } from "./chunk-VJFMXYKP.js";
112
+ } from "./chunk-T7IR4N2S.js";
107
113
  import {
108
114
  NO_CONSENT
109
115
  } from "./chunk-PEOZ34EM.js";
@@ -114,7 +120,7 @@ import {
114
120
  resolvePeriodKey,
115
121
  resolveReopenState,
116
122
  samePartition
117
- } from "./chunk-5O5HRRTV.js";
123
+ } from "./chunk-5ATC6UT4.js";
118
124
  import {
119
125
  PERIODS_COLLECTION,
120
126
  PERIOD_ARCHIVES_COLLECTION,
@@ -122,7 +128,7 @@ import {
122
128
  PERIOD_REOPENS_COLLECTION,
123
129
  PERIOD_TARGET_PURGES_COLLECTION,
124
130
  periodExclusiveUpperBound
125
- } from "./chunk-HPLWFNG4.js";
131
+ } from "./chunk-5O5ZSW7N.js";
126
132
  import {
127
133
  NO_SHADOW
128
134
  } from "./chunk-SMY5X46Z.js";
@@ -132,7 +138,7 @@ import {
132
138
  import {
133
139
  TxContext,
134
140
  bestEffortRevert
135
- } from "./chunk-35EBKWQU.js";
141
+ } from "./chunk-QH47SQLD.js";
136
142
  import {
137
143
  lazy
138
144
  } from "./chunk-5D2ALSM5.js";
@@ -140,32 +146,29 @@ import {
140
146
  InvertedIndex,
141
147
  MemoryIndexStore,
142
148
  NO_SEARCH
143
- } from "./chunk-3JVXVJ7L.js";
149
+ } from "./chunk-7OBIBPCV.js";
144
150
  import {
145
- NO_SEQUENCE,
146
- SEQUENCE_COLLECTION,
147
- compileSequenceFormat,
148
- resolveSequenceKey
149
- } from "./chunk-7MNBICB5.js";
151
+ NO_SEALED_RECORD
152
+ } from "./chunk-323MN67Z.js";
150
153
  import {
151
154
  Query,
152
155
  ScanBuilder
153
- } from "./chunk-3737A6EA.js";
156
+ } from "./chunk-EHW7NLGD.js";
154
157
  import {
155
158
  EXPORT_AUDIT_COLLECTION,
156
159
  NO_BLOBS,
157
160
  createExportBlobsHandle,
158
161
  runCompaction
159
- } from "./chunk-WASHZV34.js";
162
+ } from "./chunk-LIR2DJWP.js";
160
163
  import {
161
164
  LazyQuery,
162
165
  NO_INDEXING,
163
166
  decodeIdxId,
164
167
  encodeIdxId
165
- } from "./chunk-JIUVJ4M7.js";
168
+ } from "./chunk-S7PM7Z4K.js";
166
169
  import {
167
170
  normalizeIndexDefs
168
- } from "./chunk-GQ3BX5EA.js";
171
+ } from "./chunk-I3ISCYT7.js";
169
172
  import {
170
173
  IMPLICIT_LAZY,
171
174
  Lru,
@@ -179,13 +182,13 @@ import {
179
182
  } from "./chunk-YMUFFJCO.js";
180
183
  import {
181
184
  readPath
182
- } from "./chunk-IGJCYUT5.js";
185
+ } from "./chunk-NSITFOCJ.js";
183
186
  import {
184
187
  NO_CRDT
185
188
  } from "./chunk-PVEWA2DU.js";
186
189
  import {
187
190
  dictCollectionName
188
- } from "./chunk-WFUIE565.js";
191
+ } from "./chunk-FNYCT27B.js";
189
192
  import {
190
193
  NO_I18N,
191
194
  getAtPath,
@@ -193,11 +196,11 @@ import {
193
196
  isDictKeyDescriptor,
194
197
  isI18nTextDescriptor,
195
198
  isStaticDictDescriptor
196
- } from "./chunk-7G6VDWXB.js";
199
+ } from "./chunk-XPEPMK4Y.js";
197
200
  import {
198
201
  isViaInstalled,
199
202
  viaBinder
200
- } from "./chunk-UHXCLPGC.js";
203
+ } from "./chunk-C3XWJCG7.js";
201
204
  import {
202
205
  NO_TEAM,
203
206
  describeAllUsersAuth,
@@ -220,7 +223,7 @@ import {
220
223
  saveShamirRecoveryEntries,
221
224
  updateAuthenticator,
222
225
  writeMagicLinkGrant
223
- } from "./chunk-O2ERS4UJ.js";
226
+ } from "./chunk-YTUFV7U7.js";
224
227
  import {
225
228
  assertKeyringOpenAllowed,
226
229
  buildRecipientKeyringFile,
@@ -235,32 +238,36 @@ import {
235
238
  listUsers,
236
239
  loadKeyring,
237
240
  updateKeyringIdentity
238
- } from "./chunk-JRKZTEZZ.js";
241
+ } from "./chunk-J6I5VR6P.js";
239
242
  import {
240
243
  persistDirectoryConfig,
241
244
  readDirectoryConfig
242
- } from "./chunk-5JY5TSVY.js";
245
+ } from "./chunk-ZJUZOJVW.js";
243
246
  import {
244
247
  NO_BROKER,
245
248
  buildCredentialBrokerHandle
246
- } from "./chunk-W3TVWF6N.js";
249
+ } from "./chunk-YCGLAANM.js";
247
250
  import {
248
251
  NO_SESSION
249
252
  } from "./chunk-VKQCVU2Z.js";
250
253
  import {
251
254
  generateULID
252
- } from "./chunk-ZJADGNYF.js";
255
+ } from "./chunk-4AOERLTV.js";
253
256
  import {
254
257
  NO_HISTORY
255
- } from "./chunk-AFHQATY4.js";
258
+ } from "./chunk-7ZGPQOFV.js";
259
+ import {
260
+ sha256Hex
261
+ } from "./chunk-BZ3WMOYX.js";
256
262
  import {
257
263
  assertCutoverTierSafe,
258
264
  assertTierWritable,
265
+ dekKey,
259
266
  liveRecordIsElevated
260
- } from "./chunk-3FSX6LDG.js";
267
+ } from "./chunk-D2YFQ7XG.js";
261
268
  import {
262
- sha256Hex
263
- } from "./chunk-6SAFL5YE.js";
269
+ NO_VAULT_HEAD
270
+ } from "./chunk-HK67PX4J.js";
264
271
  import {
265
272
  NO_FORGET,
266
273
  addSubjectRef,
@@ -269,34 +276,36 @@ import {
269
276
  readDottedPath,
270
277
  rebuildSubjectIndex,
271
278
  removeSubjectRef
272
- } from "./chunk-WLZ47GSL.js";
273
- import {
274
- NO_SEALED_RECORD
275
- } from "./chunk-FAXZQ5UF.js";
279
+ } from "./chunk-HSJBJIB2.js";
276
280
  import {
277
281
  RecordCodec,
278
282
  SEALED_CEK_NS,
283
+ applyRewrappedBody,
284
+ buildRecordAad,
279
285
  findByDet,
280
286
  hasPerRecordKey,
287
+ hasSealedBody,
281
288
  makeReservedEnvelopes,
282
289
  openEnvelopeJson,
283
290
  queryByDet,
284
291
  resolveStableCek,
285
- validateSchemaInput
286
- } from "./chunk-3URQC7EH.js";
292
+ rewrapBodyToDek,
293
+ validateSchemaInput,
294
+ verifyRecordIdentity
295
+ } from "./chunk-CXPOG3ZY.js";
287
296
  import {
288
297
  buildDeleteMarker,
298
+ buildRecordEnvelope,
289
299
  buildTombstone,
290
300
  isDeleteMarker,
291
301
  isTombstone
292
- } from "./chunk-7H73RIE3.js";
302
+ } from "./chunk-FX3UIDCS.js";
293
303
  import {
294
304
  encrypt
295
- } from "./chunk-VCETL77O.js";
305
+ } from "./chunk-ONPVHX2Y.js";
296
306
  import {
297
- NOYDB_FORMAT_VERSION,
298
307
  SealedHandle
299
- } from "./chunk-YPYHVOXP.js";
308
+ } from "./chunk-UJ4Z67UQ.js";
300
309
  import {
301
310
  AlreadyElevatedError,
302
311
  AttestationError,
@@ -339,7 +348,36 @@ import {
339
348
  UnsupportedTierCompositionError,
340
349
  ValidationError,
341
350
  isConflictError
342
- } from "./chunk-HNGSV2YC.js";
351
+ } from "./chunk-Z3BZXPRO.js";
352
+
353
+ // src/kernel/merge-authority.ts
354
+ function buildMergeAuthority(keyring) {
355
+ return {
356
+ verify: async (collection, id, envelope) => {
357
+ const dek = keyring.deks.get(dekKey(collection, envelope._tier ?? 0));
358
+ if (dek === void 0) return true;
359
+ return verifyRecordIdentity({ collection, id }, envelope, dek);
360
+ },
361
+ advance: async (collection, id, envelope, toVersion) => {
362
+ if (!hasSealedBody(envelope)) return { ...envelope, _v: toVersion };
363
+ const dek = keyring.deks.get(dekKey(collection, envelope._tier ?? 0));
364
+ if (dek === void 0) {
365
+ throw new ValidationError(
366
+ `sync: cannot advance "${collection}/${id}" past the remote \u2014 no key for it, so its body cannot be re-sealed at the new version. The local copy is unchanged.`
367
+ );
368
+ }
369
+ const from = {
370
+ collection,
371
+ id,
372
+ version: envelope._v,
373
+ ...envelope._tier !== void 0 ? { tier: envelope._tier } : {},
374
+ ...envelope._by !== void 0 ? { by: envelope._by } : {}
375
+ };
376
+ const body = await rewrapBodyToDek(from, { ...from, version: toVersion }, envelope, dek, dek);
377
+ return { ...applyRewrappedBody(envelope, body), _v: toVersion };
378
+ }
379
+ };
380
+ }
343
381
 
344
382
  // src/with-commit/tx/strategy.ts
345
383
  var NOT_ENABLED = new Error(
@@ -376,6 +414,7 @@ var STRATEGY_DEFAULTS = {
376
414
  custody: NO_CUSTODY,
377
415
  forget: NO_FORGET,
378
416
  history: NO_HISTORY,
417
+ vaultHead: NO_VAULT_HEAD,
379
418
  i18n: NO_I18N,
380
419
  indexing: NO_INDEXING,
381
420
  lazy: IMPLICIT_LAZY,
@@ -469,7 +508,7 @@ function validateSecretModeOptions(options) {
469
508
  }
470
509
  async function resolveEffectiveSecret(options, store, vault) {
471
510
  if (options.secretMode === "managed") {
472
- const { resolveManagedSecret } = await import("./managed-secret-CWQ6PND5.js");
511
+ const { resolveManagedSecret } = await import("./managed-secret-ETDG6AAE.js");
473
512
  return resolveManagedSecret(store, vault, options.sealingKey);
474
513
  }
475
514
  return options.secret;
@@ -487,7 +526,7 @@ function ownerKeyringOptions(options, secret) {
487
526
 
488
527
  // src/port/by/default-provider.ts
489
528
  async function createDefaultCoordinationProvider(store) {
490
- const { StoreCoordinationProvider } = await import("./store-coordination-provider-GFCUOBR6.js");
529
+ const { StoreCoordinationProvider } = await import("./store-coordination-provider-R27VRD6K.js");
491
530
  return new StoreCoordinationProvider(store);
492
531
  }
493
532
 
@@ -942,13 +981,13 @@ async function applyCutoverTransform(ctx) {
942
981
  for (const id of ids) {
943
982
  const env = await ctx.adapter.get(ctx.vault, ctx.name, id);
944
983
  if (!env || isTombstone(env, ctx.storeCiphertext) || isDeleteMarker(env)) continue;
945
- const decoded = await ctx.codec.decryptRecord(env, { skipValidation: true, id });
984
+ const decoded = await ctx.codec.decryptRecord({ collection: ctx.name, id }, env, { skipValidation: true });
946
985
  if (decoded === null) continue;
947
986
  const record = decoded;
948
987
  const next = ctx.transform(record);
949
988
  const nextVersion = (env._v ?? 0) + 1;
950
989
  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);
990
+ const migEnvelope = await ctx.codec.encryptRecord({ collection: ctx.name, id }, next, nextVersion, cek, void 0, void 0, ctx.vdigFields !== null ? { id, prev: env } : void 0);
952
991
  await ctx.adapter.put(ctx.vault, ctx.name, id, migEnvelope);
953
992
  await ctx.onRecordMutated(id, "put", "cutover");
954
993
  if (ctx.ledger) {
@@ -1054,7 +1093,7 @@ async function rebuildIndexes(ctx) {
1054
1093
  const envelope = await ctx.adapter.get(ctx.vault, ctx.name, recordId);
1055
1094
  if (!envelope) continue;
1056
1095
  if ((envelope._tier ?? 0) > 0) continue;
1057
- const record = await ctx.codec.decryptRecord(envelope, { skipValidation: true, id: recordId });
1096
+ const record = await ctx.codec.decryptRecord({ collection: ctx.name, id: recordId }, envelope, { skipValidation: true });
1058
1097
  if (record === null) continue;
1059
1098
  await maintainPersistedIndexesOnPut(ctx, recordId, record, null, envelope._v);
1060
1099
  }
@@ -1088,7 +1127,7 @@ async function reconcileIndex(ctx, field, opts = {}) {
1088
1127
  const env = await ctx.adapter.get(ctx.vault, ctx.name, id);
1089
1128
  if (!env) continue;
1090
1129
  try {
1091
- const sidecarJson = await ctx.codec.decryptJsonString(env);
1130
+ const sidecarJson = await ctx.codec.decryptJsonString({ collection: ctx.name, id }, env);
1092
1131
  if (sidecarJson === null) {
1093
1132
  sidecar.set(decoded.recordId, void 0);
1094
1133
  } else {
@@ -1108,7 +1147,7 @@ async function reconcileIndex(ctx, field, opts = {}) {
1108
1147
  const env = await ctx.adapter.get(ctx.vault, ctx.name, id);
1109
1148
  if (!env) continue;
1110
1149
  if ((env._tier ?? 0) > 0) continue;
1111
- const record = await ctx.codec.decryptRecord(env, { skipValidation: true, id });
1150
+ const record = await ctx.codec.decryptRecord({ collection: ctx.name, id }, env, { skipValidation: true });
1112
1151
  if (record === null) continue;
1113
1152
  const live = readPersistedValue(record, field);
1114
1153
  const stored = sidecar.get(id);
@@ -1169,7 +1208,7 @@ async function maintainPersistedIndexesOnPut(ctx, id, newRecord, previousRecord,
1169
1208
  recordId: id,
1170
1209
  writtenAt: (/* @__PURE__ */ new Date()).toISOString()
1171
1210
  });
1172
- const envelope = await ctx.codec.encryptJsonString(body, version);
1211
+ const envelope = await ctx.codec.encryptJsonString({ collection: ctx.name, id: idxId }, body, version);
1173
1212
  await ctx.adapter.put(ctx.vault, ctx.name, idxId, envelope);
1174
1213
  }
1175
1214
  } catch (cause) {
@@ -1238,7 +1277,7 @@ async function resolveTierSyncPrior(ctx, id, priorEnvelope) {
1238
1277
  const cached = ctx.cache.get(id)?.record;
1239
1278
  if (cached !== void 0) return cached;
1240
1279
  if (!ctx.lazy || !priorEnvelope || (priorEnvelope._tier ?? 0) > 0) return null;
1241
- return await ctx.codec.decryptRecord(priorEnvelope, { skipValidation: true, id });
1280
+ return await ctx.codec.decryptRecord({ collection: ctx.name, id }, priorEnvelope, { skipValidation: true });
1242
1281
  }
1243
1282
 
1244
1283
  // src/with-lookup/search/serialize.ts
@@ -2421,7 +2460,7 @@ function resolveCollectionConfig(opts) {
2421
2460
  }
2422
2461
 
2423
2462
  // src/with-formula/computed/lazy.ts
2424
- var loadComputed = lazy(() => import("./computed-6G5M3UPH.js"));
2463
+ var loadComputed = lazy(() => import("./computed-VG2PCM4L.js"));
2425
2464
  async function loadEvalComputedFields() {
2426
2465
  return (await loadComputed()).evalComputedFields;
2427
2466
  }
@@ -2607,7 +2646,8 @@ var Collection = class {
2607
2646
  fieldMeta;
2608
2647
  /** Collection-level descriptive metadata declared via `meta`; read by `getMeta()`, surfaced in `describe()`. */
2609
2648
  meta;
2610
- /** Outbound ref declarations (snapshot from vault refRegistry at construction time); used by `describe()`. */
2649
+ /** Outbound ref declarations (snapshot from the vault refRegistry); read by `describe()` and
2650
+ * {@link _txAtomicSafe}. Mutable for {@link _attachDeclaredRefs} (#1141). */
2611
2651
  _refs;
2612
2652
  /** Money field descriptors keyed by field path, typed as the opaque {@link ViaDescriptor} marker
2613
2653
  * (the kernel never inspects the concrete shape); `put()` quantizes to a scaled-int string,
@@ -2877,14 +2917,14 @@ var Collection = class {
2877
2917
  if (crdtMode === "yjs") {
2878
2918
  return local._v >= remote._v ? local : remote;
2879
2919
  }
2880
- const localJson = await this.codec.decryptJsonString(local, id);
2881
- const remoteJson = await this.codec.decryptJsonString(remote, id);
2920
+ const localJson = await this.codec.decryptJsonString({ collection: this.name, id }, local);
2921
+ const remoteJson = await this.codec.decryptJsonString({ collection: this.name, id }, remote);
2882
2922
  if (localJson === null) return local;
2883
2923
  if (remoteJson === null) return remote;
2884
2924
  const merged = this.strategies.crdt.mergeCrdtStates(JSON.parse(localJson), JSON.parse(remoteJson));
2885
2925
  const mergedVersion = Math.max(local._v, remote._v) + 1;
2886
2926
  const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
2887
- return this.codec.encryptJsonString(JSON.stringify(merged), mergedVersion, cek);
2927
+ return this.codec.encryptJsonString({ collection: this.name, id }, JSON.stringify(merged), mergedVersion, cek);
2888
2928
  };
2889
2929
  opts.onRegisterConflictResolver(this.name, crdtResolver);
2890
2930
  }
@@ -2925,14 +2965,14 @@ var Collection = class {
2925
2965
  } else {
2926
2966
  const mergeFn = policy;
2927
2967
  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 });
2968
+ const localRecord = await this.codec.decryptRecord({ collection: this.name, id }, local, { skipValidation: true });
2969
+ const remoteRecord = await this.codec.decryptRecord({ collection: this.name, id }, remote, { skipValidation: true });
2930
2970
  if (localRecord === null) return local;
2931
2971
  if (remoteRecord === null) return remote;
2932
2972
  const merged = mergeFn(localRecord, remoteRecord);
2933
2973
  const mergedVersion = Math.max(local._v, remote._v) + 1;
2934
2974
  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);
2975
+ return this.codec.encryptRecord({ collection: this.name, id }, merged, mergedVersion, cek);
2936
2976
  };
2937
2977
  }
2938
2978
  opts.onRegisterConflictResolver(collectionName, resolver);
@@ -3203,7 +3243,7 @@ var Collection = class {
3203
3243
  }
3204
3244
  await this.onAccess?.("find", "*");
3205
3245
  if (hits.length === 0) return [];
3206
- const { verifyDigestField } = await import("./verify-RO5RTZOJ.js");
3246
+ const { verifyDigestField } = await import("./verify-M5LQH43C.js");
3207
3247
  const policy = {
3208
3248
  normalize: spec.verifyNormalize ?? "password",
3209
3249
  notLastN: spec.notLastN ?? 0,
@@ -3317,6 +3357,12 @@ var Collection = class {
3317
3357
  _applyMeta(meta) {
3318
3358
  if (this.meta === void 0) this.meta = meta;
3319
3359
  }
3360
+ /** @internal #1141 — refresh the ref snapshot after a late `refs` declaration. Overwrites rather
3361
+ * than first-wins, deliberately: the argument is the ref registry's own merged view (see
3362
+ * `reconcileViaAttach`), which `RefRegistry.register` has already refused to let conflict. */
3363
+ _attachDeclaredRefs(refs) {
3364
+ this._refs = refs;
3365
+ }
3320
3366
  /**
3321
3367
  * @internal — attach classified fields post-construction. See {@link _applyMoneyFields}.
3322
3368
  * First-wins. Note: unlike money/computed/meta, this cannot retro-seal a
@@ -3409,7 +3455,7 @@ var Collection = class {
3409
3455
  }
3410
3456
  }
3411
3457
  if (this.materializedViewSource !== void 0) {
3412
- const { resolveStaleMVOnRead } = await import("./stale-ARHFVL5U.js");
3458
+ const { resolveStaleMVOnRead } = await import("./stale-TH7SSVRV.js");
3413
3459
  await resolveStaleMVOnRead(this.materializedViewSource, this.name, this.#dispatchCtx({ collection: this.name, id: "resolve-on-read" }));
3414
3460
  }
3415
3461
  let record;
@@ -3421,7 +3467,7 @@ var Collection = class {
3421
3467
  const envelope = await this.adapter.get(this.vault, this.name, id);
3422
3468
  if (!envelope) return null;
3423
3469
  if (isTombstone(envelope, this.storeCiphertext) || isDeleteMarker(envelope) || (envelope._tier ?? 0) > 0) return null;
3424
- record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
3470
+ record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
3425
3471
  if (record === null) return null;
3426
3472
  this.lru.set(id, { record, version: envelope._v }, estimateRecordBytes(record));
3427
3473
  }
@@ -3448,7 +3494,7 @@ var Collection = class {
3448
3494
  }
3449
3495
  const envelope = await this.adapter.get(this.vault, this.name, id);
3450
3496
  if (!envelope || (envelope._tier ?? 0) > 0) return null;
3451
- const json = await this.codec.decryptJsonString(envelope);
3497
+ const json = await this.codec.decryptJsonString({ collection: this.name, id }, envelope);
3452
3498
  if (json === null) return null;
3453
3499
  return JSON.parse(json);
3454
3500
  }
@@ -3565,7 +3611,7 @@ var Collection = class {
3565
3611
  if (cached) return cached.record;
3566
3612
  const env = await this.adapter.get(this.vault, this.name, id);
3567
3613
  if (!env || (env._tier ?? 0) > 0) return void 0;
3568
- const rec = await this.codec.decryptRecord(env, { id });
3614
+ const rec = await this.codec.decryptRecord({ collection: this.name, id }, env, {});
3569
3615
  return rec === null ? void 0 : rec;
3570
3616
  }
3571
3617
  await this.ensureHydrated();
@@ -3613,7 +3659,7 @@ var Collection = class {
3613
3659
  if (cached2) return { record: cached2.record, version: cached2.version };
3614
3660
  const env = await this.adapter.get(this.vault, this.name, id);
3615
3661
  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 };
3662
+ return { record: await this.codec.decryptRecord({ collection: this.name, id }, env, { skipValidation: true }) ?? null, version: env._v };
3617
3663
  }
3618
3664
  await this.ensureHydrated();
3619
3665
  const cached = this.cache.get(id);
@@ -3635,7 +3681,7 @@ var Collection = class {
3635
3681
  if (this.sensitiveFields.size > 0 || this.via?.hasAtRestHooks === true) {
3636
3682
  const env = await this.adapter.get(this.vault, this.name, id);
3637
3683
  if (!env || isTombstone(env, this.storeCiphertext) || (env._tier ?? 0) > 0) return void 0;
3638
- const rec = await this.codec.decryptRecord(env, { skipValidation: true, id });
3684
+ const rec = await this.codec.decryptRecord({ collection: this.name, id }, env, { skipValidation: true });
3639
3685
  return rec === null ? void 0 : { record: rec, version: env._v };
3640
3686
  }
3641
3687
  const cached = this.cache.get(id);
@@ -3647,7 +3693,7 @@ var Collection = class {
3647
3693
  const env = await this.adapter.get(this.vault, this.name, id);
3648
3694
  if (!env) return { env: null, record: null, elided: false };
3649
3695
  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 };
3696
+ return { env, record: await this.codec.decryptRecord({ collection: this.name, id }, env, { skipValidation: true }), elided: false };
3651
3697
  }
3652
3698
  /**
3653
3699
  * Wraps {@link RecordCodec.toCacheRecord} with an additional strip for
@@ -3671,9 +3717,9 @@ var Collection = class {
3671
3717
  * payload that is not a CRDT state. The `lww-map` and `rga` branches each
3672
3718
  * carried a copy, byte-identical apart from the cast (#842).
3673
3719
  */
3674
- async #decodePriorCrdtState(envelope) {
3720
+ async #decodePriorCrdtState(id, envelope) {
3675
3721
  if (!envelope) return void 0;
3676
- const prevJson = await this.codec.decryptJsonString(envelope);
3722
+ const prevJson = await this.codec.decryptJsonString({ collection: this.name, id }, envelope);
3677
3723
  if (prevJson === null) return void 0;
3678
3724
  const prevParsed = JSON.parse(prevJson);
3679
3725
  if (prevParsed === null || typeof prevParsed !== "object" || !("_crdt" in prevParsed)) {
@@ -3710,7 +3756,8 @@ var Collection = class {
3710
3756
  this.vault,
3711
3757
  this.name,
3712
3758
  id,
3713
- await this.codec.encryptRecord(prior.record, prior.version, cek, void 0, void 0, vdigCtx, id)
3759
+ await this.codec.encryptRecord(this.strategies.history.historyIdentity(this.name, id, prior.version), prior.record, prior.version, cek, void 0, void 0, vdigCtx)
3760
+ // sealed against its _history STORAGE identity (#1041)
3714
3761
  );
3715
3762
  this.emitter.emit("history:save", { vault: this.vault, collection: this.name, id, version: prior.version });
3716
3763
  if (this.historyConfig.maxVersions) {
@@ -3820,20 +3867,20 @@ var Collection = class {
3820
3867
  const now = (/* @__PURE__ */ new Date()).toISOString();
3821
3868
  let crdtState;
3822
3869
  if (this.crdtMode === "lww-map") {
3823
- const existingState = await this.#decodePriorCrdtState(existingEnvelope);
3870
+ const existingState = await this.#decodePriorCrdtState(id, existingEnvelope);
3824
3871
  crdtState = this.strategies.crdt.buildLwwMapState(record, existingState, now);
3825
3872
  } else if (this.crdtMode === "rga") {
3826
- const existingState = await this.#decodePriorCrdtState(existingEnvelope);
3873
+ const existingState = await this.#decodePriorCrdtState(id, existingEnvelope);
3827
3874
  crdtState = this.strategies.crdt.buildRgaState(Array.isArray(record) ? record : [record], existingState, generateULID);
3828
3875
  } else {
3829
3876
  crdtState = { _crdt: "yjs", update: record };
3830
3877
  }
3831
3878
  const version = existingVersion + 1;
3832
3879
  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);
3880
+ const envelope = await this.codec.encryptJsonString({ collection: this.name, id }, JSON.stringify(crdtState), version, cek, options?.source, options?.sourceTs);
3834
3881
  await this.adapter.put(this.vault, this.name, id, envelope);
3835
3882
  const resolvedRecord = this.strategies.crdt.resolveCrdtSnapshot(crdtState);
3836
- const existingResolvedRecord = existingEnvelope ? await this.codec.decryptRecord(existingEnvelope, { skipValidation: true }) : null;
3883
+ const existingResolvedRecord = existingEnvelope ? await this.codec.decryptRecord({ collection: this.name, id }, existingEnvelope, { skipValidation: true }) : null;
3837
3884
  const existingResolved = existingResolvedRecord !== null ? { record: existingResolvedRecord, version: existingVersion } : void 0;
3838
3885
  if (existingResolved) {
3839
3886
  await this.#savePriorHistory(id, existingResolved, cek, this.vdigFields !== null ? { id, prev: existingEnvelope } : void 0);
@@ -3873,7 +3920,7 @@ var Collection = class {
3873
3920
  if (!existing) {
3874
3921
  priorRaw = await this.adapter.get(this.vault, this.name, id);
3875
3922
  if (priorRaw) {
3876
- const previousRecord = await this.codec.decryptRecord(priorRaw, { id });
3923
+ const previousRecord = await this.codec.decryptRecord({ collection: this.name, id }, priorRaw, {});
3877
3924
  if (previousRecord !== null) {
3878
3925
  existing = { record: previousRecord, version: priorRaw._v };
3879
3926
  }
@@ -3893,7 +3940,7 @@ var Collection = class {
3893
3940
  this.uniqueConstraints?.check(id, record);
3894
3941
  const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
3895
3942
  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);
3943
+ const envelope = await this.codec.encryptRecord({ collection: this.name, id }, record, version, cek, options?.source, options?.sourceTs, vdigCtx);
3897
3944
  return { id, envelope, version, indexed: record, event: record, prior: existing, cek, vdigCtx, reason: options?.reason };
3898
3945
  }
3899
3946
  /**
@@ -3939,7 +3986,7 @@ var Collection = class {
3939
3986
  */
3940
3987
  async dispatchMaterializedViews(id, record, wave) {
3941
3988
  if (this.materializedViewSource === void 0) return;
3942
- const { dispatchMaterializedViews } = await import("./dispatch-FZEAWKVM.js");
3989
+ const { dispatchMaterializedViews } = await import("./dispatch-TNM5CRLZ.js");
3943
3990
  return dispatchMaterializedViews(this.#mvDispatchCtx(this.materializedViewSource), id, record, wave);
3944
3991
  }
3945
3992
  /**
@@ -3967,7 +4014,7 @@ var Collection = class {
3967
4014
  const cached = this.lru.get(id);
3968
4015
  const env = await this.adapter.get(this.vault, this.name, id);
3969
4016
  if (!env || isTombstone(env, this.storeCiphertext) || isDeleteMarker(env)) return null;
3970
- raw = await this.codec.decryptRecord(env, { id });
4017
+ raw = await this.codec.decryptRecord({ collection: this.name, id }, env, {});
3971
4018
  if (raw === null) return null;
3972
4019
  if (!cached) {
3973
4020
  this.lru.set(id, { record: await this.codec.toCacheRecord(raw, env, id), version: env._v }, estimateRecordBytes(raw));
@@ -3978,7 +4025,7 @@ var Collection = class {
3978
4025
  else {
3979
4026
  const env = await this.adapter.get(this.vault, this.name, id);
3980
4027
  if (!env || isTombstone(env, this.storeCiphertext) || isDeleteMarker(env)) return null;
3981
- raw = await this.codec.decryptRecord(env, { id });
4028
+ raw = await this.codec.decryptRecord({ collection: this.name, id }, env, {});
3982
4029
  if (raw === null) return null;
3983
4030
  this.lru.set(id, { record: raw, version: env._v }, estimateRecordBytes(raw));
3984
4031
  }
@@ -3995,7 +4042,7 @@ var Collection = class {
3995
4042
  async _getStoredRecordForDispatch(id) {
3996
4043
  const env = await this.adapter.get(this.vault, this.name, id);
3997
4044
  if (!env || isTombstone(env, this.storeCiphertext) || isDeleteMarker(env)) return null;
3998
- const record = await this.codec.decryptRecord(env, { id });
4045
+ const record = await this.codec.decryptRecord({ collection: this.name, id }, env, {});
3999
4046
  return record === null ? null : { record, version: env._v };
4000
4047
  }
4001
4048
  /**
@@ -4112,7 +4159,7 @@ var Collection = class {
4112
4159
  * dispatch wave's per-target dedup; `undefined` on the local-write path (byte-identical). */
4113
4160
  async dispatchDerivations(id, record, version, wave) {
4114
4161
  if (this.derivationSource === void 0) return;
4115
- const { dispatchDerivations } = await import("./dispatch-MJ6SHB3Y.js");
4162
+ const { dispatchDerivations } = await import("./dispatch-3ZA733EY.js");
4116
4163
  return dispatchDerivations({
4117
4164
  ...this.#derivationDeleteCtx(this.derivationSource),
4118
4165
  via: this.via,
@@ -4295,7 +4342,7 @@ var Collection = class {
4295
4342
  if (!existing && this.historyConfig.enabled !== false) {
4296
4343
  const previousEnvelope2 = await this.adapter.get(this.vault, this.name, id);
4297
4344
  if (previousEnvelope2) {
4298
- const previousRecord = await this.codec.decryptRecord(previousEnvelope2, { id });
4345
+ const previousRecord = await this.codec.decryptRecord({ collection: this.name, id }, previousEnvelope2, {});
4299
4346
  if (previousRecord !== null) {
4300
4347
  existing = { record: previousRecord, version: previousEnvelope2._v };
4301
4348
  }
@@ -4310,7 +4357,7 @@ var Collection = class {
4310
4357
  if (this.onDirty) {
4311
4358
  const live = previousEnvelope;
4312
4359
  if (!live || isTombstone(live, this.storeCiphertext) || isDeleteMarker(live)) return null;
4313
- marker = buildDeleteMarker(live._v + 1, this.keyring.userId);
4360
+ marker = buildDeleteMarker({ collection: this.name, id }, live._v + 1, this.keyring.userId);
4314
4361
  }
4315
4362
  const snapshots = existing !== void 0 && this.historyConfig.enabled !== false;
4316
4363
  const cek = snapshots && this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
@@ -4332,7 +4379,7 @@ var Collection = class {
4332
4379
  async _commitDelete(prepared, persist = true) {
4333
4380
  const { id, internal, existing, previousPayloadHash, marker, cek, vdigCtx } = prepared;
4334
4381
  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));
4382
+ 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
4383
  }
4337
4384
  if (marker) {
4338
4385
  if (persist) await this.adapter.put(this.vault, this.name, id, marker);
@@ -4399,7 +4446,7 @@ var Collection = class {
4399
4446
  */
4400
4447
  async _decodeEnvelope(envelope, id) {
4401
4448
  try {
4402
- const rec = await this.codec.decryptRecord(envelope, { skipValidation: true, id });
4449
+ const rec = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { skipValidation: true });
4403
4450
  return rec === null ? null : rec;
4404
4451
  } catch {
4405
4452
  return null;
@@ -4408,7 +4455,7 @@ var Collection = class {
4408
4455
  async _writeTombstone(id, actor) {
4409
4456
  const live = await this.adapter.get(this.vault, this.name, id);
4410
4457
  if (!live || isTombstone(live, this.storeCiphertext) || isDeleteMarker(live)) return null;
4411
- await this.adapter.put(this.vault, this.name, id, buildTombstone(live._v, actor));
4458
+ await this.adapter.put(this.vault, this.name, id, buildTombstone({ collection: this.name, id }, live._v, actor));
4412
4459
  this.cache.delete(id);
4413
4460
  this.lru?.remove(id);
4414
4461
  this.cekCache?.remove(id);
@@ -4427,7 +4474,7 @@ var Collection = class {
4427
4474
  */
4428
4475
  async dispatchArrayDerivationsOnDelete(id, eraseRecordShapeToo = false) {
4429
4476
  if (this.derivationSource === void 0) return 0;
4430
- const { dispatchArrayDerivationsOnDelete } = await import("./dispatch-MJ6SHB3Y.js");
4477
+ const { dispatchArrayDerivationsOnDelete } = await import("./dispatch-3ZA733EY.js");
4431
4478
  return dispatchArrayDerivationsOnDelete(this.#derivationDeleteCtx(this.derivationSource), id, eraseRecordShapeToo);
4432
4479
  }
4433
4480
  /**
@@ -4441,7 +4488,7 @@ var Collection = class {
4441
4488
  */
4442
4489
  async dispatchMaterializedViewsOnDelete(id) {
4443
4490
  if (this.materializedViewSource === void 0) return { deleted: 0, residueUndecodable: [], residueDeclined: [] };
4444
- const { dispatchMaterializedViewsOnDelete } = await import("./dispatch-FZEAWKVM.js");
4491
+ const { dispatchMaterializedViewsOnDelete } = await import("./dispatch-TNM5CRLZ.js");
4445
4492
  return dispatchMaterializedViewsOnDelete(this.#mvDispatchCtx(this.materializedViewSource), id);
4446
4493
  }
4447
4494
  /**
@@ -4461,7 +4508,7 @@ var Collection = class {
4461
4508
  );
4462
4509
  }
4463
4510
  if (this.materializedViewSource !== void 0) {
4464
- const { resolveStaleMVOnRead } = await import("./stale-ARHFVL5U.js");
4511
+ const { resolveStaleMVOnRead } = await import("./stale-TH7SSVRV.js");
4465
4512
  await resolveStaleMVOnRead(this.materializedViewSource, this.name, this.#dispatchCtx({ collection: this.name, id: "resolve-on-read" }));
4466
4513
  }
4467
4514
  await this.ensureHydrated();
@@ -4795,7 +4842,7 @@ var Collection = class {
4795
4842
  const entries = [];
4796
4843
  for (const env of envelopes) {
4797
4844
  if ((env._tier ?? 0) > 0) continue;
4798
- const record = await this.codec.decryptRecord(env, { skipValidation: true, id });
4845
+ const record = await this.codec.decryptRecord(this.strategies.history.historyIdentity(this.name, id, env._v), env, { skipValidation: true });
4799
4846
  if (record === null) continue;
4800
4847
  entries.push({
4801
4848
  version: env._v,
@@ -4824,7 +4871,7 @@ var Collection = class {
4824
4871
  version
4825
4872
  );
4826
4873
  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 });
4874
+ return this.codec.decryptRecord(this.strategies.history.historyIdentity(this.name, id, envelope._v), envelope, { skipValidation: true });
4828
4875
  }
4829
4876
  /** Revert a record to a past version. Creates a new version with the old content. */
4830
4877
  async revert(id, version) {
@@ -4930,7 +4977,7 @@ var Collection = class {
4930
4977
  const id = ids[i];
4931
4978
  const envelope = await this.adapter.get(this.vault, this.name, id);
4932
4979
  if (envelope && (envelope._tier ?? 0) === 0) {
4933
- const record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
4980
+ const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
4934
4981
  if (record === null) continue;
4935
4982
  items.push(record);
4936
4983
  if (!this.lazy && !this.cache.has(id)) {
@@ -5012,7 +5059,7 @@ var Collection = class {
5012
5059
  const out = [];
5013
5060
  for (const { id, envelope } of items) {
5014
5061
  if ((envelope._tier ?? 0) > 0) continue;
5015
- const record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
5062
+ const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
5016
5063
  if (record === null) continue;
5017
5064
  out.push({ id, record, version: envelope._v });
5018
5065
  }
@@ -5073,7 +5120,7 @@ var Collection = class {
5073
5120
  }
5074
5121
  return;
5075
5122
  }
5076
- const record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
5123
+ const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
5077
5124
  if (record === null) {
5078
5125
  this.cache.delete(id);
5079
5126
  if (previous) {
@@ -5169,7 +5216,7 @@ var Collection = class {
5169
5216
  for (const id of ids) {
5170
5217
  const envelope = await this.adapter.get(this.vault, this.name, id);
5171
5218
  if (envelope && !isTombstone(envelope, this.storeCiphertext) && !isDeleteMarker(envelope) && (envelope._tier ?? 0) === 0) {
5172
- const record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
5219
+ const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
5173
5220
  if (record === null) continue;
5174
5221
  this.cache.set(id, { record, version: envelope._v });
5175
5222
  } else if (envelope && isDeleteMarker(envelope)) {
@@ -5188,7 +5235,7 @@ var Collection = class {
5188
5235
  continue;
5189
5236
  }
5190
5237
  if (isTombstone(envelope, this.storeCiphertext) || (envelope._tier ?? 0) > 0) continue;
5191
- const record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
5238
+ const record = await this.codec.decryptRecord({ collection: this.name, id }, envelope, { sealedAsHandles: true });
5192
5239
  if (record === null) continue;
5193
5240
  this.cache.set(id, { record, version: envelope._v });
5194
5241
  }
@@ -5322,7 +5369,7 @@ var Collection = class {
5322
5369
  for (const [id, entry] of this.cache) {
5323
5370
  const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
5324
5371
  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);
5372
+ 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
5373
  }
5327
5374
  return result;
5328
5375
  }
@@ -5437,7 +5484,7 @@ var Collection = class {
5437
5484
  const envelope = await this.adapter.get(this.vault, this.name, id);
5438
5485
  if (!envelope) continue;
5439
5486
  try {
5440
- const json = await this.codec.decryptJsonString(envelope);
5487
+ const json = await this.codec.decryptJsonString({ collection: this.name, id }, envelope);
5441
5488
  if (json === null) continue;
5442
5489
  const body = JSON.parse(json);
5443
5490
  if (typeof body.recordId !== "string") continue;
@@ -5571,14 +5618,14 @@ var Collection = class {
5571
5618
  /** C-A/R10: persist the classified marker once per classified handle (store I/O in config-drift.ts). */
5572
5619
  async _ensureClassifiedMarker() {
5573
5620
  if (this._markerPersisted || this.vdigFields === null) return;
5574
- const { persistClassifiedMarkerForFields } = await import("./classified-marker-2KJAXRRO.js");
5621
+ const { persistClassifiedMarkerForFields } = await import("./classified-marker-AZDSDG6V.js");
5575
5622
  await persistClassifiedMarkerForFields(this.adapter, this.vault, this.name, this.vdigFields, await this.getDEK(this.name));
5576
5623
  this._markerPersisted = true;
5577
5624
  }
5578
5625
  /** C-A/R10 drift signal — the marker's declared digest-only set, memoized to one store read per handle (see config-drift.ts). */
5579
5626
  async _classifiedMarkerDigestOnly() {
5580
5627
  if (this._markerDigestOnlyCache !== void 0) return this._markerDigestOnlyCache;
5581
- const { readClassifiedMarkerDigestOnly } = await import("./classified-marker-2KJAXRRO.js");
5628
+ const { readClassifiedMarkerDigestOnly } = await import("./classified-marker-AZDSDG6V.js");
5582
5629
  this._markerDigestOnlyCache = await readClassifiedMarkerDigestOnly(this.adapter, this.vault, this.name, await this.getDEK(this.name));
5583
5630
  return this._markerDigestOnlyCache;
5584
5631
  }
@@ -5700,10 +5747,10 @@ var Collection = class {
5700
5747
  if (busActive) await this.subsystemBus.dispatch(busPoint, event);
5701
5748
  }
5702
5749
  _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;
5750
+ 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
5751
  return opType === "put" ? Object.keys(this._refs).length === 0 : this.refEnforcer === void 0 || !this.refEnforcer._deleteCascadesPossible(this.name);
5705
5752
  }
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.
5753
+ // @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
5754
  _reconcileReadState(patch) {
5708
5755
  if (patch.dictKeyFields) this.dictKeyFields = { ...patch.dictKeyFields, ...this.dictKeyFields };
5709
5756
  if (patch.i18nFields) this.i18nFields = { ...patch.i18nFields, ...this.i18nFields };
@@ -5730,8 +5777,9 @@ var Collection = class {
5730
5777
  syncIndexes: (id, rec, version, priorEnvelope) => syncTierIndexes(this.indexingContext(), id, rec, version, priorEnvelope),
5731
5778
  syncSearch: (id, rec, version) => syncTierSearch(this.searchContext(), id, rec, version),
5732
5779
  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) => {
5780
+ saveHistorySnapshot: async (id, version, seal) => {
5734
5781
  if (this.historyConfig.enabled === false) return;
5782
+ const envelope = await seal(this.strategies.history.historyIdentity(this.name, id, version));
5735
5783
  await this.strategies.history.saveHistory(this.adapter, this.vault, this.name, id, envelope);
5736
5784
  this.emitter.emit("history:save", { vault: this.vault, collection: this.name, id, version: envelope._v });
5737
5785
  if (this.historyConfig.maxVersions) await this.strategies.history.pruneHistory(this.adapter, this.vault, this.name, id, { keepVersions: this.historyConfig.maxVersions });
@@ -6015,17 +6063,18 @@ var DeferredNumberingStore = class {
6015
6063
  async readJson(collection, id) {
6016
6064
  const env = await this.adapter.get(this.vault, collection, id);
6017
6065
  if (!env) return { env: null, value: null };
6018
- const json = this.encrypted ? await openEnvelopeJson(env, await this.dek(collection)) : env._data;
6066
+ const json = this.encrypted ? await openEnvelopeJson({ collection, id }, env, await this.dek(collection)) : env._data;
6019
6067
  return { env, value: JSON.parse(json) };
6020
6068
  }
6021
6069
  async writeJson(collection, id, value, expectedVersion) {
6022
6070
  const json = JSON.stringify(value);
6023
6071
  let env;
6024
6072
  if (!this.encrypted) {
6025
- env = { _noydb: NOYDB_FORMAT_VERSION, _v: expectedVersion + 1, _ts: (/* @__PURE__ */ new Date()).toISOString(), _iv: "", _data: json, _by: this.actor };
6073
+ env = buildRecordEnvelope({ collection, id, version: expectedVersion + 1 }, { iv: "", data: json });
6026
6074
  } 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 };
6075
+ const identity = { collection, id, version: expectedVersion + 1 };
6076
+ const { iv, data } = await encrypt(json, await this.dek(collection), buildRecordAad(identity));
6077
+ env = buildRecordEnvelope(identity, { iv, data });
6029
6078
  }
6030
6079
  await this.adapter.put(this.vault, collection, id, env, expectedVersion);
6031
6080
  }
@@ -6575,7 +6624,7 @@ var VaultPeriods = class {
6575
6624
  const loaded = await this.deps.strategy.loadPeriods(
6576
6625
  this.deps.adapter,
6577
6626
  this.deps.vault,
6578
- (env) => this.decryptPeriodRecord(env)
6627
+ (id, env) => this.decryptPeriodRecord(id, env)
6579
6628
  );
6580
6629
  this.periodCache = await this.mergeReopenState(loaded);
6581
6630
  }
@@ -6592,7 +6641,7 @@ var VaultPeriods = class {
6592
6641
  const loaded = await this.deps.strategy.loadPeriods(
6593
6642
  this.deps.adapter,
6594
6643
  this.deps.vault,
6595
- (env) => this.decryptPeriodRecord(env)
6644
+ (id, env) => this.decryptPeriodRecord(id, env)
6596
6645
  );
6597
6646
  this.periodCache = loaded;
6598
6647
  return loaded;
@@ -6600,27 +6649,15 @@ var VaultPeriods = class {
6600
6649
  /** Generic reserved-collection writer — serves `_periods` and `_period_freezes` alike. */
6601
6650
  async writeReserved(collection, key, value) {
6602
6651
  const json = JSON.stringify(value);
6652
+ const actor = this.deps.userId();
6653
+ const identity = { collection, id: key, by: actor, version: 1 };
6603
6654
  let envelope;
6604
6655
  if (this.deps.encrypted) {
6605
6656
  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
- };
6657
+ const { iv, data } = await encrypt(json, dek, buildRecordAad(identity));
6658
+ envelope = buildRecordEnvelope(identity, { iv, data });
6615
6659
  } 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
- };
6660
+ envelope = buildRecordEnvelope(identity, { iv: "", data: json });
6624
6661
  }
6625
6662
  await this.deps.adapter.put(this.deps.vault, collection, key, envelope);
6626
6663
  if (collection === PERIODS_COLLECTION && this.deps.onDirty) {
@@ -6632,14 +6669,14 @@ var VaultPeriods = class {
6632
6669
  async readReserved(collection, key) {
6633
6670
  const env = await this.deps.adapter.get(this.deps.vault, collection, key);
6634
6671
  if (!env) return null;
6635
- const json = this.deps.encrypted ? await openEnvelopeJson(env, await this.deps.getDEK(collection)) : env._data;
6672
+ const json = this.deps.encrypted ? await openEnvelopeJson({ collection, id: key }, env, await this.deps.getDEK(collection)) : env._data;
6636
6673
  return JSON.parse(json);
6637
6674
  }
6638
- async decryptPeriodRecord(envelope) {
6675
+ async decryptPeriodRecord(periodId, envelope) {
6639
6676
  let json;
6640
6677
  if (this.deps.encrypted) {
6641
6678
  const dek = await this.deps.getDEK(PERIODS_COLLECTION);
6642
- json = await openEnvelopeJson(envelope, dek);
6679
+ json = await openEnvelopeJson({ collection: PERIODS_COLLECTION, id: periodId }, envelope, dek);
6643
6680
  } else {
6644
6681
  json = envelope._data;
6645
6682
  }
@@ -7214,7 +7251,7 @@ var VaultLinks = class {
7214
7251
  // src/with-shape/links/lazy-handle.ts
7215
7252
  function makeLazyLinkSetHandle(d) {
7216
7253
  let engine = null;
7217
- const load = () => engine ??= import("./link-set-E5HNY67I.js").then(
7254
+ const load = () => engine ??= import("./link-set-5PJBBR63.js").then(
7218
7255
  ({ LinkSet }) => new LinkSet(d.adapter, d.vault, d.name, d.spec, d.encrypted, d.getDEK, d.actor, d.emitter, d.endpointExists)
7219
7256
  );
7220
7257
  return {
@@ -7620,6 +7657,10 @@ function reconcileViaAttach(coll, graph, name, vaultCtx, plan) {
7620
7657
  classifiedFields: plan.classifiedFields,
7621
7658
  computed: plan.computed
7622
7659
  }) : void 0;
7660
+ if (plan.refs !== void 0) {
7661
+ vaultCtx.refRegistry.register(name, plan.refs);
7662
+ coll._attachDeclaredRefs(vaultCtx.refRegistry.getOutbound(name));
7663
+ }
7623
7664
  if (plan.effectiveViaFields.moneyFields) coll._applyMoneyFields(plan.effectiveViaFields.moneyFields);
7624
7665
  if (plan.computed) coll._applyComputed(plan.computed);
7625
7666
  if (plan.fieldMeta) coll._applyFieldMeta(plan.fieldMeta);
@@ -7861,7 +7902,7 @@ function declareSatellite(ctx, collectionName, options, existingRegistry) {
7861
7902
  ctx.forEachSyncEngine((e) => e.remirrorPairResolvers([spec.base, spec.satellite]));
7862
7903
  const registry = reg;
7863
7904
  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(() => {
7905
+ void import("./post-register-QCJYRMIK.js").then((m) => m.postRegister(ctx.adapter, ctx.vaultName, spec, ctx.getDEK, baseSchema, registry)).catch(() => {
7865
7906
  });
7866
7907
  return reg;
7867
7908
  }
@@ -8181,17 +8222,6 @@ function expandRefsWithSatellites(refs, registry) {
8181
8222
  return anySat ? out : refs;
8182
8223
  }
8183
8224
 
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
8225
  // src/with-shape/schema-update/fence-controller.ts
8196
8226
  function schemaBumpAuditHook(getLedger, actor) {
8197
8227
  return async (generation) => {
@@ -8754,6 +8784,7 @@ var Vault = class {
8754
8784
  * dispatch reads/writes — from this vault's OWN privates, rather than passing `this` itself. */
8755
8785
  _viaReconcileCtx() {
8756
8786
  return {
8787
+ refRegistry: this.refRegistry,
8757
8788
  i18nStrategy: this.strategies.i18n,
8758
8789
  locale: this.locale,
8759
8790
  translateText: this.translateText,
@@ -8829,6 +8860,8 @@ var Vault = class {
8829
8860
  if (coll) {
8830
8861
  reconcileViaAttach(coll, this.graph, collectionName, this._viaReconcileCtx(), {
8831
8862
  effectiveViaFields,
8863
+ ...options?.refs !== void 0 ? { refs: options.refs } : {},
8864
+ // #1141 — late `refs` declaration
8832
8865
  ...options?.computed !== void 0 ? { computed: options.computed } : {},
8833
8866
  ...options?.fieldMeta !== void 0 ? { fieldMeta: options.fieldMeta } : {},
8834
8867
  ...options?.meta !== void 0 ? { meta: options.meta } : {},
@@ -8844,7 +8877,7 @@ var Vault = class {
8844
8877
  const strategies = options.schemaUpdate ?? [];
8845
8878
  const work = (async () => {
8846
8879
  const dek = await this.getDEK(collectionName);
8847
- const { persistSchemaIfNeeded } = await import("./register-4EFJCVYD.js");
8880
+ const { persistSchemaIfNeeded } = await import("./register-JBOEHTVX.js");
8848
8881
  const result = await persistSchemaIfNeeded({
8849
8882
  store: this.adapter,
8850
8883
  vault: this.name,
@@ -8994,7 +9027,7 @@ var Vault = class {
8994
9027
  const work = (async () => {
8995
9028
  try {
8996
9029
  const dek = await this.getDEK(collectionName);
8997
- await (await import("./register-4EFJCVYD.js")).persistSchemaIfNeeded({
9030
+ await (await import("./register-JBOEHTVX.js")).persistSchemaIfNeeded({
8998
9031
  store: this.adapter,
8999
9032
  vault: this.name,
9000
9033
  collectionName,
@@ -9037,9 +9070,10 @@ var Vault = class {
9037
9070
  * unblocks R-S7 when a base gains forget coverage after its satellite was
9038
9071
  * already declared without `perRecordKeys`. Call BEFORE re-declaring with
9039
9072
  * `{ satelliteOf, perRecordKeys: true }` AND before this collection serves
9040
- * writes (unfenced walk — see {@link migrateSatelliteCek}); resumable.
9073
+ * writes (unfenced walk — see `with-shape/satellites/migrate-cek.ts`); resumable.
9041
9074
  */
9042
9075
  async migrateSatellitePerRecordKeys(satelliteName) {
9076
+ const { migrateSatelliteCek } = await import("./migrate-cek-V3VDRV24.js");
9043
9077
  return migrateSatelliteCek(satelliteName, this.collection(satelliteName, { perRecordKeys: true }));
9044
9078
  }
9045
9079
  /**
@@ -9670,16 +9704,23 @@ var Vault = class {
9670
9704
  */
9671
9705
  // eslint-disable-next-line @typescript-eslint/consistent-type-imports
9672
9706
  async _loadPodSigner() {
9673
- const { loadSigner } = await import("./signer-TA55QB6R.js");
9707
+ const { loadSigner } = await import("./signer-53AQ3BU2.js");
9674
9708
  return loadSigner(this.adapter, this.name, this.getDEK);
9675
9709
  }
9676
9710
  async writeExportAudit(entry) {
9677
9711
  const json = JSON.stringify(entry);
9712
+ const exportAuditIdentity = { collection: EXPORT_AUDIT_COLLECTION, id: entry.id, by: entry.actor, version: 1 };
9678
9713
  const envelope = this.encrypted ? await (async () => {
9679
9714
  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 };
9715
+ const { iv, data } = await encrypt(json, dek, buildRecordAad(exportAuditIdentity));
9716
+ return buildRecordEnvelope(
9717
+ exportAuditIdentity,
9718
+ { ts: entry.startedAt, iv, data }
9719
+ );
9720
+ })() : buildRecordEnvelope(
9721
+ exportAuditIdentity,
9722
+ { ts: entry.startedAt, iv: "", data: json }
9723
+ );
9683
9724
  await this.adapter.put(this.name, EXPORT_AUDIT_COLLECTION, entry.id, envelope);
9684
9725
  }
9685
9726
  canExport(tier, format) {
@@ -9693,12 +9734,12 @@ var Vault = class {
9693
9734
  *
9694
9735
  * @internal
9695
9736
  */
9696
- async _decryptEnvelopeForBundleFilter(env, collectionName) {
9737
+ async _decryptEnvelopeForBundleFilter(env, collectionName, recordId) {
9697
9738
  if (!this.encrypted) {
9698
9739
  return JSON.parse(env._data);
9699
9740
  }
9700
9741
  const dek = await this.getDEK(collectionName);
9701
- const json = await openEnvelopeJson(env, dek);
9742
+ const json = await openEnvelopeJson({ collection: collectionName, id: recordId }, env, dek);
9702
9743
  return JSON.parse(json);
9703
9744
  }
9704
9745
  canImport(tier, format) {
@@ -10153,7 +10194,7 @@ var Vault = class {
10153
10194
  async _initGuards(handles) {
10154
10195
  if (handles.length === 0) return;
10155
10196
  const [{ GuardRegistry }, { ReadOnlyVaultFacade }] = await Promise.all([
10156
- import("./registry-IKUR2MXD.js"),
10197
+ import("./registry-5DYHQFJS.js"),
10157
10198
  import("./read-only-facade-CHCKSEPD.js")
10158
10199
  ]);
10159
10200
  const registry = new GuardRegistry();
@@ -10181,7 +10222,7 @@ var Vault = class {
10181
10222
  async _initDerivations(handles) {
10182
10223
  if (handles.length === 0) return;
10183
10224
  const [{ DerivationRegistry }, { ReadOnlyVaultFacade }] = await Promise.all([
10184
- import("./registry-4SDHHOJ7.js"),
10225
+ import("./registry-R23SQUQH.js"),
10185
10226
  import("./read-only-facade-CHCKSEPD.js")
10186
10227
  ]);
10187
10228
  const registry = new DerivationRegistry();
@@ -10213,7 +10254,7 @@ var Vault = class {
10213
10254
  */
10214
10255
  async _initMaterializedViews(handles) {
10215
10256
  if (handles.length === 0) return;
10216
- const { MaterializedViewRegistry } = await import("./registry-OYTFGWVK.js");
10257
+ const { MaterializedViewRegistry } = await import("./registry-J25H6VB4.js");
10217
10258
  const registry = new MaterializedViewRegistry();
10218
10259
  this.materializedViewRegistry = registry;
10219
10260
  const db = this;
@@ -10238,7 +10279,7 @@ var Vault = class {
10238
10279
  */
10239
10280
  async _initOverlayedViews(handles) {
10240
10281
  if (handles.length === 0) return;
10241
- const { OverlayedViewRegistry } = await import("./registry-CZVINVQH.js");
10282
+ const { OverlayedViewRegistry } = await import("./registry-EANV44W2.js");
10242
10283
  const registry = new OverlayedViewRegistry();
10243
10284
  const mvRegistry = this.materializedViewRegistry;
10244
10285
  const overlayNames = /* @__PURE__ */ new Set();
@@ -10296,18 +10337,19 @@ var Vault = class {
10296
10337
  if (registry === null) {
10297
10338
  return { written: 0, deleted: 0, failed: 0, residueUndecodable: [], residueDeclined: [] };
10298
10339
  }
10340
+ await registry.resolvePendingPlans();
10299
10341
  const reg = registry.byName(name);
10300
10342
  if (!reg) {
10301
10343
  throw new Error(`refreshView: no MV registered with name "${name}"`);
10302
10344
  }
10303
- const { MaterializedViewExecutor } = await import("./executor-YIQB2S6N.js");
10345
+ const { MaterializedViewExecutor } = await import("./executor-ZUTUMTPA.js");
10304
10346
  const result = await MaterializedViewExecutor.refresh(reg, {
10305
10347
  getCollection: (n) => this.collection(n),
10306
10348
  getActiveTxContext: () => this.noydb._activeTxContextOrNull,
10307
10349
  getQueryContext: () => this,
10308
10350
  dispatchCtx: this._dispatchCtx({ collection: name, id: "refreshView" })
10309
10351
  });
10310
- const { clearMVStaleFully } = await import("./stale-ARHFVL5U.js");
10352
+ const { clearMVStaleFully } = await import("./stale-TH7SSVRV.js");
10311
10353
  await clearMVStaleFully(this.adapter, this.name, registry, name);
10312
10354
  return result;
10313
10355
  }
@@ -10320,7 +10362,7 @@ var Vault = class {
10320
10362
  if (registry === null) return { derived: 0, failed: 0, skippedFrozen: 0 };
10321
10363
  const strategies = registry.strategiesForSource(sourceCollection);
10322
10364
  if (strategies.length === 0) return { derived: 0, failed: 0, skippedFrozen: 0 };
10323
- const { DerivationExecutor } = await import("./executor-S4QIKEHW.js");
10365
+ const { DerivationExecutor } = await import("./executor-BBEEUFO3.js");
10324
10366
  const sourceColl = this.collection(sourceCollection);
10325
10367
  const records = await sourceColl.list();
10326
10368
  const ctx = { vault: this.derivationFacade ?? new (await import("./read-only-facade-CHCKSEPD.js")).ReadOnlyVaultFacade(this, "derivation") };
@@ -10347,7 +10389,7 @@ var Vault = class {
10347
10389
  if (!outSpec) continue;
10348
10390
  const outputColl = this.collection(outSpec.collection);
10349
10391
  if (out.kind === "array") {
10350
- const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-NNAJQXMX.js");
10392
+ const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-3QZU7ZZX.js");
10351
10393
  const prior = await loadFanoutSidecar(this.adapter, this.name, spec.source, id, key, this.getDEK, this.encrypted);
10352
10394
  const prevKeys = new Set(prior?.keys ?? []);
10353
10395
  const newKeysList = out.entries.map((e) => e.key);
@@ -10574,7 +10616,7 @@ var Vault = class {
10574
10616
  * collection.
10575
10617
  */
10576
10618
  async delegate(opts) {
10577
- const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-MO7YZYJS.js");
10619
+ const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-5F36DRDH.js");
10578
10620
  if (!this.keyring.kek) {
10579
10621
  throw new ValidationError(
10580
10622
  "issueDelegation: keyring.kek is null \u2014 issuing a delegation requires a tier-1 unlock. Re-authenticate at tier 1 (secret) first."
@@ -10596,7 +10638,7 @@ var Vault = class {
10596
10638
  * if the id does not exist.
10597
10639
  */
10598
10640
  async revokeDelegation(id) {
10599
- const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-MO7YZYJS.js");
10641
+ const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-5F36DRDH.js");
10600
10642
  await revokeDelegation(this.adapter, this.name, id);
10601
10643
  void DELEGATIONS_COLLECTION;
10602
10644
  }
@@ -10692,25 +10734,18 @@ var Vault = class {
10692
10734
  async writeElevationAudit(entry) {
10693
10735
  const id = `elev-${Date.now().toString(36)}-${Math.random().toString(16).slice(2, 10)}`;
10694
10736
  const json = JSON.stringify({ id, ...entry });
10737
+ const elevationAuditIdentity = { collection: ELEVATION_AUDIT_COLLECTION, id, by: entry.actor, version: 1 };
10695
10738
  const envelope = this.encrypted ? await (async () => {
10696
10739
  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
- };
10740
+ const { iv, data } = await encrypt(json, dek, buildRecordAad(elevationAuditIdentity));
10741
+ return buildRecordEnvelope(
10742
+ elevationAuditIdentity,
10743
+ { ts: entry.startedAt, iv, data }
10744
+ );
10745
+ })() : buildRecordEnvelope(
10746
+ elevationAuditIdentity,
10747
+ { ts: entry.startedAt, iv: "", data: json }
10748
+ );
10714
10749
  await this.adapter.put(this.name, ELEVATION_AUDIT_COLLECTION, id, envelope);
10715
10750
  }
10716
10751
  /**
@@ -10856,7 +10891,7 @@ var Vault = class {
10856
10891
  * @see design-history/2026-05-22-schema-dump-design.md
10857
10892
  */
10858
10893
  async dumpSchema(opts = {}) {
10859
- const { dumpVaultSchema } = await import("./walk-3ZECBFDA.js");
10894
+ const { dumpVaultSchema } = await import("./walk-NABCHDZN.js");
10860
10895
  return dumpVaultSchema(this, opts);
10861
10896
  }
10862
10897
  /**
@@ -10951,15 +10986,15 @@ var Vault = class {
10951
10986
  * distinct handles, which is the right behavior — they're
10952
10987
  * separate vault instances now.
10953
10988
  */
10954
- async getBundleHandle() {
10955
- const { buildBundleHandle } = await import("./bundle-handle-GFNHT52M.js");
10956
- return buildBundleHandle(this.adapter, this.name);
10989
+ async getPodHandle() {
10990
+ const { buildPodHandle } = await import("./pod-handle-AZ3CXY5Y.js");
10991
+ return buildPodHandle(this.adapter, this.name);
10957
10992
  }
10958
10993
  /**
10959
10994
  * Read the owner-curated cover for this vault (or `undefined` if
10960
10995
  * none is persisted). The cover lives in `_meta/public-envelope`
10961
10996
  * (the frozen wire name) as plaintext — readable without any KEK
10962
- * — so `getBundleHandle`-style callers can label a vault before
10997
+ * — so `getPodHandle`-style callers can label a vault before
10963
10998
  * unlock.
10964
10999
  *
10965
11000
  * Mirrors `Noydb.getCover(vault, opts)` but scoped to a
@@ -10984,7 +11019,7 @@ var Vault = class {
10984
11019
  * both modes round-trip cleanly.
10985
11020
  */
10986
11021
  async dump() {
10987
- const { dumpVault } = await import("./backup-KULFZ2T4.js");
11022
+ const { dumpVault } = await import("./backup-VL4GRIEW.js");
10988
11023
  return dumpVault(this.backupContext());
10989
11024
  }
10990
11025
  /**
@@ -11036,7 +11071,7 @@ var Vault = class {
11036
11071
  * — there's no chain to verify against.
11037
11072
  */
11038
11073
  async load(backupJson) {
11039
- const { loadVault } = await import("./backup-KULFZ2T4.js");
11074
+ const { loadVault } = await import("./backup-VL4GRIEW.js");
11040
11075
  return loadVault(this.backupContext(), backupJson);
11041
11076
  }
11042
11077
  /**
@@ -11068,7 +11103,7 @@ var Vault = class {
11068
11103
  * way to detect tampering of an in-place vault.
11069
11104
  */
11070
11105
  async verifyBackupIntegrity() {
11071
- const { verifyBackupIntegrity } = await import("./backup-KULFZ2T4.js");
11106
+ const { verifyBackupIntegrity } = await import("./backup-VL4GRIEW.js");
11072
11107
  return verifyBackupIntegrity(this.backupContext());
11073
11108
  }
11074
11109
  /**
@@ -11286,7 +11321,7 @@ var Vault = class {
11286
11321
  * is the live validator object, not a serialization of it).
11287
11322
  */
11288
11323
  async exportJSON(opts = {}) {
11289
- const { exportVaultJSON } = await import("./backup-KULFZ2T4.js");
11324
+ const { exportVaultJSON } = await import("./backup-VL4GRIEW.js");
11290
11325
  return exportVaultJSON(this.backupContext(), opts);
11291
11326
  }
11292
11327
  };
@@ -12197,6 +12232,20 @@ var TeamFacade = class {
12197
12232
  this.deps.keyringCache.set(vault, keyring);
12198
12233
  return result;
12199
12234
  }
12235
+ /** Gate + run the `verifyRoster` engine (#1121). See `Noydb.verifyRoster`. */
12236
+ async runVerifyRoster(engine, vault) {
12237
+ const keyring = await this.deps.getKeyringInternal(vault);
12238
+ return engine(this.deps.options.store, vault, keyring);
12239
+ }
12240
+ /** Gate + run the `quarantineKeyring` engine (#1121). See `Noydb.quarantineKeyring`. */
12241
+ async runQuarantine(engine, vault, userId, factors) {
12242
+ this.deps.checkPolicyOperation(vault, "revoke");
12243
+ await this.deps.checkGate(vault, "revoke-user", factors);
12244
+ const keyring = await this.deps.getKeyringInternal(vault);
12245
+ const result = await engine(this.deps.options.store, vault, keyring, userId);
12246
+ this.deps.keyringCache.set(vault, keyring);
12247
+ return result;
12248
+ }
12200
12249
  // ─── Tier-2 enroll / remove ─────────────────────────────────────
12201
12250
  /**
12202
12251
  * Add a tier-2 authenticator slot to the calling user's keyring.
@@ -13102,6 +13151,7 @@ var Noydb = class {
13102
13151
  this.#registerGuardGate();
13103
13152
  this.#registerPeriodGate();
13104
13153
  this.#registerForgetHooks();
13154
+ this.#registerVaultHeadObserver();
13105
13155
  this.resetSessionTimer();
13106
13156
  }
13107
13157
  /** @internal — resolved forget strategy (NO_FORGET when not configured). */
@@ -13118,6 +13168,22 @@ var Noydb = class {
13118
13168
  // - the subsystemBus `afterDelete` observer fires on delete (onAfterWrite
13119
13169
  // does NOT) — drop the ref so a deleted record never lingers in the
13120
13170
  // index (RISK #2). Without it, forget() would try to shred a ghost.
13171
+ /** #1044 — see `with-commit/vault-head/strategy.ts` for why this is an observer. */
13172
+ #registerVaultHeadObserver() {
13173
+ if (!this.strategies.vaultHead.enabled) return;
13174
+ for (const point of ["afterPut", "afterDelete"]) {
13175
+ this.subsystemBus.register(point, async (event) => {
13176
+ const vault = this.vaultCache.get(event.vault);
13177
+ if (!vault) return;
13178
+ const { adapter, getDEK } = vault._introspectState();
13179
+ await this.strategies.vaultHead.note(adapter, event.vault, getDEK, {
13180
+ collection: event.collection,
13181
+ id: event.docId,
13182
+ version: event.version
13183
+ });
13184
+ });
13185
+ }
13186
+ }
13121
13187
  #registerForgetHooks() {
13122
13188
  const subjects = this.strategies.forget.subjects;
13123
13189
  if (Object.keys(subjects).length === 0) return;
@@ -13183,7 +13249,7 @@ var Noydb = class {
13183
13249
  if (!facade) return;
13184
13250
  const ctx = { existing, vault: facade, userId: e.userId, role: e.role };
13185
13251
  await registry.runChecks(e.collection, incoming, ctx);
13186
- const { GuardExecutor } = await import("./executor-CYJQLKKI.js");
13252
+ const { GuardExecutor } = await import("./executor-G6G3YEWR.js");
13187
13253
  for (const g of guards) {
13188
13254
  await GuardExecutor.checkFrozenFields(g, e.docId, existing, incoming, e.computedFieldNames);
13189
13255
  }
@@ -13304,6 +13370,7 @@ var Noydb = class {
13304
13370
  if (this.options.encrypt !== false && !this.policyCache.has(name)) {
13305
13371
  await this.bootstrapPolicy(name);
13306
13372
  }
13373
+ const mergeAuthority = buildMergeAuthority(keyring);
13307
13374
  let syncEngine;
13308
13375
  const targets = normalizeSyncTargets(this.options.sync);
13309
13376
  if (targets.length > 0) {
@@ -13318,11 +13385,12 @@ var Noydb = class {
13318
13385
  emitter: this.emitter,
13319
13386
  syncPolicy: effectivePolicy,
13320
13387
  role: primary.role,
13388
+ mergeAuthority,
13321
13389
  ...primary.label !== void 0 ? { label: primary.label } : {}
13322
13390
  });
13323
13391
  this.syncEngines.set(name, syncEngine);
13324
13392
  if (declaredPolicy) syncEngine.startScheduler();
13325
- for (const target of targets) {
13393
+ for (const [index, target] of targets.entries()) {
13326
13394
  if (target === primary) continue;
13327
13395
  const targetPolicy = target.policy ?? this.options.syncPolicy ?? INDEXED_STORE_POLICY;
13328
13396
  const engine = this.strategies.sync.buildSyncEngine({
@@ -13333,10 +13401,10 @@ var Noydb = class {
13333
13401
  emitter: this.emitter,
13334
13402
  syncPolicy: targetPolicy,
13335
13403
  role: target.role,
13404
+ mergeAuthority,
13336
13405
  ...target.label !== void 0 ? { label: target.label } : {}
13337
13406
  });
13338
- const key = `${name}::${target.label ?? target.role}`;
13339
- this.syncEngines.set(key, engine);
13407
+ this.syncEngines.set(`${name}::${index}`, engine);
13340
13408
  if (target.policy ?? this.options.syncPolicy) engine.startScheduler();
13341
13409
  }
13342
13410
  }
@@ -13557,8 +13625,8 @@ var Noydb = class {
13557
13625
  * collection) pair that was dropped. Re-run `grant()` for those pairs, or
13558
13626
  * they stay locked out.
13559
13627
  *
13560
- * Unlike `revoke({ rotateKeys: true })`, this call does not REMOVE any
13561
- * user from the vault — they keep membership and their other collections.
13628
+ * Unlike `revoke()`, this call does not REMOVE any user from the vault —
13629
+ * they keep membership and their other collections.
13562
13630
  * This is the "just rotate" path; "revoke and rotate" lives in `revoke()`.
13563
13631
  *
13564
13632
  * Exposed on Noydb (rather than only on the lower-level keyring
@@ -13569,6 +13637,27 @@ var Noydb = class {
13569
13637
  async rotate(vault, collections) {
13570
13638
  return this.strategies.team.rotate(this.team, vault, collections);
13571
13639
  }
13640
+ /**
13641
+ * Verify every `_keyring` file in the vault. Read-only (#1121).
13642
+ *
13643
+ * Names each failing file and why, so the bad one need not be found by trial.
13644
+ * Reports `checked` too: "nothing unverified" is equally true of a sweep that
13645
+ * examined nothing.
13646
+ */
13647
+ async verifyRoster(vault) {
13648
+ return this.strategies.team.verifyRoster(this.team, vault);
13649
+ }
13650
+ /**
13651
+ * Remove a `_keyring` file that cannot be authenticated, and re-key behind it
13652
+ * (#1121). Owner-only; refuses a file that verifies (use {@link revoke}).
13653
+ *
13654
+ * `revoke` consults the target's own `role`, so it cannot act on a file it
13655
+ * will not trust. This ignores every claim the file makes — which is exactly
13656
+ * why it is restricted to files that already fail authentication.
13657
+ */
13658
+ async quarantineKeyring(vault, userId, factors) {
13659
+ return this.strategies.team.quarantineKeyring(this.team, vault, userId, factors);
13660
+ }
13572
13661
  /** List all users with access to a vault. */
13573
13662
  async listUsers(vault) {
13574
13663
  return listUsers(this.options.store, vault);
@@ -13962,6 +14051,21 @@ var Noydb = class {
13962
14051
  }
13963
14052
  return engine.status();
13964
14053
  }
14054
+ /**
14055
+ * Per-target sync state for `vault` (#1034) — `syncStatus()` reads only the
14056
+ * primary engine, so it cannot express "the LAN store is behind, the cloud
14057
+ * is current". Registration order, primary first. See {@link SyncTargetStatus}.
14058
+ */
14059
+ syncTargetStatus(vault) {
14060
+ const targets = [];
14061
+ for (const [key, engine] of this.syncEngines) {
14062
+ if (key !== vault && !key.startsWith(`${vault}::`)) continue;
14063
+ const { dirty, lastPush, lastPull } = engine.status();
14064
+ const { label, role } = engine;
14065
+ targets.push({ label, role, dirty, lastPush, lastPull, caughtUp: dirty === 0 });
14066
+ }
14067
+ return targets;
14068
+ }
13965
14069
  /**
13966
14070
  * Enumerate the sync targets wired for `vault` (#948) — the primary engine
13967
14071
  * (keyed by vault name) plus any additional targets (keyed `vault::label`
@@ -13984,7 +14088,14 @@ var Noydb = class {
13984
14088
  getSyncEngine(vault) {
13985
14089
  const engine = this.syncEngines.get(vault);
13986
14090
  if (!engine) {
13987
- throw new ValidationError("No sync adapter configured. Pass a `sync` adapter to createNoydb().");
14091
+ if (this.syncEngines.size === 0) {
14092
+ throw new ValidationError(
14093
+ "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."
14094
+ );
14095
+ }
14096
+ throw new ValidationError(
14097
+ `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()\`.`
14098
+ );
13988
14099
  }
13989
14100
  return engine;
13990
14101
  }
@@ -14169,8 +14280,11 @@ var Noydb = class {
14169
14280
  * No-op when `vault` is not currently in cache (idempotent).
14170
14281
  */
14171
14282
  lockVault(vault) {
14172
- this.syncEngines.get(vault)?.stopAutoSync();
14173
- this.syncEngines.delete(vault);
14283
+ for (const [key, engine] of [...this.syncEngines]) {
14284
+ if (key !== vault && !key.startsWith(`${vault}::`)) continue;
14285
+ engine.stopAutoSync();
14286
+ this.syncEngines.delete(key);
14287
+ }
14174
14288
  this.policyEnforcers.get(vault)?.destroy();
14175
14289
  this.policyEnforcers.delete(vault);
14176
14290
  this.vaultCache.get(vault)?._stopFenceCoordination();
@@ -14507,7 +14621,7 @@ async function createNoydb(options) {
14507
14621
  if (!options.store) options = { ...options, store: memoryStore() };
14508
14622
  validateSecretModeOptions(options);
14509
14623
  if (!options.coordinationStrategy) options = { ...options, coordinationStrategy: await createDefaultCoordinationProvider(options.store) };
14510
- if (!options.userApiFactory) options = { ...options, userApiFactory: (await import("./api-RXUMEKT3.js")).createUserApi };
14624
+ if (!options.userApiFactory) options = { ...options, userApiFactory: (await import("./api-6X2VLZ7J.js")).createUserApi };
14511
14625
  if (!options.policyFactory) {
14512
14626
  const policyModule = await import("./policy/index.js");
14513
14627
  options = { ...options, policyFactory: policyModule.createNoydbPolicy, policyCheckGateFn: policyModule.checkGate };
@@ -14542,4 +14656,4 @@ export {
14542
14656
  Noydb,
14543
14657
  createNoydb
14544
14658
  };
14545
- //# sourceMappingURL=chunk-2GAJGUNM.js.map
14659
+ //# sourceMappingURL=chunk-JYPRZWCZ.js.map