@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
@@ -0,0 +1,225 @@
1
+ import {
2
+ SEQUENCE_COLLECTION
3
+ } from "./chunk-6G5ORS5D.js";
4
+ import {
5
+ SCHEMAS_COLLECTION
6
+ } from "./chunk-T7WSLRAU.js";
7
+ import {
8
+ LEDGER_COLLECTION,
9
+ LEDGER_DELTAS_COLLECTION
10
+ } from "./chunk-I7FD46FF.js";
11
+ import "./chunk-MCHVVJIA.js";
12
+ import "./chunk-QA2KUPCP.js";
13
+ import "./chunk-2OV5NVE7.js";
14
+ import "./chunk-VEPTFUJY.js";
15
+ import "./chunk-HYR4WZZ3.js";
16
+ import "./chunk-LP7BEXCT.js";
17
+ import "./chunk-3OPY6MK2.js";
18
+ import {
19
+ NOYDB_BACKUP_VERSION
20
+ } from "./chunk-YN5IAHN6.js";
21
+ import {
22
+ BackupCorruptedError,
23
+ BackupLedgerError
24
+ } from "./chunk-S7VFUQM2.js";
25
+ import "./chunk-PZ5AY32C.js";
26
+
27
+ // src/with-pod/backup.ts
28
+ async function dumpVault(ctx) {
29
+ const snapshot = await ctx.adapter.loadAll(ctx.vault);
30
+ const keyringIds = await ctx.adapter.list(ctx.vault, "_keyring");
31
+ const keyrings = {};
32
+ for (const keyringId of keyringIds) {
33
+ const envelope = await ctx.adapter.get(ctx.vault, "_keyring", keyringId);
34
+ if (envelope) {
35
+ keyrings[keyringId] = JSON.parse(envelope._data);
36
+ }
37
+ }
38
+ const internalSnapshot = {};
39
+ const internalNames = [
40
+ LEDGER_COLLECTION,
41
+ LEDGER_DELTAS_COLLECTION,
42
+ SCHEMAS_COLLECTION,
43
+ SEQUENCE_COLLECTION,
44
+ "_history",
45
+ // full-snapshot version history — so history()/getVersion()/diff() survive the bundle
46
+ "_blob_index",
47
+ "_blob_chunks",
48
+ "_blob_eviction_audit",
49
+ ...Object.keys(snapshot).flatMap((c) => [`_blob_slots_${c}`, `_blob_versions_${c}`])
50
+ ];
51
+ for (const internalName of internalNames) {
52
+ const ids = await ctx.adapter.list(ctx.vault, internalName);
53
+ if (ids.length === 0) continue;
54
+ const records = {};
55
+ for (const id of ids) {
56
+ const envelope = await ctx.adapter.get(ctx.vault, internalName, id);
57
+ if (envelope) records[id] = envelope;
58
+ }
59
+ internalSnapshot[internalName] = records;
60
+ }
61
+ const ledgerForHead = ctx.getLedgerOrNull();
62
+ const head = ledgerForHead ? await ledgerForHead.head() : null;
63
+ const backup = {
64
+ _noydb_backup: NOYDB_BACKUP_VERSION,
65
+ _compartment: ctx.vault,
66
+ _exported_at: (/* @__PURE__ */ new Date()).toISOString(),
67
+ _exported_by: ctx.userId(),
68
+ keyrings,
69
+ collections: snapshot,
70
+ ...Object.keys(internalSnapshot).length > 0 ? { _internal: internalSnapshot } : {},
71
+ ...head ? {
72
+ ledgerHead: {
73
+ hash: head.hash,
74
+ index: head.entry.index,
75
+ ts: head.entry.ts
76
+ }
77
+ } : {}
78
+ };
79
+ return JSON.stringify(backup);
80
+ }
81
+ async function loadVault(ctx, backupJson) {
82
+ const backup = JSON.parse(backupJson);
83
+ await ctx.adapter.saveAll(ctx.vault, backup.collections);
84
+ for (const [userId, keyringFile] of Object.entries(backup.keyrings)) {
85
+ const envelope = {
86
+ _noydb: 1,
87
+ _v: 1,
88
+ _ts: (/* @__PURE__ */ new Date()).toISOString(),
89
+ _iv: "",
90
+ _data: JSON.stringify(keyringFile)
91
+ };
92
+ await ctx.adapter.put(ctx.vault, "_keyring", userId, envelope);
93
+ }
94
+ if (backup._internal) {
95
+ for (const [internalName, records] of Object.entries(backup._internal)) {
96
+ for (const [id, envelope] of Object.entries(records)) {
97
+ await ctx.adapter.put(ctx.vault, internalName, id, envelope);
98
+ }
99
+ }
100
+ }
101
+ await ctx.reloadKeyringAndRebuildDEK();
102
+ ctx.clearCollectionCache();
103
+ ctx.resetLedgerStore();
104
+ if (!backup.ledgerHead) {
105
+ console.warn(
106
+ `[noy-db] Loaded a legacy backup with no ledgerHead \u2014 verifiable-backup integrity check skipped. Re-export with a ledger-aware build to get tamper detection.`
107
+ );
108
+ return;
109
+ }
110
+ const result = await verifyBackupIntegrity(ctx);
111
+ if (!result.ok) {
112
+ if (result.kind === "data") {
113
+ throw new BackupCorruptedError(
114
+ result.collection,
115
+ result.id,
116
+ result.message
117
+ );
118
+ }
119
+ throw new BackupLedgerError(result.message, result.divergedAt);
120
+ }
121
+ if (result.head !== backup.ledgerHead.hash) {
122
+ throw new BackupLedgerError(
123
+ `Backup ledger head mismatch: embedded "${backup.ledgerHead.hash}" but reconstructed "${result.head}".`
124
+ );
125
+ }
126
+ }
127
+ async function verifyBackupIntegrity(ctx) {
128
+ const ledgerForVerify = ctx.getLedgerOrNull();
129
+ if (!ledgerForVerify) {
130
+ return { ok: true, head: "", length: 0 };
131
+ }
132
+ const chainResult = await ledgerForVerify.verify();
133
+ if (!chainResult.ok) {
134
+ return {
135
+ ok: false,
136
+ kind: "chain",
137
+ divergedAt: chainResult.divergedAt,
138
+ message: `Ledger chain diverged at index ${chainResult.divergedAt}: expected prevHash "${chainResult.expected}" but found "${chainResult.actual}".`
139
+ };
140
+ }
141
+ const allEntries = await ledgerForVerify.loadAllEntries();
142
+ const seen = /* @__PURE__ */ new Set();
143
+ const latest = /* @__PURE__ */ new Map();
144
+ for (let i = allEntries.length - 1; i >= 0; i--) {
145
+ const entry = allEntries[i];
146
+ if (!entry) continue;
147
+ if (entry.op === "amendment" || entry.op === "lifecycle") continue;
148
+ const key = `${entry.collection}/${entry.id}`;
149
+ if (seen.has(key)) continue;
150
+ seen.add(key);
151
+ if (entry.op === "delete") continue;
152
+ latest.set(key, {
153
+ collection: entry.collection,
154
+ id: entry.id,
155
+ expectedHash: entry.payloadHash
156
+ });
157
+ }
158
+ for (const { collection, id, expectedHash } of latest.values()) {
159
+ const envelope = await ctx.adapter.get(ctx.vault, collection, id);
160
+ if (!envelope) {
161
+ return {
162
+ ok: false,
163
+ kind: "data",
164
+ collection,
165
+ id,
166
+ message: `Ledger expects data record "${collection}/${id}" to exist, but the adapter has no envelope for it.`
167
+ };
168
+ }
169
+ const actualHash = await ctx.envelopePayloadHash(envelope);
170
+ if (actualHash !== expectedHash) {
171
+ return {
172
+ ok: false,
173
+ kind: "data",
174
+ collection,
175
+ id,
176
+ message: `Data envelope "${collection}/${id}" has been tampered with: expected payloadHash "${expectedHash}", got "${actualHash}".`
177
+ };
178
+ }
179
+ }
180
+ return {
181
+ ok: true,
182
+ head: chainResult.head,
183
+ length: chainResult.length
184
+ };
185
+ }
186
+ async function exportVaultJSON(ctx, opts = {}) {
187
+ const collections = {};
188
+ let ledgerHead;
189
+ const allDictionaries = {};
190
+ for await (const chunk of ctx.exportStream({
191
+ granularity: "collection",
192
+ withLedgerHead: opts.withLedgerHead === true,
193
+ // Thread the export locale so records are read at the
194
+ // `export` layer (i18nText collapsed + dictKey/staticDict labels resolved).
195
+ ...opts.resolveLabels !== void 0 ? { resolveLabels: opts.resolveLabels } : {}
196
+ })) {
197
+ collections[chunk.collection] = {
198
+ schema: null,
199
+ // Standard Schema validators are not JSON-serializable
200
+ refs: chunk.refs,
201
+ records: chunk.records
202
+ };
203
+ if (chunk.ledgerHead) ledgerHead = chunk.ledgerHead;
204
+ if (!opts.resolveLabels && chunk.dictionaries) {
205
+ allDictionaries[chunk.collection] = chunk.dictionaries;
206
+ }
207
+ }
208
+ const hasDictionaries = Object.keys(allDictionaries).length > 0;
209
+ return JSON.stringify({
210
+ _noydb_export: 1,
211
+ _compartment: ctx.vault,
212
+ _exported_at: (/* @__PURE__ */ new Date()).toISOString(),
213
+ _exported_by: ctx.userId(),
214
+ collections,
215
+ ...hasDictionaries ? { _dictionaries: allDictionaries } : {},
216
+ ...ledgerHead ? { ledgerHead } : {}
217
+ });
218
+ }
219
+ export {
220
+ dumpVault,
221
+ exportVaultJSON,
222
+ loadVault,
223
+ verifyBackupIntegrity
224
+ };
225
+ //# sourceMappingURL=backup-R7NTDFKY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/with-pod/backup.ts"],"sourcesContent":["/**\n * Vault backup / restore / integrity.\n *\n * Holds `dump()` (verifiable encrypted JSON backup, including the blob\n * collections so blob \"covers\" travel in the bundle), `load()` (restore +\n * post-load integrity gate), `verifyBackupIntegrity()` (chain + data-envelope\n * cross-check), and `exportJSON()` (plaintext per-collection export, built on\n * the vault's `exportStream`). Behaviour is byte-identical to the inline\n * `Vault` methods these functions replaced — every dependency the moving code\n * touched on `this.*` arrives via {@link BackupContext}. `Vault` keeps the\n * public methods as thin delegators.\n *\n * Internal — reached through `vault.dump()` / `vault.load()` / etc.\n */\nimport { NOYDB_BACKUP_VERSION } from '../kernel/types.js'\nimport { BackupLedgerError, BackupCorruptedError } from '../kernel/errors.js'\nimport { LEDGER_COLLECTION, LEDGER_DELTAS_COLLECTION } from '../with-commit/history/ledger/constants.js'\nimport { SCHEMAS_COLLECTION } from '../with-shape/persisted-schemas/storage.js'\nimport { SEQUENCE_COLLECTION } from '../with-commit/sequence/index.js'\nimport type {\n NoydbStore,\n EncryptedEnvelope,\n VaultBackup,\n VaultSnapshot,\n ExportStreamOptions,\n ExportChunk,\n} from '../kernel/types.js'\nimport type { LedgerStore } from '../with-commit/history/ledger/store.js'\n\n/** Everything the moving backup methods touched on the vault's `this.*`. */\nexport interface BackupContext {\n /** The ciphertext store. */\n readonly adapter: NoydbStore\n /** Vault namespace name. */\n readonly vault: string\n /** The invoking keyring's user id (read fresh per call). */\n userId(): string\n /** The vault's ledger store, or null when history is off. */\n getLedgerOrNull(): LedgerStore | null\n /** Recompute an envelope's `payloadHash` (bound `historyStrategy.envelopePayloadHash`). */\n envelopePayloadHash(envelope: EncryptedEnvelope): Promise<string>\n /**\n * Refresh the in-memory keyring from the freshly-loaded keyring file and\n * rebuild the DEK resolver. No-op when the vault has no `reloadKeyring`\n * callback (plaintext vaults / test constructions).\n */\n reloadKeyringAndRebuildDEK(): Promise<void>\n /** Clear the vault's collection cache (post-load). */\n clearCollectionCache(): void\n /** Reset the ledger store so the next `ledger()` rebuilds its head cache. */\n resetLedgerStore(): void\n /** The vault's decrypt+ACL export stream (used by `exportJSON`). */\n exportStream(opts: ExportStreamOptions): AsyncIterableIterator<ExportChunk>\n}\n\n/** Result of {@link verifyBackupIntegrity}. */\nexport type VerifyBackupResult =\n | { readonly ok: true; readonly head: string; readonly length: number }\n | {\n readonly ok: false\n readonly kind: 'chain'\n readonly divergedAt: number\n readonly message: string\n }\n | {\n readonly ok: false\n readonly kind: 'data'\n readonly collection: string\n readonly id: string\n readonly message: string\n }\n\n/**\n * Dump vault as a verifiable encrypted JSON backup string.\n *\n * backups embed the current ledger head and the full `_ledger` +\n * `_ledger_deltas` internal collections so the receiver can run\n * `verifyBackupIntegrity()` after `load()` and detect any tampering between\n * dump and restore. Backups produced without a ledger skip the integrity check\n * with a warning — both modes round-trip cleanly.\n */\nexport async function dumpVault(ctx: BackupContext): Promise<string> {\n const snapshot = await ctx.adapter.loadAll(ctx.vault)\n\n // Load keyrings (separate path because loadAll filters them out\n // along with all other underscore-prefixed internal collections).\n const keyringIds = await ctx.adapter.list(ctx.vault, '_keyring')\n const keyrings: Record<string, unknown> = {}\n for (const keyringId of keyringIds) {\n const envelope = await ctx.adapter.get(ctx.vault, '_keyring', keyringId)\n if (envelope) {\n keyrings[keyringId] = JSON.parse(envelope._data)\n }\n }\n\n // Load the ledger entries + deltas so the receiver can replay\n // the chain after restore. Without this, `load()` would have an\n // empty ledger and `verifyBackupIntegrity()` would have nothing\n // to compare against.\n //\n // Also enumerate the blob collections so blob content (\"covers\")\n // travels in the bundle (the blob DEK already travels in `_keyring`).\n // Literals are inlined (not imported from blobs/blob-set.ts) to keep\n // the blob runtime out of this kernel hot path — they mirror\n // BLOB_INDEX/CHUNKS/EVICTION_AUDIT_COLLECTION and SLOTS/VERSIONS_PREFIX.\n // The collect-loop skips empty ids, so this no-ops without blobs.\n const internalSnapshot: VaultSnapshot = {}\n const internalNames = [\n LEDGER_COLLECTION, LEDGER_DELTAS_COLLECTION, SCHEMAS_COLLECTION, SEQUENCE_COLLECTION,\n '_history', // full-snapshot version history — so history()/getVersion()/diff() survive the bundle\n '_blob_index', '_blob_chunks', '_blob_eviction_audit',\n ...Object.keys(snapshot).flatMap((c) => [`_blob_slots_${c}`, `_blob_versions_${c}`]),\n ]\n for (const internalName of internalNames) {\n const ids = await ctx.adapter.list(ctx.vault, internalName)\n if (ids.length === 0) continue\n const records: Record<string, EncryptedEnvelope> = {}\n for (const id of ids) {\n const envelope = await ctx.adapter.get(ctx.vault, internalName, id)\n if (envelope) records[id] = envelope\n }\n internalSnapshot[internalName] = records\n }\n\n // Embed the ledger head if there's a chain. An empty ledger\n // (fresh vault) leaves `ledgerHead` undefined, which\n // load() treats the same as a legacy backup (no integrity\n // check, console warning). If history is not opted in,\n // `getLedgerOrNull` returns null and we skip embedding entirely\n // — the backup is still valid, just without the integrity head.\n const ledgerForHead = ctx.getLedgerOrNull()\n const head = ledgerForHead ? await ledgerForHead.head() : null\n const backup: VaultBackup = {\n _noydb_backup: NOYDB_BACKUP_VERSION,\n _compartment: ctx.vault,\n _exported_at: new Date().toISOString(),\n _exported_by: ctx.userId(),\n keyrings: keyrings as VaultBackup['keyrings'],\n collections: snapshot,\n ...(Object.keys(internalSnapshot).length > 0\n ? { _internal: internalSnapshot }\n : {}),\n ...(head\n ? {\n ledgerHead: {\n hash: head.hash,\n index: head.entry.index,\n ts: head.entry.ts,\n },\n }\n : {}),\n }\n\n return JSON.stringify(backup)\n}\n\n/**\n * Restore a vault from a verifiable backup. After loading, runs\n * `verifyBackupIntegrity()` to confirm the hash chain, the embedded head, and\n * every data envelope's payload hash. Legacy backups (no `ledgerHead`) load\n * with a console warning and skip the integrity check.\n */\nexport async function loadVault(ctx: BackupContext, backupJson: string): Promise<void> {\n const backup = JSON.parse(backupJson) as VaultBackup\n\n // 1. Restore data collections.\n await ctx.adapter.saveAll(ctx.vault, backup.collections)\n\n // 2. Restore keyrings.\n for (const [userId, keyringFile] of Object.entries(backup.keyrings)) {\n const envelope = {\n _noydb: 1 as const,\n _v: 1,\n _ts: new Date().toISOString(),\n _iv: '',\n _data: JSON.stringify(keyringFile),\n }\n await ctx.adapter.put(ctx.vault, '_keyring', userId, envelope)\n }\n\n // 3. Restore internal collections (`_ledger`, `_ledger_deltas`).\n // Required so verifyBackupIntegrity has the chain to walk.\n if (backup._internal) {\n for (const [internalName, records] of Object.entries(backup._internal)) {\n for (const [id, envelope] of Object.entries(records)) {\n await ctx.adapter.put(ctx.vault, internalName, id, envelope)\n }\n }\n }\n\n // 4. Refresh the in-memory keyring from the freshly-loaded\n // keyring file. Without this, the Vault's getDEK\n // closure still holds the OLD session's DEKs, and every\n // decrypt of a loaded ledger entry / data envelope fails\n // with TamperedError because the DEK doesn't match the\n // ciphertext that was encrypted with the SOURCE user's DEK.\n // Skipped for plaintext vaults and for tests that\n // construct Vault without a reloadKeyring callback.\n await ctx.reloadKeyringAndRebuildDEK()\n\n // 5. Clear collection cache + reset the ledger store so the\n // next ledger() call rebuilds its head cache from the\n // freshly-loaded entries.\n ctx.clearCollectionCache()\n ctx.resetLedgerStore()\n\n // 5. Run the verification gate. Legacy backups (no ledgerHead)\n // skip this with a one-line warning so existing consumers can\n // still read them while migrating.\n if (!backup.ledgerHead) {\n console.warn(\n `[noy-db] Loaded a legacy backup with no ledgerHead — ` +\n `verifiable-backup integrity check skipped. ` +\n `Re-export with a ledger-aware build to get tamper detection.`,\n )\n return\n }\n\n const result = await verifyBackupIntegrity(ctx)\n if (!result.ok) {\n // Surface the most specific error class we can. The result\n // shape carries enough info for callers to inspect.\n if (result.kind === 'data') {\n throw new BackupCorruptedError(\n result.collection,\n result.id,\n result.message,\n )\n }\n throw new BackupLedgerError(result.message, result.divergedAt)\n }\n\n // 6. Cross-check: the freshly-verified head must match the\n // value embedded at dump time. A mismatch means someone\n // truncated or extended the chain after dump.\n if (result.head !== backup.ledgerHead.hash) {\n throw new BackupLedgerError(\n `Backup ledger head mismatch: embedded \"${backup.ledgerHead.hash}\" ` +\n `but reconstructed \"${result.head}\".`,\n )\n }\n}\n\n/**\n * End-to-end backup integrity check: `ledger.verify()` (hash chain) plus a data\n * envelope cross-check (every current record's `_data` hash must match the\n * latest `put` entry's `payloadHash`). Returns a discriminated union so callers\n * can distinguish chain vs data failures.\n */\nexport async function verifyBackupIntegrity(ctx: BackupContext): Promise<VerifyBackupResult> {\n // Step 1: chain verification. Without the history strategy there\n // is no ledger; an unaudited backup verifies trivially as `ok`\n // because there's nothing to diverge from.\n const ledgerForVerify = ctx.getLedgerOrNull()\n if (!ledgerForVerify) {\n return { ok: true, head: '', length: 0 }\n }\n const chainResult = await ledgerForVerify.verify()\n if (!chainResult.ok) {\n return {\n ok: false,\n kind: 'chain',\n divergedAt: chainResult.divergedAt,\n message:\n `Ledger chain diverged at index ${chainResult.divergedAt}: ` +\n `expected prevHash \"${chainResult.expected}\" but found \"${chainResult.actual}\".`,\n }\n }\n\n // Step 2: data envelope cross-check. Walk every entry in the\n // ledger and, for the LATEST `put` per (collection, id), recompute\n // the data envelope's payloadHash and compare. Earlier puts of the\n // same id are skipped because the data collection only holds the\n // current version — historical envelopes live in the deltas\n // collection (which is itself protected by the chain).\n // Reuse the ledger we already resolved in step 1.\n const allEntries = await ledgerForVerify.loadAllEntries()\n\n // Find the latest non-delete entry per (collection, id). Walk\n // the entries in reverse so we hit the latest first; mark each\n // (collection, id) as seen and skip subsequent entries.\n const seen = new Set<string>()\n const latest = new Map<\n string,\n { collection: string; id: string; expectedHash: string }\n >()\n for (let i = allEntries.length - 1; i >= 0; i--) {\n const entry = allEntries[i]\n if (!entry) continue\n // Amendment entries are multi-record audit entries whose\n // `collection` and `id` are empty strings — building a `\"/\"`\n // key here would mark that synthetic slot as seen and falsely\n // trip the data check on a record that never existed. Skip\n // them BEFORE the key/seen bookkeeping so they neither\n // tombstone real entries nor enter the latest map.\n if (entry.op === 'amendment' || entry.op === 'lifecycle') continue\n const key = `${entry.collection}/${entry.id}`\n if (seen.has(key)) continue\n seen.add(key)\n // For deletes the data collection should NOT have the record,\n // so we skip — there's nothing to cross-check. Marking the key\n // as seen above ensures any earlier `put` of the same id is\n // also skipped (the record was subsequently deleted).\n if (entry.op === 'delete') continue\n latest.set(key, {\n collection: entry.collection,\n id: entry.id,\n expectedHash: entry.payloadHash,\n })\n }\n\n for (const { collection, id, expectedHash } of latest.values()) {\n const envelope = await ctx.adapter.get(ctx.vault, collection, id)\n if (!envelope) {\n return {\n ok: false,\n kind: 'data',\n collection,\n id,\n message:\n `Ledger expects data record \"${collection}/${id}\" to exist, ` +\n `but the adapter has no envelope for it.`,\n }\n }\n const actualHash = await ctx.envelopePayloadHash(envelope)\n if (actualHash !== expectedHash) {\n return {\n ok: false,\n kind: 'data',\n collection,\n id,\n message:\n `Data envelope \"${collection}/${id}\" has been tampered with: ` +\n `expected payloadHash \"${expectedHash}\", got \"${actualHash}\".`,\n }\n }\n }\n\n return {\n ok: true,\n head: chainResult.head,\n length: chainResult.length,\n }\n}\n\n/**\n * Plaintext per-collection export, built on the vault's `exportStream`. Forces\n * collection granularity (record-by-record output makes no sense in a single\n * string) and merges dictionary snapshots across collections.\n */\nexport async function exportVaultJSON(ctx: BackupContext, opts: ExportStreamOptions = {}): Promise<string> {\n // Force per-collection granularity regardless of caller setting:\n // record-by-record output doesn't make sense in a single string.\n const collections: Record<\n string,\n {\n schema: null\n refs: Record<string, { target: string; mode: 'strict' | 'warn' | 'cascade' }>\n records: unknown[]\n }\n > = {}\n let ledgerHead: ExportChunk['ledgerHead'] | undefined\n // Merged dictionary snapshot across all collections.\n // Only populated when `resolveLabels` is not set.\n const allDictionaries: Record<\n string, // collection name\n Record<string, Record<string, Record<string, string>>>\n > = {}\n\n for await (const chunk of ctx.exportStream({\n granularity: 'collection',\n withLedgerHead: opts.withLedgerHead === true,\n // Thread the export locale so records are read at the\n // `export` layer (i18nText collapsed + dictKey/staticDict labels resolved).\n ...(opts.resolveLabels !== undefined ? { resolveLabels: opts.resolveLabels } : {}),\n })) {\n collections[chunk.collection] = {\n schema: null, // Standard Schema validators are not JSON-serializable\n refs: chunk.refs,\n records: chunk.records,\n }\n if (chunk.ledgerHead) ledgerHead = chunk.ledgerHead\n // Collect dictionary snapshots unless resolveLabels is set\n if (!opts.resolveLabels && chunk.dictionaries) {\n allDictionaries[chunk.collection] = chunk.dictionaries\n }\n }\n\n const hasDictionaries = Object.keys(allDictionaries).length > 0\n return JSON.stringify({\n _noydb_export: 1,\n _compartment: ctx.vault,\n _exported_at: new Date().toISOString(),\n _exported_by: ctx.userId(),\n collections,\n ...(hasDictionaries ? { _dictionaries: allDictionaries } : {}),\n ...(ledgerHead ? { ledgerHead } : {}),\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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KAAK,UAAU;AAAA,IACpB,eAAe;AAAA,IACf,cAAc,IAAI;AAAA,IAClB,eAAc,oBAAI,KAAK,GAAE,YAAY;AAAA,IACrC,cAAc,IAAI,OAAO;AAAA,IACzB;AAAA,IACA,GAAI,kBAAkB,EAAE,eAAe,gBAAgB,IAAI,CAAC;AAAA,IAC5D,GAAI,aAAa,EAAE,WAAW,IAAI,CAAC;AAAA,EACrC,CAAC;AACH;","names":[]}
@@ -1,11 +1,8 @@
1
- import { B as BlobStrategy } from '../types-Df28QFKb.js';
2
- export { z as BLOB_CHUNKS_COLLECTION, A as BLOB_COLLECTION, C as BLOB_EVICTION_AUDIT_COLLECTION, E as BLOB_INDEX_COLLECTION, F as BLOB_SLOTS_PREFIX, G as BLOB_VERSIONS_PREFIX, H as BlobEvictionEntry, J as BlobFieldPolicy, K as BlobFieldsConfig, M as BlobObject, N as BlobPutOptions, Q as BlobResponseOptions, T as BlobSet, U as BlobStrategyOpenArgs, V as CompactRunOptions, W as CompactionContext, X as CompactionResult, Y as DEFAULT_CHUNK_SIZE, Z as EXPORT_AUDIT_COLLECTION, _ as ExportBlobsAbortedError, $ as ExportBlobsAuditEntry, a0 as ExportBlobsHandle, a1 as ExportBlobsOptions, a2 as ExportedBlob, a3 as SlotInfo, a4 as SlotRecord, a5 as VersionRecord, a6 as createExportBlobsHandle, a7 as runCompaction } from '../types-Df28QFKb.js';
3
- export { d as detectMagic, a as detectMimeType, i as isPreCompressed } from '../mime-magic-CBBSOkjm.js';
4
- import '../lazy-builder-7tIpFyWN.js';
5
- import '../predicate-BSAGEyu5.js';
6
- import '../strategy-DSTrsZ8t.js';
7
- import '../strategy-BSxFXGzb.js';
8
- import '../index-D8I_pyJD.js';
1
+ import { B as BlobStrategy } from '../index-DjWbxsjb.js';
2
+ export { e as BLOB_CHUNKS_COLLECTION, f as BLOB_COLLECTION, g as BLOB_EVICTION_AUDIT_COLLECTION, h as BLOB_INDEX_COLLECTION, i as BLOB_SLOTS_PREFIX, j as BLOB_VERSIONS_PREFIX, k as BlobEvictionEntry, l as BlobFieldPolicy, m as BlobFieldsConfig, n as BlobObject, o as BlobPutOptions, p as BlobResponseOptions, q as BlobSet, r as BlobStrategyOpenArgs, C as CompactRunOptions, s as CompactionContext, t as CompactionResult, D as DEFAULT_CHUNK_SIZE, E as EXPORT_AUDIT_COLLECTION, u as ExportBlobsAbortedError, w as ExportBlobsAuditEntry, x as ExportBlobsHandle, y as ExportBlobsOptions, z as ExportedBlob, O as ObjectListEntry, A as ObjectMeta, F as ObjectProjection, G as ObjectUrlOptions, H as PutObjectOptions, I as PutUrlOptions, J as SlotInfo, K as SlotRecord, L as VersionRecord, M as createExportBlobsHandle, N as memoryObjectProjection, Q as runCompaction } 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
+ import '../subject-index-CyOgGMJL.js';
5
+ import '../index-B9QdHytu.js';
9
6
  import '@noy-db/attestation';
10
7
 
11
8
  /**
@@ -1,3 +1,14 @@
1
+ import {
2
+ importExternalObjects,
3
+ memoryObjectProjection
4
+ } from "../chunk-4Q6HSHHL.js";
5
+ import {
6
+ BLOB_EVICTION_AUDIT_COLLECTION,
7
+ EXPORT_AUDIT_COLLECTION,
8
+ ExportBlobsAbortedError,
9
+ createExportBlobsHandle,
10
+ runCompaction
11
+ } from "../chunk-BQISD5ZV.js";
1
12
  import {
2
13
  BLOB_CHUNKS_COLLECTION,
3
14
  BLOB_COLLECTION,
@@ -9,19 +20,19 @@ import {
9
20
  detectMagic,
10
21
  detectMimeType,
11
22
  isPreCompressed
12
- } from "../chunk-QODLLGQ7.js";
13
- import {
14
- BLOB_EVICTION_AUDIT_COLLECTION,
15
- EXPORT_AUDIT_COLLECTION,
16
- ExportBlobsAbortedError,
17
- createExportBlobsHandle,
18
- runCompaction
19
- } from "../chunk-3BFJOWSU.js";
20
- import "../chunk-WIRRPTFH.js";
21
- import "../chunk-PP6W64Y3.js";
22
- import "../chunk-B6PB7JLN.js";
23
+ } from "../chunk-XH7XP3OL.js";
24
+ import "../chunk-MCHVVJIA.js";
25
+ import "../chunk-QA2KUPCP.js";
26
+ import "../chunk-2OV5NVE7.js";
27
+ import "../chunk-VEPTFUJY.js";
28
+ import "../chunk-HYR4WZZ3.js";
29
+ import "../chunk-LP7BEXCT.js";
30
+ import "../chunk-3OPY6MK2.js";
31
+ import "../chunk-YN5IAHN6.js";
32
+ import "../chunk-S7VFUQM2.js";
33
+ import "../chunk-PZ5AY32C.js";
23
34
 
24
- // src/blobs/active.ts
35
+ // src/via/blob/active.ts
25
36
  function withBlobs() {
26
37
  return {
27
38
  openSlot(args) {
@@ -43,7 +54,9 @@ export {
43
54
  createExportBlobsHandle,
44
55
  detectMagic,
45
56
  detectMimeType,
57
+ importExternalObjects,
46
58
  isPreCompressed,
59
+ memoryObjectProjection,
47
60
  runCompaction,
48
61
  withBlobs
49
62
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/blobs/active.ts"],"sourcesContent":["/**\n * Active blob strategy factory. Calling `blobs()` returns a\n * `BlobStrategy` whose `openSlot` constructs a real `BlobSet` bound\n * to the caller's record. The returned strategy is passed into\n * `createNoydb({ blobStrategy: blobs() })` to light up the\n * `collection.blob(id)` path.\n *\n * This module is only reachable through the `@noy-db/hub/blobs`\n * subpath — a consumer that never imports the subpath ships none of\n * this (ESM tree-shaking + hub's `\"sideEffects\": false`).\n */\n\nimport { BlobSet } from './blob-set.js'\nimport type { BlobStrategy } from './strategy.js'\n\n/**\n * Build a default `BlobStrategy` ready to pass into `createNoydb`.\n *\n * Named `withBlobs` (plugin-pattern canonical) rather than `blobs` to\n * avoid shadowing the very common local idiom\n * `const blobs = invoices.blob(id)` in user code.\n *\n * @example\n * ```ts\n * import { createNoydb } from '@noy-db/hub'\n * import { withBlobs } from '@noy-db/hub/blobs'\n *\n * const db = await createNoydb({\n * store, user, secret,\n * blobStrategy: withBlobs(),\n * })\n *\n * // Now live — delegates to BlobSet.\n * await db.vault('acme').collection('invoices').blob('inv-1').put('receipt.pdf', bytes)\n * ```\n */\nexport function withBlobs(): BlobStrategy {\n return {\n openSlot(args) {\n return new BlobSet(args)\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoCO,SAAS,YAA0B;AACxC,SAAO;AAAA,IACL,SAAS,MAAM;AACb,aAAO,IAAI,QAAQ,IAAI;AAAA,IACzB;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/via/blob/active.ts"],"sourcesContent":["/**\n * Active blob strategy factory. Calling `blobs()` returns a\n * `BlobStrategy` whose `openSlot` constructs a real `BlobSet` bound\n * to the caller's record. The returned strategy is passed into\n * `createNoydb({ blobStrategy: blobs() })` to light up the\n * `collection.blob(id)` path.\n *\n * This module is only reachable through the `@noy-db/hub/blobs`\n * subpath — a consumer that never imports the subpath ships none of\n * this (ESM tree-shaking + hub's `\"sideEffects\": false`).\n */\n\nimport { BlobSet } from '../../with-shape/blobs/blob-set.js'\nimport type { BlobStrategy } from '../../port/with/blob-strategy.js'\n\n/**\n * Build a default `BlobStrategy` ready to pass into `createNoydb`.\n *\n * Named `withBlobs` (plugin-pattern canonical) rather than `blobs` to\n * avoid shadowing the very common local idiom\n * `const blobs = invoices.blob(id)` in user code.\n *\n * @example\n * ```ts\n * import { createNoydb } from '@noy-db/hub'\n * import { withBlobs } from '@noy-db/hub/blobs'\n *\n * const db = await createNoydb({\n * store, user, secret,\n * blobStrategy: withBlobs(),\n * })\n *\n * // Now live — delegates to BlobSet.\n * await db.vault('acme').collection('invoices').blob('inv-1').put('receipt.pdf', bytes)\n * ```\n */\nexport function withBlobs(): BlobStrategy {\n return {\n openSlot(args) {\n return new BlobSet(args)\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,SAAS,YAA0B;AACxC,SAAO;AAAA,IACL,SAAS,MAAM;AACb,aAAO,IAAI,QAAQ,IAAI;AAAA,IACzB;AAAA,EACF;AACF;","names":[]}
@@ -1,52 +1,13 @@
1
- import { T as TransferSealPayload } from '../ulid-CJ8RzRrm.js';
2
- export { C as COMPRESSION_BROTLI, a as COMPRESSION_GZIP, b as COMPRESSION_NONE, c as CompressionAlgo, F as FLAG_COMPRESSED, d as FLAG_HAS_INTEGRITY_HASH, 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, i as encodeBundleHeader, j as generateULID, k as isULID, r as readNoydbBundle, l as readNoydbBundleHeader, m as resetBrotliSupportCache, v as validateBundleHeader, w as writeNoydbBundle } from '../ulid-CJ8RzRrm.js';
3
- import { bw as Vault, b3 as NoydbStore, bs as SealingKeyProvider, bx as RecoveryEnrollmentInput, by as ShamirRecoveryProvider } from '../types-Df28QFKb.js';
4
- export { p as AdoptionStateError, B as BackupCorruptedError, q as BackupLedgerError, r as BundleIntegrityError, s as BundleSealMismatchError, t as BundleVersionConflictError, P as PartitionExtractionError, u as TransferSealError } from '../index-D8I_pyJD.js';
5
- import '../lazy-builder-7tIpFyWN.js';
6
- import '../predicate-BSAGEyu5.js';
7
- import '../strategy-DSTrsZ8t.js';
8
- import '../strategy-BSxFXGzb.js';
1
+ import { T as TransferSealPayload } from '../bundle-D6GxiUfq.js';
2
+ export { C as COMPRESSION_BROTLI, b as COMPRESSION_GZIP, c as COMPRESSION_NONE, d as CompressionAlgo, F as FLAG_COMPRESSED, e as FLAG_HAS_INTEGRITY_HASH, 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, l as encodeBundleHeader, m as readNoydbBundle, n as readNoydbBundleHeader, r as readPod, a as readPodHeader, o as resetBrotliSupportCache, v as validateBundleHeader, p as writeNoydbBundle, w as writePod } from '../bundle-D6GxiUfq.js';
3
+ export { g as generateULID, i as isULID } from '../ulid-DRH25k3y.js';
4
+ import { V as Vault, dm as WalkClosureOptions, c_ as NoydbStore, dn as SealingKeyProvider, dp as RecoveryEnrollmentInput, dq as ShamirRecoveryProvider, dr as EnclaveKey } from '../index-DjWbxsjb.js';
5
+ export { ds as AdoptionStateError, dt as BackupCorruptedError, du as BackupLedgerError, dv as BundleIntegrityError, dw as BundleSealMismatchError, dx as BundleVersionConflictError, dy as ClosureResult, dz as ExtractPartitionResult, dA as PartitionExtractionError, dB as PodVersionConflictError, dC as TransferSealError, dD as extractPartition, dE as walkClosure } from '../index-DjWbxsjb.js';
6
+ export { D as DecryptedRecord, d as decryptExtractedPartition } from '../decrypt-partition-IHtxEnTi.js';
7
+ import '../subject-index-CyOgGMJL.js';
8
+ import '../index-B9QdHytu.js';
9
9
  import '@noy-db/attestation';
10
10
 
11
- /**
12
- * Transitive-closure FK walker. Computes the set of
13
- * (collection, id) tuples reachable from seed predicates, so a
14
- * partition extraction ships a referentially-complete subset.
15
- *
16
- * Two-phase, plaintext, read-only (runs inside the unlocked vault
17
- * session — see foundation §13.4 / spec invariant 7):
18
- * 1. INBOUND expansion: from selected records, pull every record
19
- * that references them (children travel with parents), to a
20
- * fixed point.
21
- * 2. OUTBOUND completion: pull every parent the selected set
22
- * references (no dangling FKs), transitively, WITHOUT
23
- * re-expanding inbound from those parents (bounds the closure).
24
- *
25
- * The FK graph is auto-derived from the vault's existing RefRegistry
26
- * (the `ref('target')` declarations on collections) — no hand-written
27
- * edge list. See the design spec §4.1.
28
- *
29
- * @module
30
- */
31
-
32
- /** Seed predicate per collection. Records that return true become roots. */
33
- interface WalkClosureOptions {
34
- readonly seeds: Record<string, (record: Record<string, unknown>) => boolean | Promise<boolean>>;
35
- /** Max fixed-point iterations before throwing. Default 16. */
36
- readonly maxDepth?: number;
37
- }
38
- interface ClosureResult {
39
- /** collection → set of record ids that travel together. */
40
- readonly closure: Map<string, Set<string>>;
41
- readonly graph: {
42
- /** Fixed-point iterations the walk needed to converge. */
43
- readonly depth: number;
44
- /** True if an edge pointed back to an already-selected node. */
45
- readonly cyclesDetected: boolean;
46
- };
47
- }
48
- declare function walkClosure(vault: Vault, opts: WalkClosureOptions): Promise<ClosureResult>;
49
-
50
11
  /**
51
12
  * Partition-extraction dry-run. Read-only preview of what an
52
13
  * `extractPartition` would move: record counts, byte totals, and the
@@ -81,38 +42,22 @@ interface ExtractionPreview {
81
42
  declare function describeExtraction(vault: Vault, opts: WalkClosureOptions): Promise<ExtractionPreview>;
82
43
 
83
44
  /**
84
- * Partition extraction. Walks the FK closure, re-encrypts
85
- * the selected records under fresh per-collection DEKs, seals those DEKs
86
- * under a one-time transfer key, and serializes an unowned
87
- * `extracted-partition` bundle.
45
+ * Partition adoption. Recipient side: verify an extracted bundle,
46
+ * validate the transfer key, import the re-keyed collections into a
47
+ * destination store, and record an `_meta/adoption` marker. The bundle
48
+ * stays UNOWNED after adoption — `createOwnerOnAdoptedPartition`
49
+ * mints the owner; the transfer seal is then destroyed.
88
50
  *
89
51
  * @module
90
52
  */
91
53
 
92
- interface ExtractPartitionResult {
93
- readonly bundleBytes: Uint8Array;
94
- /** Raw 32-byte transfer key — deliver out-of-band; required to adopt. */
95
- readonly transferKey: Uint8Array;
96
- readonly sealId: string;
97
- }
98
- /**
99
- * Extract a re-keyed, transfer-sealed partition. Owner-only
100
- * (invariant 5): producing a standalone re-keyed vault is an
101
- * ownership operation. Non-destructive on the source.
102
- */
103
- declare function extractPartition(vault: Vault, opts: WalkClosureOptions & {
104
- readonly compression?: 'auto' | 'brotli' | 'gzip' | 'none';
105
- readonly carrySchemas?: boolean;
106
- readonly carryLedger?: boolean;
107
- }): Promise<ExtractPartitionResult>;
108
-
109
54
  /**
110
55
  * Reverse of `sealDeks`. Imports the transfer key, decrypts the
111
56
  * sealed `{ collection: base64(rawDEK) }` map (layout iv(12)‖ct‖tag), and
112
57
  * re-imports each DEK as an AES-GCM key. Throws `TransferSealError` on a
113
58
  * wrong key (AES-GCM auth-tag failure) or malformed payload.
114
59
  */
115
- declare function unsealDeks(seal: TransferSealPayload, transferKey: Uint8Array): Promise<Map<string, CryptoKey>>;
60
+ declare function unsealDeks(seal: TransferSealPayload, transferKey: Uint8Array): Promise<Map<string, EnclaveKey>>;
116
61
  interface AdoptPartitionOptions {
117
62
  readonly transferKey: Uint8Array;
118
63
  readonly destinationStore: NoydbStore;
@@ -173,4 +118,4 @@ type CreateOwnerOptions = CreateOwnerStandardOptions | CreateOwnerManagedOptions
173
118
  */
174
119
  declare function createOwnerOnAdoptedPartition(store: NoydbStore, vaultName: string, opts: CreateOwnerOptions): Promise<CreateOwnerResult>;
175
120
 
176
- export { type AdoptPartitionOptions, type AdoptPartitionResult, type ClosureResult, type CreateOwnerManagedOptions, type CreateOwnerOptions, type CreateOwnerResult, type CreateOwnerStandardOptions, type ExtractPartitionResult, type ExtractionPreview, type WalkClosureOptions, adoptPartition, createOwnerOnAdoptedPartition, describeExtraction, extractPartition, unsealDeks, walkClosure };
121
+ export { type AdoptPartitionOptions, type AdoptPartitionResult, type CreateOwnerManagedOptions, type CreateOwnerOptions, type CreateOwnerResult, type CreateOwnerStandardOptions, type ExtractionPreview, WalkClosureOptions, adoptPartition, createOwnerOnAdoptedPartition, describeExtraction, unsealDeks };