@noy-db/hub 0.9.0-pre.0 → 0.9.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 (465) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/api-H4B7ZQXP.js +18 -0
  3. package/dist/as/index.js +10 -10
  4. package/dist/at/index.js +8 -8
  5. package/dist/attestation/index.js +18 -18
  6. package/dist/{backup-7RKNZMQO.js → backup-E3GBMNDA.js} +92 -31
  7. package/dist/backup-E3GBMNDA.js.map +1 -0
  8. package/dist/blobs/index.js +12 -12
  9. package/dist/broker/index.js +13 -13
  10. package/dist/by/index.js +2 -2
  11. package/dist/capsule/contract.js +6 -6
  12. package/dist/capsule/enclave-aes/crypto.d.ts +18 -0
  13. package/dist/capsule/enclave-aes/index.d.ts +2 -2
  14. package/dist/capsule/enclave-aes/index.js +14 -8
  15. package/dist/capsule/enclave-aes/index.js.map +1 -1
  16. package/dist/capsule/index.d.ts +1 -1
  17. package/dist/{capsule-57BDK7LG.js → capsule-YQKQZPH7.js} +14 -8
  18. package/dist/cargo/index.js +35 -35
  19. package/dist/{chunk-AJFPAHMW.js → chunk-27NCEPKM.js} +3 -3
  20. package/dist/{chunk-PGC35KXE.js → chunk-2IASHJPS.js} +2 -2
  21. package/dist/{chunk-NYJBYVBG.js → chunk-2ODEFG6K.js} +4 -4
  22. package/dist/{chunk-7BMOS4JQ.js → chunk-2QH3I7QC.js} +11 -11
  23. package/dist/{chunk-VSUQI5Q6.js → chunk-2RH5SEY7.js} +16 -2
  24. package/dist/chunk-2RH5SEY7.js.map +1 -0
  25. package/dist/{chunk-IVMFIKNA.js → chunk-2T2TGRWE.js} +6 -6
  26. package/dist/{chunk-G66YXUTY.js → chunk-35CNOVQE.js} +3 -3
  27. package/dist/{chunk-OJU67C23.js → chunk-3EXQXOQ2.js} +4 -4
  28. package/dist/{chunk-BJH77UY2.js → chunk-4KYKRYRT.js} +2 -2
  29. package/dist/{chunk-RDOEOPOI.js → chunk-4N4OIVK3.js} +5 -5
  30. package/dist/{chunk-WHOKGHJ3.js → chunk-4WLI37WK.js} +7 -7
  31. package/dist/{chunk-RNACRT5H.js → chunk-52ZFNK46.js} +2 -2
  32. package/dist/{chunk-CB4467G3.js → chunk-5A3HOTP5.js} +33 -7
  33. package/dist/chunk-5A3HOTP5.js.map +1 -0
  34. package/dist/{chunk-QDHHHI5Q.js → chunk-5SMCBPJ2.js} +5 -5
  35. package/dist/{chunk-EMAWOGVH.js → chunk-654RE5YC.js} +3 -3
  36. package/dist/{chunk-FZXRLNJO.js → chunk-6BEBWHNL.js} +3 -3
  37. package/dist/{chunk-EUD3HQM4.js → chunk-6WEPFEMJ.js} +4 -4
  38. package/dist/{chunk-YFFMPZPY.js → chunk-6WIFF46H.js} +2 -2
  39. package/dist/{chunk-ZVSKSUGI.js → chunk-7C7OF26T.js} +5 -5
  40. package/dist/{chunk-QXJXG7DN.js → chunk-7IV7GVOS.js} +5 -5
  41. package/dist/{chunk-MQ7YWBQ5.js → chunk-7JRLCP2J.js} +2 -2
  42. package/dist/{chunk-QSHATAXJ.js → chunk-7ONMS7QI.js} +2 -2
  43. package/dist/{chunk-JBMMWYOH.js → chunk-7UHLO4ZN.js} +35 -2
  44. package/dist/chunk-7UHLO4ZN.js.map +1 -0
  45. package/dist/{chunk-6WS35E6X.js → chunk-A52BK5AY.js} +2 -2
  46. package/dist/{chunk-GOJQ5DZA.js → chunk-AI35LNWQ.js} +4 -4
  47. package/dist/chunk-AI35LNWQ.js.map +1 -0
  48. package/dist/{chunk-XXQ5XIYY.js → chunk-AMSSAOOB.js} +2 -2
  49. package/dist/{chunk-3V6LZHUO.js → chunk-AYOQZJDB.js} +2 -2
  50. package/dist/{chunk-DL6BZKP3.js → chunk-B3B6HV5S.js} +2 -2
  51. package/dist/{chunk-5XONHAFD.js → chunk-B6EWMGFX.js} +2 -2
  52. package/dist/{chunk-6Y5E4SJU.js → chunk-BMAXBTYH.js} +5 -5
  53. package/dist/{chunk-LGGIFKJP.js → chunk-BNYDOF2Q.js} +4 -4
  54. package/dist/{chunk-XXNWU5QZ.js → chunk-BQJ5ORU5.js} +2 -2
  55. package/dist/{chunk-Z3ZXVB2Y.js → chunk-BSEPI3HD.js} +12 -12
  56. package/dist/chunk-BSEPI3HD.js.map +1 -0
  57. package/dist/{chunk-BYHCKX73.js → chunk-CLOSXHR4.js} +3 -3
  58. package/dist/{chunk-5HNW4ZTA.js → chunk-CSAN22QG.js} +6 -6
  59. package/dist/{chunk-TZYTMZZY.js → chunk-DL4GCSTS.js} +10 -10
  60. package/dist/{chunk-EA4VDI5D.js → chunk-DYIR6RC3.js} +4 -4
  61. package/dist/{chunk-PUBI455O.js → chunk-EPPAEGH5.js} +2 -2
  62. package/dist/{chunk-2A56DSRI.js → chunk-EQ6C2ZPT.js} +17 -51
  63. package/dist/chunk-EQ6C2ZPT.js.map +1 -0
  64. package/dist/{chunk-BNFNQNEP.js → chunk-F7X7MPK4.js} +2 -2
  65. package/dist/{chunk-SNM7LSYG.js → chunk-FUHUGKDN.js} +4 -4
  66. package/dist/{chunk-72XBVN4J.js → chunk-FVKQ5QUC.js} +2 -2
  67. package/dist/chunk-FVKQ5QUC.js.map +1 -0
  68. package/dist/{chunk-D4V5JJAK.js → chunk-GHMINSER.js} +4 -4
  69. package/dist/{chunk-APFFJN5T.js → chunk-GLSCL74M.js} +31 -34
  70. package/dist/chunk-GLSCL74M.js.map +1 -0
  71. package/dist/{chunk-XKBTJGFP.js → chunk-GU6QXHPZ.js} +3 -3
  72. package/dist/chunk-GU6QXHPZ.js.map +1 -0
  73. package/dist/{chunk-QGFEBNHO.js → chunk-GZISWBCJ.js} +4 -4
  74. package/dist/{chunk-OM3SEDI4.js → chunk-HTRLQ4ZZ.js} +4 -4
  75. package/dist/{chunk-SWXLZ4HX.js → chunk-ICHHNI5E.js} +8 -8
  76. package/dist/{chunk-K673OO6B.js → chunk-ID4ZBC3X.js} +4 -4
  77. package/dist/{chunk-H3YM66EI.js → chunk-IF2M43G4.js} +2 -2
  78. package/dist/{chunk-QGSNJD3B.js → chunk-IFUYLIEY.js} +2 -2
  79. package/dist/{chunk-D5A3GCZ4.js → chunk-IPF5ORDI.js} +3 -3
  80. package/dist/{delegation-ONLM4JFI.js → chunk-JQMEXCUZ.js} +59 -16
  81. package/dist/chunk-JQMEXCUZ.js.map +1 -0
  82. package/dist/{chunk-TFWFPZRU.js → chunk-K5JNK63R.js} +11 -11
  83. package/dist/{chunk-TFWFPZRU.js.map → chunk-K5JNK63R.js.map} +1 -1
  84. package/dist/{chunk-BVF3SXD7.js → chunk-KBIS64X4.js} +5 -5
  85. package/dist/chunk-L4UL4IAR.js +55 -0
  86. package/dist/chunk-L4UL4IAR.js.map +1 -0
  87. package/dist/{chunk-RIZTZJX6.js → chunk-LJ744WXU.js} +2 -2
  88. package/dist/{chunk-XITHENBI.js → chunk-LMC5L3MM.js} +7 -7
  89. package/dist/{chunk-XITHENBI.js.map → chunk-LMC5L3MM.js.map} +1 -1
  90. package/dist/{chunk-L5A3KR7R.js → chunk-LUQBG637.js} +3 -3
  91. package/dist/{chunk-6QLCS7ET.js → chunk-LZN6DTFI.js} +2 -2
  92. package/dist/{chunk-NIXRB5BP.js → chunk-MMWX5OT5.js} +2 -2
  93. package/dist/{chunk-JA25QG5M.js → chunk-N6EWQ5VB.js} +622 -119
  94. package/dist/chunk-N6EWQ5VB.js.map +1 -0
  95. package/dist/{chunk-UOZOWN73.js → chunk-ND6S2DKC.js} +2 -2
  96. package/dist/{chunk-WFWFXDNS.js → chunk-NHEKQWFI.js} +2 -2
  97. package/dist/{chunk-2ZFD2UJC.js → chunk-NIUHKKMM.js} +9 -9
  98. package/dist/{chunk-XA34THLF.js → chunk-NK4LGBGQ.js} +4 -4
  99. package/dist/{chunk-JSWKVZCR.js → chunk-NUZ7ROUZ.js} +2 -2
  100. package/dist/{chunk-DHU2AQ6T.js → chunk-O3NGOHXQ.js} +2 -2
  101. package/dist/{chunk-ZBUAX4EF.js → chunk-O6VOR4NH.js} +2 -2
  102. package/dist/{chunk-JZ4EDEIP.js → chunk-ODBOHPZU.js} +3 -3
  103. package/dist/{chunk-5UUJE4FP.js → chunk-OK44MD3C.js} +2 -2
  104. package/dist/{chunk-ECGXA4LT.js → chunk-OR3OHKU6.js} +2 -2
  105. package/dist/{chunk-ZWF3EWZA.js → chunk-P6FATPXQ.js} +2 -2
  106. package/dist/{chunk-PCYPXLEX.js → chunk-PBEHTFUG.js} +6 -6
  107. package/dist/{chunk-7CT6SX4M.js → chunk-PFHDQY5L.js} +3 -3
  108. package/dist/{chunk-PTJY5R3O.js → chunk-PIO6NW7O.js} +2 -2
  109. package/dist/{chunk-TMIJAR2X.js → chunk-PREYKC76.js} +3 -3
  110. package/dist/{chunk-ZHQJAV6D.js → chunk-PU5ZEV65.js} +2 -2
  111. package/dist/{chunk-UNSQZSZP.js → chunk-PWAMX5KU.js} +2 -2
  112. package/dist/{chunk-GETUTTZU.js → chunk-PZN76MMV.js} +4 -4
  113. package/dist/{chunk-ABU6A4Z5.js → chunk-Q4DBU5RM.js} +2 -2
  114. package/dist/{chunk-2WJKJZSO.js → chunk-QHG7GQKM.js} +2 -2
  115. package/dist/{chunk-UAKY6E4N.js → chunk-QNOWNCZS.js} +2 -2
  116. package/dist/{chunk-JPSL5GIZ.js → chunk-QQLXKDGC.js} +3 -3
  117. package/dist/{chunk-45VHWE4C.js → chunk-QVUMKG3Z.js} +271 -69
  118. package/dist/chunk-QVUMKG3Z.js.map +1 -0
  119. package/dist/{chunk-OK57EATL.js → chunk-R4GLRJ55.js} +2 -2
  120. package/dist/{chunk-B65CC6Z6.js → chunk-RF5WDM25.js} +2 -2
  121. package/dist/{chunk-G46JSSVX.js → chunk-RKBCUP5D.js} +7 -7
  122. package/dist/{chunk-GCUMOKTN.js → chunk-S2ORTQGS.js} +3 -3
  123. package/dist/{chunk-MRJDLXI3.js → chunk-SVXFCCSX.js} +8 -8
  124. package/dist/{chunk-BUE7R3B5.js → chunk-SXPLIRQH.js} +2 -2
  125. package/dist/{chunk-5LMCVBMY.js → chunk-T5EXREMW.js} +5 -5
  126. package/dist/{chunk-PT2YCQVK.js → chunk-TBVDI3LY.js} +4 -4
  127. package/dist/{chunk-BMHQHH7Q.js → chunk-TLIFNRU5.js} +2 -2
  128. package/dist/{chunk-YKGJ44Z7.js → chunk-TU6ZJTYT.js} +3 -3
  129. package/dist/{chunk-FSQNGPHH.js → chunk-U277K5GR.js} +612 -175
  130. package/dist/chunk-U277K5GR.js.map +1 -0
  131. package/dist/{chunk-55P6OBB7.js → chunk-U43RSPPX.js} +2 -2
  132. package/dist/{chunk-K7RW7FI4.js → chunk-UADW5NOU.js} +5 -5
  133. package/dist/{chunk-GRS2HIV6.js → chunk-UMV5GBTJ.js} +2 -2
  134. package/dist/{chunk-4UIP3QNW.js → chunk-UNAMWK2Q.js} +2 -2
  135. package/dist/{chunk-J4KAPKBJ.js → chunk-UORWAG7K.js} +2 -2
  136. package/dist/{chunk-V55JASXO.js → chunk-UQRKAM2R.js} +3 -3
  137. package/dist/{chunk-2ELOCEXE.js → chunk-URGHKZPL.js} +1 -1
  138. package/dist/chunk-URGHKZPL.js.map +1 -0
  139. package/dist/{chunk-ZMVSKYTJ.js → chunk-VLRY2UH4.js} +10 -10
  140. package/dist/{chunk-SPPOUJLN.js → chunk-VZFTON37.js} +2 -2
  141. package/dist/{chunk-CAD7N6HQ.js → chunk-WIUH6EJ7.js} +10 -10
  142. package/dist/chunk-WIUH6EJ7.js.map +1 -0
  143. package/dist/{chunk-YQFBH5ZJ.js → chunk-WQUIJPN4.js} +3 -3
  144. package/dist/{chunk-4J3MNVVX.js → chunk-WRLWEYHY.js} +7 -1
  145. package/dist/{chunk-4J3MNVVX.js.map → chunk-WRLWEYHY.js.map} +1 -1
  146. package/dist/{chunk-NZULV7LK.js → chunk-WVQDY3UM.js} +4 -4
  147. package/dist/{chunk-3Y5JLSXS.js → chunk-X5RGG3ZW.js} +2 -2
  148. package/dist/{chunk-PFCTSXHU.js → chunk-X6Z2SIRF.js} +2 -2
  149. package/dist/{chunk-UHFGK6YA.js → chunk-XQGKS4OW.js} +3 -3
  150. package/dist/{chunk-L2F3CFCH.js → chunk-Y22JWHCP.js} +4 -4
  151. package/dist/{chunk-C53ER7AG.js → chunk-YVA6UPRN.js} +2 -2
  152. package/dist/{chunk-226V6XXJ.js → chunk-Z2KP6PNF.js} +6 -6
  153. package/dist/{chunk-G5EDYVSE.js → chunk-ZK2WT532.js} +5 -5
  154. package/dist/{chunk-SFCD6OU7.js → chunk-ZNVBCKMV.js} +2 -2
  155. package/dist/{chunk-BU2ABHFW.js → chunk-ZOFNZLAA.js} +4 -4
  156. package/dist/{chunk-X2RP4TO5.js → chunk-ZVJKHGE5.js} +7 -7
  157. package/dist/classified/index.js +5 -5
  158. package/dist/{classified-marker-KHDOYIJB.js → classified-marker-7HXDMYHI.js} +3 -3
  159. package/dist/collection-facade-V63BEBGU.js +41 -0
  160. package/dist/{computed-XMFTHAXV.js → computed-LZLSYOPG.js} +3 -3
  161. package/dist/consent/index.js +8 -8
  162. package/dist/cover/index.js +8 -8
  163. package/dist/custody/index.js +12 -12
  164. package/dist/{dead-filter-CXV5NS67.js → dead-filter-PZIJ4F4G.js} +10 -10
  165. package/dist/debug/index.js +7 -7
  166. package/dist/delegation-7SSGIETH.js +26 -0
  167. package/dist/derivations/index.js +22 -22
  168. package/dist/derive-IMI3BMDS.js +20 -0
  169. package/dist/directory/index.js +9 -9
  170. package/dist/{dispatch-2MQFMEGY.js → dispatch-4BUYPWMJ.js} +19 -19
  171. package/dist/{dispatch-OFDA4WQV.js → dispatch-KOPDDPEQ.js} +5 -5
  172. package/dist/executor-7SY3M6TZ.js +8 -0
  173. package/dist/executor-SNHW4ELF.js +35 -0
  174. package/dist/executor-Z3IKK7G3.js +8 -0
  175. package/dist/export-accessible-O7DIVFUO.js +22 -0
  176. package/dist/extract-partition-ELZEJKXM.js +35 -0
  177. package/dist/{fanout-sidecar-BO67PCPO.js → fanout-sidecar-FYDRL7F3.js} +8 -8
  178. package/dist/find-KWB2RYWJ.js +10 -0
  179. package/dist/forget/index.js +8 -8
  180. package/dist/guards/index.js +4 -4
  181. package/dist/history/index.js +15 -13
  182. package/dist/history/index.js.map +1 -1
  183. package/dist/i18n/index.js +13 -13
  184. package/dist/index.d.ts +3 -2
  185. package/dist/index.js +111 -107
  186. package/dist/index.js.map +1 -1
  187. package/dist/indexing/index.js +5 -5
  188. package/dist/introspection/index.js +10 -10
  189. package/dist/issue-5ZHXK4HJ.js +19 -0
  190. package/dist/kernel/collection.d.ts +85 -6
  191. package/dist/kernel/constants.d.ts +7 -0
  192. package/dist/kernel/errors.d.ts +9 -0
  193. package/dist/kernel/merge-authority.d.ts +5 -1
  194. package/dist/kernel/noydb.d.ts +116 -21
  195. package/dist/kernel/rejection-seal.d.ts +13 -0
  196. package/dist/kernel/sync-wiring.d.ts +55 -0
  197. package/dist/kernel/types.d.ts +366 -8
  198. package/dist/kernel/vault.d.ts +39 -5
  199. package/dist/{ledger-MSJGWKGW.js → ledger-UFJCB6T5.js} +10 -10
  200. package/dist/liberate-OEOSNNFH.js +25 -0
  201. package/dist/{link-set-QXXSPPHL.js → link-set-KMUBFN2L.js} +10 -10
  202. package/dist/{managed-secret-VSK7ANQI.js → managed-secret-H5WYSJ46.js} +9 -9
  203. package/dist/materialized-views/index.js +25 -25
  204. package/dist/{migrate-cek-GEBFYBDC.js → migrate-cek-SPESQAAO.js} +2 -2
  205. package/dist/money/index.js +5 -5
  206. package/dist/noydb-QDZ4QIKO.js +100 -0
  207. package/dist/on/index.js +12 -12
  208. package/dist/overlay-views/index.js +4 -4
  209. package/dist/periods/index.js +11 -11
  210. package/dist/pod/index.js +66 -64
  211. package/dist/{pod-handle-YE7CT66T.js → pod-handle-GJLCOUGK.js} +8 -8
  212. package/dist/policy/index.js +9 -9
  213. package/dist/port/at/index.d.ts +1 -1
  214. package/dist/port/by/index.d.ts +1 -1
  215. package/dist/port/on/index.d.ts +1 -1
  216. package/dist/port/with/admission-authority.d.ts +34 -0
  217. package/dist/port/with/broker-strategy.d.ts +10 -0
  218. package/dist/port/with/rejection-courier.d.ts +37 -0
  219. package/dist/port/with/restore-host.d.ts +33 -0
  220. package/dist/port/with/service-bus.d.ts +18 -0
  221. package/dist/port/with/team-strategy.d.ts +2 -2
  222. package/dist/port/with/write-hooks.d.ts +2 -0
  223. package/dist/portability/index.js +8 -8
  224. package/dist/{post-register-QC5TEAW3.js → post-register-2AC2STHC.js} +6 -6
  225. package/dist/query/all/index.js +15 -15
  226. package/dist/query/index.js +7 -7
  227. package/dist/query/live/index.js +7 -7
  228. package/dist/query/reduce/index.js +10 -10
  229. package/dist/query/relate/index.js +9 -9
  230. package/dist/reduce/index.js +8 -8
  231. package/dist/register-PIORIMMR.js +30 -0
  232. package/dist/registry-BIMICFUH.js +23 -0
  233. package/dist/registry-JGWLW53D.js +35 -0
  234. package/dist/registry-SELCBYEQ.js +8 -0
  235. package/dist/registry-W327UNYH.js +8 -0
  236. package/dist/request-withdrawal-K3SXXODI.js +28 -0
  237. package/dist/restore-to-OOPKLAPU.js +66 -0
  238. package/dist/restore-to-OOPKLAPU.js.map +1 -0
  239. package/dist/{reveal-YQTRNQFH.js → reveal-UAPBG743.js} +7 -7
  240. package/dist/revoke-6AFVXTWF.js +24 -0
  241. package/dist/satellites/index.js +1 -1
  242. package/dist/schema-update/index.js +2 -2
  243. package/dist/sealed-record/index.js +11 -11
  244. package/dist/search/index.js +4 -4
  245. package/dist/{seed-JMQTRKRE.js → seed-BVYDPVIW.js} +33 -18
  246. package/dist/seed-BVYDPVIW.js.map +1 -0
  247. package/dist/sequence/index.js +8 -8
  248. package/dist/session/index.js +8 -8
  249. package/dist/shadow/index.js +2 -2
  250. package/dist/signer-TW5MAQJP.js +23 -0
  251. package/dist/snapshots/index.js +9 -9
  252. package/dist/{stale-SKV33PBU.js → stale-CROGJBIJ.js} +9 -9
  253. package/dist/storage-SO2L2Z5J.js +21 -0
  254. package/dist/{store-coordination-provider-Z6HKPOGM.js → store-coordination-provider-2YD2PTTP.js} +9 -9
  255. package/dist/sync/index.js +16 -16
  256. package/dist/sync/index.js.map +1 -1
  257. package/dist/team/index.js +15 -15
  258. package/dist/tiers/index.js +10 -10
  259. package/dist/to/index.js +2 -2
  260. package/dist/transactions/index.js +3 -3
  261. package/dist/util/index.js +1 -1
  262. package/dist/vault-head/index.js +7 -7
  263. package/dist/{verify-KWQIWLGH.js → verify-QWO5UKD6.js} +7 -7
  264. package/dist/walk-3KEOL7BY.js +20 -0
  265. package/dist/with-audit/guards/types.d.ts +2 -0
  266. package/dist/with-audit/tiers/index.d.ts +5 -5
  267. package/dist/with-commit/history/history.d.ts +16 -0
  268. package/dist/with-commit/history/restore-to.d.ts +40 -0
  269. package/dist/with-party/broker/seed.d.ts +4 -0
  270. package/dist/with-party/custody/strategy.d.ts +2 -2
  271. package/dist/with-party/team/delegation.d.ts +41 -11
  272. package/dist/with-party/team/index.d.ts +2 -0
  273. package/dist/with-party/team/keyring.d.ts +133 -3
  274. package/dist/with-party/team/managed-secret.d.ts +1 -1
  275. package/dist/with-party/team/noydb-facade.d.ts +14 -2
  276. package/dist/with-party/team/roster-tag.d.ts +1 -1
  277. package/dist/with-pod/backup.d.ts +9 -17
  278. package/dist/with-sync/active.d.ts +28 -1
  279. package/dist/with-sync/engine.d.ts +59 -2
  280. package/dist/with-sync/index.d.ts +1 -0
  281. package/dist/with-sync/reserved-mirror.d.ts +27 -4
  282. package/dist/with-sync/strategy.d.ts +2 -0
  283. package/dist/withdraw-accessible-OZU525ND.js +25 -0
  284. package/dist/withdraw-accessible-OZU525ND.js.map +1 -0
  285. package/package.json +3 -3
  286. package/dist/api-MSJXVYQG.js +0 -18
  287. package/dist/backup-7RKNZMQO.js.map +0 -1
  288. package/dist/chunk-2A56DSRI.js.map +0 -1
  289. package/dist/chunk-2ELOCEXE.js.map +0 -1
  290. package/dist/chunk-45VHWE4C.js.map +0 -1
  291. package/dist/chunk-72XBVN4J.js.map +0 -1
  292. package/dist/chunk-APFFJN5T.js.map +0 -1
  293. package/dist/chunk-CAD7N6HQ.js.map +0 -1
  294. package/dist/chunk-CB4467G3.js.map +0 -1
  295. package/dist/chunk-FSQNGPHH.js.map +0 -1
  296. package/dist/chunk-GOJQ5DZA.js.map +0 -1
  297. package/dist/chunk-JA25QG5M.js.map +0 -1
  298. package/dist/chunk-JBMMWYOH.js.map +0 -1
  299. package/dist/chunk-VSUQI5Q6.js.map +0 -1
  300. package/dist/chunk-XKBTJGFP.js.map +0 -1
  301. package/dist/chunk-Z3ZXVB2Y.js.map +0 -1
  302. package/dist/collection-facade-LZIF7GWD.js +0 -41
  303. package/dist/delegation-ONLM4JFI.js.map +0 -1
  304. package/dist/derive-3YSIS36W.js +0 -20
  305. package/dist/executor-E6YDJ7YA.js +0 -8
  306. package/dist/executor-NJX3YQQ4.js +0 -35
  307. package/dist/executor-WWM3DD4P.js +0 -8
  308. package/dist/export-accessible-RLHU5G4W.js +0 -22
  309. package/dist/extract-partition-QII2EDCS.js +0 -35
  310. package/dist/find-6M7GYDUZ.js +0 -10
  311. package/dist/issue-LPEEEMPP.js +0 -19
  312. package/dist/liberate-LEKDYKTC.js +0 -25
  313. package/dist/noydb-F2AUF6KL.js +0 -98
  314. package/dist/register-SN72QALV.js +0 -30
  315. package/dist/registry-253FF7C6.js +0 -35
  316. package/dist/registry-3AZWQTDT.js +0 -23
  317. package/dist/registry-7UEBTHWG.js +0 -8
  318. package/dist/registry-IVJ67NFQ.js +0 -8
  319. package/dist/request-withdrawal-UKVJZKX2.js +0 -28
  320. package/dist/revoke-G2KXJQA5.js +0 -24
  321. package/dist/seed-JMQTRKRE.js.map +0 -1
  322. package/dist/signer-IUIYR3CX.js +0 -23
  323. package/dist/storage-NPBYP2SM.js +0 -21
  324. package/dist/walk-F4OLXI5H.js +0 -20
  325. package/dist/withdraw-accessible-ZKPLZ66E.js +0 -25
  326. /package/dist/{api-MSJXVYQG.js.map → api-H4B7ZQXP.js.map} +0 -0
  327. /package/dist/{capsule-57BDK7LG.js.map → capsule-YQKQZPH7.js.map} +0 -0
  328. /package/dist/{chunk-AJFPAHMW.js.map → chunk-27NCEPKM.js.map} +0 -0
  329. /package/dist/{chunk-PGC35KXE.js.map → chunk-2IASHJPS.js.map} +0 -0
  330. /package/dist/{chunk-NYJBYVBG.js.map → chunk-2ODEFG6K.js.map} +0 -0
  331. /package/dist/{chunk-7BMOS4JQ.js.map → chunk-2QH3I7QC.js.map} +0 -0
  332. /package/dist/{chunk-IVMFIKNA.js.map → chunk-2T2TGRWE.js.map} +0 -0
  333. /package/dist/{chunk-G66YXUTY.js.map → chunk-35CNOVQE.js.map} +0 -0
  334. /package/dist/{chunk-OJU67C23.js.map → chunk-3EXQXOQ2.js.map} +0 -0
  335. /package/dist/{chunk-BJH77UY2.js.map → chunk-4KYKRYRT.js.map} +0 -0
  336. /package/dist/{chunk-RDOEOPOI.js.map → chunk-4N4OIVK3.js.map} +0 -0
  337. /package/dist/{chunk-WHOKGHJ3.js.map → chunk-4WLI37WK.js.map} +0 -0
  338. /package/dist/{chunk-RNACRT5H.js.map → chunk-52ZFNK46.js.map} +0 -0
  339. /package/dist/{chunk-QDHHHI5Q.js.map → chunk-5SMCBPJ2.js.map} +0 -0
  340. /package/dist/{chunk-EMAWOGVH.js.map → chunk-654RE5YC.js.map} +0 -0
  341. /package/dist/{chunk-FZXRLNJO.js.map → chunk-6BEBWHNL.js.map} +0 -0
  342. /package/dist/{chunk-EUD3HQM4.js.map → chunk-6WEPFEMJ.js.map} +0 -0
  343. /package/dist/{chunk-YFFMPZPY.js.map → chunk-6WIFF46H.js.map} +0 -0
  344. /package/dist/{chunk-ZVSKSUGI.js.map → chunk-7C7OF26T.js.map} +0 -0
  345. /package/dist/{chunk-QXJXG7DN.js.map → chunk-7IV7GVOS.js.map} +0 -0
  346. /package/dist/{chunk-MQ7YWBQ5.js.map → chunk-7JRLCP2J.js.map} +0 -0
  347. /package/dist/{chunk-QSHATAXJ.js.map → chunk-7ONMS7QI.js.map} +0 -0
  348. /package/dist/{chunk-6WS35E6X.js.map → chunk-A52BK5AY.js.map} +0 -0
  349. /package/dist/{chunk-XXQ5XIYY.js.map → chunk-AMSSAOOB.js.map} +0 -0
  350. /package/dist/{chunk-3V6LZHUO.js.map → chunk-AYOQZJDB.js.map} +0 -0
  351. /package/dist/{chunk-DL6BZKP3.js.map → chunk-B3B6HV5S.js.map} +0 -0
  352. /package/dist/{chunk-5XONHAFD.js.map → chunk-B6EWMGFX.js.map} +0 -0
  353. /package/dist/{chunk-6Y5E4SJU.js.map → chunk-BMAXBTYH.js.map} +0 -0
  354. /package/dist/{chunk-LGGIFKJP.js.map → chunk-BNYDOF2Q.js.map} +0 -0
  355. /package/dist/{chunk-XXNWU5QZ.js.map → chunk-BQJ5ORU5.js.map} +0 -0
  356. /package/dist/{chunk-BYHCKX73.js.map → chunk-CLOSXHR4.js.map} +0 -0
  357. /package/dist/{chunk-5HNW4ZTA.js.map → chunk-CSAN22QG.js.map} +0 -0
  358. /package/dist/{chunk-TZYTMZZY.js.map → chunk-DL4GCSTS.js.map} +0 -0
  359. /package/dist/{chunk-EA4VDI5D.js.map → chunk-DYIR6RC3.js.map} +0 -0
  360. /package/dist/{chunk-PUBI455O.js.map → chunk-EPPAEGH5.js.map} +0 -0
  361. /package/dist/{chunk-BNFNQNEP.js.map → chunk-F7X7MPK4.js.map} +0 -0
  362. /package/dist/{chunk-SNM7LSYG.js.map → chunk-FUHUGKDN.js.map} +0 -0
  363. /package/dist/{chunk-D4V5JJAK.js.map → chunk-GHMINSER.js.map} +0 -0
  364. /package/dist/{chunk-QGFEBNHO.js.map → chunk-GZISWBCJ.js.map} +0 -0
  365. /package/dist/{chunk-OM3SEDI4.js.map → chunk-HTRLQ4ZZ.js.map} +0 -0
  366. /package/dist/{chunk-SWXLZ4HX.js.map → chunk-ICHHNI5E.js.map} +0 -0
  367. /package/dist/{chunk-K673OO6B.js.map → chunk-ID4ZBC3X.js.map} +0 -0
  368. /package/dist/{chunk-H3YM66EI.js.map → chunk-IF2M43G4.js.map} +0 -0
  369. /package/dist/{chunk-QGSNJD3B.js.map → chunk-IFUYLIEY.js.map} +0 -0
  370. /package/dist/{chunk-D5A3GCZ4.js.map → chunk-IPF5ORDI.js.map} +0 -0
  371. /package/dist/{chunk-BVF3SXD7.js.map → chunk-KBIS64X4.js.map} +0 -0
  372. /package/dist/{chunk-RIZTZJX6.js.map → chunk-LJ744WXU.js.map} +0 -0
  373. /package/dist/{chunk-L5A3KR7R.js.map → chunk-LUQBG637.js.map} +0 -0
  374. /package/dist/{chunk-6QLCS7ET.js.map → chunk-LZN6DTFI.js.map} +0 -0
  375. /package/dist/{chunk-NIXRB5BP.js.map → chunk-MMWX5OT5.js.map} +0 -0
  376. /package/dist/{chunk-UOZOWN73.js.map → chunk-ND6S2DKC.js.map} +0 -0
  377. /package/dist/{chunk-WFWFXDNS.js.map → chunk-NHEKQWFI.js.map} +0 -0
  378. /package/dist/{chunk-2ZFD2UJC.js.map → chunk-NIUHKKMM.js.map} +0 -0
  379. /package/dist/{chunk-XA34THLF.js.map → chunk-NK4LGBGQ.js.map} +0 -0
  380. /package/dist/{chunk-JSWKVZCR.js.map → chunk-NUZ7ROUZ.js.map} +0 -0
  381. /package/dist/{chunk-DHU2AQ6T.js.map → chunk-O3NGOHXQ.js.map} +0 -0
  382. /package/dist/{chunk-ZBUAX4EF.js.map → chunk-O6VOR4NH.js.map} +0 -0
  383. /package/dist/{chunk-JZ4EDEIP.js.map → chunk-ODBOHPZU.js.map} +0 -0
  384. /package/dist/{chunk-5UUJE4FP.js.map → chunk-OK44MD3C.js.map} +0 -0
  385. /package/dist/{chunk-ECGXA4LT.js.map → chunk-OR3OHKU6.js.map} +0 -0
  386. /package/dist/{chunk-ZWF3EWZA.js.map → chunk-P6FATPXQ.js.map} +0 -0
  387. /package/dist/{chunk-PCYPXLEX.js.map → chunk-PBEHTFUG.js.map} +0 -0
  388. /package/dist/{chunk-7CT6SX4M.js.map → chunk-PFHDQY5L.js.map} +0 -0
  389. /package/dist/{chunk-PTJY5R3O.js.map → chunk-PIO6NW7O.js.map} +0 -0
  390. /package/dist/{chunk-TMIJAR2X.js.map → chunk-PREYKC76.js.map} +0 -0
  391. /package/dist/{chunk-ZHQJAV6D.js.map → chunk-PU5ZEV65.js.map} +0 -0
  392. /package/dist/{chunk-UNSQZSZP.js.map → chunk-PWAMX5KU.js.map} +0 -0
  393. /package/dist/{chunk-GETUTTZU.js.map → chunk-PZN76MMV.js.map} +0 -0
  394. /package/dist/{chunk-ABU6A4Z5.js.map → chunk-Q4DBU5RM.js.map} +0 -0
  395. /package/dist/{chunk-2WJKJZSO.js.map → chunk-QHG7GQKM.js.map} +0 -0
  396. /package/dist/{chunk-UAKY6E4N.js.map → chunk-QNOWNCZS.js.map} +0 -0
  397. /package/dist/{chunk-JPSL5GIZ.js.map → chunk-QQLXKDGC.js.map} +0 -0
  398. /package/dist/{chunk-OK57EATL.js.map → chunk-R4GLRJ55.js.map} +0 -0
  399. /package/dist/{chunk-B65CC6Z6.js.map → chunk-RF5WDM25.js.map} +0 -0
  400. /package/dist/{chunk-G46JSSVX.js.map → chunk-RKBCUP5D.js.map} +0 -0
  401. /package/dist/{chunk-GCUMOKTN.js.map → chunk-S2ORTQGS.js.map} +0 -0
  402. /package/dist/{chunk-MRJDLXI3.js.map → chunk-SVXFCCSX.js.map} +0 -0
  403. /package/dist/{chunk-BUE7R3B5.js.map → chunk-SXPLIRQH.js.map} +0 -0
  404. /package/dist/{chunk-5LMCVBMY.js.map → chunk-T5EXREMW.js.map} +0 -0
  405. /package/dist/{chunk-PT2YCQVK.js.map → chunk-TBVDI3LY.js.map} +0 -0
  406. /package/dist/{chunk-BMHQHH7Q.js.map → chunk-TLIFNRU5.js.map} +0 -0
  407. /package/dist/{chunk-YKGJ44Z7.js.map → chunk-TU6ZJTYT.js.map} +0 -0
  408. /package/dist/{chunk-55P6OBB7.js.map → chunk-U43RSPPX.js.map} +0 -0
  409. /package/dist/{chunk-K7RW7FI4.js.map → chunk-UADW5NOU.js.map} +0 -0
  410. /package/dist/{chunk-GRS2HIV6.js.map → chunk-UMV5GBTJ.js.map} +0 -0
  411. /package/dist/{chunk-4UIP3QNW.js.map → chunk-UNAMWK2Q.js.map} +0 -0
  412. /package/dist/{chunk-J4KAPKBJ.js.map → chunk-UORWAG7K.js.map} +0 -0
  413. /package/dist/{chunk-V55JASXO.js.map → chunk-UQRKAM2R.js.map} +0 -0
  414. /package/dist/{chunk-ZMVSKYTJ.js.map → chunk-VLRY2UH4.js.map} +0 -0
  415. /package/dist/{chunk-SPPOUJLN.js.map → chunk-VZFTON37.js.map} +0 -0
  416. /package/dist/{chunk-YQFBH5ZJ.js.map → chunk-WQUIJPN4.js.map} +0 -0
  417. /package/dist/{chunk-NZULV7LK.js.map → chunk-WVQDY3UM.js.map} +0 -0
  418. /package/dist/{chunk-3Y5JLSXS.js.map → chunk-X5RGG3ZW.js.map} +0 -0
  419. /package/dist/{chunk-PFCTSXHU.js.map → chunk-X6Z2SIRF.js.map} +0 -0
  420. /package/dist/{chunk-UHFGK6YA.js.map → chunk-XQGKS4OW.js.map} +0 -0
  421. /package/dist/{chunk-L2F3CFCH.js.map → chunk-Y22JWHCP.js.map} +0 -0
  422. /package/dist/{chunk-C53ER7AG.js.map → chunk-YVA6UPRN.js.map} +0 -0
  423. /package/dist/{chunk-226V6XXJ.js.map → chunk-Z2KP6PNF.js.map} +0 -0
  424. /package/dist/{chunk-G5EDYVSE.js.map → chunk-ZK2WT532.js.map} +0 -0
  425. /package/dist/{chunk-SFCD6OU7.js.map → chunk-ZNVBCKMV.js.map} +0 -0
  426. /package/dist/{chunk-BU2ABHFW.js.map → chunk-ZOFNZLAA.js.map} +0 -0
  427. /package/dist/{chunk-X2RP4TO5.js.map → chunk-ZVJKHGE5.js.map} +0 -0
  428. /package/dist/{classified-marker-KHDOYIJB.js.map → classified-marker-7HXDMYHI.js.map} +0 -0
  429. /package/dist/{collection-facade-LZIF7GWD.js.map → collection-facade-V63BEBGU.js.map} +0 -0
  430. /package/dist/{computed-XMFTHAXV.js.map → computed-LZLSYOPG.js.map} +0 -0
  431. /package/dist/{dead-filter-CXV5NS67.js.map → dead-filter-PZIJ4F4G.js.map} +0 -0
  432. /package/dist/{derive-3YSIS36W.js.map → delegation-7SSGIETH.js.map} +0 -0
  433. /package/dist/{executor-E6YDJ7YA.js.map → derive-IMI3BMDS.js.map} +0 -0
  434. /package/dist/{dispatch-2MQFMEGY.js.map → dispatch-4BUYPWMJ.js.map} +0 -0
  435. /package/dist/{dispatch-OFDA4WQV.js.map → dispatch-KOPDDPEQ.js.map} +0 -0
  436. /package/dist/{executor-NJX3YQQ4.js.map → executor-7SY3M6TZ.js.map} +0 -0
  437. /package/dist/{executor-WWM3DD4P.js.map → executor-SNHW4ELF.js.map} +0 -0
  438. /package/dist/{export-accessible-RLHU5G4W.js.map → executor-Z3IKK7G3.js.map} +0 -0
  439. /package/dist/{extract-partition-QII2EDCS.js.map → export-accessible-O7DIVFUO.js.map} +0 -0
  440. /package/dist/{find-6M7GYDUZ.js.map → extract-partition-ELZEJKXM.js.map} +0 -0
  441. /package/dist/{fanout-sidecar-BO67PCPO.js.map → fanout-sidecar-FYDRL7F3.js.map} +0 -0
  442. /package/dist/{issue-LPEEEMPP.js.map → find-KWB2RYWJ.js.map} +0 -0
  443. /package/dist/{ledger-MSJGWKGW.js.map → issue-5ZHXK4HJ.js.map} +0 -0
  444. /package/dist/{liberate-LEKDYKTC.js.map → ledger-UFJCB6T5.js.map} +0 -0
  445. /package/dist/{link-set-QXXSPPHL.js.map → liberate-OEOSNNFH.js.map} +0 -0
  446. /package/dist/{managed-secret-VSK7ANQI.js.map → link-set-KMUBFN2L.js.map} +0 -0
  447. /package/dist/{noydb-F2AUF6KL.js.map → managed-secret-H5WYSJ46.js.map} +0 -0
  448. /package/dist/{migrate-cek-GEBFYBDC.js.map → migrate-cek-SPESQAAO.js.map} +0 -0
  449. /package/dist/{register-SN72QALV.js.map → noydb-QDZ4QIKO.js.map} +0 -0
  450. /package/dist/{pod-handle-YE7CT66T.js.map → pod-handle-GJLCOUGK.js.map} +0 -0
  451. /package/dist/{post-register-QC5TEAW3.js.map → post-register-2AC2STHC.js.map} +0 -0
  452. /package/dist/{registry-253FF7C6.js.map → register-PIORIMMR.js.map} +0 -0
  453. /package/dist/{registry-3AZWQTDT.js.map → registry-BIMICFUH.js.map} +0 -0
  454. /package/dist/{registry-7UEBTHWG.js.map → registry-JGWLW53D.js.map} +0 -0
  455. /package/dist/{registry-IVJ67NFQ.js.map → registry-SELCBYEQ.js.map} +0 -0
  456. /package/dist/{request-withdrawal-UKVJZKX2.js.map → registry-W327UNYH.js.map} +0 -0
  457. /package/dist/{revoke-G2KXJQA5.js.map → request-withdrawal-K3SXXODI.js.map} +0 -0
  458. /package/dist/{reveal-YQTRNQFH.js.map → reveal-UAPBG743.js.map} +0 -0
  459. /package/dist/{signer-IUIYR3CX.js.map → revoke-6AFVXTWF.js.map} +0 -0
  460. /package/dist/{stale-SKV33PBU.js.map → signer-TW5MAQJP.js.map} +0 -0
  461. /package/dist/{storage-NPBYP2SM.js.map → stale-CROGJBIJ.js.map} +0 -0
  462. /package/dist/{walk-F4OLXI5H.js.map → storage-SO2L2Z5J.js.map} +0 -0
  463. /package/dist/{store-coordination-provider-Z6HKPOGM.js.map → store-coordination-provider-2YD2PTTP.js.map} +0 -0
  464. /package/dist/{verify-KWQIWLGH.js.map → verify-QWO5UKD6.js.map} +0 -0
  465. /package/dist/{withdraw-accessible-ZKPLZ66E.js.map → walk-3KEOL7BY.js.map} +0 -0
@@ -1 +0,0 @@
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 { MANIFEST_COLLECTION } from '../with-shape/manifest/reserved-collections.js'\n// #1025 — imported from the dependency-light `window.ts`, not `periods.ts`: that\n// module exists precisely so a consumer can name the period collections without\n// dragging the ledger hash-chain machinery (`sha256Hex`/`canonicalJson`) into a\n// bundle that opted out of the periods service. Same reason the sync engine's\n// period-scoped pull imports it.\nimport {\n PERIODS_COLLECTION,\n PERIOD_FREEZES_COLLECTION,\n PERIOD_ARCHIVES_COLLECTION,\n PERIOD_TARGET_PURGES_COLLECTION,\n PERIOD_REOPENS_COLLECTION,\n} from '../with-audit/periods/window.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'\nimport { buildRecordEnvelope } from '../capsule/index.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 MANIFEST_COLLECTION, // #941: the pod's manifest-set record(s) travel in the bundle too\n // #1025: the accounting-period close state + its companions. The bundle is\n // the backup/restore path, so without these a restore discarded the\n // hash-chained evidence that a month was ever closed — the artifact\n // `closePeriod` exists to produce — and dropped the write gate with it, so\n // the restored vault silently accepted back-dated writes into a sealed\n // month. The companions matter as much as the close: a bounded reopen\n // window (`reopenPeriod({ until })`) is state a restore must not lose.\n PERIODS_COLLECTION,\n PERIOD_REOPENS_COLLECTION,\n PERIOD_FREEZES_COLLECTION,\n PERIOD_ARCHIVES_COLLECTION,\n PERIOD_TARGET_PURGES_COLLECTION,\n '_history', // full-snapshot version history — so history()/getVersion()/diff() survive the bundle\n '_blob_index', '_blob_chunks', '_blob_eviction_audit',\n // #753 spec §7 Q3: `_blob_intent` markers travel too — restoring mid-op\n // state (a blob row without its marker) would reproduce the ambiguity\n // the journal exists to prevent. Note: `_mv_stale` does NOT travel\n // today (a pre-existing, separate gap) — observed here, tracked on\n // #761, not fixed in this pass.\n '_blob_intent',\n // #769: `_blob_slots_<c>` envelopes travel verbatim (raw ciphertext,\n // same DEK, same vault) — including any `SlotRecord.pendingRelease`\n // resume breadcrumb they carry. This is INTENTIONALLY the opposite of\n // `extract-partition`'s `reKeyBlobs`, which STRIPS `pendingRelease`:\n // a full-vault backup restores into the SAME vault it was taken from,\n // so a breadcrumb taken mid-rehome (together with its `_blob_intent`\n // marker, carried above) is resumable on restore — carry-and-resume is\n // correct here. A partition extraction crosses vaults: the breadcrumb's\n // old eTag may not exist in the destination, so it must be stripped\n // there instead. Asymmetry: backup = same-vault-resumable = carry;\n // partition = cross-vault = strip-breadcrumb-carry-marker.\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 = buildRecordEnvelope({ collection: '_keyring', id: userId, version: 1 },\n { iv: '', data: JSON.stringify(keyringFile) })\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. A backup with no ledgerHead cannot be\n // integrity-checked, and skipping silently would collapse\n // *unverifiable* into *clean* — so it always warns. But the REMEDY\n // depends on the reader, not the pod (#1303): the pod cannot say\n // whether its exporter predates the ledger or never enabled it, and\n // the reader knows its own configuration.\n //\n // - Reader HAS the ledger: the pod is behind it. \"Re-export\" is\n // actionable; keep the migration wording.\n // - Reader has NO ledger: nothing is stale and nothing is migrating —\n // the consumer priced the ledger (#1248 measured ~2.4x) and declined.\n // Prescribing a re-export is advice they should not take, and\n // repeating it on every read trains people to filter the one line\n // that also fires on a genuinely stale pod. State the consequence,\n // name the discriminator, prescribe nothing.\n if (!backup.ledgerHead) {\n if (ctx.getLedgerOrNull()) {\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 } else {\n console.warn(\n `[noy-db] Loaded a backup with no ledgerHead — this pod is not integrity-checked. ` +\n `This reader has no ledger enabled (withHistory() is not configured), so nothing is stale: ` +\n `enable the ledger on both the exporter and this reader if tamper detection is wanted.`,\n )\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+FA,eAAsB,UAAU,KAAqC;AACnE,QAAM,WAAW,MAAM,IAAI,QAAQ,QAAQ,IAAI,KAAK;AAIpD,QAAM,aAAa,MAAM,IAAI,QAAQ,KAAK,IAAI,OAAO,UAAU;AAC/D,QAAM,WAAoC,CAAC;AAC3C,aAAW,aAAa,YAAY;AAClC,UAAM,WAAW,MAAM,IAAI,QAAQ,IAAI,IAAI,OAAO,YAAY,SAAS;AACvE,QAAI,UAAU;AACZ,eAAS,SAAS,IAAI,KAAK,MAAM,SAAS,SAAS,EAA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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 +0,0 @@
1
- {"version":3,"sources":["../src/with-commit/history/history.ts","../src/with-commit/history/strategy.ts"],"sourcesContent":["import { buildRecordEnvelope } from '../../capsule/index.js'\nimport type { RecordIdentity } from '../../capsule/index.js'\nimport type { NoydbStore, EncryptedEnvelope, HistoryOptions, PruneOptions } from '../../kernel/types.js'\nimport { isTombstone, isTombstoneShape, rewrapEnvelope, isRewrappedUnder, type EnclaveKey } from '../../capsule/index.js'\n\n/**\n * History storage convention:\n * Collection: `_history`\n * ID format: `{collection}:{recordId}:{paddedVersion}`\n * Version is zero-padded to 10 digits for lexicographic sorting.\n */\n\nconst HISTORY_COLLECTION = '_history'\nconst VERSION_PAD = 10\n\nfunction historyId(collection: string, recordId: string, version: number): string {\n return `${collection}:${recordId}:${String(version).padStart(VERSION_PAD, '0')}`\n}\n\n/**\n * The identity a history snapshot is **sealed against** — its STORAGE location,\n * not the live record it is a copy of (#1041).\n *\n * ## Why storage, and why this is a decision rather than a detail\n *\n * A snapshot is a copy, so two identities are available: the live record\n * (`collection`/`recordId`) or where the bytes actually land\n * (`_history`/`historyId(...)`). They are not equivalent under attack.\n *\n * Binding the LIVE identity makes a snapshot's AAD **indistinguishable from the\n * live record's at the same version** — so an untrusted store could serve a\n * history entry *as the current record* and the client would accept it. It also\n * leaves entries relocatable within `_history`.\n *\n * Binding STORAGE identity closes both. The cost is that the id must be known\n * *before* the envelope is sealed, where `saveHistory` previously derived it\n * *after* (from `envelope._v`) — which is precisely the restructure this\n * function exists to make possible.\n *\n * `saveHistory` uses this too, so the sealed identity and the put location have\n * **one definition** and cannot drift apart. Changing the layout here changes\n * both at once, by construction.\n */\nexport function historyIdentity(collection: string, recordId: string, version: number): RecordIdentity {\n // The snapshot's own `_v` IS the version it preserves — the same number that\n // appears in its id. One argument feeds both, so they cannot disagree (#1093).\n return { collection: HISTORY_COLLECTION, id: historyId(collection, recordId, version), version }\n}\n\n// Unused today, kept for future history-id parsing utilities.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction parseHistoryId(id: string): { collection: string; recordId: string; version: number } | null {\n const lastColon = id.lastIndexOf(':')\n if (lastColon < 0) return null\n const versionStr = id.slice(lastColon + 1)\n const rest = id.slice(0, lastColon)\n const firstColon = rest.indexOf(':')\n if (firstColon < 0) return null\n return {\n collection: rest.slice(0, firstColon),\n recordId: rest.slice(firstColon + 1),\n version: parseInt(versionStr, 10),\n }\n}\n\nfunction matchesPrefix(id: string, collection: string, recordId?: string): boolean {\n if (recordId) {\n return id.startsWith(`${collection}:${recordId}:`)\n }\n return id.startsWith(`${collection}:`)\n}\n\n/** Save a history entry (a complete encrypted envelope snapshot). */\nexport async function saveHistory(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n envelope: EncryptedEnvelope,\n): Promise<void> {\n // Same derivation the caller sealed against — one definition, so the sealed\n // identity and the put location cannot drift (#1041).\n const { id } = historyIdentity(collection, recordId, envelope._v)\n await adapter.put(vault, HISTORY_COLLECTION, id, envelope)\n}\n\n/** Get history entries for a record, sorted newest-first. */\nexport async function getHistory(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n options?: HistoryOptions,\n): Promise<EncryptedEnvelope[]> {\n const allIds = await adapter.list(vault, HISTORY_COLLECTION)\n const matchingIds = allIds\n .filter(id => matchesPrefix(id, collection, recordId))\n .sort()\n .reverse() // newest first\n\n const entries: EncryptedEnvelope[] = []\n\n for (const id of matchingIds) {\n const envelope = await adapter.get(vault, HISTORY_COLLECTION, id)\n if (!envelope) continue\n\n // Apply time filters\n if (options?.from && envelope._ts < options.from) continue\n if (options?.to && envelope._ts > options.to) continue\n\n entries.push(envelope)\n\n if (options?.limit && entries.length >= options.limit) break\n }\n\n return entries\n}\n\n/** Get a specific version's envelope from history. */\nexport async function getVersionEnvelope(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n version: number,\n): Promise<EncryptedEnvelope | null> {\n const id = historyId(collection, recordId, version)\n return adapter.get(vault, HISTORY_COLLECTION, id)\n}\n\n/** Prune history entries. Returns the number of entries deleted. */\nexport async function pruneHistory(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string | undefined,\n options: PruneOptions,\n): Promise<number> {\n const allIds = await adapter.list(vault, HISTORY_COLLECTION)\n const matchingIds = allIds\n .filter(id => recordId ? matchesPrefix(id, collection, recordId) : matchesPrefix(id, collection))\n .sort()\n\n let toDelete: string[] = []\n\n if (options.keepVersions !== undefined) {\n // Keep only the N most recent, delete the rest\n const keep = options.keepVersions\n if (matchingIds.length > keep) {\n toDelete = matchingIds.slice(0, matchingIds.length - keep)\n }\n }\n\n if (options.beforeDate) {\n // Delete entries older than the specified date\n for (const id of matchingIds) {\n if (toDelete.includes(id)) continue\n const envelope = await adapter.get(vault, HISTORY_COLLECTION, id)\n if (envelope && envelope._ts < options.beforeDate) {\n toDelete.push(id)\n }\n }\n }\n\n // Deduplicate\n const uniqueDeletes = [...new Set(toDelete)]\n\n for (const id of uniqueDeletes) {\n await adapter.delete(vault, HISTORY_COLLECTION, id)\n }\n\n return uniqueDeletes.length\n}\n\n/** Clear all history for a vault, optionally scoped to a collection or record. */\nexport async function clearHistory(\n adapter: NoydbStore,\n vault: string,\n collection?: string,\n recordId?: string,\n): Promise<number> {\n const allIds = await adapter.list(vault, HISTORY_COLLECTION)\n let toDelete: string[]\n\n if (collection && recordId) {\n toDelete = allIds.filter(id => matchesPrefix(id, collection, recordId))\n } else if (collection) {\n toDelete = allIds.filter(id => matchesPrefix(id, collection))\n } else {\n toDelete = allIds\n }\n\n for (const id of toDelete) {\n await adapter.delete(vault, HISTORY_COLLECTION, id)\n }\n\n return toDelete.length\n}\n\n/**\n * Crypto-shred every `_history` version of a record. Each non-tombstone\n * history envelope is OVERWRITTEN in place with a tombstone\n * `{ _noydb, _v, _ts: now, _by: actor, _iv: '', _data: '' }` — dropping\n * `_iv`/`_data`/`_cek`/`_det`, so the prior ciphertext (and the wrapped CEK\n * that could decrypt it) is gone everywhere this store reaches. The version\n * counter (`_v`) is preserved so the audit trail still shows \"N versions\n * existed and were erased.\"\n *\n * Overwrite — NOT delete — so the history key itself survives as proof the\n * version existed. Already-tombstoned versions (re-run / idempotent forget)\n * are left untouched and not counted.\n *\n * Returns the number of history versions newly tombstoned.\n */\nexport async function tombstoneHistory(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n actor: string,\n encrypted: boolean,\n): Promise<number> {\n const allIds = await adapter.list(vault, HISTORY_COLLECTION)\n const matchingIds = allIds.filter(id => matchesPrefix(id, collection, recordId))\n\n const now = new Date().toISOString()\n let count = 0\n for (const id of matchingIds) {\n const env = await adapter.get(vault, HISTORY_COLLECTION, id)\n if (!env) continue\n // Already a tombstone (no body and no wrapped CEK)? Skip — idempotent.\n if (isTombstone(env, encrypted)) continue\n // `by` rides on the IDENTITY — passing it in the body went through a\n // conditional spread, which TypeScript does not excess-property-check, so\n // it was silently dropped once `_by` moved to the identity (#1041).\n const tombstone: EncryptedEnvelope = buildRecordEnvelope(\n { collection: HISTORY_COLLECTION, id, ...(actor ? { by: actor } : {}), version: env._v },\n { ts: now, iv: '', data: '' },\n )\n await adapter.put(vault, HISTORY_COLLECTION, id, tombstone)\n count++\n }\n return count\n}\n\n/**\n * Re-key every `_history` snapshot of a record from `fromDek` to `toDek`.\n * Mirrors what `rewrapBodyToDek` already does for a record's LIVE body on a\n * tier move (elevate/demote/putAtTier) — each `_history` envelope also\n * carries its own `_cek`, wrapped under the collection's tier-0 DEK at write\n * time (`record-codec.ts`), so a tier move that rewraps only the live\n * envelope leaves prior versions decryptable at rest under the tier the\n * record left. This is defense-in-depth *beneath* the read-gate\n * (`history()`/`getVersion()` already return empty for an elevated record;\n * this protects the ciphertext even if that gate is bypassed).\n *\n * Rewraps content in place — unlike `tombstoneHistory`, it does NOT blank\n * `_iv`/`_data`/`_cek` — so a subsequent `demote()` restores tier-0\n * readability. Tombstone-shaped entries (a forgotten/shredded version —\n * blanked `_data`, no `_cek`) are skipped: there is no key material left to\n * rewrap.\n *\n * **Legacy fallback.** A snapshot written before this fix stays wrapped\n * under the tier-0 DEK even after its live record has since moved tiers, so\n * a rewrap attempted with a tier-N `fromDek` fails to unwrap/decrypt. When\n * the caller supplies `tier0Dek`, a failed rewrap is retried once with\n * `tier0Dek` as `fromDek` (the only other key a pre-fix snapshot can be\n * wrapped under — history is written only by tier-0 `put()`). The output is\n * always wrapped under `toDek` regardless of which `fromDek` succeeded. A\n * rewrap that fails under BOTH keys re-throws — that is real corruption, not\n * a tier mismatch, and must not be swallowed.\n *\n * **Crash-atomicity / idempotency (#712 whole-branch-fix-3).** This loop has\n * no transaction around it: a crash after some entries have been rewritten\n * under `toDek` but before the loop finishes leaves the record's history\n * split across two keys. A retry of the SAME call must not re-fail on the\n * entries that already made it — so each entry is probed with\n * `isRewrappedUnder(env, toDek)` FIRST; a match means it's already at the\n * target key and is skipped (put nothing). This makes same-target retries\n * and demote-after-crash fully self-healing. It does NOT close every crash\n * window: a crash that lands SOME entries under `toDek` while the record's\n * NEXT move target differs from this call's `toDek` (an intermediate-tier\n * crash — e.g. elevate 0→1 crashes mid-loop, then the record is moved 1→2)\n * still finds those entries unreadable under either `fromDek` or the\n * tier-0 fallback, since `toDek` is a third key the next call never probes\n * for. That residual window is an accepted, fail-closed limitation (see\n * `.changeset/history-at-rest.md` and the design doc) — availability is\n * lost, never confidentiality.\n */\nexport async function rewrapHistory(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n fromDek: EnclaveKey,\n toDek: EnclaveKey,\n tier0Dek?: EnclaveKey,\n): Promise<void> {\n const allIds = await adapter.list(vault, HISTORY_COLLECTION)\n const matchingIds = allIds.filter(id => matchesPrefix(id, collection, recordId))\n\n for (const id of matchingIds) {\n const env = await adapter.get(vault, HISTORY_COLLECTION, id)\n if (!env) continue\n // Already a tombstone (forgotten/shredded version)? Nothing to rewrap.\n if (isTombstoneShape(env)) continue\n // #712/whole-branch-fix-3: toDek-first idempotency skip — already at the\n // target key (a same-target retry, or demote-after-crash landing back on\n // a key it already reached)? Nothing to do; put nothing.\n // In-place re-key of a `_history` entry: the address does not move, so the\n // same identity opens and re-seals it (#1041). Built from the entry itself,\n // exactly as a reader would via `recordAadFor`.\n const identity = {\n collection: HISTORY_COLLECTION, id, version: env._v,\n ...(env._tier !== undefined ? { tier: env._tier } : {}),\n ...(env._by !== undefined ? { by: env._by } : {}),\n }\n if (await isRewrappedUnder(identity, env, toDek)) continue\n\n let next: EncryptedEnvelope\n try {\n next = await rewrapEnvelope(identity, env, fromDek, toDek)\n } catch (err) {\n if (!tier0Dek) throw err\n // Legacy fallback: retry once under the tier-0 DEK. A failure here is\n // real corruption, not a tier mismatch — let it propagate.\n next = await rewrapEnvelope(identity, env, tier0Dek, toDek)\n }\n\n await adapter.put(vault, HISTORY_COLLECTION, id, next)\n }\n}\n","/**\n * Strategy seam for the optional history + ledger + time-machine\n * service. Core imports `HistoryStrategy` type-only + `NO_HISTORY`\n * stub; real implementations of `saveHistory`, `LedgerStore`,\n * `VaultInstant`, `computePatch`, `diff` etc. are only reachable via\n * `withHistory()` in `./active.ts`.\n *\n * Applications that don't track per-record versioning, don't need the\n * hash-chained audit ledger, and don't restore to past instants ship\n * none of the ~1,880 LOC behind this seam.\n *\n * Strategy contract:\n *\n * - **saveHistory / pruneHistory / clearHistory** — no-ops under\n * NO_HISTORY. Writes still succeed; no snapshot is captured.\n * - **getHistoryEntries / getVersionEnvelope / diff** — throw under\n * NO_HISTORY. These are read APIs the consumer would only call\n * after explicitly asking for history; the throw guides them to\n * `@noy-db/hub/history`.\n * - **envelopePayloadHash / computePatch** — return empty / `[]`\n * under NO_HISTORY. These are only used inside the\n * `if (this.ledger)` branch, which is itself gated by\n * `buildLedger()` returning null.\n * - **buildLedger** — returns `null` under NO_HISTORY. The Vault's\n * public `vault.ledger()` accessor throws when null.\n * - **buildVaultInstant** — throws under NO_HISTORY. `vault.at()`\n * propagates the throw.\n *\n * @internal\n */\n\nimport type {\n EncryptedEnvelope,\n NoydbStore,\n HistoryOptions,\n PruneOptions,\n} from '../../kernel/types.js'\nimport type { LedgerStore } from './ledger/store.js'\nimport type { JsonPatch } from './ledger/patch.js'\nimport type { DiffEntry } from './diff.js'\nimport type { VaultInstant, VaultEngine } from './time-machine.js'\nimport type { EnclaveKey, RecordIdentity } from '../../capsule/index.js'\nimport { historyIdentity } from './history.js'\n\n/**\n * Options accepted by `HistoryStrategy.buildLedger`. Mirrors the\n * `LedgerStore` constructor verbatim — kept in this file so `core`\n * code never imports the LedgerStore module at runtime.\n *\n * @internal\n */\nexport interface BuildLedgerOptions {\n adapter: NoydbStore\n vault: string\n encrypted: boolean\n getDEK: (collectionName: string) => Promise<EnclaveKey>\n actor: string\n}\n\n/**\n * @internal\n */\nexport interface HistoryStrategy {\n /**\n * Persist a full encrypted envelope snapshot of the prior version\n * under `_history/{collection}:{id}:{paddedVersion}`. No-op under\n * `NO_HISTORY`.\n */\n saveHistory(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n envelope: EncryptedEnvelope,\n ): Promise<void>\n\n /**\n * The identity a snapshot of `collection/recordId@version` must be **sealed\n * against** — its `_history` storage location (#1041).\n *\n * On the port because the kernel writes history snapshots but must not import\n * `with-commit` to learn its layout. Exposing it here keeps the derivation in\n * the module that owns the layout, and `saveHistory` uses the same function,\n * so the sealed identity and the put location cannot drift.\n */\n historyIdentity(collection: string, recordId: string, version: number): RecordIdentity\n\n /**\n * List history envelopes for a record, newest first. Throws under\n * `NO_HISTORY` — callers reach this via `collection.history()` /\n * `collection.getVersion()` / `collection.diff()`, which only work\n * with the strategy enabled.\n */\n getHistoryEntries(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n options?: HistoryOptions,\n ): Promise<EncryptedEnvelope[]>\n\n /**\n * Fetch a specific version's envelope. Throws under `NO_HISTORY`.\n */\n getVersionEnvelope(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n version: number,\n ): Promise<EncryptedEnvelope | null>\n\n /**\n * Prune history entries by retention rule. Returns `0` under\n * `NO_HISTORY`.\n */\n pruneHistory(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string | undefined,\n options: PruneOptions,\n ): Promise<number>\n\n /**\n * Clear all history for vault/collection/record. Returns `0` under\n * `NO_HISTORY`.\n */\n clearHistory(\n adapter: NoydbStore,\n vault: string,\n collection?: string,\n recordId?: string,\n ): Promise<number>\n\n /**\n * Crypto-shred (overwrite-to-tombstone) every `_history` version of a\n * record for GDPR erasure. Returns the number of versions newly\n * tombstoned, or `0` under `NO_HISTORY` (no history = nothing to shred).\n */\n tombstoneHistory(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n actor: string,\n encrypted: boolean,\n ): Promise<number>\n\n /**\n * Re-key every `_history` snapshot of a record from `fromDek` to `toDek`\n * on a tier move (elevate/demote/putAtTier), mirroring the live-body\n * rewrap so prior versions are not left decryptable at rest under a tier\n * the record has moved away from. Optional `tier0Dek` enables the legacy\n * fallback for snapshots written before this rewrap existed (see\n * `history.ts` for the full contract). No-op under `NO_HISTORY` (no\n * history = nothing to rewrap).\n */\n rewrapHistory(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n fromDek: EnclaveKey,\n toDek: EnclaveKey,\n tier0Dek?: EnclaveKey,\n ): Promise<void>\n\n /**\n * Compute the SHA-256 hash of an envelope's encrypted payload, used\n * by `LedgerStore.append` to track tamper-evidence. Returns the\n * empty string under `NO_HISTORY` (the call site is gated by\n * `if (this.ledger)`, so the value is never observed).\n */\n envelopePayloadHash(envelope: EncryptedEnvelope | null): Promise<string>\n\n /**\n * Compute the JSON patch from `from` → `to`. Returns `[]` under\n * `NO_HISTORY`.\n */\n computePatch(from: unknown, to: unknown): JsonPatch\n\n /**\n * Compute the typed diff between two records. Throws under\n * `NO_HISTORY` — `collection.diff()` is a history-read API.\n */\n diff(recordA: unknown, recordB: unknown): DiffEntry[]\n\n /**\n * Construct (or return null) a `LedgerStore` for the vault. Returns\n * `null` under `NO_HISTORY`; the Vault treats null as \"no ledger\n * attached\" — collection write paths skip the append branch and the\n * public `vault.ledger()` accessor throws.\n */\n buildLedger(opts: BuildLedgerOptions): LedgerStore | null\n\n /**\n * Construct a `VaultInstant` for time-machine reads. Throws under\n * `NO_HISTORY`.\n */\n buildVaultInstant(engine: VaultEngine, timestamp: string): VaultInstant\n}\n\n/**\n * Error thrown when the consumer reaches a history-gated surface\n * without opting into the strategy. The message names the offending\n * operation and points to the subpath import.\n *\n * @internal\n */\nfunction notEnabled(op: string): Error {\n return new Error(\n `${op} requires the history strategy. Import ` +\n '`{ withHistory }` from \"@noy-db/hub/history\" and pass it to ' +\n '`createNoydb({ historyStrategy: withHistory() })`.',\n )\n}\n\n/**\n * No-history stub. Snapshots and prune/clear are no-ops; reads and\n * time-machine throw with an actionable message; ledger construction\n * returns null so the write-path's `if (this.ledger)` branch is dead\n * code in the bundle.\n *\n * @internal\n */\nexport const NO_HISTORY: HistoryStrategy = {\n async saveHistory() {},\n // Unreachable in practice — `saveHistory` above is a no-op, so nothing is\n // ever sealed. Returns the real layout rather than a sentinel so a future\n // caller that reads it without writing cannot be misled.\n historyIdentity: (collection, recordId, version) => historyIdentity(collection, recordId, version),\n async getHistoryEntries() { throw notEnabled('collection.history()') },\n async getVersionEnvelope() { throw notEnabled('collection.getVersion()') },\n async pruneHistory() { return 0 },\n async clearHistory() { return 0 },\n async tombstoneHistory() { return 0 },\n async rewrapHistory() {},\n async envelopePayloadHash() { return '' },\n computePatch() { return [] },\n diff() { throw notEnabled('collection.diff()') },\n buildLedger() {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