@noy-db/hub 0.4.0-pre.0 → 0.4.0-pre.10

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 (611) hide show
  1. package/README.md +3 -4
  2. package/dist/api-ZDKTWNBB.js +20 -0
  3. package/dist/attestation/index.js +18 -18
  4. package/dist/{backup-YPUEKIJC.js → backup-2UX7PRM5.js} +13 -13
  5. package/dist/blobs/index.js +30 -15
  6. package/dist/blobs/index.js.map +1 -1
  7. package/dist/broker/index.js +12 -12
  8. package/dist/broker/index.js.map +1 -1
  9. package/dist/cargo/index.js +58 -29
  10. package/dist/{chunk-IY23KFNZ.js → chunk-35NMVJ7I.js} +3 -3
  11. package/dist/{chunk-S3BFKGET.js → chunk-3HUYRN24.js} +4 -4
  12. package/dist/chunk-3HUYRN24.js.map +1 -0
  13. package/dist/{walk-IPLXE36W.js → chunk-3V3XR4S4.js} +4 -13
  14. package/dist/{walk-IPLXE36W.js.map → chunk-3V3XR4S4.js.map} +1 -1
  15. package/dist/{chunk-RTEK4C4I.js → chunk-4JQK3L4V.js} +2 -2
  16. package/dist/{chunk-3ELCWU56.js → chunk-4ZKNC6A6.js} +2 -2
  17. package/dist/{chunk-VQNJ7UZL.js → chunk-55LKVALY.js} +106 -10
  18. package/dist/chunk-55LKVALY.js.map +1 -0
  19. package/dist/{chunk-VAIS3SOM.js → chunk-55LX6FSX.js} +2 -2
  20. package/dist/chunk-5D2ALSM5.js +19 -0
  21. package/dist/chunk-5D2ALSM5.js.map +1 -0
  22. package/dist/{chunk-6HPG2YNX.js → chunk-5DRROK5W.js} +2 -2
  23. package/dist/{chunk-S6Q37VGE.js → chunk-5GQEU4DN.js} +2 -2
  24. package/dist/chunk-5JOFWL4G.js +25 -0
  25. package/dist/chunk-5JOFWL4G.js.map +1 -0
  26. package/dist/{chunk-ZXEZCY6F.js → chunk-63FE525P.js} +6 -6
  27. package/dist/chunk-6LJY7X5A.js +18 -0
  28. package/dist/chunk-6LJY7X5A.js.map +1 -0
  29. package/dist/{chunk-JVBO4SZL.js → chunk-6UBZ6I5Z.js} +2 -2
  30. package/dist/{chunk-BOKIKJJB.js → chunk-6ZNSB3H6.js} +5 -17
  31. package/dist/chunk-6ZNSB3H6.js.map +1 -0
  32. package/dist/{chunk-IK43HLDQ.js → chunk-7YVBQJ7K.js} +13 -355
  33. package/dist/chunk-7YVBQJ7K.js.map +1 -0
  34. package/dist/{chunk-VRBTNCM4.js → chunk-ABS7FMMD.js} +6 -6
  35. package/dist/chunk-AFHQATY4.js +47 -0
  36. package/dist/chunk-AFHQATY4.js.map +1 -0
  37. package/dist/{chunk-HOONYZY2.js → chunk-AKKRXT23.js} +7 -7
  38. package/dist/chunk-AKKRXT23.js.map +1 -0
  39. package/dist/{chunk-DDHM2TLX.js → chunk-AT2JJEKJ.js} +4 -4
  40. package/dist/chunk-AT2JJEKJ.js.map +1 -0
  41. package/dist/{chunk-M75ZZHSR.js → chunk-BLBAQRBM.js} +2 -2
  42. package/dist/{chunk-554KLAAN.js → chunk-BLCWSJLN.js} +88 -81
  43. package/dist/chunk-BLCWSJLN.js.map +1 -0
  44. package/dist/chunk-CADUYBQD.js +151 -0
  45. package/dist/chunk-CADUYBQD.js.map +1 -0
  46. package/dist/{chunk-WOM2HTML.js → chunk-CI32CAFS.js} +5 -5
  47. package/dist/{chunk-FH52K7EG.js → chunk-CUZLNGD5.js} +2 -6
  48. package/dist/{chunk-FH52K7EG.js.map → chunk-CUZLNGD5.js.map} +1 -1
  49. package/dist/{chunk-U6JMEH2P.js → chunk-CXQW2NWO.js} +145 -3
  50. package/dist/chunk-CXQW2NWO.js.map +1 -0
  51. package/dist/{chunk-EO43ANYJ.js → chunk-DABACXEF.js} +3 -3
  52. package/dist/{chunk-CJ5KKU6X.js → chunk-DMH3VZU5.js} +4 -4
  53. package/dist/chunk-DSDXAKIP.js +50 -0
  54. package/dist/chunk-DSDXAKIP.js.map +1 -0
  55. package/dist/{chunk-WZSHL6DQ.js → chunk-DZ2JXHWK.js} +5 -5
  56. package/dist/chunk-DZFQVICS.js +23 -0
  57. package/dist/chunk-DZFQVICS.js.map +1 -0
  58. package/dist/chunk-E23UGFVC.js +63 -0
  59. package/dist/chunk-E23UGFVC.js.map +1 -0
  60. package/dist/{chunk-Z4PD65VQ.js → chunk-EE7UHLKH.js} +4 -4
  61. package/dist/chunk-EIPVYUEP.js +654 -0
  62. package/dist/chunk-EIPVYUEP.js.map +1 -0
  63. package/dist/{chunk-RNG4VRP4.js → chunk-EKRSCRNM.js} +3 -3
  64. package/dist/{chunk-YMUGBZN2.js → chunk-FQ5CHJR7.js} +1 -1
  65. package/dist/chunk-FQ5CHJR7.js.map +1 -0
  66. package/dist/{chunk-RFI7GGFO.js → chunk-FQZ6XTQ7.js} +17 -20
  67. package/dist/chunk-FQZ6XTQ7.js.map +1 -0
  68. package/dist/{chunk-MT62YSPZ.js → chunk-FRMPM7WG.js} +4 -4
  69. package/dist/{chunk-W4TCUGQR.js → chunk-G2JUIDFA.js} +13 -9
  70. package/dist/{chunk-W4TCUGQR.js.map → chunk-G2JUIDFA.js.map} +1 -1
  71. package/dist/{chunk-T3GY65MA.js → chunk-G6WWZNJP.js} +13 -13
  72. package/dist/chunk-G6WWZNJP.js.map +1 -0
  73. package/dist/chunk-GJW4HX2O.js +1 -0
  74. package/dist/{chunk-KS6SAVCZ.js → chunk-GU3IP74F.js} +6 -6
  75. package/dist/{chunk-UHNGNKLV.js → chunk-GWWOGNBK.js} +308 -18
  76. package/dist/chunk-GWWOGNBK.js.map +1 -0
  77. package/dist/{chunk-5PFOMHTB.js → chunk-H2GPHUZD.js} +12 -13
  78. package/dist/chunk-H2GPHUZD.js.map +1 -0
  79. package/dist/{chunk-H2KSZMIX.js → chunk-HMU5P6RL.js} +5 -5
  80. package/dist/chunk-HMU5P6RL.js.map +1 -0
  81. package/dist/{chunk-JFCV5QIK.js → chunk-I5GEJX3R.js} +5 -5
  82. package/dist/chunk-I5GEJX3R.js.map +1 -0
  83. package/dist/{chunk-GWKAVKHI.js → chunk-IG6KUWBX.js} +2 -2
  84. package/dist/chunk-IG6KUWBX.js.map +1 -0
  85. package/dist/{chunk-LVGTA624.js → chunk-IPUG56GJ.js} +15 -5
  86. package/dist/{chunk-LVGTA624.js.map → chunk-IPUG56GJ.js.map} +1 -1
  87. package/dist/{chunk-SMIRGMS7.js → chunk-IXNCZTWA.js} +2 -2
  88. package/dist/{chunk-WQIYTNJV.js → chunk-IXTSNGYY.js} +3 -3
  89. package/dist/{chunk-WHXXI3W5.js → chunk-IYZISPGD.js} +7 -5
  90. package/dist/chunk-IYZISPGD.js.map +1 -0
  91. package/dist/{chunk-HQBM64EE.js → chunk-JDOMW53O.js} +145 -16
  92. package/dist/chunk-JDOMW53O.js.map +1 -0
  93. package/dist/{chunk-NCCBLYEB.js → chunk-JJZGIE4U.js} +6 -5
  94. package/dist/{chunk-DRWBEDYO.js → chunk-JYJFGD2H.js} +2 -2
  95. package/dist/{chunk-TAGR72IR.js → chunk-KRCBZYTZ.js} +26 -177
  96. package/dist/chunk-KRCBZYTZ.js.map +1 -0
  97. package/dist/{chunk-DSBQODMZ.js → chunk-L2DGWBCT.js} +14 -14
  98. package/dist/chunk-L2DGWBCT.js.map +1 -0
  99. package/dist/{chunk-VEALDPHW.js → chunk-L3YYLT4E.js} +15 -2
  100. package/dist/chunk-L3YYLT4E.js.map +1 -0
  101. package/dist/{chunk-FXZDAV62.js → chunk-LNPUSMZL.js} +29 -31
  102. package/dist/chunk-LNPUSMZL.js.map +1 -0
  103. package/dist/{chunk-XJMBYYQK.js → chunk-LNZKOUJR.js} +2 -2
  104. package/dist/{chunk-R3BLCFD2.js → chunk-MBKVNOJS.js} +6 -6
  105. package/dist/chunk-MCHBCNCE.js +367 -0
  106. package/dist/chunk-MCHBCNCE.js.map +1 -0
  107. package/dist/{chunk-VCBHAE4R.js → chunk-MHMLXJ3I.js} +2 -2
  108. package/dist/chunk-MHMLXJ3I.js.map +1 -0
  109. package/dist/{chunk-WNGGJWF7.js → chunk-MSMJJB4J.js} +2 -2
  110. package/dist/chunk-MSMJJB4J.js.map +1 -0
  111. package/dist/{chunk-T36RFODW.js → chunk-MXUT7FTE.js} +2 -2
  112. package/dist/chunk-MXUT7FTE.js.map +1 -0
  113. package/dist/{chunk-WG4QBZDN.js → chunk-N4BBNYIB.js} +11 -9
  114. package/dist/chunk-N4BBNYIB.js.map +1 -0
  115. package/dist/{chunk-PK6JIDQ4.js → chunk-NFIBXF4V.js} +1084 -1583
  116. package/dist/chunk-NFIBXF4V.js.map +1 -0
  117. package/dist/{chunk-VKCADNMR.js → chunk-NFNJLRY7.js} +368 -52
  118. package/dist/chunk-NFNJLRY7.js.map +1 -0
  119. package/dist/{chunk-N6WF5PKC.js → chunk-NFZGZ4AK.js} +2 -2
  120. package/dist/{chunk-JRBNCUNT.js → chunk-NGSJZFGL.js} +21 -4
  121. package/dist/chunk-NGSJZFGL.js.map +1 -0
  122. package/dist/chunk-NJ4DYYO5.js +81 -0
  123. package/dist/chunk-NJ4DYYO5.js.map +1 -0
  124. package/dist/chunk-NM5UYF6Q.js +24 -0
  125. package/dist/chunk-NM5UYF6Q.js.map +1 -0
  126. package/dist/{chunk-JBBSYJHP.js → chunk-NYEFP7DY.js} +4 -4
  127. package/dist/chunk-NYEFP7DY.js.map +1 -0
  128. package/dist/{chunk-GDG5VVYG.js → chunk-NZ24MX4J.js} +8 -46
  129. package/dist/chunk-NZ24MX4J.js.map +1 -0
  130. package/dist/{chunk-IFJTPAQQ.js → chunk-OLEPKFTW.js} +4 -4
  131. package/dist/chunk-OLEPKFTW.js.map +1 -0
  132. package/dist/{chunk-THVIPWRF.js → chunk-PEATRIYJ.js} +9 -9
  133. package/dist/chunk-PEOZ34EM.js +13 -0
  134. package/dist/chunk-PEOZ34EM.js.map +1 -0
  135. package/dist/{chunk-UC2ETWF3.js → chunk-PTHKZWEH.js} +2 -14
  136. package/dist/{chunk-UC2ETWF3.js.map → chunk-PTHKZWEH.js.map} +1 -1
  137. package/dist/chunk-PVEWA2DU.js +23 -0
  138. package/dist/chunk-PVEWA2DU.js.map +1 -0
  139. package/dist/{chunk-VCTXU4AT.js → chunk-QBAC3GXA.js} +1 -1
  140. package/dist/chunk-QBAC3GXA.js.map +1 -0
  141. package/dist/{chunk-RDXW3OBQ.js → chunk-QD46HPZG.js} +2 -2
  142. package/dist/chunk-QD46HPZG.js.map +1 -0
  143. package/dist/{chunk-YZQOGE2L.js → chunk-QDIH2744.js} +2 -2
  144. package/dist/{chunk-6HY2X62D.js → chunk-QJNCB5SK.js} +2 -2
  145. package/dist/{chunk-IAO54J4R.js → chunk-QX76XVQH.js} +6 -6
  146. package/dist/chunk-QX76XVQH.js.map +1 -0
  147. package/dist/{chunk-W2OG6JOL.js → chunk-QZWTRENR.js} +24 -7
  148. package/dist/chunk-QZWTRENR.js.map +1 -0
  149. package/dist/{chunk-6NQMXTYC.js → chunk-RO5NM6UI.js} +2 -2
  150. package/dist/chunk-RO5NM6UI.js.map +1 -0
  151. package/dist/chunk-SGDPRCC4.js +1075 -0
  152. package/dist/chunk-SGDPRCC4.js.map +1 -0
  153. package/dist/{chunk-2PCAVW2I.js → chunk-SHEEBRZ4.js} +2 -2
  154. package/dist/chunk-SMY5X46Z.js +14 -0
  155. package/dist/chunk-SMY5X46Z.js.map +1 -0
  156. package/dist/{chunk-ISMV2QVG.js → chunk-TG634KCO.js} +11 -2
  157. package/dist/chunk-TG634KCO.js.map +1 -0
  158. package/dist/{chunk-XUW3PXHU.js → chunk-TUXQSFHZ.js} +4 -16
  159. package/dist/{chunk-XUW3PXHU.js.map → chunk-TUXQSFHZ.js.map} +1 -1
  160. package/dist/{chunk-GULTLPFB.js → chunk-UADPR6F4.js} +3 -3
  161. package/dist/{chunk-GULTLPFB.js.map → chunk-UADPR6F4.js.map} +1 -1
  162. package/dist/{chunk-XTHCN77N.js → chunk-UDHBXYGG.js} +29 -19
  163. package/dist/chunk-UDHBXYGG.js.map +1 -0
  164. package/dist/{chunk-RA5VTXXG.js → chunk-V6UQZA2H.js} +2 -2
  165. package/dist/chunk-VG2ZSFYD.js +32 -0
  166. package/dist/chunk-VG2ZSFYD.js.map +1 -0
  167. package/dist/chunk-VKQCVU2Z.js +21 -0
  168. package/dist/chunk-VKQCVU2Z.js.map +1 -0
  169. package/dist/{chunk-QDPZWTN2.js → chunk-W3G5REIU.js} +2 -2
  170. package/dist/{chunk-A4FXFAKF.js → chunk-W3L64Y3J.js} +2 -2
  171. package/dist/{chunk-ONTBCHCP.js → chunk-W66AM5IB.js} +2 -2
  172. package/dist/chunk-W66AM5IB.js.map +1 -0
  173. package/dist/{chunk-A5BDDEXK.js → chunk-WBKZUO5V.js} +26 -43
  174. package/dist/chunk-WBKZUO5V.js.map +1 -0
  175. package/dist/{chunk-XDIAFPUM.js → chunk-WLXMTYGO.js} +2 -2
  176. package/dist/{chunk-RJ6K6K5M.js → chunk-X3F5YJG2.js} +2 -2
  177. package/dist/{chunk-WKGF2TJR.js → chunk-X45JYIAY.js} +3 -3
  178. package/dist/chunk-X45JYIAY.js.map +1 -0
  179. package/dist/{chunk-6XE5TMPR.js → chunk-X4MVWPHV.js} +3 -3
  180. package/dist/chunk-X4MVWPHV.js.map +1 -0
  181. package/dist/chunk-XZHEOSQ2.js +16 -0
  182. package/dist/chunk-XZHEOSQ2.js.map +1 -0
  183. package/dist/chunk-Y2NBBT6K.js +18 -0
  184. package/dist/chunk-Y2NBBT6K.js.map +1 -0
  185. package/dist/{chunk-CZTLE22N.js → chunk-Y2NJBNX3.js} +8 -8
  186. package/dist/{chunk-CZTLE22N.js.map → chunk-Y2NJBNX3.js.map} +1 -1
  187. package/dist/{chunk-YTGDPCPW.js → chunk-Y6B6HVKC.js} +2 -2
  188. package/dist/chunk-YMUFFJCO.js +23 -0
  189. package/dist/chunk-YMUFFJCO.js.map +1 -0
  190. package/dist/{chunk-SV6EAJEP.js → chunk-YWWQM7KP.js} +5 -14
  191. package/dist/chunk-YWWQM7KP.js.map +1 -0
  192. package/dist/{chunk-UDSR4X4L.js → chunk-YZJSJOUI.js} +239 -16
  193. package/dist/chunk-YZJSJOUI.js.map +1 -0
  194. package/dist/{chunk-5WZXVULX.js → chunk-ZTLOXFPB.js} +2 -2
  195. package/dist/chunk-ZTLOXFPB.js.map +1 -0
  196. package/dist/classified/index.js +5 -5
  197. package/dist/{classified-marker-QWMASIT7.js → classified-marker-7PKJBFCG.js} +3 -3
  198. package/dist/collection-facade-6I5K5IOD.js +45 -0
  199. package/dist/{computed-DSMPXG2Y.js → computed-AB45PS4V.js} +3 -3
  200. package/dist/consent/index.js +13 -9
  201. package/dist/consent/index.js.map +1 -1
  202. package/dist/cover/index.js +37 -0
  203. package/dist/crdt/index.js +4 -0
  204. package/dist/crdt/index.js.map +1 -1
  205. package/dist/custody/index.js +26 -0
  206. package/dist/{dead-filter-66VGI6JV.js → dead-filter-FL3WIUZS.js} +2 -2
  207. package/dist/{chunk-OCVM6KDH.js → delegation-QXZ4MPPH.js} +12 -6
  208. package/dist/{chunk-OCVM6KDH.js.map → delegation-QXZ4MPPH.js.map} +1 -1
  209. package/dist/derivations/index.js +12 -12
  210. package/dist/derive-VGS7FKE3.js +22 -0
  211. package/dist/directory/index.js +46 -0
  212. package/dist/dispatch-EGGC7UD7.js +72 -0
  213. package/dist/dispatch-EGGC7UD7.js.map +1 -0
  214. package/dist/dispatch-GDSTUTVP.js +194 -0
  215. package/dist/dispatch-GDSTUTVP.js.map +1 -0
  216. package/dist/{enclave-TKPN2G2U.js → enclave-SPEEDYZ4.js} +13 -11
  217. package/dist/executor-IEBLTBCW.js +9 -0
  218. package/dist/executor-OTF556PL.js +28 -0
  219. package/dist/executor-RM7XWQDU.js +9 -0
  220. package/dist/export-accessible-P42BQ4PB.js +23 -0
  221. package/dist/extract-partition-TCYXRWBN.js +38 -0
  222. package/dist/{fanout-sidecar-B5LVUMQX.js → fanout-sidecar-SSMRSC2L.js} +9 -9
  223. package/dist/find-OZMTRIK3.js +11 -0
  224. package/dist/forget/index.js +11 -11
  225. package/dist/forget/index.js.map +1 -1
  226. package/dist/guards/index.js +4 -4
  227. package/dist/history/index.js +16 -12
  228. package/dist/history/index.js.map +1 -1
  229. package/dist/i18n/index.js +16 -14
  230. package/dist/i18n/index.js.map +1 -1
  231. package/dist/index.d.ts +42 -42
  232. package/dist/index.js +332 -2106
  233. package/dist/index.js.map +1 -1
  234. package/dist/indexing/index.js +4 -2
  235. package/dist/indexing/index.js.map +1 -1
  236. package/dist/introspection/index.js +28 -0
  237. package/dist/issue-FCKN5O6C.js +19 -0
  238. package/dist/kernel/best-effort-revert.d.ts +9 -1
  239. package/dist/kernel/collection-config.d.ts +12 -70
  240. package/dist/kernel/collection.d.ts +11 -23
  241. package/dist/kernel/enclave/crypto.d.ts +8 -8
  242. package/dist/kernel/enclave/index.d.ts +4 -4
  243. package/dist/kernel/enclave/record-keys/envelope-body.d.ts +8 -0
  244. package/dist/kernel/errors.d.ts +41 -22
  245. package/dist/kernel/lazy.d.ts +30 -0
  246. package/dist/kernel/noydb.d.ts +81 -124
  247. package/dist/kernel/query/builder.d.ts +10 -10
  248. package/dist/kernel/query/index.d.ts +0 -6
  249. package/dist/kernel/query/scan-builder.d.ts +4 -4
  250. package/dist/kernel/sync-policy.d.ts +76 -4
  251. package/dist/kernel/types.d.ts +187 -86
  252. package/dist/kernel/validation.d.ts +33 -33
  253. package/dist/kernel/vault.d.ts +41 -229
  254. package/dist/kernel/via/dispatch.d.ts +7 -0
  255. package/dist/{ledger-PTK7XZYT.js → ledger-6XBEVWYP.js} +11 -11
  256. package/dist/liberate-CYUOS4NC.js +24 -0
  257. package/dist/{link-set-SLJHDNRB.js → link-set-NK6L2A5S.js} +11 -11
  258. package/dist/materialized-views/index.js +22 -19
  259. package/dist/money/index.js +31 -0
  260. package/dist/noydb-FZZIMLCI.js +81 -0
  261. package/dist/overlay-views/index.js +4 -4
  262. package/dist/periods/index.js +21 -17
  263. package/dist/pod/index.js +26 -12
  264. package/dist/{policy-YDLCOX4P.js → policy/index.js} +6 -6
  265. package/dist/port/with/archive-strategy.d.ts +31 -0
  266. package/dist/port/with/blob-strategy.d.ts +15 -5
  267. package/dist/port/with/collection-options.d.ts +171 -0
  268. package/dist/port/with/collection-registries.d.ts +62 -0
  269. package/dist/port/with/strategies.d.ts +134 -0
  270. package/dist/port/with/team-strategy.d.ts +3 -2
  271. package/dist/portability/index.js +8 -8
  272. package/dist/{post-register-2YHSADFI.js → post-register-VFIYISUK.js} +6 -6
  273. package/dist/query/index.js +6 -46
  274. package/dist/{aggregate → reduce}/index.js +24 -17
  275. package/dist/reduce/index.js.map +1 -0
  276. package/dist/register-UKU2J6MN.js +25 -0
  277. package/dist/registry-2VCWVHZS.js +19 -0
  278. package/dist/registry-7Y5WF7GS.js +9 -0
  279. package/dist/{registry-VW6P6A3J.js → registry-BWD2ED52.js} +2 -2
  280. package/dist/registry-DTWRJLSF.js +18 -0
  281. package/dist/request-withdrawal-JYDZ5XY2.js +31 -0
  282. package/dist/{reveal-HWO4YMTJ.js → reveal-CL2BCW6A.js} +6 -6
  283. package/dist/revoke-2TSAD2T4.js +24 -0
  284. package/dist/satellites/index.js +1 -1
  285. package/dist/schema-update/index.js +26 -0
  286. package/dist/sealed-record/index.js +12 -12
  287. package/dist/search/index.js +36 -0
  288. package/dist/{seed-3ZMF5EQA.js → seed-NUVJEL7T.js} +12 -12
  289. package/dist/seed-NUVJEL7T.js.map +1 -0
  290. package/dist/sequence/index.js +30 -0
  291. package/dist/session/index.js +13 -9
  292. package/dist/session/index.js.map +1 -1
  293. package/dist/shadow/index.js +6 -2
  294. package/dist/shadow/index.js.map +1 -1
  295. package/dist/share-link/index.d.ts +19 -0
  296. package/dist/share-link/index.js +201 -0
  297. package/dist/share-link/index.js.map +1 -0
  298. package/dist/share-link/share-link.d.ts +123 -0
  299. package/dist/signer-K7Z2EOMG.js +25 -0
  300. package/dist/snapshots/index.js +14 -10
  301. package/dist/snapshots/index.js.map +1 -1
  302. package/dist/{stale-VZL4OGUB.js → stale-A4J26OIC.js} +11 -10
  303. package/dist/storage-YVHZUISN.js +23 -0
  304. package/dist/store/index.js +22 -0
  305. package/dist/{store-coordination-provider-FKX3F6TQ.js → store-coordination-provider-EWRZL7XF.js} +3 -3
  306. package/dist/sync/index.js +15 -11
  307. package/dist/sync/index.js.map +1 -1
  308. package/dist/team/index.js +33 -47
  309. package/dist/tiers/index.js +10 -10
  310. package/dist/to/index.js +1 -1
  311. package/dist/{tx → transactions}/index.js +7 -3
  312. package/dist/transactions/index.js.map +1 -0
  313. package/dist/util/index.js +1 -1
  314. package/dist/{verify-26Y5GNMK.js → verify-7XWHJWUN.js} +5 -5
  315. package/dist/via/blob/active.d.ts +23 -7
  316. package/dist/via/blob/binding.d.ts +1 -1
  317. package/dist/via/blob/index.d.ts +7 -1
  318. package/dist/via/i18n/core.d.ts +1 -1
  319. package/dist/via/i18n/index.d.ts +2 -0
  320. package/dist/via/money/money-reducer.d.ts +2 -2
  321. package/dist/walk-P5D6CF4V.js +21 -0
  322. package/dist/with-audit/consent/index.d.ts +2 -0
  323. package/dist/with-audit/forget/active.d.ts +3 -3
  324. package/dist/with-audit/forget/index.d.ts +6 -5
  325. package/dist/with-audit/forget/strategy.d.ts +3 -3
  326. package/dist/with-audit/guards/executor.d.ts +4 -4
  327. package/dist/with-audit/guards/immutable-guard.d.ts +3 -3
  328. package/dist/with-audit/guards/index.d.ts +1 -1
  329. package/dist/with-audit/guards/registry.d.ts +3 -3
  330. package/dist/with-audit/guards/transition-guard.d.ts +3 -3
  331. package/dist/with-audit/guards/types.d.ts +10 -10
  332. package/dist/with-audit/guards/with-guard.d.ts +2 -2
  333. package/dist/with-audit/periods/index.d.ts +2 -0
  334. package/dist/with-audit/periods/periods.d.ts +1 -16
  335. package/dist/with-audit/periods/vault-facade.d.ts +6 -0
  336. package/dist/with-audit/periods/window.d.ts +16 -0
  337. package/dist/with-audit/portability/export-accessible.d.ts +4 -4
  338. package/dist/with-audit/portability/request-withdrawal.d.ts +3 -3
  339. package/dist/with-audit/portability/withdraw-accessible.d.ts +2 -2
  340. package/dist/with-audit/sealed-record/strategy.d.ts +1 -1
  341. package/dist/with-audit/tiers/index.d.ts +1 -0
  342. package/dist/with-cargo/adopt-partition.d.ts +7 -7
  343. package/dist/{legacy/kernel.d.ts → with-cargo/floor.d.ts} +4 -4
  344. package/dist/with-cargo/index.d.ts +15 -2
  345. package/dist/with-commit/crdt/index.d.ts +2 -0
  346. package/dist/with-commit/history/index.d.ts +2 -0
  347. package/dist/with-commit/history/time-machine.d.ts +2 -2
  348. package/dist/with-commit/numbering/descriptor.d.ts +16 -6
  349. package/dist/with-commit/tx/active.d.ts +5 -5
  350. package/dist/with-commit/tx/index.d.ts +2 -2
  351. package/dist/with-commit/tx/invariants.d.ts +1 -1
  352. package/dist/with-commit/tx/strategy.d.ts +3 -3
  353. package/dist/with-fork/shadow/index.d.ts +2 -0
  354. package/dist/with-fork/snapshots/active.d.ts +2 -2
  355. package/dist/with-fork/snapshots/index.d.ts +3 -1
  356. package/dist/with-fork/snapshots/noydb-facade.d.ts +3 -3
  357. package/dist/with-fork/snapshots/strategy.d.ts +2 -2
  358. package/dist/with-formula/derivations/dispatch.d.ts +98 -0
  359. package/dist/with-formula/derivations/executor.d.ts +2 -2
  360. package/dist/with-formula/derivations/index.d.ts +4 -1
  361. package/dist/with-formula/derivations/registry.d.ts +3 -3
  362. package/dist/with-formula/derivations/stale.d.ts +2 -2
  363. package/dist/with-formula/derivations/types.d.ts +3 -3
  364. package/dist/with-formula/derivations/with-derivation.d.ts +2 -2
  365. package/dist/with-formula/derivations/with-rollup.d.ts +15 -8
  366. package/dist/with-formula/materialized-views/dependency-analyzer.d.ts +3 -3
  367. package/dist/with-formula/materialized-views/dispatch.d.ts +75 -0
  368. package/dist/with-formula/materialized-views/index.d.ts +2 -1
  369. package/dist/with-formula/materialized-views/registry.d.ts +4 -4
  370. package/dist/with-formula/materialized-views/types.d.ts +11 -11
  371. package/dist/with-formula/materialized-views/with-materialized-view.d.ts +2 -2
  372. package/dist/with-formula/overlay-views/index.d.ts +1 -1
  373. package/dist/with-formula/overlay-views/registry.d.ts +4 -4
  374. package/dist/with-formula/overlay-views/types.d.ts +3 -3
  375. package/dist/with-formula/overlay-views/virtual-collection.d.ts +2 -2
  376. package/dist/with-formula/overlay-views/with-overlayed-view.d.ts +2 -2
  377. package/dist/with-lookup/indexing/active.d.ts +5 -5
  378. package/dist/with-lookup/indexing/index.d.ts +3 -1
  379. package/dist/with-lookup/indexing/strategy.d.ts +3 -3
  380. package/dist/with-lookup/{aggregate → reduce}/active.d.ts +8 -8
  381. package/dist/with-lookup/{aggregate → reduce}/groupby.d.ts +21 -21
  382. package/dist/with-lookup/reduce/index.d.ts +34 -0
  383. package/dist/with-lookup/{aggregate → reduce}/reducers.d.ts +11 -12
  384. package/dist/with-lookup/{aggregate/aggregation.d.ts → reduce/reduction.d.ts} +21 -21
  385. package/dist/with-lookup/{aggregate → reduce}/strategy.d.ts +15 -15
  386. package/dist/with-lookup/search/build-docs.d.ts +7 -2
  387. package/dist/with-lookup/search/index.d.ts +1 -1
  388. package/dist/with-party/broker/index.d.ts +1 -0
  389. package/dist/with-party/broker/seed.d.ts +1 -1
  390. package/dist/with-party/custody/liberate.d.ts +3 -3
  391. package/dist/with-party/directory/cover/index.d.ts +1 -5
  392. package/dist/with-party/directory/cover/schema.d.ts +0 -6
  393. package/dist/with-party/directory/cover/storage.d.ts +0 -8
  394. package/dist/with-party/directory/cover/types.d.ts +0 -21
  395. package/dist/with-party/directory/index.d.ts +2 -0
  396. package/dist/with-party/session/dev-unlock.d.ts +2 -2
  397. package/dist/with-party/session/index.d.ts +2 -0
  398. package/dist/with-party/session/session.d.ts +2 -2
  399. package/dist/with-party/team/deed.d.ts +8 -8
  400. package/dist/with-party/team/index.d.ts +4 -7
  401. package/dist/with-party/team/keyring.d.ts +83 -35
  402. package/dist/with-party/team/{managed-passphrase.d.ts → managed-secret.d.ts} +27 -27
  403. package/dist/with-party/team/noydb-facade.d.ts +43 -42
  404. package/dist/with-party/team/peer-recover.d.ts +13 -13
  405. package/dist/with-party/team/recovery.d.ts +5 -5
  406. package/dist/with-party/team/rotate-recover.d.ts +30 -30
  407. package/dist/with-pod/bundle.d.ts +30 -32
  408. package/dist/with-pod/format.d.ts +2 -2
  409. package/dist/with-pod/index.d.ts +2 -1
  410. package/dist/with-shape/blobs/blob-compaction.d.ts +43 -3
  411. package/dist/with-shape/blobs/blob-pinning.d.ts +112 -0
  412. package/dist/with-shape/blobs/blob-set.d.ts +86 -2
  413. package/dist/with-shape/introspection/index.d.ts +6 -0
  414. package/dist/with-shape/schema-update/index.d.ts +1 -0
  415. package/dist/with-store/index.d.ts +3 -2
  416. package/dist/with-store/route-store.d.ts +1 -1
  417. package/dist/{with-party/team/sync-active.d.ts → with-sync/active.d.ts} +1 -1
  418. package/dist/{with-party/team/sync-credentials.d.ts → with-sync/credentials.d.ts} +3 -3
  419. package/dist/{with-party/team/sync.d.ts → with-sync/engine.d.ts} +17 -4
  420. package/dist/{with-party/sync → with-sync}/index.d.ts +4 -2
  421. package/dist/with-sync/period-scope.d.ts +78 -0
  422. package/dist/{with-party/team → with-sync}/presence.d.ts +2 -2
  423. package/dist/{with-party/team/sync-strategy.d.ts → with-sync/strategy.d.ts} +6 -6
  424. package/dist/{with-party/team/sync-transaction.d.ts → with-sync/transaction.d.ts} +3 -3
  425. package/dist/withdraw-accessible-A2PWF5MZ.js +28 -0
  426. package/dist/withdraw-accessible-A2PWF5MZ.js.map +1 -0
  427. package/package.json +49 -36
  428. package/dist/aggregate/index.js.map +0 -1
  429. package/dist/api-3A3S4SHH.js +0 -20
  430. package/dist/as/index.js +0 -30
  431. package/dist/at/index.js +0 -1
  432. package/dist/bundle/index.js +0 -153
  433. package/dist/bundle/index.js.map +0 -1
  434. package/dist/by/index.js +0 -11
  435. package/dist/chunk-554KLAAN.js.map +0 -1
  436. package/dist/chunk-5PFOMHTB.js.map +0 -1
  437. package/dist/chunk-5WZXVULX.js.map +0 -1
  438. package/dist/chunk-6NQMXTYC.js.map +0 -1
  439. package/dist/chunk-6XE5TMPR.js.map +0 -1
  440. package/dist/chunk-A5BDDEXK.js.map +0 -1
  441. package/dist/chunk-ANATMTOA.js +0 -205
  442. package/dist/chunk-ANATMTOA.js.map +0 -1
  443. package/dist/chunk-BOKIKJJB.js.map +0 -1
  444. package/dist/chunk-CHFZDSE4.js +0 -1
  445. package/dist/chunk-DDHM2TLX.js.map +0 -1
  446. package/dist/chunk-DSBQODMZ.js.map +0 -1
  447. package/dist/chunk-EWPOHMN2.js +0 -255
  448. package/dist/chunk-EWPOHMN2.js.map +0 -1
  449. package/dist/chunk-FXZDAV62.js.map +0 -1
  450. package/dist/chunk-GDG5VVYG.js.map +0 -1
  451. package/dist/chunk-GWKAVKHI.js.map +0 -1
  452. package/dist/chunk-H2KSZMIX.js.map +0 -1
  453. package/dist/chunk-HOONYZY2.js.map +0 -1
  454. package/dist/chunk-HQBM64EE.js.map +0 -1
  455. package/dist/chunk-IAO54J4R.js.map +0 -1
  456. package/dist/chunk-IFJTPAQQ.js.map +0 -1
  457. package/dist/chunk-IK43HLDQ.js.map +0 -1
  458. package/dist/chunk-ISMV2QVG.js.map +0 -1
  459. package/dist/chunk-JBBSYJHP.js.map +0 -1
  460. package/dist/chunk-JFCV5QIK.js.map +0 -1
  461. package/dist/chunk-JRBNCUNT.js.map +0 -1
  462. package/dist/chunk-LB7FD65R.js +0 -163
  463. package/dist/chunk-LB7FD65R.js.map +0 -1
  464. package/dist/chunk-ONTBCHCP.js.map +0 -1
  465. package/dist/chunk-PK6JIDQ4.js.map +0 -1
  466. package/dist/chunk-RDXW3OBQ.js.map +0 -1
  467. package/dist/chunk-RFI7GGFO.js.map +0 -1
  468. package/dist/chunk-S3BFKGET.js.map +0 -1
  469. package/dist/chunk-SV6EAJEP.js.map +0 -1
  470. package/dist/chunk-T36RFODW.js.map +0 -1
  471. package/dist/chunk-T3GY65MA.js.map +0 -1
  472. package/dist/chunk-TAGR72IR.js.map +0 -1
  473. package/dist/chunk-TIGPQDYP.js +0 -14
  474. package/dist/chunk-TIGPQDYP.js.map +0 -1
  475. package/dist/chunk-U6JMEH2P.js.map +0 -1
  476. package/dist/chunk-UDSR4X4L.js.map +0 -1
  477. package/dist/chunk-UHNGNKLV.js.map +0 -1
  478. package/dist/chunk-VCBHAE4R.js.map +0 -1
  479. package/dist/chunk-VCTXU4AT.js.map +0 -1
  480. package/dist/chunk-VEALDPHW.js.map +0 -1
  481. package/dist/chunk-VKCADNMR.js.map +0 -1
  482. package/dist/chunk-VQNJ7UZL.js.map +0 -1
  483. package/dist/chunk-W2OG6JOL.js.map +0 -1
  484. package/dist/chunk-WG4QBZDN.js.map +0 -1
  485. package/dist/chunk-WHXXI3W5.js.map +0 -1
  486. package/dist/chunk-WKGF2TJR.js.map +0 -1
  487. package/dist/chunk-WNGGJWF7.js.map +0 -1
  488. package/dist/chunk-XTHCN77N.js.map +0 -1
  489. package/dist/chunk-YCH5GBN6.js +0 -99
  490. package/dist/chunk-YCH5GBN6.js.map +0 -1
  491. package/dist/chunk-YMUGBZN2.js.map +0 -1
  492. package/dist/collection-facade-KMBWNCYP.js +0 -44
  493. package/dist/cover-QJRXINN5.js +0 -52
  494. package/dist/delegation-SU6CV3W7.js +0 -25
  495. package/dist/derive-6RWU4EOA.js +0 -21
  496. package/dist/executor-KGNLJD6M.js +0 -9
  497. package/dist/executor-UX4FASYZ.js +0 -26
  498. package/dist/executor-XGIS6CR7.js +0 -9
  499. package/dist/export-accessible-LKW3QV22.js +0 -23
  500. package/dist/extract-partition-UP2ARO75.js +0 -38
  501. package/dist/find-YS6XWB46.js +0 -11
  502. package/dist/in/index.js +0 -1
  503. package/dist/issue-3ACYX7LO.js +0 -19
  504. package/dist/legacy/bundle.d.ts +0 -30
  505. package/dist/liberate-MQQXBUCY.js +0 -24
  506. package/dist/noydb-ANIW5FLE.js +0 -69
  507. package/dist/on/index.js +0 -17
  508. package/dist/port/as/index.d.ts +0 -26
  509. package/dist/port/at/index.d.ts +0 -18
  510. package/dist/port/in/index.d.ts +0 -21
  511. package/dist/port/on/index.d.ts +0 -27
  512. package/dist/port/ui/index.d.ts +0 -21
  513. package/dist/port/with/index.d.ts +0 -18
  514. package/dist/register-PAM3ASRZ.js +0 -23
  515. package/dist/registry-4S2U2TR4.js +0 -19
  516. package/dist/registry-NPOWJHC4.js +0 -9
  517. package/dist/registry-VZ3CCI2R.js +0 -18
  518. package/dist/request-withdrawal-DI3H5WUI.js +0 -31
  519. package/dist/revoke-R5CZSVUT.js +0 -24
  520. package/dist/seed-3ZMF5EQA.js.map +0 -1
  521. package/dist/signer-MBVHW4WE.js +0 -25
  522. package/dist/storage-3MEJUENZ.js +0 -23
  523. package/dist/tx/index.js.map +0 -1
  524. package/dist/ui/index.js +0 -1
  525. package/dist/with/index.js +0 -31
  526. package/dist/with-lookup/aggregate/index.d.ts +0 -23
  527. package/dist/withdraw-accessible-TZDATQVR.js +0 -28
  528. /package/dist/{api-3A3S4SHH.js.map → api-ZDKTWNBB.js.map} +0 -0
  529. /package/dist/{backup-YPUEKIJC.js.map → backup-2UX7PRM5.js.map} +0 -0
  530. /package/dist/{chunk-IY23KFNZ.js.map → chunk-35NMVJ7I.js.map} +0 -0
  531. /package/dist/{chunk-RTEK4C4I.js.map → chunk-4JQK3L4V.js.map} +0 -0
  532. /package/dist/{chunk-3ELCWU56.js.map → chunk-4ZKNC6A6.js.map} +0 -0
  533. /package/dist/{chunk-VAIS3SOM.js.map → chunk-55LX6FSX.js.map} +0 -0
  534. /package/dist/{chunk-6HPG2YNX.js.map → chunk-5DRROK5W.js.map} +0 -0
  535. /package/dist/{chunk-S6Q37VGE.js.map → chunk-5GQEU4DN.js.map} +0 -0
  536. /package/dist/{chunk-ZXEZCY6F.js.map → chunk-63FE525P.js.map} +0 -0
  537. /package/dist/{chunk-JVBO4SZL.js.map → chunk-6UBZ6I5Z.js.map} +0 -0
  538. /package/dist/{chunk-VRBTNCM4.js.map → chunk-ABS7FMMD.js.map} +0 -0
  539. /package/dist/{chunk-M75ZZHSR.js.map → chunk-BLBAQRBM.js.map} +0 -0
  540. /package/dist/{chunk-WOM2HTML.js.map → chunk-CI32CAFS.js.map} +0 -0
  541. /package/dist/{chunk-EO43ANYJ.js.map → chunk-DABACXEF.js.map} +0 -0
  542. /package/dist/{chunk-CJ5KKU6X.js.map → chunk-DMH3VZU5.js.map} +0 -0
  543. /package/dist/{chunk-WZSHL6DQ.js.map → chunk-DZ2JXHWK.js.map} +0 -0
  544. /package/dist/{chunk-Z4PD65VQ.js.map → chunk-EE7UHLKH.js.map} +0 -0
  545. /package/dist/{chunk-RNG4VRP4.js.map → chunk-EKRSCRNM.js.map} +0 -0
  546. /package/dist/{chunk-MT62YSPZ.js.map → chunk-FRMPM7WG.js.map} +0 -0
  547. /package/dist/{as/index.js.map → chunk-GJW4HX2O.js.map} +0 -0
  548. /package/dist/{chunk-KS6SAVCZ.js.map → chunk-GU3IP74F.js.map} +0 -0
  549. /package/dist/{chunk-SMIRGMS7.js.map → chunk-IXNCZTWA.js.map} +0 -0
  550. /package/dist/{chunk-WQIYTNJV.js.map → chunk-IXTSNGYY.js.map} +0 -0
  551. /package/dist/{chunk-NCCBLYEB.js.map → chunk-JJZGIE4U.js.map} +0 -0
  552. /package/dist/{chunk-DRWBEDYO.js.map → chunk-JYJFGD2H.js.map} +0 -0
  553. /package/dist/{chunk-XJMBYYQK.js.map → chunk-LNZKOUJR.js.map} +0 -0
  554. /package/dist/{chunk-R3BLCFD2.js.map → chunk-MBKVNOJS.js.map} +0 -0
  555. /package/dist/{chunk-N6WF5PKC.js.map → chunk-NFZGZ4AK.js.map} +0 -0
  556. /package/dist/{chunk-THVIPWRF.js.map → chunk-PEATRIYJ.js.map} +0 -0
  557. /package/dist/{chunk-YZQOGE2L.js.map → chunk-QDIH2744.js.map} +0 -0
  558. /package/dist/{chunk-6HY2X62D.js.map → chunk-QJNCB5SK.js.map} +0 -0
  559. /package/dist/{chunk-2PCAVW2I.js.map → chunk-SHEEBRZ4.js.map} +0 -0
  560. /package/dist/{chunk-RA5VTXXG.js.map → chunk-V6UQZA2H.js.map} +0 -0
  561. /package/dist/{chunk-QDPZWTN2.js.map → chunk-W3G5REIU.js.map} +0 -0
  562. /package/dist/{chunk-A4FXFAKF.js.map → chunk-W3L64Y3J.js.map} +0 -0
  563. /package/dist/{chunk-XDIAFPUM.js.map → chunk-WLXMTYGO.js.map} +0 -0
  564. /package/dist/{chunk-RJ6K6K5M.js.map → chunk-X3F5YJG2.js.map} +0 -0
  565. /package/dist/{chunk-YTGDPCPW.js.map → chunk-Y6B6HVKC.js.map} +0 -0
  566. /package/dist/{classified-marker-QWMASIT7.js.map → classified-marker-7PKJBFCG.js.map} +0 -0
  567. /package/dist/{at/index.js.map → collection-facade-6I5K5IOD.js.map} +0 -0
  568. /package/dist/{by/index.js.map → computed-AB45PS4V.js.map} +0 -0
  569. /package/dist/{in → cover}/index.js.map +0 -0
  570. /package/dist/{on → custody}/index.js.map +0 -0
  571. /package/dist/{dead-filter-66VGI6JV.js.map → dead-filter-FL3WIUZS.js.map} +0 -0
  572. /package/dist/{chunk-CHFZDSE4.js.map → derive-VGS7FKE3.js.map} +0 -0
  573. /package/dist/{ui → directory}/index.js.map +0 -0
  574. /package/dist/{collection-facade-KMBWNCYP.js.map → enclave-SPEEDYZ4.js.map} +0 -0
  575. /package/dist/{computed-DSMPXG2Y.js.map → executor-IEBLTBCW.js.map} +0 -0
  576. /package/dist/{cover-QJRXINN5.js.map → executor-OTF556PL.js.map} +0 -0
  577. /package/dist/{delegation-SU6CV3W7.js.map → executor-RM7XWQDU.js.map} +0 -0
  578. /package/dist/{derive-6RWU4EOA.js.map → export-accessible-P42BQ4PB.js.map} +0 -0
  579. /package/dist/{enclave-TKPN2G2U.js.map → extract-partition-TCYXRWBN.js.map} +0 -0
  580. /package/dist/{fanout-sidecar-B5LVUMQX.js.map → fanout-sidecar-SSMRSC2L.js.map} +0 -0
  581. /package/dist/{executor-KGNLJD6M.js.map → find-OZMTRIK3.js.map} +0 -0
  582. /package/dist/{with → introspection}/index.js.map +0 -0
  583. /package/dist/{executor-UX4FASYZ.js.map → issue-FCKN5O6C.js.map} +0 -0
  584. /package/dist/{executor-XGIS6CR7.js.map → ledger-6XBEVWYP.js.map} +0 -0
  585. /package/dist/{export-accessible-LKW3QV22.js.map → liberate-CYUOS4NC.js.map} +0 -0
  586. /package/dist/{extract-partition-UP2ARO75.js.map → link-set-NK6L2A5S.js.map} +0 -0
  587. /package/dist/{find-YS6XWB46.js.map → money/index.js.map} +0 -0
  588. /package/dist/{issue-3ACYX7LO.js.map → noydb-FZZIMLCI.js.map} +0 -0
  589. /package/dist/{ledger-PTK7XZYT.js.map → policy/index.js.map} +0 -0
  590. /package/dist/{post-register-2YHSADFI.js.map → post-register-VFIYISUK.js.map} +0 -0
  591. /package/dist/{liberate-MQQXBUCY.js.map → register-UKU2J6MN.js.map} +0 -0
  592. /package/dist/{link-set-SLJHDNRB.js.map → registry-2VCWVHZS.js.map} +0 -0
  593. /package/dist/{noydb-ANIW5FLE.js.map → registry-7Y5WF7GS.js.map} +0 -0
  594. /package/dist/{policy-YDLCOX4P.js.map → registry-BWD2ED52.js.map} +0 -0
  595. /package/dist/{register-PAM3ASRZ.js.map → registry-DTWRJLSF.js.map} +0 -0
  596. /package/dist/{registry-4S2U2TR4.js.map → request-withdrawal-JYDZ5XY2.js.map} +0 -0
  597. /package/dist/{reveal-HWO4YMTJ.js.map → reveal-CL2BCW6A.js.map} +0 -0
  598. /package/dist/{registry-NPOWJHC4.js.map → revoke-2TSAD2T4.js.map} +0 -0
  599. /package/dist/{registry-VW6P6A3J.js.map → schema-update/index.js.map} +0 -0
  600. /package/dist/{registry-VZ3CCI2R.js.map → search/index.js.map} +0 -0
  601. /package/dist/{request-withdrawal-DI3H5WUI.js.map → sequence/index.js.map} +0 -0
  602. /package/dist/{revoke-R5CZSVUT.js.map → signer-K7Z2EOMG.js.map} +0 -0
  603. /package/dist/{signer-MBVHW4WE.js.map → stale-A4J26OIC.js.map} +0 -0
  604. /package/dist/{stale-VZL4OGUB.js.map → storage-YVHZUISN.js.map} +0 -0
  605. /package/dist/{storage-3MEJUENZ.js.map → store/index.js.map} +0 -0
  606. /package/dist/{store-coordination-provider-FKX3F6TQ.js.map → store-coordination-provider-EWRZL7XF.js.map} +0 -0
  607. /package/dist/{verify-26Y5GNMK.js.map → verify-7XWHJWUN.js.map} +0 -0
  608. /package/dist/{withdraw-accessible-TZDATQVR.js.map → walk-P5D6CF4V.js.map} +0 -0
  609. /package/dist/with-lookup/{aggregate → reduce}/canonical-key.d.ts +0 -0
  610. /package/dist/{with-party → with-sync}/tab-coordination.d.ts +0 -0
  611. /package/dist/{with-party → with-sync}/tab-write-relay.d.ts +0 -0
@@ -1,9 +1,66 @@
1
+ import {
2
+ installViaBinder
3
+ } from "./chunk-6UBZ6I5Z.js";
1
4
  import {
2
5
  encrypt
3
- } from "./chunk-HOONYZY2.js";
6
+ } from "./chunk-AKKRXT23.js";
4
7
  import {
5
8
  NOYDB_FORMAT_VERSION
6
- } from "./chunk-VCTXU4AT.js";
9
+ } from "./chunk-QBAC3GXA.js";
10
+ import {
11
+ ValidationError
12
+ } from "./chunk-QZWTRENR.js";
13
+
14
+ // src/via/blob/binding.ts
15
+ async function eraseBlobs(ctx, cfg) {
16
+ if (cfg.purgeBlobsForRecord) return cfg.purgeBlobsForRecord(ctx.id);
17
+ return { shredded: 0, residue: [] };
18
+ }
19
+ function buildBlobDescribeFragment(fields) {
20
+ return {
21
+ blobFields: Object.fromEntries(
22
+ Object.entries(fields).map(([field, p]) => [field, {
23
+ ...p.retainDays !== void 0 ? { retainDays: p.retainDays } : {},
24
+ ...p.evictWhen !== void 0 ? { evictWhen: true } : {},
25
+ ...p.legalHold !== void 0 ? { legalHold: true } : {},
26
+ ...p.retainUntil !== void 0 ? { retainUntil: true } : {},
27
+ ...p.external === true ? { external: true } : {},
28
+ ...p.public === true ? { public: true } : {},
29
+ ...p.backlink !== void 0 ? { backlink: p.backlink } : {}
30
+ }])
31
+ )
32
+ };
33
+ }
34
+ function blobBinding(cfg) {
35
+ return {
36
+ brand: "blob",
37
+ // encryptedAtRest: 'envelope' — blob chunks are AEAD-encrypted envelopes
38
+ // in `_blob_chunks` (service-side), not sealed record fields; queryable:
39
+ // 'none' — nothing indexes blob content; exportable — vault.exportBlobs()
40
+ // is a first-class door; forgettable — shredAllForRecord participates in
41
+ // vault.forget().
42
+ posture: { encryptedAtRest: "envelope", queryable: "none", exportable: true, forgettable: true },
43
+ covers: (field) => field in cfg.fields,
44
+ erase: (ctx) => eraseBlobs(ctx, cfg),
45
+ describeFragment: () => buildBlobDescribeFragment(cfg.fields)
46
+ };
47
+ }
48
+ function linkBlobVia() {
49
+ installViaBinder("blob", (c) => blobBinding(c));
50
+ }
51
+
52
+ // src/port/with/blob-strategy.ts
53
+ linkBlobVia();
54
+ var NO_BLOBS = {
55
+ openSlot() {
56
+ throw new Error(
57
+ 'Blob storage is not enabled on this Noydb instance. Import `{ withBlobs }` from "@noy-db/hub/blobs" and pass `withBlobs()` to `createNoydb({ blobsStrategy: withBlobs() })`.'
58
+ );
59
+ },
60
+ cacheStats() {
61
+ return { hits: 0, misses: 0, bytesDownloaded: 0 };
62
+ }
63
+ };
7
64
 
8
65
  // src/with-shape/blobs/export-blobs.ts
9
66
  var ExportBlobsAbortedError = class extends Error {
@@ -113,12 +170,16 @@ async function runCompaction(ctx, options = {}) {
113
170
  const now = options.now ?? /* @__PURE__ */ new Date();
114
171
  const maxEvictions = options.maxEvictions ?? Infinity;
115
172
  const dryRun = options.dryRun === true;
173
+ if (options.cacheBudget !== void 0 && (!Number.isFinite(options.cacheBudget.maxBytes) || options.cacheBudget.maxBytes < 0)) {
174
+ throw new ValidationError("compact(): cacheBudget.maxBytes must be a non-negative finite number (#808)");
175
+ }
116
176
  const allCollections = await ctx.listCollections();
117
177
  const byCollection = {};
118
178
  let evicted = 0;
119
179
  let records = 0;
120
180
  let auditEntries = 0;
121
181
  let held = 0;
182
+ let pinned = 0;
122
183
  let collectionsWithPolicy = 0;
123
184
  outer: for (const collectionName of allCollections) {
124
185
  if (collectionName.startsWith("_")) continue;
@@ -142,6 +203,10 @@ async function runCompaction(ctx, options = {}) {
142
203
  if (!policy) continue;
143
204
  const reason = evaluatePolicy(policy, record, slot, now);
144
205
  if (!reason) continue;
206
+ if (slot.pinned === true) {
207
+ pinned += 1;
208
+ continue;
209
+ }
145
210
  if (isHeld(policy, record, now)) {
146
211
  held += 1;
147
212
  continue;
@@ -165,15 +230,91 @@ async function runCompaction(ctx, options = {}) {
165
230
  }
166
231
  }
167
232
  }
233
+ let budgetEvicted = 0;
234
+ let budgetBytesFreed = 0;
235
+ if (options.cacheBudget !== void 0) {
236
+ const pass = await runBudgetPass(ctx, options.cacheBudget.maxBytes, {
237
+ now,
238
+ dryRun,
239
+ remainingEvictions: maxEvictions - evicted
240
+ });
241
+ budgetEvicted = pass.evicted;
242
+ budgetBytesFreed = pass.bytesFreed;
243
+ auditEntries += pass.auditEntries;
244
+ }
168
245
  return {
169
246
  evicted,
170
247
  records,
171
248
  collections: collectionsWithPolicy,
172
249
  auditEntries,
173
250
  held,
251
+ pinned,
252
+ budgetEvicted,
253
+ budgetBytesFreed,
174
254
  byCollection
175
255
  };
176
256
  }
257
+ async function runBudgetPass(ctx, maxBytes, opts) {
258
+ const candidates = [];
259
+ let total = 0;
260
+ for (const collectionName of await ctx.listCollections()) {
261
+ if (collectionName.startsWith("_")) continue;
262
+ const config = ctx.getBlobFields(collectionName);
263
+ for (const recordId of await ctx.listRecords(collectionName)) {
264
+ const slots = await ctx.listSlots(collectionName, recordId).catch(() => []);
265
+ if (slots.length === 0) continue;
266
+ const record = config ? await ctx.getRecord(collectionName, recordId).catch(() => null) : null;
267
+ for (const slot of slots) {
268
+ if (slot.pinned === true) continue;
269
+ const policy = config?.[slot.name];
270
+ if (policy && record !== null && isHeld(policy, record, opts.now)) continue;
271
+ const lastAccessMs = Date.parse(slot.lastAccessAt ?? slot.uploadedAt) || 0;
272
+ const isExternal = slot.external !== void 0;
273
+ const bytes = isExternal ? slot.cachedBytes ?? 0 : slot.size;
274
+ if (bytes <= 0) continue;
275
+ total += bytes;
276
+ candidates.push({
277
+ collection: collectionName,
278
+ recordId,
279
+ slotName: slot.name,
280
+ eTag: slot.eTag,
281
+ bytes,
282
+ kind: isExternal ? "cache" : "slot",
283
+ lastAccessMs
284
+ });
285
+ }
286
+ }
287
+ }
288
+ candidates.sort((a, b) => a.lastAccessMs - b.lastAccessMs || a.collection.localeCompare(b.collection) || a.recordId.localeCompare(b.recordId) || a.slotName.localeCompare(b.slotName));
289
+ let evicted = 0;
290
+ let bytesFreed = 0;
291
+ let auditEntries = 0;
292
+ for (const c of candidates) {
293
+ if (total <= maxBytes || evicted >= opts.remainingEvictions) break;
294
+ if (!opts.dryRun) {
295
+ if (c.kind === "slot") {
296
+ await ctx.deleteSlot(c.collection, c.recordId, c.slotName);
297
+ await writeAuditEntry(ctx, {
298
+ id: generateEvictionId(c.collection, c.recordId, c.slotName),
299
+ collection: c.collection,
300
+ recordId: c.recordId,
301
+ slotName: c.slotName,
302
+ blobHash: c.eTag,
303
+ reason: "budget",
304
+ evictedAt: opts.now.toISOString(),
305
+ actor: ctx.actor
306
+ });
307
+ auditEntries += 1;
308
+ } else {
309
+ await ctx.dropLocalCache?.(c.collection, c.recordId, c.slotName);
310
+ }
311
+ }
312
+ evicted += 1;
313
+ bytesFreed += c.bytes;
314
+ total -= c.bytes;
315
+ }
316
+ return { evicted, bytesFreed, auditEntries };
317
+ }
177
318
  function isHeld(policy, record, now) {
178
319
  if (policy.legalHold) {
179
320
  try {
@@ -252,10 +393,11 @@ async function writeAuditEntry(ctx, entry) {
252
393
  }
253
394
 
254
395
  export {
396
+ NO_BLOBS,
255
397
  ExportBlobsAbortedError,
256
398
  EXPORT_AUDIT_COLLECTION,
257
399
  createExportBlobsHandle,
258
400
  BLOB_EVICTION_AUDIT_COLLECTION,
259
401
  runCompaction
260
402
  };
261
- //# sourceMappingURL=chunk-U6JMEH2P.js.map
403
+ //# sourceMappingURL=chunk-CXQW2NWO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/via/blob/binding.ts","../src/port/with/blob-strategy.ts","../src/with-shape/blobs/export-blobs.ts","../src/with-shape/blobs/blob-compaction.ts"],"sourcesContent":["/**\n * The blob `ViaBinding` (#629 Task 7) — wires the `blobFields` declaration\n * into the kernel's generic Via port as a deliberately THIN binding:\n * declaration + posture + `describeFragment` + `erase` glue, and nothing\n * else. Blob content is fully out-of-band (`collection.blob(id)` →\n * `BlobSet` writing `_blob_*` side-collections; it never touches\n * `_putInternal` or the record codec), so this binding declares **no\n * write/read pipeline hooks** — in particular no `encodeAtRest`/\n * `decodeAtRest`: a blobFields collection must not flip the pipeline's\n * `hasAtRestHooks`, or the codec would abandon its inline seal path for a\n * feature that never seals record fields. The routing/compaction/TTL/\n * legal-hold/exportBlobs machinery stays service-side in\n * `with-shape/blobs/` (the i18n-dictionary precedent — that machinery\n * does real chunk AEAD + key-lifecycle work `via-enclave-isolation`\n * forbids under `via/*`).\n *\n * Like classified (see `port/with/classified-strategy.ts`), the link is\n * EAGER — `port/with/blob-strategy.ts` calls {@link linkBlobVia} at module\n * load. `blobFields` policies are plain object literals (there is no\n * `blob.*()` declaration factory to hang a lazy link on), so the binder\n * must be installed before `compileViaBindings` ever sees one.\n *\n * There is no `declare`-time validation: `blobFields` has never had a\n * construction-time refusal matrix (policies are consulted lazily by\n * `vault.compact()` and `BlobSet.put`), and inventing one here would\n * break the behavior lock.\n *\n * `covers` (#629 Task 8) is a passive coverage predicate, not a pipeline\n * hook — it lets `ViaPipeline.postureFor` recognize a `blobFields` slot so\n * `.where()`/`.orderBy()`/`.aggregate()` can refuse it (posture\n * `queryable: 'none'`); it does not participate in clause building or\n * evaluation.\n */\nimport type { ViaBinding, ViaEraseCtx, ViaEraseReport } from '../../kernel/via/index.js'\nimport { installViaBinder } from '../../kernel/via/index.js'\nimport type { BlobFieldsConfig } from '../../with-shape/blobs/blob-compaction.js'\n\n/**\n * Config a blob collection's `blobFields` declaration resolves to — the\n * binding's construction input. `purgeBlobsForRecord` is an OPTIONAL\n * vault/service-provided closure for the `erase` hook, mapping\n * `collection.blob(id).shredAllForRecord()`'s `{shredded, retainedShared,\n * residue}: string[]` accounting onto `ViaEraseReport` — `shredded`/\n * `retainedShared` become counts, each residue eTag becomes a tagged\n * `{kind: 'blob-residue', eTag}` entry.\n *\n * DELIBERATELY left unwired by `compileViaBindings` (#629 Task 10, resolved\n * within parity-first — see task-10-report.md \"blob purge\" section):\n * `per-blob-cek.test.ts`/`forget.test.ts` prove blob-shred-on-forget is\n * gated SOLELY on the vault's `blobsStrategy` being configured, never on a\n * given collection's OWN `blobFields` declaration (`.blob(id)` is callable,\n * and IS exercised by those tests, on collections with no `blobFields` at\n * all). Routing it exclusively through this binding would silently stop\n * blob crypto-shredding for every such collection; `vault.forget()` keeps\n * calling `collection.blob(id).shredAllForRecord()` directly for that\n * reason. The hook stays real/tested (see `blob-binding.test.ts`) for a\n * future caller that wants it.\n */\nexport interface BlobViaConfig {\n readonly fields: BlobFieldsConfig\n readonly collectionName: string\n /** Purge one record's blob slots (crypto-shred participation). Returns the erase report for `forget()`'s summary. */\n readonly purgeBlobsForRecord?: (id: string) => Promise<ViaEraseReport>\n}\n\n/**\n * `forget()`'s per-ref blob-purge participation: delegate to the wired\n * closure, or report a clean zero-shredded, zero-residue no-op — the\n * default in production too (#629 Task 10 deliberately leaves this unwired;\n * see `BlobViaConfig`'s doc comment).\n */\nasync function eraseBlobs(ctx: ViaEraseCtx, cfg: BlobViaConfig): Promise<ViaEraseReport> {\n if (cfg.purgeBlobsForRecord) return cfg.purgeBlobsForRecord(ctx.id)\n return { shredded: 0, residue: [] }\n}\n\n/**\n * One field's blob knobs as they appear on `describeFragment()`'s payload\n * (#657 — the second real `ViaBinding.describeFragment` consumer after\n * `lookup`'s; see `with-shape/introspection/describe.ts`'s `buildDescription`).\n * Declarative scalars (`retainDays`/`external`/`public`/`backlink`) verbatim;\n * predicate knobs (`evictWhen`/`legalHold`/`retainUntil` — functions over the\n * decrypted record) as presence flags, since a predicate has no serializable\n * form — mirrors `buildBlobDescribeFragment`'s per-field shape below.\n */\nexport interface BlobDescribeFragmentEntry {\n readonly retainDays?: number\n readonly evictWhen?: true\n readonly legalHold?: true\n readonly retainUntil?: true\n readonly external?: true\n readonly public?: true\n readonly backlink?: string\n}\n\n/** The `'blob'` binding's `describeFragment()` payload shape. */\nexport interface BlobDescribeFragment {\n readonly blobFields: Record<string, BlobDescribeFragmentEntry>\n}\n\n/**\n * `{ blobFields: { <field>: <knobs> } }` — declarative scalars\n * (`retainDays`/`external`/`public`/`backlink`) verbatim; predicate knobs\n * (`evictWhen`/`legalHold`/`retainUntil` — functions over the decrypted\n * record) as presence flags, since a predicate has no serializable form.\n */\nfunction buildBlobDescribeFragment(fields: BlobFieldsConfig): Record<string, unknown> {\n return {\n blobFields: Object.fromEntries(\n Object.entries(fields).map(([field, p]) => [field, {\n ...(p.retainDays !== undefined ? { retainDays: p.retainDays } : {}),\n ...(p.evictWhen !== undefined ? { evictWhen: true } : {}),\n ...(p.legalHold !== undefined ? { legalHold: true } : {}),\n ...(p.retainUntil !== undefined ? { retainUntil: true } : {}),\n ...(p.external === true ? { external: true } : {}),\n ...(p.public === true ? { public: true } : {}),\n ...(p.backlink !== undefined ? { backlink: p.backlink } : {}),\n }]),\n ),\n }\n}\n\nexport function blobBinding(cfg: BlobViaConfig): ViaBinding {\n return {\n brand: 'blob',\n // encryptedAtRest: 'envelope' — blob chunks are AEAD-encrypted envelopes\n // in `_blob_chunks` (service-side), not sealed record fields; queryable:\n // 'none' — nothing indexes blob content; exportable — vault.exportBlobs()\n // is a first-class door; forgettable — shredAllForRecord participates in\n // vault.forget().\n posture: { encryptedAtRest: 'envelope', queryable: 'none', exportable: true, forgettable: true },\n covers: (field) => field in cfg.fields,\n erase: (ctx) => eraseBlobs(ctx, cfg),\n describeFragment: () => buildBlobDescribeFragment(cfg.fields),\n }\n}\n\nexport function linkBlobVia(): void {\n installViaBinder('blob', (c) => blobBinding(c as BlobViaConfig))\n}\n","/**\n * Strategy seam between core Collection and the optional blob service\n * (#629 Task 7 — moved out of `with-shape/blobs/strategy.ts`, precedent:\n * `port/with/classified-strategy.ts`/`i18n-strategy.ts`). Lives on the\n * `/with` port (the one seam the kernel spine may import statically) so\n * `Collection`/`Vault` can hold the `NO_BLOBS` default without a\n * spine→service static import.\n *\n * Core imports `BlobsStrategy` as a TYPE-ONLY symbol and `NO_BLOBS` as a\n * minimal runtime stub. Neither pulls in the heavy `BlobSet` / chunk /\n * MIME machinery — those only arrive when the consumer explicitly\n * imports `@noy-db/hub/blobs` (see `via/blob/index.ts` →\n * `withBlobs()` factory).\n *\n * This file is intentionally tiny so the bundler keeps it in the graph\n * without dragging everything else in.\n *\n * @internal\n */\n\nimport type { BlobSet } from '../../with-shape/blobs/blob-set.js'\nimport type { NoydbStore } from '../../kernel/types.js'\nimport type { ObjectProjection } from '../../with-shape/blobs/object-projection.js'\nimport type { BlobFieldsConfig } from '../../with-shape/blobs/blob-compaction.js'\nimport type { EnclaveKey } from '../../kernel/enclave/index.js'\nimport type { BlobCacheStats } from '../../with-shape/blobs/blob-pinning.js'\nimport type { UnlockedKeyring } from '../../with-party/team/keyring.js'\nimport { linkBlobVia } from '../../via/blob/binding.js'\n\n// Install the blob Via binder EAGERLY (#629 Task 7) — `blobFields` policies\n// are plain object literals (there is no `blob.*()` declaration factory to\n// hang a lazy money/i18n-style link on), so the binder must be installed\n// before `compileViaBindings` ever compiles one. This port module is\n// already unconditionally imported by the kernel spine (for the `NO_BLOBS`\n// strategy default below), so linking here guarantees it — same rationale\n// as `port/with/classified-strategy.ts`'s eager `linkClassifiedVia()`. The\n// binding module is hook-free glue (declare/describe/erase) and imports no\n// machinery, so the eager cost is a few hundred bytes, not `BlobSet`.\nlinkBlobVia()\n\n/**\n * Args forwarded by `Collection.blob(id)` to the active strategy's\n * `openSlot`. The strategy is responsible for returning a live\n * `BlobSet` bound to the given record.\n *\n * @internal\n */\nexport interface BlobsStrategyOpenArgs {\n readonly store: NoydbStore\n readonly vault: string\n readonly collection: string\n readonly recordId: string\n readonly getDEK: (collectionName: string) => Promise<EnclaveKey>\n readonly encrypted: boolean\n readonly userId: string\n /**\n * Collection opts into per-record keys (`perRecordKeys`), so its blobs are\n * erasable: new uploads mint a per-blob content CEK (crypto-shreddable at\n * `refCount → 0`). Off → legacy shared-`_blob`-DEK chunks. See the per-blob\n * CEK design spec.\n */\n readonly erasableBlobs?: boolean\n /**\n * Collection has `tiers` active (#724 I1 completion). Combined with\n * `erasableBlobs` false, a content write is refused —\n * `UnsupportedTierCompositionError` — since a legacy blob has no\n * per-blob `_cek` and can never be tier-isolated on elevate/demote.\n */\n readonly tiersActive?: boolean\n /**\n * Vault is in debug-plaintext mode (`encrypt: false` + `debugPlaintext: true`).\n * Blobs are then written as a single un-gzipped object (one base64 chunk) so\n * the stored object is directly recoverable with native tools (`base64 -d`),\n * matching the directly-inspectable record layout. Dev-only — see the\n * plaintext/debug-store-mode design.\n */\n readonly debugPlaintext?: boolean\n /**\n * Object projection for `external` blob fields (`createNoydb({ objectStore })`).\n * When present, fields declared `external` in `blobFields` route their raw\n * bytes here instead of the encrypted-chunk path.\n */\n readonly objectStore?: ObjectProjection\n /** Per-collection blob field policies — used to resolve `external` / `public`. */\n readonly blobFields?: BlobFieldsConfig\n /**\n * The caller's unlocked keyring (#749). Threaded through so `BlobSet.atTier()`\n * can run `assertTierAccess` — the SAME clearance gate `putAtTier`/`elevate`/\n * `demote` run before any tier `getDEK` call — rather than relying on a bare\n * `getDEK`, which auto-mints a DEK for ANY role and never throws (verified: it\n * is not itself a gate). Omitted only by a construction path that never calls\n * `atTier()`.\n */\n readonly keyring?: UnlockedKeyring\n}\n\n/**\n * The seam interface. `@internal` — do not build public APIs on this\n * shape; it can evolve freely until blobs are extracted into their\n * own package, at which point it will be promoted to public.\n *\n * @internal\n */\nexport interface BlobsStrategy {\n openSlot(args: BlobsStrategyOpenArgs): BlobSet\n /**\n * Snapshot of this device's blob-cache KPI counters: local-read hits,\n * network misses, and total bytes downloaded from the object store (#808).\n *\n * Lives on the seam rather than on the `withBlobs()` return type so the\n * service has exactly one name (#844b) — `NO_BLOBS` answers with zeros,\n * which is the truthful reading of \"blobs were never enabled\".\n */\n cacheStats(): BlobCacheStats\n}\n\n/**\n * Default strategy for collections that did not opt into blob storage.\n * Every operation surfaces an actionable error that points the caller\n * at the opt-in path.\n *\n * @internal\n */\nexport const NO_BLOBS: BlobsStrategy = {\n openSlot() {\n throw new Error(\n 'Blob storage is not enabled on this Noydb instance. ' +\n 'Import `{ withBlobs }` from \"@noy-db/hub/blobs\" and pass `withBlobs()` to `createNoydb({ blobsStrategy: withBlobs() })`.',\n )\n },\n cacheStats() {\n return { hits: 0, misses: 0, bytesDownloaded: 0 }\n },\n}\n","/**\n * `vault.exportBlobs()` — bulk blob extraction primitive.\n *\n * Async-iterable handle over every blob attached to records in a\n * vault, optionally filtered by collection allowlist and per-record\n * predicate. Emits tuples of `{ blobId, recordRef, bytes, meta }` so\n * the consumer can pipe into any sink (zip stream, S3 multipart, USB\n * copy, cold-storage tape) without pulling the whole export into\n * memory.\n *\n * ## Auth + audit\n *\n * - Capability check runs **once** at handle creation via\n * `Vault.assertCanExport('plaintext', 'blob')`. An operator whose\n * keyring lacks that bit fails before a single byte of ciphertext\n * is decrypted.\n * - Audit entry lands in `_export_audit` at handle creation: the\n * actor, start timestamp, target collections, predicate presence,\n * and batch mechanism. **No content hashes** — per the spec\n * non-correlation invariant.\n *\n * ## Abort + resume\n *\n * - `handle.abort()` flips the internal signal; the next iteration\n * boundary throws `AbortError`. Consumers already in `for await`\n * can catch and exit cleanly.\n * - Restart after a partial failure with `{ afterBlobId }` — the\n * iterator skips tuples up to (and including) that blob id before\n * yielding again. Combined with a blob-count ceiling it supports\n * idempotent batch re-runs.\n *\n * @module\n */\n\nimport type { Collection } from '../../kernel/collection.js'\nimport type { SlotInfo } from '../../kernel/types.js'\n\n// ─── Types ──────────────────────────────────────────────────────────────\n\nexport interface ExportBlobsOptions {\n /**\n * Collection allowlist. Omit to export blobs from every collection\n * the caller has read access to.\n */\n readonly collections?: readonly string[]\n /**\n * Per-record predicate. Called on the decrypted record BEFORE any\n * blob bytes are read for that record — returning false skips the\n * record and all its slots without touching their chunks.\n */\n readonly where?: (record: unknown, context: { collection: string; id: string }) => boolean\n /**\n * Resume after a specific blob id. The iterator skips tuples up to\n * and including this id, then yields. Format of the id is the same\n * as `ExportedBlob.blobId` (the HMAC-keyed eTag).\n */\n readonly afterBlobId?: string\n /**\n * External abort signal. When fired, the next iterator tick throws\n * `ExportBlobsAbortedError`. Honored alongside `handle.abort()`.\n */\n readonly signal?: AbortSignal\n}\n\nexport interface ExportedBlob {\n /** Opaque blob identifier — HMAC-keyed eTag, stable across vaults. */\n readonly blobId: string\n /** Where this blob came from in the vault. */\n readonly recordRef: {\n readonly collection: string\n readonly id: string\n readonly slot: string\n }\n /** Decrypted plaintext bytes. */\n readonly bytes: Uint8Array\n /** Best-effort metadata (from the blob slot record). */\n readonly meta: {\n readonly size: number\n /**\n * User-visible filename stored on the slot. Often equal to the\n * slot name; differs when the caller supplied an explicit\n * `filename` to `BlobSet.put()`.\n */\n readonly filename: string\n readonly mimeType?: string\n readonly createdAt?: string\n }\n}\n\nexport interface ExportBlobsHandle extends AsyncIterable<ExportedBlob> {\n /** Abort the export. Safe to call multiple times. */\n abort(): void\n /** True once `abort()` has fired or the external signal aborted. */\n readonly aborted: boolean\n}\n\nexport class ExportBlobsAbortedError extends Error {\n constructor(reason: string) {\n super(`exportBlobs aborted: ${reason}`)\n this.name = 'ExportBlobsAbortedError'\n }\n}\n\n// ─── Audit ──────────────────────────────────────────────────────────────\n\nexport const EXPORT_AUDIT_COLLECTION = '_export_audit'\n\nexport interface ExportBlobsAuditEntry {\n readonly id: string\n readonly mechanism: 'exportBlobs'\n readonly actor: string\n readonly startedAt: string\n readonly collections: readonly string[] | null\n readonly predicate: boolean\n readonly afterBlobId: string | null\n}\n\n// ─── Implementation ─────────────────────────────────────────────────────\n\n/**\n * Build the handle. Factored out of `Vault.exportBlobs` so the\n * implementation can be unit-tested without going through the\n * compartment lifecycle.\n */\nexport function createExportBlobsHandle(\n actor: string,\n listAccessibleCollections: () => Promise<string[]>,\n getCollection: <T>(name: string) => Collection<T>,\n writeAudit: (entry: ExportBlobsAuditEntry) => Promise<void>,\n options: ExportBlobsOptions,\n): ExportBlobsHandle {\n let aborted = false\n\n const abort = (): void => {\n aborted = true\n }\n\n if (options.signal) {\n if (options.signal.aborted) aborted = true\n options.signal.addEventListener('abort', () => { aborted = true })\n }\n\n function assertLive(): void {\n if (aborted) throw new ExportBlobsAbortedError('aborted by caller')\n }\n\n const allowlist = options.collections ? new Set(options.collections) : null\n\n // Write the audit entry BEFORE the first yield so a blocked\n // iteration still leaves an audit trail that the export started.\n let auditPromise: Promise<void> | null = null\n function writeAuditOnce(): Promise<void> {\n if (!auditPromise) {\n auditPromise = writeAudit({\n id: generateBatchId(),\n mechanism: 'exportBlobs',\n actor,\n startedAt: new Date().toISOString(),\n collections: options.collections ?? null,\n predicate: Boolean(options.where),\n afterBlobId: options.afterBlobId ?? null,\n })\n }\n return auditPromise\n }\n\n async function* generate(): AsyncGenerator<ExportedBlob> {\n await writeAuditOnce()\n assertLive()\n\n // Resolve target collections lazily — also keeps the call async.\n const allCollections = await listAccessibleCollections()\n const targets = allCollections.filter(name => {\n if (name.startsWith('_')) return false\n if (allowlist && !allowlist.has(name)) return false\n return true\n })\n\n let resumeCursorHit = options.afterBlobId === undefined\n\n for (const collectionName of targets) {\n if (aborted) return\n\n const coll = getCollection<Record<string, unknown>>(collectionName)\n const records = await coll.list().catch(() => [])\n for (const record of records) {\n if (aborted) return\n assertLive()\n\n const idField = (record as { id?: unknown }).id\n if (typeof idField !== 'string') continue\n\n if (options.where && !options.where(record, { collection: collectionName, id: idField })) continue\n\n const blobSet = coll.blob(idField)\n const slots = await blobSet.list().catch(() => [] as SlotInfo[])\n for (const slot of slots) {\n if (aborted) return\n\n if (!resumeCursorHit) {\n if (slot.eTag === options.afterBlobId) {\n resumeCursorHit = true\n }\n continue\n }\n\n const bytes = await blobSet.get(slot.name)\n if (!bytes) continue\n\n const item: ExportedBlob = {\n blobId: slot.eTag,\n recordRef: { collection: collectionName, id: idField, slot: slot.name },\n bytes,\n meta: {\n size: slot.size,\n filename: slot.filename,\n ...(slot.mimeType !== undefined && { mimeType: slot.mimeType }),\n ...(slot.uploadedAt !== undefined && { createdAt: slot.uploadedAt }),\n },\n }\n yield item\n }\n }\n }\n }\n\n const handle: ExportBlobsHandle = {\n abort,\n get aborted() { return aborted },\n [Symbol.asyncIterator]: () => generate(),\n }\n return handle\n}\n\n// ─── Helpers ────────────────────────────────────────────────────────────\n\nfunction generateBatchId(): string {\n // 16 bytes of crypto randomness, URL-safe base64, no padding.\n const raw = globalThis.crypto.getRandomValues(new Uint8Array(16))\n let s = ''\n for (const b of raw) s += b.toString(16).padStart(2, '0')\n return `batch-${Date.now().toString(36)}-${s.slice(0, 12)}`\n}\n","/**\n * Blob retention + compaction.\n *\n * Declarative per-collection / per-slot eviction policy. Two\n * triggers:\n *\n * - **`retainDays`** — age-based TTL. A slot uploaded more than N\n * days ago is evicted.\n * - **`evictWhen(record)`** — predicate over the **decrypted**\n * record. Lets consumers express \"the image is safe to drop once\n * the structured invoice has been reviewed and confirmed.\"\n *\n * Either trigger (or both) causes the slot to evict. Eviction removes\n * the slot entry from `_blob_slots_{collection}`, decrements the\n * blob's refCount (so unreferenced chunks can be GC'd by the next\n * sweep), and writes one entry to the `_blob_eviction_audit`\n * collection for tamper-evident record-keeping.\n *\n * The audit entry carries the eTag of the evicted blob (opaque HMAC\n * of plaintext under the vault's `_blob` DEK) — no plaintext leakage,\n * per the SPEC non-correlation invariant. Consumers reconstructing\n * \"what used to be attached\" can look up the audit entry by record\n * id.\n *\n * Compaction is **consumer-scheduled** — noy-db never runs a\n * background daemon. Call `vault.compact()` whenever your workflow\n * allows (cron, manual \"tidy\" button, cold-storage export prep, …).\n *\n * @module\n */\n\nimport type { NoydbStore, EncryptedEnvelope, SlotInfo } from '../../kernel/types.js'\nimport { NOYDB_FORMAT_VERSION } from '../../kernel/types.js'\nimport { ValidationError } from '../../kernel/errors.js'\nimport { encrypt, type EnclaveKey } from '../../kernel/enclave/index.js'\n\n// ─── Config types ───────────────────────────────────────────────────────\n\nexport interface BlobFieldPolicy<T = unknown> {\n /**\n * Via port brand marker — lets a `BlobFieldPolicy` satisfy the kernel's\n * opaque `ViaDescriptor` (#629 Task 7). Optional (the\n * `ClassifiedFieldSpec._viaBrand` precedent): `blobFields` policies are\n * plain object literals with no declaration factory to stamp it, so a\n * mandatory field would break every existing declaration.\n */\n readonly _viaBrand?: 'blob'\n /**\n * Age-based TTL in days. A slot whose `uploadedAt` is older than\n * `now - retainDays × 86400s` evicts on the next `vault.compact()`.\n * Omit to disable age-based eviction.\n */\n readonly retainDays?: number\n /**\n * Predicate evaluated against the decrypted record. When it returns\n * `true`, every matching slot on that record evicts. Omit to\n * disable predicate-based eviction.\n */\n readonly evictWhen?: (record: T) => boolean\n /**\n * **Legal hold.** When this predicate returns `true`, the slot is\n * never evicted — `retainDays`/`evictWhen` are overridden. Use for a\n * litigation / audit hold on a fiscal document: the blob stays until\n * the predicate returns `false` (the hold is released). Fail-closed:\n * if the predicate throws, the slot is treated as held.\n */\n readonly legalHold?: (record: T) => boolean\n /**\n * **Period-bound retention.** Returns the date (Date / ISO string /\n * epoch ms) until which the slot must be retained — typically derived\n * from the record's fiscal period (e.g. period end + 10 years). While\n * `now < retainUntil`, the slot is never evicted, regardless of\n * `retainDays`. Return `null`/`undefined` to impose no floor.\n * Fail-closed: a throwing function holds the slot.\n */\n readonly retainUntil?: (record: T) => Date | string | number | null | undefined\n /**\n * **External projection.** When `true`, this field's bytes are stored in the\n * vault's `ObjectProjection` (`createNoydb({ objectStore })`) as a single raw,\n * **unencrypted** object — servable directly from S3/CDN and processable by\n * native tooling — instead of the encrypted-chunk path. The encrypted slot\n * record remains the catalog (anchoring invariant). Requires an `objectStore`;\n * **outside the zero-knowledge guarantee** — use only for assets meant to\n * leave the vault. See the as-aws-s3 design spec.\n */\n readonly external?: boolean\n /**\n * For an `external` field: make the object world-readable (CDN origin) rather\n * than presigned-only. Default `false` (presigned). Ignored unless `external`.\n */\n readonly public?: boolean\n /**\n * For an `external` field: how to stamp a **backlink** (this record's\n * vault/collection/id/field) onto the object's metadata — the self-describing\n * \"secondary store\" that powers reconcile / DR / import re-pairing.\n * - `'opaque-token'` (default): a random id; preserves the opaque-bucket\n * property (no names leak); the token is also recorded on the slot.\n * - `'encrypted'`: the reference encrypted under the blob DEK (ZK-preserving;\n * falls back to `'opaque-token'` on a plaintext vault).\n * - `'plain'`: the reference in cleartext metadata — **leaks structure** to\n * bucket readers; only for non-sensitive deployments.\n * - `'none'`: no backlink.\n */\n readonly backlink?: 'opaque-token' | 'encrypted' | 'plain' | 'none'\n}\n\nexport type BlobFieldsConfig<T = unknown> = Record<string, BlobFieldPolicy<T>>\n\n// ─── Audit collection ──────────────────────────────────────────────────\n\nexport const BLOB_EVICTION_AUDIT_COLLECTION = '_blob_eviction_audit'\n\nexport interface BlobEvictionEntry {\n readonly id: string\n readonly collection: string\n readonly recordId: string\n readonly slotName: string\n readonly blobHash: string\n /** `'budget'` — evicted by the #808 cache-budget LRU pass, not a policy. */\n readonly reason: 'ttl' | 'predicate' | 'both' | 'budget'\n readonly evictedAt: string\n readonly actor: string\n}\n\n// ─── Compaction result ──────────────────────────────────────────────────\n\nexport interface CompactionResult {\n /** Number of blob slots evicted by the policy pass across all collections. */\n readonly evicted: number\n /** Number of records touched (iterated + policy checked). */\n readonly records: number\n /** Number of collections with `blobFields` configured. */\n readonly collections: number\n /**\n * Number of audit entries written — one per policy eviction plus one per\n * budget SLOT eviction (dropping a device-local cache copy writes none).\n */\n readonly auditEntries: number\n /**\n * Number of slots that would have evicted (TTL/predicate triggered)\n * but were retained by a `legalHold` or `retainUntil` floor.\n */\n readonly held: number\n /**\n * #808: number of slots whose due policy eviction was skipped because they\n * are pinned for offline on THIS device (pin state is device-local).\n */\n readonly pinned: number\n /**\n * #808: number of evictions performed by the `cacheBudget` LRU pass —\n * internal slots evicted through the standard eviction writer plus\n * device-local external cache copies dropped. 0 when no budget was given.\n */\n readonly budgetEvicted: number\n /** #808: plaintext bytes freed by the `cacheBudget` LRU pass. */\n readonly budgetBytesFreed: number\n /** Per-collection breakdown for diagnostics. */\n readonly byCollection: Record<string, { records: number; evicted: number }>\n}\n\n// ─── Core ──────────────────────────────────────────────────────────────\n\nexport interface CompactRunOptions {\n /** Override \"now\" for deterministic testing. */\n readonly now?: Date\n /**\n * Stop after this many evictions. Useful for capped batches / cron\n * jobs that need to fit in a time window. `undefined` = unbounded.\n */\n readonly maxEvictions?: number\n /**\n * Dry-run — evaluate policies and return the counts, but do NOT\n * delete slots or write audit entries. Lets a consumer preview\n * what would happen.\n */\n readonly dryRun?: boolean\n /**\n * #808 mobile cache budget: cap the locally-cached UNPINNED blob bytes.\n * After the policy pass, a dedicated LRU pass walks every collection's\n * slots (pinned slots and `legalHold`/`retainUntil`-held slots are exempt\n * and uncounted) and evicts oldest-access-first — internal slots through\n * the standard eviction writer (`deleteSlot` + a `'budget'` audit entry),\n * external slots by dropping their device-local encrypted cache copy only\n * (the object-store copy is authoritative and untouched) — until the\n * remaining unpinned bytes fit `maxBytes`. Internal slots count their\n * uncompressed `size`; external slots count `cachedBytes` (0 = nothing\n * local, nothing to evict). LRU order comes from the device-local\n * `lastAccessAt` stamp, falling back to `uploadedAt`.\n */\n readonly cacheBudget?: { readonly maxBytes: number }\n}\n\nexport interface CompactionContext {\n readonly adapter: NoydbStore\n readonly vault: string\n readonly actor: string\n readonly encrypted: boolean\n readonly getDEK: (collection: string) => Promise<EnclaveKey>\n /**\n * Resolve a collection's declared `blobFields` config. Returns an\n * empty map for collections without the config — the walk skips\n * those.\n */\n readonly getBlobFields: <T>(collection: string) => BlobFieldsConfig<T> | null\n /** List collection names in the vault. */\n readonly listCollections: () => Promise<string[]>\n /** List record ids in a collection. */\n readonly listRecords: (collection: string) => Promise<string[]>\n /** Decrypt and return the record. Null when absent. */\n readonly getRecord: <T>(collection: string, id: string) => Promise<T | null>\n /** Return the BlobSet-like handle for a record's slots. */\n readonly listSlots: (collection: string, id: string) => Promise<SlotInfo[]>\n /** Delete a slot and decrement its blob's refCount. */\n readonly deleteSlot: (collection: string, id: string, slotName: string) => Promise<void>\n /**\n * #808: drop a slot's DEVICE-LOCAL cached copy (the encrypted external\n * side-cache) without touching the slot or the object store. Returns the\n * plaintext bytes freed. Optional — absent (or a 0 return) means external\n * cache entries simply cannot be budget-evicted through this context.\n */\n readonly dropLocalCache?: (collection: string, id: string, slotName: string) => Promise<number>\n}\n\nexport async function runCompaction(\n ctx: CompactionContext,\n options: CompactRunOptions = {},\n): Promise<CompactionResult> {\n const now = options.now ?? new Date()\n const maxEvictions = options.maxEvictions ?? Infinity\n const dryRun = options.dryRun === true\n if (options.cacheBudget !== undefined\n && (!Number.isFinite(options.cacheBudget.maxBytes) || options.cacheBudget.maxBytes < 0)) {\n throw new ValidationError('compact(): cacheBudget.maxBytes must be a non-negative finite number (#808)')\n }\n\n const allCollections = await ctx.listCollections()\n const byCollection: Record<string, { records: number; evicted: number }> = {}\n let evicted = 0\n let records = 0\n let auditEntries = 0\n let held = 0\n let pinned = 0\n let collectionsWithPolicy = 0\n\n outer: for (const collectionName of allCollections) {\n if (collectionName.startsWith('_')) continue\n const config = ctx.getBlobFields(collectionName)\n if (!config) continue\n const configuredSlots = Object.keys(config)\n if (configuredSlots.length === 0) continue\n collectionsWithPolicy += 1\n byCollection[collectionName] = { records: 0, evicted: 0 }\n\n const ids = await ctx.listRecords(collectionName)\n for (const recordId of ids) {\n if (evicted >= maxEvictions) break outer\n\n const record = await ctx.getRecord(collectionName, recordId).catch(() => null)\n if (record === null) continue\n records += 1\n byCollection[collectionName].records += 1\n\n const slots = await ctx.listSlots(collectionName, recordId).catch(() => [])\n for (const slot of slots) {\n if (evicted >= maxEvictions) break outer\n const policy = config[slot.name]\n if (!policy) continue\n\n const reason = evaluatePolicy(policy, record, slot, now)\n if (!reason) continue\n\n // #808: device-local offline pin — an exemption inside this existing\n // pass, exactly like a hold: counted, never evicted. `slot.pinned` is\n // the device-local annotation `BlobSet.list()` stamps from the\n // withBlobs() pin registry (never synced state).\n if (slot.pinned === true) {\n pinned += 1\n continue\n }\n\n // Retention floor: a legal hold or period-bound retainUntil\n // blocks an otherwise-due eviction. Counted, never evicted.\n if (isHeld(policy, record, now)) {\n held += 1\n continue\n }\n\n if (!dryRun) {\n await ctx.deleteSlot(collectionName, recordId, slot.name)\n await writeAuditEntry(ctx, {\n id: generateEvictionId(collectionName, recordId, slot.name),\n collection: collectionName,\n recordId,\n slotName: slot.name,\n blobHash: slot.eTag,\n reason,\n evictedAt: now.toISOString(),\n actor: ctx.actor,\n })\n auditEntries += 1\n }\n evicted += 1\n byCollection[collectionName].evicted += 1\n }\n }\n }\n\n // #808: cache-budget LRU pass — runs AFTER the policy pass so a slot that\n // just evicted no longer counts toward the budget. Reuses this module's own\n // eviction writer (deleteSlot + audit), never a parallel one.\n let budgetEvicted = 0\n let budgetBytesFreed = 0\n if (options.cacheBudget !== undefined) {\n const pass = await runBudgetPass(ctx, options.cacheBudget.maxBytes, {\n now, dryRun, remainingEvictions: maxEvictions - evicted,\n })\n budgetEvicted = pass.evicted\n budgetBytesFreed = pass.bytesFreed\n auditEntries += pass.auditEntries\n }\n\n return {\n evicted,\n records,\n collections: collectionsWithPolicy,\n auditEntries,\n held,\n pinned,\n budgetEvicted,\n budgetBytesFreed,\n byCollection,\n }\n}\n\n// ─── #808: cache-budget LRU pass ───────────────────────────────────────\n\ninterface BudgetCandidate {\n readonly collection: string\n readonly recordId: string\n readonly slotName: string\n readonly eTag: string\n readonly bytes: number\n /** `'slot'` — internal blob, evicted via `deleteSlot`; `'cache'` — external device-local copy, dropped via `dropLocalCache`. */\n readonly kind: 'slot' | 'cache'\n readonly lastAccessMs: number\n}\n\n/**\n * Enforce `cacheBudget.maxBytes` over the locally-cached UNPINNED blob bytes\n * (see {@link CompactRunOptions.cacheBudget} for the full contract). Walks\n * EVERY collection — unlike the policy pass, the budget is not gated on a\n * declared `blobFields` config — but still honors a declared policy's\n * `legalHold`/`retainUntil` floor where one exists.\n */\nasync function runBudgetPass(\n ctx: CompactionContext,\n maxBytes: number,\n opts: { now: Date; dryRun: boolean; remainingEvictions: number },\n): Promise<{ evicted: number; bytesFreed: number; auditEntries: number }> {\n const candidates: BudgetCandidate[] = []\n let total = 0\n\n for (const collectionName of await ctx.listCollections()) {\n if (collectionName.startsWith('_')) continue\n const config = ctx.getBlobFields(collectionName)\n for (const recordId of await ctx.listRecords(collectionName)) {\n const slots = await ctx.listSlots(collectionName, recordId).catch(() => [])\n if (slots.length === 0) continue\n // The record is only needed to evaluate a declared policy's retention\n // floor — skip the decrypt entirely for policy-less collections.\n const record = config\n ? await ctx.getRecord<unknown>(collectionName, recordId).catch(() => null)\n : null\n for (const slot of slots) {\n if (slot.pinned === true) continue // pinned: exempt AND uncounted (#808)\n const policy = config?.[slot.name]\n if (policy && record !== null && isHeld(policy, record, opts.now)) continue // floor blocks budget too\n const lastAccessMs = Date.parse(slot.lastAccessAt ?? slot.uploadedAt) || 0\n const isExternal = slot.external !== undefined\n const bytes = isExternal ? slot.cachedBytes ?? 0 : slot.size\n if (bytes <= 0) continue // external with no local copy: nothing cached to evict\n total += bytes\n candidates.push({\n collection: collectionName, recordId, slotName: slot.name, eTag: slot.eTag,\n bytes, kind: isExternal ? 'cache' : 'slot', lastAccessMs,\n })\n }\n }\n }\n\n // Oldest access first; deterministic tiebreak so equal timestamps (common\n // within one ms) never make the eviction order flap between runs.\n candidates.sort((a, b) =>\n a.lastAccessMs - b.lastAccessMs\n || a.collection.localeCompare(b.collection)\n || a.recordId.localeCompare(b.recordId)\n || a.slotName.localeCompare(b.slotName))\n\n let evicted = 0\n let bytesFreed = 0\n let auditEntries = 0\n for (const c of candidates) {\n if (total <= maxBytes || evicted >= opts.remainingEvictions) break\n if (!opts.dryRun) {\n if (c.kind === 'slot') {\n await ctx.deleteSlot(c.collection, c.recordId, c.slotName)\n await writeAuditEntry(ctx, {\n id: generateEvictionId(c.collection, c.recordId, c.slotName),\n collection: c.collection,\n recordId: c.recordId,\n slotName: c.slotName,\n blobHash: c.eTag,\n reason: 'budget',\n evictedAt: opts.now.toISOString(),\n actor: ctx.actor,\n })\n auditEntries += 1\n } else {\n // Device-local cache drop only — the slot (catalog) and the\n // object-store copy are untouched, so no eviction audit entry.\n await ctx.dropLocalCache?.(c.collection, c.recordId, c.slotName)\n }\n }\n evicted += 1\n bytesFreed += c.bytes\n total -= c.bytes\n }\n\n return { evicted, bytesFreed, auditEntries }\n}\n\n/**\n * Whether a retention floor (legal hold or period-bound `retainUntil`)\n * currently blocks eviction of this record's slots. Fail-closed: a\n * throwing predicate holds the slot.\n */\nfunction isHeld<T>(policy: BlobFieldPolicy<T>, record: T, now: Date): boolean {\n if (policy.legalHold) {\n try {\n if (policy.legalHold(record)) return true\n } catch {\n return true\n }\n }\n if (policy.retainUntil) {\n try {\n const until = policy.retainUntil(record)\n if (until !== null && until !== undefined) {\n const t = until instanceof Date ? until.getTime() : typeof until === 'number' ? until : Date.parse(String(until))\n if (!Number.isFinite(t)) return true // fail-closed: unparseable retainUntil holds the slot\n if (t > now.getTime()) return true\n }\n } catch {\n return true\n }\n }\n return false\n}\n\nfunction evaluatePolicy<T>(\n policy: BlobFieldPolicy<T>,\n record: T,\n slot: SlotInfo,\n now: Date,\n): 'ttl' | 'predicate' | 'both' | null {\n let ttlTriggered = false\n let predicateTriggered = false\n\n if (policy.retainDays !== undefined && policy.retainDays > 0) {\n const uploadedAt = Date.parse(slot.uploadedAt)\n if (Number.isFinite(uploadedAt)) {\n const ageMs = now.getTime() - uploadedAt\n const limitMs = policy.retainDays * 86_400_000\n if (ageMs > limitMs) ttlTriggered = true\n }\n }\n\n if (policy.evictWhen) {\n try {\n if (policy.evictWhen(record)) predicateTriggered = true\n } catch {\n // Predicate error → do NOT evict. Fail closed.\n }\n }\n\n if (ttlTriggered && predicateTriggered) return 'both'\n if (ttlTriggered) return 'ttl'\n if (predicateTriggered) return 'predicate'\n return null\n}\n\nfunction generateEvictionId(collection: string, recordId: string, slotName: string): string {\n const rand = globalThis.crypto.getRandomValues(new Uint8Array(8))\n let suffix = ''\n for (const b of rand) suffix += b.toString(16).padStart(2, '0')\n return `${collection}__${recordId}__${slotName}__${suffix}`\n}\n\nasync function writeAuditEntry(ctx: CompactionContext, entry: BlobEvictionEntry): Promise<void> {\n const json = JSON.stringify(entry)\n let envelope: EncryptedEnvelope\n if (ctx.encrypted) {\n const dek = await ctx.getDEK(BLOB_EVICTION_AUDIT_COLLECTION)\n const { iv, data } = await encrypt(json, dek)\n envelope = {\n _noydb: NOYDB_FORMAT_VERSION,\n _v: 1,\n _ts: entry.evictedAt,\n _iv: iv,\n _data: data,\n _by: entry.actor,\n }\n } else {\n envelope = {\n _noydb: NOYDB_FORMAT_VERSION,\n _v: 1,\n _ts: entry.evictedAt,\n _iv: '',\n _data: json,\n _by: entry.actor,\n }\n }\n await ctx.adapter.put(ctx.vault, BLOB_EVICTION_AUDIT_COLLECTION, entry.id, envelope)\n}\n"],"mappings":";;;;;;;;;;;;;;AAuEA,eAAe,WAAW,KAAkB,KAA6C;AACvF,MAAI,IAAI,oBAAqB,QAAO,IAAI,oBAAoB,IAAI,EAAE;AAClE,SAAO,EAAE,UAAU,GAAG,SAAS,CAAC,EAAE;AACpC;AAgCA,SAAS,0BAA0B,QAAmD;AACpF,SAAO;AAAA,IACL,YAAY,OAAO;AAAA,MACjB,OAAO,QAAQ,MAAM,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO;AAA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A,IACb;AAAA,EACF;AACA,QAAM,IAAI,QAAQ,IAAI,IAAI,OAAO,gCAAgC,MAAM,IAAI,QAAQ;AACrF;","names":[]}
@@ -4,10 +4,10 @@ import {
4
4
  persistUserVisibility,
5
5
  readUserVisibility,
6
6
  saveUserEnvelope
7
- } from "./chunk-NCCBLYEB.js";
7
+ } from "./chunk-JJZGIE4U.js";
8
8
  import {
9
9
  PolicyDeniedError
10
- } from "./chunk-W2OG6JOL.js";
10
+ } from "./chunk-QZWTRENR.js";
11
11
 
12
12
  // src/with-party/directory/user-envelope/api.ts
13
13
  var UserApi = class {
@@ -379,4 +379,4 @@ export {
379
379
  UserApi,
380
380
  createUserApi
381
381
  };
382
- //# sourceMappingURL=chunk-EO43ANYJ.js.map
382
+ //# sourceMappingURL=chunk-DABACXEF.js.map
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  openEnvelopeJson
3
- } from "./chunk-W4TCUGQR.js";
3
+ } from "./chunk-G2JUIDFA.js";
4
4
  import {
5
5
  encrypt
6
- } from "./chunk-HOONYZY2.js";
6
+ } from "./chunk-AKKRXT23.js";
7
7
  import {
8
8
  NOYDB_FORMAT_VERSION
9
- } from "./chunk-VCTXU4AT.js";
9
+ } from "./chunk-QBAC3GXA.js";
10
10
 
11
11
  // src/with-shape/persisted-schemas/storage.ts
12
12
  var SCHEMAS_COLLECTION = "_schemas";
@@ -46,4 +46,4 @@ export {
46
46
  loadPersistedSchema,
47
47
  savePersistedSchema
48
48
  };
49
- //# sourceMappingURL=chunk-CJ5KKU6X.js.map
49
+ //# sourceMappingURL=chunk-DMH3VZU5.js.map
@@ -0,0 +1,50 @@
1
+ import {
2
+ canonicalize
3
+ } from "./chunk-Y2NBBT6K.js";
4
+
5
+ // src/with-shape/schema-update/delta.ts
6
+ function computeSchemaDelta(stored, fresh, collection) {
7
+ const a = stored;
8
+ const b = fresh;
9
+ const aProps = a.properties ?? {};
10
+ const bProps = b.properties ?? {};
11
+ const aReq = new Set(a.required ?? []);
12
+ const bReq = new Set(b.required ?? []);
13
+ const aKeys = Object.keys(aProps);
14
+ const bKeys = Object.keys(bProps);
15
+ const added = bKeys.filter((k) => !(k in aProps));
16
+ const removed = aKeys.filter((k) => !(k in bProps));
17
+ const changed = [];
18
+ for (const k of bKeys) {
19
+ if (!(k in aProps)) continue;
20
+ const shapeChanged = canonicalize(aProps[k]) !== canonicalize(bProps[k]);
21
+ const requiredChanged = aReq.has(k) !== bReq.has(k);
22
+ if (shapeChanged || requiredChanged) {
23
+ changed.push({ field: k, requiredChanged, shapeChanged });
24
+ }
25
+ }
26
+ let kind;
27
+ if (added.length === 0 && removed.length === 0 && changed.length === 0) {
28
+ kind = "none";
29
+ } else if (removed.length === 0 && changed.length === 0 && added.every((k) => !bReq.has(k))) {
30
+ kind = "additive";
31
+ } else {
32
+ kind = "non-additive";
33
+ }
34
+ return { collection, kind, added, removed, changed };
35
+ }
36
+
37
+ // src/with-shape/schema-update/dispatch.ts
38
+ async function evaluateStrategies(delta, strategies, ctx) {
39
+ for (const strategy of strategies) {
40
+ const decision = await strategy.onSchemaDelta(delta, ctx);
41
+ if (decision.action !== "allow") return decision;
42
+ }
43
+ return { action: "allow" };
44
+ }
45
+
46
+ export {
47
+ computeSchemaDelta,
48
+ evaluateStrategies
49
+ };
50
+ //# sourceMappingURL=chunk-DSDXAKIP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-shape/schema-update/delta.ts","../src/with-shape/schema-update/dispatch.ts"],"sourcesContent":["/**\n * Classify the difference between two derived JSON Schemas.\n *\n * v1 ruleset — top-level object properties + required-ness:\n * - additive ⇔ only new OPTIONAL properties (no removals, no changed\n * properties, no new required field, no required-ness flip)\n * - non-additive ⇔ any removal, any shape/type change, any required-ness\n * flip, or a new REQUIRED property\n * Deeper rules (nested objects, union widening, type narrowing) are\n * deferred. Callers only invoke this with two object schemas.\n */\nimport { canonicalize } from '../persisted-schemas/canonicalize.js'\nimport type { SchemaDelta, FieldChange } from './types.js'\n\ninterface ObjectSchema {\n readonly properties?: Record<string, unknown>\n readonly required?: readonly string[]\n}\n\nexport function computeSchemaDelta(\n stored: object,\n fresh: object,\n collection: string,\n): SchemaDelta {\n const a = stored as ObjectSchema\n const b = fresh as ObjectSchema\n const aProps = a.properties ?? {}\n const bProps = b.properties ?? {}\n const aReq = new Set(a.required ?? [])\n const bReq = new Set(b.required ?? [])\n\n const aKeys = Object.keys(aProps)\n const bKeys = Object.keys(bProps)\n\n const added = bKeys.filter(k => !(k in aProps))\n const removed = aKeys.filter(k => !(k in bProps))\n\n const changed: FieldChange[] = []\n for (const k of bKeys) {\n if (!(k in aProps)) continue\n const shapeChanged = canonicalize(aProps[k]) !== canonicalize(bProps[k])\n const requiredChanged = aReq.has(k) !== bReq.has(k)\n if (shapeChanged || requiredChanged) {\n changed.push({ field: k, requiredChanged, shapeChanged })\n }\n }\n\n let kind: SchemaDelta['kind']\n if (added.length === 0 && removed.length === 0 && changed.length === 0) {\n kind = 'none'\n } else if (\n removed.length === 0 &&\n changed.length === 0 &&\n added.every(k => !bReq.has(k))\n ) {\n kind = 'additive'\n } else {\n kind = 'non-additive'\n }\n\n return { collection, kind, added, removed, changed }\n}\n","/** Ordered strategy evaluation: first non-`allow` decision wins. */\nimport type { SchemaDelta, SchemaUpdateStrategy, UpdateContext, UpdateDecision } from './types.js'\n\nexport async function evaluateStrategies(\n delta: SchemaDelta,\n strategies: readonly SchemaUpdateStrategy[],\n ctx: UpdateContext,\n): Promise<UpdateDecision> {\n for (const strategy of strategies) {\n const decision = await strategy.onSchemaDelta(delta, ctx)\n if (decision.action !== 'allow') return decision\n }\n return { action: 'allow' }\n}\n"],"mappings":";;;;;AAmBO,SAAS,mBACd,QACA,OACA,YACa;AACb,QAAM,IAAI;AACV,QAAM,IAAI;AACV,QAAM,SAAS,EAAE,cAAc,CAAC;AAChC,QAAM,SAAS,EAAE,cAAc,CAAC;AAChC,QAAM,OAAO,IAAI,IAAI,EAAE,YAAY,CAAC,CAAC;AACrC,Q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} from "./chunk-ZJADGNYF.js";
8
8
  import {
9
9
  encrypt
10
- } from "./chunk-HOONYZY2.js";
10
+ } from "./chunk-AKKRXT23.js";
11
11
  import {
12
12
  NOYDB_FORMAT_VERSION
13
- } from "./chunk-VCTXU4AT.js";
13
+ } from "./chunk-QBAC3GXA.js";
14
14
  import {
15
15
  AttestationError
16
- } from "./chunk-W2OG6JOL.js";
16
+ } from "./chunk-QZWTRENR.js";
17
17
 
18
18
  // src/with-audit/attestation/issue.ts
19
19
  import {
@@ -56,4 +56,4 @@ async function issueAttestationCore(ctx, args) {
56
56
  export {
57
57
  issueAttestationCore
58
58
  };
59
- //# sourceMappingURL=chunk-WZSHL6DQ.js.map
59
+ //# sourceMappingURL=chunk-DZ2JXHWK.js.map
@@ -0,0 +1,23 @@
1
+ // src/with-fork/snapshots/strategy.ts
2
+ var NOT_ENABLED = new Error(
3
+ 'Snapshots require the snapshot strategy. Import `{ withSnapshots }` from "@noy-db/hub/snapshots" and pass it to `createNoydb({ snapshotsStrategy: withSnapshots({ store }) })`.'
4
+ );
5
+ var NO_SNAPSHOTS = {
6
+ async snapshot() {
7
+ throw NOT_ENABLED;
8
+ },
9
+ async listSnapshots() {
10
+ throw NOT_ENABLED;
11
+ },
12
+ async restoreSnapshot() {
13
+ throw NOT_ENABLED;
14
+ },
15
+ async autoSnapshot() {
16
+ throw NOT_ENABLED;
17
+ }
18
+ };
19
+
20
+ export {
21
+ NO_SNAPSHOTS
22
+ };
23
+ //# sourceMappingURL=chunk-DZFQVICS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-fork/snapshots/strategy.ts"],"sourcesContent":["import type { SnapshotPolicy } from './policy.js'\n\nexport interface SnapshotMeta {\n readonly version: string\n readonly label?: string\n readonly note?: string\n readonly exportedAt: string\n readonly exportedBy: string\n readonly size: number\n /**\n * `'verified'` — bundle was produced by `writePod(vault, {})`, which embeds\n * ledgerHead metadata; `vault.load()` runs `verifyBackupIntegrity()` on restore.\n * `'legacy-unverifiable'` — reserved for v2 import paths that read pre-existing bundles\n * lacking a ledgerHead; not produced by the current engine.\n */\n readonly integrity: 'verified' | 'legacy-unverifiable'\n /** `true` for the rolling auto-snapshot; absent on on-demand checkpoints. */\n readonly auto?: true\n}\n\nexport interface RetentionPolicy {\n readonly keepLast?: number\n readonly maxAgeDays?: number\n readonly prune?: boolean\n}\n\n/** @internal */\nexport interface SnapshotIndex {\n snapshots: SnapshotMeta[]\n nextCounter: number\n /** Single rolling auto-snapshot slot, separate from the immutable `snapshots` pool. */\n auto?: SnapshotMeta\n}\n\n/** @internal */\nexport interface SnapshotsStrategy {\n snapshot(vault: unknown, by: string, opts?: { label?: string; note?: string }): Promise<SnapshotMeta>\n listSnapshots(vaultId: string): Promise<SnapshotMeta[]>\n restoreSnapshot(vault: unknown, version: string): Promise<void>\n /** Rolling auto-snapshot to the fixed `<vault>__auto` key. */\n autoSnapshot(vault: unknown, by: string, opts?: { label?: string; note?: string }): Promise<SnapshotMeta>\n /** Configured cadence policy. Undefined or `mode:'manual'` ⇒ no scheduler is wired. */\n readonly policy?: SnapshotPolicy\n}\n\nconst NOT_ENABLED = new Error(\n 'Snapshots require the snapshot strategy. Import `{ withSnapshots }` from ' +\n '\"@noy-db/hub/snapshots\" and pass it to ' +\n '`createNoydb({ snapshotsStrategy: withSnapshots({ store }) })`.',\n)\n\n/** No-op stub. @internal */\nexport const NO_SNAPSHOTS: SnapshotsStrategy = {\n async snapshot() { throw NOT_ENABLED },\n async listSnapshots() { throw NOT_ENABLED },\n async restoreSnapshot() { throw NOT_ENABLED },\n async autoSnapshot() { throw NOT_ENABLED },\n}\n"],"mappings":";AA6CA,IAAM,cAAc,IAAI;AAAA,EACtB;AAGF;AAGO,IAAM,eAAkC;AAAA,EAC7C,MAAM,WAAW;AAAE,UAAM;AAAA,EAAY;AAAA,EACrC,MAAM,gBAAgB;AAAE,UAAM;AAAA,EAAY;AAAA,EAC1C,MAAM,kBAAkB;AAAE,UAAM;AAAA,EAAY;AAAA,EAC5C,MAAM,eAAe;AAAE,UAAM;AAAA,EAAY;AAC3C;","names":[]}
@@ -0,0 +1,63 @@
1
+ import {
2
+ NonAdditiveSchemaChangeError,
3
+ SchemaLockedError
4
+ } from "./chunk-QZWTRENR.js";
5
+
6
+ // src/with-shape/schema-update/strategies.ts
7
+ function blindUpdate() {
8
+ return { name: "blindUpdate", onSchemaDelta: () => ({ action: "allow" }) };
9
+ }
10
+ function additiveOnly() {
11
+ return {
12
+ name: "additiveOnly",
13
+ onSchemaDelta(delta) {
14
+ if (delta.kind === "non-additive") {
15
+ return {
16
+ action: "reject",
17
+ error: new NonAdditiveSchemaChangeError(
18
+ `Non-additive schema change to "${delta.collection}" (added: [${delta.added.join(", ")}], removed: [${delta.removed.join(", ")}], changed: [${delta.changed.map((c) => c.field).join(", ")}]). Register a coordinatedCutover() strategy to migrate, or revert the change.`
19
+ )
20
+ };
21
+ }
22
+ return { action: "allow" };
23
+ }
24
+ };
25
+ }
26
+ function lockSchema(opts) {
27
+ const fields = opts?.fields;
28
+ return {
29
+ name: "lockSchema",
30
+ onSchemaDelta(delta) {
31
+ if (delta.kind === "none") return { action: "allow" };
32
+ const touched = fields ? [...delta.added, ...delta.removed, ...delta.changed.map((c) => c.field)].filter((f) => fields.includes(f)) : ["<any>"];
33
+ if (touched.length === 0) return { action: "allow" };
34
+ return {
35
+ action: "reject",
36
+ error: new SchemaLockedError(
37
+ `Schema for "${delta.collection}" is locked` + (fields ? ` on fields [${fields.join(", ")}] (touched: [${touched.join(", ")}])` : "") + `; the change was refused.`
38
+ )
39
+ };
40
+ }
41
+ };
42
+ }
43
+
44
+ // src/with-shape/schema-update/cutover.ts
45
+ function coordinatedCutover(opts) {
46
+ return {
47
+ name: "coordinatedCutover",
48
+ onSchemaDelta(delta) {
49
+ if (delta.kind === "non-additive") {
50
+ return { action: "cutover", transform: opts.transform };
51
+ }
52
+ return { action: "allow" };
53
+ }
54
+ };
55
+ }
56
+
57
+ export {
58
+ blindUpdate,
59
+ additiveOnly,
60
+ lockSchema,
61
+ coordinatedCutover
62
+ };
63
+ //# sourceMappingURL=chunk-E23UGFVC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-shape/schema-update/strategies.ts","../src/with-shape/schema-update/cutover.ts"],"sourcesContent":["/** Bundled light update strategies. */\nimport { NonAdditiveSchemaChangeError, SchemaLockedError } from '../../kernel/errors.js'\nimport type { SchemaUpdateStrategy, SchemaDelta } from './types.js'\n\n/** Allow any schema change. Explicit blind / back-compat. */\nexport function blindUpdate(): SchemaUpdateStrategy {\n return { name: 'blindUpdate', onSchemaDelta: () => ({ action: 'allow' }) }\n}\n\n/** Allow additive changes; reject non-additive ones. The safety backstop. */\nexport function additiveOnly(): SchemaUpdateStrategy {\n return {\n name: 'additiveOnly',\n onSchemaDelta(delta: SchemaDelta) {\n if (delta.kind === 'non-additive') {\n return {\n action: 'reject' as const,\n error: new NonAdditiveSchemaChangeError(\n `Non-additive schema change to \"${delta.collection}\" ` +\n `(added: [${delta.added.join(', ')}], removed: [${delta.removed.join(', ')}], ` +\n `changed: [${delta.changed.map(c => c.field).join(', ')}]). ` +\n `Register a coordinatedCutover() strategy to migrate, or revert the change.`,\n ),\n }\n }\n return { action: 'allow' as const }\n },\n }\n}\n\n/**\n * Reject schema changes. With `fields`, reject only when one of those\n * fields is added/removed/changed; otherwise reject any non-`none` delta.\n */\nexport function lockSchema(opts?: { readonly fields?: readonly string[] }): SchemaUpdateStrategy {\n const fields = opts?.fields\n return {\n name: 'lockSchema',\n onSchemaDelta(delta: SchemaDelta) {\n if (delta.kind === 'none') return { action: 'allow' as const }\n const touched = fields\n ? [...delta.added, ...delta.removed, ...delta.changed.map(c => c.field)].filter(f => fields.includes(f))\n : ['<any>']\n if (touched.length === 0) return { action: 'allow' as const }\n return {\n action: 'reject' as const,\n error: new SchemaLockedError(\n `Schema for \"${delta.collection}\" is locked` +\n (fields ? ` on fields [${fields.join(', ')}] (touched: [${touched.join(', ')}])` : '') +\n `; the change was refused.`,\n ),\n }\n },\n }\n}\n","/** The coordinatedCutover update strategy (single-step — no from/to). */\nimport type { SchemaUpdateStrategy, SchemaDelta, TransformFn } from './types.js'\n\nexport function coordinatedCutover(opts: { readonly transform: TransformFn }): SchemaUpdateStrategy {\n return {\n name: 'coordinatedCutover',\n onSchemaDelta(delta: SchemaDelta) {\n if (delta.kind === 'non-additive') {\n return { action: 'cutover' as const, transform: opts.transform }\n }\n return { action: 'allow' as const }\n },\n }\n}\n"],"mappings":";;;;;;AAKO,SAAS,cAAoC;AAClD,SAAO,EAAE,MAAM,eAAe,eAAe,OAAO,EAAE,QAAQ,QAAQ,GAAG;AAC3E;AAGO,SAAS,eAAqC;AACnD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,cAAc,OAAoB;AAChC,UAAI,MAAM,SAAS,gBAAgB;AACjC,eAAO;AAAA,UACL,QAAQ;AAAA,UACR,OAAO,IAAI;AAAA,YACT,kCAAkC,MAAM,UAAU,cACpC,MAAM,MAAM,KAAK,IAAI,CAAC,gBAAgB,MAAM,QAAQ,KAAK,IAAI,CAAC,gBAC7D,MAAM,QAAQ,IAAI,OAAK,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC;AAAA,UAE3D;AAAA,QACF;AAAA,MACF;AACA,aAAO,EAAE,QAAQ,QAAiB;AAAA,IACpC;AAAA,EACF;AACF;AAMO,SAAS,WAAW,MAAsE;AAC/F,QAAM,SAAS,MAAM;AACrB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,cAAc,OAAoB;AAChC,UAAI,MAAM,SAAS,OAAQ,QAAO,EAAE,QAAQ,QAAiB;AAC7D,YAAM,UAAU,SACZ,CAAC,GAAG,MAAM,OAAO,GAAG,MAAM,SAAS,GAAG,MAAM,QAAQ,IAAI,OAAK,EAAE,KAAK,CAAC,EAAE,OAAO,OAAK,OAAO,SAAS,CAAC,CAAC,IACrG,CAAC,OAAO;AACZ,UAAI,QAAQ,WAAW,EAAG,QAAO,EAAE,QAAQ,QAAiB;AAC5D,aAAO;AAAA,QACL,QAAQ;AAAA,QACR,OAAO,IAAI;AAAA,UACT,eAAe,MAAM,UAAU,iBAC5B,SAAS,eAAe,OAAO,KAAK,IAAI,CAAC,gBAAgB,QAAQ,KAAK,IAAI,CAAC,OAAO,MACnF;AAAA,QACJ;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;ACnDO,SAAS,mBAAmB,MAAiE;AAClG,SAAO;AAAA,IACL,MAAM;AAAA,IACN,cAAc,OAAoB;AAChC,UAAI,MAAM,SAAS,gBAAgB;AACjC,eAAO,EAAE,QAAQ,WAAoB,WAAW,KAAK,UAAU;AAAA,MACjE;AACA,aAAO,EAAE,QAAQ,QAAiB;AAAA,IACpC;AAAA,EACF;AACF;","names":[]}
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  installViaBinder
3
- } from "./chunk-JVBO4SZL.js";
3
+ } from "./chunk-6UBZ6I5Z.js";
4
4
  import {
5
5
  SealedHandle
6
- } from "./chunk-VCTXU4AT.js";
6
+ } from "./chunk-QBAC3GXA.js";
7
7
  import {
8
8
  ClassifiedConfigError,
9
9
  ClassifiedNotEnabledError
10
- } from "./chunk-W2OG6JOL.js";
10
+ } from "./chunk-QZWTRENR.js";
11
11
 
12
12
  // src/via/classified/descriptor.ts
13
13
  function isClassifiedFieldSpec(x) {
@@ -262,4 +262,4 @@ export {
262
262
  enforceClassifiedWrite,
263
263
  NO_CLASSIFIED
264
264
  };
265
- //# sourceMappingURL=chunk-Z4PD65VQ.js.map
265
+ //# sourceMappingURL=chunk-EE7UHLKH.js.map