@noy-db/hub 0.4.0-pre.1 → 0.4.0-pre.11

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 (605) 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-LU2DTZTI.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 +53 -43
  10. package/dist/{chunk-YTGDPCPW.js → chunk-2J6UEN2V.js} +42 -18
  11. package/dist/chunk-2J6UEN2V.js.map +1 -0
  12. package/dist/{chunk-IY23KFNZ.js → chunk-35NMVJ7I.js} +3 -3
  13. package/dist/{chunk-S3BFKGET.js → chunk-3HUYRN24.js} +4 -4
  14. package/dist/chunk-3HUYRN24.js.map +1 -0
  15. package/dist/{walk-XS3PKM6I.js → chunk-3V3XR4S4.js} +4 -13
  16. package/dist/{walk-XS3PKM6I.js.map → chunk-3V3XR4S4.js.map} +1 -1
  17. package/dist/{chunk-RTEK4C4I.js → chunk-4JQK3L4V.js} +2 -2
  18. package/dist/{chunk-3ELCWU56.js → chunk-4ZKNC6A6.js} +2 -2
  19. package/dist/{chunk-VQNJ7UZL.js → chunk-55LKVALY.js} +106 -10
  20. package/dist/chunk-55LKVALY.js.map +1 -0
  21. package/dist/{chunk-VAIS3SOM.js → chunk-55LX6FSX.js} +2 -2
  22. package/dist/chunk-5D2ALSM5.js +19 -0
  23. package/dist/chunk-5D2ALSM5.js.map +1 -0
  24. package/dist/{chunk-6HPG2YNX.js → chunk-5DRROK5W.js} +2 -2
  25. package/dist/{chunk-S6Q37VGE.js → chunk-5GQEU4DN.js} +2 -2
  26. package/dist/chunk-5JOFWL4G.js +25 -0
  27. package/dist/chunk-5JOFWL4G.js.map +1 -0
  28. package/dist/{chunk-TOPYT5U5.js → chunk-63FE525P.js} +6 -6
  29. package/dist/chunk-6LJY7X5A.js +18 -0
  30. package/dist/chunk-6LJY7X5A.js.map +1 -0
  31. package/dist/{chunk-JVBO4SZL.js → chunk-6UBZ6I5Z.js} +2 -2
  32. package/dist/{chunk-BOKIKJJB.js → chunk-6ZNSB3H6.js} +5 -17
  33. package/dist/chunk-6ZNSB3H6.js.map +1 -0
  34. package/dist/{chunk-BMQWTQZ4.js → chunk-7YVBQJ7K.js} +13 -355
  35. package/dist/chunk-7YVBQJ7K.js.map +1 -0
  36. package/dist/{chunk-UFEVO57O.js → chunk-ABS7FMMD.js} +6 -6
  37. package/dist/chunk-AFHQATY4.js +47 -0
  38. package/dist/chunk-AFHQATY4.js.map +1 -0
  39. package/dist/{chunk-HOONYZY2.js → chunk-AKKRXT23.js} +7 -7
  40. package/dist/chunk-AKKRXT23.js.map +1 -0
  41. package/dist/{chunk-DDHM2TLX.js → chunk-AT2JJEKJ.js} +4 -4
  42. package/dist/chunk-AT2JJEKJ.js.map +1 -0
  43. package/dist/{chunk-M75ZZHSR.js → chunk-BLBAQRBM.js} +2 -2
  44. package/dist/{chunk-3SV2EPMN.js → chunk-BLCWSJLN.js} +88 -81
  45. package/dist/chunk-BLCWSJLN.js.map +1 -0
  46. package/dist/chunk-CADUYBQD.js +151 -0
  47. package/dist/chunk-CADUYBQD.js.map +1 -0
  48. package/dist/{chunk-G6EQYAL6.js → chunk-CI32CAFS.js} +5 -5
  49. package/dist/{chunk-FH52K7EG.js → chunk-CUZLNGD5.js} +2 -6
  50. package/dist/{chunk-FH52K7EG.js.map → chunk-CUZLNGD5.js.map} +1 -1
  51. package/dist/{chunk-2P7EGNKF.js → chunk-CXQW2NWO.js} +145 -3
  52. package/dist/chunk-CXQW2NWO.js.map +1 -0
  53. package/dist/{chunk-6B4DYGWO.js → chunk-DABACXEF.js} +3 -3
  54. package/dist/{chunk-F6T6L2UK.js → chunk-DMH3VZU5.js} +4 -4
  55. package/dist/chunk-DSDXAKIP.js +50 -0
  56. package/dist/chunk-DSDXAKIP.js.map +1 -0
  57. package/dist/{chunk-MQ6WOPSY.js → chunk-DZ2JXHWK.js} +5 -5
  58. package/dist/chunk-DZFQVICS.js +23 -0
  59. package/dist/chunk-DZFQVICS.js.map +1 -0
  60. package/dist/chunk-E23UGFVC.js +63 -0
  61. package/dist/chunk-E23UGFVC.js.map +1 -0
  62. package/dist/{chunk-UBNCR3YK.js → chunk-EE7UHLKH.js} +4 -4
  63. package/dist/chunk-EIPVYUEP.js +654 -0
  64. package/dist/chunk-EIPVYUEP.js.map +1 -0
  65. package/dist/{chunk-EGCRBCNA.js → chunk-EKRSCRNM.js} +3 -3
  66. package/dist/{chunk-YMUGBZN2.js → chunk-FQ5CHJR7.js} +1 -1
  67. package/dist/chunk-FQ5CHJR7.js.map +1 -0
  68. package/dist/{chunk-LB6OH6K2.js → chunk-FQZ6XTQ7.js} +17 -20
  69. package/dist/chunk-FQZ6XTQ7.js.map +1 -0
  70. package/dist/{chunk-IRQY7IR5.js → chunk-FRMPM7WG.js} +4 -4
  71. package/dist/{chunk-DVUZMT2W.js → chunk-G2JUIDFA.js} +9 -9
  72. package/dist/{chunk-DVUZMT2W.js.map → chunk-G2JUIDFA.js.map} +1 -1
  73. package/dist/{chunk-RND5ZPNP.js → chunk-G6WWZNJP.js} +13 -13
  74. package/dist/chunk-G6WWZNJP.js.map +1 -0
  75. package/dist/chunk-GJW4HX2O.js +1 -0
  76. package/dist/{chunk-T6GU5PPZ.js → chunk-GU3IP74F.js} +6 -6
  77. package/dist/{chunk-5OI6BR4H.js → chunk-GWWOGNBK.js} +308 -18
  78. package/dist/chunk-GWWOGNBK.js.map +1 -0
  79. package/dist/{chunk-UNCOC7QH.js → chunk-H2GPHUZD.js} +12 -13
  80. package/dist/chunk-H2GPHUZD.js.map +1 -0
  81. package/dist/{chunk-7CI6CP7Z.js → chunk-HMU5P6RL.js} +5 -5
  82. package/dist/chunk-HMU5P6RL.js.map +1 -0
  83. package/dist/{chunk-YJV2UZ7H.js → chunk-I5GEJX3R.js} +5 -5
  84. package/dist/chunk-I5GEJX3R.js.map +1 -0
  85. package/dist/{chunk-GWKAVKHI.js → chunk-IG6KUWBX.js} +2 -2
  86. package/dist/chunk-IG6KUWBX.js.map +1 -0
  87. package/dist/{chunk-MTQPRQHB.js → chunk-IPUG56GJ.js} +15 -5
  88. package/dist/{chunk-MTQPRQHB.js.map → chunk-IPUG56GJ.js.map} +1 -1
  89. package/dist/{chunk-SMIRGMS7.js → chunk-IXNCZTWA.js} +2 -2
  90. package/dist/{chunk-RM2XV574.js → chunk-IXTSNGYY.js} +3 -3
  91. package/dist/{chunk-KUPKLSX5.js → chunk-IYZISPGD.js} +7 -5
  92. package/dist/chunk-IYZISPGD.js.map +1 -0
  93. package/dist/{chunk-SMGEYW6G.js → chunk-JDOMW53O.js} +26 -16
  94. package/dist/chunk-JDOMW53O.js.map +1 -0
  95. package/dist/{chunk-PK6QCH2C.js → chunk-JJZGIE4U.js} +6 -5
  96. package/dist/{chunk-DRWBEDYO.js → chunk-JYJFGD2H.js} +2 -2
  97. package/dist/{chunk-TAGR72IR.js → chunk-KRCBZYTZ.js} +26 -177
  98. package/dist/chunk-KRCBZYTZ.js.map +1 -0
  99. package/dist/{chunk-HPUWOVR7.js → chunk-L2DGWBCT.js} +14 -14
  100. package/dist/chunk-L2DGWBCT.js.map +1 -0
  101. package/dist/{chunk-VEALDPHW.js → chunk-L3YYLT4E.js} +15 -2
  102. package/dist/chunk-L3YYLT4E.js.map +1 -0
  103. package/dist/{chunk-A7JJLVGH.js → chunk-LNPUSMZL.js} +29 -31
  104. package/dist/chunk-LNPUSMZL.js.map +1 -0
  105. package/dist/{chunk-KUIB4B5Q.js → chunk-LNZKOUJR.js} +2 -2
  106. package/dist/{chunk-IM3QVF53.js → chunk-MBKVNOJS.js} +6 -6
  107. package/dist/chunk-MCHBCNCE.js +367 -0
  108. package/dist/chunk-MCHBCNCE.js.map +1 -0
  109. package/dist/{chunk-VCBHAE4R.js → chunk-MHMLXJ3I.js} +2 -2
  110. package/dist/chunk-MHMLXJ3I.js.map +1 -0
  111. package/dist/{chunk-WNGGJWF7.js → chunk-MSMJJB4J.js} +2 -2
  112. package/dist/chunk-MSMJJB4J.js.map +1 -0
  113. package/dist/{chunk-T36RFODW.js → chunk-MXUT7FTE.js} +2 -2
  114. package/dist/chunk-MXUT7FTE.js.map +1 -0
  115. package/dist/{chunk-BGK233EA.js → chunk-N4BBNYIB.js} +11 -9
  116. package/dist/chunk-N4BBNYIB.js.map +1 -0
  117. package/dist/{chunk-3PF6CRDT.js → chunk-NFIBXF4V.js} +1082 -1583
  118. package/dist/chunk-NFIBXF4V.js.map +1 -0
  119. package/dist/{chunk-LOF2W3JU.js → chunk-NFNJLRY7.js} +368 -52
  120. package/dist/chunk-NFNJLRY7.js.map +1 -0
  121. package/dist/{chunk-N6WF5PKC.js → chunk-NFZGZ4AK.js} +2 -2
  122. package/dist/{chunk-JRBNCUNT.js → chunk-NGSJZFGL.js} +21 -4
  123. package/dist/chunk-NGSJZFGL.js.map +1 -0
  124. package/dist/chunk-NJ4DYYO5.js +81 -0
  125. package/dist/chunk-NJ4DYYO5.js.map +1 -0
  126. package/dist/{chunk-2IALOXZS.js → chunk-NM5UYF6Q.js} +2 -2
  127. package/dist/chunk-NM5UYF6Q.js.map +1 -0
  128. package/dist/{chunk-JBBSYJHP.js → chunk-NYEFP7DY.js} +4 -4
  129. package/dist/chunk-NYEFP7DY.js.map +1 -0
  130. package/dist/{chunk-CCOP5XDW.js → chunk-NZ24MX4J.js} +8 -46
  131. package/dist/chunk-NZ24MX4J.js.map +1 -0
  132. package/dist/{chunk-KWVJAOIN.js → chunk-OLEPKFTW.js} +4 -4
  133. package/dist/chunk-OLEPKFTW.js.map +1 -0
  134. package/dist/{chunk-OF75ACKS.js → chunk-PEATRIYJ.js} +9 -9
  135. package/dist/chunk-PEOZ34EM.js +13 -0
  136. package/dist/chunk-PEOZ34EM.js.map +1 -0
  137. package/dist/{chunk-UC2ETWF3.js → chunk-PTHKZWEH.js} +2 -14
  138. package/dist/{chunk-UC2ETWF3.js.map → chunk-PTHKZWEH.js.map} +1 -1
  139. package/dist/chunk-PVEWA2DU.js +23 -0
  140. package/dist/chunk-PVEWA2DU.js.map +1 -0
  141. package/dist/{chunk-LSASLXGC.js → chunk-QBAC3GXA.js} +1 -1
  142. package/dist/chunk-QBAC3GXA.js.map +1 -0
  143. package/dist/{chunk-RDXW3OBQ.js → chunk-QD46HPZG.js} +2 -2
  144. package/dist/chunk-QD46HPZG.js.map +1 -0
  145. package/dist/{chunk-N55W7KUL.js → chunk-QDIH2744.js} +2 -2
  146. package/dist/{chunk-6HY2X62D.js → chunk-QJNCB5SK.js} +2 -2
  147. package/dist/{chunk-4BRCIYFG.js → chunk-QX76XVQH.js} +6 -6
  148. package/dist/chunk-QX76XVQH.js.map +1 -0
  149. package/dist/{chunk-W2OG6JOL.js → chunk-QZWTRENR.js} +24 -7
  150. package/dist/chunk-QZWTRENR.js.map +1 -0
  151. package/dist/{chunk-6NQMXTYC.js → chunk-RO5NM6UI.js} +2 -2
  152. package/dist/chunk-RO5NM6UI.js.map +1 -0
  153. package/dist/chunk-SGDPRCC4.js +1075 -0
  154. package/dist/chunk-SGDPRCC4.js.map +1 -0
  155. package/dist/{chunk-2PCAVW2I.js → chunk-SHEEBRZ4.js} +2 -2
  156. package/dist/chunk-SMY5X46Z.js +14 -0
  157. package/dist/chunk-SMY5X46Z.js.map +1 -0
  158. package/dist/{chunk-ISMV2QVG.js → chunk-TG634KCO.js} +11 -2
  159. package/dist/chunk-TG634KCO.js.map +1 -0
  160. package/dist/{chunk-J6Q7UVQE.js → chunk-TUXQSFHZ.js} +4 -16
  161. package/dist/{chunk-J6Q7UVQE.js.map → chunk-TUXQSFHZ.js.map} +1 -1
  162. package/dist/{chunk-GULTLPFB.js → chunk-UADPR6F4.js} +3 -3
  163. package/dist/{chunk-GULTLPFB.js.map → chunk-UADPR6F4.js.map} +1 -1
  164. package/dist/{chunk-ZEQWCBCM.js → chunk-UDHBXYGG.js} +27 -5
  165. package/dist/chunk-UDHBXYGG.js.map +1 -0
  166. package/dist/{chunk-RA5VTXXG.js → chunk-V6UQZA2H.js} +2 -2
  167. package/dist/chunk-VG2ZSFYD.js +32 -0
  168. package/dist/chunk-VG2ZSFYD.js.map +1 -0
  169. package/dist/chunk-VKQCVU2Z.js +21 -0
  170. package/dist/chunk-VKQCVU2Z.js.map +1 -0
  171. package/dist/{chunk-QDPZWTN2.js → chunk-W3G5REIU.js} +2 -2
  172. package/dist/{chunk-WEYZTLXN.js → chunk-W3L64Y3J.js} +2 -2
  173. package/dist/{chunk-ONTBCHCP.js → chunk-W66AM5IB.js} +2 -2
  174. package/dist/chunk-W66AM5IB.js.map +1 -0
  175. package/dist/{chunk-A5BDDEXK.js → chunk-WBKZUO5V.js} +26 -43
  176. package/dist/chunk-WBKZUO5V.js.map +1 -0
  177. package/dist/{chunk-CBSY2N76.js → chunk-WLXMTYGO.js} +2 -2
  178. package/dist/{chunk-3U3FBR7O.js → chunk-X3F5YJG2.js} +2 -2
  179. package/dist/{chunk-GQNGCEP5.js → chunk-X45JYIAY.js} +3 -3
  180. package/dist/chunk-X45JYIAY.js.map +1 -0
  181. package/dist/{chunk-6XE5TMPR.js → chunk-X4MVWPHV.js} +3 -3
  182. package/dist/chunk-X4MVWPHV.js.map +1 -0
  183. package/dist/chunk-XZHEOSQ2.js +16 -0
  184. package/dist/chunk-XZHEOSQ2.js.map +1 -0
  185. package/dist/chunk-Y2NBBT6K.js +18 -0
  186. package/dist/chunk-Y2NBBT6K.js.map +1 -0
  187. package/dist/{chunk-DDATL6PU.js → chunk-Y2NJBNX3.js} +8 -8
  188. package/dist/{chunk-DDATL6PU.js.map → chunk-Y2NJBNX3.js.map} +1 -1
  189. package/dist/chunk-YMUFFJCO.js +23 -0
  190. package/dist/chunk-YMUFFJCO.js.map +1 -0
  191. package/dist/{chunk-O7WJ47EF.js → chunk-YWWQM7KP.js} +5 -14
  192. package/dist/chunk-YWWQM7KP.js.map +1 -0
  193. package/dist/{chunk-7O3AYBC7.js → chunk-YZJSJOUI.js} +235 -65
  194. package/dist/chunk-YZJSJOUI.js.map +1 -0
  195. package/dist/{chunk-5WZXVULX.js → chunk-ZTLOXFPB.js} +2 -2
  196. package/dist/chunk-ZTLOXFPB.js.map +1 -0
  197. package/dist/classified/index.js +5 -5
  198. package/dist/{classified-marker-WQVIJAW2.js → classified-marker-7PKJBFCG.js} +3 -3
  199. package/dist/collection-facade-6I5K5IOD.js +45 -0
  200. package/dist/{computed-DSMPXG2Y.js → computed-AB45PS4V.js} +3 -3
  201. package/dist/consent/index.js +13 -9
  202. package/dist/consent/index.js.map +1 -1
  203. package/dist/cover/index.js +37 -0
  204. package/dist/crdt/index.js +4 -0
  205. package/dist/crdt/index.js.map +1 -1
  206. package/dist/custody/index.js +26 -0
  207. package/dist/{dead-filter-2A7IAJ3D.js → dead-filter-FL3WIUZS.js} +2 -2
  208. package/dist/{chunk-GYYCX5K6.js → delegation-QXZ4MPPH.js} +12 -6
  209. package/dist/{chunk-GYYCX5K6.js.map → delegation-QXZ4MPPH.js.map} +1 -1
  210. package/dist/derivations/index.js +12 -12
  211. package/dist/derive-VGS7FKE3.js +22 -0
  212. package/dist/directory/index.js +46 -0
  213. package/dist/dispatch-EGGC7UD7.js +72 -0
  214. package/dist/dispatch-EGGC7UD7.js.map +1 -0
  215. package/dist/dispatch-GDSTUTVP.js +194 -0
  216. package/dist/dispatch-GDSTUTVP.js.map +1 -0
  217. package/dist/{enclave-7MW6ZGXW.js → enclave-SPEEDYZ4.js} +11 -11
  218. package/dist/executor-IEBLTBCW.js +9 -0
  219. package/dist/executor-OTF556PL.js +28 -0
  220. package/dist/executor-RM7XWQDU.js +9 -0
  221. package/dist/export-accessible-P42BQ4PB.js +23 -0
  222. package/dist/extract-partition-TCYXRWBN.js +38 -0
  223. package/dist/{fanout-sidecar-WDYQ77VB.js → fanout-sidecar-SSMRSC2L.js} +9 -9
  224. package/dist/find-OZMTRIK3.js +11 -0
  225. package/dist/forget/index.js +11 -11
  226. package/dist/forget/index.js.map +1 -1
  227. package/dist/guards/index.js +6 -6
  228. package/dist/history/index.js +16 -12
  229. package/dist/history/index.js.map +1 -1
  230. package/dist/i18n/index.js +16 -14
  231. package/dist/i18n/index.js.map +1 -1
  232. package/dist/index.d.ts +42 -42
  233. package/dist/index.js +330 -2106
  234. package/dist/index.js.map +1 -1
  235. package/dist/indexing/index.js +4 -2
  236. package/dist/indexing/index.js.map +1 -1
  237. package/dist/introspection/index.js +28 -0
  238. package/dist/issue-FCKN5O6C.js +19 -0
  239. package/dist/kernel/best-effort-revert.d.ts +9 -1
  240. package/dist/kernel/collection-config.d.ts +12 -70
  241. package/dist/kernel/collection.d.ts +11 -23
  242. package/dist/kernel/enclave/crypto.d.ts +8 -8
  243. package/dist/kernel/enclave/index.d.ts +3 -3
  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 +146 -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-33BC4TR7.js → ledger-6XBEVWYP.js} +11 -11
  256. package/dist/liberate-CYUOS4NC.js +24 -0
  257. package/dist/{link-set-QK22TDEX.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 +15 -13
  263. package/dist/pod/index.js +26 -12
  264. package/dist/{policy-NAHB2TUT.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-JVTMJ6OW.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-LGBOM2BO.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-PWK45HDF.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/signer-K7Z2EOMG.js +25 -0
  296. package/dist/snapshots/index.js +14 -10
  297. package/dist/snapshots/index.js.map +1 -1
  298. package/dist/{stale-FJED42DM.js → stale-A4J26OIC.js} +11 -10
  299. package/dist/storage-YVHZUISN.js +23 -0
  300. package/dist/store/index.js +22 -0
  301. package/dist/{store-coordination-provider-APODTV4W.js → store-coordination-provider-EWRZL7XF.js} +3 -3
  302. package/dist/sync/index.js +15 -12
  303. package/dist/sync/index.js.map +1 -1
  304. package/dist/team/index.js +33 -48
  305. package/dist/tiers/index.js +10 -10
  306. package/dist/to/index.js +1 -1
  307. package/dist/{tx → transactions}/index.js +7 -3
  308. package/dist/transactions/index.js.map +1 -0
  309. package/dist/util/index.js +1 -1
  310. package/dist/{verify-26Y5GNMK.js → verify-7XWHJWUN.js} +5 -5
  311. package/dist/via/blob/active.d.ts +23 -7
  312. package/dist/via/blob/binding.d.ts +1 -1
  313. package/dist/via/blob/index.d.ts +7 -1
  314. package/dist/via/i18n/core.d.ts +1 -1
  315. package/dist/via/i18n/index.d.ts +2 -0
  316. package/dist/via/money/money-reducer.d.ts +2 -2
  317. package/dist/walk-P5D6CF4V.js +21 -0
  318. package/dist/with-audit/consent/index.d.ts +2 -0
  319. package/dist/with-audit/forget/active.d.ts +3 -3
  320. package/dist/with-audit/forget/index.d.ts +6 -5
  321. package/dist/with-audit/forget/strategy.d.ts +3 -3
  322. package/dist/with-audit/guards/executor.d.ts +4 -4
  323. package/dist/with-audit/guards/immutable-guard.d.ts +3 -3
  324. package/dist/with-audit/guards/index.d.ts +1 -1
  325. package/dist/with-audit/guards/registry.d.ts +3 -3
  326. package/dist/with-audit/guards/transition-guard.d.ts +3 -3
  327. package/dist/with-audit/guards/types.d.ts +10 -10
  328. package/dist/with-audit/guards/with-guard.d.ts +2 -2
  329. package/dist/with-audit/periods/index.d.ts +2 -0
  330. package/dist/with-audit/periods/vault-facade.d.ts +6 -0
  331. package/dist/with-audit/portability/export-accessible.d.ts +4 -4
  332. package/dist/with-audit/portability/request-withdrawal.d.ts +3 -3
  333. package/dist/with-audit/portability/withdraw-accessible.d.ts +2 -2
  334. package/dist/with-audit/sealed-record/strategy.d.ts +1 -1
  335. package/dist/with-audit/tiers/index.d.ts +1 -0
  336. package/dist/with-cargo/adopt-partition.d.ts +7 -7
  337. package/dist/{legacy/kernel.d.ts → with-cargo/floor.d.ts} +4 -4
  338. package/dist/with-cargo/index.d.ts +9 -2
  339. package/dist/with-commit/crdt/index.d.ts +2 -0
  340. package/dist/with-commit/history/index.d.ts +2 -0
  341. package/dist/with-commit/history/time-machine.d.ts +2 -2
  342. package/dist/with-commit/numbering/descriptor.d.ts +16 -6
  343. package/dist/with-commit/tx/active.d.ts +5 -5
  344. package/dist/with-commit/tx/index.d.ts +2 -2
  345. package/dist/with-commit/tx/invariants.d.ts +1 -1
  346. package/dist/with-commit/tx/strategy.d.ts +3 -3
  347. package/dist/with-fork/shadow/index.d.ts +2 -0
  348. package/dist/with-fork/snapshots/active.d.ts +2 -2
  349. package/dist/with-fork/snapshots/index.d.ts +3 -1
  350. package/dist/with-fork/snapshots/noydb-facade.d.ts +3 -3
  351. package/dist/with-fork/snapshots/strategy.d.ts +2 -2
  352. package/dist/with-formula/derivations/dispatch.d.ts +98 -0
  353. package/dist/with-formula/derivations/executor.d.ts +2 -2
  354. package/dist/with-formula/derivations/index.d.ts +4 -1
  355. package/dist/with-formula/derivations/registry.d.ts +3 -3
  356. package/dist/with-formula/derivations/stale.d.ts +2 -2
  357. package/dist/with-formula/derivations/types.d.ts +3 -3
  358. package/dist/with-formula/derivations/with-derivation.d.ts +2 -2
  359. package/dist/with-formula/derivations/with-rollup.d.ts +15 -8
  360. package/dist/with-formula/materialized-views/dependency-analyzer.d.ts +3 -3
  361. package/dist/with-formula/materialized-views/dispatch.d.ts +75 -0
  362. package/dist/with-formula/materialized-views/index.d.ts +2 -1
  363. package/dist/with-formula/materialized-views/registry.d.ts +4 -4
  364. package/dist/with-formula/materialized-views/types.d.ts +11 -11
  365. package/dist/with-formula/materialized-views/with-materialized-view.d.ts +2 -2
  366. package/dist/with-formula/overlay-views/index.d.ts +1 -1
  367. package/dist/with-formula/overlay-views/registry.d.ts +4 -4
  368. package/dist/with-formula/overlay-views/types.d.ts +3 -3
  369. package/dist/with-formula/overlay-views/virtual-collection.d.ts +2 -2
  370. package/dist/with-formula/overlay-views/with-overlayed-view.d.ts +2 -2
  371. package/dist/with-lookup/indexing/active.d.ts +5 -5
  372. package/dist/with-lookup/indexing/index.d.ts +3 -1
  373. package/dist/with-lookup/indexing/strategy.d.ts +3 -3
  374. package/dist/with-lookup/{aggregate → reduce}/active.d.ts +8 -8
  375. package/dist/with-lookup/{aggregate → reduce}/groupby.d.ts +21 -21
  376. package/dist/with-lookup/reduce/index.d.ts +34 -0
  377. package/dist/with-lookup/{aggregate → reduce}/reducers.d.ts +11 -12
  378. package/dist/with-lookup/{aggregate/aggregation.d.ts → reduce/reduction.d.ts} +21 -21
  379. package/dist/with-lookup/{aggregate → reduce}/strategy.d.ts +15 -15
  380. package/dist/with-lookup/search/build-docs.d.ts +7 -2
  381. package/dist/with-lookup/search/index.d.ts +1 -1
  382. package/dist/with-party/broker/index.d.ts +1 -0
  383. package/dist/with-party/broker/seed.d.ts +1 -1
  384. package/dist/with-party/custody/liberate.d.ts +3 -3
  385. package/dist/with-party/directory/cover/index.d.ts +1 -5
  386. package/dist/with-party/directory/cover/schema.d.ts +0 -6
  387. package/dist/with-party/directory/cover/storage.d.ts +0 -8
  388. package/dist/with-party/directory/cover/types.d.ts +0 -21
  389. package/dist/with-party/directory/index.d.ts +2 -0
  390. package/dist/with-party/session/dev-unlock.d.ts +2 -2
  391. package/dist/with-party/session/index.d.ts +2 -0
  392. package/dist/with-party/session/session.d.ts +2 -2
  393. package/dist/with-party/team/deed.d.ts +8 -8
  394. package/dist/with-party/team/index.d.ts +4 -7
  395. package/dist/with-party/team/keyring.d.ts +83 -35
  396. package/dist/with-party/team/{managed-passphrase.d.ts → managed-secret.d.ts} +27 -27
  397. package/dist/with-party/team/noydb-facade.d.ts +43 -42
  398. package/dist/with-party/team/peer-recover.d.ts +13 -13
  399. package/dist/with-party/team/recovery.d.ts +5 -5
  400. package/dist/with-party/team/rotate-recover.d.ts +30 -30
  401. package/dist/with-pod/bundle.d.ts +30 -32
  402. package/dist/with-pod/format.d.ts +2 -2
  403. package/dist/with-pod/index.d.ts +2 -1
  404. package/dist/with-shape/blobs/blob-compaction.d.ts +43 -3
  405. package/dist/with-shape/blobs/blob-pinning.d.ts +112 -0
  406. package/dist/with-shape/blobs/blob-set.d.ts +86 -2
  407. package/dist/with-shape/introspection/index.d.ts +6 -0
  408. package/dist/with-shape/schema-update/index.d.ts +1 -0
  409. package/dist/with-store/index.d.ts +3 -2
  410. package/dist/with-store/route-store.d.ts +1 -1
  411. package/dist/{with-party/team/sync-active.d.ts → with-sync/active.d.ts} +1 -1
  412. package/dist/{with-party/team/sync-credentials.d.ts → with-sync/credentials.d.ts} +3 -3
  413. package/dist/{with-party/team/sync.d.ts → with-sync/engine.d.ts} +5 -5
  414. package/dist/{with-party/sync → with-sync}/index.d.ts +4 -2
  415. package/dist/{with-party/team/sync-period-scope.d.ts → with-sync/period-scope.d.ts} +2 -2
  416. package/dist/{with-party/team → with-sync}/presence.d.ts +2 -2
  417. package/dist/{with-party/team/sync-strategy.d.ts → with-sync/strategy.d.ts} +6 -6
  418. package/dist/{with-party/team/sync-transaction.d.ts → with-sync/transaction.d.ts} +3 -3
  419. package/dist/withdraw-accessible-A2PWF5MZ.js +28 -0
  420. package/package.json +45 -36
  421. package/dist/aggregate/index.js.map +0 -1
  422. package/dist/api-IQFZJSQO.js +0 -20
  423. package/dist/as/index.js +0 -30
  424. package/dist/at/index.js +0 -1
  425. package/dist/bundle/index.js +0 -105
  426. package/dist/by/index.js +0 -11
  427. package/dist/chunk-2IALOXZS.js.map +0 -1
  428. package/dist/chunk-2MUZ3LY6.js +0 -205
  429. package/dist/chunk-2MUZ3LY6.js.map +0 -1
  430. package/dist/chunk-2P7EGNKF.js.map +0 -1
  431. package/dist/chunk-3PF6CRDT.js.map +0 -1
  432. package/dist/chunk-3SV2EPMN.js.map +0 -1
  433. package/dist/chunk-4BRCIYFG.js.map +0 -1
  434. package/dist/chunk-5OI6BR4H.js.map +0 -1
  435. package/dist/chunk-5WZXVULX.js.map +0 -1
  436. package/dist/chunk-6NQMXTYC.js.map +0 -1
  437. package/dist/chunk-6XE5TMPR.js.map +0 -1
  438. package/dist/chunk-7CI6CP7Z.js.map +0 -1
  439. package/dist/chunk-7O3AYBC7.js.map +0 -1
  440. package/dist/chunk-A5BDDEXK.js.map +0 -1
  441. package/dist/chunk-A7JJLVGH.js.map +0 -1
  442. package/dist/chunk-BGK233EA.js.map +0 -1
  443. package/dist/chunk-BMQWTQZ4.js.map +0 -1
  444. package/dist/chunk-BOKIKJJB.js.map +0 -1
  445. package/dist/chunk-CCOP5XDW.js.map +0 -1
  446. package/dist/chunk-CHFZDSE4.js +0 -1
  447. package/dist/chunk-DDHM2TLX.js.map +0 -1
  448. package/dist/chunk-GQNGCEP5.js.map +0 -1
  449. package/dist/chunk-GVZQ4NAM.js +0 -14
  450. package/dist/chunk-GVZQ4NAM.js.map +0 -1
  451. package/dist/chunk-GWKAVKHI.js.map +0 -1
  452. package/dist/chunk-HOONYZY2.js.map +0 -1
  453. package/dist/chunk-HPUWOVR7.js.map +0 -1
  454. package/dist/chunk-ISMV2QVG.js.map +0 -1
  455. package/dist/chunk-JBBSYJHP.js.map +0 -1
  456. package/dist/chunk-JRBNCUNT.js.map +0 -1
  457. package/dist/chunk-JZWWLLVY.js +0 -99
  458. package/dist/chunk-JZWWLLVY.js.map +0 -1
  459. package/dist/chunk-KUPKLSX5.js.map +0 -1
  460. package/dist/chunk-KWVJAOIN.js.map +0 -1
  461. package/dist/chunk-LB6OH6K2.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-LOF2W3JU.js.map +0 -1
  465. package/dist/chunk-LSASLXGC.js.map +0 -1
  466. package/dist/chunk-O7WJ47EF.js.map +0 -1
  467. package/dist/chunk-ONTBCHCP.js.map +0 -1
  468. package/dist/chunk-PT37L5DV.js +0 -255
  469. package/dist/chunk-PT37L5DV.js.map +0 -1
  470. package/dist/chunk-RDXW3OBQ.js.map +0 -1
  471. package/dist/chunk-RND5ZPNP.js.map +0 -1
  472. package/dist/chunk-S3BFKGET.js.map +0 -1
  473. package/dist/chunk-SMGEYW6G.js.map +0 -1
  474. package/dist/chunk-T36RFODW.js.map +0 -1
  475. package/dist/chunk-TAGR72IR.js.map +0 -1
  476. package/dist/chunk-UNCOC7QH.js.map +0 -1
  477. package/dist/chunk-VCBHAE4R.js.map +0 -1
  478. package/dist/chunk-VEALDPHW.js.map +0 -1
  479. package/dist/chunk-VQNJ7UZL.js.map +0 -1
  480. package/dist/chunk-W2OG6JOL.js.map +0 -1
  481. package/dist/chunk-WNGGJWF7.js.map +0 -1
  482. package/dist/chunk-YJV2UZ7H.js.map +0 -1
  483. package/dist/chunk-YMUGBZN2.js.map +0 -1
  484. package/dist/chunk-YTGDPCPW.js.map +0 -1
  485. package/dist/chunk-ZEQWCBCM.js.map +0 -1
  486. package/dist/collection-facade-MJXSC3Q6.js +0 -44
  487. package/dist/cover-B5SJDHR3.js +0 -52
  488. package/dist/delegation-A5A75KQO.js +0 -25
  489. package/dist/derive-HJSMH7RA.js +0 -21
  490. package/dist/executor-AXE4XMLT.js +0 -26
  491. package/dist/executor-KGNLJD6M.js +0 -9
  492. package/dist/executor-XGIS6CR7.js +0 -9
  493. package/dist/export-accessible-VVBJM3MM.js +0 -23
  494. package/dist/extract-partition-LGGBTQET.js +0 -38
  495. package/dist/find-YS6XWB46.js +0 -11
  496. package/dist/in/index.js +0 -1
  497. package/dist/issue-LSR5PS6H.js +0 -19
  498. package/dist/legacy/bundle.d.ts +0 -30
  499. package/dist/liberate-GBSAYLPJ.js +0 -24
  500. package/dist/noydb-MTUBMWFE.js +0 -70
  501. package/dist/on/index.js +0 -17
  502. package/dist/port/as/index.d.ts +0 -26
  503. package/dist/port/at/index.d.ts +0 -18
  504. package/dist/port/in/index.d.ts +0 -21
  505. package/dist/port/on/index.d.ts +0 -27
  506. package/dist/port/ui/index.d.ts +0 -21
  507. package/dist/port/with/index.d.ts +0 -18
  508. package/dist/register-X462DNDM.js +0 -23
  509. package/dist/registry-3XMCT7MQ.js +0 -18
  510. package/dist/registry-KHD2I3M2.js +0 -19
  511. package/dist/registry-NPOWJHC4.js +0 -9
  512. package/dist/request-withdrawal-U7K3JTMY.js +0 -31
  513. package/dist/revoke-OCWDSWRQ.js +0 -24
  514. package/dist/seed-PWK45HDF.js.map +0 -1
  515. package/dist/signer-3YFBLZRN.js +0 -25
  516. package/dist/storage-W3GURVFU.js +0 -23
  517. package/dist/tx/index.js.map +0 -1
  518. package/dist/ui/index.js +0 -1
  519. package/dist/with/index.js +0 -31
  520. package/dist/with-lookup/aggregate/index.d.ts +0 -23
  521. package/dist/withdraw-accessible-Y3B2535F.js +0 -28
  522. /package/dist/{api-IQFZJSQO.js.map → api-ZDKTWNBB.js.map} +0 -0
  523. /package/dist/{backup-LU2DTZTI.js.map → backup-2UX7PRM5.js.map} +0 -0
  524. /package/dist/{chunk-IY23KFNZ.js.map → chunk-35NMVJ7I.js.map} +0 -0
  525. /package/dist/{chunk-RTEK4C4I.js.map → chunk-4JQK3L4V.js.map} +0 -0
  526. /package/dist/{chunk-3ELCWU56.js.map → chunk-4ZKNC6A6.js.map} +0 -0
  527. /package/dist/{chunk-VAIS3SOM.js.map → chunk-55LX6FSX.js.map} +0 -0
  528. /package/dist/{chunk-6HPG2YNX.js.map → chunk-5DRROK5W.js.map} +0 -0
  529. /package/dist/{chunk-S6Q37VGE.js.map → chunk-5GQEU4DN.js.map} +0 -0
  530. /package/dist/{chunk-TOPYT5U5.js.map → chunk-63FE525P.js.map} +0 -0
  531. /package/dist/{chunk-JVBO4SZL.js.map → chunk-6UBZ6I5Z.js.map} +0 -0
  532. /package/dist/{chunk-UFEVO57O.js.map → chunk-ABS7FMMD.js.map} +0 -0
  533. /package/dist/{chunk-M75ZZHSR.js.map → chunk-BLBAQRBM.js.map} +0 -0
  534. /package/dist/{chunk-G6EQYAL6.js.map → chunk-CI32CAFS.js.map} +0 -0
  535. /package/dist/{chunk-6B4DYGWO.js.map → chunk-DABACXEF.js.map} +0 -0
  536. /package/dist/{chunk-F6T6L2UK.js.map → chunk-DMH3VZU5.js.map} +0 -0
  537. /package/dist/{chunk-MQ6WOPSY.js.map → chunk-DZ2JXHWK.js.map} +0 -0
  538. /package/dist/{chunk-UBNCR3YK.js.map → chunk-EE7UHLKH.js.map} +0 -0
  539. /package/dist/{chunk-EGCRBCNA.js.map → chunk-EKRSCRNM.js.map} +0 -0
  540. /package/dist/{chunk-IRQY7IR5.js.map → chunk-FRMPM7WG.js.map} +0 -0
  541. /package/dist/{as/index.js.map → chunk-GJW4HX2O.js.map} +0 -0
  542. /package/dist/{chunk-T6GU5PPZ.js.map → chunk-GU3IP74F.js.map} +0 -0
  543. /package/dist/{chunk-SMIRGMS7.js.map → chunk-IXNCZTWA.js.map} +0 -0
  544. /package/dist/{chunk-RM2XV574.js.map → chunk-IXTSNGYY.js.map} +0 -0
  545. /package/dist/{chunk-PK6QCH2C.js.map → chunk-JJZGIE4U.js.map} +0 -0
  546. /package/dist/{chunk-DRWBEDYO.js.map → chunk-JYJFGD2H.js.map} +0 -0
  547. /package/dist/{chunk-KUIB4B5Q.js.map → chunk-LNZKOUJR.js.map} +0 -0
  548. /package/dist/{chunk-IM3QVF53.js.map → chunk-MBKVNOJS.js.map} +0 -0
  549. /package/dist/{chunk-N6WF5PKC.js.map → chunk-NFZGZ4AK.js.map} +0 -0
  550. /package/dist/{chunk-OF75ACKS.js.map → chunk-PEATRIYJ.js.map} +0 -0
  551. /package/dist/{chunk-N55W7KUL.js.map → chunk-QDIH2744.js.map} +0 -0
  552. /package/dist/{chunk-6HY2X62D.js.map → chunk-QJNCB5SK.js.map} +0 -0
  553. /package/dist/{chunk-2PCAVW2I.js.map → chunk-SHEEBRZ4.js.map} +0 -0
  554. /package/dist/{chunk-RA5VTXXG.js.map → chunk-V6UQZA2H.js.map} +0 -0
  555. /package/dist/{chunk-QDPZWTN2.js.map → chunk-W3G5REIU.js.map} +0 -0
  556. /package/dist/{chunk-WEYZTLXN.js.map → chunk-W3L64Y3J.js.map} +0 -0
  557. /package/dist/{chunk-CBSY2N76.js.map → chunk-WLXMTYGO.js.map} +0 -0
  558. /package/dist/{chunk-3U3FBR7O.js.map → chunk-X3F5YJG2.js.map} +0 -0
  559. /package/dist/{classified-marker-WQVIJAW2.js.map → classified-marker-7PKJBFCG.js.map} +0 -0
  560. /package/dist/{at/index.js.map → collection-facade-6I5K5IOD.js.map} +0 -0
  561. /package/dist/{bundle/index.js.map → computed-AB45PS4V.js.map} +0 -0
  562. /package/dist/{by → cover}/index.js.map +0 -0
  563. /package/dist/{in → custody}/index.js.map +0 -0
  564. /package/dist/{dead-filter-2A7IAJ3D.js.map → dead-filter-FL3WIUZS.js.map} +0 -0
  565. /package/dist/{chunk-CHFZDSE4.js.map → derive-VGS7FKE3.js.map} +0 -0
  566. /package/dist/{on → directory}/index.js.map +0 -0
  567. /package/dist/{collection-facade-MJXSC3Q6.js.map → enclave-SPEEDYZ4.js.map} +0 -0
  568. /package/dist/{computed-DSMPXG2Y.js.map → executor-IEBLTBCW.js.map} +0 -0
  569. /package/dist/{cover-B5SJDHR3.js.map → executor-OTF556PL.js.map} +0 -0
  570. /package/dist/{delegation-A5A75KQO.js.map → executor-RM7XWQDU.js.map} +0 -0
  571. /package/dist/{derive-HJSMH7RA.js.map → export-accessible-P42BQ4PB.js.map} +0 -0
  572. /package/dist/{enclave-7MW6ZGXW.js.map → extract-partition-TCYXRWBN.js.map} +0 -0
  573. /package/dist/{fanout-sidecar-WDYQ77VB.js.map → fanout-sidecar-SSMRSC2L.js.map} +0 -0
  574. /package/dist/{executor-AXE4XMLT.js.map → find-OZMTRIK3.js.map} +0 -0
  575. /package/dist/{ui → introspection}/index.js.map +0 -0
  576. /package/dist/{executor-KGNLJD6M.js.map → issue-FCKN5O6C.js.map} +0 -0
  577. /package/dist/{executor-XGIS6CR7.js.map → ledger-6XBEVWYP.js.map} +0 -0
  578. /package/dist/{export-accessible-VVBJM3MM.js.map → liberate-CYUOS4NC.js.map} +0 -0
  579. /package/dist/{extract-partition-LGGBTQET.js.map → link-set-NK6L2A5S.js.map} +0 -0
  580. /package/dist/{with → money}/index.js.map +0 -0
  581. /package/dist/{find-YS6XWB46.js.map → noydb-FZZIMLCI.js.map} +0 -0
  582. /package/dist/{issue-LSR5PS6H.js.map → policy/index.js.map} +0 -0
  583. /package/dist/{post-register-JVTMJ6OW.js.map → post-register-VFIYISUK.js.map} +0 -0
  584. /package/dist/{ledger-33BC4TR7.js.map → register-UKU2J6MN.js.map} +0 -0
  585. /package/dist/{liberate-GBSAYLPJ.js.map → registry-2VCWVHZS.js.map} +0 -0
  586. /package/dist/{link-set-QK22TDEX.js.map → registry-7Y5WF7GS.js.map} +0 -0
  587. /package/dist/{noydb-MTUBMWFE.js.map → registry-BWD2ED52.js.map} +0 -0
  588. /package/dist/{policy-NAHB2TUT.js.map → registry-DTWRJLSF.js.map} +0 -0
  589. /package/dist/{register-X462DNDM.js.map → request-withdrawal-JYDZ5XY2.js.map} +0 -0
  590. /package/dist/{reveal-LGBOM2BO.js.map → reveal-CL2BCW6A.js.map} +0 -0
  591. /package/dist/{registry-3XMCT7MQ.js.map → revoke-2TSAD2T4.js.map} +0 -0
  592. /package/dist/{registry-KHD2I3M2.js.map → schema-update/index.js.map} +0 -0
  593. /package/dist/{registry-NPOWJHC4.js.map → search/index.js.map} +0 -0
  594. /package/dist/{registry-VW6P6A3J.js.map → sequence/index.js.map} +0 -0
  595. /package/dist/{request-withdrawal-U7K3JTMY.js.map → signer-K7Z2EOMG.js.map} +0 -0
  596. /package/dist/{revoke-OCWDSWRQ.js.map → stale-A4J26OIC.js.map} +0 -0
  597. /package/dist/{signer-3YFBLZRN.js.map → storage-YVHZUISN.js.map} +0 -0
  598. /package/dist/{stale-FJED42DM.js.map → store/index.js.map} +0 -0
  599. /package/dist/{store-coordination-provider-APODTV4W.js.map → store-coordination-provider-EWRZL7XF.js.map} +0 -0
  600. /package/dist/{verify-26Y5GNMK.js.map → verify-7XWHJWUN.js.map} +0 -0
  601. /package/dist/{storage-W3GURVFU.js.map → walk-P5D6CF4V.js.map} +0 -0
  602. /package/dist/with-lookup/{aggregate → reduce}/canonical-key.d.ts +0 -0
  603. /package/dist/{with-party → with-sync}/tab-coordination.d.ts +0 -0
  604. /package/dist/{with-party → with-sync}/tab-write-relay.d.ts +0 -0
  605. /package/dist/{withdraw-accessible-Y3B2535F.js.map → withdraw-accessible-A2PWF5MZ.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/with-party/team/wrapped-deks.ts","../src/with-party/team/recovery.ts"],"sourcesContent":["/**\n * **Wrap-DEKs primitive** — a single canonical shape for the\n * pattern of \"serialize a DEK set, encrypt it under a credential-derived\n * AES-GCM key.\" Used by:\n *\n * - **tier-0** — paper recovery entries (`_meta/recovery-paper`),\n * credential = the printed code.\n * - **tier-2** — password authenticator slots (`KeyringFile.authenticators`,\n * `wrapKind: 'deks'`), credential = the user's password.\n *\n * **Not** used by `@noy-db/on-pin` — tier-3 wraps the DEK set under\n * the same conceptual pattern but at **100,000 PBKDF2 iterations**\n * (vs the 600,000 here), because the protection window for a PIN\n * slot is short (idle-timeout-bounded, typically 15 min) and 600k\n * iterations would make every PIN-resume noticeably slow. The wire\n * formats are deliberately incompatible. See `@noy-db/on-pin`'s\n * `PIN_PBKDF2_ITERATIONS` and the threat-model rationale in its\n * module docstring.\n *\n * Previously, the same crypto lived in two places: `mintPaperRecoveryEntry`\n * (in `team/recovery.ts`) and `enrollPasswordAuthenticator` (in\n * `@noy-db/on-password`). Both functions did identical work — PBKDF2\n * the credential, AES-GCM-encrypt the JSON-serialized DEK set — but\n * their implementations had drifted apart enough that fixing a bug\n * in one wouldn't fix the other.\n *\n * This module owns the canonical implementation. Consumers compose:\n *\n * - `mintPaperRecoveryEntry` is now a thin wrapper that calls\n * `mintWrappedDeksBlob` and adds `{ codeId, enrolledAt }`.\n * - `enrollPasswordAuthenticator` calls `mintWrappedDeksBlob` and\n * wraps the result in the slot envelope.\n *\n * @module\n */\n\nimport { derivePassphraseKey, type EnclaveKey } from '../../kernel/enclave/index.js'\n\nconst PBKDF2_ITERATIONS = 600_000\nconst SALT_BYTES = 32\nconst IV_BYTES = 12\n\nconst subtle = globalThis.crypto.subtle\n\n// ─── Type ──────────────────────────────────────────────────────────────\n\n/**\n * The wrap-DEKs primitive — a serialized + AES-GCM-encrypted DEK set\n * keyed under a credential-derived key.\n *\n * All three fields are base64-encoded so the blob is JSON-safe and\n * round-trips through `_meta/*` envelopes (which carry plaintext\n * JSON in `_data`).\n *\n * Composition: `PaperRecoveryEntry extends WrappedDeksBlob` plus\n * `{ codeId, enrolledAt }`. `KeyringAuthenticatorWrappingDEKs`\n * carries the same three fields with `salt` stored in `meta` for\n * slot-format back-compat (defers moving it to top-level).\n */\nexport interface WrappedDeksBlob {\n /** Base64 PBKDF2 salt for the credential-derived wrapping key. */\n readonly salt: string\n /** Base64 AES-GCM IV used for the `wrappedDeks` ciphertext. */\n readonly iv: string\n /** Base64 AES-GCM ciphertext of `{ deks: { collection: base64rawDek } }`. */\n readonly wrappedDeks: string\n}\n\n// ─── Mint ──────────────────────────────────────────────────────────────\n\n/**\n * Mint a fresh `WrappedDeksBlob` from a DEK set + a string credential.\n *\n * Generates a random salt + IV, derives a 256-bit AES-GCM key via\n * PBKDF2-SHA256(credential, salt, 600K), serializes the DEK set as\n * `{ deks: { coll: rawBase64 } }`, and AES-GCM-encrypts.\n *\n * The `credential` is the user-typed string (recovery code, password,\n * PIN). Caller normalization rules apply (e.g. paper\n * recovery uppercase-strips the code before reaching this function).\n *\n * @param deks - DEK set to wrap. Each DEK must be exportable via\n * `subtle.exportKey('raw', dek)` (the hub mints DEKs\n * this way; consumers feeding non-extractable keys\n * will get `InvalidAccessError` from WebCrypto).\n * @param credential - String input the consumer minted (paper code,\n * password, PIN). Treated as opaque bytes by PBKDF2.\n */\nexport async function mintWrappedDeksBlob(\n deks: Map<string, EnclaveKey>,\n credential: string,\n): Promise<WrappedDeksBlob> {\n const salt = crypto.getRandomValues(new Uint8Array(SALT_BYTES))\n const iv = crypto.getRandomValues(new Uint8Array(IV_BYTES))\n const wrappingKey = await deriveWrappingKey(credential, salt)\n\n // Serialize the DEK set as JSON `{ deks: { collection: base64 } }`.\n const exported: Record<string, string> = {}\n for (const [coll, dek] of deks) {\n const raw = await subtle.exportKey('raw', dek)\n exported[coll] = bytesToBase64(new Uint8Array(raw))\n }\n const plaintext = new TextEncoder().encode(JSON.stringify({ deks: exported }))\n const ciphertext = await subtle.encrypt(\n { name: 'AES-GCM', iv: iv as BufferSource },\n wrappingKey,\n plaintext as BufferSource,\n )\n\n return {\n salt: bytesToBase64(salt),\n iv: bytesToBase64(iv),\n wrappedDeks: bytesToBase64(new Uint8Array(ciphertext)),\n }\n}\n\n// ─── Unwrap ────────────────────────────────────────────────────────────\n\n/**\n * Reverse of {@link mintWrappedDeksBlob}. Re-derives the wrapping key\n * from the credential + stored salt, AES-GCM-decrypts the wrapped DEK\n * set, and re-imports each DEK as an extractable AES-GCM CryptoKey.\n *\n * Throws (AES-GCM auth tag failure) when the credential doesn't\n * match the blob. Callers iterating over multiple blobs (e.g. paper\n * recovery's \"try every entry until one matches\") should catch.\n */\nexport async function unwrapDeksFromBlob(\n blob: WrappedDeksBlob,\n credential: string,\n): Promise<Map<string, EnclaveKey>> {\n const wrappingKey = await deriveWrappingKey(credential, base64ToBytes(blob.salt))\n const plaintext = await subtle.decrypt(\n { name: 'AES-GCM', iv: base64ToBytes(blob.iv) as BufferSource },\n wrappingKey,\n base64ToBytes(blob.wrappedDeks) as BufferSource,\n )\n const parsed = JSON.parse(new TextDecoder().decode(plaintext)) as { deks: Record<string, string> }\n const deks = new Map<string, EnclaveKey>()\n for (const [coll, b64] of Object.entries(parsed.deks)) {\n const raw = base64ToBytes(b64)\n const key = await subtle.importKey(\n 'raw',\n raw as BufferSource,\n { name: 'AES-GCM', length: 256 },\n true,\n ['encrypt', 'decrypt'],\n )\n deks.set(coll, key)\n }\n return deks\n}\n\n// ─── Internals ─────────────────────────────────────────────────────────\n\nasync function deriveWrappingKey(credential: string, salt: Uint8Array): Promise<CryptoKey> {\n return derivePassphraseKey(credential, salt, { iterations: PBKDF2_ITERATIONS, keyUsage: 'aes-gcm' })\n}\n\nfunction bytesToBase64(b: Uint8Array): string {\n let s = ''\n for (const x of b) s += String.fromCharCode(x)\n return btoa(s)\n}\n\nfunction base64ToBytes(b64: string): Uint8Array {\n const s = atob(b64)\n const out = new Uint8Array(s.length)\n for (let i = 0; i < s.length; i++) out[i] = s.charCodeAt(i)\n return out\n}\n","/**\n * Recovery profile persistence + dispatch.\n *\n * Wires the **paper** profile end-to-end through\n * `@noy-db/on-recovery`. The other three profiles (Shamir,\n * multi-channel, admin-mediated) ship the API surface and throw\n * {@link RecoveryProfileNotImplementedError} during use; per-profile\n * dispatch lands in follow-up issues.\n *\n * Storage layout:\n *\n * ```\n * _meta/recovery-paper — JSON { entries: RecoveryCodeEntry[] } produced by `on-recovery`.\n * _meta/recovery-shamir — reserved\n * _meta/recovery-multi — reserved\n * _meta/recovery-admin — reserved\n * ```\n *\n * Like `_meta/policy` and `_meta/handle`, the documents are plain JSON\n * with empty `_iv` — the recovery-code wrapping is what protects the\n * KEK; the entries themselves are inert without the user's code.\n *\n * @module\n */\nimport type { NoydbStore, EncryptedEnvelope } from '../../kernel/types.js'\nimport { NOYDB_FORMAT_VERSION } from '../../kernel/types.js'\nimport type { EnclaveKey } from '../../kernel/enclave/index.js'\nimport {\n mintWrappedDeksBlob,\n unwrapDeksFromBlob,\n type WrappedDeksBlob,\n} from './wrapped-deks.js'\nimport type { ShamirRecoveryProvider } from './shamir-recovery-provider.js'\n\n/**\n * One paper recovery code as persisted in `_meta/recovery-paper`.\n *\n * The hub's KEK is intentionally non-extractable (see `crypto.ts`),\n * so the recovery entry can't AES-KW-wrap the KEK directly. Instead\n * we wrap a serialized DEK set: the entry holds the AES-GCM\n * ciphertext of `{ deks: { collection: rawDekBase64 } }`. Recovery\n * deserializes the DEK set, then mints a fresh KEK from the new\n * passphrase and rewraps the DEKs under it.\n *\n * This is the same pattern `@noy-db/on-pin` uses for tier-3 quick\n * resume — the cryptographic guarantee is identical (AES-GCM with a\n * PBKDF2-derived key), and it sidesteps the non-extractable-KEK\n * constraint cleanly.\n *\n * Type-level composition: `PaperRecoveryEntry extends\n * WrappedDeksBlob` — the three crypto fields (`salt`, `iv`,\n * `wrappedDeks`) come from the shared primitive; `codeId` and\n * `enrolledAt` are paper-recovery's own metadata. Wire format\n * unchanged.\n */\nexport interface PaperRecoveryEntry extends WrappedDeksBlob {\n readonly codeId: string\n readonly enrolledAt: string\n}\n\nexport interface PaperRecoveryDoc {\n readonly _noydb_recovery: 1\n readonly profile: 'paper'\n readonly entries: ReadonlyArray<PaperRecoveryEntry>\n}\n\nconst PAPER_DOC_ID = 'recovery-paper'\n\n/** Read the paper-recovery entries. Returns empty array when absent. */\nexport async function loadPaperRecoveryEntries(\n store: NoydbStore,\n vault: string,\n): Promise<ReadonlyArray<PaperRecoveryEntry>> {\n const env = await store.get(vault, '_meta', PAPER_DOC_ID)\n if (!env) return []\n try {\n const doc = JSON.parse(env._data) as PaperRecoveryDoc\n if (doc.profile !== 'paper' || !Array.isArray(doc.entries)) return []\n return doc.entries\n } catch {\n return []\n }\n}\n\n/** Replace the paper-recovery entries (used after burn-on-recovery). */\nexport async function savePaperRecoveryEntries(\n store: NoydbStore,\n vault: string,\n entries: ReadonlyArray<PaperRecoveryEntry>,\n): Promise<void> {\n const doc: PaperRecoveryDoc = {\n _noydb_recovery: 1,\n profile: 'paper',\n entries,\n }\n const envelope: EncryptedEnvelope = {\n _noydb: NOYDB_FORMAT_VERSION,\n _v: 1,\n _ts: new Date().toISOString(),\n _iv: '',\n _data: JSON.stringify(doc),\n }\n await store.put(vault, '_meta', PAPER_DOC_ID, envelope)\n}\n\n/** Drop a single paper-recovery entry (burn-on-use). */\nexport async function burnPaperRecoveryEntry(\n store: NoydbStore,\n vault: string,\n codeId: string,\n): Promise<void> {\n const entries = await loadPaperRecoveryEntries(store, vault)\n const remaining = entries.filter((e) => e.codeId !== codeId)\n await savePaperRecoveryEntries(store, vault, remaining)\n}\n\n/** Whether at least one recovery profile has any enrolled entries. */\nexport async function hasRecoveryEnrolled(\n store: NoydbStore,\n vault: string,\n): Promise<boolean> {\n const paper = await loadPaperRecoveryEntries(store, vault)\n if (paper.length > 0) return true\n const shamir = await loadShamirRecoveryEntries(store, vault)\n return shamir.length > 0\n}\n\n/**\n * Whether at least one **strong** recovery profile is enrolled.\n *\n * \"Strong\" excludes paper-alone — under managed-passphrase mode the\n * user has no memorized passphrase, so a stolen/lost paper sheet\n * would be a single point of total loss. Strong profiles today:\n *\n * - `shamir` (k-of-n threshold; survives loss of up to n-k shares)\n * - `multi-channel` (when shipped — follow-up slice)\n * - `admin-mediated` (when shipped — follow-up slice)\n *\n * Managed mode requires this check to pass before `openVault` returns.\n */\nexport async function hasStrongRecoveryEnrolled(\n store: NoydbStore,\n vault: string,\n): Promise<boolean> {\n const shamir = await loadShamirRecoveryEntries(store, vault)\n return shamir.length > 0\n // When multi-channel / admin-mediated land, extend this check.\n}\n\n// ─── Shamir recovery ─────────────────────────────────────────────────────\n\n/**\n * One Shamir-recovery entry as persisted in `_meta/recovery-shamir`.\n *\n * Like {@link PaperRecoveryEntry}, the entry composes\n * {@link WrappedDeksBlob} (DEKs wrapped under a fresh ephemeral\n * recovery secret) with profile-specific metadata. Unlike paper, the\n * \"credential\" was never visible to the user — it was 32 random\n * bytes split into N Shamir shares at enrollment. The shares ARE\n * the credential; the user holds them, the hub never sees them\n * again after `enrollRecovery` returns.\n *\n * The recovery secret is base64-encoded and\n * passed as the `credential` arg to\n * {@link mintWrappedDeksBlob} / {@link unwrapDeksFromBlob}. The\n * PBKDF2 round over high-entropy input is harmless overhead — it\n * keeps the shared primitive unchanged while letting Shamir reuse\n * the same wrapping pipeline as paper.\n */\nexport interface ShamirRecoveryEntry extends WrappedDeksBlob {\n /** Stable id for this entry. Allows multiple Shamir splits to coexist. */\n readonly entryId: string\n /** Threshold — minimum shares to reconstruct. */\n readonly k: number\n /** Total shares minted at enrollment. */\n readonly n: number\n /** x-coordinates of the n minted shares. Informational. Omitted as of 0.2\n * (string-level provider doesn't expose share x-coords); kept optional so\n * pre-0.2 entries still read. */\n readonly xCoords?: ReadonlyArray<number>\n /** ISO timestamp. */\n readonly enrolledAt: string\n /** Optional caller-supplied label (e.g., \"2-of-3 board escrow\"). */\n readonly label?: string\n}\n\nexport interface ShamirRecoveryDoc {\n readonly _noydb_recovery: 1\n readonly profile: 'shamir'\n readonly entries: ReadonlyArray<ShamirRecoveryEntry>\n}\n\nconst SHAMIR_DOC_ID = 'recovery-shamir'\n\n/** Read the Shamir-recovery entries. Returns empty array when absent. */\nexport async function loadShamirRecoveryEntries(\n store: NoydbStore,\n vault: string,\n): Promise<ReadonlyArray<ShamirRecoveryEntry>> {\n const env = await store.get(vault, '_meta', SHAMIR_DOC_ID)\n if (!env) return []\n try {\n const doc = JSON.parse(env._data) as ShamirRecoveryDoc\n if (doc.profile !== 'shamir' || !Array.isArray(doc.entries)) return []\n return doc.entries\n } catch {\n return []\n }\n}\n\n/** Replace the Shamir-recovery entries (used by enrollment and rotation). */\nexport async function saveShamirRecoveryEntries(\n store: NoydbStore,\n vault: string,\n entries: ReadonlyArray<ShamirRecoveryEntry>,\n): Promise<void> {\n const doc: ShamirRecoveryDoc = {\n _noydb_recovery: 1,\n profile: 'shamir',\n entries,\n }\n const envelope: EncryptedEnvelope = {\n _noydb: NOYDB_FORMAT_VERSION,\n _v: 1,\n _ts: new Date().toISOString(),\n _iv: '',\n _data: JSON.stringify(doc),\n }\n await store.put(vault, '_meta', SHAMIR_DOC_ID, envelope)\n}\n\n/**\n * Mint a fresh Shamir recovery entry from a DEK set.\n *\n * 1. Generates a 32-byte recovery secret.\n * 2. Wraps the DEK set under that secret via\n * {@link mintWrappedDeksBlob} (the recovery secret is base64-\n * encoded as the credential string — PBKDF2 over high-entropy\n * input is harmless overhead).\n * 3. Splits the recovery secret via Shamir into `n` shares with\n * threshold `k`.\n * 4. Zeros the in-memory recovery secret after wrapping + splitting.\n *\n * Returns:\n * - `entry` — the {@link ShamirRecoveryEntry} to persist.\n * - `shareStrings` — the `n` Base32-encoded share strings to\n * return to the caller. The HUB MUST NOT PERSIST THESE; once\n * returned they are the user's responsibility.\n *\n * @param deks - DEK set to wrap.\n * @param entryId - Stable id for this entry (caller-supplied or\n * hub-generated).\n * @param k - Threshold (>= 2).\n * @param n - Total shares (k <= n <= 255).\n * @param label - Optional caller label.\n */\nexport async function mintShamirRecoveryEntry(\n provider: ShamirRecoveryProvider,\n deks: Map<string, EnclaveKey>,\n entryId: string,\n k: number,\n n: number,\n label?: string,\n): Promise<{ entry: ShamirRecoveryEntry; shareStrings: string[] }> {\n const recoverySecret = crypto.getRandomValues(new Uint8Array(32))\n try {\n const credential = bytesToBase64(recoverySecret)\n const blob = await mintWrappedDeksBlob(deks, credential)\n const shareStrings = provider.splitToShares(recoverySecret, k, n)\n const entry: ShamirRecoveryEntry = {\n ...blob, entryId, k, n,\n enrolledAt: new Date().toISOString(),\n ...(label !== undefined && { label }),\n }\n return { entry, shareStrings }\n } finally {\n recoverySecret.fill(0)\n }\n}\n\n/**\n * Decrypt a Shamir recovery entry to recover the raw DEK set.\n *\n * Combines K or more `shares`, reconstructs the recovery secret,\n * unwraps the DEKs via {@link unwrapDeksFromBlob}.\n *\n * Throws (AES-GCM auth-tag mismatch) when the shares don't combine\n * to the secret originally used to mint the entry — typically\n * because they came from a different enrollment or were tampered\n * with. Callers iterating multiple entries should catch.\n */\nexport async function unwrapDeksFromShamirEntry(\n provider: ShamirRecoveryProvider,\n entry: ShamirRecoveryEntry,\n shareStrings: readonly string[],\n): Promise<Map<string, EnclaveKey>> {\n if (shareStrings.length < entry.k) {\n throw new Error(\n `Insufficient shares: this Shamir entry needs ${entry.k} of ${entry.n}, `\n + `but ${shareStrings.length} were provided.`,\n )\n }\n const secret = provider.combineShares(shareStrings)\n try {\n return await unwrapDeksFromBlob(entry, bytesToBase64(secret))\n } finally {\n secret.fill(0)\n }\n}\n\nfunction bytesToBase64(b: Uint8Array): string {\n let s = ''\n for (const x of b) s += String.fromCharCode(x)\n return btoa(s)\n}\n\n/**\n * Generate one paper-recovery entry from an unlocked DEK set.\n *\n * Returns the serializable entry (persisted via\n * {@link savePaperRecoveryEntries}). The recovery flow unwraps the\n * DEK set, then mints a fresh KEK from the user's new passphrase.\n *\n * Thin wrapper over {@link mintWrappedDeksBlob} — the crypto\n * lives in the shared primitive; this function just adds paper-\n * recovery's own metadata (`codeId`, `enrolledAt`).\n *\n * @param deks Map of collection-name → DEK (extractable).\n * @param code The plaintext recovery code (caller-supplied;\n * pair this with `@noy-db/on-recovery`'s code\n * generator/parser if available).\n * @param codeId Stable id used by `burnPaperRecoveryEntry`.\n */\nexport async function mintPaperRecoveryEntry(\n deks: Map<string, EnclaveKey>,\n code: string,\n codeId: string,\n): Promise<PaperRecoveryEntry> {\n const blob = await mintWrappedDeksBlob(deks, code)\n return {\n ...blob,\n codeId,\n enrolledAt: new Date().toISOString(),\n }\n}\n\n/**\n * Decrypt a recovery entry to recover the raw DEK set. Used by the\n * `recoverPassphrase` flow after the user's code has been parsed.\n *\n * Thin wrapper over {@link unwrapDeksFromBlob}.\n *\n * @throws when the code does not match the entry (AES-GCM auth tag fail).\n */\nexport async function unwrapDeksFromPaperEntry(\n entry: PaperRecoveryEntry,\n code: string,\n): Promise<Map<string, EnclaveKey>> {\n return unwrapDeksFromBlob(entry, code)\n}\n\n// The crypto helpers (deriveRecoveryWrappingKey, bytesToBase64,\n// base64ToBytes) live in the canonical wrap-DEKs primitive at\n// `./wrapped-deks.ts` and are reached via\n// `mintWrappedDeksBlob` / `unwrapDeksFromBlob`.\n"],"mappings":";;;;;;;;AAsCA,IAAM,oBAAoB;AAC1B,IAAM,aAAa;AACnB,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 @@
1
- {"version":3,"sources":["../src/with-shape/blobs/export-blobs.ts","../src/with-shape/blobs/blob-compaction.ts"],"sourcesContent":["/**\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 { 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 readonly reason: 'ttl' | 'predicate' | 'both'\n readonly evictedAt: string\n readonly actor: string\n}\n\n// ─── Compaction result ──────────────────────────────────────────────────\n\nexport interface CompactionResult {\n /** Number of blob slots evicted 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 /** Number of audit entries written. Equal to `evicted`. */\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 /** 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\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\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\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 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 // 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 return {\n evicted,\n records,\n collections: collectionsWithPolicy,\n auditEntries,\n held,\n byCollection,\n }\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":";;;;;;;;AAgGO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EACjD,YAAY,QAAgB;AAC1B,UAAM,wBAAwB,MAAM,EAAE;AACtC,SAAK,OAAO;AAAA,EACd;AACF;AAIO,IAAM,0BAA0B;AAmBhC,SAAS,wBACd,OACA,2BACA,eACA,YACA,SACmB;AACnB,MAAI,UAAU;AAEd,QAAM,QAAQ,MAAY;AACxB,cAAU;AAAA,EACZ;AAEA,MAAI,QAAQ,QAAQ;AAClB,QAAI,QAAQ,OAAO,QAAS,WAAU;AACtC,YAAQ,OAAO,iBAAiB,SAAS,MAAM;AAAE,gBAAU;AAAA,IAAK,CAAC;AAAA,EACnE;AAEA,WAAS,aAAmB;AAC1B,QAAI,QAAS,OAAM,IAAI,wBAAwB,mBAAmB;AAAA,EACpE;AAEA,QAAM,YAAY,QAAQ,cAAc,IAAI,IAAI,QAAQ,WAAW,IAAI;AAIvE,MAAI,eAAqC;AACzC,WAAS,iBAAgC;AACvC,QAAI,CAAC,cAAc;AACjB,qBAAe,WAAW;AAAA,QACxB,IAAI,gBAAgB;AAAA,QACpB,WAAW;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