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

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 (367) hide show
  1. package/dist/aggregate/index.js +4 -4
  2. package/dist/api-UPAT2O3M.js +20 -0
  3. package/dist/as/index.js +12 -12
  4. package/dist/attestation/index.js +18 -18
  5. package/dist/{backup-YPUEKIJC.js → backup-JL2GOTYQ.js} +11 -11
  6. package/dist/blobs/index.js +27 -15
  7. package/dist/blobs/index.js.map +1 -1
  8. package/dist/broker/index.js +12 -12
  9. package/dist/by/index.js +2 -2
  10. package/dist/cargo/index.js +51 -22
  11. package/dist/{chunk-QDPZWTN2.js → chunk-25G7U6RD.js} +2 -2
  12. package/dist/{chunk-WKGF2TJR.js → chunk-25ZDB25Z.js} +2 -2
  13. package/dist/{chunk-5WZXVULX.js → chunk-2ITLQZV5.js} +2 -2
  14. package/dist/{chunk-WNGGJWF7.js → chunk-2JZ763FV.js} +2 -2
  15. package/dist/{chunk-U6JMEH2P.js → chunk-2KL6NDD4.js} +90 -3
  16. package/dist/chunk-2KL6NDD4.js.map +1 -0
  17. package/dist/{chunk-RJ6K6K5M.js → chunk-2RMDVWGB.js} +2 -2
  18. package/dist/{chunk-VAIS3SOM.js → chunk-2U7Y7BNJ.js} +2 -2
  19. package/dist/{chunk-WZSHL6DQ.js → chunk-2VUISNGP.js} +5 -5
  20. package/dist/chunk-2YELV6TV.js +1 -0
  21. package/dist/{chunk-ANATMTOA.js → chunk-3O62PVDW.js} +3 -3
  22. package/dist/{chunk-VKCADNMR.js → chunk-4JYYIFHW.js} +12 -12
  23. package/dist/{chunk-6HY2X62D.js → chunk-5BB3N4KU.js} +2 -2
  24. package/dist/{chunk-VCTXU4AT.js → chunk-5BHNQNBI.js} +1 -1
  25. package/dist/chunk-5BHNQNBI.js.map +1 -0
  26. package/dist/{chunk-6NQMXTYC.js → chunk-5OZCCLNC.js} +2 -2
  27. package/dist/{chunk-HOONYZY2.js → chunk-5P5AAXYA.js} +2 -2
  28. package/dist/{chunk-KS6SAVCZ.js → chunk-5SZ24DL5.js} +6 -6
  29. package/dist/{chunk-NCCBLYEB.js → chunk-7B4GPCX7.js} +5 -5
  30. package/dist/{chunk-SV6EAJEP.js → chunk-A64XXIIB.js} +4 -4
  31. package/dist/{chunk-WOM2HTML.js → chunk-AFBJHD55.js} +5 -5
  32. package/dist/{chunk-RFI7GGFO.js → chunk-BCOKZC4B.js} +2 -2
  33. package/dist/{chunk-XUW3PXHU.js → chunk-BVZGNMVM.js} +4 -16
  34. package/dist/{chunk-XUW3PXHU.js.map → chunk-BVZGNMVM.js.map} +1 -1
  35. package/dist/{chunk-MT62YSPZ.js → chunk-BZEPJJOK.js} +4 -4
  36. package/dist/{chunk-OCVM6KDH.js → chunk-BZK6JEX4.js} +5 -5
  37. package/dist/{chunk-H2KSZMIX.js → chunk-CCT4WZI6.js} +5 -5
  38. package/dist/{chunk-VEALDPHW.js → chunk-CGPO3ZYB.js} +2 -2
  39. package/dist/{chunk-S3BFKGET.js → chunk-DEQ2JTBR.js} +3 -3
  40. package/dist/{chunk-3ELCWU56.js → chunk-E2R5NRZD.js} +2 -2
  41. package/dist/{chunk-BOKIKJJB.js → chunk-EDC6MLXV.js} +2 -2
  42. package/dist/chunk-F4COUZLL.js +24 -0
  43. package/dist/chunk-F4COUZLL.js.map +1 -0
  44. package/dist/{chunk-JRBNCUNT.js → chunk-FLHOTGOO.js} +3 -3
  45. package/dist/{chunk-6XE5TMPR.js → chunk-GBEXTC6Z.js} +3 -3
  46. package/dist/{chunk-YZQOGE2L.js → chunk-GS3Q2KOZ.js} +2 -2
  47. package/dist/{chunk-M75ZZHSR.js → chunk-GYB2QK5H.js} +2 -2
  48. package/dist/{chunk-EO43ANYJ.js → chunk-GZ2GKOF6.js} +3 -3
  49. package/dist/{chunk-VCBHAE4R.js → chunk-H4SMS4O2.js} +2 -2
  50. package/dist/{chunk-LVGTA624.js → chunk-HGVFJL63.js} +4 -4
  51. package/dist/{chunk-554KLAAN.js → chunk-HVZT5T22.js} +5 -5
  52. package/dist/{chunk-CJ5KKU6X.js → chunk-IGAIOGCN.js} +4 -4
  53. package/dist/{chunk-W2OG6JOL.js → chunk-IGM563N5.js} +18 -1
  54. package/dist/chunk-IGM563N5.js.map +1 -0
  55. package/dist/{chunk-GWKAVKHI.js → chunk-ITI3SJRB.js} +2 -2
  56. package/dist/{chunk-CZTLE22N.js → chunk-IU22SQGU.js} +7 -7
  57. package/dist/{chunk-RTEK4C4I.js → chunk-IUIVDVXM.js} +2 -2
  58. package/dist/{chunk-Z4PD65VQ.js → chunk-IZX3WZBF.js} +4 -4
  59. package/dist/{chunk-RDXW3OBQ.js → chunk-J3VW4J4E.js} +2 -2
  60. package/dist/{chunk-IK43HLDQ.js → chunk-J6U4BOKP.js} +11 -11
  61. package/dist/{chunk-XJMBYYQK.js → chunk-JA5B3SLH.js} +2 -2
  62. package/dist/{chunk-IAO54J4R.js → chunk-JA5O7UEZ.js} +6 -6
  63. package/dist/{chunk-6HPG2YNX.js → chunk-JKWNG3TM.js} +2 -2
  64. package/dist/{chunk-WQIYTNJV.js → chunk-JLHKBAFY.js} +3 -3
  65. package/dist/{chunk-ISMV2QVG.js → chunk-KMONEHDJ.js} +2 -2
  66. package/dist/{chunk-XTHCN77N.js → chunk-KR5EGWI4.js} +7 -19
  67. package/dist/chunk-KR5EGWI4.js.map +1 -0
  68. package/dist/{chunk-JBBSYJHP.js → chunk-KVHWEPT2.js} +2 -2
  69. package/dist/{chunk-2PCAVW2I.js → chunk-L4OA7G5T.js} +2 -2
  70. package/dist/{chunk-IY23KFNZ.js → chunk-LLVW4V7R.js} +3 -3
  71. package/dist/{chunk-N6WF5PKC.js → chunk-M25ZIEB2.js} +2 -2
  72. package/dist/{chunk-FXZDAV62.js → chunk-MEKAMERX.js} +5 -7
  73. package/dist/{chunk-FXZDAV62.js.map → chunk-MEKAMERX.js.map} +1 -1
  74. package/dist/{chunk-UC2ETWF3.js → chunk-MSO2C3KG.js} +2 -2
  75. package/dist/{chunk-ONTBCHCP.js → chunk-N4FZ6ITM.js} +2 -2
  76. package/dist/{chunk-DRWBEDYO.js → chunk-NM4LVUXH.js} +2 -2
  77. package/dist/{chunk-DSBQODMZ.js → chunk-NOT7XA7Q.js} +5 -5
  78. package/dist/{chunk-RA5VTXXG.js → chunk-OGFPMCSP.js} +2 -2
  79. package/dist/{chunk-WHXXI3W5.js → chunk-OGY4ELVE.js} +3 -3
  80. package/dist/{chunk-T36RFODW.js → chunk-OOTTXUNV.js} +2 -2
  81. package/dist/{chunk-A5BDDEXK.js → chunk-OTU5ZI3U.js} +4 -4
  82. package/dist/{chunk-THVIPWRF.js → chunk-OVFCAS7U.js} +9 -9
  83. package/dist/{chunk-IFJTPAQQ.js → chunk-OWE4BNTM.js} +4 -4
  84. package/dist/{chunk-W4TCUGQR.js → chunk-PEY6ZTCF.js} +12 -8
  85. package/dist/{chunk-W4TCUGQR.js.map → chunk-PEY6ZTCF.js.map} +1 -1
  86. package/dist/{chunk-UDSR4X4L.js → chunk-PWZKD4HW.js} +74 -10
  87. package/dist/chunk-PWZKD4HW.js.map +1 -0
  88. package/dist/{chunk-HQBM64EE.js → chunk-QAFWRGVD.js} +127 -8
  89. package/dist/chunk-QAFWRGVD.js.map +1 -0
  90. package/dist/{chunk-ZXEZCY6F.js → chunk-QCUH2G77.js} +6 -6
  91. package/dist/{chunk-XDIAFPUM.js → chunk-QDNVHA2F.js} +2 -2
  92. package/dist/{chunk-FH52K7EG.js → chunk-QRHEAZ2Q.js} +2 -6
  93. package/dist/{chunk-FH52K7EG.js.map → chunk-QRHEAZ2Q.js.map} +1 -1
  94. package/dist/{chunk-A4FXFAKF.js → chunk-QXPOEAKR.js} +2 -2
  95. package/dist/{chunk-EWPOHMN2.js → chunk-RGL53NXZ.js} +3 -3
  96. package/dist/{chunk-TAGR72IR.js → chunk-RI3OKC3Y.js} +4 -4
  97. package/dist/{chunk-5PFOMHTB.js → chunk-S3OYXPSE.js} +9 -9
  98. package/dist/{chunk-JVBO4SZL.js → chunk-STR7WBOB.js} +2 -2
  99. package/dist/{chunk-DDHM2TLX.js → chunk-T7S4V52L.js} +4 -4
  100. package/dist/{chunk-WG4QBZDN.js → chunk-TYBXP6WE.js} +7 -7
  101. package/dist/{chunk-T3GY65MA.js → chunk-UEO5CHOP.js} +3 -3
  102. package/dist/{chunk-RNG4VRP4.js → chunk-V3YB7RGR.js} +3 -3
  103. package/dist/{chunk-R3BLCFD2.js → chunk-V7RGFJ3Z.js} +6 -6
  104. package/dist/{chunk-SMIRGMS7.js → chunk-VEX6G3YL.js} +2 -2
  105. package/dist/{chunk-PK6JIDQ4.js → chunk-VZELV7ZJ.js} +116 -119
  106. package/dist/chunk-VZELV7ZJ.js.map +1 -0
  107. package/dist/{chunk-GULTLPFB.js → chunk-XGVDLQJE.js} +3 -3
  108. package/dist/{chunk-JFCV5QIK.js → chunk-XULHFSHO.js} +5 -5
  109. package/dist/{chunk-S6Q37VGE.js → chunk-XW7NWO4A.js} +2 -2
  110. package/dist/{chunk-YCH5GBN6.js → chunk-Y5E6CH6S.js} +6 -6
  111. package/dist/{chunk-GDG5VVYG.js → chunk-YG2EG6CB.js} +4 -4
  112. package/dist/{chunk-UHNGNKLV.js → chunk-YGBIBOCR.js} +307 -17
  113. package/dist/chunk-YGBIBOCR.js.map +1 -0
  114. package/dist/{chunk-YTGDPCPW.js → chunk-YHPUDB7Q.js} +2 -2
  115. package/dist/{chunk-VRBTNCM4.js → chunk-ZJGZDOQO.js} +6 -6
  116. package/dist/classified/index.js +5 -5
  117. package/dist/{classified-marker-QWMASIT7.js → classified-marker-7S5IEP6Q.js} +3 -3
  118. package/dist/collection-facade-ENLTJZBT.js +44 -0
  119. package/dist/{computed-DSMPXG2Y.js → computed-WZNKRLCY.js} +3 -3
  120. package/dist/consent/index.js +9 -9
  121. package/dist/cover-B5MY43CK.js +36 -0
  122. package/dist/{dead-filter-66VGI6JV.js → dead-filter-KRRD57MR.js} +2 -2
  123. package/dist/delegation-UT76AQIG.js +25 -0
  124. package/dist/derivations/index.js +12 -12
  125. package/dist/derive-SGRCCKVP.js +21 -0
  126. package/dist/{enclave-TKPN2G2U.js → enclave-YFKA3GJT.js} +11 -9
  127. package/dist/executor-TEZYRDN3.js +9 -0
  128. package/dist/executor-UF7LTX6O.js +26 -0
  129. package/dist/executor-WQQRU6DO.js +9 -0
  130. package/dist/export-accessible-HXMKW5LJ.js +23 -0
  131. package/dist/extract-partition-QGQ2R42J.js +38 -0
  132. package/dist/{fanout-sidecar-B5LVUMQX.js → fanout-sidecar-HJV3A7PM.js} +9 -9
  133. package/dist/find-VV6PBIHK.js +11 -0
  134. package/dist/forget/index.js +9 -9
  135. package/dist/guards/index.js +3 -3
  136. package/dist/history/index.js +12 -12
  137. package/dist/i18n/index.js +14 -14
  138. package/dist/index.d.ts +1 -4
  139. package/dist/index.js +151 -168
  140. package/dist/index.js.map +1 -1
  141. package/dist/indexing/index.js +2 -2
  142. package/dist/issue-7JJ4Z7E2.js +19 -0
  143. package/dist/kernel/enclave/index.d.ts +1 -1
  144. package/dist/kernel/enclave/record-keys/envelope-body.d.ts +8 -0
  145. package/dist/kernel/errors.d.ts +19 -0
  146. package/dist/kernel/noydb.d.ts +0 -6
  147. package/dist/kernel/types.d.ts +61 -17
  148. package/dist/kernel/vault.d.ts +0 -4
  149. package/dist/{ledger-PTK7XZYT.js → ledger-SW6QQOAV.js} +11 -11
  150. package/dist/liberate-W5MDWYOV.js +24 -0
  151. package/dist/{link-set-SLJHDNRB.js → link-set-GNGGCFI4.js} +11 -11
  152. package/dist/materialized-views/index.js +19 -19
  153. package/dist/noydb-U63S3Z7F.js +70 -0
  154. package/dist/on/index.js +9 -9
  155. package/dist/overlay-views/index.js +4 -4
  156. package/dist/periods/index.js +19 -17
  157. package/dist/pod/index.js +27 -12
  158. package/dist/{policy-YDLCOX4P.js → policy-EAXSJNOT.js} +5 -5
  159. package/dist/portability/index.js +8 -8
  160. package/dist/{post-register-2YHSADFI.js → post-register-A7HCFBP5.js} +6 -6
  161. package/dist/query/index.js +6 -6
  162. package/dist/register-YBMRLZLO.js +23 -0
  163. package/dist/registry-3LXKNXWI.js +9 -0
  164. package/dist/registry-4V4YQCXJ.js +19 -0
  165. package/dist/registry-ZULMLCJK.js +18 -0
  166. package/dist/request-withdrawal-SEVUEUDG.js +31 -0
  167. package/dist/{reveal-HWO4YMTJ.js → reveal-PB3YG544.js} +6 -6
  168. package/dist/revoke-5QULL5GT.js +24 -0
  169. package/dist/satellites/index.js +1 -1
  170. package/dist/sealed-record/index.js +12 -12
  171. package/dist/{seed-3ZMF5EQA.js → seed-6GTDHL4E.js} +11 -11
  172. package/dist/session/index.js +9 -9
  173. package/dist/shadow/index.js +2 -2
  174. package/dist/share-link/index.d.ts +19 -0
  175. package/dist/share-link/index.js +201 -0
  176. package/dist/share-link/index.js.map +1 -0
  177. package/dist/share-link/share-link.d.ts +123 -0
  178. package/dist/signer-ZMH35FT4.js +25 -0
  179. package/dist/snapshots/index.js +10 -10
  180. package/dist/{stale-VZL4OGUB.js → stale-NB5BGRVU.js} +10 -10
  181. package/dist/storage-QOZKQMID.js +23 -0
  182. package/dist/{store-coordination-provider-FKX3F6TQ.js → store-coordination-provider-3AELCZ4Y.js} +3 -3
  183. package/dist/sync/index.js +10 -9
  184. package/dist/sync/index.js.map +1 -1
  185. package/dist/team/index.js +29 -28
  186. package/dist/tiers/index.js +10 -10
  187. package/dist/to/index.js +1 -1
  188. package/dist/tx/index.js +3 -3
  189. package/dist/util/index.js +1 -1
  190. package/dist/{verify-26Y5GNMK.js → verify-MXN66IIH.js} +5 -5
  191. package/dist/via/blob/active.d.ts +27 -1
  192. package/dist/via/blob/index.d.ts +4 -0
  193. package/dist/{walk-IPLXE36W.js → walk-H4YE52S2.js} +11 -11
  194. package/dist/with/index.js +11 -11
  195. package/dist/with-audit/periods/periods.d.ts +1 -16
  196. package/dist/with-audit/periods/vault-facade.d.ts +6 -0
  197. package/dist/with-audit/periods/window.d.ts +16 -0
  198. package/dist/{legacy/kernel.d.ts → with-cargo/floor.d.ts} +1 -1
  199. package/dist/with-cargo/index.d.ts +12 -1
  200. package/dist/with-party/directory/cover/index.d.ts +0 -5
  201. package/dist/with-party/directory/cover/schema.d.ts +0 -6
  202. package/dist/with-party/directory/cover/storage.d.ts +0 -8
  203. package/dist/with-party/directory/cover/types.d.ts +0 -21
  204. package/dist/with-party/team/sync-period-scope.d.ts +78 -0
  205. package/dist/with-party/team/sync.d.ts +13 -0
  206. package/dist/with-pod/bundle.d.ts +0 -2
  207. package/dist/with-pod/index.d.ts +2 -1
  208. package/dist/with-shape/blobs/blob-compaction.d.ts +43 -3
  209. package/dist/with-shape/blobs/blob-pinning.d.ts +112 -0
  210. package/dist/with-shape/blobs/blob-set.d.ts +85 -1
  211. package/dist/withdraw-accessible-HPOVNG2G.js +28 -0
  212. package/package.json +7 -7
  213. package/dist/api-3A3S4SHH.js +0 -20
  214. package/dist/bundle/index.js +0 -153
  215. package/dist/bundle/index.js.map +0 -1
  216. package/dist/chunk-CHFZDSE4.js +0 -1
  217. package/dist/chunk-HQBM64EE.js.map +0 -1
  218. package/dist/chunk-PK6JIDQ4.js.map +0 -1
  219. package/dist/chunk-TIGPQDYP.js +0 -14
  220. package/dist/chunk-TIGPQDYP.js.map +0 -1
  221. package/dist/chunk-U6JMEH2P.js.map +0 -1
  222. package/dist/chunk-UDSR4X4L.js.map +0 -1
  223. package/dist/chunk-UHNGNKLV.js.map +0 -1
  224. package/dist/chunk-VCTXU4AT.js.map +0 -1
  225. package/dist/chunk-W2OG6JOL.js.map +0 -1
  226. package/dist/chunk-XTHCN77N.js.map +0 -1
  227. package/dist/collection-facade-KMBWNCYP.js +0 -44
  228. package/dist/cover-QJRXINN5.js +0 -52
  229. package/dist/delegation-SU6CV3W7.js +0 -25
  230. package/dist/derive-6RWU4EOA.js +0 -21
  231. package/dist/executor-KGNLJD6M.js +0 -9
  232. package/dist/executor-UX4FASYZ.js +0 -26
  233. package/dist/executor-XGIS6CR7.js +0 -9
  234. package/dist/export-accessible-LKW3QV22.js +0 -23
  235. package/dist/extract-partition-UP2ARO75.js +0 -38
  236. package/dist/find-YS6XWB46.js +0 -11
  237. package/dist/issue-3ACYX7LO.js +0 -19
  238. package/dist/legacy/bundle.d.ts +0 -30
  239. package/dist/liberate-MQQXBUCY.js +0 -24
  240. package/dist/noydb-ANIW5FLE.js +0 -69
  241. package/dist/register-PAM3ASRZ.js +0 -23
  242. package/dist/registry-4S2U2TR4.js +0 -19
  243. package/dist/registry-NPOWJHC4.js +0 -9
  244. package/dist/registry-VZ3CCI2R.js +0 -18
  245. package/dist/request-withdrawal-DI3H5WUI.js +0 -31
  246. package/dist/revoke-R5CZSVUT.js +0 -24
  247. package/dist/signer-MBVHW4WE.js +0 -25
  248. package/dist/storage-3MEJUENZ.js +0 -23
  249. package/dist/withdraw-accessible-TZDATQVR.js +0 -28
  250. /package/dist/{api-3A3S4SHH.js.map → api-UPAT2O3M.js.map} +0 -0
  251. /package/dist/{backup-YPUEKIJC.js.map → backup-JL2GOTYQ.js.map} +0 -0
  252. /package/dist/{chunk-QDPZWTN2.js.map → chunk-25G7U6RD.js.map} +0 -0
  253. /package/dist/{chunk-WKGF2TJR.js.map → chunk-25ZDB25Z.js.map} +0 -0
  254. /package/dist/{chunk-5WZXVULX.js.map → chunk-2ITLQZV5.js.map} +0 -0
  255. /package/dist/{chunk-WNGGJWF7.js.map → chunk-2JZ763FV.js.map} +0 -0
  256. /package/dist/{chunk-RJ6K6K5M.js.map → chunk-2RMDVWGB.js.map} +0 -0
  257. /package/dist/{chunk-VAIS3SOM.js.map → chunk-2U7Y7BNJ.js.map} +0 -0
  258. /package/dist/{chunk-WZSHL6DQ.js.map → chunk-2VUISNGP.js.map} +0 -0
  259. /package/dist/{chunk-CHFZDSE4.js.map → chunk-2YELV6TV.js.map} +0 -0
  260. /package/dist/{chunk-ANATMTOA.js.map → chunk-3O62PVDW.js.map} +0 -0
  261. /package/dist/{chunk-VKCADNMR.js.map → chunk-4JYYIFHW.js.map} +0 -0
  262. /package/dist/{chunk-6HY2X62D.js.map → chunk-5BB3N4KU.js.map} +0 -0
  263. /package/dist/{chunk-6NQMXTYC.js.map → chunk-5OZCCLNC.js.map} +0 -0
  264. /package/dist/{chunk-HOONYZY2.js.map → chunk-5P5AAXYA.js.map} +0 -0
  265. /package/dist/{chunk-KS6SAVCZ.js.map → chunk-5SZ24DL5.js.map} +0 -0
  266. /package/dist/{chunk-NCCBLYEB.js.map → chunk-7B4GPCX7.js.map} +0 -0
  267. /package/dist/{chunk-SV6EAJEP.js.map → chunk-A64XXIIB.js.map} +0 -0
  268. /package/dist/{chunk-WOM2HTML.js.map → chunk-AFBJHD55.js.map} +0 -0
  269. /package/dist/{chunk-RFI7GGFO.js.map → chunk-BCOKZC4B.js.map} +0 -0
  270. /package/dist/{chunk-MT62YSPZ.js.map → chunk-BZEPJJOK.js.map} +0 -0
  271. /package/dist/{chunk-OCVM6KDH.js.map → chunk-BZK6JEX4.js.map} +0 -0
  272. /package/dist/{chunk-H2KSZMIX.js.map → chunk-CCT4WZI6.js.map} +0 -0
  273. /package/dist/{chunk-VEALDPHW.js.map → chunk-CGPO3ZYB.js.map} +0 -0
  274. /package/dist/{chunk-S3BFKGET.js.map → chunk-DEQ2JTBR.js.map} +0 -0
  275. /package/dist/{chunk-3ELCWU56.js.map → chunk-E2R5NRZD.js.map} +0 -0
  276. /package/dist/{chunk-BOKIKJJB.js.map → chunk-EDC6MLXV.js.map} +0 -0
  277. /package/dist/{chunk-JRBNCUNT.js.map → chunk-FLHOTGOO.js.map} +0 -0
  278. /package/dist/{chunk-6XE5TMPR.js.map → chunk-GBEXTC6Z.js.map} +0 -0
  279. /package/dist/{chunk-YZQOGE2L.js.map → chunk-GS3Q2KOZ.js.map} +0 -0
  280. /package/dist/{chunk-M75ZZHSR.js.map → chunk-GYB2QK5H.js.map} +0 -0
  281. /package/dist/{chunk-EO43ANYJ.js.map → chunk-GZ2GKOF6.js.map} +0 -0
  282. /package/dist/{chunk-VCBHAE4R.js.map → chunk-H4SMS4O2.js.map} +0 -0
  283. /package/dist/{chunk-LVGTA624.js.map → chunk-HGVFJL63.js.map} +0 -0
  284. /package/dist/{chunk-554KLAAN.js.map → chunk-HVZT5T22.js.map} +0 -0
  285. /package/dist/{chunk-CJ5KKU6X.js.map → chunk-IGAIOGCN.js.map} +0 -0
  286. /package/dist/{chunk-GWKAVKHI.js.map → chunk-ITI3SJRB.js.map} +0 -0
  287. /package/dist/{chunk-CZTLE22N.js.map → chunk-IU22SQGU.js.map} +0 -0
  288. /package/dist/{chunk-RTEK4C4I.js.map → chunk-IUIVDVXM.js.map} +0 -0
  289. /package/dist/{chunk-Z4PD65VQ.js.map → chunk-IZX3WZBF.js.map} +0 -0
  290. /package/dist/{chunk-RDXW3OBQ.js.map → chunk-J3VW4J4E.js.map} +0 -0
  291. /package/dist/{chunk-IK43HLDQ.js.map → chunk-J6U4BOKP.js.map} +0 -0
  292. /package/dist/{chunk-XJMBYYQK.js.map → chunk-JA5B3SLH.js.map} +0 -0
  293. /package/dist/{chunk-IAO54J4R.js.map → chunk-JA5O7UEZ.js.map} +0 -0
  294. /package/dist/{chunk-6HPG2YNX.js.map → chunk-JKWNG3TM.js.map} +0 -0
  295. /package/dist/{chunk-WQIYTNJV.js.map → chunk-JLHKBAFY.js.map} +0 -0
  296. /package/dist/{chunk-ISMV2QVG.js.map → chunk-KMONEHDJ.js.map} +0 -0
  297. /package/dist/{chunk-JBBSYJHP.js.map → chunk-KVHWEPT2.js.map} +0 -0
  298. /package/dist/{chunk-2PCAVW2I.js.map → chunk-L4OA7G5T.js.map} +0 -0
  299. /package/dist/{chunk-IY23KFNZ.js.map → chunk-LLVW4V7R.js.map} +0 -0
  300. /package/dist/{chunk-N6WF5PKC.js.map → chunk-M25ZIEB2.js.map} +0 -0
  301. /package/dist/{chunk-UC2ETWF3.js.map → chunk-MSO2C3KG.js.map} +0 -0
  302. /package/dist/{chunk-ONTBCHCP.js.map → chunk-N4FZ6ITM.js.map} +0 -0
  303. /package/dist/{chunk-DRWBEDYO.js.map → chunk-NM4LVUXH.js.map} +0 -0
  304. /package/dist/{chunk-DSBQODMZ.js.map → chunk-NOT7XA7Q.js.map} +0 -0
  305. /package/dist/{chunk-RA5VTXXG.js.map → chunk-OGFPMCSP.js.map} +0 -0
  306. /package/dist/{chunk-WHXXI3W5.js.map → chunk-OGY4ELVE.js.map} +0 -0
  307. /package/dist/{chunk-T36RFODW.js.map → chunk-OOTTXUNV.js.map} +0 -0
  308. /package/dist/{chunk-A5BDDEXK.js.map → chunk-OTU5ZI3U.js.map} +0 -0
  309. /package/dist/{chunk-THVIPWRF.js.map → chunk-OVFCAS7U.js.map} +0 -0
  310. /package/dist/{chunk-IFJTPAQQ.js.map → chunk-OWE4BNTM.js.map} +0 -0
  311. /package/dist/{chunk-ZXEZCY6F.js.map → chunk-QCUH2G77.js.map} +0 -0
  312. /package/dist/{chunk-XDIAFPUM.js.map → chunk-QDNVHA2F.js.map} +0 -0
  313. /package/dist/{chunk-A4FXFAKF.js.map → chunk-QXPOEAKR.js.map} +0 -0
  314. /package/dist/{chunk-EWPOHMN2.js.map → chunk-RGL53NXZ.js.map} +0 -0
  315. /package/dist/{chunk-TAGR72IR.js.map → chunk-RI3OKC3Y.js.map} +0 -0
  316. /package/dist/{chunk-5PFOMHTB.js.map → chunk-S3OYXPSE.js.map} +0 -0
  317. /package/dist/{chunk-JVBO4SZL.js.map → chunk-STR7WBOB.js.map} +0 -0
  318. /package/dist/{chunk-DDHM2TLX.js.map → chunk-T7S4V52L.js.map} +0 -0
  319. /package/dist/{chunk-WG4QBZDN.js.map → chunk-TYBXP6WE.js.map} +0 -0
  320. /package/dist/{chunk-T3GY65MA.js.map → chunk-UEO5CHOP.js.map} +0 -0
  321. /package/dist/{chunk-RNG4VRP4.js.map → chunk-V3YB7RGR.js.map} +0 -0
  322. /package/dist/{chunk-R3BLCFD2.js.map → chunk-V7RGFJ3Z.js.map} +0 -0
  323. /package/dist/{chunk-SMIRGMS7.js.map → chunk-VEX6G3YL.js.map} +0 -0
  324. /package/dist/{chunk-GULTLPFB.js.map → chunk-XGVDLQJE.js.map} +0 -0
  325. /package/dist/{chunk-JFCV5QIK.js.map → chunk-XULHFSHO.js.map} +0 -0
  326. /package/dist/{chunk-S6Q37VGE.js.map → chunk-XW7NWO4A.js.map} +0 -0
  327. /package/dist/{chunk-YCH5GBN6.js.map → chunk-Y5E6CH6S.js.map} +0 -0
  328. /package/dist/{chunk-GDG5VVYG.js.map → chunk-YG2EG6CB.js.map} +0 -0
  329. /package/dist/{chunk-YTGDPCPW.js.map → chunk-YHPUDB7Q.js.map} +0 -0
  330. /package/dist/{chunk-VRBTNCM4.js.map → chunk-ZJGZDOQO.js.map} +0 -0
  331. /package/dist/{classified-marker-QWMASIT7.js.map → classified-marker-7S5IEP6Q.js.map} +0 -0
  332. /package/dist/{collection-facade-KMBWNCYP.js.map → collection-facade-ENLTJZBT.js.map} +0 -0
  333. /package/dist/{computed-DSMPXG2Y.js.map → computed-WZNKRLCY.js.map} +0 -0
  334. /package/dist/{cover-QJRXINN5.js.map → cover-B5MY43CK.js.map} +0 -0
  335. /package/dist/{dead-filter-66VGI6JV.js.map → dead-filter-KRRD57MR.js.map} +0 -0
  336. /package/dist/{delegation-SU6CV3W7.js.map → delegation-UT76AQIG.js.map} +0 -0
  337. /package/dist/{derive-6RWU4EOA.js.map → derive-SGRCCKVP.js.map} +0 -0
  338. /package/dist/{enclave-TKPN2G2U.js.map → enclave-YFKA3GJT.js.map} +0 -0
  339. /package/dist/{executor-KGNLJD6M.js.map → executor-TEZYRDN3.js.map} +0 -0
  340. /package/dist/{executor-UX4FASYZ.js.map → executor-UF7LTX6O.js.map} +0 -0
  341. /package/dist/{executor-XGIS6CR7.js.map → executor-WQQRU6DO.js.map} +0 -0
  342. /package/dist/{export-accessible-LKW3QV22.js.map → export-accessible-HXMKW5LJ.js.map} +0 -0
  343. /package/dist/{extract-partition-UP2ARO75.js.map → extract-partition-QGQ2R42J.js.map} +0 -0
  344. /package/dist/{fanout-sidecar-B5LVUMQX.js.map → fanout-sidecar-HJV3A7PM.js.map} +0 -0
  345. /package/dist/{find-YS6XWB46.js.map → find-VV6PBIHK.js.map} +0 -0
  346. /package/dist/{issue-3ACYX7LO.js.map → issue-7JJ4Z7E2.js.map} +0 -0
  347. /package/dist/{ledger-PTK7XZYT.js.map → ledger-SW6QQOAV.js.map} +0 -0
  348. /package/dist/{liberate-MQQXBUCY.js.map → liberate-W5MDWYOV.js.map} +0 -0
  349. /package/dist/{link-set-SLJHDNRB.js.map → link-set-GNGGCFI4.js.map} +0 -0
  350. /package/dist/{noydb-ANIW5FLE.js.map → noydb-U63S3Z7F.js.map} +0 -0
  351. /package/dist/{policy-YDLCOX4P.js.map → policy-EAXSJNOT.js.map} +0 -0
  352. /package/dist/{post-register-2YHSADFI.js.map → post-register-A7HCFBP5.js.map} +0 -0
  353. /package/dist/{register-PAM3ASRZ.js.map → register-YBMRLZLO.js.map} +0 -0
  354. /package/dist/{registry-4S2U2TR4.js.map → registry-3LXKNXWI.js.map} +0 -0
  355. /package/dist/{registry-NPOWJHC4.js.map → registry-4V4YQCXJ.js.map} +0 -0
  356. /package/dist/{registry-VZ3CCI2R.js.map → registry-ZULMLCJK.js.map} +0 -0
  357. /package/dist/{request-withdrawal-DI3H5WUI.js.map → request-withdrawal-SEVUEUDG.js.map} +0 -0
  358. /package/dist/{reveal-HWO4YMTJ.js.map → reveal-PB3YG544.js.map} +0 -0
  359. /package/dist/{revoke-R5CZSVUT.js.map → revoke-5QULL5GT.js.map} +0 -0
  360. /package/dist/{seed-3ZMF5EQA.js.map → seed-6GTDHL4E.js.map} +0 -0
  361. /package/dist/{signer-MBVHW4WE.js.map → signer-ZMH35FT4.js.map} +0 -0
  362. /package/dist/{stale-VZL4OGUB.js.map → stale-NB5BGRVU.js.map} +0 -0
  363. /package/dist/{storage-3MEJUENZ.js.map → storage-QOZKQMID.js.map} +0 -0
  364. /package/dist/{store-coordination-provider-FKX3F6TQ.js.map → store-coordination-provider-3AELCZ4Y.js.map} +0 -0
  365. /package/dist/{verify-26Y5GNMK.js.map → verify-MXN66IIH.js.map} +0 -0
  366. /package/dist/{walk-IPLXE36W.js.map → walk-H4YE52S2.js.map} +0 -0
  367. /package/dist/{withdraw-accessible-TZDATQVR.js.map → withdraw-accessible-HPOVNG2G.js.map} +0 -0
@@ -1,14 +0,0 @@
1
- // src/with-cargo/active.ts
2
- function withCargo() {
3
- return {
4
- async extractPartition(vault, opts) {
5
- const { extractPartitionCore } = await import("./extract-partition-UP2ARO75.js");
6
- return extractPartitionCore(vault, opts);
7
- }
8
- };
9
- }
10
-
11
- export {
12
- withCargo
13
- };
14
- //# sourceMappingURL=chunk-TIGPQDYP.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/with-cargo/active.ts"],"sourcesContent":["/**\n * Enable the cargo (partition extraction) capability.\n * Pass to `createNoydb({ cargoStrategy: withCargo() })` to make the source-side\n * `extractPartition(vault, ...)` free function live. The extraction crypto\n * engine is dynamically imported here, so it stays out of the floor bundle\n * until opted in. The recipient-side `adoptPartition` /\n * `decryptExtractedPartition` free functions — and `diffVault` (shared\n * import/merge infra) — are ungated and unaffected.\n */\nimport type { CargoStrategy } from './strategy.js'\n\nexport function withCargo(): CargoStrategy {\n return {\n async extractPartition(vault, opts) {\n const { extractPartitionCore } = await import('./extract-partition.js')\n return extractPartitionCore(vault, opts)\n },\n }\n}\n"],"mappings":";AAWO,SAAS,YAA2B;AACzC,SAAO;AAAA,IACL,MAAM,iBAAiB,OAAO,MAAM;AAClC,YAAM,EAAE,qBAAqB,IAAI,MAAM,OAAO,iCAAwB;AACtE,aAAO,qBAAqB,OAAO,IAAI;AAAA,IACzC;AAAA,EACF;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/with-shape/blobs/export-blobs.ts","../src/with-shape/blobs/blob-compaction.ts"],"sourcesContent":["/**\n * `vault.exportBlobs()` — bulk blob extraction primitive.\n *\n * Async-iterable handle over every blob attached to records in a\n * vault, optionally filtered by collection allowlist and per-record\n * predicate. Emits tuples of `{ blobId, recordRef, bytes, meta }` so\n * the consumer can pipe into any sink (zip stream, S3 multipart, USB\n * copy, cold-storage tape) without pulling the whole export into\n * memory.\n *\n * ## Auth + audit\n *\n * - Capability check runs **once** at handle creation via\n * `Vault.assertCanExport('plaintext', 'blob')`. An operator whose\n * keyring lacks that bit fails before a single byte of ciphertext\n * is decrypted.\n * - Audit entry lands in `_export_audit` at handle creation: the\n * actor, start timestamp, target collections, predicate presence,\n * and batch mechanism. **No content hashes** — per the spec\n * non-correlation invariant.\n *\n * ## Abort + resume\n *\n * - `handle.abort()` flips the internal signal; the next iteration\n * boundary throws `AbortError`. Consumers already in `for await`\n * can catch and exit cleanly.\n * - Restart after a partial failure with `{ afterBlobId }` — the\n * iterator skips tuples up to (and including) that blob id before\n * yielding again. Combined with a blob-count ceiling it supports\n * idempotent batch re-runs.\n *\n * @module\n */\n\nimport type { Collection } from '../../kernel/collection.js'\nimport type { SlotInfo } from '../../kernel/types.js'\n\n// ─── Types ──────────────────────────────────────────────────────────────\n\nexport interface ExportBlobsOptions {\n /**\n * Collection allowlist. Omit to export blobs from every collection\n * the caller has read access to.\n */\n readonly collections?: readonly string[]\n /**\n * Per-record predicate. Called on the decrypted record BEFORE any\n * blob bytes are read for that record — returning false skips the\n * record and all its slots without touching their chunks.\n */\n readonly where?: (record: unknown, context: { collection: string; id: string }) => boolean\n /**\n * Resume after a specific blob id. The iterator skips tuples up to\n * and including this id, then yields. Format of the id is the same\n * as `ExportedBlob.blobId` (the HMAC-keyed eTag).\n */\n readonly afterBlobId?: string\n /**\n * External abort signal. When fired, the next iterator tick throws\n * `ExportBlobsAbortedError`. Honored alongside `handle.abort()`.\n */\n readonly signal?: AbortSignal\n}\n\nexport interface ExportedBlob {\n /** Opaque blob identifier — HMAC-keyed eTag, stable across vaults. */\n readonly blobId: string\n /** Where this blob came from in the vault. */\n readonly recordRef: {\n readonly collection: string\n readonly id: string\n readonly slot: string\n }\n /** Decrypted plaintext bytes. */\n readonly bytes: Uint8Array\n /** Best-effort metadata (from the blob slot record). */\n readonly meta: {\n readonly size: number\n /**\n * User-visible filename stored on the slot. Often equal to the\n * slot name; differs when the caller supplied an explicit\n * `filename` to `BlobSet.put()`.\n */\n readonly filename: string\n readonly mimeType?: string\n readonly createdAt?: string\n }\n}\n\nexport interface ExportBlobsHandle extends AsyncIterable<ExportedBlob> {\n /** Abort the export. Safe to call multiple times. */\n abort(): void\n /** True once `abort()` has fired or the external signal aborted. */\n readonly aborted: boolean\n}\n\nexport class ExportBlobsAbortedError extends Error {\n constructor(reason: string) {\n super(`exportBlobs aborted: ${reason}`)\n this.name = 'ExportBlobsAbortedError'\n }\n}\n\n// ─── Audit ──────────────────────────────────────────────────────────────\n\nexport const EXPORT_AUDIT_COLLECTION = '_export_audit'\n\nexport interface ExportBlobsAuditEntry {\n readonly id: string\n readonly mechanism: 'exportBlobs'\n readonly actor: string\n readonly startedAt: string\n readonly collections: readonly string[] | null\n readonly predicate: boolean\n readonly afterBlobId: string | null\n}\n\n// ─── Implementation ─────────────────────────────────────────────────────\n\n/**\n * Build the handle. Factored out of `Vault.exportBlobs` so the\n * implementation can be unit-tested without going through the\n * compartment lifecycle.\n */\nexport function createExportBlobsHandle(\n actor: string,\n listAccessibleCollections: () => Promise<string[]>,\n getCollection: <T>(name: string) => Collection<T>,\n writeAudit: (entry: ExportBlobsAuditEntry) => Promise<void>,\n options: ExportBlobsOptions,\n): ExportBlobsHandle {\n let aborted = false\n\n const abort = (): void => {\n aborted = true\n }\n\n if (options.signal) {\n if (options.signal.aborted) aborted = true\n options.signal.addEventListener('abort', () => { aborted = true })\n }\n\n function assertLive(): void {\n if (aborted) throw new ExportBlobsAbortedError('aborted by caller')\n }\n\n const allowlist = options.collections ? new Set(options.collections) : null\n\n // Write the audit entry BEFORE the first yield so a blocked\n // iteration still leaves an audit trail that the export started.\n let auditPromise: Promise<void> | null = null\n function writeAuditOnce(): Promise<void> {\n if (!auditPromise) {\n auditPromise = writeAudit({\n id: generateBatchId(),\n mechanism: 'exportBlobs',\n actor,\n startedAt: new Date().toISOString(),\n collections: options.collections ?? null,\n predicate: Boolean(options.where),\n afterBlobId: options.afterBlobId ?? null,\n })\n }\n return auditPromise\n }\n\n async function* generate(): AsyncGenerator<ExportedBlob> {\n await writeAuditOnce()\n assertLive()\n\n // Resolve target collections lazily — also keeps the call async.\n const allCollections = await listAccessibleCollections()\n const targets = allCollections.filter(name => {\n if (name.startsWith('_')) return false\n if (allowlist && !allowlist.has(name)) return false\n return true\n })\n\n let resumeCursorHit = options.afterBlobId === undefined\n\n for (const collectionName of targets) {\n if (aborted) return\n\n const coll = getCollection<Record<string, unknown>>(collectionName)\n const records = await coll.list().catch(() => [])\n for (const record of records) {\n if (aborted) return\n assertLive()\n\n const idField = (record as { id?: unknown }).id\n if (typeof idField !== 'string') continue\n\n if (options.where && !options.where(record, { collection: collectionName, id: idField })) continue\n\n const blobSet = coll.blob(idField)\n const slots = await blobSet.list().catch(() => [] as SlotInfo[])\n for (const slot of slots) {\n if (aborted) return\n\n if (!resumeCursorHit) {\n if (slot.eTag === options.afterBlobId) {\n resumeCursorHit = true\n }\n continue\n }\n\n const bytes = await blobSet.get(slot.name)\n if (!bytes) continue\n\n const item: ExportedBlob = {\n blobId: slot.eTag,\n recordRef: { collection: collectionName, id: idField, slot: slot.name },\n bytes,\n meta: {\n size: slot.size,\n filename: slot.filename,\n ...(slot.mimeType !== undefined && { mimeType: slot.mimeType }),\n ...(slot.uploadedAt !== undefined && { createdAt: slot.uploadedAt }),\n },\n }\n yield item\n }\n }\n }\n }\n\n const handle: ExportBlobsHandle = {\n abort,\n get aborted() { return aborted },\n [Symbol.asyncIterator]: () => generate(),\n }\n return handle\n}\n\n// ─── Helpers ────────────────────────────────────────────────────────────\n\nfunction generateBatchId(): string {\n // 16 bytes of crypto randomness, URL-safe base64, no padding.\n const raw = globalThis.crypto.getRandomValues(new Uint8Array(16))\n let s = ''\n for (const b of raw) s += b.toString(16).padStart(2, '0')\n return `batch-${Date.now().toString(36)}-${s.slice(0, 12)}`\n}\n","/**\n * Blob retention + compaction.\n *\n * Declarative per-collection / per-slot eviction policy. Two\n * triggers:\n *\n * - **`retainDays`** — age-based TTL. A slot uploaded more than N\n * days ago is evicted.\n * - **`evictWhen(record)`** — predicate over the **decrypted**\n * record. Lets consumers express \"the image is safe to drop once\n * the structured invoice has been reviewed and confirmed.\"\n *\n * Either trigger (or both) causes the slot to evict. Eviction removes\n * the slot entry from `_blob_slots_{collection}`, decrements the\n * blob's refCount (so unreferenced chunks can be GC'd by the next\n * sweep), and writes one entry to the `_blob_eviction_audit`\n * collection for tamper-evident record-keeping.\n *\n * The audit entry carries the eTag of the evicted blob (opaque HMAC\n * of plaintext under the vault's `_blob` DEK) — no plaintext leakage,\n * per the SPEC non-correlation invariant. Consumers reconstructing\n * \"what used to be attached\" can look up the audit entry by record\n * id.\n *\n * Compaction is **consumer-scheduled** — noy-db never runs a\n * background daemon. Call `vault.compact()` whenever your workflow\n * allows (cron, manual \"tidy\" button, cold-storage export prep, …).\n *\n * @module\n */\n\nimport type { NoydbStore, EncryptedEnvelope, SlotInfo } from '../../kernel/types.js'\nimport { NOYDB_FORMAT_VERSION } from '../../kernel/types.js'\nimport { encrypt, type EnclaveKey } from '../../kernel/enclave/index.js'\n\n// ─── Config types ───────────────────────────────────────────────────────\n\nexport interface BlobFieldPolicy<T = unknown> {\n /**\n * Via port brand marker — lets a `BlobFieldPolicy` satisfy the kernel's\n * opaque `ViaDescriptor` (#629 Task 7). Optional (the\n * `ClassifiedFieldSpec._viaBrand` precedent): `blobFields` policies are\n * plain object literals with no declaration factory to stamp it, so a\n * mandatory field would break every existing declaration.\n */\n readonly _viaBrand?: 'blob'\n /**\n * Age-based TTL in days. A slot whose `uploadedAt` is older than\n * `now - retainDays × 86400s` evicts on the next `vault.compact()`.\n * Omit to disable age-based eviction.\n */\n readonly retainDays?: number\n /**\n * Predicate evaluated against the decrypted record. When it returns\n * `true`, every matching slot on that record evicts. Omit to\n * disable predicate-based eviction.\n */\n readonly evictWhen?: (record: T) => boolean\n /**\n * **Legal hold.** When this predicate returns `true`, the slot is\n * never evicted — `retainDays`/`evictWhen` are overridden. Use for a\n * litigation / audit hold on a fiscal document: the blob stays until\n * the predicate returns `false` (the hold is released). Fail-closed:\n * if the predicate throws, the slot is treated as held.\n */\n readonly legalHold?: (record: T) => boolean\n /**\n * **Period-bound retention.** Returns the date (Date / ISO string /\n * epoch ms) until which the slot must be retained — typically derived\n * from the record's fiscal period (e.g. period end + 10 years). While\n * `now < retainUntil`, the slot is never evicted, regardless of\n * `retainDays`. Return `null`/`undefined` to impose no floor.\n * Fail-closed: a throwing function holds the slot.\n */\n readonly retainUntil?: (record: T) => Date | string | number | null | undefined\n /**\n * **External projection.** When `true`, this field's bytes are stored in the\n * vault's `ObjectProjection` (`createNoydb({ objectStore })`) as a single raw,\n * **unencrypted** object — servable directly from S3/CDN and processable by\n * native tooling — instead of the encrypted-chunk path. The encrypted slot\n * record remains the catalog (anchoring invariant). Requires an `objectStore`;\n * **outside the zero-knowledge guarantee** — use only for assets meant to\n * leave the vault. See the as-aws-s3 design spec.\n */\n readonly external?: boolean\n /**\n * For an `external` field: make the object world-readable (CDN origin) rather\n * than presigned-only. Default `false` (presigned). Ignored unless `external`.\n */\n readonly public?: boolean\n /**\n * For an `external` field: how to stamp a **backlink** (this record's\n * vault/collection/id/field) onto the object's metadata — the self-describing\n * \"secondary store\" that powers reconcile / DR / import re-pairing.\n * - `'opaque-token'` (default): a random id; preserves the opaque-bucket\n * property (no names leak); the token is also recorded on the slot.\n * - `'encrypted'`: the reference encrypted under the blob DEK (ZK-preserving;\n * falls back to `'opaque-token'` on a plaintext vault).\n * - `'plain'`: the reference in cleartext metadata — **leaks structure** to\n * bucket readers; only for non-sensitive deployments.\n * - `'none'`: no backlink.\n */\n readonly backlink?: 'opaque-token' | 'encrypted' | 'plain' | 'none'\n}\n\nexport type BlobFieldsConfig<T = unknown> = Record<string, BlobFieldPolicy<T>>\n\n// ─── Audit collection ──────────────────────────────────────────────────\n\nexport const BLOB_EVICTION_AUDIT_COLLECTION = '_blob_eviction_audit'\n\nexport interface BlobEvictionEntry {\n readonly id: string\n readonly collection: string\n readonly recordId: string\n readonly slotName: string\n readonly blobHash: string\n readonly reason: 'ttl' | 'predicate' | 'both'\n readonly evictedAt: string\n readonly actor: string\n}\n\n// ─── Compaction result ──────────────────────────────────────────────────\n\nexport interface CompactionResult {\n /** Number of blob slots evicted across all collections. */\n readonly evicted: number\n /** Number of records touched (iterated + policy checked). */\n readonly records: number\n /** Number of collections with `blobFields` configured. */\n readonly collections: number\n /** Number of audit entries written. Equal to `evicted`. */\n readonly auditEntries: number\n /**\n * Number of slots that would have evicted (TTL/predicate triggered)\n * but were retained by a `legalHold` or `retainUntil` floor.\n */\n readonly held: number\n /** Per-collection breakdown for diagnostics. */\n readonly byCollection: Record<string, { records: number; evicted: number }>\n}\n\n// ─── Core ──────────────────────────────────────────────────────────────\n\nexport interface CompactRunOptions {\n /** Override \"now\" for deterministic testing. */\n readonly now?: Date\n /**\n * Stop after this many evictions. Useful for capped batches / cron\n * jobs that need to fit in a time window. `undefined` = unbounded.\n */\n readonly maxEvictions?: number\n /**\n * Dry-run — evaluate policies and return the counts, but do NOT\n * delete slots or write audit entries. Lets a consumer preview\n * what would happen.\n */\n readonly dryRun?: boolean\n}\n\nexport interface CompactionContext {\n readonly adapter: NoydbStore\n readonly vault: string\n readonly actor: string\n readonly encrypted: boolean\n readonly getDEK: (collection: string) => Promise<EnclaveKey>\n /**\n * Resolve a collection's declared `blobFields` config. Returns an\n * empty map for collections without the config — the walk skips\n * those.\n */\n readonly getBlobFields: <T>(collection: string) => BlobFieldsConfig<T> | null\n /** List collection names in the vault. */\n readonly listCollections: () => Promise<string[]>\n /** List record ids in a collection. */\n readonly listRecords: (collection: string) => Promise<string[]>\n /** Decrypt and return the record. Null when absent. */\n readonly getRecord: <T>(collection: string, id: string) => Promise<T | null>\n /** Return the BlobSet-like handle for a record's slots. */\n readonly listSlots: (collection: string, id: string) => Promise<SlotInfo[]>\n /** Delete a slot and decrement its blob's refCount. */\n readonly deleteSlot: (collection: string, id: string, slotName: string) => Promise<void>\n}\n\nexport async function runCompaction(\n ctx: CompactionContext,\n options: CompactRunOptions = {},\n): Promise<CompactionResult> {\n const now = options.now ?? new Date()\n const maxEvictions = options.maxEvictions ?? Infinity\n const dryRun = options.dryRun === true\n\n const allCollections = await ctx.listCollections()\n const byCollection: Record<string, { records: number; evicted: number }> = {}\n let evicted = 0\n let records = 0\n let auditEntries = 0\n let held = 0\n let collectionsWithPolicy = 0\n\n outer: for (const collectionName of allCollections) {\n if (collectionName.startsWith('_')) continue\n const config = ctx.getBlobFields(collectionName)\n if (!config) continue\n const configuredSlots = Object.keys(config)\n if (configuredSlots.length === 0) continue\n collectionsWithPolicy += 1\n byCollection[collectionName] = { records: 0, evicted: 0 }\n\n const ids = await ctx.listRecords(collectionName)\n for (const recordId of ids) {\n if (evicted >= maxEvictions) break outer\n\n const record = await ctx.getRecord(collectionName, recordId).catch(() => null)\n if (record === null) continue\n records += 1\n byCollection[collectionName].records += 1\n\n const slots = await ctx.listSlots(collectionName, recordId).catch(() => [])\n for (const slot of slots) {\n if (evicted >= maxEvictions) break outer\n const policy = config[slot.name]\n if (!policy) continue\n\n const reason = evaluatePolicy(policy, record, slot, now)\n if (!reason) continue\n\n // Retention floor: a legal hold or period-bound retainUntil\n // blocks an otherwise-due eviction. Counted, never evicted.\n if (isHeld(policy, record, now)) {\n held += 1\n continue\n }\n\n if (!dryRun) {\n await ctx.deleteSlot(collectionName, recordId, slot.name)\n await writeAuditEntry(ctx, {\n id: generateEvictionId(collectionName, recordId, slot.name),\n collection: collectionName,\n recordId,\n slotName: slot.name,\n blobHash: slot.eTag,\n reason,\n evictedAt: now.toISOString(),\n actor: ctx.actor,\n })\n auditEntries += 1\n }\n evicted += 1\n byCollection[collectionName].evicted += 1\n }\n }\n }\n\n return {\n evicted,\n records,\n collections: collectionsWithPolicy,\n auditEntries,\n held,\n byCollection,\n }\n}\n\n/**\n * Whether a retention floor (legal hold or period-bound `retainUntil`)\n * currently blocks eviction of this record's slots. Fail-closed: a\n * throwing predicate holds the slot.\n */\nfunction isHeld<T>(policy: BlobFieldPolicy<T>, record: T, now: Date): boolean {\n if (policy.legalHold) {\n try {\n if (policy.legalHold(record)) return true\n } catch {\n return true\n }\n }\n if (policy.retainUntil) {\n try {\n const until = policy.retainUntil(record)\n if (until !== null && until !== undefined) {\n const t = until instanceof Date ? until.getTime() : typeof until === 'number' ? until : Date.parse(String(until))\n if (!Number.isFinite(t)) return true // fail-closed: unparseable retainUntil holds the slot\n if (t > now.getTime()) return true\n }\n } catch {\n return true\n }\n }\n return false\n}\n\nfunction evaluatePolicy<T>(\n policy: BlobFieldPolicy<T>,\n record: T,\n slot: SlotInfo,\n now: Date,\n): 'ttl' | 'predicate' | 'both' | null {\n let ttlTriggered = false\n let predicateTriggered = false\n\n if (policy.retainDays !== undefined && policy.retainDays > 0) {\n const uploadedAt = Date.parse(slot.uploadedAt)\n if (Number.isFinite(uploadedAt)) {\n const ageMs = now.getTime() - uploadedAt\n const limitMs = policy.retainDays * 86_400_000\n if (ageMs > limitMs) ttlTriggered = true\n }\n }\n\n if (policy.evictWhen) {\n try {\n if (policy.evictWhen(record)) predicateTriggered = true\n } catch {\n // Predicate error → do NOT evict. Fail closed.\n }\n }\n\n if (ttlTriggered && predicateTriggered) return 'both'\n if (ttlTriggered) return 'ttl'\n if (predicateTriggered) return 'predicate'\n return null\n}\n\nfunction generateEvictionId(collection: string, recordId: string, slotName: string): string {\n const rand = globalThis.crypto.getRandomValues(new Uint8Array(8))\n let suffix = ''\n for (const b of rand) suffix += b.toString(16).padStart(2, '0')\n return `${collection}__${recordId}__${slotName}__${suffix}`\n}\n\nasync function writeAuditEntry(ctx: CompactionContext, entry: BlobEvictionEntry): Promise<void> {\n const json = JSON.stringify(entry)\n let envelope: EncryptedEnvelope\n if (ctx.encrypted) {\n const dek = await ctx.getDEK(BLOB_EVICTION_AUDIT_COLLECTION)\n const { iv, data } = await encrypt(json, dek)\n envelope = {\n _noydb: NOYDB_FORMAT_VERSION,\n _v: 1,\n _ts: entry.evictedAt,\n _iv: iv,\n _data: data,\n _by: entry.actor,\n }\n } else {\n envelope = {\n _noydb: NOYDB_FORMAT_VERSION,\n _v: 1,\n _ts: entry.evictedAt,\n _iv: '',\n _data: json,\n _by: entry.actor,\n }\n }\n await ctx.adapter.put(ctx.vault, BLOB_EVICTION_AUDIT_COLLECTION, entry.id, envelope)\n}\n"],"mappings":";;;;;;;;AAgGO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EACjD,YAAY,QAAgB;AAC1B,UAAM,wBAAwB,MAAM,EAAE;AACtC,SAAK,OAAO;AAAA,EACd;AACF;AAIO,IAAM,0BAA0B;AAmBhC,SAAS,wBACd,OACA,2BACA,eACA,YACA,SACmB;AACnB,MAAI,UAAU;AAEd,QAAM,QAAQ,MAAY;AACxB,cAAU;AAAA,EACZ;AAEA,MAAI,QAAQ,QAAQ;AAClB,QAAI,QAAQ,OAAO,QAAS,WAAU;AACtC,YAAQ,OAAO,iBAAiB,SAAS,MAAM;AAAE,gBAAU;AAAA,IAAK,CAAC;AAAA,EACnE;AAEA,WAAS,aAAmB;AAC1B,QAAI,QAAS,OAAM,IAAI,wBAAwB,mBAAmB;AAAA,EACpE;AAEA,QAAM,YAAY,QAAQ,cAAc,IAAI,IAAI,QAAQ,WAAW,IAAI;AAIvE,MAAI,eAAqC;AACzC,WAAS,iBAAgC;AACvC,QAAI,CAAC,cAAc;AACjB,qBAAe,WAAW;AAAA,QACxB,IAAI,gBAAgB;AAAA,QACpB,WAAW;AAAA,QACX;AAAA,QACA,YAAW,oBAAI,KAAK,GAAE,YAAY;AAAA,QACl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,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG;AAC9D,SAAO,GAAG,UAAU,KAAK,QAAQ,KAAK,QAAQ,KAAK,MAAM;AAC3D;AAEA,eAAe,gBAAgB,KAAwB,OAAyC;AAC9F,QAAM,OAAO,KAAK,UAAU,KAAK;AACjC,MAAI;AACJ,MAAI,IAAI,WAAW;AACjB,UAAM,MAAM,MAAM,IAAI,OAAO,8BAA8B;AAC3D,UAAM,EAAE,IAAI,KAAK,IAAI,MAAM,QAAQ,MAAM,GAAG;AAC5C,eAAW;AAAA,MACT,QAAQ;AAAA,MACR,IAAI;AAAA,MACJ,KAAK,MAAM;AAAA,MACX,KAAK;AAAA,MACL,OAAO;AAAA,MACP,KAAK,MAAM;AAAA,IACb;AAAA,EACF,OAAO;AACL,eAAW;AAAA,MACT,QAAQ;AAAA,MACR,IAAI;AAAA,MACJ,KAAK,MAAM;AAAA,MACX,KAAK;AAAA,MACL,OAAO;AAAA,MACP,KAAK,MAAM;AAAA,IACb;AAAA,EACF;AACA,QAAM,IAAI,QAAQ,IAAI,IAAI,OAAO,gCAAgC,MAAM,IAAI,QAAQ;AACrF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/with-cargo/adopt-partition.ts","../src/with-cargo/decrypt-partition.ts"],"sourcesContent":["/**\n * Partition adoption. Recipient side: verify an extracted bundle,\n * validate the transfer key, import the re-keyed collections into a\n * destination store, and record an `_meta/adoption` marker. The bundle\n * stays UNOWNED after adoption — `createOwnerOnAdoptedPartition`\n * mints the owner; the transfer seal is then destroyed.\n *\n * @module\n */\nimport { base64ToBuffer, wrapKey, type EnclaveKey } from '../kernel/enclave/index.js'\nimport { TransferSealError, AdoptionStateError, ValidationError } from '../kernel/errors.js'\nimport type { NoydbStore, VaultSnapshot, KeyringFile } from '../kernel/types.js'\nimport { createOwnerKeyring } from '../with-party/team/keyring.js'\nimport { resolveManagedSecret } from '../with-party/team/managed-passphrase.js'\nimport type { SealingKeyProvider } from '../with-party/team/managed-passphrase.js'\nimport type { ShamirRecoveryProvider } from '../with-party/team/shamir-recovery-provider.js'\nimport type { RecoveryEnrollmentInput } from '../with-party/team/rotate-recover.js'\nimport { LedgerStore } from '../with-commit/history/ledger/store.js'\nimport { LEDGER_COLLECTION } from '../with-commit/history/ledger/constants.js'\nimport type { TransferSealPayload } from '../with-pod/bundle.js'\nimport { readPodHeader, readPod, parseExtractedPartitionBody } from '../with-pod/bundle.js'\n\n/**\n * Reverse of `sealDeks`. Imports the transfer key, decrypts the\n * sealed `{ collection: base64(rawDEK) }` map (layout iv(12)‖ct‖tag), and\n * re-imports each DEK as an AES-GCM key. Throws `TransferSealError` on a\n * wrong key (AES-GCM auth-tag failure) or malformed payload.\n */\nexport async function unsealDeks(\n seal: TransferSealPayload,\n transferKey: Uint8Array,\n): Promise<Map<string, EnclaveKey>> {\n if (transferKey.byteLength !== 32) {\n throw new TransferSealError(\n `transfer key must be 32 bytes, got ${transferKey.byteLength}.`,\n )\n }\n const key = await crypto.subtle.importKey('raw', transferKey as BufferSource, 'AES-GCM', false, ['decrypt'])\n const raw = base64ToBuffer(seal.payload)\n let plaintext: ArrayBuffer\n try {\n plaintext = await crypto.subtle.decrypt(\n { name: 'AES-GCM', iv: raw.slice(0, 12) as BufferSource },\n key,\n raw.slice(12) as BufferSource,\n )\n } catch {\n throw new TransferSealError(\n 'transfer seal could not be opened — wrong transfer key (AES-GCM authentication failed).',\n )\n }\n let dekMap: Record<string, string>\n try {\n dekMap = JSON.parse(new TextDecoder().decode(plaintext)) as Record<string, string>\n } catch {\n throw new TransferSealError('transfer seal payload is not valid JSON after decryption.')\n }\n const deks = new Map<string, EnclaveKey>()\n for (const [collection, b64] of Object.entries(dekMap)) {\n // Extractable: the recipient must be able to re-wrap these under their\n // own KEK (AES-KW) at owner-creation. Matches generateDEK.\n const dek = await crypto.subtle.importKey('raw', base64ToBuffer(b64) as BufferSource, 'AES-GCM', true, ['encrypt', 'decrypt'])\n deks.set(collection, dek)\n }\n return deks\n}\n\nexport interface AdoptPartitionOptions {\n readonly transferKey: Uint8Array\n readonly destinationStore: NoydbStore\n readonly vaultName: string\n}\n\nexport interface AdoptPartitionResult {\n readonly vaultName: string\n readonly needsOwner: true\n readonly sealId: string\n}\n\nexport async function adoptPartition(\n bundleBytes: Uint8Array,\n opts: AdoptPartitionOptions,\n): Promise<AdoptPartitionResult> {\n const { transferKey, destinationStore, vaultName } = opts\n\n const header = readPodHeader(bundleBytes)\n if (header.bundleKind !== 'extracted-partition' || header.transferSeal === undefined) {\n throw new ValidationError(\n 'adoptPartition requires an extracted-partition bundle with a transfer seal. '\n + 'For ordinary backups use readPod + vault.load.',\n )\n }\n\n const { dumpJson } = await readPod(bundleBytes)\n const { dump, seal } = parseExtractedPartitionBody(dumpJson)\n\n // Validate the transfer key by unsealing in memory; throws\n // TransferSealError on mismatch. DEKs are discarded here — they stay\n // sealed at rest (in _meta/adoption) until owner-creation wraps them under the\n // recipient's KEK.\n await unsealDeks(seal, transferKey)\n\n // Single-occupancy per vaultName: an `_meta/adoption` marker already present\n // means this slot holds a partition (adopted-and-unowned, or already owned).\n // saveAll below would overwrite its data and replace the marker, stranding the\n // prior adoption's transfer seal. Refuse regardless of sealId — re-adopting the\n // SAME bundle is a redundant call, and adopting a DIFFERENT bundle here would\n // clobber the existing partition. Either way, pick a fresh vaultName.\n const existing = await destinationStore.get(vaultName, '_meta', 'adoption')\n if (existing) {\n const prior = JSON.parse(existing._data) as { sealId?: string }\n if (prior.sealId === seal.sealId) {\n throw new AdoptionStateError(\n `partition (sealId ${seal.sealId}) is already adopted into vault \"${vaultName}\".`,\n )\n }\n throw new AdoptionStateError(\n `vault \"${vaultName}\" already holds an adopted partition (sealId ${prior.sealId}); `\n + `adopting a different partition (sealId ${seal.sealId}) here would overwrite it. `\n + `Adopt into a fresh vaultName instead.`,\n )\n }\n\n // The marker-only check above misses a worse case: a vaultName already in use\n // by an ORDINARY vault (createNoydb + openVault) carries no `_meta/adoption`,\n // yet `saveAll` below is destructive on SQL adapters (`DELETE FROM ... WHERE\n // vault = ?` followed by upsert) and would wipe the legitimate keyring +\n // data. Refuse adoption into ANY occupied slot — a fresh vaultName is the\n // documented precondition.\n const existingKeyring = await destinationStore.list(vaultName, '_keyring')\n if (existingKeyring.length > 0) {\n throw new AdoptionStateError(\n `vault \"${vaultName}\" already holds a keyring (an unrelated owner exists at this slot); `\n + `adoptPartition requires a fresh vaultName to avoid destructive saveAll on SQL adapters.`,\n )\n }\n\n const backup = JSON.parse(dump) as { collections: VaultSnapshot; _internal?: VaultSnapshot }\n await destinationStore.saveAll(vaultName, backup.collections)\n\n // Import carried internal collections (e.g. _schemas from carrySchemas).\n // saveAll only writes data collections; _internal is written per-record.\n if (backup._internal) {\n for (const [collection, records] of Object.entries(backup._internal)) {\n for (const [id, envelope] of Object.entries(records)) {\n await destinationStore.put(vaultName, collection, id, envelope)\n }\n }\n }\n\n const adoptedAt = new Date().toISOString()\n const adoption = { sealId: seal.sealId, adoptedAt, needsOwner: true as const, transferSeal: seal }\n await destinationStore.put(vaultName, '_meta', 'adoption', {\n _noydb: 1, _v: 1, _ts: adoptedAt, _iv: '', _data: JSON.stringify(adoption),\n })\n\n return { vaultName, needsOwner: true, sealId: seal.sealId }\n}\n\nexport interface CreateOwnerResult {\n readonly vaultName: string\n readonly userId: string\n}\n\n/** Standard-mode owner: recipient supplies the passphrase. */\nexport interface CreateOwnerStandardOptions {\n readonly userId: string\n readonly passphrase: string\n readonly transferKey: Uint8Array\n}\n\n/**\n * Managed-mode owner: the passphrase is minted + sealed under\n * a `SealingKeyProvider` (e.g. an `at-*` OS keychain) so the partition\n * auto-unlocks on the recipient's device. Managed mode mandates a strong\n * (Shamir) recovery profile at creation, which needs the\n * `shamirRecovery` provider injected.\n */\nexport interface CreateOwnerManagedOptions {\n readonly userId: string\n readonly passphraseMode: 'managed'\n readonly sealingKey: SealingKeyProvider\n readonly recovery: ReadonlyArray<RecoveryEnrollmentInput>\n readonly shamirRecovery: ShamirRecoveryProvider\n readonly transferKey: Uint8Array\n}\n\nexport type CreateOwnerOptions = CreateOwnerStandardOptions | CreateOwnerManagedOptions\n\nfunction isManaged(o: CreateOwnerOptions): o is CreateOwnerManagedOptions {\n return 'passphraseMode' in o && o.passphraseMode === 'managed'\n}\n\n/**\n * Mint the first owner keyring on an adopted-but-unowned partition,\n * then destroy the transfer seal.\n *\n * Standard mode: the recipient supplies a passphrase. Managed mode: the\n * passphrase is minted + sealed under a `SealingKeyProvider` and a strong\n * (Shamir) recovery profile is enrolled — orchestrated via the existing\n * `openVaultAndEnrollRecovery` ceremony.\n *\n * Either way, reuses `createOwnerKeyring` to derive the KEK + write the base\n * keyring, then wraps the partition's DEKs (recovered from the seal) under that\n * KEK and re-persists the merged keyring file.\n *\n * Idempotent under retry: the seal is destroyed LAST (Stage D), after the\n * keyring (Stage A), the ledger transition (Stage B), and — in managed mode —\n * strong-recovery enrollment (Stage C). A failure in the fallible enrollment\n * step leaves the seal intact, and re-running with the same `userId` +\n * `transferKey` resumes from the first incomplete stage. (Multi-profile recovery\n * arrays may re-enroll an already-enrolled profile on retry; managed mode's\n * mandated single Shamir profile does not.)\n */\nexport async function createOwnerOnAdoptedPartition(\n store: NoydbStore,\n vaultName: string,\n opts: CreateOwnerOptions,\n): Promise<CreateOwnerResult> {\n const { userId, transferKey } = opts\n\n // Managed mode requires a strong (Shamir) recovery profile, validated BEFORE\n // any disk write — same gate as createNoydb.\n if (isManaged(opts) && !opts.recovery.some((r) => r.profile === 'shamir')) {\n throw new AdoptionStateError(\n 'managed-mode adoption requires at least one strong (shamir) recovery profile in '\n + '`recovery` — paper alone is not strong when there is no user passphrase to fall back on.',\n )\n }\n\n // 1. Verify adopted-unowned state.\n const adoptionEnv = await store.get(vaultName, '_meta', 'adoption')\n if (!adoptionEnv) {\n throw new AdoptionStateError(\n `vault \"${vaultName}\" is not an adopted partition (no _meta/adoption). `\n + `createOwnerOnAdoptedPartition only applies to vaults created via adoptPartition.`,\n )\n }\n const adoption = JSON.parse(adoptionEnv._data) as {\n sealId: string; adoptedAt: string; needsOwner?: boolean\n consumedAt?: string; transferSeal?: TransferSealPayload\n }\n if (adoption.consumedAt !== undefined || adoption.transferSeal === undefined) {\n throw new AdoptionStateError(\n `vault \"${vaultName}\" already has an owner (transfer seal consumed at ${adoption.consumedAt}).`,\n )\n }\n\n // 2. Recover the partition DEKs from the seal (throws on wrong key) BEFORE\n // writing any keyring, so a bad transfer key leaves no trace. Always\n // validated, including when resuming a partial prior call.\n const partitionDeks = await unsealDeks(adoption.transferSeal, transferKey)\n\n // The ceremony below is split into stages so a failure in the fallible\n // managed-enrollment step (network/provider outage) leaves the call RETRYABLE\n // — the seal is destroyed only once everything durable is in place. Each stage\n // detects its own prior completion rather than relying on a single resume bit.\n\n // A keyring present for a DIFFERENT user (with the seal still unconsumed) is a\n // genuine second-owner attempt — refuse it. A same-user keyring is a resumed\n // partial call and is handled by the stage checks below.\n const existingKeyring = await store.get(vaultName, '_keyring', userId)\n const otherOwners = (await store.list(vaultName, '_keyring')).filter((u) => u !== userId)\n if (otherOwners.length > 0) {\n throw new AdoptionStateError(\n `vault \"${vaultName}\" already has a keyring for a different owner; cannot create owner \"${userId}\".`,\n )\n }\n\n // Stage A — mint the owner keyring + merge the partition DEKs. Considered done\n // only when the keyring already holds every partition DEK. createOwnerKeyring\n // overwrites (fresh KEK + fresh _users DEK), so re-running is safe ONLY while\n // no recovery has been enrolled yet — guaranteed here because enrollment\n // (Stage C) runs strictly after Stage A completes.\n const partitionCollections = [...partitionDeks.keys()]\n const priorDeks = existingKeyring ? (JSON.parse(existingKeyring._data) as KeyringFile).deks : {}\n const ownerMinted = existingKeyring !== null && partitionCollections.every((c) => c in priorDeks)\n if (!ownerMinted) {\n // Resolve the owner passphrase. Managed mode mints a random passphrase, seals\n // it under the provider, and persists _meta/sealed-passphrase (so the\n // partition auto-unlocks on the recipient's device); standard mode uses the\n // caller's passphrase. Idempotent under retry — resolveManagedSecret's reopen\n // arm reuses an already-sealed passphrase.\n const passphrase = isManaged(opts)\n ? await resolveManagedSecret(store, vaultName, opts.sealingKey)\n : opts.passphrase\n\n // Mint the owner keyring (KEK + _users DEK + canary, written to disk).\n const unlocked = await createOwnerKeyring(store, vaultName, userId, passphrase)\n\n // Merge the partition DEKs (wrapped under the new KEK) into the keyring.\n const env = await store.get(vaultName, '_keyring', userId)\n if (!env) throw new AdoptionStateError(`keyring write for \"${userId}\" did not persist`)\n const keyringFile = JSON.parse(env._data) as KeyringFile\n const kek = unlocked.kek\n if (!kek) throw new AdoptionStateError(`owner keyring for \"${userId}\" has no KEK to wrap partition DEKs under`)\n const mergedDeks: Record<string, string> = { ...keyringFile.deks }\n for (const [collection, dek] of partitionDeks) {\n mergedDeks[collection] = await wrapKey(dek, kek)\n }\n const mergedFile: KeyringFile = { ...keyringFile, deks: mergedDeks }\n await store.put(vaultName, '_keyring', userId, { ...env, _data: JSON.stringify(mergedFile) })\n }\n\n // Stage B — record the ownership transition on the carried\n // audit chain (carryLedger sealed the _ledger DEK). No-op without that DEK.\n // Idempotent: appended only if the closing `transfer-seal-consumed` entry is\n // absent, so a retry does not duplicate the pair.\n const ledgerDek = partitionDeks.get(LEDGER_COLLECTION)\n if (ledgerDek) {\n const ledger = new LedgerStore({\n adapter: store,\n vault: vaultName,\n encrypted: true,\n getDEK: async () => ledgerDek,\n actor: userId,\n })\n const creationReason = `creation-of-new-owner:${userId}`\n const consumedReason = `transfer-seal-consumed:${adoption.sealId}`\n // Gate each append on its own presence — a crash or store error strictly\n // between the two adjacent puts would otherwise re-append the first one\n // on retry. The pair is the audit record, not a single transaction.\n const recordedReasons = new Set((await ledger.loadAllEntries()).map((e) => e.reason))\n if (!recordedReasons.has(creationReason)) {\n await ledger.append({ op: 'lifecycle', collection: '', id: '', version: 0, actor: '', payloadHash: '', reason: creationReason })\n }\n if (!recordedReasons.has(consumedReason)) {\n await ledger.append({ op: 'lifecycle', collection: '', id: '', version: 0, actor: '', payloadHash: '', reason: consumedReason })\n }\n }\n\n // Stage C — Managed mode: enroll the mandatory strong recovery\n // by orchestrating the existing public ceremony. The partition is\n // now a managed-mode vault on disk (sealed passphrase + keyring), so we\n // open it as a normal client and let openVaultAndEnrollRecovery do the\n // gate-bypass + enroll + re-assert. Dynamic import keeps the Noydb class\n // out of the @noy-db/hub/bundle static graph. Runs BEFORE seal destruction\n // so a failure here leaves the seal intact and the call retryable.\n if (isManaged(opts)) {\n const { createNoydb } = await import('../kernel/noydb.js')\n const db = await createNoydb({\n store,\n user: userId,\n passphraseMode: 'managed',\n sealingKey: opts.sealingKey,\n shamirRecovery: opts.shamirRecovery,\n })\n await db.openVaultAndEnrollRecovery(vaultName, { recovery: opts.recovery })\n }\n\n // Stage D — Destroy the transfer seal LAST — the commit point. Everything\n // above is either idempotent or resumable, so the seal is only consumed\n // once the owner keyring (and, in managed mode, strong recovery) is\n // durably in place. Retain sealId + consumedAt for audit.\n const consumed = { sealId: adoption.sealId, adoptedAt: adoption.adoptedAt, consumedAt: new Date().toISOString() }\n await store.put(vaultName, '_meta', 'adoption', { ...adoptionEnv, _data: JSON.stringify(consumed) })\n\n return { vaultName, userId }\n}\n","/**\n * Read-side counterpart to `extractPartition`: decrypt an\n * extracted-partition bundle's records to plaintext using its transfer\n * key, WITHOUT adopting it into a vault. Used by an outward\n * orchestration layer's reconcile/merge and field-authority flows to\n * compare incoming records against a receiver. The transfer key validates the bundle\n * (wrong key throws).\n * @module\n */\nimport type { EncryptedEnvelope } from '../kernel/types.js'\nimport { openEnvelopeJson } from '../kernel/enclave/index.js'\nimport { readPodHeader, readPod, parseExtractedPartitionBody } from '../with-pod/bundle.js'\nimport { unsealDeks } from './adopt-partition.js'\n\n/** One decrypted record from an extracted-partition compartment. */\nexport interface DecryptedRecord {\n readonly id: string\n readonly record: Record<string, unknown>\n /** Source envelope write timestamp (ISO) — for last-write-wins merges. */\n readonly ts: string\n /** Source envelope version. */\n readonly version: number\n /** Provenance source id (FR-5). Present only when the source collection had provenance:true and a source was supplied on put. */\n readonly source?: string\n /** ISO-8601 timestamp the provenance source was recorded (FR-5). */\n readonly sourceTs?: string\n}\n\n/**\n * Decrypt every record of an extracted-partition bundle to plaintext,\n * grouped by collection. Throws if the bundle isn't an\n * extracted-partition or the transfer key is wrong.\n */\nexport async function decryptExtractedPartition(\n bundleBytes: Uint8Array,\n transferKey: Uint8Array,\n): Promise<Record<string, DecryptedRecord[]>> {\n const header = readPodHeader(bundleBytes)\n if (header.bundleKind !== 'extracted-partition' || header.transferSeal === undefined) {\n throw new Error('decryptExtractedPartition: bundle is not an extracted-partition.')\n }\n const { dumpJson } = await readPod(bundleBytes)\n const { dump, seal } = parseExtractedPartitionBody(dumpJson)\n const deks = await unsealDeks(seal, transferKey) // throws TransferSealError on wrong key\n const backup = JSON.parse(dump) as { collections: Record<string, Record<string, EncryptedEnvelope>> }\n const out: Record<string, DecryptedRecord[]> = {}\n for (const [collection, byId] of Object.entries(backup.collections)) {\n const dek = deks.get(collection)\n if (dek === undefined) continue // no DEK sealed for this collection — skip\n const recs: DecryptedRecord[] = []\n for (const [id, env] of Object.entries(byId)) {\n const plaintext = await openEnvelopeJson(env, dek)\n const body = JSON.parse(plaintext) as Record<string, unknown>\n recs.push({\n id,\n record: { ...body, id },\n ts: env._ts,\n version: env._v,\n ...(env._source !== undefined ? { source: env._source } : {}),\n ...(env._sourceTs !== undefined ? { sourceTs: env._sourceTs } : {}),\n })\n }\n out[collection] = recs\n }\n return out\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,eAAsB,WACpB,MACA,aACkC;AAClC,MAAI,YAAY,eAAe,IAAI;AACjC,UAAM,IAAI;AAAA,MACR,sCAAsC,YAAY,UAAU;AAAA,IAC9D;AAAA,EACF;AACA,QAAM,MAAM,MAAM,OAAO,OAAO,UAAU,OAAO,aAA6B,WAAW,OAAO,CAAC,SAAS,CAAC;AAC3G,QAAM,MAAM,eAAe,KAAK,OAAO;AACvC,MAAI;AACJ,MAAI;AACF,gBA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