@noy-db/hub 0.3.0-pre.6 → 0.3.0-pre.8

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 (245) hide show
  1. package/dist/adapter/index.d.ts +1 -1
  2. package/dist/aggregate/index.d.ts +2 -2
  3. package/dist/{api-OQ65LUSK.js → api-JDWL67WL.js} +6 -6
  4. package/dist/as/index.d.ts +3 -3
  5. package/dist/as/index.js +5 -5
  6. package/dist/at/index.d.ts +1 -1
  7. package/dist/attestation/index.d.ts +2 -2
  8. package/dist/attestation/index.js +12 -12
  9. package/dist/{backup-Y3RMFGVX.js → backup-WRGNTGJF.js} +6 -6
  10. package/dist/blobs/index.d.ts +3 -3
  11. package/dist/blobs/index.js +5 -5
  12. package/dist/bundle/index.d.ts +4 -4
  13. package/dist/bundle/index.js +14 -14
  14. package/dist/{bundle-BPOSpGZG.d.ts → bundle-DzWtVw7w.d.ts} +1 -1
  15. package/dist/cargo/index.d.ts +3 -3
  16. package/dist/cargo/index.js +13 -13
  17. package/dist/{chunk-QQQE6QUO.js → chunk-25G7PUTA.js} +7 -7
  18. package/dist/{chunk-S2IDC6MO.js → chunk-2PJB6H3H.js} +2 -2
  19. package/dist/{chunk-OCVO2V63.js → chunk-37JZR7CY.js} +18 -5
  20. package/dist/chunk-37JZR7CY.js.map +1 -0
  21. package/dist/{chunk-RIZQZKU6.js → chunk-3KBK5LU4.js} +3 -3
  22. package/dist/{chunk-MT4YWJRW.js → chunk-3YKBGS3I.js} +4 -4
  23. package/dist/{chunk-TSAT3E7Y.js → chunk-44DV37ZV.js} +2 -2
  24. package/dist/{chunk-7A7LTSJR.js → chunk-4VDFUBTS.js} +3 -3
  25. package/dist/{chunk-D6ADQ4QL.js → chunk-56JB2BGI.js} +420 -81
  26. package/dist/chunk-56JB2BGI.js.map +1 -0
  27. package/dist/{chunk-4I4UNXHM.js → chunk-5HRJQSKN.js} +3 -3
  28. package/dist/{chunk-3IMGBWP7.js → chunk-5YBUFCFF.js} +5 -5
  29. package/dist/{chunk-73C4RPMX.js → chunk-62APEMF3.js} +3 -3
  30. package/dist/{chunk-GGFT2XFF.js → chunk-723XB5NX.js} +3 -3
  31. package/dist/{chunk-7AGLCOYE.js → chunk-7TAV3BFQ.js} +6 -5
  32. package/dist/chunk-7TAV3BFQ.js.map +1 -0
  33. package/dist/{chunk-C57J6AWN.js → chunk-BJ2XF2RC.js} +3 -3
  34. package/dist/{chunk-YXGIPYH4.js → chunk-BM6E4MUT.js} +164 -51
  35. package/dist/chunk-BM6E4MUT.js.map +1 -0
  36. package/dist/{chunk-T45LAT2Y.js → chunk-BTFTHF6Q.js} +2 -2
  37. package/dist/{chunk-C2ZKWL37.js → chunk-DCVVCJVB.js} +2 -2
  38. package/dist/{chunk-ZHK3F5RB.js → chunk-F3EKFGUS.js} +4 -4
  39. package/dist/{chunk-3UUXDQPM.js → chunk-FWART3VA.js} +2 -2
  40. package/dist/{chunk-C6A2DPRE.js → chunk-FZK3JJJK.js} +3 -3
  41. package/dist/{chunk-E7MAS736.js → chunk-GDOOG5YQ.js} +2 -2
  42. package/dist/{chunk-I7GTYPWF.js → chunk-GLVXQU3E.js} +2 -2
  43. package/dist/{chunk-65FW3ALF.js → chunk-I6URUNTD.js} +3 -3
  44. package/dist/{chunk-RXUFMTD5.js → chunk-IARAK3PK.js} +2 -2
  45. package/dist/{chunk-DBBP35OP.js → chunk-J5YUA6JB.js} +2 -2
  46. package/dist/{chunk-BYS45GOJ.js → chunk-J7OH6R4K.js} +3 -3
  47. package/dist/{chunk-YFF2RP3X.js → chunk-L6Q5NA22.js} +2 -2
  48. package/dist/{chunk-ML5UP7YN.js → chunk-M3OYTM5Z.js} +4 -4
  49. package/dist/{chunk-UZZFV3O3.js → chunk-NTPWQH4S.js} +5 -5
  50. package/dist/{chunk-VWGCJUTV.js → chunk-P2PEPSPK.js} +2 -2
  51. package/dist/{chunk-XDWNF4BS.js → chunk-P6TZ3IVN.js} +7 -7
  52. package/dist/{chunk-WQAT24C2.js → chunk-PMMV5SQC.js} +5 -5
  53. package/dist/{chunk-PLQCXH75.js → chunk-PPPZIBKY.js} +2 -2
  54. package/dist/chunk-PVC2FBCQ.js +45 -0
  55. package/dist/chunk-PVC2FBCQ.js.map +1 -0
  56. package/dist/{chunk-NL4HVTNO.js → chunk-QABECTNN.js} +2 -2
  57. package/dist/{chunk-IVIGZTFH.js → chunk-QYMMMKOO.js} +4 -4
  58. package/dist/{chunk-ZRJBLWKQ.js → chunk-R4IVPJHN.js} +3 -3
  59. package/dist/{chunk-LN22XH4B.js → chunk-REWTMYSF.js} +1 -1
  60. package/dist/chunk-REWTMYSF.js.map +1 -0
  61. package/dist/{chunk-GEK6UGOJ.js → chunk-TCGVRKOS.js} +2 -2
  62. package/dist/{chunk-RLP65PI3.js → chunk-TIAYXOEI.js} +2 -2
  63. package/dist/{chunk-WAL4MRBK.js → chunk-TUL5YQWF.js} +3 -3
  64. package/dist/{chunk-TWJVOYU2.js → chunk-UMH35AQV.js} +2 -2
  65. package/dist/{chunk-SXLMLECV.js → chunk-VVLOWY74.js} +3 -3
  66. package/dist/{chunk-HJZ3CTZ2.js → chunk-W3JABOVB.js} +2 -2
  67. package/dist/{chunk-S55MJQUQ.js → chunk-WPNP3NF5.js} +4 -4
  68. package/dist/{chunk-WAW4VFS7.js → chunk-X5QZAJDB.js} +3 -3
  69. package/dist/{chunk-OLVIGEHQ.js → chunk-X6VNIRHS.js} +2 -2
  70. package/dist/{chunk-CYWF3JJE.js → chunk-XBPUVQDO.js} +8 -8
  71. package/dist/classified/index.d.ts +3 -3
  72. package/dist/classified/index.js +1 -1
  73. package/dist/{collection-facade-5V3JS7SD.js → collection-facade-EJVIN2BY.js} +9 -9
  74. package/dist/{config-drift-SWZNEH5H.js → config-drift-RFEVGBKR.js} +3 -3
  75. package/dist/consent/index.d.ts +2 -2
  76. package/dist/consent/index.js +4 -4
  77. package/dist/crdt/index.d.ts +2 -2
  78. package/dist/{dead-filter-MGWMNRO2.js → dead-filter-RHMNYOXP.js} +2 -2
  79. package/dist/{delegation-AUY42TGU.js → delegation-IHXOASHV.js} +5 -5
  80. package/dist/derivations/index.d.ts +3 -3
  81. package/dist/derivations/index.js +3 -3
  82. package/dist/{derive-FWSEWWI7.js → derive-CD3ZVIXK.js} +4 -4
  83. package/dist/{dev-unlock-DxecHstJ.d.ts → dev-unlock-wgQ7Ci5I.d.ts} +1 -1
  84. package/dist/{enclave-UYZGSE2C.js → enclave-KGEUW2GL.js} +11 -5
  85. package/dist/{executor-XWPD5PIM.js → executor-MHUM2VZK.js} +4 -4
  86. package/dist/{export-accessible-M54OI6FO.js → export-accessible-Z3NSZZHN.js} +7 -7
  87. package/dist/{extract-partition-MIHAL6PP.js → extract-partition-VSKT35JG.js} +10 -10
  88. package/dist/{fanout-sidecar-SSEW7BQB.js → fanout-sidecar-NBDKKCHT.js} +4 -4
  89. package/dist/forget/index.js +4 -4
  90. package/dist/guards/index.d.ts +3 -3
  91. package/dist/{hash-umqwdLhO.d.ts → hash-CwHnoKyW.d.ts} +1 -1
  92. package/dist/history/index.d.ts +3 -3
  93. package/dist/history/index.js +6 -6
  94. package/dist/i18n/index.d.ts +2 -2
  95. package/dist/i18n/index.js +7 -7
  96. package/dist/in/index.d.ts +1 -1
  97. package/dist/{index-zdEVWlkZ.d.ts → index-CTvUp94-.d.ts} +2 -2
  98. package/dist/{index-B-LKCpm6.d.ts → index-Dn5GzPg_.d.ts} +304 -4
  99. package/dist/index.d.ts +26 -19
  100. package/dist/index.js +52 -51
  101. package/dist/index.js.map +1 -1
  102. package/dist/indexing/index.d.ts +2 -2
  103. package/dist/{issue-PHWTGH2G.js → issue-AEOL6RXA.js} +6 -6
  104. package/dist/kernel/index.d.ts +2 -2
  105. package/dist/kernel/index.js +3 -3
  106. package/dist/lazy/index.d.ts +2 -2
  107. package/dist/{ledger-IWWY7IIC.js → ledger-3LR3YO2W.js} +6 -6
  108. package/dist/liberate-XSEPRWEA.js +24 -0
  109. package/dist/{link-set-HJOC7GB7.js → link-set-NSUIX6BR.js} +5 -5
  110. package/dist/materialized-views/index.d.ts +3 -3
  111. package/dist/materialized-views/index.js +4 -4
  112. package/dist/{mime-magic-C_O9KsAk.d.ts → mime-magic-CYbFNQ4h.d.ts} +1 -1
  113. package/dist/{noydb-Y5L74IDJ.js → noydb-POVTIVQ6.js} +23 -23
  114. package/dist/on/index.d.ts +1 -1
  115. package/dist/on/index.js +4 -4
  116. package/dist/overlay-views/index.d.ts +3 -3
  117. package/dist/periods/index.d.ts +2 -2
  118. package/dist/periods/index.js +15 -7
  119. package/dist/pod/index.d.ts +2 -2
  120. package/dist/pod/index.js +5 -5
  121. package/dist/{policy-3ZKSGSRK.js → policy-Y7HL2KGA.js} +4 -4
  122. package/dist/portability/index.d.ts +2 -2
  123. package/dist/portability/index.js +6 -6
  124. package/dist/{post-register-BIXGCZ2M.js → post-register-KOFRTCDD.js} +4 -4
  125. package/dist/{public-envelope-6UBQ4IUY.js → public-envelope-NC7SPNMV.js} +3 -3
  126. package/dist/query/index.d.ts +1 -1
  127. package/dist/{register-OVONZ2MJ.js → register-3D6R2MKN.js} +6 -6
  128. package/dist/{registry-AIEYUOSG.js → registry-AI4E46PD.js} +4 -4
  129. package/dist/{registry-D5J7SVJ2.js → registry-WIX6QCV5.js} +4 -4
  130. package/dist/{request-withdrawal-IHF64VIT.js → request-withdrawal-GU4XS2R5.js} +9 -9
  131. package/dist/{reveal-B77Q2BJW.js → reveal-5Y777N5Q.js} +3 -3
  132. package/dist/{revoke-BPPOUZPE.js → revoke-ZFETCLYV.js} +6 -6
  133. package/dist/satellites/index.d.ts +1 -1
  134. package/dist/sealed-record/index.d.ts +2 -2
  135. package/dist/sealed-record/index.js +6 -6
  136. package/dist/session/index.d.ts +3 -3
  137. package/dist/session/index.js +3 -3
  138. package/dist/shadow/index.d.ts +2 -2
  139. package/dist/{signer-MNQEL27B.js → signer-GAIMQQ2J.js} +5 -5
  140. package/dist/snapshots/index.d.ts +2 -2
  141. package/dist/snapshots/index.js +5 -5
  142. package/dist/{stale-COBBJORL.js → stale-77LP2EEF.js} +2 -2
  143. package/dist/{storage-DVKYH7UU.js → storage-KEXIXLGM.js} +5 -5
  144. package/dist/{store-coordination-provider-JJCEMTAE.js → store-coordination-provider-NJDDZ264.js} +3 -3
  145. package/dist/sync/index.d.ts +1 -1
  146. package/dist/sync/index.js +4 -4
  147. package/dist/team/index.d.ts +2 -2
  148. package/dist/team/index.js +9 -9
  149. package/dist/tiers/index.d.ts +1 -1
  150. package/dist/tiers/index.js +4 -4
  151. package/dist/to/index.d.ts +1 -1
  152. package/dist/{transition-guard-CzqWwVGP.d.ts → transition-guard-D5RLJv8S.d.ts} +1 -1
  153. package/dist/tx/index.d.ts +2 -2
  154. package/dist/{validators-Bdiv0ucK.d.ts → validators-C3lrVF-c.d.ts} +1 -1
  155. package/dist/{vault-diff-BbZngJUP.d.ts → vault-diff-_LSIcOMv.d.ts} +1 -1
  156. package/dist/{walk-CVNXFUEF.js → walk-SMAE4IEI.js} +5 -5
  157. package/dist/with/index.d.ts +2 -2
  158. package/dist/with/index.js +6 -6
  159. package/dist/{with-materialized-view-BmKXygt2.d.ts → with-materialized-view-Xv1-9Bh0.d.ts} +1 -1
  160. package/dist/{with-overlayed-view-Bnwe7E75.d.ts → with-overlayed-view-CuWhq_-C.d.ts} +1 -1
  161. package/dist/{with-rollup-JXTxc9cu.d.ts → with-rollup-K_iwal4b.d.ts} +1 -1
  162. package/dist/{withdraw-accessible-5ALN3ZGM.js → withdraw-accessible-Q7BULAN5.js} +8 -8
  163. package/package.json +3 -3
  164. package/dist/chunk-7AGLCOYE.js.map +0 -1
  165. package/dist/chunk-D6ADQ4QL.js.map +0 -1
  166. package/dist/chunk-LN22XH4B.js.map +0 -1
  167. package/dist/chunk-OCVO2V63.js.map +0 -1
  168. package/dist/chunk-QKVILR7N.js +0 -25
  169. package/dist/chunk-QKVILR7N.js.map +0 -1
  170. package/dist/chunk-YXGIPYH4.js.map +0 -1
  171. package/dist/liberate-QDTNV7SM.js +0 -24
  172. /package/dist/{api-OQ65LUSK.js.map → api-JDWL67WL.js.map} +0 -0
  173. /package/dist/{backup-Y3RMFGVX.js.map → backup-WRGNTGJF.js.map} +0 -0
  174. /package/dist/{chunk-QQQE6QUO.js.map → chunk-25G7PUTA.js.map} +0 -0
  175. /package/dist/{chunk-S2IDC6MO.js.map → chunk-2PJB6H3H.js.map} +0 -0
  176. /package/dist/{chunk-RIZQZKU6.js.map → chunk-3KBK5LU4.js.map} +0 -0
  177. /package/dist/{chunk-MT4YWJRW.js.map → chunk-3YKBGS3I.js.map} +0 -0
  178. /package/dist/{chunk-TSAT3E7Y.js.map → chunk-44DV37ZV.js.map} +0 -0
  179. /package/dist/{chunk-7A7LTSJR.js.map → chunk-4VDFUBTS.js.map} +0 -0
  180. /package/dist/{chunk-4I4UNXHM.js.map → chunk-5HRJQSKN.js.map} +0 -0
  181. /package/dist/{chunk-3IMGBWP7.js.map → chunk-5YBUFCFF.js.map} +0 -0
  182. /package/dist/{chunk-73C4RPMX.js.map → chunk-62APEMF3.js.map} +0 -0
  183. /package/dist/{chunk-GGFT2XFF.js.map → chunk-723XB5NX.js.map} +0 -0
  184. /package/dist/{chunk-C57J6AWN.js.map → chunk-BJ2XF2RC.js.map} +0 -0
  185. /package/dist/{chunk-T45LAT2Y.js.map → chunk-BTFTHF6Q.js.map} +0 -0
  186. /package/dist/{chunk-C2ZKWL37.js.map → chunk-DCVVCJVB.js.map} +0 -0
  187. /package/dist/{chunk-ZHK3F5RB.js.map → chunk-F3EKFGUS.js.map} +0 -0
  188. /package/dist/{chunk-3UUXDQPM.js.map → chunk-FWART3VA.js.map} +0 -0
  189. /package/dist/{chunk-C6A2DPRE.js.map → chunk-FZK3JJJK.js.map} +0 -0
  190. /package/dist/{chunk-E7MAS736.js.map → chunk-GDOOG5YQ.js.map} +0 -0
  191. /package/dist/{chunk-I7GTYPWF.js.map → chunk-GLVXQU3E.js.map} +0 -0
  192. /package/dist/{chunk-65FW3ALF.js.map → chunk-I6URUNTD.js.map} +0 -0
  193. /package/dist/{chunk-RXUFMTD5.js.map → chunk-IARAK3PK.js.map} +0 -0
  194. /package/dist/{chunk-DBBP35OP.js.map → chunk-J5YUA6JB.js.map} +0 -0
  195. /package/dist/{chunk-BYS45GOJ.js.map → chunk-J7OH6R4K.js.map} +0 -0
  196. /package/dist/{chunk-YFF2RP3X.js.map → chunk-L6Q5NA22.js.map} +0 -0
  197. /package/dist/{chunk-ML5UP7YN.js.map → chunk-M3OYTM5Z.js.map} +0 -0
  198. /package/dist/{chunk-UZZFV3O3.js.map → chunk-NTPWQH4S.js.map} +0 -0
  199. /package/dist/{chunk-VWGCJUTV.js.map → chunk-P2PEPSPK.js.map} +0 -0
  200. /package/dist/{chunk-XDWNF4BS.js.map → chunk-P6TZ3IVN.js.map} +0 -0
  201. /package/dist/{chunk-WQAT24C2.js.map → chunk-PMMV5SQC.js.map} +0 -0
  202. /package/dist/{chunk-PLQCXH75.js.map → chunk-PPPZIBKY.js.map} +0 -0
  203. /package/dist/{chunk-NL4HVTNO.js.map → chunk-QABECTNN.js.map} +0 -0
  204. /package/dist/{chunk-IVIGZTFH.js.map → chunk-QYMMMKOO.js.map} +0 -0
  205. /package/dist/{chunk-ZRJBLWKQ.js.map → chunk-R4IVPJHN.js.map} +0 -0
  206. /package/dist/{chunk-GEK6UGOJ.js.map → chunk-TCGVRKOS.js.map} +0 -0
  207. /package/dist/{chunk-RLP65PI3.js.map → chunk-TIAYXOEI.js.map} +0 -0
  208. /package/dist/{chunk-WAL4MRBK.js.map → chunk-TUL5YQWF.js.map} +0 -0
  209. /package/dist/{chunk-TWJVOYU2.js.map → chunk-UMH35AQV.js.map} +0 -0
  210. /package/dist/{chunk-SXLMLECV.js.map → chunk-VVLOWY74.js.map} +0 -0
  211. /package/dist/{chunk-HJZ3CTZ2.js.map → chunk-W3JABOVB.js.map} +0 -0
  212. /package/dist/{chunk-S55MJQUQ.js.map → chunk-WPNP3NF5.js.map} +0 -0
  213. /package/dist/{chunk-WAW4VFS7.js.map → chunk-X5QZAJDB.js.map} +0 -0
  214. /package/dist/{chunk-OLVIGEHQ.js.map → chunk-X6VNIRHS.js.map} +0 -0
  215. /package/dist/{chunk-CYWF3JJE.js.map → chunk-XBPUVQDO.js.map} +0 -0
  216. /package/dist/{collection-facade-5V3JS7SD.js.map → collection-facade-EJVIN2BY.js.map} +0 -0
  217. /package/dist/{config-drift-SWZNEH5H.js.map → config-drift-RFEVGBKR.js.map} +0 -0
  218. /package/dist/{dead-filter-MGWMNRO2.js.map → dead-filter-RHMNYOXP.js.map} +0 -0
  219. /package/dist/{delegation-AUY42TGU.js.map → delegation-IHXOASHV.js.map} +0 -0
  220. /package/dist/{derive-FWSEWWI7.js.map → derive-CD3ZVIXK.js.map} +0 -0
  221. /package/dist/{enclave-UYZGSE2C.js.map → enclave-KGEUW2GL.js.map} +0 -0
  222. /package/dist/{executor-XWPD5PIM.js.map → executor-MHUM2VZK.js.map} +0 -0
  223. /package/dist/{export-accessible-M54OI6FO.js.map → export-accessible-Z3NSZZHN.js.map} +0 -0
  224. /package/dist/{extract-partition-MIHAL6PP.js.map → extract-partition-VSKT35JG.js.map} +0 -0
  225. /package/dist/{fanout-sidecar-SSEW7BQB.js.map → fanout-sidecar-NBDKKCHT.js.map} +0 -0
  226. /package/dist/{issue-PHWTGH2G.js.map → issue-AEOL6RXA.js.map} +0 -0
  227. /package/dist/{ledger-IWWY7IIC.js.map → ledger-3LR3YO2W.js.map} +0 -0
  228. /package/dist/{liberate-QDTNV7SM.js.map → liberate-XSEPRWEA.js.map} +0 -0
  229. /package/dist/{link-set-HJOC7GB7.js.map → link-set-NSUIX6BR.js.map} +0 -0
  230. /package/dist/{noydb-Y5L74IDJ.js.map → noydb-POVTIVQ6.js.map} +0 -0
  231. /package/dist/{policy-3ZKSGSRK.js.map → policy-Y7HL2KGA.js.map} +0 -0
  232. /package/dist/{post-register-BIXGCZ2M.js.map → post-register-KOFRTCDD.js.map} +0 -0
  233. /package/dist/{public-envelope-6UBQ4IUY.js.map → public-envelope-NC7SPNMV.js.map} +0 -0
  234. /package/dist/{register-OVONZ2MJ.js.map → register-3D6R2MKN.js.map} +0 -0
  235. /package/dist/{registry-AIEYUOSG.js.map → registry-AI4E46PD.js.map} +0 -0
  236. /package/dist/{registry-D5J7SVJ2.js.map → registry-WIX6QCV5.js.map} +0 -0
  237. /package/dist/{request-withdrawal-IHF64VIT.js.map → request-withdrawal-GU4XS2R5.js.map} +0 -0
  238. /package/dist/{reveal-B77Q2BJW.js.map → reveal-5Y777N5Q.js.map} +0 -0
  239. /package/dist/{revoke-BPPOUZPE.js.map → revoke-ZFETCLYV.js.map} +0 -0
  240. /package/dist/{signer-MNQEL27B.js.map → signer-GAIMQQ2J.js.map} +0 -0
  241. /package/dist/{stale-COBBJORL.js.map → stale-77LP2EEF.js.map} +0 -0
  242. /package/dist/{storage-DVKYH7UU.js.map → storage-KEXIXLGM.js.map} +0 -0
  243. /package/dist/{store-coordination-provider-JJCEMTAE.js.map → store-coordination-provider-NJDDZ264.js.map} +0 -0
  244. /package/dist/{walk-CVNXFUEF.js.map → walk-SMAE4IEI.js.map} +0 -0
  245. /package/dist/{withdraw-accessible-5ALN3ZGM.js.map → withdraw-accessible-Q7BULAN5.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  loadVaultPolicy
3
- } from "./chunk-T45LAT2Y.js";
3
+ } from "./chunk-BTFTHF6Q.js";
4
4
  import {
5
5
  jsonSchemaToFields
6
6
  } from "./chunk-TQ3REHVF.js";
@@ -9,7 +9,7 @@ import {
9
9
  SEQUENCE_COLLECTION,
10
10
  compileSequenceFormat,
11
11
  resolveSequenceKey
12
- } from "./chunk-4I4UNXHM.js";
12
+ } from "./chunk-5HRJQSKN.js";
13
13
  import {
14
14
  LinkIntegrityError,
15
15
  isLinkCollectionName,
@@ -22,14 +22,14 @@ import {
22
22
  } from "./chunk-5JQMX2EH.js";
23
23
  import {
24
24
  loadFence
25
- } from "./chunk-YFF2RP3X.js";
25
+ } from "./chunk-L6Q5NA22.js";
26
26
  import {
27
27
  InvertedIndex,
28
28
  MemoryIndexStore,
29
29
  NO_SEARCH,
30
30
  VectorSet,
31
31
  buildPersistedIndexCallbacks
32
- } from "./chunk-CYWF3JJE.js";
32
+ } from "./chunk-XBPUVQDO.js";
33
33
  import {
34
34
  derivePersistedSchema,
35
35
  isZod4Schema
@@ -42,7 +42,7 @@ import {
42
42
  CustodyApi,
43
43
  NO_CARGO,
44
44
  NO_CUSTODY
45
- } from "./chunk-GGFT2XFF.js";
45
+ } from "./chunk-723XB5NX.js";
46
46
  import {
47
47
  ServiceBus,
48
48
  WriteHookRegistry,
@@ -50,7 +50,7 @@ import {
50
50
  assertCanImport,
51
51
  canExport,
52
52
  canImport
53
- } from "./chunk-NL4HVTNO.js";
53
+ } from "./chunk-QABECTNN.js";
54
54
  import {
55
55
  NO_ATTESTATION
56
56
  } from "./chunk-LFGJG4XZ.js";
@@ -62,7 +62,7 @@ import {
62
62
  import {
63
63
  NO_TIERS,
64
64
  classifySealedShred
65
- } from "./chunk-7A7LTSJR.js";
65
+ } from "./chunk-4VDFUBTS.js";
66
66
  import {
67
67
  NO_PORTABILITY
68
68
  } from "./chunk-II6DLDZM.js";
@@ -70,8 +70,12 @@ import {
70
70
  runDrainBarrier
71
71
  } from "./chunk-EU7HDMT3.js";
72
72
  import {
73
- PERIODS_COLLECTION
74
- } from "./chunk-OCVO2V63.js";
73
+ PERIODS_COLLECTION,
74
+ PERIOD_ARCHIVES_COLLECTION,
75
+ PERIOD_FREEZES_COLLECTION,
76
+ PERIOD_TARGET_PURGES_COLLECTION,
77
+ periodExclusiveUpperBound
78
+ } from "./chunk-37JZR7CY.js";
75
79
  import {
76
80
  TxContext,
77
81
  revertExecuted
@@ -83,7 +87,7 @@ import {
83
87
  EXPORT_AUDIT_COLLECTION,
84
88
  createExportBlobsHandle,
85
89
  runCompaction
86
- } from "./chunk-PLQCXH75.js";
90
+ } from "./chunk-PPPZIBKY.js";
87
91
  import {
88
92
  LazyQuery,
89
93
  decodeIdxId,
@@ -97,11 +101,11 @@ import {
97
101
  import {
98
102
  resolveManagedSecret,
99
103
  saveSealedPassphrase
100
- } from "./chunk-VWGCJUTV.js";
104
+ } from "./chunk-P2PEPSPK.js";
101
105
  import {
102
106
  isDictCollectionName,
103
107
  isStaticDictDescriptor
104
- } from "./chunk-WQAT24C2.js";
108
+ } from "./chunk-PMMV5SQC.js";
105
109
  import {
106
110
  NO_TEAM,
107
111
  enrollAuthenticator,
@@ -112,7 +116,7 @@ import {
112
116
  rotatePassphrase,
113
117
  updateAuthenticator,
114
118
  writeMagicLinkGrant
115
- } from "./chunk-UZZFV3O3.js";
119
+ } from "./chunk-NTPWQH4S.js";
116
120
  import {
117
121
  hasRecoveryEnrolled,
118
122
  hasStrongRecoveryEnrolled,
@@ -122,7 +126,7 @@ import {
122
126
  mintShamirRecoveryEntry,
123
127
  savePaperRecoveryEntries,
124
128
  saveShamirRecoveryEntries
125
- } from "./chunk-3UUXDQPM.js";
129
+ } from "./chunk-FWART3VA.js";
126
130
  import {
127
131
  INDEXED_STORE_POLICY
128
132
  } from "./chunk-VQNJ7UZL.js";
@@ -138,17 +142,17 @@ import {
138
142
  listUsers,
139
143
  loadKeyring,
140
144
  updateKeyringIdentity
141
- } from "./chunk-WAL4MRBK.js";
145
+ } from "./chunk-TUL5YQWF.js";
142
146
  import {
143
147
  persistDirectoryConfig,
144
148
  readDirectoryConfig
145
- } from "./chunk-C6A2DPRE.js";
149
+ } from "./chunk-FZK3JJJK.js";
146
150
  import {
147
151
  generateULID
148
152
  } from "./chunk-ZJADGNYF.js";
149
153
  import {
150
154
  sha256Hex
151
- } from "./chunk-TWJVOYU2.js";
155
+ } from "./chunk-UMH35AQV.js";
152
156
  import {
153
157
  NO_FORGET,
154
158
  addSubjectRef,
@@ -157,7 +161,7 @@ import {
157
161
  readDottedPath,
158
162
  rebuildSubjectIndex,
159
163
  removeSubjectRef
160
- } from "./chunk-SXLMLECV.js";
164
+ } from "./chunk-VVLOWY74.js";
161
165
  import {
162
166
  NO_SEALED_RECORD
163
167
  } from "./chunk-XW5LZYV4.js";
@@ -170,14 +174,16 @@ import {
170
174
  queryByDet,
171
175
  resolveStableCek,
172
176
  validateSchemaInput
173
- } from "./chunk-7AGLCOYE.js";
177
+ } from "./chunk-7TAV3BFQ.js";
174
178
  import {
179
+ buildDeleteMarker,
175
180
  buildTombstone,
181
+ isDeleteMarker,
176
182
  isTombstone
177
- } from "./chunk-QKVILR7N.js";
183
+ } from "./chunk-PVC2FBCQ.js";
178
184
  import {
179
185
  NOYDB_FORMAT_VERSION
180
- } from "./chunk-LN22XH4B.js";
186
+ } from "./chunk-REWTMYSF.js";
181
187
  import {
182
188
  encrypt
183
189
  } from "./chunk-5HZULLHE.js";
@@ -240,7 +246,7 @@ import {
240
246
 
241
247
  // src/port/by/default-provider.ts
242
248
  async function createDefaultCoordinationProvider(store) {
243
- const { StoreCoordinationProvider } = await import("./store-coordination-provider-JJCEMTAE.js");
249
+ const { StoreCoordinationProvider } = await import("./store-coordination-provider-NJDDZ264.js");
244
250
  return new StoreCoordinationProvider(store);
245
251
  }
246
252
 
@@ -2373,7 +2379,7 @@ var Collection = class {
2373
2379
  }
2374
2380
  }
2375
2381
  if (this.materializedViewSource !== void 0) {
2376
- const { resolveStaleMVOnRead } = await import("./stale-COBBJORL.js");
2382
+ const { resolveStaleMVOnRead } = await import("./stale-77LP2EEF.js");
2377
2383
  await resolveStaleMVOnRead(this.materializedViewSource, this.name);
2378
2384
  }
2379
2385
  let record;
@@ -2384,7 +2390,7 @@ var Collection = class {
2384
2390
  } else {
2385
2391
  const envelope = await this.adapter.get(this.vault, this.name, id);
2386
2392
  if (!envelope) return null;
2387
- if (isTombstone(envelope, this.storeCiphertext)) return null;
2393
+ if (isTombstone(envelope, this.storeCiphertext) || isDeleteMarker(envelope)) return null;
2388
2394
  record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
2389
2395
  if (record === null) return null;
2390
2396
  this.lru.set(id, { record, version: envelope._v }, estimateRecordBytes(record));
@@ -2834,14 +2840,15 @@ var Collection = class {
2834
2840
  return;
2835
2841
  }
2836
2842
  let existing;
2843
+ let priorRaw = null;
2837
2844
  if (this.lazy && this.lru) {
2838
2845
  existing = this.lru.get(id);
2839
2846
  if (!existing) {
2840
- const previousEnvelope = await this.adapter.get(this.vault, this.name, id);
2841
- if (previousEnvelope) {
2842
- const previousRecord = await this.codec.decryptRecord(previousEnvelope);
2847
+ priorRaw = await this.adapter.get(this.vault, this.name, id);
2848
+ if (priorRaw) {
2849
+ const previousRecord = await this.codec.decryptRecord(priorRaw);
2843
2850
  if (previousRecord !== null) {
2844
- existing = { record: previousRecord, version: previousEnvelope._v };
2851
+ existing = { record: previousRecord, version: priorRaw._v };
2845
2852
  }
2846
2853
  }
2847
2854
  }
@@ -2849,7 +2856,11 @@ var Collection = class {
2849
2856
  await this.ensureHydrated();
2850
2857
  existing = await this.resolvePriorValues(id);
2851
2858
  }
2852
- const version = existing ? existing.version + 1 : 1;
2859
+ let version = existing ? existing.version + 1 : 1;
2860
+ if (!existing && this.onDirty) {
2861
+ if (priorRaw === null) priorRaw = await this.adapter.get(this.vault, this.name, id);
2862
+ if (priorRaw && isDeleteMarker(priorRaw)) version = priorRaw._v + 1;
2863
+ }
2853
2864
  this.uniqueConstraints?.check(id, record);
2854
2865
  const cek = this.perRecordCek ? await this.resolveRecordCek(id) : void 0;
2855
2866
  const vdigCtx = this.vdigFields !== null ? { id, prev: await this.adapter.get(this.vault, this.name, id) } : void 0;
@@ -2936,7 +2947,7 @@ var Collection = class {
2936
2947
  if (mode === "eager") {
2937
2948
  if (executor === null) {
2938
2949
  ;
2939
- ({ MaterializedViewExecutor: executor } = await import("./executor-XWPD5PIM.js"));
2950
+ ({ MaterializedViewExecutor: executor } = await import("./executor-MHUM2VZK.js"));
2940
2951
  }
2941
2952
  await executor.refresh(reg, {
2942
2953
  getCollection: (name) => this.materializedViewSource.getCollection(name),
@@ -2945,7 +2956,7 @@ var Collection = class {
2945
2956
  });
2946
2957
  } else if (mode === "lazy") {
2947
2958
  if (staleHelpers === null) {
2948
- staleHelpers = await import("./stale-COBBJORL.js");
2959
+ staleHelpers = await import("./stale-77LP2EEF.js");
2949
2960
  }
2950
2961
  staleHelpers.markMVStale(registry, reg.spec.name);
2951
2962
  }
@@ -2975,7 +2986,7 @@ var Collection = class {
2975
2986
  if (this.sensitiveFields.size > 0) {
2976
2987
  const cached = this.lru.get(id);
2977
2988
  const env = await this.adapter.get(this.vault, this.name, id);
2978
- if (!env || isTombstone(env, this.storeCiphertext)) return null;
2989
+ if (!env || isTombstone(env, this.storeCiphertext) || isDeleteMarker(env)) return null;
2979
2990
  raw = await this.codec.decryptRecord(env, { id });
2980
2991
  if (raw === null) return null;
2981
2992
  if (!cached) {
@@ -2986,7 +2997,7 @@ var Collection = class {
2986
2997
  if (cached) raw = cached.record;
2987
2998
  else {
2988
2999
  const env = await this.adapter.get(this.vault, this.name, id);
2989
- if (!env || isTombstone(env, this.storeCiphertext)) return null;
3000
+ if (!env || isTombstone(env, this.storeCiphertext) || isDeleteMarker(env)) return null;
2990
3001
  raw = await this.codec.decryptRecord(env, { id });
2991
3002
  if (raw === null) return null;
2992
3003
  this.lru.set(id, { record: raw, version: env._v }, estimateRecordBytes(raw));
@@ -3149,7 +3160,7 @@ var Collection = class {
3149
3160
  const outputCollection = this.derivationSource.getCollection(outSpec.collection);
3150
3161
  const txCtx = this.derivationSource.getActiveTxContext();
3151
3162
  if (out.kind === "array") {
3152
- const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-SSEW7BQB.js");
3163
+ const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-NBDKKCHT.js");
3153
3164
  const prior = await loadFanoutSidecar(this.adapter, this.vault, spec.source, run.runId, key, this.getDEK, this.storeCiphertext);
3154
3165
  const prevKeys = new Set(prior?.keys ?? []);
3155
3166
  const newKeysList = out.entries.map((e) => e.key);
@@ -3269,7 +3280,7 @@ var Collection = class {
3269
3280
  let count = 0;
3270
3281
  for (const id of ids) {
3271
3282
  const env = await this.adapter.get(this.vault, this.name, id);
3272
- if (!env || isTombstone(env, this.storeCiphertext)) continue;
3283
+ if (!env || isTombstone(env, this.storeCiphertext) || isDeleteMarker(env)) continue;
3273
3284
  const decoded = await this.codec.decryptRecord(env, { skipValidation: true, id });
3274
3285
  if (decoded === null) continue;
3275
3286
  const record = decoded;
@@ -3398,7 +3409,15 @@ var Collection = class {
3398
3409
  }
3399
3410
  const previousEnvelope = await this.adapter.get(this.vault, this.name, id);
3400
3411
  const previousPayloadHash = await this.historyStrategy.envelopePayloadHash(previousEnvelope);
3401
- await this.adapter.delete(this.vault, this.name, id);
3412
+ let markerVersion;
3413
+ if (this.onDirty) {
3414
+ const live = previousEnvelope;
3415
+ if (!live || isTombstone(live, this.storeCiphertext) || isDeleteMarker(live)) return;
3416
+ markerVersion = live._v + 1;
3417
+ await this.adapter.put(this.vault, this.name, id, buildDeleteMarker(markerVersion, this.keyring.userId));
3418
+ } else {
3419
+ await this.adapter.delete(this.vault, this.name, id);
3420
+ }
3402
3421
  if (this.ledger) {
3403
3422
  await this.ledger.append({
3404
3423
  op: "delete",
@@ -3421,7 +3440,7 @@ var Collection = class {
3421
3440
  this.uniqueConstraints?.remove(id, existing.record);
3422
3441
  }
3423
3442
  }
3424
- await this.onDirty?.(this.name, id, "delete", existing?.version ?? 0);
3443
+ await this.onDirty?.(this.name, id, "put", markerVersion ?? (existing?.version ?? 0) + 1);
3425
3444
  this.emitter.emit("change", {
3426
3445
  vault: this.vault,
3427
3446
  collection: this.name,
@@ -3473,11 +3492,12 @@ var Collection = class {
3473
3492
  }
3474
3493
  async _writeTombstone(id, actor) {
3475
3494
  const live = await this.adapter.get(this.vault, this.name, id);
3476
- if (!live || isTombstone(live, this.storeCiphertext)) return null;
3495
+ if (!live || isTombstone(live, this.storeCiphertext) || isDeleteMarker(live)) return null;
3477
3496
  await this.adapter.put(this.vault, this.name, id, buildTombstone(live._v, actor));
3478
3497
  this.cache.delete(id);
3479
3498
  this.lru?.remove(id);
3480
3499
  this.cekCache?.remove(id);
3500
+ await this.onDirty?.(this.name, id, "put", live._v);
3481
3501
  return { previousVersion: live._v };
3482
3502
  }
3483
3503
  /**
@@ -3502,7 +3522,7 @@ var Collection = class {
3502
3522
  for (const [outputKey, outSpec] of Object.entries(spec.outputs)) {
3503
3523
  if (outSpec.shape !== "array") continue;
3504
3524
  if (helpers === null) {
3505
- helpers = await import("./fanout-sidecar-SSEW7BQB.js");
3525
+ helpers = await import("./fanout-sidecar-NBDKKCHT.js");
3506
3526
  }
3507
3527
  const sidecar = await helpers.loadFanoutSidecar(this.adapter, this.vault, spec.source, id, outputKey, this.getDEK, this.storeCiphertext);
3508
3528
  if (!sidecar) continue;
@@ -3536,7 +3556,7 @@ var Collection = class {
3536
3556
  if (mode === "eager") {
3537
3557
  if (executor === null) {
3538
3558
  ;
3539
- ({ MaterializedViewExecutor: executor } = await import("./executor-XWPD5PIM.js"));
3559
+ ({ MaterializedViewExecutor: executor } = await import("./executor-MHUM2VZK.js"));
3540
3560
  }
3541
3561
  await executor.refresh(reg, {
3542
3562
  getCollection: (name) => this.materializedViewSource.getCollection(name),
@@ -3545,7 +3565,7 @@ var Collection = class {
3545
3565
  });
3546
3566
  } else if (mode === "lazy") {
3547
3567
  if (staleHelpers === null) {
3548
- staleHelpers = await import("./stale-COBBJORL.js");
3568
+ staleHelpers = await import("./stale-77LP2EEF.js");
3549
3569
  }
3550
3570
  staleHelpers.markMVStale(registry, reg.spec.name);
3551
3571
  }
@@ -3568,7 +3588,7 @@ var Collection = class {
3568
3588
  );
3569
3589
  }
3570
3590
  if (this.materializedViewSource !== void 0) {
3571
- const { resolveStaleMVOnRead } = await import("./stale-COBBJORL.js");
3591
+ const { resolveStaleMVOnRead } = await import("./stale-77LP2EEF.js");
3572
3592
  await resolveStaleMVOnRead(this.materializedViewSource, this.name);
3573
3593
  }
3574
3594
  await this.ensureHydrated();
@@ -4261,7 +4281,7 @@ var Collection = class {
4261
4281
  const ids = await this.adapter.list(this.vault, this.name);
4262
4282
  for (const id of ids) {
4263
4283
  const envelope = await this.adapter.get(this.vault, this.name, id);
4264
- if (envelope && !isTombstone(envelope, this.storeCiphertext)) {
4284
+ if (envelope && !isTombstone(envelope, this.storeCiphertext) && !isDeleteMarker(envelope)) {
4265
4285
  const record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
4266
4286
  if (record === null) continue;
4267
4287
  this.cache.set(id, { record, version: envelope._v });
@@ -4274,7 +4294,7 @@ var Collection = class {
4274
4294
  /** Hydrate from a pre-loaded snapshot (used by Vault). */
4275
4295
  async hydrateFromSnapshot(records) {
4276
4296
  for (const [id, envelope] of Object.entries(records)) {
4277
- if (isTombstone(envelope, this.storeCiphertext)) continue;
4297
+ if (isTombstone(envelope, this.storeCiphertext) || isDeleteMarker(envelope)) continue;
4278
4298
  const record = await this.codec.decryptRecord(envelope, { id, sealedAsHandles: true });
4279
4299
  if (record === null) continue;
4280
4300
  this.cache.set(id, { record, version: envelope._v });
@@ -4722,14 +4742,14 @@ var Collection = class {
4722
4742
  /** C-A/R10: persist the classified marker once per classified handle (store I/O in config-drift.ts). */
4723
4743
  async _ensureClassifiedMarker() {
4724
4744
  if (this._markerPersisted || this.vdigFields === null) return;
4725
- const { persistClassifiedMarkerForFields } = await import("./config-drift-SWZNEH5H.js");
4745
+ const { persistClassifiedMarkerForFields } = await import("./config-drift-RFEVGBKR.js");
4726
4746
  await persistClassifiedMarkerForFields(this.adapter, this.vault, this.name, this.vdigFields, await this.getDEK(this.name));
4727
4747
  this._markerPersisted = true;
4728
4748
  }
4729
4749
  /** C-A/R10 drift signal — the marker's declared digest-only set, memoized to one store read per handle (see config-drift.ts). */
4730
4750
  async _classifiedMarkerDigestOnly() {
4731
4751
  if (this._markerDigestOnlyCache !== void 0) return this._markerDigestOnlyCache;
4732
- const { readClassifiedMarkerDigestOnly } = await import("./config-drift-SWZNEH5H.js");
4752
+ const { readClassifiedMarkerDigestOnly } = await import("./config-drift-RFEVGBKR.js");
4733
4753
  this._markerDigestOnlyCache = await readClassifiedMarkerDigestOnly(this.adapter, this.vault, this.name, await this.getDEK(this.name));
4734
4754
  return this._markerDigestOnlyCache;
4735
4755
  }
@@ -5208,7 +5228,7 @@ var VaultPeriods = class {
5208
5228
  ...anchor.priorPeriodName !== void 0 && { priorPeriodName: anchor.priorPeriodName },
5209
5229
  ...options.dateField !== void 0 && { dateField: options.dateField }
5210
5230
  };
5211
- const envelope = await this.writePeriodRecord(record);
5231
+ const envelope = await this.writeReserved(PERIODS_COLLECTION, record.name, record);
5212
5232
  await this.deps.strategy.appendPeriodLedgerEntry(this.deps.getLedgerOrNull(), this.deps.userId(), envelope, record.name);
5213
5233
  existing.push(record);
5214
5234
  this.periodCache = existing;
@@ -5263,20 +5283,208 @@ var VaultPeriods = class {
5263
5283
  priorPeriodName: anchor.priorPeriodName ?? prior.name,
5264
5284
  ...openingCollections.length > 0 && { openingCollections }
5265
5285
  };
5266
- const envelope = await this.writePeriodRecord(record);
5286
+ const envelope = await this.writeReserved(PERIODS_COLLECTION, record.name, record);
5267
5287
  await this.deps.strategy.appendPeriodLedgerEntry(this.deps.getLedgerOrNull(), this.deps.userId(), envelope, record.name);
5268
5288
  existing.push(record);
5269
5289
  this.periodCache = existing;
5270
5290
  return record;
5271
5291
  }
5272
- /** Return every closed / opened period in `closedAt` order. */
5292
+ /**
5293
+ * Freeze a closed period: physically purges delete markers whose `_ts`
5294
+ * falls inside the period's window (#604) and records the fact in a
5295
+ * companion `_period_freezes/<name>` record. NEVER mutates the
5296
+ * hash-chained `_periods/<name>` record's stored bytes — `frozenAt` /
5297
+ * `frozenBy` / `purgedMarkerCount` are merged into `PeriodRecord`s on
5298
+ * read only. Idempotent: a second call is a no-op that returns the
5299
+ * same merged record without re-purging or re-appending a ledger entry.
5300
+ */
5301
+ async freezePeriod(name) {
5302
+ const existing = await this.loadPeriodsCache();
5303
+ const period = existing.find((p) => p.name === name);
5304
+ if (!period) throw new ValidationError(`freezePeriod: no period named "${name}".`);
5305
+ if (period.kind !== "closed") {
5306
+ throw new ValidationError(
5307
+ `freezePeriod: period "${name}" is "${period.kind}"; only a closed period can be frozen.`
5308
+ );
5309
+ }
5310
+ const before = periodExclusiveUpperBound(period.endDate);
5311
+ if (Date.parse(before) > Date.now()) {
5312
+ throw new ValidationError(
5313
+ `freezePeriod: period "${name}" purge window ends at ${before}, in the future; only a period whose window is fully in the past can be frozen (recent delete markers may not have converged).`
5314
+ );
5315
+ }
5316
+ const prior = await this.readReserved(PERIOD_FREEZES_COLLECTION, name);
5317
+ if (prior) return this.mergeFreeze(period, prior);
5318
+ const purgedMarkerCount = await this.deps.purgeDeleteMarkers(before);
5319
+ const freeze = {
5320
+ period: name,
5321
+ frozenAt: (/* @__PURE__ */ new Date()).toISOString(),
5322
+ frozenBy: this.deps.userId(),
5323
+ purgedMarkerCount
5324
+ };
5325
+ const envelope = await this.writeReserved(PERIOD_FREEZES_COLLECTION, name, freeze);
5326
+ await this.deps.strategy.appendPeriodLedgerEntry(
5327
+ this.deps.getLedgerOrNull(),
5328
+ this.deps.userId(),
5329
+ envelope,
5330
+ name,
5331
+ PERIOD_FREEZES_COLLECTION
5332
+ );
5333
+ return this.mergeFreeze(period, freeze);
5334
+ }
5335
+ /**
5336
+ * Archive a closed period (#613): physically relocates its in-window
5337
+ * records (those with `_ts < periodExclusiveUpperBound(endDate)`) from the
5338
+ * hot store to the configured cold tier via `archiveRecords`, and records
5339
+ * the fact in a companion `_period_archives/<name>` record. NEVER mutates
5340
+ * the hash-chained `_periods/<name>` record. Non-destructive (reads fall
5341
+ * through to cold) and idempotent: a second call is a no-op returning the
5342
+ * same merged record.
5343
+ */
5344
+ async archivePeriod(name) {
5345
+ const existing = await this.loadPeriodsCache();
5346
+ const period = existing.find((p) => p.name === name);
5347
+ if (!period) throw new ValidationError(`archivePeriod: no period named "${name}".`);
5348
+ if (period.kind !== "closed") {
5349
+ throw new ValidationError(
5350
+ `archivePeriod: period "${name}" is "${period.kind}"; only a closed period can be archived.`
5351
+ );
5352
+ }
5353
+ const prior = await this.readReserved(PERIOD_ARCHIVES_COLLECTION, name);
5354
+ if (prior) return this.mergeArchive(period, prior);
5355
+ const before = periodExclusiveUpperBound(period.endDate);
5356
+ const archivedRecordCount = await this.deps.archiveRecords(before);
5357
+ const archive = {
5358
+ period: name,
5359
+ archivedAt: (/* @__PURE__ */ new Date()).toISOString(),
5360
+ archivedBy: this.deps.userId(),
5361
+ archivedRecordCount
5362
+ };
5363
+ const envelope = await this.writeReserved(PERIOD_ARCHIVES_COLLECTION, name, archive);
5364
+ await this.deps.strategy.appendPeriodLedgerEntry(
5365
+ this.deps.getLedgerOrNull(),
5366
+ this.deps.userId(),
5367
+ envelope,
5368
+ name,
5369
+ PERIOD_ARCHIVES_COLLECTION
5370
+ );
5371
+ return this.mergeArchive(period, archive);
5372
+ }
5373
+ /**
5374
+ * Target-purge a closed period (#615): sweeps delete markers off the vault's
5375
+ * PUSH-ONLY sync targets (`backup`/`archive`) via `purgeTargets`, recording a
5376
+ * companion `_period_target_purges/<name>` record. `sync-peer` targets are
5377
+ * skipped (resurrection risk). NEVER mutates the chained `_periods/<name>`
5378
+ * record. Requires the period be frozen first (closed → frozen → target-purged).
5379
+ * Idempotent once run; with no push-only targets it writes no companion and
5380
+ * is re-runnable.
5381
+ */
5382
+ async purgePeriodTargets(name) {
5383
+ const existing = await this.loadPeriodsCache();
5384
+ const period = existing.find((p) => p.name === name);
5385
+ if (!period) throw new ValidationError(`purgePeriodTargets: no period named "${name}".`);
5386
+ if (period.kind !== "closed") {
5387
+ throw new ValidationError(
5388
+ `purgePeriodTargets: period "${name}" is "${period.kind}"; only a closed period can be target-purged.`
5389
+ );
5390
+ }
5391
+ const frozen = await this.readReserved(PERIOD_FREEZES_COLLECTION, name);
5392
+ if (!frozen) {
5393
+ throw new ValidationError(
5394
+ `purgePeriodTargets: period "${name}" must be frozen first (closed \u2192 frozen \u2192 target-purged).`
5395
+ );
5396
+ }
5397
+ const prior = await this.readReserved(PERIOD_TARGET_PURGES_COLLECTION, name);
5398
+ if (prior) return this.mergeTargetPurge(period, prior);
5399
+ const before = periodExclusiveUpperBound(period.endDate);
5400
+ const targets = await this.deps.purgeTargets(before);
5401
+ if (targets.length === 0) return period;
5402
+ const record = {
5403
+ period: name,
5404
+ purgedAt: (/* @__PURE__ */ new Date()).toISOString(),
5405
+ purgedBy: this.deps.userId(),
5406
+ targets
5407
+ };
5408
+ const envelope = await this.writeReserved(PERIOD_TARGET_PURGES_COLLECTION, name, record);
5409
+ await this.deps.strategy.appendPeriodLedgerEntry(
5410
+ this.deps.getLedgerOrNull(),
5411
+ this.deps.userId(),
5412
+ envelope,
5413
+ name,
5414
+ PERIOD_TARGET_PURGES_COLLECTION
5415
+ );
5416
+ return this.mergeTargetPurge(period, record);
5417
+ }
5418
+ /** Merge target-purge companion fields into a fresh `PeriodRecord` copy — never mutates `periodCache`. */
5419
+ mergeTargetPurge(period, record) {
5420
+ return {
5421
+ ...period,
5422
+ targetsPurgedAt: record.purgedAt,
5423
+ targetsPurgedBy: record.purgedBy,
5424
+ targetsPurged: record.targets
5425
+ };
5426
+ }
5427
+ /** Merge archive companion fields into a fresh `PeriodRecord` copy — never mutates `periodCache`. */
5428
+ mergeArchive(period, archive) {
5429
+ return {
5430
+ ...period,
5431
+ archivedAt: archive.archivedAt,
5432
+ archivedBy: archive.archivedBy,
5433
+ archivedRecordCount: archive.archivedRecordCount
5434
+ };
5435
+ }
5436
+ /** Merge freeze companion fields into a fresh `PeriodRecord` copy — never mutates `periodCache`. */
5437
+ mergeFreeze(period, freeze) {
5438
+ return {
5439
+ ...period,
5440
+ frozenAt: freeze.frozenAt,
5441
+ frozenBy: freeze.frozenBy,
5442
+ purgedMarkerCount: freeze.purgedMarkerCount
5443
+ };
5444
+ }
5445
+ /** Return every closed / opened period in `closedAt` order, merged with any freeze + archive companions. */
5273
5446
  async listPeriods() {
5274
- return [...await this.loadPeriodsCache()];
5447
+ const all = await this.loadPeriodsCache();
5448
+ const freezeIds = await this.deps.adapter.list(this.deps.vault, PERIOD_FREEZES_COLLECTION);
5449
+ const freezes = /* @__PURE__ */ new Map();
5450
+ for (const id of freezeIds) {
5451
+ const f = await this.readReserved(PERIOD_FREEZES_COLLECTION, id);
5452
+ if (f) freezes.set(f.period, f);
5453
+ }
5454
+ const archiveIds = await this.deps.adapter.list(this.deps.vault, PERIOD_ARCHIVES_COLLECTION);
5455
+ const archives = /* @__PURE__ */ new Map();
5456
+ for (const id of archiveIds) {
5457
+ const a = await this.readReserved(PERIOD_ARCHIVES_COLLECTION, id);
5458
+ if (a) archives.set(a.period, a);
5459
+ }
5460
+ const targetPurgeIds = await this.deps.adapter.list(this.deps.vault, PERIOD_TARGET_PURGES_COLLECTION);
5461
+ const targetPurges = /* @__PURE__ */ new Map();
5462
+ for (const id of targetPurgeIds) {
5463
+ const tp = await this.readReserved(PERIOD_TARGET_PURGES_COLLECTION, id);
5464
+ if (tp) targetPurges.set(tp.period, tp);
5465
+ }
5466
+ return all.map((p) => {
5467
+ const f = freezes.get(p.name);
5468
+ let merged = f ? this.mergeFreeze(p, f) : p;
5469
+ const a = archives.get(p.name);
5470
+ if (a) merged = this.mergeArchive(merged, a);
5471
+ const tp = targetPurges.get(p.name);
5472
+ if (tp) merged = this.mergeTargetPurge(merged, tp);
5473
+ return merged;
5474
+ });
5275
5475
  }
5276
- /** Look up a single period by name. Returns `null` if not found. */
5476
+ /** Look up a single period by name, merged with its freeze + archive + target-purge companions if any. Returns `null` if not found. */
5277
5477
  async getPeriod(name) {
5278
5478
  const all = await this.loadPeriodsCache();
5279
- return all.find((p) => p.name === name) ?? null;
5479
+ const period = all.find((p) => p.name === name);
5480
+ if (!period) return null;
5481
+ const freeze = await this.readReserved(PERIOD_FREEZES_COLLECTION, name);
5482
+ const archive = await this.readReserved(PERIOD_ARCHIVES_COLLECTION, name);
5483
+ let merged = freeze ? this.mergeFreeze(period, freeze) : period;
5484
+ if (archive) merged = this.mergeArchive(merged, archive);
5485
+ const targetPurge = await this.readReserved(PERIOD_TARGET_PURGES_COLLECTION, name);
5486
+ if (targetPurge) merged = this.mergeTargetPurge(merged, targetPurge);
5487
+ return merged;
5280
5488
  }
5281
5489
  /** Called by the gate bus before put/delete. */
5282
5490
  async assertTsWritable(existing, incoming) {
@@ -5301,11 +5509,12 @@ var VaultPeriods = class {
5301
5509
  this.periodCache = loaded;
5302
5510
  return loaded;
5303
5511
  }
5304
- async writePeriodRecord(record) {
5305
- const json = JSON.stringify(record);
5512
+ /** Generic reserved-collection writer — serves `_periods` and `_period_freezes` alike. */
5513
+ async writeReserved(collection, key, value) {
5514
+ const json = JSON.stringify(value);
5306
5515
  let envelope;
5307
5516
  if (this.deps.encrypted) {
5308
- const dek = await this.deps.getDEK(PERIODS_COLLECTION);
5517
+ const dek = await this.deps.getDEK(collection);
5309
5518
  const { iv, data } = await encrypt(json, dek);
5310
5519
  envelope = {
5311
5520
  _noydb: NOYDB_FORMAT_VERSION,
@@ -5325,9 +5534,16 @@ var VaultPeriods = class {
5325
5534
  _by: this.deps.userId()
5326
5535
  };
5327
5536
  }
5328
- await this.deps.adapter.put(this.deps.vault, PERIODS_COLLECTION, record.name, envelope);
5537
+ await this.deps.adapter.put(this.deps.vault, collection, key, envelope);
5329
5538
  return envelope;
5330
5539
  }
5540
+ /** Generic reserved-collection reader — serves `_period_freezes` companion reads. */
5541
+ async readReserved(collection, key) {
5542
+ const env = await this.deps.adapter.get(this.deps.vault, collection, key);
5543
+ if (!env) return null;
5544
+ const json = this.deps.encrypted ? await openEnvelopeJson(env, await this.deps.getDEK(collection)) : env._data;
5545
+ return JSON.parse(json);
5546
+ }
5331
5547
  async decryptPeriodRecord(envelope) {
5332
5548
  let json;
5333
5549
  if (this.deps.encrypted) {
@@ -5776,7 +5992,7 @@ var VaultLinks = class {
5776
5992
  // src/with-shape/links/lazy-handle.ts
5777
5993
  function makeLazyLinkSetHandle(d) {
5778
5994
  let engine = null;
5779
- const load = () => engine ??= import("./link-set-HJOC7GB7.js").then(
5995
+ const load = () => engine ??= import("./link-set-NSUIX6BR.js").then(
5780
5996
  ({ LinkSet }) => new LinkSet(d.adapter, d.vault, d.name, d.spec, d.encrypted, d.getDEK, d.actor, d.emitter, d.endpointExists)
5781
5997
  );
5782
5998
  return {
@@ -5900,7 +6116,7 @@ function declareSatellite(ctx, collectionName, options, existingRegistry) {
5900
6116
  ctx.forEachSyncEngine((e) => e.remirrorPairResolvers([spec.base, spec.satellite]));
5901
6117
  const registry = reg;
5902
6118
  const baseSchema = ctx.getBaseSchema(spec.base);
5903
- void import("./post-register-BIXGCZ2M.js").then((m) => m.postRegister(ctx.adapter, ctx.vaultName, spec, ctx.getDEK, baseSchema, registry)).catch(() => {
6119
+ void import("./post-register-KOFRTCDD.js").then((m) => m.postRegister(ctx.adapter, ctx.vaultName, spec, ctx.getDEK, baseSchema, registry)).catch(() => {
5904
6120
  });
5905
6121
  return reg;
5906
6122
  }
@@ -6431,6 +6647,7 @@ var Vault = class {
6431
6647
  onDirty;
6432
6648
  onRegisterConflictResolver;
6433
6649
  syncAdapter;
6650
+ getPurgeableTargets;
6434
6651
  historyConfig;
6435
6652
  /**
6436
6653
  * tree-shake seam for the optional blob service. Undefined
@@ -6696,6 +6913,7 @@ var Vault = class {
6696
6913
  this.onDirty = opts.onDirty;
6697
6914
  this.onRegisterConflictResolver = opts.onRegisterConflictResolver;
6698
6915
  this.syncAdapter = opts.syncAdapter;
6916
+ this.getPurgeableTargets = opts.getPurgeableTargets ?? (() => []);
6699
6917
  this.blobStrategy = opts.blobStrategy;
6700
6918
  this.objectStore = opts.objectStore;
6701
6919
  this.archiveStrategy = opts.archiveStrategy;
@@ -6718,7 +6936,10 @@ var Vault = class {
6718
6936
  userId: () => this.keyring.userId,
6719
6937
  getDEK: (collection) => this.getDEK(collection),
6720
6938
  getLedgerOrNull: () => this.getLedgerOrNull(),
6721
- collection: (name) => this.collection(name)
6939
+ collection: (name) => this.collection(name),
6940
+ purgeDeleteMarkers: (before) => this._purgeDeleteMarkers(before),
6941
+ archiveRecords: (before) => this._archiveClosedPeriod(before),
6942
+ purgeTargets: (before) => this._purgePeriodTargets(before)
6722
6943
  });
6723
6944
  this.linksEnforcer = new VaultLinks({
6724
6945
  refRegistry: this.refRegistry,
@@ -6921,7 +7142,7 @@ var Vault = class {
6921
7142
  const strategies = options.schemaUpdate ?? [];
6922
7143
  const work = (async () => {
6923
7144
  const dek = await this.getDEK(collectionName);
6924
- const { persistSchemaIfNeeded } = await import("./register-OVONZ2MJ.js");
7145
+ const { persistSchemaIfNeeded } = await import("./register-3D6R2MKN.js");
6925
7146
  const result = await persistSchemaIfNeeded({
6926
7147
  store: this.adapter,
6927
7148
  vault: this.name,
@@ -7100,7 +7321,7 @@ var Vault = class {
7100
7321
  const work = (async () => {
7101
7322
  try {
7102
7323
  const dek = await this.getDEK(collectionName);
7103
- await (await import("./register-OVONZ2MJ.js")).persistSchemaIfNeeded({
7324
+ await (await import("./register-3D6R2MKN.js")).persistSchemaIfNeeded({
7104
7325
  store: this.adapter,
7105
7326
  vault: this.name,
7106
7327
  collectionName,
@@ -7175,6 +7396,83 @@ var Vault = class {
7175
7396
  if (!coll) return;
7176
7397
  await coll._applyRemoteChange(docId, action);
7177
7398
  }
7399
+ /** @internal #598: refresh cache entries a sync-applied write rewrote underneath us. No-op if not loaded this session. */
7400
+ async _invalidateSyncApplied(collection, id) {
7401
+ const coll = this.collectionCache.get(collection);
7402
+ if (!coll) return;
7403
+ coll._invalidateCekCacheEntry(id);
7404
+ await coll._invalidateCacheEntry(id);
7405
+ }
7406
+ /**
7407
+ * @internal #589 → #604. Physically remove delete markers with `_ts` strictly
7408
+ * older than `before` (ISO timestamp), across `collections` (or all data
7409
+ * collections). Returns the count removed.
7410
+ *
7411
+ * SAFETY: purging a marker RE-OPENS the #589 resurrection window for any peer
7412
+ * offline since before the cutoff — never-GC is safe precisely because the marker
7413
+ * is always present to win convergence. This is an operator-asserted safe-point
7414
+ * ONLY; #604's period-close lifecycle is what earns that assertion. Do not call
7415
+ * it on live/unsettled data.
7416
+ *
7417
+ * Emits no ledger/event itself — its callers (#604's `freezePeriod`, #615's
7418
+ * `purgePeriodTargets`) own the audit record. The sweep body is shared via
7419
+ * {@link _purgeMarkersOn}, which #615 also aims at push-only sync targets.
7420
+ *
7421
+ * Purges the local adapter only. Markers already pushed to the vault's
7422
+ * push-only (`backup`/`archive`) sync targets are reclaimed by #615's
7423
+ * `vault.purgePeriodTargets`; `sync-peer` targets are left untouched (purging
7424
+ * them would re-open the resurrection window — the deferred half of #611).
7425
+ */
7426
+ async _purgeDeleteMarkers(before, collections) {
7427
+ return this._purgeMarkersOn(this.adapter, before, collections);
7428
+ }
7429
+ /**
7430
+ * @internal #615. Sweep delete markers with `_ts < before` off ANY store
7431
+ * (local adapter or a push-only sync target). Returns the count removed.
7432
+ */
7433
+ async _purgeMarkersOn(store, before, collections) {
7434
+ const snapshot = await store.loadAll(this.name);
7435
+ let removed = 0;
7436
+ for (const [coll, records] of Object.entries(snapshot)) {
7437
+ if (collections && !collections.includes(coll)) continue;
7438
+ for (const [id, env] of Object.entries(records)) {
7439
+ if (isDeleteMarker(env) && env._ts < before) {
7440
+ await store.delete(this.name, coll, id);
7441
+ removed++;
7442
+ }
7443
+ }
7444
+ }
7445
+ return removed;
7446
+ }
7447
+ /**
7448
+ * @internal #613. Relocate this closed period's in-window records (those
7449
+ * with `_ts < before`) from the hot store to the configured cold tier,
7450
+ * via the routeStore's `compact({ before })`. Returns the count moved.
7451
+ * Requires a `routeStore` with a cold route (the `coldArchival`
7452
+ * capability); throws a clear error otherwise. Non-destructive — reads
7453
+ * fall through to cold, so this does NOT re-open the #589 window.
7454
+ */
7455
+ async _archiveClosedPeriod(before) {
7456
+ const store = this.adapter;
7457
+ if (store.capabilities?.coldArchival !== true || typeof store.compact !== "function") {
7458
+ throw new ValidationError("archivePeriod: cold archival requires a routeStore with a cold route.");
7459
+ }
7460
+ return store.compact(this.name, { before });
7461
+ }
7462
+ /**
7463
+ * @internal #615. Sweep delete markers with `_ts < before` off each of the
7464
+ * vault's push-only sync targets, returning a per-target count. Skips
7465
+ * `sync-peer` targets by construction (getPurgeableTargets yields only
7466
+ * backup/archive). Never touches the local adapter.
7467
+ */
7468
+ async _purgePeriodTargets(before) {
7469
+ const out = [];
7470
+ for (const t of this.getPurgeableTargets()) {
7471
+ const purgedCount = await this._purgeMarkersOn(t.store, before);
7472
+ out.push({ ...t.label !== void 0 ? { label: t.label } : {}, role: t.role, purgedCount });
7473
+ }
7474
+ return out;
7475
+ }
7178
7476
  /**
7179
7477
  * For a detected conflict: capture this tab's clobbered record,
7180
7478
  * read the common ancestor from history, converge the cache to the store's
@@ -8214,7 +8512,7 @@ var Vault = class {
8214
8512
  async _initDerivations(handles) {
8215
8513
  if (handles.length === 0) return;
8216
8514
  const [{ DerivationRegistry }, { ReadOnlyVaultFacade }] = await Promise.all([
8217
- import("./registry-D5J7SVJ2.js"),
8515
+ import("./registry-WIX6QCV5.js"),
8218
8516
  import("./read-only-facade-5ADRJVTM.js")
8219
8517
  ]);
8220
8518
  const registry = new DerivationRegistry();
@@ -8245,7 +8543,7 @@ var Vault = class {
8245
8543
  */
8246
8544
  async _initMaterializedViews(handles) {
8247
8545
  if (handles.length === 0) return;
8248
- const { MaterializedViewRegistry } = await import("./registry-AIEYUOSG.js");
8546
+ const { MaterializedViewRegistry } = await import("./registry-AI4E46PD.js");
8249
8547
  const registry = new MaterializedViewRegistry();
8250
8548
  this.materializedViewRegistry = registry;
8251
8549
  const db = this;
@@ -8316,13 +8614,13 @@ var Vault = class {
8316
8614
  if (!reg) {
8317
8615
  throw new Error(`refreshView: no MV registered with name "${name}"`);
8318
8616
  }
8319
- const { MaterializedViewExecutor } = await import("./executor-XWPD5PIM.js");
8617
+ const { MaterializedViewExecutor } = await import("./executor-MHUM2VZK.js");
8320
8618
  const result = await MaterializedViewExecutor.refresh(reg, {
8321
8619
  getCollection: (n) => this.collection(n),
8322
8620
  getActiveTxContext: () => this.noydb._activeTxContextOrNull,
8323
8621
  getQueryContext: () => this
8324
8622
  });
8325
- const { clearMVStale } = await import("./stale-COBBJORL.js");
8623
+ const { clearMVStale } = await import("./stale-77LP2EEF.js");
8326
8624
  clearMVStale(registry, name);
8327
8625
  return result;
8328
8626
  }
@@ -8363,7 +8661,7 @@ var Vault = class {
8363
8661
  if (!outSpec) continue;
8364
8662
  const outputColl = this.collection(outSpec.collection);
8365
8663
  if (out.kind === "array") {
8366
- const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-SSEW7BQB.js");
8664
+ const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-NBDKKCHT.js");
8367
8665
  const prior = await loadFanoutSidecar(this.adapter, this.name, spec.source, id, key, this.getDEK, this.encrypted);
8368
8666
  const prevKeys = new Set(prior?.keys ?? []);
8369
8667
  const newKeysList = out.entries.map((e) => e.key);
@@ -8585,7 +8883,7 @@ var Vault = class {
8585
8883
  * collection.
8586
8884
  */
8587
8885
  async delegate(opts) {
8588
- const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-AUY42TGU.js");
8886
+ const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-IHXOASHV.js");
8589
8887
  if (!this.keyring.kek) {
8590
8888
  throw new ValidationError(
8591
8889
  "issueDelegation: keyring.kek is null \u2014 issuing a delegation requires a tier-1 unlock. Re-authenticate at tier 1 (passphrase) first."
@@ -8607,7 +8905,7 @@ var Vault = class {
8607
8905
  * if the id does not exist.
8608
8906
  */
8609
8907
  async revokeDelegation(id) {
8610
- const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-AUY42TGU.js");
8908
+ const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-IHXOASHV.js");
8611
8909
  await revokeDelegation(this.adapter, this.name, id);
8612
8910
  void DELEGATIONS_COLLECTION;
8613
8911
  }
@@ -8794,6 +9092,38 @@ var Vault = class {
8794
9092
  async getPeriod(name) {
8795
9093
  return this.periods.getPeriod(name);
8796
9094
  }
9095
+ /**
9096
+ * Freeze a closed period (#604): purges in-window delete markers and
9097
+ * records a `_period_freezes` companion, never mutating the chained
9098
+ * `_periods` record. Idempotent. Purges the LOCAL adapter only — a
9099
+ * synced target's markers survive there and re-import on pull (benign),
9100
+ * and purging re-opens the #589 resurrection window for a peer offline
9101
+ * since before the cutoff (see periods.ts's "Freeze" section).
9102
+ */
9103
+ async freezePeriod(name) {
9104
+ return this.periods.freezePeriod(name);
9105
+ }
9106
+ /**
9107
+ * Archive a closed period (#613): relocates its in-window records from the
9108
+ * hot store to the configured cold tier (via the routeStore's cold route),
9109
+ * recording a `_period_archives` companion + ledger entry, never mutating
9110
+ * the chained `_periods` record. Non-destructive (reads fall through to
9111
+ * cold) and idempotent. Requires a routeStore with a cold route.
9112
+ */
9113
+ async archivePeriod(name) {
9114
+ return this.periods.archivePeriod(name);
9115
+ }
9116
+ /**
9117
+ * Target-purge a closed+frozen period (#615): sweeps delete markers off the
9118
+ * vault's push-only sync targets (`backup`/`archive`), recording a
9119
+ * `_period_target_purges` companion + ledger entry, never mutating the chained
9120
+ * `_periods` record. `sync-peer` targets are skipped. Requires the period be
9121
+ * frozen first. Idempotent; a vault with no push-only targets writes no
9122
+ * companion and is re-runnable.
9123
+ */
9124
+ async purgePeriodTargets(name) {
9125
+ return this.periods.purgePeriodTargets(name);
9126
+ }
8797
9127
  /** @internal — called by the gate bus before put/delete. */
8798
9128
  async _assertTsWritable(existing, incoming) {
8799
9129
  return this.periods.assertTsWritable(existing, incoming);
@@ -8823,7 +9153,7 @@ var Vault = class {
8823
9153
  * @see docs/superpowers/specs/2026-05-22-schema-dump-design.md
8824
9154
  */
8825
9155
  async dumpSchema(opts = {}) {
8826
- const { dumpVaultSchema } = await import("./walk-CVNXFUEF.js");
9156
+ const { dumpVaultSchema } = await import("./walk-SMAE4IEI.js");
8827
9157
  return dumpVaultSchema(this, opts);
8828
9158
  }
8829
9159
  /**
@@ -8958,7 +9288,7 @@ var Vault = class {
8958
9288
  * @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/public-envelope.md
8959
9289
  */
8960
9290
  async getPublicEnvelope(opts = {}) {
8961
- const { readPublicEnvelope } = await import("./public-envelope-6UBQ4IUY.js");
9291
+ const { readPublicEnvelope } = await import("./public-envelope-NC7SPNMV.js");
8962
9292
  return readPublicEnvelope(this.adapter, this.name, opts);
8963
9293
  }
8964
9294
  /**
@@ -8973,7 +9303,7 @@ var Vault = class {
8973
9303
  * both modes round-trip cleanly.
8974
9304
  */
8975
9305
  async dump() {
8976
- const { dumpVault } = await import("./backup-Y3RMFGVX.js");
9306
+ const { dumpVault } = await import("./backup-WRGNTGJF.js");
8977
9307
  return dumpVault(this.backupContext());
8978
9308
  }
8979
9309
  /**
@@ -9025,7 +9355,7 @@ var Vault = class {
9025
9355
  * — there's no chain to verify against.
9026
9356
  */
9027
9357
  async load(backupJson) {
9028
- const { loadVault } = await import("./backup-Y3RMFGVX.js");
9358
+ const { loadVault } = await import("./backup-WRGNTGJF.js");
9029
9359
  return loadVault(this.backupContext(), backupJson);
9030
9360
  }
9031
9361
  /**
@@ -9057,7 +9387,7 @@ var Vault = class {
9057
9387
  * way to detect tampering of an in-place vault.
9058
9388
  */
9059
9389
  async verifyBackupIntegrity() {
9060
- const { verifyBackupIntegrity } = await import("./backup-Y3RMFGVX.js");
9390
+ const { verifyBackupIntegrity } = await import("./backup-WRGNTGJF.js");
9061
9391
  return verifyBackupIntegrity(this.backupContext());
9062
9392
  }
9063
9393
  /**
@@ -9275,7 +9605,7 @@ var Vault = class {
9275
9605
  * is the live validator object, not a serialization of it).
9276
9606
  */
9277
9607
  async exportJSON(opts = {}) {
9278
- const { exportVaultJSON } = await import("./backup-Y3RMFGVX.js");
9608
+ const { exportVaultJSON } = await import("./backup-WRGNTGJF.js");
9279
9609
  return exportVaultJSON(this.backupContext(), opts);
9280
9610
  }
9281
9611
  };
@@ -10903,6 +11233,7 @@ function createPlaintextKeyring(userId, debugPlaintext = false) {
10903
11233
  ...debugPlaintext ? { debugPlaintext } : {}
10904
11234
  };
10905
11235
  }
11236
+ var emptyPullResult = () => ({ pulled: 0, conflicts: [], errors: [] });
10906
11237
  var Noydb = class {
10907
11238
  options;
10908
11239
  emitter = new NoydbEventEmitter();
@@ -11319,6 +11650,7 @@ var Noydb = class {
11319
11650
  } : void 0,
11320
11651
  onRegisterConflictResolver: syncEngine ? (resolverName, resolver) => syncEngine.registerConflictResolver(resolverName, resolver) : void 0,
11321
11652
  syncAdapter: targets.length > 0 ? targets[0].store : void 0,
11653
+ getPurgeableTargets: () => targets.filter((t) => t.role === "backup" || t.role === "archive").map((t) => ({ store: t.store, role: t.role, ...t.label !== void 0 ? { label: t.label } : {} })),
11322
11654
  historyConfig: this.options.history,
11323
11655
  ...this.options.blobStrategy !== void 0 ? { blobStrategy: this.options.blobStrategy } : {},
11324
11656
  ...this.options.objectStore !== void 0 ? { objectStore: this.options.objectStore } : {},
@@ -11365,6 +11697,9 @@ var Noydb = class {
11365
11697
  return refreshed;
11366
11698
  } : void 0
11367
11699
  });
11700
+ this._forEachSyncEngine(name, (engine) => {
11701
+ engine.setCacheInvalidator((collection, id) => comp._invalidateSyncApplied(collection, id));
11702
+ });
11368
11703
  await comp._initGuards(this.options.guardStrategies ?? []);
11369
11704
  await comp._initDerivations(this.options.derivationStrategies ?? []);
11370
11705
  await comp._initMaterializedViews(this.options.materializedViewStrategies ?? []);
@@ -11836,9 +12171,13 @@ var Noydb = class {
11836
12171
  const engine = this.getSyncEngine(vault);
11837
12172
  return engine.push(options);
11838
12173
  }
11839
- /** Pull remote changes to local for a vault. */
12174
+ /**
12175
+ * Pull remote changes to local for a vault. A `backup`/`archive` primary is a
12176
+ * push-only sink and is never pulled from (#616) — returns an empty result.
12177
+ */
11840
12178
  async pull(vault, options) {
11841
12179
  const engine = this.getSyncEngine(vault);
12180
+ if (engine.role !== "sync-peer") return emptyPullResult();
11842
12181
  return engine.pull(options);
11843
12182
  }
11844
12183
  /**
@@ -11847,7 +12186,7 @@ var Noydb = class {
11847
12186
  */
11848
12187
  async sync(vault, options) {
11849
12188
  const primary = this.getSyncEngine(vault);
11850
- const result = await primary.sync(options);
12189
+ const result = primary.role === "sync-peer" ? await primary.sync(options) : { pull: emptyPullResult(), push: await primary.push(options?.push) };
11851
12190
  for (const [key, engine] of this.syncEngines) {
11852
12191
  if (key === vault) continue;
11853
12192
  if (!key.startsWith(`${vault}::`)) continue;
@@ -12404,7 +12743,7 @@ var Noydb = class {
12404
12743
  "setPublicEnvelope: the public-envelope feature is not enabled. Pass `publicEnvelope: true` (or a schema object) to `createNoydb`."
12405
12744
  );
12406
12745
  }
12407
- const { loadPublicEnvelope, savePublicEnvelope, resolveSchema, validatePublicEnvelopeInput } = await import("./public-envelope-6UBQ4IUY.js");
12746
+ const { loadPublicEnvelope, savePublicEnvelope, resolveSchema, validatePublicEnvelopeInput } = await import("./public-envelope-NC7SPNMV.js");
12408
12747
  const schema = resolveSchema(this.options.publicEnvelope);
12409
12748
  validatePublicEnvelopeInput(input, schema);
12410
12749
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -12433,7 +12772,7 @@ var Noydb = class {
12433
12772
  * regardless).
12434
12773
  */
12435
12774
  async getPublicEnvelope(vault, opts = {}) {
12436
- const { readPublicEnvelope } = await import("./public-envelope-6UBQ4IUY.js");
12775
+ const { readPublicEnvelope } = await import("./public-envelope-NC7SPNMV.js");
12437
12776
  return readPublicEnvelope(this.options.store, vault, opts);
12438
12777
  }
12439
12778
  // ─── Auth introspection ─────────────────────────────────────────
@@ -12624,9 +12963,9 @@ async function createNoydb(options) {
12624
12963
  throw new ValidationError("A secret (passphrase) or getKeyring callback is required when encryption is enabled");
12625
12964
  }
12626
12965
  if (!options.coordinationStrategy) options = { ...options, coordinationStrategy: await createDefaultCoordinationProvider(options.store) };
12627
- if (!options.userApiFactory) options = { ...options, userApiFactory: (await import("./api-OQ65LUSK.js")).createUserApi };
12966
+ if (!options.userApiFactory) options = { ...options, userApiFactory: (await import("./api-JDWL67WL.js")).createUserApi };
12628
12967
  if (!options.policyFactory) {
12629
- const policyModule = await import("./policy-3ZKSGSRK.js");
12968
+ const policyModule = await import("./policy-Y7HL2KGA.js");
12630
12969
  options = { ...options, policyFactory: policyModule.createNoydbPolicy, policyCheckGateFn: policyModule.checkGate };
12631
12970
  }
12632
12971
  return new Noydb(options);
@@ -12661,4 +13000,4 @@ export {
12661
13000
  Noydb,
12662
13001
  createNoydb
12663
13002
  };
12664
- //# sourceMappingURL=chunk-D6ADQ4QL.js.map
13003
+ //# sourceMappingURL=chunk-56JB2BGI.js.map