@noy-db/hub 0.2.0-pre.9 → 0.3.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 (615) hide show
  1. package/README.md +129 -3
  2. package/dist/aggregate/index.d.ts +5 -2
  3. package/dist/aggregate/index.js +25 -16
  4. package/dist/aggregate/index.js.map +1 -1
  5. package/dist/api-TX2EX2FX.js +20 -0
  6. package/dist/as/index.d.ts +6 -0
  7. package/dist/as/index.js +30 -0
  8. package/dist/at/index.d.ts +4 -0
  9. package/dist/at/index.js +1 -0
  10. package/dist/attestation/index.d.ts +14 -47
  11. package/dist/attestation/index.js +60 -10
  12. package/dist/attestation/index.js.map +1 -1
  13. package/dist/backup-R7NTDFKY.js +225 -0
  14. package/dist/backup-R7NTDFKY.js.map +1 -0
  15. package/dist/blobs/index.d.ts +5 -8
  16. package/dist/blobs/index.js +25 -12
  17. package/dist/blobs/index.js.map +1 -1
  18. package/dist/bundle/index.d.ts +15 -70
  19. package/dist/bundle/index.js +45 -476
  20. package/dist/bundle/index.js.map +1 -1
  21. package/dist/{ulid-CJ8RzRrm.d.ts → bundle-D6GxiUfq.d.ts} +31 -86
  22. package/dist/by/index.d.ts +1 -0
  23. package/dist/by/index.js +11 -0
  24. package/dist/cargo/index.d.ts +7 -0
  25. package/dist/cargo/index.js +95 -0
  26. package/dist/chunk-2OV5NVE7.js +95 -0
  27. package/dist/chunk-2OV5NVE7.js.map +1 -0
  28. package/dist/chunk-2OZXVKVP.js +367 -0
  29. package/dist/chunk-2OZXVKVP.js.map +1 -0
  30. package/dist/{chunk-HNRHLRDC.js → chunk-2REPHKET.js} +6 -5
  31. package/dist/chunk-2REPHKET.js.map +1 -0
  32. package/dist/{chunk-PE2FR4J3.js → chunk-3JXPAHOZ.js} +17 -17
  33. package/dist/chunk-3JXPAHOZ.js.map +1 -0
  34. package/dist/{chunk-H2X3ISXG.js → chunk-3MATJ6O4.js} +7 -7
  35. package/dist/chunk-3MATJ6O4.js.map +1 -0
  36. package/dist/{chunk-PP6W64Y3.js → chunk-3OPY6MK2.js} +132 -3
  37. package/dist/chunk-3OPY6MK2.js.map +1 -0
  38. package/dist/{chunk-T7JEBOGN.js → chunk-3QSIU3UT.js} +49 -71
  39. package/dist/chunk-3QSIU3UT.js.map +1 -0
  40. package/dist/{chunk-ZYWZWG6G.js → chunk-4OMCIY6F.js} +32 -12
  41. package/dist/chunk-4OMCIY6F.js.map +1 -0
  42. package/dist/chunk-4Q6HSHHL.js +90 -0
  43. package/dist/chunk-4Q6HSHHL.js.map +1 -0
  44. package/dist/chunk-5I35DOHK.js +94 -0
  45. package/dist/chunk-5I35DOHK.js.map +1 -0
  46. package/dist/chunk-5VG4IJR7.js +235 -0
  47. package/dist/chunk-5VG4IJR7.js.map +1 -0
  48. package/dist/chunk-5YESYH2C.js +155 -0
  49. package/dist/chunk-5YESYH2C.js.map +1 -0
  50. package/dist/chunk-6G5ORS5D.js +202 -0
  51. package/dist/chunk-6G5ORS5D.js.map +1 -0
  52. package/dist/{chunk-VTKGMEPP.js → chunk-6P5XCKSD.js} +13 -3
  53. package/dist/chunk-6P5XCKSD.js.map +1 -0
  54. package/dist/{chunk-J66GRPNH.js → chunk-6S7T6WC4.js} +2 -2
  55. package/dist/chunk-6S7T6WC4.js.map +1 -0
  56. package/dist/{chunk-U26HQ6KJ.js → chunk-7BWJHO2A.js} +4 -4
  57. package/dist/chunk-7BWJHO2A.js.map +1 -0
  58. package/dist/chunk-7P2SDJG3.js +279 -0
  59. package/dist/chunk-7P2SDJG3.js.map +1 -0
  60. package/dist/chunk-ANB77BVV.js +150 -0
  61. package/dist/chunk-ANB77BVV.js.map +1 -0
  62. package/dist/chunk-AURFOK3D.js +35 -0
  63. package/dist/chunk-AURFOK3D.js.map +1 -0
  64. package/dist/chunk-BKARNZJN.js +382 -0
  65. package/dist/chunk-BKARNZJN.js.map +1 -0
  66. package/dist/{chunk-3BFJOWSU.js → chunk-BQISD5ZV.js} +35 -7
  67. package/dist/chunk-BQISD5ZV.js.map +1 -0
  68. package/dist/{chunk-2GLDA55J.js → chunk-BUAQ7YI3.js} +260 -135
  69. package/dist/chunk-BUAQ7YI3.js.map +1 -0
  70. package/dist/{chunk-2WUSG3IT.js → chunk-CB7CWSKW.js} +5 -5
  71. package/dist/chunk-CB7CWSKW.js.map +1 -0
  72. package/dist/chunk-CHFZDSE4.js +1 -0
  73. package/dist/{aggregate/index.cjs → chunk-DFVUTGT2.js} +206 -222
  74. package/dist/chunk-DFVUTGT2.js.map +1 -0
  75. package/dist/chunk-DJ7KIPLV.js +23 -0
  76. package/dist/chunk-DJ7KIPLV.js.map +1 -0
  77. package/dist/chunk-DSKDQP3G.js +14066 -0
  78. package/dist/chunk-DSKDQP3G.js.map +1 -0
  79. package/dist/{chunk-5T22KDPN.js → chunk-DV4HUP5G.js} +10 -8
  80. package/dist/chunk-DV4HUP5G.js.map +1 -0
  81. package/dist/chunk-EOXAAJTY.js +621 -0
  82. package/dist/chunk-EOXAAJTY.js.map +1 -0
  83. package/dist/chunk-ET67AY6B.js +74 -0
  84. package/dist/chunk-ET67AY6B.js.map +1 -0
  85. package/dist/chunk-F4CEK5YM.js +123 -0
  86. package/dist/chunk-F4CEK5YM.js.map +1 -0
  87. package/dist/chunk-FORYWFN6.js +130 -0
  88. package/dist/chunk-FORYWFN6.js.map +1 -0
  89. package/dist/{chunk-JWRVQKRZ.js → chunk-FRP6D2DM.js} +21 -20
  90. package/dist/chunk-FRP6D2DM.js.map +1 -0
  91. package/dist/chunk-FUOE7UUV.js +341 -0
  92. package/dist/chunk-FUOE7UUV.js.map +1 -0
  93. package/dist/chunk-G4JYND6L.js +42 -0
  94. package/dist/chunk-G4JYND6L.js.map +1 -0
  95. package/dist/{chunk-53XBRIRT.js → chunk-G6XV4H65.js} +9 -9
  96. package/dist/chunk-G6XV4H65.js.map +1 -0
  97. package/dist/chunk-GHVIKOHT.js +1 -0
  98. package/dist/{chunk-PX35GA7L.js → chunk-GNMXXTMN.js} +11 -9
  99. package/dist/chunk-GNMXXTMN.js.map +1 -0
  100. package/dist/chunk-GYGLAVCX.js +19 -0
  101. package/dist/chunk-GYGLAVCX.js.map +1 -0
  102. package/dist/chunk-HPWKV3YB.js +21 -0
  103. package/dist/chunk-HPWKV3YB.js.map +1 -0
  104. package/dist/chunk-HY3AUMFI.js +41 -0
  105. package/dist/chunk-HY3AUMFI.js.map +1 -0
  106. package/dist/chunk-HYR4WZZ3.js +69 -0
  107. package/dist/chunk-HYR4WZZ3.js.map +1 -0
  108. package/dist/chunk-I7FD46FF.js +9 -0
  109. package/dist/chunk-I7FD46FF.js.map +1 -0
  110. package/dist/{chunk-TFBP23BX.js → chunk-ICXIFFYZ.js} +66 -7
  111. package/dist/chunk-ICXIFFYZ.js.map +1 -0
  112. package/dist/{chunk-TV3YZ35S.js → chunk-IGJCYUT5.js} +17 -8
  113. package/dist/chunk-IGJCYUT5.js.map +1 -0
  114. package/dist/{chunk-F3GDRNUT.js → chunk-IVLTXX4W.js} +36 -68
  115. package/dist/chunk-IVLTXX4W.js.map +1 -0
  116. package/dist/{chunk-DONMZAD2.js → chunk-J4LPNIGK.js} +62 -169
  117. package/dist/chunk-J4LPNIGK.js.map +1 -0
  118. package/dist/chunk-JJZ2LW6T.js +36 -0
  119. package/dist/chunk-JJZ2LW6T.js.map +1 -0
  120. package/dist/chunk-JK733I5V.js +23 -0
  121. package/dist/chunk-JK733I5V.js.map +1 -0
  122. package/dist/{chunk-3YPCK6JX.js → chunk-KJ2BCBTL.js} +181 -422
  123. package/dist/chunk-KJ2BCBTL.js.map +1 -0
  124. package/dist/chunk-KNZB6JMR.js +129 -0
  125. package/dist/chunk-KNZB6JMR.js.map +1 -0
  126. package/dist/{chunk-OIF6LZUR.js → chunk-KPZS5QAQ.js} +30 -11
  127. package/dist/chunk-KPZS5QAQ.js.map +1 -0
  128. package/dist/chunk-LB7FD65R.js +163 -0
  129. package/dist/chunk-LB7FD65R.js.map +1 -0
  130. package/dist/{chunk-DO7C2TOG.js → chunk-LEJIKBBB.js} +3 -3
  131. package/dist/{chunk-DO7C2TOG.js.map → chunk-LEJIKBBB.js.map} +1 -1
  132. package/dist/{chunk-O3VZPBZG.js → chunk-LL2NIVUR.js} +56 -13
  133. package/dist/chunk-LL2NIVUR.js.map +1 -0
  134. package/dist/chunk-LP7BEXCT.js +32 -0
  135. package/dist/chunk-LP7BEXCT.js.map +1 -0
  136. package/dist/chunk-MCHVVJIA.js +968 -0
  137. package/dist/chunk-MCHVVJIA.js.map +1 -0
  138. package/dist/chunk-NO272T7Q.js +194 -0
  139. package/dist/chunk-NO272T7Q.js.map +1 -0
  140. package/dist/{chunk-22DWZL57.js → chunk-NUEQU36L.js} +70 -267
  141. package/dist/chunk-NUEQU36L.js.map +1 -0
  142. package/dist/chunk-O45M6LDB.js +38 -0
  143. package/dist/chunk-O45M6LDB.js.map +1 -0
  144. package/dist/chunk-OBKWYKYC.js +117 -0
  145. package/dist/chunk-OBKWYKYC.js.map +1 -0
  146. package/dist/{chunk-DJHHA6XH.js → chunk-OHHKHSJP.js} +50 -20
  147. package/dist/chunk-OHHKHSJP.js.map +1 -0
  148. package/dist/chunk-OT76OZL6.js +45 -0
  149. package/dist/chunk-OT76OZL6.js.map +1 -0
  150. package/dist/chunk-OVYRLHPE.js +150 -0
  151. package/dist/chunk-OVYRLHPE.js.map +1 -0
  152. package/dist/{chunk-ML236QKC.js → chunk-OXCSVM3B.js} +5 -5
  153. package/dist/chunk-OXCSVM3B.js.map +1 -0
  154. package/dist/chunk-P33LUIML.js +205 -0
  155. package/dist/chunk-P33LUIML.js.map +1 -0
  156. package/dist/{chunk-DL3HWOQ5.js → chunk-PLS64NCS.js} +10 -8
  157. package/dist/chunk-PLS64NCS.js.map +1 -0
  158. package/dist/{chunk-SYMWGEET.js → chunk-PS2NEWEX.js} +3 -3
  159. package/dist/chunk-PS2NEWEX.js.map +1 -0
  160. package/dist/chunk-PY4KJPYU.js +9 -0
  161. package/dist/chunk-PY4KJPYU.js.map +1 -0
  162. package/dist/chunk-PZ5AY32C.js +10 -0
  163. package/dist/chunk-QA2KUPCP.js +45 -0
  164. package/dist/chunk-QA2KUPCP.js.map +1 -0
  165. package/dist/chunk-QOC3VYL2.js +30 -0
  166. package/dist/chunk-QOC3VYL2.js.map +1 -0
  167. package/dist/{chunk-BVRYKATC.js → chunk-QSFOZUYL.js} +62 -34
  168. package/dist/chunk-QSFOZUYL.js.map +1 -0
  169. package/dist/chunk-RHK32N73.js +30 -0
  170. package/dist/chunk-RHK32N73.js.map +1 -0
  171. package/dist/{chunk-K3DK3NU5.js → chunk-RW3Y22MW.js} +20 -5
  172. package/dist/chunk-RW3Y22MW.js.map +1 -0
  173. package/dist/{chunk-B6PB7JLN.js → chunk-S7VFUQM2.js} +541 -6
  174. package/dist/chunk-S7VFUQM2.js.map +1 -0
  175. package/dist/chunk-SVLR4POP.js +64 -0
  176. package/dist/chunk-SVLR4POP.js.map +1 -0
  177. package/dist/chunk-T7WSLRAU.js +49 -0
  178. package/dist/chunk-T7WSLRAU.js.map +1 -0
  179. package/dist/{chunk-WPLVTJ5D.js → chunk-TAKWLZZX.js} +285 -63
  180. package/dist/chunk-TAKWLZZX.js.map +1 -0
  181. package/dist/chunk-THNJ3IKU.js +17 -0
  182. package/dist/chunk-THNJ3IKU.js.map +1 -0
  183. package/dist/{chunk-XJFLDA7A.js → chunk-TMBXVJKT.js} +9 -6
  184. package/dist/chunk-TMBXVJKT.js.map +1 -0
  185. package/dist/chunk-TWKKOM55.js +54 -0
  186. package/dist/chunk-TWKKOM55.js.map +1 -0
  187. package/dist/chunk-U3WZCU7E.js +14 -0
  188. package/dist/chunk-U3WZCU7E.js.map +1 -0
  189. package/dist/{chunk-Z6FNBOTC.js → chunk-UF362QVH.js} +15 -17
  190. package/dist/chunk-UF362QVH.js.map +1 -0
  191. package/dist/chunk-UN4FVIBH.js +135 -0
  192. package/dist/chunk-UN4FVIBH.js.map +1 -0
  193. package/dist/chunk-VEAVKDDB.js +29 -0
  194. package/dist/chunk-VEAVKDDB.js.map +1 -0
  195. package/dist/chunk-VEPTFUJY.js +29 -0
  196. package/dist/chunk-VEPTFUJY.js.map +1 -0
  197. package/dist/chunk-VJV7GKQK.js +662 -0
  198. package/dist/chunk-VJV7GKQK.js.map +1 -0
  199. package/dist/{chunk-2QR2PQTT.js → chunk-VQNJ7UZL.js} +5 -3
  200. package/dist/chunk-VQNJ7UZL.js.map +1 -0
  201. package/dist/chunk-VQRAIPYF.js +50 -0
  202. package/dist/chunk-VQRAIPYF.js.map +1 -0
  203. package/dist/{chunk-DFMLEQZB.js → chunk-VRIYFLBA.js} +5 -10
  204. package/dist/chunk-VRIYFLBA.js.map +1 -0
  205. package/dist/chunk-VWM3DAVB.js +265 -0
  206. package/dist/chunk-VWM3DAVB.js.map +1 -0
  207. package/dist/{chunk-NONAAENK.js → chunk-VWRRVE6D.js} +11 -4
  208. package/dist/chunk-VWRRVE6D.js.map +1 -0
  209. package/dist/chunk-VYYM3MEN.js +98 -0
  210. package/dist/chunk-VYYM3MEN.js.map +1 -0
  211. package/dist/chunk-WBJIQSLL.js +167 -0
  212. package/dist/chunk-WBJIQSLL.js.map +1 -0
  213. package/dist/chunk-WIGQB62E.js +164 -0
  214. package/dist/chunk-WIGQB62E.js.map +1 -0
  215. package/dist/{chunk-EMIGCR7X.js → chunk-WXSYDNBT.js} +2 -2
  216. package/dist/chunk-WXSYDNBT.js.map +1 -0
  217. package/dist/chunk-WZSCE6RM.js +466 -0
  218. package/dist/chunk-WZSCE6RM.js.map +1 -0
  219. package/dist/chunk-XGDAPN6M.js +255 -0
  220. package/dist/chunk-XGDAPN6M.js.map +1 -0
  221. package/dist/{chunk-QODLLGQ7.js → chunk-XH7XP3OL.js} +372 -37
  222. package/dist/chunk-XH7XP3OL.js.map +1 -0
  223. package/dist/chunk-XREOISSI.js +40 -0
  224. package/dist/chunk-XREOISSI.js.map +1 -0
  225. package/dist/chunk-XUBPSPKD.js +164 -0
  226. package/dist/chunk-XUBPSPKD.js.map +1 -0
  227. package/dist/chunk-Y3A5CB5G.js +247 -0
  228. package/dist/chunk-Y3A5CB5G.js.map +1 -0
  229. package/dist/{chunk-I5FOWO4J.js → chunk-YCXCR7VG.js} +52 -73
  230. package/dist/chunk-YCXCR7VG.js.map +1 -0
  231. package/dist/{chunk-A3JMGXPG.js → chunk-YMUGBZN2.js} +2 -2
  232. package/dist/chunk-YMUGBZN2.js.map +1 -0
  233. package/dist/chunk-YMVQD5Q5.js +453 -0
  234. package/dist/chunk-YMVQD5Q5.js.map +1 -0
  235. package/dist/chunk-YN5IAHN6.js +32 -0
  236. package/dist/chunk-YN5IAHN6.js.map +1 -0
  237. package/dist/{chunk-FZU343FL.js → chunk-ZJADGNYF.js} +2 -2
  238. package/dist/chunk-ZJADGNYF.js.map +1 -0
  239. package/dist/chunk-ZYJ55N7N.js +86 -0
  240. package/dist/chunk-ZYJ55N7N.js.map +1 -0
  241. package/dist/classified/index.d.ts +16 -0
  242. package/dist/classified/index.js +40 -0
  243. package/dist/classified-marker-H6YSHYNK.js +24 -0
  244. package/dist/classified-marker-H6YSHYNK.js.map +1 -0
  245. package/dist/collection-facade-LVD22JLM.js +39 -0
  246. package/dist/computed-EXDMQODG.js +11 -0
  247. package/dist/consent/index.d.ts +4 -7
  248. package/dist/consent/index.js +13 -5
  249. package/dist/consent/index.js.map +1 -1
  250. package/dist/crdt/index.d.ts +5 -2
  251. package/dist/crdt/index.js +3 -2
  252. package/dist/crdt/index.js.map +1 -1
  253. package/dist/dead-filter-HQIE2YG7.js +28 -0
  254. package/dist/dead-filter-HQIE2YG7.js.map +1 -0
  255. package/dist/decrypt-partition-IHtxEnTi.d.ts +21 -0
  256. package/dist/delegation-BJP73GAP.js +25 -0
  257. package/dist/derivations/index.d.ts +6 -9
  258. package/dist/derivations/index.js +18 -6
  259. package/dist/derive-BME7HDWO.js +21 -0
  260. package/dist/{dev-unlock-B4kDxep_.d.ts → dev-unlock-Bmm2pgJ0.d.ts} +1 -1
  261. package/dist/discriminant-BN9REW3o.d.ts +60 -0
  262. package/dist/enclave-NHORSWSF.js +125 -0
  263. package/dist/executor-FE6X4LFX.js +9 -0
  264. package/dist/executor-KSHKRJXP.js +25 -0
  265. package/dist/executor-ZHTJJICG.js +9 -0
  266. package/dist/export-accessible-DACHM5VT.js +23 -0
  267. package/dist/extract-partition-RNENZZ4T.js +36 -0
  268. package/dist/fanout-sidecar-OFWN3NM7.js +74 -0
  269. package/dist/fanout-sidecar-OFWN3NM7.js.map +1 -0
  270. package/dist/fence-watcher-DHQ775JB.js +69 -0
  271. package/dist/fence-watcher-DHQ775JB.js.map +1 -0
  272. package/dist/find-BNGBJNKP.js +11 -0
  273. package/dist/forget/index.d.ts +36 -0
  274. package/dist/forget/index.js +25 -0
  275. package/dist/forget/index.js.map +1 -0
  276. package/dist/guards/index.d.ts +12 -9
  277. package/dist/guards/index.js +12 -5
  278. package/dist/{hash-DdpVypUp.d.cts → hash-DAJjMsCE.d.ts} +10 -1
  279. package/dist/history/index.d.ts +5 -8
  280. package/dist/history/index.js +25 -12
  281. package/dist/history/index.js.map +1 -1
  282. package/dist/i18n/index.d.ts +25 -8
  283. package/dist/i18n/index.js +137 -29
  284. package/dist/i18n/index.js.map +1 -1
  285. package/dist/in/index.d.ts +4 -0
  286. package/dist/in/index.js +1 -0
  287. package/dist/in/index.js.map +1 -0
  288. package/dist/index-B9QdHytu.d.ts +123 -0
  289. package/dist/index-DjWbxsjb.d.ts +23579 -0
  290. package/dist/index-qwuNvO2B.d.ts +144 -0
  291. package/dist/index.d.ts +1179 -449
  292. package/dist/index.js +2524 -312
  293. package/dist/index.js.map +1 -1
  294. package/dist/indexing/index.d.ts +5 -3
  295. package/dist/indexing/index.js +6 -5
  296. package/dist/indexing/index.js.map +1 -1
  297. package/dist/issue-NDI4CVZU.js +19 -0
  298. package/dist/issue-NDI4CVZU.js.map +1 -0
  299. package/dist/json-schema-I22JCYCG.js +44 -0
  300. package/dist/json-schema-I22JCYCG.js.map +1 -0
  301. package/dist/lazy/index.d.ts +20 -0
  302. package/dist/lazy/index.js +12 -0
  303. package/dist/lazy/index.js.map +1 -0
  304. package/dist/ledger-6NDS2EO4.js +42 -0
  305. package/dist/ledger-6NDS2EO4.js.map +1 -0
  306. package/dist/liberate-HN3RIGIP.js +24 -0
  307. package/dist/liberate-HN3RIGIP.js.map +1 -0
  308. package/dist/link-set-SJB2MVJV.js +31 -0
  309. package/dist/link-set-SJB2MVJV.js.map +1 -0
  310. package/dist/materialized-views/index.d.ts +23 -20
  311. package/dist/materialized-views/index.js +26 -12
  312. package/dist/mime-magic-bBj5OgUC.d.ts +103 -0
  313. package/dist/noydb-BWF6EPIR.js +66 -0
  314. package/dist/noydb-BWF6EPIR.js.map +1 -0
  315. package/dist/on/index.d.ts +4 -0
  316. package/dist/on/index.js +17 -0
  317. package/dist/on/index.js.map +1 -0
  318. package/dist/overlay-views/index.d.ts +26 -11
  319. package/dist/overlay-views/index.js +7 -6
  320. package/dist/periods/index.d.ts +4 -7
  321. package/dist/periods/index.js +27 -9
  322. package/dist/pod/index.d.ts +62 -0
  323. package/dist/pod/index.js +67 -0
  324. package/dist/pod/index.js.map +1 -0
  325. package/dist/policy-WGNAG5H6.js +41 -0
  326. package/dist/policy-WGNAG5H6.js.map +1 -0
  327. package/dist/portability/index.d.ts +19 -0
  328. package/dist/portability/index.js +43 -0
  329. package/dist/portability/index.js.map +1 -0
  330. package/dist/post-register-CWKBQRC7.js +55 -0
  331. package/dist/post-register-CWKBQRC7.js.map +1 -0
  332. package/dist/{public-envelope-BW6OXORV.js → public-envelope-EJLVIFX7.js} +6 -5
  333. package/dist/public-envelope-EJLVIFX7.js.map +1 -0
  334. package/dist/query/index.d.ts +4 -3
  335. package/dist/query/index.js +24 -13
  336. package/dist/read-only-facade-CHCKSEPD.js +8 -0
  337. package/dist/read-only-facade-CHCKSEPD.js.map +1 -0
  338. package/dist/register-SBIX7TVV.js +23 -0
  339. package/dist/register-SBIX7TVV.js.map +1 -0
  340. package/dist/registry-3EQG6OOE.js +18 -0
  341. package/dist/registry-3EQG6OOE.js.map +1 -0
  342. package/dist/registry-CA327ACV.js +9 -0
  343. package/dist/registry-CA327ACV.js.map +1 -0
  344. package/dist/registry-E7OXOTSV.js +19 -0
  345. package/dist/registry-E7OXOTSV.js.map +1 -0
  346. package/dist/registry-VW6P6A3J.js +8 -0
  347. package/dist/registry-VW6P6A3J.js.map +1 -0
  348. package/dist/request-withdrawal-KAH2AAXC.js +31 -0
  349. package/dist/request-withdrawal-KAH2AAXC.js.map +1 -0
  350. package/dist/reveal-R3JLHMUF.js +38 -0
  351. package/dist/reveal-R3JLHMUF.js.map +1 -0
  352. package/dist/revoke-IXLOJ3IH.js +24 -0
  353. package/dist/revoke-IXLOJ3IH.js.map +1 -0
  354. package/dist/satellites/index.d.ts +4 -0
  355. package/dist/satellites/index.js +8 -0
  356. package/dist/satellites/index.js.map +1 -0
  357. package/dist/sealed-record/index.d.ts +68 -0
  358. package/dist/sealed-record/index.js +71 -0
  359. package/dist/sealed-record/index.js.map +1 -0
  360. package/dist/session/index.d.ts +5 -8
  361. package/dist/session/index.js +13 -5
  362. package/dist/session/index.js.map +1 -1
  363. package/dist/shadow/index.d.ts +4 -7
  364. package/dist/shadow/index.js +4 -3
  365. package/dist/shadow/index.js.map +1 -1
  366. package/dist/signer-Y46N2GJ3.js +25 -0
  367. package/dist/signer-Y46N2GJ3.js.map +1 -0
  368. package/dist/snapshots/index.d.ts +5 -8
  369. package/dist/snapshots/index.js +19 -11
  370. package/dist/snapshots/index.js.map +1 -1
  371. package/dist/{stale-6ZDBTQT7.js → stale-Z7IW6RIL.js} +3 -2
  372. package/dist/stale-Z7IW6RIL.js.map +1 -0
  373. package/dist/storage-ADNP2UWI.js +23 -0
  374. package/dist/storage-ADNP2UWI.js.map +1 -0
  375. package/dist/store-coordination-provider-DTDMI6VL.js +142 -0
  376. package/dist/store-coordination-provider-DTDMI6VL.js.map +1 -0
  377. package/dist/subject-index-CyOgGMJL.d.ts +380 -0
  378. package/dist/sync/index.d.ts +3 -6
  379. package/dist/sync/index.js +13 -6
  380. package/dist/sync/index.js.map +1 -1
  381. package/dist/team/index.d.ts +46 -10
  382. package/dist/team/index.js +35 -18
  383. package/dist/tiers/index.d.ts +4 -0
  384. package/dist/tiers/index.js +39 -0
  385. package/dist/tiers/index.js.map +1 -0
  386. package/dist/to/index.d.ts +4 -0
  387. package/dist/to/index.js +16 -0
  388. package/dist/to/index.js.map +1 -0
  389. package/dist/transition-guard-DI-krBsZ.d.ts +165 -0
  390. package/dist/tx/index.d.ts +22 -9
  391. package/dist/tx/index.js +13 -8
  392. package/dist/tx/index.js.map +1 -1
  393. package/dist/ui/index.d.ts +4 -0
  394. package/dist/ui/index.js +1 -0
  395. package/dist/ui/index.js.map +1 -0
  396. package/dist/ulid-DRH25k3y.d.ts +66 -0
  397. package/dist/ulid-PTAIMDG4.js +10 -0
  398. package/dist/ulid-PTAIMDG4.js.map +1 -0
  399. package/dist/util/index.d.ts +2 -0
  400. package/dist/util/index.js +7 -2
  401. package/dist/util/index.js.map +1 -1
  402. package/dist/validators-BUcli5Nh.d.ts +101 -0
  403. package/dist/vault-diff-Z2DUayMe.d.ts +147 -0
  404. package/dist/verify-JPF2YR5E.js +139 -0
  405. package/dist/verify-JPF2YR5E.js.map +1 -0
  406. package/dist/walk-XYA2O3LW.js +241 -0
  407. package/dist/walk-XYA2O3LW.js.map +1 -0
  408. package/dist/with/index.d.ts +37 -0
  409. package/dist/with/index.js +31 -0
  410. package/dist/with/index.js.map +1 -0
  411. package/dist/{with-materialized-view-BLkQxoQN.d.ts → with-materialized-view-BUmzlXue.d.ts} +1 -1
  412. package/dist/{with-overlayed-view-CRsSEwHR.d.ts → with-overlayed-view-m4FaXXTO.d.ts} +2 -3
  413. package/dist/with-rollup-DEKGI9vb.d.ts +47 -0
  414. package/dist/withdraw-accessible-WLV4MTEN.js +28 -0
  415. package/dist/withdraw-accessible-WLV4MTEN.js.map +1 -0
  416. package/dist/zod-HAJM7LMS.js +14763 -0
  417. package/dist/zod-HAJM7LMS.js.map +1 -0
  418. package/package.json +122 -202
  419. package/dist/aggregate/index.cjs.map +0 -1
  420. package/dist/aggregate/index.d.cts +0 -38
  421. package/dist/attestation/index.cjs +0 -305
  422. package/dist/attestation/index.cjs.map +0 -1
  423. package/dist/attestation/index.d.cts +0 -52
  424. package/dist/blobs/index.cjs +0 -1480
  425. package/dist/blobs/index.cjs.map +0 -1
  426. package/dist/blobs/index.d.cts +0 -46
  427. package/dist/bundle/index.cjs +0 -19264
  428. package/dist/bundle/index.cjs.map +0 -1
  429. package/dist/bundle/index.d.cts +0 -176
  430. package/dist/chunk-22DWZL57.js.map +0 -1
  431. package/dist/chunk-2GLDA55J.js.map +0 -1
  432. package/dist/chunk-2QR2PQTT.js.map +0 -1
  433. package/dist/chunk-2WUSG3IT.js.map +0 -1
  434. package/dist/chunk-3BFJOWSU.js.map +0 -1
  435. package/dist/chunk-3YPCK6JX.js.map +0 -1
  436. package/dist/chunk-53XBRIRT.js.map +0 -1
  437. package/dist/chunk-5T22KDPN.js.map +0 -1
  438. package/dist/chunk-5XHKQ56N.js +0 -340
  439. package/dist/chunk-5XHKQ56N.js.map +0 -1
  440. package/dist/chunk-6CME4UEK.js +0 -10329
  441. package/dist/chunk-6CME4UEK.js.map +0 -1
  442. package/dist/chunk-6STK5TQP.js +0 -139
  443. package/dist/chunk-6STK5TQP.js.map +0 -1
  444. package/dist/chunk-A3JMGXPG.js.map +0 -1
  445. package/dist/chunk-B6PB7JLN.js.map +0 -1
  446. package/dist/chunk-BVRYKATC.js.map +0 -1
  447. package/dist/chunk-DE6GKS6G.js +0 -79
  448. package/dist/chunk-DE6GKS6G.js.map +0 -1
  449. package/dist/chunk-DFMLEQZB.js.map +0 -1
  450. package/dist/chunk-DJHHA6XH.js.map +0 -1
  451. package/dist/chunk-DL3HWOQ5.js.map +0 -1
  452. package/dist/chunk-DONMZAD2.js.map +0 -1
  453. package/dist/chunk-EMIGCR7X.js.map +0 -1
  454. package/dist/chunk-F3GDRNUT.js.map +0 -1
  455. package/dist/chunk-FZU343FL.js.map +0 -1
  456. package/dist/chunk-H2X3ISXG.js.map +0 -1
  457. package/dist/chunk-HNRHLRDC.js.map +0 -1
  458. package/dist/chunk-I5FOWO4J.js.map +0 -1
  459. package/dist/chunk-J66GRPNH.js.map +0 -1
  460. package/dist/chunk-JWRVQKRZ.js.map +0 -1
  461. package/dist/chunk-K3DK3NU5.js.map +0 -1
  462. package/dist/chunk-ML236QKC.js.map +0 -1
  463. package/dist/chunk-NONAAENK.js.map +0 -1
  464. package/dist/chunk-O3VZPBZG.js.map +0 -1
  465. package/dist/chunk-OIF6LZUR.js.map +0 -1
  466. package/dist/chunk-OQ6PIGHA.js +0 -19
  467. package/dist/chunk-OQ6PIGHA.js.map +0 -1
  468. package/dist/chunk-PE2FR4J3.js.map +0 -1
  469. package/dist/chunk-PP6W64Y3.js.map +0 -1
  470. package/dist/chunk-PX35GA7L.js.map +0 -1
  471. package/dist/chunk-QEILDE6R.js +0 -793
  472. package/dist/chunk-QEILDE6R.js.map +0 -1
  473. package/dist/chunk-QODLLGQ7.js.map +0 -1
  474. package/dist/chunk-RAZ4OVLL.js +0 -51
  475. package/dist/chunk-RAZ4OVLL.js.map +0 -1
  476. package/dist/chunk-SYMWGEET.js.map +0 -1
  477. package/dist/chunk-T7JEBOGN.js.map +0 -1
  478. package/dist/chunk-TFBP23BX.js.map +0 -1
  479. package/dist/chunk-TV3YZ35S.js.map +0 -1
  480. package/dist/chunk-U26HQ6KJ.js.map +0 -1
  481. package/dist/chunk-UF3BUNQZ.js +0 -1
  482. package/dist/chunk-UMLVJTYV.js +0 -20
  483. package/dist/chunk-UMLVJTYV.js.map +0 -1
  484. package/dist/chunk-VTKGMEPP.js.map +0 -1
  485. package/dist/chunk-W6EQLGMB.js +0 -100
  486. package/dist/chunk-W6EQLGMB.js.map +0 -1
  487. package/dist/chunk-WIRRPTFH.js +0 -17
  488. package/dist/chunk-WIRRPTFH.js.map +0 -1
  489. package/dist/chunk-WPLVTJ5D.js.map +0 -1
  490. package/dist/chunk-XJFLDA7A.js.map +0 -1
  491. package/dist/chunk-Z6FNBOTC.js.map +0 -1
  492. package/dist/chunk-ZYWZWG6G.js.map +0 -1
  493. package/dist/consent/index.cjs +0 -204
  494. package/dist/consent/index.cjs.map +0 -1
  495. package/dist/consent/index.d.cts +0 -25
  496. package/dist/crdt/index.cjs +0 -152
  497. package/dist/crdt/index.cjs.map +0 -1
  498. package/dist/crdt/index.d.cts +0 -30
  499. package/dist/crypto-HTZ4FJOP.js +0 -44
  500. package/dist/delegation-RI54P6I5.js +0 -17
  501. package/dist/derivations/index.cjs +0 -351
  502. package/dist/derivations/index.cjs.map +0 -1
  503. package/dist/derivations/index.d.cts +0 -72
  504. package/dist/dev-unlock-BIoEFbwm.d.cts +0 -263
  505. package/dist/executor-5PNY7LGW.js +0 -8
  506. package/dist/executor-B4QIYGZX.js +0 -8
  507. package/dist/executor-BWXXDQ7K.js +0 -11
  508. package/dist/fanout-sidecar-OKPMMPLG.js +0 -51
  509. package/dist/fanout-sidecar-OKPMMPLG.js.map +0 -1
  510. package/dist/guards/index.cjs +0 -322
  511. package/dist/guards/index.cjs.map +0 -1
  512. package/dist/guards/index.d.cts +0 -31
  513. package/dist/hash-HJqD14vS.d.ts +0 -63
  514. package/dist/history/index.cjs +0 -1222
  515. package/dist/history/index.cjs.map +0 -1
  516. package/dist/history/index.d.cts +0 -63
  517. package/dist/i18n/index.cjs +0 -1100
  518. package/dist/i18n/index.cjs.map +0 -1
  519. package/dist/i18n/index.d.cts +0 -39
  520. package/dist/index-4fBVt8j9.d.cts +0 -2387
  521. package/dist/index-D8I_pyJD.d.ts +0 -2387
  522. package/dist/index.cjs +0 -24487
  523. package/dist/index.cjs.map +0 -1
  524. package/dist/index.d.cts +0 -776
  525. package/dist/indexing/index.cjs +0 -742
  526. package/dist/indexing/index.cjs.map +0 -1
  527. package/dist/indexing/index.d.cts +0 -36
  528. package/dist/issue-VGDPP4B5.js +0 -12
  529. package/dist/lazy-builder-7tIpFyWN.d.ts +0 -304
  530. package/dist/lazy-builder-wY4pMCEe.d.cts +0 -304
  531. package/dist/ledger-TMRZYNVJ.js +0 -33
  532. package/dist/materialized-views/index.cjs +0 -854
  533. package/dist/materialized-views/index.cjs.map +0 -1
  534. package/dist/materialized-views/index.d.cts +0 -186
  535. package/dist/mime-magic-CBBSOkjm.d.cts +0 -50
  536. package/dist/mime-magic-CBBSOkjm.d.ts +0 -50
  537. package/dist/noydb-G725ZSZG.js +0 -34
  538. package/dist/overlay-views/index.cjs +0 -359
  539. package/dist/overlay-views/index.cjs.map +0 -1
  540. package/dist/overlay-views/index.d.cts +0 -82
  541. package/dist/periods/index.cjs +0 -1041
  542. package/dist/periods/index.cjs.map +0 -1
  543. package/dist/periods/index.d.cts +0 -22
  544. package/dist/predicate-BSAGEyu5.d.cts +0 -209
  545. package/dist/predicate-BSAGEyu5.d.ts +0 -209
  546. package/dist/query/index.cjs +0 -2375
  547. package/dist/query/index.cjs.map +0 -1
  548. package/dist/query/index.d.cts +0 -3
  549. package/dist/read-only-facade-ITU6L7BL.js +0 -7
  550. package/dist/registry-3QP3YKQS.js +0 -8
  551. package/dist/registry-DKEXOJVO.js +0 -7
  552. package/dist/registry-OJIOSBV6.js +0 -10
  553. package/dist/registry-USRVT6YF.js +0 -8
  554. package/dist/revoke-JCC7N56X.js +0 -17
  555. package/dist/session/index.cjs +0 -495
  556. package/dist/session/index.cjs.map +0 -1
  557. package/dist/session/index.d.cts +0 -46
  558. package/dist/shadow/index.cjs +0 -133
  559. package/dist/shadow/index.cjs.map +0 -1
  560. package/dist/shadow/index.d.cts +0 -17
  561. package/dist/signer-72QAUSVW.js +0 -18
  562. package/dist/snapshots/index.cjs +0 -937
  563. package/dist/snapshots/index.cjs.map +0 -1
  564. package/dist/snapshots/index.d.cts +0 -28
  565. package/dist/store/index.cjs +0 -1083
  566. package/dist/store/index.cjs.map +0 -1
  567. package/dist/store/index.d.cts +0 -492
  568. package/dist/store/index.d.ts +0 -492
  569. package/dist/store/index.js +0 -37
  570. package/dist/strategy-BSxFXGzb.d.cts +0 -110
  571. package/dist/strategy-BSxFXGzb.d.ts +0 -110
  572. package/dist/strategy-DSTrsZ8t.d.cts +0 -601
  573. package/dist/strategy-DSTrsZ8t.d.ts +0 -601
  574. package/dist/sync/index.cjs +0 -1062
  575. package/dist/sync/index.cjs.map +0 -1
  576. package/dist/sync/index.d.cts +0 -43
  577. package/dist/team/index.cjs +0 -2798
  578. package/dist/team/index.cjs.map +0 -1
  579. package/dist/team/index.d.cts +0 -118
  580. package/dist/tx/index.cjs +0 -544
  581. package/dist/tx/index.cjs.map +0 -1
  582. package/dist/tx/index.d.cts +0 -21
  583. package/dist/types-Df28QFKb.d.ts +0 -12818
  584. package/dist/types-DyXYr8rE.d.cts +0 -12818
  585. package/dist/ulid-COREQ2RQ.js +0 -9
  586. package/dist/ulid-Drr7ykr6.d.cts +0 -603
  587. package/dist/util/index.cjs +0 -230
  588. package/dist/util/index.cjs.map +0 -1
  589. package/dist/util/index.d.cts +0 -77
  590. package/dist/with-derivation-DFnFByiQ.d.ts +0 -13
  591. package/dist/with-derivation-DU3Sjazm.d.cts +0 -13
  592. package/dist/with-guard-ByyxmEe7.d.cts +0 -18
  593. package/dist/with-guard-qube6BMI.d.ts +0 -18
  594. package/dist/with-materialized-view-BmEToIR1.d.cts +0 -27
  595. package/dist/with-overlayed-view-BMsQQbWm.d.cts +0 -13
  596. /package/dist/{chunk-UF3BUNQZ.js.map → api-TX2EX2FX.js.map} +0 -0
  597. /package/dist/{store → as}/index.js.map +0 -0
  598. /package/dist/{crypto-HTZ4FJOP.js.map → at/index.js.map} +0 -0
  599. /package/dist/{delegation-RI54P6I5.js.map → by/index.js.map} +0 -0
  600. /package/dist/{executor-5PNY7LGW.js.map → cargo/index.js.map} +0 -0
  601. /package/dist/{executor-B4QIYGZX.js.map → chunk-CHFZDSE4.js.map} +0 -0
  602. /package/dist/{executor-BWXXDQ7K.js.map → chunk-GHVIKOHT.js.map} +0 -0
  603. /package/dist/{issue-VGDPP4B5.js.map → chunk-PZ5AY32C.js.map} +0 -0
  604. /package/dist/{ledger-TMRZYNVJ.js.map → classified/index.js.map} +0 -0
  605. /package/dist/{noydb-G725ZSZG.js.map → collection-facade-LVD22JLM.js.map} +0 -0
  606. /package/dist/{public-envelope-BW6OXORV.js.map → computed-EXDMQODG.js.map} +0 -0
  607. /package/dist/{read-only-facade-ITU6L7BL.js.map → delegation-BJP73GAP.js.map} +0 -0
  608. /package/dist/{registry-3QP3YKQS.js.map → derive-BME7HDWO.js.map} +0 -0
  609. /package/dist/{registry-DKEXOJVO.js.map → enclave-NHORSWSF.js.map} +0 -0
  610. /package/dist/{registry-OJIOSBV6.js.map → executor-FE6X4LFX.js.map} +0 -0
  611. /package/dist/{registry-USRVT6YF.js.map → executor-KSHKRJXP.js.map} +0 -0
  612. /package/dist/{revoke-JCC7N56X.js.map → executor-ZHTJJICG.js.map} +0 -0
  613. /package/dist/{signer-72QAUSVW.js.map → export-accessible-DACHM5VT.js.map} +0 -0
  614. /package/dist/{stale-6ZDBTQT7.js.map → extract-partition-RNENZZ4T.js.map} +0 -0
  615. /package/dist/{ulid-COREQ2RQ.js.map → find-BNGBJNKP.js.map} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,77 +1,27 @@
1
- import { b3 as NoydbStore, bF as UserEnvelope, br as PublicEnvelope, bG as GateName, bH as GatePolicy, bI as VaultPolicy, bJ as ActiveTier, bK as FactorProof, bL as SchemaUpdateStrategy, bM as TransformFn, bN as PersistedSchemaEnvelope, bO as UpdateDecision, bP as DirectoryConfig, bQ as UserVisibility, b1 as UnlockedKeyring, bw as Vault, ba as DiffEntry } from './types-Df28QFKb.js';
2
- export { bR as AccessibleVault, bS as AffectedDocument, b7 as AppendInput, aP as ArrayOutputSpec, z as BLOB_CHUNKS_COLLECTION, A as BLOB_COLLECTION, E as BLOB_INDEX_COLLECTION, F as BLOB_SLOTS_PREFIX, G as BLOB_VERSIONS_PREFIX, bT as BUNDLE_STORE_POLICY, M as BlobObject, N as BlobPutOptions, Q as BlobResponseOptions, T as BlobSet, bU as BuiltInGateName, bt as BundleRecipient, a9 as CONSENT_AUDIT_COLLECTION, bV as CacheOptions, bW as CacheStats, bX as ChangeEvent, b8 as ChangeType, ai as ClosePeriodOptions, aY as Collection, bY as CollectionChangeEvent, bZ as CollectionConflictResolver, b_ as CollectionDescriptor, az as CollectionFrame, b9 as CollectionInstant, b$ as CollectionStats, c0 as Conflict, c1 as ConflictPolicy, c2 as ConflictStrategy, aa as ConsentAuditEntry, ab as ConsentAuditFilter, ac as ConsentContext, ad as ConsentOp, c3 as CrossTierAccessEvent, Y as DEFAULT_CHUNK_SIZE, c4 as DEFAULT_PUBLIC_ENVELOPE_SCHEMA, c5 as DELEGATIONS_COLLECTION, D as DICT_COLLECTION_PREFIX, c6 as DeepPartial, c7 as DeepPartialOrNull, c8 as DelegationToken, c9 as DeleteManyResult, ca as DerivationDescriptor, aN as DerivationStrategy, aR as DerivationStrategyHandle, aS as DerivedFromMeta, a as DictEntry, b as DictKeyDescriptor, c as DictionaryHandle, d as DictionaryOptions, cb as DirtyEntry, cc as DryRunResult, cd as DumpSchemaOptions, ce as ELEVATION_AUDIT_COLLECTION, cf as ElevatedHandle, b5 as EncryptedEnvelope, cg as EnrollAuthenticatorOptions, ch as EnrollAuthenticatorWrappingDEKsOptions, ci as EnrollAuthenticatorWrappingKEKOptions, cj as EnrollRecoveryResult, ck as ExportCapability, cl as ExportChunk, cm as ExportFormat, cn as ExportStreamOptions, co as FactorKind, cp as FactorProofBundle, cq as FactorRequirement, cr as FenceDoc, cs as FenceState, ct as FieldChange, cu as FieldDescriptor, cv as FieldSource, cw as GhostRecord, cx as GrantOptions, at as GuardChange, au as GuardContext, as as GuardStrategy, aw as GuardStrategyHandle, cy as GuardViolation, cz as HistoryConfig, cA as HistoryEntry, b4 as HistoryOptions, e as I18nMap, f as I18nTextDescriptor, g as I18nTextOptions, cB as INDEXED_STORE_POLICY, cC as ImportCapability, cD as InferOutput, cE as InternalCollectionStats, cF as IssueDelegationOptions, cG as IssueMagicLinkGrantOptions, bb as JsonPatch, bc as JsonPatchOp, cH as KeyringAuthenticator, cI as KeyringAuthenticatorWrappingDEKs, cJ as KeyringAuthenticatorWrappingKEK, cK as KeyringFile, L as Layer, bd as LedgerEntry, be as LedgerStore, cL as ListAccessibleVaultsOptions, cM as ListPageResult, cN as ListUsersOptions, cO as LiveUserEnvelope, cP as LocaleReadOptions, cQ as Lru, cR as LruOptions, cS as LruStats, cT as MAGIC_LINK_CONTENT_INFO_PREFIX, cU as MAGIC_LINK_GRANTS_COLLECTION, cV as MAGIC_LINK_KEK_INFO_PREFIX, cW as MagicLinkGrantPayload, cX as MagicLinkGrantRecord, bC as MaterializedFromMeta, cY as MaterializedViewDescriptor, bD as MaterializedViewOutput, aV as MaterializedViewStrategy, aW as MaterializedViewStrategyHandle, cZ as MemoryRecipientSealer, c_ as MemorySealingKeyProvider, c$ as NOYDB_BACKUP_VERSION, d0 as NOYDB_FORMAT_VERSION, d1 as NOYDB_KEYRING_VERSION, d2 as NOYDB_SYNC_VERSION, d3 as Noydb, aB as NoydbBundleStore, d4 as NoydbEventMap, d5 as NoydbOptions, O as OnMissing, h as OnMissingPolicy, aj as OpenPeriodOptions, aT as OutputSpec, d6 as OverlayViewDescriptor, aX as OverlayedViewStrategy, a_ as OverlayedViewStrategyHandle, ak as PERIODS_COLLECTION, d7 as PUBLIC_ENVELOPE_FIELDS, d8 as PaperRecoveryDoc, d9 as PaperRecoveryEntry, da as PassphrasePolicy, db as PassphraseValidationResult, al as PeriodRecord, dc as Permission, dd as Permissions, de as PersistedSchemaKind, df as PlaintextTranslatorContext, dg as PlaintextTranslatorFn, P as PolicyEnforcer, dh as PresenceHandle, di as PresencePeer, b6 as PruneOptions, dj as PublicEnvelopeField, dk as PublicEnvelopeSchema, dl as PublicEnvelopeText, dm as PullMode, dn as PullOptions, dp as PullPolicy, dq as PullResult, dr as PushMode, ds as PushOptions, dt as PushPolicy, du as PushResult, dv as PutManyItemOptions, dw as PutManyOptions, dx as PutManyResult, dy as QueryAcrossOptions, dz as QueryAcrossResult, dA as QuickUnlockState, dB as QuickUnlockStore, dC as ReAuthOperation, bv as RecipientHint, bu as RecipientSealer, aU as RecordOutputSpec, dD as RecoverPassphraseInput, dE as RecoverPassphraseResult, dF as RecoverUserOptions, dG as RecoveryProof, R as ResolveI18nOptions, dH as ResolvedPublicEnvelopeSchema, aC as RetentionPolicy, dI as RevokeOptions, b0 as Role, dJ as RotatePassphraseInput, dK as RotateRecoveryOptions, dL as RotateRecoveryResult, dM as SEALED_PASSPHRASE_RECORD_ID, dN as SchemaDelta, dO as SchemaIntrospection, S as ScriptWarning, dP as SealedEnvelope, dQ as SealedPassphrase, bs as SealingKeyProvider, dR as SessionPolicy, dS as SetPublicEnvelopeInput, dT as ShamirRecoveryDoc, dU as ShamirRecoveryEntry, by as ShamirRecoveryProvider, a3 as SlotInfo, a4 as SlotRecord, dV as SlotRewrapCeremony, dW as SlotRewrapContext, aF as SnapshotMeta, dX as StandardSchemaV1, dY as StandardSchemaV1Issue, dZ as StandardSchemaV1SyncResult, d_ as StoreAuth, d$ as StoreAuthKind, e0 as StoreCapabilities, e1 as SyncEngine, e2 as SyncMetadata, e3 as SyncPolicy, e4 as SyncScheduler, e5 as SyncSchedulerStatus, e6 as SyncStatus, e7 as SyncTarget, e8 as SyncTargetRole, e9 as SyncTransaction, ea as SyncTransactionResult, eb as TabChannel, ec as TabCoordinationOptions, ed as TabLockManager, ee as TabPresence, ef as TabRole, eg as TierMode, eh as TranslatorAuditEntry, aJ as TxCollection, aK as TxContext, ei as TxOp, aL as TxVault, ej as USER_ENVELOPE_COLLECTION, ek as USER_ENVELOPE_MAX_BYTES, bE as UnionSource, el as Unsubscribe, em as UpdateAuthenticatorOptions, en as UpdateContext, eo as UpdateUserOptions, ep as UserApi, eq as UserEnvelopeCheckGate, er as UserEnvelopeOversizedError, es as UserEnvelopePresented, et as UserInfo, eu as VaultBackup, bf as VaultEngine, aA as VaultFrame, bg as VaultInstant, ev as VaultPolicyOnDisk, ew as VaultSchemaSnapshot, ex as VaultSnapshot, bh as VerifyResult, a5 as VersionRecord, ey as WarningRules, ez as WeakPassphraseError, eA as WeakPassphraseReason, eB as WrappedDeksBlob, eC as WriteConflict, eD as WriteEvent, eE as WriteHook, eF as WriteQueue, i as applyI18nLocale, bi as applyPatch, eG as assertStrongPassphrase, eH as buildRecipientKeyringFile, eI as burnPaperRecoveryEntry, bj as canonicalJson, bk as computePatch, x as createEnforcer, eJ as createNoydb, eK as createStore, eL as deriveMagicLinkContentKey, j as dictCollectionName, k as dictKey, bl as diff, l as enforceScript, eM as enrollAuthenticator, eN as estimateEntropy, eO as evaluateExportCapability, eP as evaluateImportCapability, eQ as findAuthenticator, bm as formatDiff, eR as hasExportCapability, eS as hasImportCapability, eT as hasRecoveryEnrolled, bn as hashEntry, n as i18nText, o as inferScripts, p as isDictCollectionName, q as isDictKeyDescriptor, r as isI18nTextDescriptor, eU as isMagicLinkGrantExpired, eV as isPublicEnvelope, eW as issueDelegation, eX as keyringRecoverPassphrase, eY as keyringRotatePassphrase, eZ as listMagicLinkGrants, e_ as listUsers, e$ as listUsersWithEnvelopes, f0 as loadActiveDelegations, f1 as loadPaperRecoveryEntries, f2 as loadSealedPassphrase, f3 as loadShamirRecoveryEntries, f4 as magicLinkGrantRecordId, f5 as mintPaperRecoveryEntry, f6 as mintShamirRecoveryEntry, f7 as mintWrappedDeksBlob, bo as paddedIndex, bp as parseIndex, f8 as parseSealedEnvelope, f9 as readMagicLinkGrantRecord, fa as recoverUser, fb as removeAuthenticator, s as resolveI18nText, t as resolvePolicy, fc as resolvePublicEnvelopeSchema, fd as revokeDelegation, fe as revokeMagicLinkGrant, aM as runTransaction, ff as savePaperRecoveryEntries, fg as saveSealedPassphrase, fh as saveShamirRecoveryEntries, bq as sha256Hex, fi as unwrapDeksFromBlob, fj as unwrapDeksFromPaperEntry, fk as unwrapDeksFromShamirEntry, fl as unwrapMagicLinkGrant, v as validateI18nTextValue, fm as validatePassphrase, fn as validatePublicEnvelopeInput, fo as validateSchemaInput, fp as validateSchemaOutput, y as validateSessionPolicy, fq as writeMagicLinkGrant } from './types-Df28QFKb.js';
3
- export { d as detectMagic, a as detectMimeType, i as isPreCompressed } from './mime-magic-CBBSOkjm.js';
4
- export { AgeRoute, BlobLifecyclePolicy, BlobStoreRoute, CircuitBreakerOptions, HealthCheckOptions, LogLevel, LoggingOptions, MetricsOptions, OverrideOptions, OverrideTarget, RetryOptions, RouteStatus, RouteStoreOptions, RoutedNoydbStore, StoreCacheOptions, StoreMiddleware, StoreOperation, SuspendOptions, WrapBundleStoreOptions, WrappedBundleNoydbStore, createBundleStore, routeStore, withCache, withCircuitBreaker, withHealthCheck, withLogging, withMetrics, withRetry, wrapBundleStore, wrapStore } from './store/index.js';
5
- import { N as NoydbError } from './index-D8I_pyJD.js';
6
- export { z as AlreadyElevatedError, A as AmendmentForbiddenError, o as AttestationError, B as BackupCorruptedError, q as BackupLedgerError, r as BundleIntegrityError, s as BundleSealMismatchError, t as BundleVersionConflictError, C as ConflictError, E as CrossJoinSourceUnknownError, G as CrossJoinTooLargeError, H as DEFAULT_CROSS_JOIN_MAX_ROWS, J as DEFAULT_JOIN_MAX_ROWS, K as DanglingReferenceError, U as DecryptionError, V as DelegationTargetMissingError, g as DerivationCapExceededError, h as DerivationCycleError, i as DerivationDepthError, j as DerivationOutputShapeError, k as DerivationOutputUnknownError, D as DictKeyInUseError, a as DictKeyMissingError, W as DirectoryDisabledError, X as ElevationExpiredError, Y as ExportCapabilityError, F as FieldFrozenError, Z as FilenameSanitizationError, _ as GroupCardinalityError, $ as ImportCapabilityError, a0 as IndexRequiredError, a1 as IndexWriteFailureError, a2 as InvalidKeyError, I as InvariantError, a3 as JoinContext, a4 as JoinLeg, a5 as JoinStrategy, a6 as JoinTooLargeError, a7 as JoinableSource, a8 as KeyringCorruptError, a9 as KeyringExpiredError, aa as LedgerContentionError, ab as LiveQuery, ac as LiveUpstream, L as LocaleNotSpecifiedError, v as MaterializedViewConfigError, w as MaterializedViewCycleError, x as MaterializedViewSourceUnknownError, y as MaterializedViewTooLargeError, ad as MigrationRequiredError, M as MissingTranslationError, ae as NetworkError, af as NoAccessError, ag as NonAdditiveSchemaChangeError, ah as NotFoundError, ai as OrderBy, O as OverlayBaseIsVirtualError, l as OverlayCollectionUnavailableError, m as OverlayIdMismatchError, n as OverlayNameCollisionError, aj as PathEscapeError, ak as PeriodClosedError, al as PermissionDeniedError, am as PrivilegeEscalationError, Q as Query, an as QueryPlan, ao as QuerySource, ap as QuiesceTimeoutError, aq as ReadOnlyAtInstantError, ar as ReadOnlyError, as as ReadOnlyFrameError, e as RecordLockedError, at as RefDescriptor, au as RefIntegrityError, av as RefMode, aw as RefRegistry, ax as RefScopeError, ay as RefViolation, R as ReservedCollectionNameError, az as ScanBuilder, aA as ScanPageProvider, aB as SchemaFenceError, aC as SchemaLockedError, aD as SchemaUpdateError, aE as SchemaValidationError, S as ScriptViolationError, b as SessionExpiredError, c as SessionNotFoundError, d as SessionPolicyError, f as SnapshotNotFoundError, aF as StoreCapabilityError, aG as TamperedError, aH as TierDemoteDeniedError, aI as TierNotGrantedError, T as TranslatorNotConfiguredError, aJ as ValidationError, aK as applyJoins, aL as buildLiveQuery, aM as executePlan, aN as ref, aO as resetJoinWarnings } from './index-D8I_pyJD.js';
7
- export { A as AutoCredential, n as AutoCredentialKind, c as CompressionAlgo, N as NOYDB_BUNDLE_FORMAT_VERSION, e as NOYDB_BUNDLE_MAGIC, f as NOYDB_BUNDLE_PREFIX_BYTES, g as NoydbBundleHeader, h as NoydbBundleReadResult, R as ReadNoydbBundleOptions, W as WriteNoydbBundleOptions, j as generateULID, o as hasNoydbBundleMagic, k as isULID, r as readNoydbBundle, l as readNoydbBundleHeader, p as readNoydbBundlePublicEnvelope, m as resetBrotliSupportCache, w as writeNoydbBundle } from './ulid-CJ8RzRrm.js';
8
- export { a as CrdtMode, b as CrdtState, L as LwwMapState, R as RgaState, Y as YjsState, m as mergeCrdtStates, r as resolveCrdtSnapshot } from './strategy-BSxFXGzb.js';
9
- export { w as withGuard } from './with-guard-qube6BMI.js';
10
- export { w as withDerivation } from './with-derivation-DFnFByiQ.js';
11
- export { w as withMaterializedView } from './with-materialized-view-BLkQxoQN.js';
12
- export { a as Clause, C as CollectionIndexes, F as FieldClause, b as FilterClause, G as GroupClause, H as HashIndex, I as IndexDef, O as Operator, e as evaluateClause, c as evaluateFieldClause, r as readPath } from './predicate-BSAGEyu5.js';
13
- export { w as withOverlayedView } from './with-overlayed-view-CRsSEwHR.js';
14
- export { SYNC_CREDENTIALS_COLLECTION, SyncCredential, credentialStatus, deleteCredential, getCredential, listCredentials, putCredential } from './team/index.js';
15
- export { C as CreateSessionOptions, a as CreateSessionResult, D as DevUnlockOptions, S as SessionToken, b as activeSessionCount, c as clearDevUnlock, d as createSession, e as enableDevUnlock, i as isDevUnlockActive, f as isSessionAlive, l as loadDevUnlock, r as resolveSession, g as revokeAllSessions, h as revokeSession } from './dev-unlock-B4kDxep_.js';
16
- export { a as AggregateResult, b as AggregateSpec, c as Aggregation, d as AggregationUpstream, G as GROUPBY_MAX_CARDINALITY, e as GROUPBY_WARN_CARDINALITY, f as GroupedAggregation, g as GroupedQuery, h as GroupedQueryN, i as GroupedRow, j as GroupedRowN, L as LiveAggregation, R as Reducer, k as ReducerOptions, l as avg, n as count, o as groupAndReduce, p as max, q as min, r as reduceRecords, t as sum } from './strategy-DSTrsZ8t.js';
17
- export { L as LEDGER_COLLECTION, a as LEDGER_DELTAS_COLLECTION, e as envelopePayloadHash } from './hash-HJqD14vS.js';
18
- import './lazy-builder-7tIpFyWN.js';
1
+ import { ep as SearchStrategy, eq as SequenceStrategy, er as ViaDescriptor, es as CustodyStrategy, d0 as EncryptedEnvelope, et as CollectionDescription, eu as SchemaUpdateStrategy, ev as TransformFn, c_ as NoydbStore, ew as PersistedSchemaEnvelope, dr as EnclaveKey, ex as UpdateDecision, ey as NoydbError, e7 as PublicEnvelope, ez as UserEnvelope, eA as VaultUserApi, eB as UserApiDeps, c1 as RequestWithdrawalOptions, c2 as RequestWithdrawalResult, c6 as WithdrawalRequestStatus, c5 as WithdrawalRequest, bY as ApproveWithdrawalOptions, c4 as WithdrawResult, c0 as RejectWithdrawalOptions, c3 as WithdrawAccessibleOptions, bZ as ExportAccessibleOptions, eC as DeepPartialOrNull, eD as UserEnvelopePresented, eE as Unsubscribe, eF as LiveUserEnvelope, eG as RoundingMode, c8 as UnlockedKeyring, eH as VaultPolicy, eI as ActiveTier, eJ as FactorProof, eK as GateName, eL as PolicyDenyReason, eM as GatePolicy } from './index-DjWbxsjb.js';
2
+ export { eN as AccessibleVault, eO as AffectedDocument, aa as AggregateResult, ab as AggregateSpec, ac as Aggregation, ad as AggregationUpstream, eP as AlreadyElevatedError, bf as AmendmentForbiddenError, d2 as AppendInput, eQ as ArchivePolicy, eR as ArchiveResult, eS as ArchiveRunOptions, eT as ArchiveStrategy, bz as ArrayOutputSpec, dG as AttestationError, dH as AttestationNotEnabledError, e as BLOB_CHUNKS_COLLECTION, f as BLOB_COLLECTION, h as BLOB_INDEX_COLLECTION, i as BLOB_SLOTS_PREFIX, j as BLOB_VERSIONS_PREFIX, eU as BUNDLE_STORE_POLICY, dt as BackupCorruptedError, du as BackupLedgerError, n as BlobObject, o as BlobPutOptions, p as BlobResponseOptions, q as BlobSet, eV as BuiltInGateName, dv as BundleIntegrityError, e8 as BundleRecipient, dw as BundleSealMismatchError, dx as BundleVersionConflictError, aN as CONSENT_AUDIT_COLLECTION, eW as CacheOptions, eX as CacheStats, eY as CargoNotEnabledError, eZ as CargoStrategy, e_ as ChangeEvent, d3 as ChangeType, dU as ClassifiedConfigError, dV as ClassifiedEntry, dS as ClassifiedFieldSpec, dW as ClassifiedGroup, dX as ClassifiedList, e$ as ClassifiedNotEnabledError, dZ as ClassifiedRevealError, d$ as ClassifiedRotationError, e0 as ClassifiedStorage, e1 as ClassifiedVerdict, e3 as ClassifiedVerifyError, f0 as Clause, aW as ClosePeriodOptions, bN as Collection, f1 as CollectionChangeEvent, f2 as CollectionConfig, f3 as CollectionConflictResolver, f4 as CollectionDescriptor, bo as CollectionFrame, U as CollectionIndexes, d4 as CollectionInstant, f5 as CollectionMeta, f6 as CollectionStats, f7 as ComputedFieldEntry, f8 as ComputedFieldError, f9 as ComputedFields, fa as ComputedFn, fb as Conflict, fc as ConflictError, fd as ConflictPolicy, fe as ConflictStrategy, aO as ConsentAuditEntry, aP as ConsentAuditFilter, aQ as ConsentContext, aR as ConsentOp, aD as CrdtMode, aE as CrdtState, ff as CrossJoinSourceUnknownError, fg as CrossJoinTooLargeError, fh as CrossTierAccessEvent, fi as CustodyApi, fj as CustodyHost, fk as CustodyNotEnabledError, D as DEFAULT_CHUNK_SIZE, fl as DEFAULT_CROSS_JOIN_MAX_ROWS, fm as DEFAULT_JOIN_MAX_ROWS, fn as DEFAULT_PUBLIC_ENVELOPE_SCHEMA, fo as DELEGATIONS_COLLECTION, cl as DICT_COLLECTION_PREFIX, fp as DanglingReferenceError, fq as DataResidencyError, fr as DebugPlaintextError, fs as DebugReservedFieldError, ft as DecryptionError, fu as DeepPartial, fv as DeferredNumberingConfig, fw as DelegationTargetMissingError, fx as DelegationToken, fy as DeleteManyResult, bA as DerivationCapExceededError, bB as DerivationCycleError, bC as DerivationDepthError, fz as DerivationDescriptor, bD as DerivationOutputShapeError, bE as DerivationOutputUnknownError, fA as DerivationSkippedFrozen, bx as DerivationStrategy, bG as DerivationStrategyHandle, bH as DerivedFromMeta, fB as DescribeOptions, fC as DescribedField, cm as DictEntry, cn as DictKeyDescriptor, co as DictKeyInUseError, cp as DictKeyMissingError, cq as DictionaryHandle, cr as DictionaryOptions, c7 as DiffEntry, fD as DirectoryDisabledError, fE as DirtyEntry, fF as DryRunResult, fG as DumpSchemaOptions, fH as ELEVATION_AUDIT_COLLECTION, fI as ElevatedHandle, fJ as ElevationExpiredError, fK as EmbeddingDescriptor, fL as EmbeddingDimMismatchError, fM as EmbeddingModelMismatchError, fN as EnclaveNotSupportedError, fO as EnrollAuthenticatorOptions, fP as EnrollAuthenticatorWrappingDEKsOptions, fQ as EnrollAuthenticatorWrappingKEKOptions, fR as EnrollRecoveryResult, fS as ErasureEnforcement, fT as ExportCapability, fU as ExportCapabilityError, fV as ExportChunk, c9 as ExportFormat, fW as ExportStreamOptions, fX as FactorKind, fY as FactorProofBundle, fZ as FactorRequirement, f_ as FenceDoc, f$ as FenceState, g0 as FieldChange, g1 as FieldClause, g2 as FieldDescriptor, bg as FieldFrozenError, g3 as FieldMeta, g4 as FieldNotQueryableError, g5 as FieldSource, g6 as FilenameSanitizationError, g7 as FilterClause, g8 as ForgetStrategyNotConfiguredError, g9 as FormattedSequenceHandle, ga as FrozenSnapshotRef, ae as GROUPBY_MAX_CARDINALITY, af as GROUPBY_WARN_CARDINALITY, gb as GhostRecord, gc as GrantCustodianOptions, gd as GrantOptions, ge as GroupCardinalityError, gf as GroupClause, ag as GroupedAggregation, ah as GroupedQuery, ai as GroupedQueryN, aj as GroupedRow, ak as GroupedRowN, bd as GuardChange, be as GuardContext, bc as GuardStrategy, bi as GuardStrategyHandle, gg as GuardViolation, W as HashIndex, gh as HistoryConfig, gi as HistoryEntry, c$ as HistoryOptions, cs as I18nMap, ct as I18nTextDescriptor, cu as I18nTextOptions, gj as INDEXED_STORE_POLICY, bj as IllegalTransitionError, gk as ImportCapability, gl as ImportCapabilityError, Y as IndexDef, gm as IndexFieldName, gn as IndexRequiredError, go as IndexWriteFailureError, gp as InferOutput, gq as InternalCollectionStats, gr as InvalidKeyError, bk as InvariantError, gs as IssueDelegationOptions, gt as IssueMagicLinkGrantOptions, gu as JoinContext, gv as JoinLeg, gw as JoinStrategy, gx as JoinTooLargeError, gy as JoinableSource, d5 as JsonPatch, d6 as JsonPatchOp, gz as KeyringAuthenticator, gA as KeyringAuthenticatorWrappingDEKs, gB as KeyringAuthenticatorWrappingKEK, gC as KeyringCorruptError, gD as KeyringExpiredError, gE as KeyringFile, cv as Layer, gF as LazyStrategy, gG as LedgerContentionError, d7 as LedgerStore, gH as LiberateOptions, gI as LiberateResult, gJ as LinkIntegrityError, gK as LinkOnDelete, gL as LinkRow, gM as LinkSetHandle, gN as LinkSpec, gO as ListAccessibleVaultsOptions, gP as ListPageResult, gQ as ListUsersOptions, al as LiveAggregation, gR as LiveQuery, gS as LiveUpstream, cw as LocaleNotSpecifiedError, gT as LocaleReadOptions, gU as LookupDescriptor, gV as Lru, gW as LruOptions, gX as LruStats, aF as LwwMapState, gY as MAGIC_LINK_CONTENT_INFO_PREFIX, gZ as MAGIC_LINK_GRANTS_COLLECTION, g_ as MAGIC_LINK_KEK_INFO_PREFIX, g$ as MagicLinkGrantPayload, h0 as MagicLinkGrantRecord, h1 as ManagedRecoveryNotEnrolledError, eh as MaterializedFromMeta, ei as MaterializedViewConfigError, ej as MaterializedViewCycleError, h2 as MaterializedViewDescriptor, ek as MaterializedViewOutput, el as MaterializedViewSourceUnknownError, bK as MaterializedViewStrategy, bL as MaterializedViewStrategyHandle, em as MaterializedViewTooLargeError, h3 as MemoryRecipientSealer, h4 as MemorySealingKeyProvider, h5 as MigrationRequiredError, cx as MissingTranslationError, h6 as MoneyCurrencyError, h7 as MoneyDescriptor, h8 as MoneyOptions, h9 as MoneyOptionsFixed, ha as MoneyOptionsMulti, hb as MoneyPrecisionError, hc as MoneyString, hd as MoneyUnsupportedError, he as NOYDB_BACKUP_VERSION, hf as NOYDB_FORMAT_VERSION, hg as NOYDB_KEYRING_VERSION, hh as NOYDB_SYNC_VERSION, hi as NO_CARGO, hj as NO_CUSTODY, hk as NO_SEARCH, hl as NO_SEQUENCE, hm as NO_TEAM, hn as NetworkError, ho as NextOptions, hp as NoAccessError, hq as NonAdditiveSchemaChangeError, hr as NotFoundError, hs as Noydb, ht as NoydbBundleStore, hu as NoydbEventMap, hv as NoydbOptions, bq as NoydbPodStore, hw as NumberingAssignment, hx as NumberingUncertaintyError, O as ObjectListEntry, A as ObjectMeta, F as ObjectProjection, G as ObjectUrlOptions, hy as OnDelete, cy as OnMissing, cz as OnMissingPolicy, aX as OpenPeriodOptions, hz as Operator, hA as OrderBy, bI as OutputSpec, bO as OverlayBaseIsVirtualError, bP as OverlayCollectionUnavailableError, bQ as OverlayFieldMergeMode, bR as OverlayFieldMergeRule, bS as OverlayIdMismatchError, bT as OverlayNameCollisionError, hB as OverlayViewDescriptor, bM as OverlayedViewStrategy, bV as OverlayedViewStrategyHandle, aY as PERIODS_COLLECTION, hC as POD_STORE_POLICY, hD as PUBLIC_ENVELOPE_FIELDS, hE as PaperRecoveryDoc, hF as PaperRecoveryEntry, hG as PassphrasePolicy, hH as PassphraseValidationResult, hI as PathEscapeError, hJ as PeriodClosedError, b2 as PeriodRecord, hK as Permission, hL as PermissionDeniedError, hM as Permissions, hN as PersistedSchemaKind, hO as PlaintextTranslatorContext, hP as PlaintextTranslatorFn, dB as PodVersionConflictError, hQ as PolicyDeniedError, P as PolicyEnforcer, b$ as PortabilityNotEnabledError, hR as PresenceHandle, hS as PresencePeer, hT as PrivilegeEscalationError, d1 as PruneOptions, hU as PublicEnvelopeField, hV as PublicEnvelopeSchema, hW as PublicEnvelopeText, hX as PullMode, hY as PullOptions, hZ as PullPolicy, h_ as PullResult, h$ as PushMode, i0 as PushOptions, i1 as PushPolicy, i2 as PushResult, i3 as PutManyItemOptions, i4 as PutManyOptions, i5 as PutManyResult, H as PutObjectOptions, I as PutUrlOptions, ef as Query, i6 as QueryAcrossOptions, i7 as QueryAcrossResult, i8 as QueryField, i9 as QueryPlan, ia as QuerySource, ib as QuickUnlockState, ic as QuickUnlockStore, id as QuiesceTimeoutError, ie as ReAuthOperation, ig as ReadOnlyAtInstantError, ih as ReadOnlyError, ii as ReadOnlyFrameError, ea as RecipientHint, e9 as RecipientSealer, ij as RecordCekNotFoundError, bm as RecordLockedError, bJ as RecordOutputSpec, ik as RecoverPassphraseInput, il as RecoverPassphraseResult, im as RecoverUserOptions, io as RecoveryNotEnrolledError, ip as RecoveryProfileNotImplementedError, iq as RecoveryProof, am as Reducer, an as ReducerBuilder, ao as ReducerOptions, ir as RefDescriptor, is as RefIntegrityError, it as RefMode, iu as RefRegistry, iv as RefScopeError, iw as RefViolation, cA as ReservedCollectionNameError, ix as ReservedVaultNameError, cB as ResolveI18nOptions, iy as ResolvedPublicEnvelopeSchema, iz as RestrictRefUnresolvableError, br as RetentionPolicy, iA as RetrieveHit, iB as RetrieveOptions, iC as RevokeOptions, aG as RgaState, cY as Role, iD as RotatePassphraseInput, iE as RotateRecoveryOptions, iF as RotateRecoveryResult, iG as SEALED_PASSPHRASE_RECORD_ID, iH as ScanBuilder, iI as ScanPageProvider, iJ as SchemaDelta, iK as SchemaFenceError, iL as SchemaIntrospection, iM as SchemaLockedError, iN as SchemaUpdateError, iO as SchemaValidationError, cC as ScriptViolationError, cD as ScriptWarning, iP as Sealed, iQ as SealedEnvelope, iR as SealedHandle, iS as SealedPassphrase, dj as SealedRecordExpiredError, dk as SealedRecordMismatchError, dl as SealedRecordNotEnabledError, iT as SealedView, dn as SealingKeyProvider, iU as SearchEntry, iV as SearchNotEnabledError, iW as SearchOptions, iX as SearchResult, iY as SemanticType, iZ as SequenceContentionError, i_ as SequenceHandle, i$ as SequenceNotEnabledError, j0 as SequenceOfflineError, j1 as SequenceOptions, j2 as SequenceStore, j3 as SequenceStoreOptions, a as SessionExpiredError, b as SessionNotFoundError, j4 as SessionPolicy, c as SessionPolicyError, j5 as SetPublicEnvelopeInput, j6 as ShamirRecoveryDoc, j7 as ShamirRecoveryEntry, dq as ShamirRecoveryProvider, j8 as ShardProvisioningError, J as SlotInfo, K as SlotRecord, j9 as SlotRewrapCeremony, ja as SlotRewrapContext, bu as SnapshotMeta, bw as SnapshotNotFoundError, jb as StandardSchemaV1, jc as StandardSchemaV1Issue, jd as StandardSchemaV1SyncResult, cE as StaticDictDescriptor, cF as StaticDictReadonlyError, je as StoreAuth, jf as StoreAuthKind, jg as StoreCapabilities, jh as StoreCapabilityError, ji as StoreTime, jj as SyncEngine, jk as SyncMetadata, jl as SyncPolicy, jm as SyncScheduler, jn as SyncSchedulerStatus, jo as SyncStatus, jp as SyncTarget, jq as SyncTargetRole, jr as SyncTransaction, js as SyncTransactionResult, jt as TabChannel, ju as TabCoordinationOptions, jv as TabLockManager, jw as TabPresence, jx as TabRole, jy as TamperedError, jz as TeamNotEnabledError, jA as TeamStrategy, jB as TierDemoteDeniedError, jC as TierMode, jD as TierNotGrantedError, jE as TiersNotEnabledError, jF as TransactionInvariant, jG as TranslatorAuditEntry, cG as TranslatorNotConfiguredError, jH as TxCollection, eb as TxContext, jI as TxOp, jJ as TxVault, en as UnionArmJoin, eo as UnionSource, jK as UniqueConstraintError, cH as UnknownDictCodeError, jL as UnknownLookupKeyError, jM as UnknownShardError, jN as UnsupportedIndexOptionError, jO as UpdateAuthenticatorOptions, jP as UpdateContext, jQ as UpdateUserOptions, jR as UserEnvelopeCheckGate, jS as UserEnvelopeOversizedError, jT as UserInfo, jU as ValidationError, V as Vault, jV as VaultBackup, d8 as VaultEngine, bp as VaultFrame, d9 as VaultInstant, jW as VaultMeta, jX as VaultPolicyOnDisk, jY as VaultSchemaSnapshot, jZ as VaultSnapshot, j_ as VaultTemplateNotFoundError, da as VerifyResult, L as VersionRecord, j$ as ViaFieldSpec, k0 as ViaPosture, k1 as Vocabulary, k2 as WarningRules, k3 as WeakPassphraseError, k4 as WeakPassphraseReason, k5 as WithArchiveOptions, k6 as WithdrawalRequestError, k7 as WrappedDeksBlob, k8 as WriteConflict, k9 as WriteQueue, aH as YjsState, ka as aesGcmOpen, cI as applyI18nLocale, kb as applyJoins, db as applyPatch, kc as approveWithdrawal, kd as asMoney, ke as assertStrongPassphrase, ap as avg, kf as base64ToBuffer, kg as bufferToBase64, kh as buildLiveQuery, ki as buildRecipientKeyringFile, kj as burnPaperRecoveryEntry, kk as compileSequenceFormat, dc as computePatch, ar as count, d as createEnforcer, kl as createNoydb, km as createStore, kn as decryptBytes, ko as decryptDeterministic, kp as deriveMagicLinkContentKey, kq as derivePresenceKey, kr as dict, cJ as dictCollectionName, cK as dictKey, dd as diff, ks as encryptBytes, kt as encryptDeterministic, cL as enforceScript, ku as enrollAuthenticator, kv as enum, kv as enumOf, kw as estimateEntropy, kx as evalComputedFields, ky as evaluateClause, kz as evaluateExportCapability, kA as evaluateFieldClause, kB as evaluateImportCapability, kC as executePlan, kD as exportAccessibleData, kE as findAuthenticator, de as formatDiff, as as groupAndReduce, kF as hasExportCapability, kG as hasImportCapability, kH as hasRecoveryEnrolled, cM as i18nText, cN as inferScripts, e5 as isClassifiedFieldSpec, e6 as isClassifiedGroup, cO as isDictCollectionName, cP as isDictKeyDescriptor, cQ as isI18nTextDescriptor, kI as isLinkCollectionName, kJ as isMagicLinkGrantExpired, kK as isMoneyDescriptor, kL as isMoneyString, kM as isPublicEnvelope, kN as isRefArray, cR as isStaticDictDescriptor, kO as isViaFieldSpec, kP as issueDelegation, kQ as keyringRecoverPassphrase, kR as keyringRotatePassphrase, kS as liberateVault, kT as listMagicLinkGrants, kU as listUsers, kV as listUsersWithEnvelopes, kW as listWithdrawalRequests, kX as loadActiveDelegations, kY as loadPaperRecoveryEntries, kZ as loadSealedPassphrase, k_ as loadShamirRecoveryEntries, k$ as lookup, l0 as magicLinkGrantRecordId, at as max, N as memoryObjectProjection, aK as mergeCrdtStates, au as min, l1 as mintPaperRecoveryEntry, l2 as mintShamirRecoveryEntry, l3 as mintWrappedDeksBlob, l4 as money, av as moneyMax, aw as moneyMin, l5 as moneyNumber, ax as moneySum, l6 as parseRsaOaepTlv, l7 as parseSealedEnvelope, l8 as readMagicLinkGrantRecord, l9 as readPath, la as recoverUser, ay as reduceRecords, az as reducerBuilder, lb as ref, lc as refArray, ld as rejectWithdrawal, le as removeAuthenticator, lf as requestWithdrawal, lg as resetJoinWarnings, aL as resolveCrdtSnapshot, cT as resolveI18nText, cU as resolvePolicy, lh as resolvePublicEnvelopeSchema, li as resolveSequenceKey, lj as revokeDelegation, lk as revokeMagicLinkGrant, ll as runTransaction, lm as savePaperRecoveryEntries, ln as saveSealedPassphrase, lo as saveShamirRecoveryEntries, lp as sealRsaOaepTlv, cV as staticDict, aB as sum, lq as unwrapDeksFromBlob, lr as unwrapDeksFromPaperEntry, ls as unwrapDeksFromShamirEntry, lt as unwrapMagicLinkGrant, cX as validateI18nTextValue, lu as validatePassphrase, lv as validatePublicEnvelopeInput, lw as validateSchemaInput, lx as validateSchemaOutput, v as validateSessionPolicy, ly as via, lz as withArchive, lA as withDeferredNumbering, lB as withdrawAccessibleData, lC as writeMagicLinkGrant } from './index-DjWbxsjb.js';
3
+ export { I as ImportExternalOptions, a as ImportExternalResult, b as ImportableCollection, d as detectMagic, c as detectMimeType, i as importExternalObjects, e as isPreCompressed } from './mime-magic-bBj5OgUC.js';
4
+ export { WrapBundleStoreOptions, WrapPodStoreOptions, WrappedBundleNoydbStore, WrappedPodNoydbStore, createBundleStore, createPodStore, wrapBundleStore, wrapPodStore } from './pod/index.js';
5
+ export { W as WriteEvent, a as WriteHook } from './index-B9QdHytu.js';
6
+ export { D as DEED_RECORD_ID, a as DeedMarker, F as FuseOptions, S as STATE_VAULT_NAME, U as USER_ENVELOPE_COLLECTION, b as USER_ENVELOPE_MAX_BYTES, c as createDeedOwner, f as fuseRetrieval, i as isDeedVault, l as loadDeedMarker, w as withCargo } from './index-qwuNvO2B.js';
7
+ export { A as AutoCredential, q as AutoCredentialKind, d as CompressionAlgo, f as NOYDB_BUNDLE_FORMAT_VERSION, g as NOYDB_BUNDLE_MAGIC, h as NOYDB_BUNDLE_PREFIX_BYTES, i as NoydbBundleHeader, j as NoydbBundleReadResult, N as NoydbPodHeader, R as ReadNoydbBundleOptions, k as WriteNoydbBundleOptions, W as WritePodOptions, s as hasNoydbBundleMagic, m as readNoydbBundle, n as readNoydbBundleHeader, t as readNoydbBundlePublicEnvelope, r as readPod, a as readPodHeader, o as resetBrotliSupportCache, p as writeNoydbBundle, w as writePod } from './bundle-D6GxiUfq.js';
8
+ export { g as generateULID, i as isULID } from './ulid-DRH25k3y.js';
9
+ export { D as DecryptedRecord, d as decryptExtractedPartition } from './decrypt-partition-IHtxEnTi.js';
10
+ export { L as LedgerEntry, d as canonicalJson, h as hashEntry, p as paddedIndex, e as parseIndex, s as sha256Hex } from './subject-index-CyOgGMJL.js';
11
+ export { SYNC_CREDENTIALS_COLLECTION, SyncCredential, credentialStatus, deleteCredential, getCredential, listCredentials, putCredential, withTeam } from './team/index.js';
12
+ export { withLazy } from './lazy/index.js';
13
+ export { TransactionStrategyOptions } from './tx/index.js';
14
+ export { I as ImmutableGuardConfig, T as TransitionGuardConfig, i as immutableGuard, t as transitionGuard, w as withGuard } from './transition-guard-DI-krBsZ.js';
15
+ export { w as withDerivation, a as withRollup } from './with-rollup-DEKGI9vb.js';
16
+ export { w as withMaterializedView } from './with-materialized-view-BUmzlXue.js';
17
+ export { w as withOverlayedView } from './with-overlayed-view-m4FaXXTO.js';
18
+ export { C as ClassifiedNeverStoredError, a as ClassifiedValidationError, c as classified, l as luhnCheck, r as resolveClassifiedFields } from './validators-BUcli5Nh.js';
19
+ export { C as CreateSessionOptions, a as CreateSessionResult, D as DevUnlockOptions, S as SessionToken, b as activeSessionCount, c as clearDevUnlock, d as createSession, e as enableDevUnlock, i as isDevUnlockActive, f as isSessionAlive, l as loadDevUnlock, r as resolveSession, g as revokeAllSessions, h as revokeSession } from './dev-unlock-Bmm2pgJ0.js';
20
+ export { i as isDiscriminant } from './discriminant-BN9REW3o.js';
21
+ export { D as DiffCandidate, a as DiffOptions, V as VaultDiff, b as VaultDiffEntry, c as VaultDiffModifiedEntry, d as diffVault } from './vault-diff-Z2DUayMe.js';
22
+ export { L as LEDGER_COLLECTION, a as LEDGER_DELTAS_COLLECTION, e as envelopePayloadHash } from './hash-DAJjMsCE.js';
19
23
  import '@noy-db/attestation';
20
24
 
21
- /**
22
- * Persistence helpers for per-principal user envelopes stored at
23
- * `_users/<keyringId>` (logically: `_meta/user/<keyringId>`).
24
- *
25
- * Unlike `_meta/policy` and `_meta/handle` which are plaintext, user
26
- * envelopes carry user data and are encrypted with a dedicated
27
- * {@link USER_ENVELOPE_COLLECTION} DEK (provisioned at vault open and
28
- * propagated to every keyring via the system-collection DEK path in
29
- * `team/keyring.ts`).
30
- *
31
- * This module is the **storage primitive** layer. The public API
32
- * (`vault.user.*`) sits on top of this; permission gates, own-only
33
- * write enforcement, and presence-channel propagation live there.
34
- *
35
- * @see docs/superpowers/specs/2026-05-05-user-envelope-design.md
36
- *
37
- * @module
38
- */
39
-
40
- /**
41
- * Read and decrypt the user envelope for `keyringId`. Returns `null`
42
- * when no envelope has been persisted (either the principal has never
43
- * called `updateMe`, or the keyring predates this feature).
44
- *
45
- * Decryption errors propagate — a tampered or wrong-keyed envelope
46
- * surfaces as the underlying crypto error rather than masquerading as
47
- * "not found".
48
- */
49
- declare function loadUserEnvelope<T = unknown>(store: NoydbStore, vault: string, keyringId: string, dek: CryptoKey): Promise<UserEnvelope<T> | null>;
50
- /**
51
- * Encrypt and persist the user envelope for `keyringId`. The new
52
- * version is `(prior._v ?? 0) + 1`. Pass `expectedVersion` to enable
53
- * optimistic-concurrency checks: a mismatch with the stored version
54
- * throws {@link ConflictError} with the actual stored version.
55
- *
56
- * `expectedVersion: 0` means "expect no prior envelope"; the write
57
- * succeeds only if no envelope exists yet.
58
- *
59
- * Soft-caps the JSON-serialized payload at {@link USER_ENVELOPE_MAX_BYTES};
60
- * larger payloads throw {@link UserEnvelopeOversizedError}.
61
- */
62
- declare function saveUserEnvelope<T>(store: NoydbStore, vault: string, keyringId: string, payload: T, dek: CryptoKey, expectedVersion?: number): Promise<UserEnvelope<T>>;
63
- /**
64
- * Delete the user envelope for `keyringId`. Idempotent — no error if
65
- * the envelope is already absent. Called from the keyring revoke path
66
- * (cascade-delete) and is a no-op for keyrings that never wrote.
67
- */
68
- declare function deleteUserEnvelope(store: NoydbStore, vault: string, keyringId: string): Promise<void>;
69
- /**
70
- * List the keyring ids that have a user envelope persisted in `vault`.
71
- * Order is store-defined — callers that need a stable order should sort.
72
- */
73
- declare function listUserEnvelopeIds(store: NoydbStore, vault: string): Promise<string[]>;
74
-
75
25
  /**
76
26
  * Cache policy helpers — parse human-friendly byte budgets into raw numbers.
77
27
  *
@@ -106,340 +56,1057 @@ declare function parseBytes(input: number | string): number;
106
56
  declare function estimateRecordBytes(record: unknown): number;
107
57
 
108
58
  /**
109
- * Persistence helpers for `_meta/public-envelope`. Mirrors the
110
- * bypass-AES pattern used by `_meta/handle` and `_meta/policy` —
111
- * the document is plaintext JSON, the envelope's `_iv` field is
112
- * left empty.
59
+ * Default text tokenizer for scan-mode search.
60
+ *
61
+ * NFKC-normalize → lowercase → split on Unicode letter/number runs. This is a
62
+ * word-boundary tokenizer: it does **not** segment scripts written without
63
+ * inter-word spaces (Thai, Lao, Khmer, CJK) — those collapse to one token per
64
+ * run. For such data, a dictionary/ICU segmenter is the right `tokenizer`
65
+ * (the engine takes one as a parameter); substring/`contains` matching is the
66
+ * pragmatic fallback until then.
67
+ */
68
+ type Tokenizer = (text: string) => string[];
69
+ declare const tokenize: Tokenizer;
70
+
71
+ /**
72
+ * Enable the search / retrieval capability.
73
+ * Pass to `createNoydb({ searchStrategy: withSearch() })` to make a collection's
74
+ * `search` / `retrieve` / `similarTo` / `warmIndex` / `flushIndex` methods live,
75
+ * and to enable the put()-time embedding-vector compute for collections that
76
+ * declare an `embeddings` config. The search/retrieval engine is dynamically
77
+ * imported here, so it stays out of the floor bundle until opted in.
78
+ */
79
+
80
+ declare function withSearch(): SearchStrategy;
81
+
82
+ /**
83
+ * Enable the atomic-sequence capability.
84
+ * Pass to `createNoydb({ sequenceStrategy: withSequence() })` to make
85
+ * `vault.sequence('name').next()` / `.peek()` / `.seedTo()` live. The
86
+ * {@link SequenceStore} CAS engine is statically imported here, so it is pulled
87
+ * into the bundle only when `withSequence()` is referenced (the floor never
88
+ * imports it).
89
+ */
90
+
91
+ declare function withSequence(): SequenceStrategy;
92
+
93
+ /**
94
+ * computed() — the declaration factory for a field whose value is DERIVED
95
+ * from other fields on the same record (#638 Task 7, spec §6). Composes
96
+ * with `via()` (the locked grammar since phase A: `via(computed(fn, { deps,
97
+ * mode }), money('EUR'))`), grouped by `_viaBrand` like every other via
98
+ * feature (`kernel/via/compose.ts#mergeViaFields`).
99
+ *
100
+ * `mode` picks where the function runs:
101
+ * - `'materialized'` (default) — TODAY's stage-5 write-time eager compute
102
+ * (`with-formula/computed/index.ts#evalComputedFields`), stored like any
103
+ * other field. Byte-for-byte the existing `computed: { field: fn }` sugar.
104
+ * - `'virtual'` — rides the `present` read phase (the money-`Formatted`/
105
+ * i18n-`Label` precedent, seam map Part 4): computed fresh on every
106
+ * read, NEVER stored, `queryable: 'none'`, excluded from export unless
107
+ * its declared `deps` permit (identical taint rule to materialized —
108
+ * see `via/computed/binding.ts`).
109
+ *
110
+ * `deps` names the OTHER fields `fn` reads — feeds `ViaGraph` (Task 1/2) so
111
+ * a source's taint (e.g. a classified field) propagates to this derived
112
+ * field. A depsless entry is fine UNLESS the collection also declares
113
+ * classified fields (`kernel/collection-config.ts#resolveComputedEdges`
114
+ * refuses it — closes the #636 opaque-function leak).
115
+ */
116
+
117
+ interface ComputedDescriptor extends ViaDescriptor {
118
+ readonly _viaBrand: 'computed';
119
+ readonly fn: (record: Record<string, unknown>) => unknown;
120
+ readonly deps?: readonly string[];
121
+ readonly mode: 'materialized' | 'virtual';
122
+ }
123
+ declare function computed(fn: (record: Record<string, unknown>) => unknown, opts?: {
124
+ readonly deps?: readonly string[];
125
+ readonly mode?: 'materialized' | 'virtual';
126
+ }): ComputedDescriptor;
127
+ declare function isComputedDescriptor(x: unknown): x is ComputedDescriptor;
128
+
129
+ /**
130
+ * Enable the sovereign-custody (FR-6) capability.
131
+ * Pass to `createNoydb({ custodyStrategy: withCustody() })` to make
132
+ * `db.grantCustodian` / `db.revokeCustodian` (and the `vault.custody.*` facade
133
+ * that delegates to them) plus `vault.custody.liberate()` live. The heavy
134
+ * `liberateVault` ceremony is dynamically imported here, so it is reached only
135
+ * via opt-in; grant/revoke run the host's own gate + keyring engine.
136
+ */
137
+
138
+ declare function withCustody(): CustodyStrategy;
139
+
140
+ /**
141
+ * Helpers for reading records out of a *plaintext* store (`encrypt: false`)
142
+ * with native tooling — the programmatic core of a `noydb cat`-style unwrap.
143
+ * See the plaintext/debug-store-mode design.
144
+ */
145
+
146
+ /**
147
+ * Extract the record from a plaintext stored envelope, handling both layouts:
148
+ *
149
+ * - **classic plaintext** (`encrypt: false`): the record is JSON in `_data`.
150
+ * - **debugPlaintext**: the record's fields are inlined beside the
151
+ * `_`-prefixed metadata (marked by `_debug`).
113
152
  *
153
+ * Returns `null` for an empty/absent body. Throws if handed an **encrypted**
154
+ * envelope (non-empty `_iv`) — there is no key here; decrypt through the vault
155
+ * instead. Intended for record envelopes, not blob chunks.
156
+ *
157
+ * @example
158
+ * ```ts
159
+ * // node script over a to-file store, no vault needed:
160
+ * const env = JSON.parse(readFileSync('data/acme/invoices/inv-1.json', 'utf8'))
161
+ * console.log(readPlaintextRecord(env)) // → { id: 'inv-1', total: '120.00', … }
162
+ * ```
163
+ */
164
+ declare function readPlaintextRecord<T = Record<string, unknown>>(envelope: EncryptedEnvelope): T | null;
165
+
166
+ /**
167
+ * `applyListProjection` — the ONE vetted read-projection for lists/exports.
168
+ * Replaces classified field values with their declared projection (omit /
169
+ * mask / rider) so no consumer re-implements redaction. Pure, non-mutating.
170
+ * Consumed by as-* exporters (#489) and available to any list renderer.
114
171
  * @module
115
172
  */
116
173
 
117
- /** Reserved id for the vault-level public envelope record. */
118
- declare const PUBLIC_ENVELOPE_RECORD_ID = "public-envelope";
174
+ interface ListProjectionOptions {
175
+ /** Also handle fields carrying only a plain sensitivity tag (pii/secret). */
176
+ readonly sensitivity?: 'omit' | 'mask';
177
+ }
178
+ declare function applyListProjection(desc: CollectionDescription, record: Record<string, unknown>, opts?: ListProjectionOptions): Record<string, unknown>;
179
+
180
+ /** Allow any schema change. Explicit blind / back-compat. */
181
+ declare function blindUpdate(): SchemaUpdateStrategy;
182
+ /** Allow additive changes; reject non-additive ones. The safety backstop. */
183
+ declare function additiveOnly(): SchemaUpdateStrategy;
119
184
  /**
120
- * Read the public envelope from `_meta/public-envelope`. Returns
121
- * `undefined` when no envelope has been persisted (fresh vault, or
122
- * a vault written before the feature was enabled). Tolerates
123
- * corrupted documents — a JSON parse failure surfaces as `undefined`,
124
- * not a thrown error, mirroring `_meta/handle`'s contract.
185
+ * Reject schema changes. With `fields`, reject only when one of those
186
+ * fields is added/removed/changed; otherwise reject any non-`none` delta.
125
187
  */
126
- declare function loadPublicEnvelope(store: NoydbStore, vault: string): Promise<PublicEnvelope | undefined>;
127
- /** Persist the public envelope. Idempotent — overwrites any prior write. */
128
- declare function savePublicEnvelope(store: NoydbStore, vault: string, envelope: PublicEnvelope): Promise<void>;
188
+ declare function lockSchema(opts?: {
189
+ readonly fields?: readonly string[];
190
+ }): SchemaUpdateStrategy;
191
+
192
+ /** The coordinatedCutover update strategy (single-step — no from/to). */
193
+
194
+ declare function coordinatedCutover(opts: {
195
+ readonly transform: TransformFn;
196
+ }): SchemaUpdateStrategy;
197
+
129
198
  /**
130
- * Public, no-key reader. Plain function, not a method on `Noydb` —
131
- * the whole point is it works without an authenticated session, so
132
- * a UI can show "Acme 2026 Tax Records" before unlocking.
199
+ * Built-in in-memory store — the kernel's zero-config default.
133
200
  *
134
- * Resolves any `name` / `description` locale map through the supplied
135
- * `locale` (when provided). Omitting `locale` returns the raw
136
- * envelope, which a multilingual picker can render as it pleases.
201
+ * Nested `Map`s: `vault → collection → id → envelope`. Non-persistent
202
+ * (data is lost on process exit). A conformant 6-method {@link NoydbStore}
203
+ * with CAS atomicity and a monotonic store clock — the kernel version of
204
+ * `@noy-db/to-memory`'s core, so `createNoydb()` works with no store package.
205
+ *
206
+ * Portable: imports only `types` + `errors` (no crypto primitive) — passes
207
+ * the `stores-ciphertext-only` architecture guard.
208
+ *
209
+ * Implements the 6-method core only (no optional `listVaults`/`ping`/`tx`),
210
+ * so `Noydb.listAccessibleVaults()` throws its documented capability error
211
+ * rather than enumerating vaults under the default store.
137
212
  */
138
- declare function readPublicEnvelope(store: NoydbStore, vault: string, opts?: {
139
- readonly locale?: string;
140
- }): Promise<PublicEnvelope | undefined>;
213
+ declare function memoryStore(): NoydbStore;
141
214
 
142
215
  /**
143
- * Why a gate denied a request. Stable across hub versions so consumers
144
- * can switch on the value in error UIs.
216
+ * Store router / multiplexer.
217
+ *
218
+ * Dispatches `NoydbStore` operations to different backends based on
219
+ * collection type, record size, record age, collection name, or vault name.
220
+ *
221
+ * ```ts
222
+ * const db = await createNoydb({
223
+ * store: routeStore({
224
+ * default: dynamo({ table: 'myapp' }),
225
+ * blobs: s3Store({ bucket: 'myapp-blobs' }),
226
+ * }),
227
+ * })
228
+ * ```
229
+ *
230
+ * @module
145
231
  */
146
- type PolicyDenyReason = 'insufficient-tier' | 'missing-factor' | 'stale-proof' | 'disabled' | 'shared-device-blocked';
232
+
147
233
  /**
148
- * Thrown by {@link checkGate} when the active session does not meet
149
- * the gate's requirements. Carries the gate name, the reason, and the
150
- * full required {@link GatePolicy} so error UIs can prompt the user
151
- * for the missing factor without re-reading the policy document.
234
+ * Size-tiered blob routing configuration.
235
+ *
236
+ * Routes blob chunks to different stores based on byte size. Small blobs
237
+ * (under `threshold`) stay in the primary or `small` store; large blobs
238
+ * go to `large`. This lets you keep DynamoDB as the default while sending
239
+ * large binary objects to S3.
152
240
  */
153
- declare class PolicyDeniedError extends NoydbError {
154
- readonly gate: GateName;
155
- readonly reason: PolicyDenyReason;
156
- readonly required: GatePolicy;
157
- constructor(gate: GateName, reason: PolicyDenyReason, required: GatePolicy, message?: string);
241
+ interface BlobStoreRoute {
242
+ /** Store for small blobs (under threshold). Falls back to `default`. */
243
+ readonly small?: NoydbStore;
244
+ /** Store for large blobs (over threshold). */
245
+ readonly large: NoydbStore;
246
+ /** Size threshold in bytes. Default: `400 * 1024` (DynamoDB item limit). */
247
+ readonly threshold?: number;
158
248
  }
159
249
  /**
160
- * Raised by `createNoydb({ ... })` when the developer omits a recovery
161
- * profile and `recover-passphrase` is not explicitly disabled. Vaults
162
- * MUST have at least one recovery path enrolled before being
163
- * production-ready (paper, shamir, multi-channel, or admin-mediated).
250
+ * Blob lifecycle management policies evaluated during `compact()`.
164
251
  *
165
- * The error message carries a pointer to the recovery design docs.
252
+ * Controls orphan cleanup, cold-tier archival, and hard deletion of
253
+ * blobs that are no longer referenced by any record.
166
254
  */
167
- declare class RecoveryNotEnrolledError extends NoydbError {
168
- constructor(message?: string);
255
+ interface BlobLifecyclePolicy {
256
+ /** Delete orphan blobs (refCount: 0) after this many days. Default: 7. */
257
+ readonly orphanRetentionDays?: number;
258
+ /** Move blobs not accessed in this many days to the cold blob store. */
259
+ readonly archiveAfterDays?: number;
260
+ /** Store for archived blobs. Required if archiveAfterDays is set. */
261
+ readonly archiveStore?: NoydbStore;
262
+ /** Hard-delete archived blobs after this many days. */
263
+ readonly expireAfterDays?: number;
169
264
  }
170
265
  /**
171
- * Raised by `openVault` when a managed-passphrase-mode vault has no
172
- * STRONG recovery profile enrolled.
266
+ * Age-based hot/cold tiering configuration.
173
267
  *
174
- * Managed mode means the user never types a passphrase — the unlock
175
- * material lives in a `SealingKeyProvider` (`at-*` package). If that
176
- * provider's key is lost AND no strong recovery is enrolled, the
177
- * vault is irrecoverable. To prevent that footgun, managed-mode vaults
178
- * require at least one strong recovery profile (Shamir today;
179
- * multi-channel / admin-mediated when those ship).
180
- *
181
- * Paper recovery alone is NOT strong under managed mode: the user has
182
- * no memorized passphrase to fall back on, so losing the paper sheet =
183
- * losing every record permanently.
268
+ * Records whose `_ts` timestamp is older than `coldAfterDays` are migrated
269
+ * to the `cold` store during `compact()`. Reads transparently fall through
270
+ * to the cold store when the hot store returns null, so callers don't need
271
+ * to know which tier a record lives in.
272
+ */
273
+ interface AgeRoute {
274
+ /** Store for records older than the cutoff. */
275
+ readonly cold: NoydbStore;
276
+ /**
277
+ * Days after last modification before a record is cold-eligible for the
278
+ * ROLLING `compact(vault)` migrator. Omit for period-driven archival only
279
+ * (`compact(vault, { before })`), where the cutoff is supplied per call.
280
+ */
281
+ readonly coldAfterDays?: number;
282
+ /**
283
+ * Collections that participate in age tiering.
284
+ * Empty array or omitted = all user collections (excluding `_` prefixed).
285
+ */
286
+ readonly collections?: string[];
287
+ }
288
+ /**
289
+ * Options for `routeStore()` — the store multiplexer.
184
290
  *
185
- * Bootstrap with `db.openVaultAndEnrollRecovery(vault, { recovery: [{ profile: "shamir", k, n }] })`
186
- * to atomically create-and-enroll, or call `db.enrollRecovery(vault, { profile: "shamir", ... })`
187
- * separately before re-attempting `openVault`.
291
+ * At minimum, provide a `default` store. All other fields are optional
292
+ * extensions for specific routing scenarios (blobs → S3, geographic sharding,
293
+ * age-based tiering, etc.).
188
294
  */
189
- declare class ManagedRecoveryNotEnrolledError extends NoydbError {
190
- readonly vault: string;
191
- constructor(vault: string);
295
+ interface RouteStoreOptions {
296
+ /** Default store for all unmatched operations. */
297
+ readonly default: NoydbStore;
298
+ /**
299
+ * Route blob chunk data to a separate store.
300
+ * - Pass a `NoydbStore` for simple prefix routing (all chunks → that store).
301
+ * - Pass `{ small?, large, threshold? }` for size-tiered routing.
302
+ */
303
+ readonly blobs?: NoydbStore | BlobStoreRoute;
304
+ /** Route all blob metadata (index, slots, versions) to the blobs store too. Default: false. */
305
+ readonly routeBlobMeta?: boolean;
306
+ /** Route specific user collections to dedicated stores. */
307
+ readonly routes?: Record<string, NoydbStore>;
308
+ /** Route by vault name (prefix patterns, e.g. `'EU-'`). */
309
+ readonly vaultRoutes?: Record<string, NoydbStore>;
310
+ /**
311
+ * Age-based tiering: records older than `coldAfterDays` are read from
312
+ * the cold store. A background `compact()` method migrates them.
313
+ */
314
+ readonly age?: AgeRoute;
315
+ /**
316
+ * Content-aware blob routing.
317
+ * Route blob chunks by MIME type glob pattern. The MIME type is stored
318
+ * in `BlobObject` and matched at read time via `storeHint`.
319
+ */
320
+ readonly blobRoutes?: Record<string, NoydbStore>;
321
+ /**
322
+ * Blob lifecycle policies.
323
+ * Evaluated during `compact()`.
324
+ */
325
+ readonly blobLifecycle?: BlobLifecyclePolicy;
326
+ /**
327
+ * Quota-aware overflow.
328
+ * When the default store's usage exceeds the threshold, new writes
329
+ * overflow to the specified store.
330
+ */
331
+ readonly overflow?: NoydbStore;
332
+ /**
333
+ * Quota threshold (0-1). Default: 0.8 (overflow at 80% usage).
334
+ * Only effective when `overflow` is set.
335
+ */
336
+ readonly quotaThreshold?: number;
192
337
  }
193
338
  /**
194
- * Raised by `db.recoverPassphrase` / `db.enrollRecovery` /
195
- * `db.rotateRecovery` when the developer requests a recovery profile
196
- * not yet wired in this hub release.
339
+ * Named route that can be overridden or suspended at runtime.
197
340
  *
198
- * Implemented: `paper` and `shamir`.
199
- * Pending: `multi-channel` and `admin-mediated` (follow-up slices).
341
+ * Built-in names: `'default'`, `'blobs'`, `'cold'`.
342
+ * Custom names: any collection name from `routes`, any vault prefix from
343
+ * `vaultRoutes`, or any sync target label.
344
+ */
345
+ type OverrideTarget = 'default' | 'blobs' | 'cold' | (string & {});
346
+ /**
347
+ * Options for `RoutedNoydbStore.override()`.
200
348
  *
201
- * The carried `profile` and `tracking` fields let consumers steer the
202
- * UI ("multi-channel recovery is not yet wired up — open issue #N to follow").
349
+ * Controls whether the new store is pre-populated with data from the
350
+ * original store before the switch takes effect.
203
351
  */
204
- declare class RecoveryProfileNotImplementedError extends NoydbError {
205
- readonly profile: string;
206
- readonly tracking: string;
207
- constructor(profile: string, tracking: string);
352
+ interface OverrideOptions {
353
+ /**
354
+ * Hydrate the override store from the original before activating.
355
+ * - `true` — copy all data for all vaults.
356
+ * - `string[]` — copy only named collections.
357
+ * Makes `override()` async — returns a Promise.
358
+ */
359
+ hydrate?: boolean | string[];
208
360
  }
209
-
210
361
  /**
211
- * Default policy for personal vaults and SMB deployments — the gates
212
- * that need an off-device factor get one (TOTP / email-OTP / paper
213
- * recovery), the rest take a tier-1 unlock alone. Tier-3 (PIN) is the
214
- * floor only for `rotate-unlock` because that's the
215
- * "change my PIN" flow.
362
+ * Options for `RoutedNoydbStore.suspend()`.
216
363
  *
217
- * The unspecified gates (e.g. `view-user-auth`) inherit the engine
218
- * default of `{ enabled: false, minTier: 1 }` — they fail closed.
219
- *
220
- * @see docs/subsystems/session-tiers.md → Built-in gates
364
+ * A suspended route becomes a null store: reads return null/[], writes
365
+ * are dropped (or buffered if `queue: true`). Useful for maintenance
366
+ * windows or restricted-network scenarios.
221
367
  */
222
- declare const PERSONAL_POLICY: VaultPolicy;
368
+ interface SuspendOptions {
369
+ /**
370
+ * Buffer write operations during suspension. On `resume()`, queued
371
+ * writes are replayed against the restored store.
372
+ */
373
+ queue?: boolean;
374
+ /**
375
+ * Maximum queued operations. When exceeded, oldest entries are dropped.
376
+ * Default: 10_000.
377
+ */
378
+ maxQueueSize?: number;
379
+ }
223
380
  /**
224
- * Strict policy for regulated deployments and shared workstations —
225
- * raises the phrase floor to 8 words, demands two distinct factors for
226
- * exports, and blocks export-on-shared-device. Use as a base for
227
- * `policy: { ...STRICT_POLICY, gates: { ...STRICT_POLICY.gates, ... } }`
228
- * tweaks.
381
+ * Snapshot of the current override and suspend state of a `RoutedNoydbStore`.
382
+ * Returned by `routeStatus()` for diagnostics and health dashboards.
229
383
  */
230
- declare const STRICT_POLICY: VaultPolicy;
384
+ interface RouteStatus {
385
+ /** Active overrides: route name → override store name. */
386
+ readonly overrides: Record<string, string>;
387
+ /** Currently suspended routes. */
388
+ readonly suspended: string[];
389
+ /** Queued writes per suspended route (only for routes suspended with `queue: true`). */
390
+ readonly queued: Record<string, number>;
391
+ }
231
392
  /**
232
- * Merge a developer override onto a preset. Unspecified gates inherit;
233
- * specified gates fully replace the preset's entry for that gate.
393
+ * Extended `NoydbStore` returned by `routeStore()`.
234
394
  *
235
- * Example:
395
+ * Satisfies the full `NoydbStore` contract plus adds runtime control
396
+ * methods for overriding, suspending, and inspecting routes.
397
+ */
398
+ interface RoutedNoydbStore extends NoydbStore {
399
+ /**
400
+ * Migrate records to the cold store. Only applies when `age.cold` is
401
+ * configured. With `{ before }`, migrates records whose `_ts < before`
402
+ * (period-driven archival); without, uses the rolling `coldAfterDays`.
403
+ * Returns the number of records migrated.
404
+ */
405
+ compact(vault: string, opts?: {
406
+ before?: string;
407
+ }): Promise<number>;
408
+ /**
409
+ * Override a named route at runtime.
410
+ *
411
+ * The override persists until `clearOverride()` is called or the
412
+ * instance is closed. In-flight operations complete on the original
413
+ * store; new operations use the override.
414
+ *
415
+ * Options:
416
+ * - `hydrate: true` — async: copies all data from the original store
417
+ * into the override before activating the switch.
418
+ * - `hydrate: ['invoices', 'clients']` — copies only named collections.
419
+ *
420
+ * Use cases:
421
+ * - Shared device: `await store.override('default', memory(), { hydrate: true })`
422
+ * - Restricted network: `store.override('blobs', localFile(...))`
423
+ */
424
+ override(route: OverrideTarget, store: NoydbStore, opts?: OverrideOptions): void | Promise<void>;
425
+ /** Clear a runtime override, reverting to the original store. */
426
+ clearOverride(route: OverrideTarget): void;
427
+ /**
428
+ * Suspend a route entirely. Operations to suspended stores become
429
+ * no-ops (puts silently dropped, gets return null, lists return []).
430
+ *
431
+ * Options:
432
+ * - `queue: true` — buffer write operations (put/delete) during
433
+ * suspension. When `resume()` is called, queued writes are replayed
434
+ * against the restored store.
435
+ *
436
+ * Returns a `SuspendHandle` when `queue: true`, for inspecting queue state.
437
+ */
438
+ suspend(route: OverrideTarget, opts?: SuspendOptions): void;
439
+ /**
440
+ * Resume a previously suspended route.
441
+ * If the route was suspended with `queue: true`, replays queued writes.
442
+ * Returns the number of replayed operations.
443
+ */
444
+ resume(route: OverrideTarget): Promise<number>;
445
+ /** Snapshot the current override/suspend state for diagnostics. */
446
+ routeStatus(): RouteStatus;
447
+ /**
448
+ * Resolve the physical backend a vault id maps to via the geographic
449
+ * `vaultRoutes` prefix routing (collection-independent), falling back to
450
+ * the `default` store. Used by the federation data-residency guard
451
+ * to read the placement backend's `capabilities.region`.
452
+ */
453
+ resolveBackend(vaultId: string): NoydbStore;
454
+ }
455
+ /**
456
+ * Create a store multiplexer that dispatches operations to different backends
457
+ * based on collection type, record size, record age, vault prefix, or
458
+ * runtime overrides.
236
459
  *
237
460
  * ```ts
238
- * mergePolicy(PERSONAL_POLICY, {
239
- * gates: {
240
- * 'app:approve-large-payment': { minTier: 2, factors: [{ anyOf: ['totp'] }] },
241
- * },
461
+ * const store = routeStore({
462
+ * default: dynamo({ table: 'myapp' }),
463
+ * blobs: s3({ bucket: 'myapp-blobs' }),
464
+ * routes: { auditLog: s3({ bucket: 'myapp-audit' }) },
242
465
  * })
243
- * // → PERSONAL_POLICY plus the new app gate; existing gates intact.
244
466
  * ```
467
+ *
468
+ * The returned store satisfies `NoydbStore` and can be passed directly to
469
+ * `createNoydb({ store })`. It also exposes additional methods
470
+ * (`override`, `suspend`, `resume`, `routeStatus`, `compact`) for runtime
471
+ * control and maintenance.
245
472
  */
246
- declare function mergePolicy(base: VaultPolicy, override?: Partial<VaultPolicy>): VaultPolicy;
473
+ declare function routeStore(opts: RouteStoreOptions): RoutedNoydbStore;
247
474
 
248
475
  /**
249
- * Policy gate engine — the {@link checkGate} entry point.
476
+ * Store middleware — composable interceptors for NoydbStore.
250
477
  *
251
- * Given a configured {@link VaultPolicy}, an active session tier, and
252
- * the factor proofs an actor is presenting, decide whether the gate
253
- * permits the action. On denial, throws {@link PolicyDeniedError} with
254
- * a stable {@link PolicyDenyReason} so consumers can branch in error
255
- * UIs.
478
+ * ```ts
479
+ * const resilient = wrapStore(
480
+ * dynamo({ table: 'myapp' }),
481
+ * withRetry({ maxRetries: 3 }),
482
+ * withLogging({ level: 'debug' }),
483
+ * withCache({ ttlMs: 60_000 }),
484
+ * )
485
+ * ```
256
486
  *
257
- * @see docs/subsystems/session-tiers.md → checkGate() API
487
+ * Each middleware is `(next: NoydbStore) => NoydbStore`. They compose
488
+ * left-to-right: first middleware is outermost (processes requests first,
489
+ * responses last).
258
490
  *
259
491
  * @module
260
492
  */
261
493
 
262
- /** Default freshness window — 5 minutes. */
263
- declare const DEFAULT_FRESHNESS_MS: number;
264
- /** Caller-supplied context for one `checkGate` invocation. */
265
- interface CheckGateContext {
266
- /** Tier the active session currently holds. */
267
- readonly activeTier: ActiveTier;
268
- /** Proofs the actor is presenting for this gate. */
269
- readonly factors?: ReadonlyArray<FactorProof>;
270
- /**
271
- * If the host knows the actor is on a shared device, set this to
272
- * `true` so the engine can apply `warn.sharedDevice` rules. Defaults
273
- * to `false`.
274
- */
275
- readonly sharedDevice?: boolean;
494
+ /**
495
+ * A store middleware function.
496
+ *
497
+ * Takes the next store in the chain and returns a wrapped store. Middlewares
498
+ * compose left-to-right via `wrapStore()`: the first argument is outermost
499
+ * (first to intercept requests, last to process responses).
500
+ *
501
+ * ```ts
502
+ * const mw: StoreMiddleware = (next) => ({
503
+ * ...next,
504
+ * async get(vault, collection, id) {
505
+ * console.log('get', id)
506
+ * return next.get(vault, collection, id)
507
+ * },
508
+ * })
509
+ * ```
510
+ */
511
+ type StoreMiddleware = (next: NoydbStore) => NoydbStore;
512
+ /**
513
+ * Wrap a store with one or more middlewares. Middlewares compose left-to-right.
514
+ */
515
+ declare function wrapStore(store: NoydbStore, ...middlewares: StoreMiddleware[]): NoydbStore;
516
+ /** Options for `withRetry()`. */
517
+ interface RetryOptions {
518
+ /** Maximum retry attempts. Default: 3. */
519
+ maxRetries?: number;
520
+ /** Base backoff delay in ms. Default: 500. */
521
+ backoffMs?: number;
522
+ /** Jitter factor (0-1). Adds random delay up to `backoffMs * jitter`. Default: 0.3. */
523
+ jitter?: number;
524
+ /** Only retry on these error codes. Default: retry all errors. */
525
+ retryOn?: string[];
526
+ }
527
+ /**
528
+ * Middleware that retries failed store operations with exponential backoff
529
+ * and optional jitter. Useful for transient network errors on DynamoDB/S3.
530
+ *
531
+ * ```ts
532
+ * wrapStore(dynamo({ table: 'myapp' }), withRetry({ maxRetries: 5, retryOn: ['NETWORK_ERROR'] }))
533
+ * ```
534
+ */
535
+ declare function withRetry(opts?: RetryOptions): StoreMiddleware;
536
+ /** Log level for `withLogging()`. Maps to standard console method names. */
537
+ type LogLevel = 'debug' | 'info' | 'warn' | 'error';
538
+ /** Options for `withLogging()`. */
539
+ interface LoggingOptions {
540
+ /** Minimum log level. Default: 'info'. */
541
+ level?: LogLevel;
542
+ /** Custom logger. Default: console. */
543
+ logger?: {
544
+ debug(msg: string, ...args: unknown[]): void;
545
+ info(msg: string, ...args: unknown[]): void;
546
+ warn(msg: string, ...args: unknown[]): void;
547
+ error(msg: string, ...args: unknown[]): void;
548
+ };
549
+ /** Log the data payload (envelope contents). Default: false (privacy). */
550
+ logData?: boolean;
551
+ }
552
+ /**
553
+ * Middleware that logs every store operation with its method name, arguments,
554
+ * and elapsed duration. Privacy-safe by default: envelope payloads are not
555
+ * logged unless `logData: true` is set.
556
+ */
557
+ declare function withLogging(opts?: LoggingOptions): StoreMiddleware;
558
+ /**
559
+ * Data emitted to `MetricsOptions.onOperation` after every store call.
560
+ *
561
+ * Carries method name, vault/collection/id context, elapsed duration,
562
+ * and success/failure status. Wire this into your metrics pipeline
563
+ * (DataDog, Prometheus, CloudWatch) to get per-operation latency histograms.
564
+ */
565
+ interface StoreOperation {
566
+ method: 'get' | 'put' | 'delete' | 'list' | 'loadAll' | 'saveAll';
567
+ vault: string;
568
+ collection?: string;
569
+ id?: string;
570
+ durationMs: number;
571
+ success: boolean;
572
+ error?: Error;
573
+ }
574
+ /** Options for `withMetrics()`. */
575
+ interface MetricsOptions {
576
+ /** Called after every store operation. */
577
+ onOperation: (op: StoreOperation) => void;
578
+ }
579
+ /**
580
+ * Middleware that calls `onOperation` after every store method with timing
581
+ * and success/failure data. Designed for low-overhead integration with
582
+ * metrics systems — the callback is synchronous and fire-and-forget.
583
+ */
584
+ declare function withMetrics(opts: MetricsOptions): StoreMiddleware;
585
+ /**
586
+ * Options for `withCircuitBreaker()`.
587
+ *
588
+ * The circuit breaker moves through three states:
589
+ * - `closed`: normal operation.
590
+ * - `open`: store is failing; all calls return fallback values immediately.
591
+ * - `half-open`: one probe call after `resetTimeoutMs` — success closes, failure re-opens.
592
+ */
593
+ interface CircuitBreakerOptions {
594
+ /** Number of consecutive failures before opening the circuit. Default: 5. */
595
+ failureThreshold?: number;
596
+ /** Time in ms before attempting to half-open the circuit. Default: 30_000. */
597
+ resetTimeoutMs?: number;
598
+ /** Called when the circuit opens (store becomes unavailable). */
599
+ onOpen?: () => void;
600
+ /** Called when the circuit closes (store recovers). */
601
+ onClose?: () => void;
602
+ }
603
+ /**
604
+ * Middleware that implements the circuit-breaker pattern.
605
+ *
606
+ * When the wrapped store fails `failureThreshold` consecutive times, the
607
+ * circuit opens: subsequent calls return safe fallback values (`null`, `[]`,
608
+ * `{}`) without hitting the store. After `resetTimeoutMs` the circuit
609
+ * half-opens and allows one probe — success closes the circuit, failure
610
+ * keeps it open. Pair with `withRetry` to handle transient errors before
611
+ * they trip the circuit.
612
+ */
613
+ declare function withCircuitBreaker(opts?: CircuitBreakerOptions): StoreMiddleware;
614
+ /**
615
+ * Options for `withCache()`.
616
+ *
617
+ * The cache is a read-through LRU that caches individual record fetches
618
+ * (`get`). Writes (`put`, `delete`) invalidate the relevant cache entry
619
+ * immediately. `list`, `loadAll`, and `saveAll` bypass the cache.
620
+ *
621
+ * Named `StoreCacheOptions` to distinguish from `CacheOptions` in
622
+ * `@noy-db/hub/collection`, which controls the in-memory decrypted-record LRU.
623
+ */
624
+ interface StoreCacheOptions {
625
+ /** Maximum cached entries. Default: 500. */
626
+ maxEntries?: number;
627
+ /** Cache TTL in ms. Default: 60_000 (1 minute). 0 = no expiry. */
628
+ ttlMs?: number;
629
+ }
630
+ /**
631
+ * Middleware that adds a read-through LRU cache for `get()` calls.
632
+ *
633
+ * Reduces latency for frequently-read records (e.g. lookup tables, user
634
+ * profiles) by serving repeat reads from memory. Because NOYDB records are
635
+ * encrypted at rest, caching envelopes is safe — the cache holds ciphertext,
636
+ * not plaintext. For write-heavy workloads, the cache provides little benefit
637
+ * and should be omitted to avoid the invalidation overhead.
638
+ */
639
+ declare function withCache(opts?: StoreCacheOptions): StoreMiddleware;
640
+ interface HealthCheckOptions {
641
+ /** Ping interval in ms. Default: 30_000. */
642
+ checkIntervalMs?: number;
643
+ /** Suspend after N consecutive ping failures. Default: 3. */
644
+ suspendAfterFailures?: number;
645
+ /** Resume after N consecutive ping successes. Default: 1. */
646
+ resumeAfterSuccess?: number;
647
+ /** Called when the store is auto-suspended. */
648
+ onSuspend?: () => void;
649
+ /** Called when the store is auto-resumed. */
650
+ onResume?: () => void;
276
651
  /**
277
- * Override `now()` for tests. Defaults to `Date.now()`.
278
- * @internal
652
+ * Custom health check. Default: calls `store.ping()` if available,
653
+ * otherwise attempts a `list()` on a sentinel collection.
279
654
  */
280
- readonly now?: number;
655
+ check?: () => Promise<boolean>;
281
656
  }
282
657
  /**
283
- * Decide whether `gate` permits the action under `context`. Throws
284
- * {@link PolicyDeniedError} on denial; resolves with `void` on success.
658
+ * Auto-suspends a store when health checks fail, auto-resumes when they recover.
285
659
  *
286
- * Lookup rules:
287
- * - **Built-in gates** without a configured policy fail closed
288
- * (`enabled: false`).
289
- * - **App-defined gates** (`app:*`) without a configured policy are
290
- * treated as no-op (allow). The developer registered the policy if
291
- * they wanted enforcement; absence means the gate is informational.
660
+ * When suspended, `get` returns null, `put`/`delete` are no-ops, `list` returns [].
661
+ * This is identical to the `NullStore` behavior from `routeStore.suspend()`.
292
662
  */
293
- declare function checkGate(policy: VaultPolicy, gate: GateName, context: CheckGateContext): Promise<void>;
663
+ declare function withHealthCheck(opts?: HealthCheckOptions): StoreMiddleware;
664
+
294
665
  /**
295
- * Same as {@link checkGate} but returns a structured verdict instead
296
- * of throwing. Useful when an error UI wants to show the user
297
- * "you'll need TOTP plus a recovery code to do that" without first
298
- * triggering the action.
666
+ * Derive a {@link PersistedSchemaEnvelope} from a Standard Schema v1
667
+ * validator. Supports zod 3 (via the optional `zod-to-json-schema` peer-dep)
668
+ * and zod 4 (via its native `z.toJSONSchema()`); both are loaded lazily so
669
+ * hub never statically imports zod. Other validator families write a stub
670
+ * envelope flagging the kind.
671
+ *
672
+ * @see docs/superpowers/specs/2026-05-22-schema-dump-design.md
673
+ *
674
+ * @module
299
675
  */
300
- declare function describeGate(policy: VaultPolicy, gate: GateName, context: CheckGateContext): Promise<{
301
- ok: true;
302
- } | {
303
- ok: false;
304
- reason: PolicyDenyReason;
305
- required: GatePolicy;
306
- }>;
307
676
 
308
677
  /**
309
- * Persistence helpers for the vault-level policy document
310
- * (`_meta/policy`). Mirrors the bypass-AES pattern used by
311
- * `_meta/handle` — the policy document is plain JSON, the envelope's
312
- * `_iv` field is left empty.
678
+ * Heuristic Zod detection — uses the Standard Schema v1 `~standard.vendor`
679
+ * property (present in Zod v3.23+ and Zod v4+). Falls back to the
680
+ * `_def.typeName` heuristic for older Zod v3 builds that predate Standard
681
+ * Schema support.
682
+ */
683
+ declare function isZodSchema(value: unknown): boolean;
684
+ declare function derivePersistedSchema(validator: unknown): Promise<PersistedSchemaEnvelope>;
685
+
686
+ /**
687
+ * Read / write the per-collection persisted-schema envelope. Mirrors the
688
+ * standard noy-db record envelope shape and is **AES-GCM encrypted with
689
+ * the collection's DEK** — the schema body (field names, enum values,
690
+ * constraints) is sensitive metadata, so it gets the same encryption
691
+ * envelope as the records it describes.
692
+ *
693
+ * Storage layout:
313
694
  *
314
- * @see docs/subsystems/session-tiers.md → Storage location
695
+ * <vault>/_schemas/<collection> → EncryptedEnvelope
696
+ *
697
+ * The DEK passed to {@link savePersistedSchema} / {@link loadPersistedSchema}
698
+ * is the same key the collection uses for its records.
315
699
  *
316
700
  * @module
317
701
  */
318
702
 
319
- /** Reserved collection name for vault-level metadata documents. */
320
- declare const META_COLLECTION = "_meta";
321
- /** Reserved id for the vault-level policy document. */
322
- declare const POLICY_RECORD_ID = "policy";
703
+ /** Reserved collection name where persisted schemas live. */
704
+ declare const SCHEMAS_COLLECTION: "_schemas";
323
705
  /**
324
- * Read the vault-level policy from `_meta/policy`. Returns `undefined`
325
- * when no policy has been persisted (fresh vault, or a vault written
326
- * before the policy module landed). The caller falls back to the
327
- * default preset.
706
+ * Read and decrypt the persisted-schema envelope for one collection.
707
+ * Returns `undefined` when no envelope has been written or when decryption
708
+ * fails (e.g. wrong DEK passed). Tolerates corrupted records — JSON parse
709
+ * failures surface as `undefined`, mirroring `_meta/handle`'s contract.
710
+ */
711
+ declare function loadPersistedSchema(store: NoydbStore, vault: string, collection: string, dek: EnclaveKey): Promise<PersistedSchemaEnvelope | undefined>;
712
+ /**
713
+ * Encrypt and persist a schema envelope for one collection. Always
714
+ * overwrites any prior write (callers gate on hash equality before calling
715
+ * to avoid no-op writes).
328
716
  *
329
- * Tolerates corrupted documents the same way `_meta/handle` does: a
330
- * JSON parse failure surfaces as `undefined`, not a thrown error, so
331
- * a bad write never permanently locks a vault.
717
+ * Pass `expectedVersion` — the `version` from {@link loadPersistedSchemaEntry}
718
+ * captured at load time — to make the write an optimistic CAS: on a store with
719
+ * `casAtomic`, `store.put` throws {@link ConflictError} when the record was
720
+ * bumped concurrently, so a lost update on the shared `_schemas` record is
721
+ * rejected instead of silently clobbering the other writer's field (#583).
722
+ * When omitted, keeps the legacy unconditional last-writer-wins behaviour.
332
723
  */
333
- declare function loadVaultPolicy(store: NoydbStore, vault: string): Promise<VaultPolicy | undefined>;
724
+ declare function savePersistedSchema(store: NoydbStore, vault: string, collection: string, dek: EnclaveKey, payload: PersistedSchemaEnvelope, expectedVersion?: number): Promise<void>;
725
+
334
726
  /**
335
- * Persist the vault-level policy at `_meta/policy`. Idempotent — call
336
- * once at vault creation and again on `db.updatePolicy()` invocations.
727
+ * Orchestrate the derive → hash → skip-or-write cycle for a collection's
728
+ * persisted JSON Schema. Called by the Vault at collection-registration
729
+ * time when the developer opts in via `collection({ persistJsonSchema:
730
+ * true })`.
731
+ *
732
+ * Skip semantics:
733
+ *
734
+ * - Zod validators: skip when the new hash equals the stored hash.
735
+ * - Non-Zod (stub envelopes have hash=null): skip when the stored
736
+ * envelope's `kind` matches the freshly-detected kind (since there's
737
+ * no body to compare yet — a kind change is the only signal).
738
+ *
739
+ * @module
337
740
  */
338
- declare function saveVaultPolicy(store: NoydbStore, vault: string, policy: VaultPolicy): Promise<void>;
339
741
 
340
- /** Allow any schema change. Explicit blind / back-compat. */
341
- declare function blindUpdate(): SchemaUpdateStrategy;
342
- /** Allow additive changes; reject non-additive ones. The safety backstop. */
343
- declare function additiveOnly(): SchemaUpdateStrategy;
742
+ interface PersistSchemaResult {
743
+ /** True when a fresh envelope was written to storage. */
744
+ readonly written: boolean;
745
+ /** True when an existing envelope matched and the write was skipped. */
746
+ readonly skipped: boolean;
747
+ /** The envelope that was either written or matched. */
748
+ readonly envelope: PersistedSchemaEnvelope;
749
+ /** The update-strategy decision, present when strategies ran. */
750
+ readonly decision?: UpdateDecision;
751
+ }
752
+ declare function persistSchemaIfNeeded(opts: {
753
+ readonly store: NoydbStore;
754
+ readonly vault: string;
755
+ readonly collectionName: string;
756
+ readonly validator: unknown;
757
+ readonly dek: EnclaveKey;
758
+ readonly strategies?: readonly SchemaUpdateStrategy[];
759
+ }): Promise<PersistSchemaResult>;
760
+
344
761
  /**
345
- * Reject schema changes. With `fields`, reject only when one of those
346
- * fields is added/removed/changed; otherwise reject any non-`none` delta.
762
+ * `_links_*` reserved collections — managed bidirectional many-to-many
763
+ * junctions (design B).
764
+ *
765
+ * Where `refArray` (design A) stores an id-array on one owning record,
766
+ * `vault.link()` creates a first-class junction: a dedicated encrypted
767
+ * `_links_<name>` collection whose rows are `{ a, b, meta? }` link tuples.
768
+ * It is queryable from BOTH sides (`of(id)`), carries optional per-link
769
+ * metadata, and cascades on endpoint delete.
770
+ *
771
+ * Each link is slot-typed: `a` is an id in the `a` endpoint collection,
772
+ * `b` an id in the `b` endpoint collection (they may be the same
773
+ * collection for self-links). A link's identity is the ordered pair
774
+ * `(a, b)`; `of(id)` matches either slot.
775
+ *
776
+ * Rows are encrypted under a dedicated `_links_<name>` DEK — same
777
+ * zero-knowledge stack as every other collection (the store sees only
778
+ * ciphertext). Backup/restore rides the normal `loadAll` path.
347
779
  */
348
- declare function lockSchema(opts?: {
349
- readonly fields?: readonly string[];
350
- }): SchemaUpdateStrategy;
351
780
 
352
- /** The coordinatedCutover update strategy (single-step — no from/to). */
781
+ /** Thrown by `connect()` when an endpoint record does not exist. */
782
+ declare class LinkEndpointError extends NoydbError {
783
+ readonly link: string;
784
+ readonly endpoint: string;
785
+ readonly missingId: string;
786
+ constructor(link: string, endpoint: string, missingId: string);
787
+ }
353
788
 
354
- declare function coordinatedCutover(opts: {
355
- readonly transform: TransformFn;
356
- }): SchemaUpdateStrategy;
789
+ /**
790
+ * Persistence helpers for `_meta/public-envelope`. Mirrors the
791
+ * bypass-AES pattern used by `_meta/handle` and `_meta/policy` —
792
+ * the document is plaintext JSON, the envelope's `_iv` field is
793
+ * left empty.
794
+ *
795
+ * @module
796
+ */
797
+
798
+ /** Reserved id for the vault-level public envelope record. */
799
+ declare const PUBLIC_ENVELOPE_RECORD_ID = "public-envelope";
800
+ /**
801
+ * Read the public envelope from `_meta/public-envelope`. Returns
802
+ * `undefined` when no envelope has been persisted (fresh vault, or
803
+ * a vault written before the feature was enabled). Tolerates
804
+ * corrupted documents — a JSON parse failure surfaces as `undefined`,
805
+ * not a thrown error, mirroring `_meta/handle`'s contract.
806
+ */
807
+ declare function loadPublicEnvelope(store: NoydbStore, vault: string): Promise<PublicEnvelope | undefined>;
808
+ /** Persist the public envelope. Idempotent — overwrites any prior write. */
809
+ declare function savePublicEnvelope(store: NoydbStore, vault: string, envelope: PublicEnvelope): Promise<void>;
810
+ /**
811
+ * Public, no-key reader. Plain function, not a method on `Noydb` —
812
+ * the whole point is it works without an authenticated session, so
813
+ * a UI can show "Acme 2026 Tax Records" before unlocking.
814
+ *
815
+ * Resolves any `name` / `description` locale map through the supplied
816
+ * `locale` (when provided). Omitting `locale` returns the raw
817
+ * envelope, which a multilingual picker can render as it pleases.
818
+ */
819
+ declare function readPublicEnvelope(store: NoydbStore, vault: string, opts?: {
820
+ readonly locale?: string;
821
+ }): Promise<PublicEnvelope | undefined>;
822
+
823
+ /**
824
+ * Persistence helpers for per-principal user envelopes stored at
825
+ * `_users/<keyringId>` (logically: `_meta/user/<keyringId>`).
826
+ *
827
+ * Unlike `_meta/policy` and `_meta/handle` which are plaintext, user
828
+ * envelopes carry user data and are encrypted with a dedicated
829
+ * {@link USER_ENVELOPE_COLLECTION} DEK (provisioned at vault open and
830
+ * propagated to every keyring via the system-collection DEK path in
831
+ * `team/keyring.ts`).
832
+ *
833
+ * This module is the **storage primitive** layer. The public API
834
+ * (`vault.user.*`) sits on top of this; permission gates, own-only
835
+ * write enforcement, and presence-channel propagation live there.
836
+ *
837
+ * @see docs/superpowers/specs/2026-05-05-user-envelope-design.md
838
+ *
839
+ * @module
840
+ */
357
841
 
358
842
  /**
359
- * Derive a {@link PersistedSchemaEnvelope} from a Standard Schema v1
360
- * validator. v0 supports Zod via `zod-to-json-schema` (optional peer-dep);
361
- * other families write a stub envelope flagging the kind.
843
+ * Read and decrypt the user envelope for `keyringId`. Returns `null`
844
+ * when no envelope has been persisted (either the principal has never
845
+ * called `updateMe`, or the keyring predates this feature).
846
+ *
847
+ * Decryption errors propagate — a tampered or wrong-keyed envelope
848
+ * surfaces as the underlying crypto error rather than masquerading as
849
+ * "not found".
850
+ */
851
+ declare function loadUserEnvelope<T = unknown>(store: NoydbStore, vault: string, keyringId: string, dek: EnclaveKey): Promise<UserEnvelope<T> | null>;
852
+ /**
853
+ * Encrypt and persist the user envelope for `keyringId`. The new
854
+ * version is `(prior._v ?? 0) + 1`. Pass `expectedVersion` to enable
855
+ * optimistic-concurrency checks: a mismatch with the stored version
856
+ * throws {@link ConflictError} with the actual stored version.
362
857
  *
363
- * @see docs/superpowers/specs/2026-05-22-schema-dump-design.md
858
+ * `expectedVersion: 0` means "expect no prior envelope"; the write
859
+ * succeeds only if no envelope exists yet.
364
860
  *
365
- * @module
861
+ * Soft-caps the JSON-serialized payload at {@link USER_ENVELOPE_MAX_BYTES};
862
+ * larger payloads throw {@link UserEnvelopeOversizedError}.
366
863
  */
367
-
864
+ declare function saveUserEnvelope<T>(store: NoydbStore, vault: string, keyringId: string, payload: T, dek: EnclaveKey, expectedVersion?: number): Promise<UserEnvelope<T>>;
368
865
  /**
369
- * Heuristic Zod detection — Zod schemas carry a `_def.typeName` property
370
- * starting with `Zod` (e.g. `ZodObject`, `ZodString`). This survives Zod's
371
- * minor-version bumps because the typeName naming is stable across v3.
866
+ * Delete the user envelope for `keyringId`. Idempotent — no error if
867
+ * the envelope is already absent. Called from the keyring revoke path
868
+ * (cascade-delete) and is a no-op for keyrings that never wrote.
372
869
  */
373
- declare function isZodSchema(value: unknown): boolean;
374
- declare function derivePersistedSchema(validator: unknown): Promise<PersistedSchemaEnvelope>;
870
+ declare function deleteUserEnvelope(store: NoydbStore, vault: string, keyringId: string): Promise<void>;
871
+ /**
872
+ * List the keyring ids that have a user envelope persisted in `vault`.
873
+ * Order is store-defined — callers that need a stable order should sort.
874
+ */
875
+ declare function listUserEnvelopeIds(store: NoydbStore, vault: string): Promise<string[]>;
375
876
 
376
877
  /**
377
- * Read / write the per-collection persisted-schema envelope. Mirrors the
378
- * standard noy-db record envelope shape and is **AES-GCM encrypted with
379
- * the collection's DEK** — the schema body (field names, enum values,
380
- * constraints) is sensitive metadata, so it gets the same encryption
381
- * envelope as the records it describes.
878
+ * Type surface for the user-list visibility service.
382
879
  *
383
- * Storage layout:
880
+ * Two complementary flags:
881
+ * - {@link DirectoryConfig} — vault-level "is the directory listing
882
+ * enabled at all?" toggle. Owner-only mutation.
883
+ * - {@link UserVisibility} — per-user "hide me from teammate listings"
884
+ * opt-out. Self-mutation via `vault.user.setMyVisibility`.
384
885
  *
385
- * <vault>/_schemas/<collection> → EncryptedEnvelope
886
+ * Both flags live in the existing `_meta` collection as plaintext-bypass
887
+ * sidecars (`_iv: ''`). Neither is a security boundary — the keyring
888
+ * file is still observable at `_keyring/*` and the envelope ciphertext
889
+ * is still at `_users/*` to anyone with direct store read access. The
890
+ * flags exist to keep admin-UI listings tidy, not to hide principals
891
+ * from a determined attacker.
386
892
  *
387
- * The DEK passed to {@link savePersistedSchema} / {@link loadPersistedSchema}
388
- * is the same key the collection uses for its records.
893
+ * @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/user-envelope.md → Directory visibility
389
894
  *
390
895
  * @module
391
896
  */
392
-
393
- /** Reserved collection name where persisted schemas live. */
394
- declare const SCHEMAS_COLLECTION: "_schemas";
395
897
  /**
396
- * Read and decrypt the persisted-schema envelope for one collection.
397
- * Returns `undefined` when no envelope has been written or when decryption
398
- * fails (e.g. wrong DEK passed). Tolerates corrupted records — JSON parse
399
- * failures surface as `undefined`, mirroring `_meta/handle`'s contract.
898
+ * Vault-level directory toggle. Persisted at `_meta/directory`.
899
+ *
900
+ * - `enabled: true` (default when no document exists) — every authenticated
901
+ * caller can enumerate users via `listUsersWithEnvelopes`.
902
+ * - `enabled: false` — only `owner` and `admin` callers can enumerate;
903
+ * anyone else gets {@link import('../../kernel/errors.js').DirectoryDisabledError}.
400
904
  */
401
- declare function loadPersistedSchema(store: NoydbStore, vault: string, collection: string, dek: CryptoKey): Promise<PersistedSchemaEnvelope | undefined>;
905
+ interface DirectoryConfig {
906
+ readonly enabled: boolean;
907
+ }
402
908
  /**
403
- * Encrypt and persist a schema envelope for one collection. Always
404
- * overwrites any prior write (callers gate on hash equality before calling
405
- * to avoid no-op writes).
909
+ * Per-user visibility flag. Persisted at `_meta/visibility/<keyringId>`.
910
+ *
911
+ * - `hidden: false` (default when no document exists) — the user shows up
912
+ * in `listUsersWithEnvelopes` like any other principal.
913
+ * - `hidden: true` — the user is filtered out of the default listing.
914
+ * `owner`/`admin` callers can still see them by passing
915
+ * `{ includeHidden: true }`.
406
916
  */
407
- declare function savePersistedSchema(store: NoydbStore, vault: string, collection: string, dek: CryptoKey, payload: PersistedSchemaEnvelope): Promise<void>;
917
+ interface UserVisibility {
918
+ readonly hidden: boolean;
919
+ }
408
920
 
409
921
  /**
410
- * Orchestrate the derive → hash → skip-or-write cycle for a collection's
411
- * persisted JSON Schema. Called by the Vault at collection-registration
412
- * time when the developer opts in via `collection({ persistJsonSchema:
413
- * true })`.
414
- *
415
- * Skip semantics:
416
- *
417
- * - Zod validators: skip when the new hash equals the stored hash.
418
- * - Non-Zod (stub envelopes have hash=null): skip when the stored
419
- * envelope's `kind` matches the freshly-detected kind (since there's
420
- * no body to compare yet — a kind change is the only signal).
421
- *
422
- * @module
922
+ * Implementation behind `vault.user`. Constructed once per Vault via
923
+ * {@link createUserApi}, holds the writer's keyringId in closure so
924
+ * `updateMe`/`setMe` cannot target any other principal — the own-only
925
+ * rule is enforced at the type level (no `set(otherKeyringId, …)`
926
+ * method) AND at runtime (the keyringId argument simply doesn't exist
927
+ * on the write path).
423
928
  */
424
-
425
- interface PersistSchemaResult {
426
- /** True when a fresh envelope was written to storage. */
427
- readonly written: boolean;
428
- /** True when an existing envelope matched and the write was skipped. */
429
- readonly skipped: boolean;
430
- /** The envelope that was either written or matched. */
431
- readonly envelope: PersistedSchemaEnvelope;
432
- /** The update-strategy decision, present when strategies ran. */
433
- readonly decision?: UpdateDecision;
929
+ declare class UserApi implements VaultUserApi {
930
+ /** keyringId → set of listeners. Wildcard '*' fires on every change. */
931
+ private readonly listeners;
932
+ private readonly adapter;
933
+ private readonly vaultName;
934
+ /** The writer's own keyringId. Frozen at construction time. */
935
+ private readonly writerKeyringId;
936
+ private readonly getDek;
937
+ /**
938
+ * Policy-gate validator. When omitted, gates are skipped — useful
939
+ * for low-level tests that exercise the storage layer directly.
940
+ * Production paths always wire the Noydb-backed implementation.
941
+ */
942
+ private readonly checkGate?;
943
+ /**
944
+ * Noydb-backed `exportMyAccessibleData`, injected by the Vault
945
+ * (which holds the keyring + bundle machinery). Omitted in low-level tests.
946
+ */
947
+ private readonly exportAccessible?;
948
+ /**
949
+ * Noydb-backed `unilateralWithdrawal`, injected by the Vault.
950
+ * Destructive — extract + dispose (delete | freeze). Omitted in low-level tests.
951
+ */
952
+ private readonly unilateralWithdraw?;
953
+ /**
954
+ * Noydb-backed two-party withdrawal ceremony, injected by the
955
+ * Vault. requestWithdraw = requester side; the rest = owner side.
956
+ */
957
+ private readonly requestWithdraw?;
958
+ private readonly listWithdrawals?;
959
+ private readonly approveWithdraw?;
960
+ private readonly rejectWithdraw?;
961
+ constructor(deps: UserApiDeps);
962
+ /**
963
+ * File a two-party withdrawal request for the caller's accessible
964
+ * scope. Non-destructive (writes a pending request); an owner later approves
965
+ * or rejects. This is the path for read-only roles (`client`/`viewer`) that
966
+ * cannot self-serve a destructive `unilateralWithdrawal`. Gated by
967
+ * `user-request-withdrawal` (enabled by default).
968
+ */
969
+ requestWithdrawal(opts?: RequestWithdrawalOptions): Promise<RequestWithdrawalResult>;
970
+ /** Owner side: list filed withdrawal requests (optionally by status). */
971
+ listWithdrawalRequests(opts?: {
972
+ status?: WithdrawalRequestStatus;
973
+ }): Promise<WithdrawalRequest[]>;
974
+ /**
975
+ * Owner side: approve a pending request. Extracts the requester's
976
+ * recorded scope under firm authority, disposes of the source per the
977
+ * request's disposition, and returns the re-keyed bundle to hand back. Gated
978
+ * by `approve-user-withdrawal` (tier-2 default) + owner/admin role.
979
+ */
980
+ approveWithdrawal(requestId: string, opts?: ApproveWithdrawalOptions): Promise<WithdrawResult>;
981
+ /** Owner side: reject a pending request (no data is touched). */
982
+ rejectWithdrawal(requestId: string, opts?: RejectWithdrawalOptions): Promise<WithdrawalRequest>;
983
+ /**
984
+ * Single-party withdrawal: export the caller's accessible scope
985
+ * (re-keyed) and dispose of the source (`delete` or `freeze`). Gated by the
986
+ * fail-closed built-in `client-unilateral-withdraw` policy — undefined or
987
+ * disabled → throws (use `requestWithdrawal`). The firm enables it at vault
988
+ * creation.
989
+ */
990
+ unilateralWithdrawal(opts: WithdrawAccessibleOptions): Promise<WithdrawResult>;
991
+ /**
992
+ * Export the calling user's accessible scope as a portable, re-keyed
993
+ * `.noydb` bundle. Non-destructive and **always allowed** (data sovereignty
994
+ * by construction) but audited. Scope = the caller's DEK access set.
995
+ */
996
+ exportMyAccessibleData(opts?: ExportAccessibleOptions): Promise<Uint8Array>;
997
+ /** Read the writer's own envelope. Returns null if never written. */
998
+ me<T = unknown>(): Promise<UserEnvelope<T> | null>;
999
+ /**
1000
+ * Deep-merge a partial patch into the writer's own envelope. Creates
1001
+ * the envelope on first call. Optimistic-concurrency safe — a stale
1002
+ * `_v` (parallel writer on another device) throws `ConflictError`.
1003
+ *
1004
+ * Patch semantics:
1005
+ * - `undefined` (or omitted key) — skip; existing value preserved
1006
+ * - `null` — delete the field from the merged result
1007
+ * - any other value — overwrite (deep-merge for plain objects,
1008
+ * replace for primitives / arrays)
1009
+ *
1010
+ * To clear a field, pass `null` rather than `undefined`. Callers
1011
+ * with shape `T = string | null` where `null` is a meaningful value
1012
+ * should use `setMe` for that specific field instead — `null` here
1013
+ * always means delete.
1014
+ *
1015
+ * Gated by the `edit-own-profile` policy gate (default `minTier: 3`).
1016
+ * Pass `presented` to satisfy tightened policies that require a
1017
+ * factor proof (e.g. STRICT_POLICY's TOTP requirement).
1018
+ */
1019
+ updateMe<T extends object = Record<string, unknown>>(patch: DeepPartialOrNull<T>, presented?: UserEnvelopePresented): Promise<UserEnvelope<T>>;
1020
+ /**
1021
+ * Replace the writer's own envelope with `payload`. Use sparingly —
1022
+ * `updateMe` is the canonical mutation. No `expectedVersion` check;
1023
+ * callers explicitly take last-write-wins semantics.
1024
+ *
1025
+ * Gated by `edit-own-profile`. See `updateMe` for `presented` usage.
1026
+ */
1027
+ setMe<T = unknown>(payload: T, presented?: UserEnvelopePresented): Promise<UserEnvelope<T>>;
1028
+ /**
1029
+ * Read the current user's visibility flag from
1030
+ * `_meta/visibility/<keyringId>`. Returns `{ hidden: false }` when no
1031
+ * document has been persisted (the default-visible case).
1032
+ */
1033
+ getMyVisibility(): Promise<UserVisibility>;
1034
+ /**
1035
+ * Update the current user's visibility in the team directory.
1036
+ *
1037
+ * - `hidden: true` — opt out of the default `listUsersWithEnvelopes`
1038
+ * listing. `owner`/`admin` callers can still see the user by passing
1039
+ * `{ includeHidden: true }`.
1040
+ * - `hidden: false` — opt back in.
1041
+ *
1042
+ * Own-only by construction: the keyringId argument doesn't exist on
1043
+ * this method, so no caller can hide or unhide another principal.
1044
+ *
1045
+ * Honest caveat: this is a UX flag, not a privacy guarantee. The
1046
+ * envelope ciphertext at `_users/<keyringId>` and the keyring file at
1047
+ * `_keyring/<userId>` are both still observable to anyone with direct
1048
+ * store read access. See `https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/user-envelope.md` →
1049
+ * "Directory visibility".
1050
+ */
1051
+ setMyVisibility(visibility: UserVisibility): Promise<void>;
1052
+ /**
1053
+ * Read another principal's envelope by their keyringId. Returns null
1054
+ * if the principal exists but has no envelope yet, or if the
1055
+ * keyringId does not exist at all.
1056
+ *
1057
+ * Gated by `view-team-profiles` (default `minTier: 2`) — but ONLY for
1058
+ * cross-principal reads. Reading your own envelope (`keyringId ===
1059
+ * self`) is never gated; that's just `me()` written long-form.
1060
+ */
1061
+ get<T = unknown>(keyringId: string, presented?: UserEnvelopePresented): Promise<UserEnvelope<T> | null>;
1062
+ /**
1063
+ * Read every persisted envelope in the vault. Order is store-defined.
1064
+ *
1065
+ * Gated by `view-team-profiles`. Default policy (`minTier: 2`) lets
1066
+ * any authenticated session read all envelopes. Two privacy-strict
1067
+ * opt-outs:
1068
+ *
1069
+ * - `view-team-profiles.enabled: false` → list() returns only the
1070
+ * caller's own envelope (silent self-fallback, no thrown error).
1071
+ * - `view-team-profiles.minTier: 1` + insufficient tier → throws
1072
+ * `PolicyDeniedError` with `reason: 'insufficient-tier'`. The
1073
+ * caller is expected to elevate, not silently degrade.
1074
+ *
1075
+ * The asymmetry is deliberate: `enabled: false` is a deliberate
1076
+ * design choice ("nobody sees teammate profiles in this app");
1077
+ * `insufficient-tier` is "you need to authenticate further". Different
1078
+ * UX prompts for different intents.
1079
+ */
1080
+ list<T = unknown>(presented?: UserEnvelopePresented): Promise<UserEnvelope<T>[]>;
1081
+ /**
1082
+ * Listen for changes to a specific keyringId's envelope. The callback
1083
+ * fires synchronously after every successful local `updateMe` /
1084
+ * `setMe` for that principal.
1085
+ *
1086
+ * Cross-instance changes (a teammate edits their profile on their
1087
+ * device, the sync engine pulls the diff onto this device) will fire
1088
+ * subscribers when the sync layer replays the write through this API.
1089
+ * In v1, subscribers do NOT fire on raw store changes — wire your sync
1090
+ * layer to call back through `vault.user.setMe` / `updateMe` if you
1091
+ * need that.
1092
+ *
1093
+ * Pass keyringId `'*'` to fire on every change in the vault.
1094
+ */
1095
+ subscribe<T = unknown>(keyringId: string, cb: (env: UserEnvelope<T> | null) => void): Unsubscribe;
1096
+ /**
1097
+ * Reactive handle that caches the current value and re-reads on every
1098
+ * change for the given keyringId. Convenient for framework bindings:
1099
+ *
1100
+ * const live = vault.user.live<UserShape>(vault.userId)
1101
+ * live.subscribe(env => render(env?.data))
1102
+ *
1103
+ * Initial value is `null` until the first `current()` call materializes
1104
+ * it via `vault.user.get()`. Call `stop()` when done to release the
1105
+ * subscription.
1106
+ */
1107
+ live<T = unknown>(keyringId: string): LiveUserEnvelope<T>;
1108
+ private fireChange;
434
1109
  }
435
- declare function persistSchemaIfNeeded(opts: {
436
- readonly store: NoydbStore;
437
- readonly vault: string;
438
- readonly collectionName: string;
439
- readonly validator: unknown;
440
- readonly dek: CryptoKey;
441
- readonly strategies?: readonly SchemaUpdateStrategy[];
442
- }): Promise<PersistSchemaResult>;
443
1110
 
444
1111
  /**
445
1112
  * Authentication introspection.
@@ -492,8 +1159,8 @@ declare function describeAllUsersAuth(store: NoydbStore, vault: string): Promise
492
1159
  * `_meta/policy` — the directory document is plain JSON, the
493
1160
  * envelope's `_iv` field is left empty.
494
1161
  *
495
- * @see docs/subsystems/user-envelope.md → Directory visibility
496
- * @see docs/subsystems/plaintext-bypass.md — every `_iv: ''` write site
1162
+ * @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/user-envelope.md → Directory visibility
1163
+ * @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/plaintext-bypass.md — every `_iv: ''` write site
497
1164
  *
498
1165
  * @module
499
1166
  */
@@ -533,8 +1200,8 @@ declare function persistDirectoryConfig(store: NoydbStore, vault: string, config
533
1200
  * work even when decryption fails (legacy keyrings predating the
534
1201
  * envelope feature, or a corrupted envelope).
535
1202
  *
536
- * @see docs/subsystems/user-envelope.md → Directory visibility
537
- * @see docs/subsystems/plaintext-bypass.md — every `_iv: ''` write site
1203
+ * @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/user-envelope.md → Directory visibility
1204
+ * @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/plaintext-bypass.md — every `_iv: ''` write site
538
1205
  *
539
1206
  * @module
540
1207
  */
@@ -564,60 +1231,107 @@ declare function persistUserVisibility(store: NoydbStore, vault: string, keyring
564
1231
  */
565
1232
  declare function deleteUserVisibility(store: NoydbStore, vault: string, keyringId: string): Promise<void>;
566
1233
 
567
- interface EncryptResult {
568
- iv: string;
569
- data: string;
570
- }
571
1234
  /**
572
- * Encrypt raw bytes with AES-256-GCM using a fresh random IV.
573
- * Used by the attachment store so binary blobs avoid double base64 encoding
574
- * (the existing `encrypt()` function calls `TextEncoder` on a string — here
575
- * we pass the `Uint8Array` directly to `subtle.encrypt`).
1235
+ * Return the ISO-4217 minor-unit scale for a currency code, or `null`
1236
+ * when the code is not in the known set (caller must supply an explicit
1237
+ * scale).
576
1238
  */
577
- declare function encryptBytes(data: Uint8Array, dek: CryptoKey): Promise<EncryptResult>;
1239
+ declare function scaleForCurrency(code: string): number | null;
1240
+
578
1241
  /**
579
- * Decrypt AES-256-GCM ciphertext back to raw bytes.
580
- * Counterpart to `encryptBytes`. Throws `TamperedError` on auth-tag failure.
1242
+ * Money-aware aggregation: exact `sum` / `min` / `max` over money
1243
+ * fields.
1244
+ *
1245
+ * The generic reducers (`aggregate/reducers.ts`) read a field via
1246
+ * `readNumber`, which coerces a string (the stored scaled-integer form
1247
+ * of money, e.g. `'12345'`) to `0` — so an un-wrapped money `sum` would
1248
+ * silently return zero. {@link wrapMoneyReducers} rewrites any `sum` /
1249
+ * `min` / `max` over a declared money field into a reducer that
1250
+ * accumulates per-currency `BigInt` totals of the stored integers, so
1251
+ * the result is exact for any magnitude (past `Number.MAX_SAFE_INTEGER`
1252
+ * included).
1253
+ *
1254
+ * Results are currency-aware and never silently mix currencies:
1255
+ * - **fixed** mode → a single exact decimal string.
1256
+ * - **multi** mode → an exact `Record<currency, string>` map.
1257
+ * - **`sum` with `convertTo` + `fx`** → a single exact string, with
1258
+ * each currency converted via BigInt arithmetic (no float).
1259
+ *
1260
+ * `remove()` is implemented for every money reducer so they participate
1261
+ * in incremental live-aggregation and materialized-view maintenance
1262
+ * exactly like the generic reducers they replace.
581
1263
  */
582
- declare function decryptBytes(ivBase64: string, dataBase64: string, dek: CryptoKey): Promise<Uint8Array>;
1264
+
1265
+ type FxRates = Record<string, number | string>;
1266
+
583
1267
  /**
584
- * Derive an AES-256-GCM presence key from a collection DEK using HKDF-SHA256.
585
- *
586
- * The presence key is domain-separated from the data DEK by the fixed salt
587
- * `'noydb-presence'` and the `info` = collection name. This means:
588
- * - The adapter never sees the presence key.
589
- * - Presence payloads rotate automatically when the collection DEK is rotated.
590
- * - Revoked users cannot derive the new presence key after a DEK rotation.
591
- *
592
- * @param dek The collection's AES-256-GCM DEK (extractable).
593
- * @param collectionName Used as the HKDF `info` parameter for domain separation.
594
- * @returns A non-extractable AES-256-GCM key suitable for presence payload encryption.
1268
+ * Exact money arithmetic helpers — `mulRate` and `allocate`.
1269
+ *
1270
+ * Both operate on the canonical decoded string form that `get()`
1271
+ * returns (`'10000.00'`), entirely in scaled-`BigInt` space — no
1272
+ * floating-point step anywhere, exact past 2^53. They are pure
1273
+ * functions with no vault or descriptor dependency: the working scale
1274
+ * is inferred from the amount's fractional digits (a canonical money
1275
+ * string always carries exactly the field's scale) or pinned with
1276
+ * `opts.scale`.
1277
+ *
1278
+ * Why these two: app-side invariants of the form
1279
+ * `Σ parts === whole` (receipt totals, net-zero WHT pairs, proration)
1280
+ * carry ±0.01 tolerances ONLY because the math is major-unit floats +
1281
+ * round2. `mulRate` (VAT-style rate application with explicit
1282
+ * rounding) and `allocate` (largest-remainder split — parts sum to the
1283
+ * input EXACTLY, by construction) make those tolerances zero.
595
1284
  */
596
- declare function derivePresenceKey(dek: CryptoKey, collectionName: string): Promise<CryptoKey>;
1285
+
1286
+ interface MulRateOptions {
1287
+ /**
1288
+ * Output scale (fraction digits). Defaults to the amount's own
1289
+ * fractional digits — for a canonical money string that IS the
1290
+ * field's scale.
1291
+ */
1292
+ readonly scale?: number;
1293
+ /** Rounding for the final re-scale. Default `'half-up'`. */
1294
+ readonly rounding?: RoundingMode;
1295
+ }
1296
+ interface AllocateOptions {
1297
+ /** Working scale. Defaults to the amount's own fractional digits. */
1298
+ readonly scale?: number;
1299
+ }
597
1300
  /**
598
- * Encrypt a plaintext string with AES-256-GCM and a deterministic,
599
- * HKDF-derived IV.
1301
+ * Multiply a money amount by a decimal rate, exactly.
600
1302
  *
601
- * The same `{ dek, context, plaintext }` triple always produces the
602
- * same `{ iv, data }` — call this twice and you can string-compare the
603
- * ciphertexts to check equality of the inputs without decrypting them.
1303
+ * The rate is parsed at its OWN full precision (`0.07` → `7` at scale
1304
+ * 2), the product computed in `BigInt` at `amountScale + rateScale`,
1305
+ * then re-scaled back to the output scale with the requested rounding —
1306
+ * one rounding step, at the very end.
604
1307
  *
605
- * @param context Domain-separation string — by convention
606
- * `'<collection>/<field>'`. Different contexts encrypt
607
- * the same plaintext to different ciphertexts, so
608
- * `email` in collection `users` does not collide with
609
- * `email` in collection `customers`.
1308
+ * ```ts
1309
+ * mulRate('10000.00', 0.07) // '700.00' (VAT)
1310
+ * mulRate('33.33', '0.07') // '2.33' (half-up)
1311
+ * mulRate('33.33', 0.07, { rounding: 'floor' }) // '2.33'
1312
+ * mulRate(100, 0.07, { scale: 2 }) // '7.00'
1313
+ * ```
610
1314
  */
611
- declare function encryptDeterministic(plaintext: string, dek: CryptoKey, context: string): Promise<EncryptResult>;
1315
+ declare function mulRate(amount: number | string, rate: number | string, opts?: MulRateOptions): string;
612
1316
  /**
613
- * Counterpart to {@link encryptDeterministic}. The IV is stored
614
- * alongside the ciphertext (exactly like the randomized path), so
615
- * decrypt uses the stored IV and verifies the GCM auth tag — a tampered
616
- * ciphertext throws `TamperedError` just like randomized AES-GCM.
1317
+ * Split a money amount across weighted buckets with ZERO drift: the
1318
+ * returned parts sum to the input exactly, by construction
1319
+ * (largest-remainder method).
1320
+ *
1321
+ * Each bucket gets `floor(amount × weightᵢ / Σweights)`; the leftover
1322
+ * minor units (always fewer than the bucket count) go one each to the
1323
+ * buckets with the largest truncated remainders — ties broken by
1324
+ * position, earlier bucket first. Weights are parsed as exact decimals
1325
+ * (no float division anywhere); they must be non-negative with a
1326
+ * positive sum.
1327
+ *
1328
+ * ```ts
1329
+ * allocate('100.00', [1, 1, 1]) // ['33.34', '33.33', '33.33']
1330
+ * allocate('0.05', [3, 7]) // ['0.02', '0.03']
1331
+ * allocate('-100.00', [1, 1, 1]) // ['-33.34', '-33.33', '-33.33']
1332
+ * ```
617
1333
  */
618
- declare function decryptDeterministic(ivBase64: string, dataBase64: string, dek: CryptoKey): Promise<string>;
619
- declare function bufferToBase64(buffer: ArrayBuffer | Uint8Array): string;
620
- declare function base64ToBuffer(base64: string): Uint8Array<ArrayBuffer>;
1334
+ declare function allocate(amount: number | string, weights: ReadonlyArray<number | string>, opts?: AllocateOptions): string[];
621
1335
 
622
1336
  /**
623
1337
  * Hierarchical access — tier-aware keyring helpers.
@@ -660,117 +1374,133 @@ declare function effectiveClearance(keyring: UnlockedKeyring, collection: string
660
1374
  declare function assertTierAccess(keyring: UnlockedKeyring, collection: string, tier: number): void;
661
1375
 
662
1376
  /**
663
- * Vault-level diff orchestrator.
664
- *
665
- * Compares a live `Vault`'s plaintext state against a candidate state
666
- * (another vault, a plain `{ collection: records[] }` map, or a vault
667
- * dump JSON) and returns a structured `VaultDiff` plan listing the
668
- * records that would be added, modified, or deleted to bring the live
669
- * vault into the candidate's shape.
1377
+ * Default policy for personal vaults and SMB deployments — the gates
1378
+ * that need an off-device factor get one (TOTP / email-OTP / paper
1379
+ * recovery), the rest take a tier-1 unlock alone. Tier-3 (PIN) is the
1380
+ * floor only for `rotate-unlock` because that's the
1381
+ * "change my PIN" flow.
670
1382
  *
671
- * Builds on two existing record-level helpers:
1383
+ * The unspecified gates (e.g. `view-user-auth`) inherit the engine
1384
+ * default of `{ enabled: false, minTier: 1 }` — they fail closed.
672
1385
  *
673
- * 1. `diff(a, b)` from `./history/diff.ts` — emits dot-pathed
674
- * `DiffEntry[]` with `type: 'added' | 'removed' | 'changed'` for
675
- * each changed field of two records. Used here for the
676
- * `fieldDiffs` of every `modified` entry, and (with empty result)
677
- * as the default deep-equal check.
1386
+ * @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/session-tiers.md → Built-in gates
1387
+ */
1388
+ declare const PERSONAL_POLICY: VaultPolicy;
1389
+ /**
1390
+ * Strict policy for regulated deployments and shared workstations —
1391
+ * raises the phrase floor to 8 words, demands two distinct factors for
1392
+ * exports, and blocks export-on-shared-device. Use as a base for
1393
+ * `policy: { ...STRICT_POLICY, gates: { ...STRICT_POLICY.gates, ... } }`
1394
+ * tweaks.
1395
+ */
1396
+ declare const STRICT_POLICY: VaultPolicy;
1397
+ /**
1398
+ * Merge a developer override onto a preset. Unspecified gates inherit;
1399
+ * specified gates fully replace the preset's entry for that gate.
678
1400
  *
679
- * 2. `Vault.exportStream()` from `./vault.ts` — the canonical
680
- * decrypt-and-stream-records iterator. Used to walk both sides
681
- * when the candidate is itself a `Vault`. ACL-scoped: collections
682
- * the caller can't read silently drop out, the same way every
683
- * other plaintext-emitting export pipeline filters them.
1401
+ * Example:
684
1402
  *
685
- * The new orchestration is the **vault-level** enumeration: bucket
686
- * each record id into added (only in candidate), deleted (only in
687
- * vault), or modified (in both with field changes); leave the
688
- * field-level granularity to the existing `diff()`.
1403
+ * ```ts
1404
+ * mergePolicy(PERSONAL_POLICY, {
1405
+ * gates: {
1406
+ * 'app:approve-large-payment': { minTier: 2, factors: [{ anyOf: ['totp'] }] },
1407
+ * },
1408
+ * })
1409
+ * // → PERSONAL_POLICY plus the new app gate; existing gates intact.
1410
+ * ```
1411
+ */
1412
+ declare function mergePolicy(base: VaultPolicy, override?: Partial<VaultPolicy>): VaultPolicy;
1413
+
1414
+ /**
1415
+ * Policy gate engine — the {@link checkGate} entry point.
689
1416
  *
690
- * Use cases:
1417
+ * Given a configured {@link VaultPolicy}, an active session tier, and
1418
+ * the factor proofs an actor is presenting, decide whether the gate
1419
+ * permits the action. On denial, throws {@link PolicyDeniedError} with
1420
+ * a stable {@link PolicyDenyReason} so consumers can branch in error
1421
+ * UIs.
691
1422
  *
692
- * - Import preview (`@noy-db/as-*` `fromString` returns a plan
693
- * whose body is a `VaultDiff`).
694
- * - Backup verification ("does this `.noydb` bundle from yesterday
695
- * match the current vault?").
696
- * - Two-vault reconciliation ("what's different between Office A
697
- * and Office B before we sync?").
698
- * - Test assertions (golden-file testing with one-liner
699
- * `expect(plan.summary).toEqual(...)`).
1423
+ * @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/session-tiers.md → checkGate() API
700
1424
  *
701
1425
  * @module
702
1426
  */
703
1427
 
704
- /** Per-record entry shape — added and deleted records carry only the record value. */
705
- interface VaultDiffEntry<T = unknown> {
706
- readonly collection: string;
707
- readonly id: string;
708
- readonly record: T;
709
- }
710
- /** Modified records carry both halves of the diff plus the field-level breakdown. */
711
- interface VaultDiffModifiedEntry<T = unknown> extends VaultDiffEntry<T> {
712
- /** The record as it stands in the live vault. */
713
- readonly before: T;
714
- /** Top-level keys whose values differ between `before` and `record`. */
715
- readonly fieldsChanged: readonly string[];
716
- /**
717
- * Field-level diff entries from `diff(before, record)`. Reuses the
718
- * existing per-record diff helper so consumers can render git-style
719
- * `path: from → to` rows without re-walking the records.
720
- */
721
- readonly fieldDiffs: readonly DiffEntry[];
722
- }
723
- interface VaultDiff<T = unknown> {
724
- readonly added: readonly VaultDiffEntry<T>[];
725
- readonly modified: readonly VaultDiffModifiedEntry<T>[];
726
- readonly deleted: readonly VaultDiffEntry<T>[];
727
- /** Only populated when `options.includeUnchanged: true`. */
728
- readonly unchanged: readonly VaultDiffEntry<T>[] | undefined;
729
- readonly summary: {
730
- readonly add: number;
731
- readonly modify: number;
732
- readonly delete: number;
733
- readonly total: number;
734
- };
1428
+ /** Default freshness window — 5 minutes. */
1429
+ declare const DEFAULT_FRESHNESS_MS: number;
1430
+ /** Caller-supplied context for one `checkGate` invocation. */
1431
+ interface CheckGateContext {
1432
+ /** Tier the active session currently holds. */
1433
+ readonly activeTier: ActiveTier;
1434
+ /** Proofs the actor is presenting for this gate. */
1435
+ readonly factors?: ReadonlyArray<FactorProof>;
735
1436
  /**
736
- * Format the diff as a human-readable string.
737
- *
738
- * - `'count'` — one line, just the numbers (`12 added · 3 modified · 0 deleted`)
739
- * - `'one-line'` — count plus a single overview line
740
- * - `'full'` — count + one row per added/modified/deleted record (default)
1437
+ * If the host knows the actor is on a shared device, set this to
1438
+ * `true` so the engine can apply `warn.sharedDevice` rules. Defaults
1439
+ * to `false`.
741
1440
  */
742
- format(opts?: {
743
- detail?: 'count' | 'one-line' | 'full';
744
- }): string;
745
- }
746
- interface DiffOptions {
747
- /** Restrict the diff to a subset of collections. */
748
- readonly collections?: readonly string[];
749
- /** Field on each record that carries its id. Defaults to `'id'`. */
750
- readonly idKey?: string;
751
- /** Override the default deep-equal check for "modified vs unchanged". */
752
- readonly compareFn?: (a: unknown, b: unknown) => boolean;
753
- /** If true, include unchanged records in the diff (off by default to save memory). */
754
- readonly includeUnchanged?: boolean;
1441
+ readonly sharedDevice?: boolean;
1442
+ /**
1443
+ * Override `now()` for tests. Defaults to `Date.now()`.
1444
+ * @internal
1445
+ */
1446
+ readonly now?: number;
755
1447
  }
756
1448
  /**
757
- * Candidate state to diff the vault against:
1449
+ * Decide whether `gate` permits the action under `context`. Throws
1450
+ * {@link PolicyDeniedError} on denial; resolves with `void` on success.
1451
+ *
1452
+ * Lookup rules:
1453
+ * - **Built-in gates** without a configured policy fail closed
1454
+ * (`enabled: false`).
1455
+ * - **App-defined gates** (`app:*`) without a configured policy are
1456
+ * treated as no-op (allow). The developer registered the policy if
1457
+ * they wanted enforcement; absence means the gate is informational.
1458
+ */
1459
+ declare function checkGate(policy: VaultPolicy, gate: GateName, context: CheckGateContext): Promise<void>;
1460
+ /**
1461
+ * Same as {@link checkGate} but returns a structured verdict instead
1462
+ * of throwing. Useful when an error UI wants to show the user
1463
+ * "you'll need TOTP plus a recovery code to do that" without first
1464
+ * triggering the action.
1465
+ */
1466
+ declare function describeGate(policy: VaultPolicy, gate: GateName, context: CheckGateContext): Promise<{
1467
+ ok: true;
1468
+ } | {
1469
+ ok: false;
1470
+ reason: PolicyDenyReason;
1471
+ required: GatePolicy;
1472
+ }>;
1473
+
1474
+ /**
1475
+ * Persistence helpers for the vault-level policy document
1476
+ * (`_meta/policy`). Mirrors the bypass-AES pattern used by
1477
+ * `_meta/handle` — the policy document is plain JSON, the envelope's
1478
+ * `_iv` field is left empty.
758
1479
  *
759
- * - A `Vault` instance — both sides are walked via `exportStream()`.
760
- * - A `Record<collection, records[]>` map — same shape `as-json.toObject()`
761
- * produces. Useful for diffing parsed file content against the live vault.
762
- * - A `VaultDump` (output of `vault.dump()`) — a JSON string carrying the
763
- * full vault state. Parsed and reduced to the map shape above.
1480
+ * @see https://github.com/vLannaAi/noy-db-docs/blob/main/content/docs/services/session-tiers.md → Storage location
1481
+ *
1482
+ * @module
764
1483
  */
765
- type DiffCandidate<T = unknown> = Vault | Record<string, readonly T[]> | string;
1484
+
1485
+ /** Reserved collection name for vault-level metadata documents. */
1486
+ declare const META_COLLECTION = "_meta";
1487
+ /** Reserved id for the vault-level policy document. */
1488
+ declare const POLICY_RECORD_ID = "policy";
766
1489
  /**
767
- * Compute the diff between a live vault and a candidate state.
1490
+ * Read the vault-level policy from `_meta/policy`. Returns `undefined`
1491
+ * when no policy has been persisted (fresh vault, or a vault written
1492
+ * before the policy module landed). The caller falls back to the
1493
+ * default preset.
768
1494
  *
769
- * Returns a fully buffered `VaultDiff` — no streaming. Memory cost is
770
- * O(n + m) in the row count of vault + candidate. For documented
771
- * 1K-50K-record vaults this is fine; a streaming variant lands as a
772
- * follow-up if a > 100K-record consumer arrives.
1495
+ * Tolerates corrupted documents the same way `_meta/handle` does: a
1496
+ * JSON parse failure surfaces as `undefined`, not a thrown error, so
1497
+ * a bad write never permanently locks a vault.
1498
+ */
1499
+ declare function loadVaultPolicy(store: NoydbStore, vault: string): Promise<VaultPolicy | undefined>;
1500
+ /**
1501
+ * Persist the vault-level policy at `_meta/policy`. Idempotent — call
1502
+ * once at vault creation and again on `db.updatePolicy()` invocations.
773
1503
  */
774
- declare function diffVault<T = unknown>(vault: Vault, candidate: DiffCandidate<T>, options?: DiffOptions): Promise<VaultDiff<T>>;
1504
+ declare function saveVaultPolicy(store: NoydbStore, vault: string, policy: VaultPolicy): Promise<void>;
775
1505
 
776
- export { ActiveTier, type CheckGateContext, DEFAULT_FRESHNESS_MS, DIRECTORY_RECORD_ID, type DiffCandidate, DiffEntry, type DiffOptions, DirectoryConfig, FactorProof, GateName, GatePolicy, META_COLLECTION, ManagedRecoveryNotEnrolledError, NoydbError, NoydbStore, PERSONAL_POLICY, POLICY_RECORD_ID, PUBLIC_ENVELOPE_RECORD_ID, type PersistSchemaResult, PersistedSchemaEnvelope, PolicyDeniedError, type PolicyDenyReason, PublicEnvelope, RecoveryNotEnrolledError, RecoveryProfileNotImplementedError, SCHEMAS_COLLECTION, STRICT_POLICY, SchemaUpdateStrategy, UnlockedKeyring, UpdateDecision, UserEnvelope, UserVisibility, VISIBILITY_RECORD_PREFIX, Vault, type VaultDiff, type VaultDiffEntry, type VaultDiffModifiedEntry, VaultPolicy, additiveOnly, assertTierAccess, base64ToBuffer, blindUpdate, bufferToBase64, checkGate, coordinatedCutover, decryptBytes, decryptDeterministic, dekKey, deleteUserEnvelope, deleteUserVisibility, derivePersistedSchema, derivePresenceKey, describeAllUsersAuth, describeAuthConfig, describeGate, describeUserAuth, diagramAuthConfig, diffVault, effectiveClearance, encryptBytes, encryptDeterministic, estimateRecordBytes, isZodSchema, listUserEnvelopeIds, loadPersistedSchema, loadPublicEnvelope, loadUserEnvelope, loadVaultPolicy, lockSchema, mergePolicy, parseBytes, persistDirectoryConfig, persistSchemaIfNeeded, persistUserVisibility, readDirectoryConfig, readPublicEnvelope, readUserVisibility, savePersistedSchema, savePublicEnvelope, saveUserEnvelope, saveVaultPolicy, visibilityRecordId };
1506
+ export { ActiveTier, type AgeRoute, type AllocateOptions, ApproveWithdrawalOptions, type BlobLifecyclePolicy, type BlobStoreRoute, type CheckGateContext, type CircuitBreakerOptions, CollectionDescription, type ComputedDescriptor, CustodyStrategy, DEFAULT_FRESHNESS_MS, DIRECTORY_RECORD_ID, DeepPartialOrNull, type DirectoryConfig, EncryptedEnvelope, ExportAccessibleOptions, FactorProof, type FxRates, GateName, GatePolicy, type HealthCheckOptions, LinkEndpointError, type ListProjectionOptions, LiveUserEnvelope, type LogLevel, type LoggingOptions, META_COLLECTION, type MetricsOptions, type MulRateOptions, NoydbError, NoydbStore, type OverrideOptions, type OverrideTarget, PERSONAL_POLICY, POLICY_RECORD_ID, PUBLIC_ENVELOPE_RECORD_ID, type PersistSchemaResult, PersistedSchemaEnvelope, PolicyDenyReason, PublicEnvelope, RejectWithdrawalOptions, RequestWithdrawalOptions, RequestWithdrawalResult, type RetryOptions, RoundingMode, type RouteStatus, type RouteStoreOptions, type RoutedNoydbStore, SCHEMAS_COLLECTION, STRICT_POLICY, SchemaUpdateStrategy, SearchStrategy, SequenceStrategy, type StoreCacheOptions, type StoreMiddleware, type StoreOperation, type SuspendOptions, type Tokenizer, UnlockedKeyring, Unsubscribe, UpdateDecision, UserApi, UserEnvelope, UserEnvelopePresented, type UserVisibility, VISIBILITY_RECORD_PREFIX, VaultPolicy, ViaDescriptor, WithdrawAccessibleOptions, WithdrawResult, WithdrawalRequest, WithdrawalRequestStatus, additiveOnly, allocate, applyListProjection, assertTierAccess, blindUpdate, checkGate, computed, coordinatedCutover, dekKey, deleteUserEnvelope, deleteUserVisibility, derivePersistedSchema, describeAllUsersAuth, describeAuthConfig, describeGate, describeUserAuth, diagramAuthConfig, effectiveClearance, estimateRecordBytes, isComputedDescriptor, isZodSchema, listUserEnvelopeIds, loadPersistedSchema, loadPublicEnvelope, loadUserEnvelope, loadVaultPolicy, lockSchema, memoryStore, mergePolicy, mulRate, parseBytes, persistDirectoryConfig, persistSchemaIfNeeded, persistUserVisibility, readDirectoryConfig, readPlaintextRecord, readPublicEnvelope, readUserVisibility, routeStore, savePersistedSchema, savePublicEnvelope, saveUserEnvelope, saveVaultPolicy, scaleForCurrency, tokenize, visibilityRecordId, withCache, withCircuitBreaker, withCustody, withHealthCheck, withLogging, withMetrics, withRetry, withSearch, withSequence, wrapStore };