@noy-db/hub 0.2.0-pre.18 → 0.2.0-pre.19

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 (283) hide show
  1. package/dist/aggregate/index.cjs +227 -3
  2. package/dist/aggregate/index.cjs.map +1 -1
  3. package/dist/aggregate/index.d.cts +3 -3
  4. package/dist/aggregate/index.d.ts +3 -3
  5. package/dist/aggregate/index.js +5 -4
  6. package/dist/aggregate/index.js.map +1 -1
  7. package/dist/attestation/index.cjs.map +1 -1
  8. package/dist/attestation/index.d.cts +5 -5
  9. package/dist/attestation/index.d.ts +5 -5
  10. package/dist/attestation/index.js +6 -6
  11. package/dist/blobs/index.cjs +4 -10
  12. package/dist/blobs/index.cjs.map +1 -1
  13. package/dist/blobs/index.d.cts +6 -6
  14. package/dist/blobs/index.d.ts +6 -6
  15. package/dist/blobs/index.js +6 -6
  16. package/dist/bundle/index.cjs +520 -46
  17. package/dist/bundle/index.cjs.map +1 -1
  18. package/dist/bundle/index.d.cts +7 -7
  19. package/dist/bundle/index.d.ts +7 -7
  20. package/dist/bundle/index.js +10 -10
  21. package/dist/{chunk-6Q5XRLKG.js → chunk-3FSMVWBN.js} +4 -4
  22. package/dist/{chunk-647TFNYL.js → chunk-3Q2AOPLT.js} +76 -28
  23. package/dist/chunk-3Q2AOPLT.js.map +1 -0
  24. package/dist/{chunk-2U226RDC.js → chunk-4ULLGYPA.js} +3 -3
  25. package/dist/{chunk-6FHCU3QO.js → chunk-5IGWRMEC.js} +5 -5
  26. package/dist/{chunk-Y5XVB75E.js → chunk-6KESZO5D.js} +35 -7
  27. package/dist/chunk-6KESZO5D.js.map +1 -0
  28. package/dist/{chunk-KQ523X3A.js → chunk-6OSOE6BY.js} +2 -2
  29. package/dist/{chunk-HWK75CYX.js → chunk-7C6VFNIY.js} +2 -2
  30. package/dist/{chunk-33DAO2XG.js → chunk-7HD67R6U.js} +2 -2
  31. package/dist/{chunk-RQFG2YSV.js → chunk-B6E5IRPJ.js} +3 -3
  32. package/dist/{chunk-YWYW2YNO.js → chunk-CYNTFU2D.js} +2 -2
  33. package/dist/{chunk-HMFC6M2G.js → chunk-DJF3FXW5.js} +17 -1
  34. package/dist/{chunk-HMFC6M2G.js.map → chunk-DJF3FXW5.js.map} +1 -1
  35. package/dist/{chunk-KTZ2MHQK.js → chunk-DY3EOJEN.js} +2 -2
  36. package/dist/{chunk-PGVEL5IZ.js → chunk-E66DSTJP.js} +3 -3
  37. package/dist/{chunk-6YEC7LLO.js → chunk-FBLAWK6A.js} +2 -2
  38. package/dist/{chunk-LQ3GD5LL.js → chunk-FPHRTW2Z.js} +5 -5
  39. package/dist/{chunk-ZJ67TB4S.js → chunk-G4PYA575.js} +2 -2
  40. package/dist/{chunk-45643PAU.js → chunk-GKQAU52M.js} +4 -4
  41. package/dist/{chunk-5KKNBDCT.js → chunk-GYAWXHFO.js} +2 -2
  42. package/dist/{chunk-KOURQXIU.js → chunk-H42KZXNV.js} +5 -210
  43. package/dist/chunk-H42KZXNV.js.map +1 -0
  44. package/dist/{chunk-6XEGHIBA.js → chunk-IBVTH4JR.js} +4 -4
  45. package/dist/{chunk-AB7JF2KF.js → chunk-IVP5IVON.js} +2 -2
  46. package/dist/{chunk-T4T5I5L6.js → chunk-KEDJDWWQ.js} +3 -3
  47. package/dist/{chunk-C2OYWD5S.js → chunk-KNKNOJFS.js} +3 -3
  48. package/dist/chunk-KNKNOJFS.js.map +1 -0
  49. package/dist/{chunk-F2IJ2HGD.js → chunk-KYGGXXT6.js} +228 -69
  50. package/dist/chunk-KYGGXXT6.js.map +1 -0
  51. package/dist/{chunk-RZWQNMMP.js → chunk-LSIIPKYT.js} +2 -2
  52. package/dist/{chunk-FQRAYDS4.js → chunk-M3FPNTO2.js} +4 -4
  53. package/dist/{chunk-DR5I7Q6N.js → chunk-MI36HL5G.js} +4 -4
  54. package/dist/{chunk-Z3I2WNGF.js → chunk-NN6IISZO.js} +2 -2
  55. package/dist/{chunk-32XVU2LT.js → chunk-OBMYMKGO.js} +29 -6
  56. package/dist/{chunk-32XVU2LT.js.map → chunk-OBMYMKGO.js.map} +1 -1
  57. package/dist/{chunk-QJKZ5WUP.js → chunk-OKOKPYWH.js} +2 -2
  58. package/dist/{chunk-CMISAJAE.js → chunk-OY7RX2VL.js} +9 -15
  59. package/dist/chunk-OY7RX2VL.js.map +1 -0
  60. package/dist/{chunk-Z3BE5BRK.js → chunk-PTGQPWMV.js} +2 -2
  61. package/dist/{chunk-QPJ7Z4L3.js → chunk-PWFTQHYX.js} +2 -2
  62. package/dist/{chunk-K3NYRK7U.js → chunk-Q5MCHUXZ.js} +2 -2
  63. package/dist/{chunk-IQ4GMEYZ.js → chunk-S22UOMHM.js} +6 -6
  64. package/dist/{chunk-WZCG3EZ6.js → chunk-S3XA7G35.js} +2 -2
  65. package/dist/{chunk-LGPSCKWZ.js → chunk-SHIUFIPW.js} +1 -1
  66. package/dist/chunk-SHIUFIPW.js.map +1 -0
  67. package/dist/{chunk-BUBJYIZ7.js → chunk-U7JNBSS3.js} +3 -3
  68. package/dist/{chunk-TFAN3NFD.js → chunk-V3VIRTTE.js} +3 -3
  69. package/dist/{chunk-VVDSDOVV.js → chunk-V5FZWQNN.js} +4 -4
  70. package/dist/chunk-VEIVAYJ7.js +361 -0
  71. package/dist/chunk-VEIVAYJ7.js.map +1 -0
  72. package/dist/{chunk-P57D4KBG.js → chunk-VNUE6FHP.js} +3 -3
  73. package/dist/{chunk-TPOHMOGX.js → chunk-WFK2EVYU.js} +10 -2
  74. package/dist/chunk-WFK2EVYU.js.map +1 -0
  75. package/dist/{chunk-TTS3RWL5.js → chunk-X7FJMKT3.js} +2 -2
  76. package/dist/{chunk-HZOEBM67.js → chunk-XPH3FWME.js} +7 -2
  77. package/dist/{chunk-HZOEBM67.js.map → chunk-XPH3FWME.js.map} +1 -1
  78. package/dist/{chunk-DKMPR76W.js → chunk-Y5J63SMF.js} +5 -5
  79. package/dist/{chunk-HOO5I3VG.js → chunk-YLRRU72W.js} +2 -2
  80. package/dist/{chunk-MGB67HKX.js → chunk-YX333DPS.js} +4 -4
  81. package/dist/{chunk-4UI5T3K7.js → chunk-YZE6C3TQ.js} +3 -3
  82. package/dist/consent/index.cjs.map +1 -1
  83. package/dist/consent/index.d.cts +6 -6
  84. package/dist/consent/index.d.ts +6 -6
  85. package/dist/consent/index.js +3 -3
  86. package/dist/{crypto-FNK3XPCS.js → crypto-B46VNH6X.js} +3 -3
  87. package/dist/{delegation-FMXNUWE6.js → delegation-5HON72PV.js} +5 -5
  88. package/dist/derivations/index.cjs.map +1 -1
  89. package/dist/derivations/index.d.cts +7 -7
  90. package/dist/derivations/index.d.ts +7 -7
  91. package/dist/derivations/index.js +4 -4
  92. package/dist/{dev-unlock-3_2b_vo6.d.cts → dev-unlock-BR1rMOS-.d.cts} +1 -1
  93. package/dist/{dev-unlock-BMvwPr_E.d.ts → dev-unlock-whL49sxV.d.ts} +1 -1
  94. package/dist/{errors-DUTlAt3Y.d.ts → errors-DL-zTrrF.d.cts} +14 -1
  95. package/dist/{errors-DUTlAt3Y.d.cts → errors-DL-zTrrF.d.ts} +14 -1
  96. package/dist/executor-44R5CUS2.js +12 -0
  97. package/dist/executor-AOACUK7Z.js +8 -0
  98. package/dist/executor-OKFLQCDW.js +8 -0
  99. package/dist/{fanout-sidecar-JGHXAJO5.js → fanout-sidecar-DCQWJQ6S.js} +2 -2
  100. package/dist/forget/index.cjs.map +1 -1
  101. package/dist/forget/index.d.cts +1 -1
  102. package/dist/forget/index.d.ts +1 -1
  103. package/dist/forget/index.js +4 -4
  104. package/dist/guards/index.cjs.map +1 -1
  105. package/dist/guards/index.d.cts +7 -7
  106. package/dist/guards/index.d.ts +7 -7
  107. package/dist/guards/index.js +3 -3
  108. package/dist/{hash-BnWnL9bQ.d.cts → hash-BEUBmmI4.d.cts} +1 -1
  109. package/dist/{hash-BThBJFO1.d.ts → hash-Dtb7FwWd.d.ts} +1 -1
  110. package/dist/history/index.cjs.map +1 -1
  111. package/dist/history/index.d.cts +7 -7
  112. package/dist/history/index.d.ts +7 -7
  113. package/dist/history/index.js +5 -5
  114. package/dist/i18n/index.cjs +149 -132
  115. package/dist/i18n/index.cjs.map +1 -1
  116. package/dist/i18n/index.d.cts +6 -6
  117. package/dist/i18n/index.d.ts +6 -6
  118. package/dist/i18n/index.js +14 -14
  119. package/dist/{index-C6lgoUhK.d.cts → index-BM7O48Ur.d.cts} +47 -8
  120. package/dist/{index-C-SSRIxP.d.ts → index-BMmajblo.d.cts} +14 -0
  121. package/dist/{index-C-SSRIxP.d.cts → index-BMmajblo.d.ts} +14 -0
  122. package/dist/{index-DP1JTWHZ.d.ts → index-BelbyUwz.d.ts} +47 -8
  123. package/dist/index.cjs +799 -465
  124. package/dist/index.cjs.map +1 -1
  125. package/dist/index.d.cts +29 -16
  126. package/dist/index.d.ts +29 -16
  127. package/dist/index.js +56 -52
  128. package/dist/index.js.map +1 -1
  129. package/dist/indexing/index.cjs.map +1 -1
  130. package/dist/indexing/index.js +4 -4
  131. package/dist/issue-EPA2PSWP.js +12 -0
  132. package/dist/{ledger-GXC2YA3A.js → ledger-LS6GXCBP.js} +5 -5
  133. package/dist/materialized-views/index.cjs +257 -4
  134. package/dist/materialized-views/index.cjs.map +1 -1
  135. package/dist/materialized-views/index.d.cts +7 -7
  136. package/dist/materialized-views/index.d.ts +7 -7
  137. package/dist/materialized-views/index.js +8 -7
  138. package/dist/noydb-BVKFP74P.js +38 -0
  139. package/dist/overlay-views/index.cjs.map +1 -1
  140. package/dist/overlay-views/index.d.cts +7 -7
  141. package/dist/overlay-views/index.d.ts +7 -7
  142. package/dist/overlay-views/index.js +4 -4
  143. package/dist/periods/index.cjs.map +1 -1
  144. package/dist/periods/index.d.cts +6 -6
  145. package/dist/periods/index.d.ts +6 -6
  146. package/dist/periods/index.js +5 -5
  147. package/dist/{public-envelope-HXOFHY4N.js → public-envelope-AGU6SS4Z.js} +4 -4
  148. package/dist/query/index.cjs +296 -27
  149. package/dist/query/index.cjs.map +1 -1
  150. package/dist/query/index.d.cts +3 -3
  151. package/dist/query/index.d.ts +3 -3
  152. package/dist/query/index.js +7 -6
  153. package/dist/registry-ERNAMRDE.js +8 -0
  154. package/dist/registry-EXTHSXQW.js +8 -0
  155. package/dist/{registry-WVXO6NH5.js → registry-RDPTFXQ7.js} +3 -3
  156. package/dist/{revoke-7LCWE2AH.js → revoke-IFLXEZA5.js} +6 -6
  157. package/dist/sealed-record/index.cjs.map +1 -1
  158. package/dist/sealed-record/index.d.cts +1 -1
  159. package/dist/sealed-record/index.d.ts +1 -1
  160. package/dist/sealed-record/index.js +2 -2
  161. package/dist/session/index.cjs.map +1 -1
  162. package/dist/session/index.d.cts +7 -7
  163. package/dist/session/index.d.ts +7 -7
  164. package/dist/session/index.js +3 -3
  165. package/dist/shadow/index.cjs.map +1 -1
  166. package/dist/shadow/index.d.cts +6 -6
  167. package/dist/shadow/index.d.ts +6 -6
  168. package/dist/shadow/index.js +2 -2
  169. package/dist/{signer-HAVDLGOK.js → signer-UNWOUJAK.js} +5 -5
  170. package/dist/snapshots/index.cjs.map +1 -1
  171. package/dist/snapshots/index.d.cts +6 -6
  172. package/dist/snapshots/index.d.ts +6 -6
  173. package/dist/snapshots/index.js +4 -4
  174. package/dist/{stale-PGTEGJDI.js → stale-NTEV5SLX.js} +2 -2
  175. package/dist/{state-vault-QKQKN3H3.js → state-vault-TUTFRTOA.js} +4 -4
  176. package/dist/store/index.cjs +8 -0
  177. package/dist/store/index.cjs.map +1 -1
  178. package/dist/store/index.d.cts +13 -6
  179. package/dist/store/index.d.ts +13 -6
  180. package/dist/store/index.js +2 -2
  181. package/dist/{strategy-Diwh5lzS.d.ts → strategy-BDxQnnTX.d.ts} +315 -4
  182. package/dist/{strategy-nuyN8K5N.d.cts → strategy-C5ol6NdV.d.cts} +315 -4
  183. package/dist/sync/index.cjs.map +1 -1
  184. package/dist/sync/index.d.cts +5 -5
  185. package/dist/sync/index.d.ts +5 -5
  186. package/dist/sync/index.js +4 -4
  187. package/dist/team/index.cjs.map +1 -1
  188. package/dist/team/index.d.cts +6 -6
  189. package/dist/team/index.d.ts +6 -6
  190. package/dist/team/index.js +8 -8
  191. package/dist/{transition-guard--t3exQHF.d.cts → transition-guard-B1N82hMf.d.cts} +1 -1
  192. package/dist/{transition-guard-BlI9Oy5K.d.ts → transition-guard-C__YeF3_.d.ts} +1 -1
  193. package/dist/tx/index.cjs.map +1 -1
  194. package/dist/tx/index.d.cts +6 -6
  195. package/dist/tx/index.d.ts +6 -6
  196. package/dist/tx/index.js +3 -3
  197. package/dist/{types-Diqc2caK.d.ts → types-CraiZOyO.d.ts} +134 -292
  198. package/dist/{types-BpLPqyaO.d.cts → types-D-gr5t0G.d.cts} +134 -292
  199. package/dist/{ulid-DNiRB4Mx.d.cts → ulid-DQnSAP5W.d.cts} +1 -1
  200. package/dist/{ulid-B1zNV8r9.d.ts → ulid-FFRRHkVf.d.ts} +1 -1
  201. package/dist/util/index.cjs.map +1 -1
  202. package/dist/util/index.js +1 -1
  203. package/dist/{vault-group-DPZVFRI5.js → vault-group-27EV7KB4.js} +29 -8
  204. package/dist/vault-group-27EV7KB4.js.map +1 -0
  205. package/dist/{with-materialized-view-BdH_A_r6.d.cts → with-materialized-view-BboqxyV3.d.cts} +1 -1
  206. package/dist/{with-materialized-view-CzAgp_HJ.d.ts → with-materialized-view-CguCeVcT.d.ts} +1 -1
  207. package/dist/{with-overlayed-view-BJbqQnsR.d.ts → with-overlayed-view-DO08u_tx.d.ts} +1 -1
  208. package/dist/{with-overlayed-view-C40rDPlu.d.cts → with-overlayed-view-mmsg5Of3.d.cts} +1 -1
  209. package/dist/{with-rollup-DrlGkxiE.d.ts → with-rollup-_TyBzz3T.d.ts} +1 -1
  210. package/dist/{with-rollup-Bopu5UDZ.d.cts → with-rollup-aaxOZcIb.d.cts} +1 -1
  211. package/package.json +3 -3
  212. package/dist/chunk-647TFNYL.js.map +0 -1
  213. package/dist/chunk-C2OYWD5S.js.map +0 -1
  214. package/dist/chunk-CMISAJAE.js.map +0 -1
  215. package/dist/chunk-F2IJ2HGD.js.map +0 -1
  216. package/dist/chunk-KOURQXIU.js.map +0 -1
  217. package/dist/chunk-LGPSCKWZ.js.map +0 -1
  218. package/dist/chunk-M3H7VSRV.js +0 -139
  219. package/dist/chunk-M3H7VSRV.js.map +0 -1
  220. package/dist/chunk-TPOHMOGX.js.map +0 -1
  221. package/dist/chunk-Y5XVB75E.js.map +0 -1
  222. package/dist/executor-IZ2NVXCY.js +0 -11
  223. package/dist/executor-THSEYEJG.js +0 -8
  224. package/dist/executor-WLFDUTOM.js +0 -8
  225. package/dist/issue-R2MWQO6K.js +0 -12
  226. package/dist/noydb-RJL6FQ4B.js +0 -37
  227. package/dist/registry-3T2RZC5A.js +0 -8
  228. package/dist/registry-DMS7OKBM.js +0 -8
  229. package/dist/vault-group-DPZVFRI5.js.map +0 -1
  230. /package/dist/{chunk-6Q5XRLKG.js.map → chunk-3FSMVWBN.js.map} +0 -0
  231. /package/dist/{chunk-2U226RDC.js.map → chunk-4ULLGYPA.js.map} +0 -0
  232. /package/dist/{chunk-6FHCU3QO.js.map → chunk-5IGWRMEC.js.map} +0 -0
  233. /package/dist/{chunk-KQ523X3A.js.map → chunk-6OSOE6BY.js.map} +0 -0
  234. /package/dist/{chunk-HWK75CYX.js.map → chunk-7C6VFNIY.js.map} +0 -0
  235. /package/dist/{chunk-33DAO2XG.js.map → chunk-7HD67R6U.js.map} +0 -0
  236. /package/dist/{chunk-RQFG2YSV.js.map → chunk-B6E5IRPJ.js.map} +0 -0
  237. /package/dist/{chunk-YWYW2YNO.js.map → chunk-CYNTFU2D.js.map} +0 -0
  238. /package/dist/{chunk-KTZ2MHQK.js.map → chunk-DY3EOJEN.js.map} +0 -0
  239. /package/dist/{chunk-PGVEL5IZ.js.map → chunk-E66DSTJP.js.map} +0 -0
  240. /package/dist/{chunk-6YEC7LLO.js.map → chunk-FBLAWK6A.js.map} +0 -0
  241. /package/dist/{chunk-LQ3GD5LL.js.map → chunk-FPHRTW2Z.js.map} +0 -0
  242. /package/dist/{chunk-ZJ67TB4S.js.map → chunk-G4PYA575.js.map} +0 -0
  243. /package/dist/{chunk-45643PAU.js.map → chunk-GKQAU52M.js.map} +0 -0
  244. /package/dist/{chunk-5KKNBDCT.js.map → chunk-GYAWXHFO.js.map} +0 -0
  245. /package/dist/{chunk-6XEGHIBA.js.map → chunk-IBVTH4JR.js.map} +0 -0
  246. /package/dist/{chunk-AB7JF2KF.js.map → chunk-IVP5IVON.js.map} +0 -0
  247. /package/dist/{chunk-T4T5I5L6.js.map → chunk-KEDJDWWQ.js.map} +0 -0
  248. /package/dist/{chunk-RZWQNMMP.js.map → chunk-LSIIPKYT.js.map} +0 -0
  249. /package/dist/{chunk-FQRAYDS4.js.map → chunk-M3FPNTO2.js.map} +0 -0
  250. /package/dist/{chunk-DR5I7Q6N.js.map → chunk-MI36HL5G.js.map} +0 -0
  251. /package/dist/{chunk-Z3I2WNGF.js.map → chunk-NN6IISZO.js.map} +0 -0
  252. /package/dist/{chunk-QJKZ5WUP.js.map → chunk-OKOKPYWH.js.map} +0 -0
  253. /package/dist/{chunk-Z3BE5BRK.js.map → chunk-PTGQPWMV.js.map} +0 -0
  254. /package/dist/{chunk-QPJ7Z4L3.js.map → chunk-PWFTQHYX.js.map} +0 -0
  255. /package/dist/{chunk-K3NYRK7U.js.map → chunk-Q5MCHUXZ.js.map} +0 -0
  256. /package/dist/{chunk-IQ4GMEYZ.js.map → chunk-S22UOMHM.js.map} +0 -0
  257. /package/dist/{chunk-WZCG3EZ6.js.map → chunk-S3XA7G35.js.map} +0 -0
  258. /package/dist/{chunk-BUBJYIZ7.js.map → chunk-U7JNBSS3.js.map} +0 -0
  259. /package/dist/{chunk-TFAN3NFD.js.map → chunk-V3VIRTTE.js.map} +0 -0
  260. /package/dist/{chunk-VVDSDOVV.js.map → chunk-V5FZWQNN.js.map} +0 -0
  261. /package/dist/{chunk-P57D4KBG.js.map → chunk-VNUE6FHP.js.map} +0 -0
  262. /package/dist/{chunk-TTS3RWL5.js.map → chunk-X7FJMKT3.js.map} +0 -0
  263. /package/dist/{chunk-DKMPR76W.js.map → chunk-Y5J63SMF.js.map} +0 -0
  264. /package/dist/{chunk-HOO5I3VG.js.map → chunk-YLRRU72W.js.map} +0 -0
  265. /package/dist/{chunk-MGB67HKX.js.map → chunk-YX333DPS.js.map} +0 -0
  266. /package/dist/{chunk-4UI5T3K7.js.map → chunk-YZE6C3TQ.js.map} +0 -0
  267. /package/dist/{crypto-FNK3XPCS.js.map → crypto-B46VNH6X.js.map} +0 -0
  268. /package/dist/{delegation-FMXNUWE6.js.map → delegation-5HON72PV.js.map} +0 -0
  269. /package/dist/{executor-IZ2NVXCY.js.map → executor-44R5CUS2.js.map} +0 -0
  270. /package/dist/{executor-THSEYEJG.js.map → executor-AOACUK7Z.js.map} +0 -0
  271. /package/dist/{executor-WLFDUTOM.js.map → executor-OKFLQCDW.js.map} +0 -0
  272. /package/dist/{fanout-sidecar-JGHXAJO5.js.map → fanout-sidecar-DCQWJQ6S.js.map} +0 -0
  273. /package/dist/{issue-R2MWQO6K.js.map → issue-EPA2PSWP.js.map} +0 -0
  274. /package/dist/{ledger-GXC2YA3A.js.map → ledger-LS6GXCBP.js.map} +0 -0
  275. /package/dist/{noydb-RJL6FQ4B.js.map → noydb-BVKFP74P.js.map} +0 -0
  276. /package/dist/{public-envelope-HXOFHY4N.js.map → public-envelope-AGU6SS4Z.js.map} +0 -0
  277. /package/dist/{registry-3T2RZC5A.js.map → registry-ERNAMRDE.js.map} +0 -0
  278. /package/dist/{registry-DMS7OKBM.js.map → registry-EXTHSXQW.js.map} +0 -0
  279. /package/dist/{registry-WVXO6NH5.js.map → registry-RDPTFXQ7.js.map} +0 -0
  280. /package/dist/{revoke-7LCWE2AH.js.map → revoke-IFLXEZA5.js.map} +0 -0
  281. /package/dist/{signer-HAVDLGOK.js.map → signer-UNWOUJAK.js.map} +0 -0
  282. /package/dist/{stale-PGTEGJDI.js.map → stale-NTEV5SLX.js.map} +0 -0
  283. /package/dist/{state-vault-QKQKN3H3.js.map → state-vault-TUTFRTOA.js.map} +0 -0
@@ -1,13 +1,13 @@
1
- export { w as withDerivation, a as withRollup } from '../with-rollup-Bopu5UDZ.cjs';
2
- import { aK as DerivationStrategy, aL as DerivationContext } from '../types-BpLPqyaO.cjs';
3
- export { aM as ArrayOutputSpec, aN as DerivationRegistry, aO as DerivationStrategyHandle, aP as DerivedFromMeta, aQ as OutputSpec, aR as RecordOutputSpec } from '../types-BpLPqyaO.cjs';
4
- export { i as DerivationCapExceededError, j as DerivationCycleError, k as DerivationDepthError, l as DerivationOutputShapeError, m as DerivationOutputUnknownError } from '../errors-DUTlAt3Y.cjs';
1
+ export { w as withDerivation, a as withRollup } from '../with-rollup-aaxOZcIb.cjs';
2
+ import { av as DerivationStrategy, aw as DerivationContext } from '../types-D-gr5t0G.cjs';
3
+ export { ax as ArrayOutputSpec, ay as DerivationRegistry, az as DerivationStrategyHandle, aA as DerivedFromMeta, aB as OutputSpec, aC as RecordOutputSpec } from '../types-D-gr5t0G.cjs';
4
+ export { i as DerivationCapExceededError, j as DerivationCycleError, k as DerivationDepthError, l as DerivationOutputShapeError, m as DerivationOutputUnknownError } from '../errors-DL-zTrrF.cjs';
5
5
  import '../lazy-builder-eYZzLEL1.cjs';
6
6
  import '../predicate-BmhBSPCH.cjs';
7
- import '../strategy-nuyN8K5N.cjs';
7
+ import '../strategy-C5ol6NdV.cjs';
8
8
  import '../strategy-BSxFXGzb.cjs';
9
- import '../index-C-SSRIxP.cjs';
10
- import '../index-C6lgoUhK.cjs';
9
+ import '../index-BMmajblo.cjs';
10
+ import '../index-BM7O48Ur.cjs';
11
11
  import '@noy-db/attestation';
12
12
 
13
13
  interface RunResult {
@@ -1,13 +1,13 @@
1
- export { w as withDerivation, a as withRollup } from '../with-rollup-DrlGkxiE.js';
2
- import { aK as DerivationStrategy, aL as DerivationContext } from '../types-Diqc2caK.js';
3
- export { aM as ArrayOutputSpec, aN as DerivationRegistry, aO as DerivationStrategyHandle, aP as DerivedFromMeta, aQ as OutputSpec, aR as RecordOutputSpec } from '../types-Diqc2caK.js';
4
- export { i as DerivationCapExceededError, j as DerivationCycleError, k as DerivationDepthError, l as DerivationOutputShapeError, m as DerivationOutputUnknownError } from '../errors-DUTlAt3Y.js';
1
+ export { w as withDerivation, a as withRollup } from '../with-rollup-_TyBzz3T.js';
2
+ import { av as DerivationStrategy, aw as DerivationContext } from '../types-CraiZOyO.js';
3
+ export { ax as ArrayOutputSpec, ay as DerivationRegistry, az as DerivationStrategyHandle, aA as DerivedFromMeta, aB as OutputSpec, aC as RecordOutputSpec } from '../types-CraiZOyO.js';
4
+ export { i as DerivationCapExceededError, j as DerivationCycleError, k as DerivationDepthError, l as DerivationOutputShapeError, m as DerivationOutputUnknownError } from '../errors-DL-zTrrF.js';
5
5
  import '../lazy-builder-ChSqcF5t.js';
6
6
  import '../predicate-BmhBSPCH.js';
7
- import '../strategy-Diwh5lzS.js';
7
+ import '../strategy-BDxQnnTX.js';
8
8
  import '../strategy-BSxFXGzb.js';
9
- import '../index-C-SSRIxP.js';
10
- import '../index-DP1JTWHZ.js';
9
+ import '../index-BMmajblo.js';
10
+ import '../index-BelbyUwz.js';
11
11
  import '@noy-db/attestation';
12
12
 
13
13
  interface RunResult {
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  withDerivation,
3
3
  withRollup
4
- } from "../chunk-YWYW2YNO.js";
4
+ } from "../chunk-CYNTFU2D.js";
5
5
  import {
6
6
  DerivationRegistry
7
- } from "../chunk-KQ523X3A.js";
7
+ } from "../chunk-6OSOE6BY.js";
8
8
  import {
9
9
  DerivationExecutor
10
- } from "../chunk-33DAO2XG.js";
10
+ } from "../chunk-7HD67R6U.js";
11
11
  import {
12
12
  DerivationCapExceededError,
13
13
  DerivationCycleError,
14
14
  DerivationDepthError,
15
15
  DerivationOutputShapeError,
16
16
  DerivationOutputUnknownError
17
- } from "../chunk-HMFC6M2G.js";
17
+ } from "../chunk-DJF3FXW5.js";
18
18
  export {
19
19
  DerivationCapExceededError,
20
20
  DerivationCycleError,
@@ -1,4 +1,4 @@
1
- import { a$ as Role, b0 as UnlockedKeyring } from './types-BpLPqyaO.cjs';
1
+ import { aM as Role, aN as UnlockedKeyring } from './types-D-gr5t0G.cjs';
2
2
 
3
3
  /**
4
4
  * Session tokens —
@@ -1,4 +1,4 @@
1
- import { a$ as Role, b0 as UnlockedKeyring } from './types-Diqc2caK.js';
1
+ import { aM as Role, aN as UnlockedKeyring } from './types-CraiZOyO.js';
2
2
 
3
3
  /**
4
4
  * Session tokens —
@@ -1361,6 +1361,19 @@ declare class ShardProvisioningError extends NoydbError {
1361
1361
  readonly vaultId: string;
1362
1362
  constructor(vaultId: string, partitionKey: string);
1363
1363
  }
1364
+ /**
1365
+ * Thrown by `VaultGroup.createShard` when `sharding.regionOf` resolves a
1366
+ * required region that doesn't match the placement backend's
1367
+ * `capabilities.region` — the shard would land on a non-compliant backend
1368
+ * (data-residency violation, #271). Raised BEFORE provisioning, so no
1369
+ * vault is created.
1370
+ */
1371
+ declare class DataResidencyError extends NoydbError {
1372
+ readonly vaultId: string;
1373
+ readonly requiredRegion: string;
1374
+ readonly backendRegion: string | undefined;
1375
+ constructor(vaultId: string, requiredRegion: string, backendRegion: string | undefined);
1376
+ }
1364
1377
  /** Thrown when a VaultGroup references a template name that was never registered. */
1365
1378
  declare class VaultTemplateNotFoundError extends NoydbError {
1366
1379
  readonly templateName: string;
@@ -1431,4 +1444,4 @@ declare class RecordCekNotFoundError extends NoydbError {
1431
1444
  constructor(collection: string, id: string);
1432
1445
  }
1433
1446
 
1434
- export { FilenameSanitizationError as $, AmendmentForbiddenError as A, BackupCorruptedError as B, MaterializedViewCycleError as C, DictKeyInUseError as D, MaterializedViewSourceUnknownError as E, FieldFrozenError as F, MaterializedViewTooLargeError as G, AlreadyElevatedError as H, IllegalTransitionError as I, ConflictError as J, CrossJoinSourceUnknownError as K, LocaleNotSpecifiedError as L, MissingTranslationError as M, NoydbError as N, OverlayBaseIsVirtualError as O, PartitionExtractionError as P, CrossJoinTooLargeError as Q, ReservedCollectionNameError as R, ScriptViolationError as S, TranslatorNotConfiguredError as T, UnknownDictCodeError as U, DanglingReferenceError as V, DecryptionError as W, DelegationTargetMissingError as X, DirectoryDisabledError as Y, ElevationExpiredError as Z, ExportCapabilityError as _, DictKeyMissingError as a, ForgetStrategyNotConfiguredError as a0, GroupCardinalityError as a1, ImportCapabilityError as a2, IndexRequiredError as a3, IndexWriteFailureError as a4, InvalidKeyError as a5, JoinTooLargeError as a6, KeyringCorruptError as a7, KeyringExpiredError as a8, LedgerContentionError as a9, TierNotGrantedError as aA, UniqueConstraintError as aB, UnknownShardError as aC, UnsupportedIndexOptionError as aD, ValidationError as aE, VaultTemplateNotFoundError as aF, MigrationRequiredError as aa, NetworkError as ab, NoAccessError as ac, NonAdditiveSchemaChangeError as ad, NotFoundError as ae, NumberingUncertaintyError as af, PathEscapeError as ag, PeriodClosedError as ah, PermissionDeniedError as ai, PrivilegeEscalationError as aj, QuiesceTimeoutError as ak, ReadOnlyAtInstantError as al, ReadOnlyError as am, ReadOnlyFrameError as an, RecordCekNotFoundError as ao, ReservedVaultNameError as ap, SchemaFenceError as aq, SchemaLockedError as ar, SchemaUpdateError as as, SchemaValidationError as at, SequenceContentionError as au, SequenceOfflineError as av, ShardProvisioningError as aw, StoreCapabilityError as ax, TamperedError as ay, TierDemoteDeniedError as az, StaticDictReadonlyError as b, SessionExpiredError as c, SessionNotFoundError as d, SessionPolicyError as e, InvariantError as f, RecordLockedError as g, SnapshotNotFoundError as h, DerivationCapExceededError as i, DerivationCycleError as j, DerivationDepthError as k, DerivationOutputShapeError as l, DerivationOutputUnknownError as m, OverlayCollectionUnavailableError as n, OverlayIdMismatchError as o, OverlayNameCollisionError as p, SealedRecordExpiredError as q, SealedRecordMismatchError as r, AttestationError as s, AdoptionStateError as t, BackupLedgerError as u, BundleIntegrityError as v, BundleSealMismatchError as w, BundleVersionConflictError as x, TransferSealError as y, MaterializedViewConfigError as z };
1447
+ export { ExportCapabilityError as $, AmendmentForbiddenError as A, BackupCorruptedError as B, MaterializedViewCycleError as C, DictKeyInUseError as D, MaterializedViewSourceUnknownError as E, FieldFrozenError as F, MaterializedViewTooLargeError as G, AlreadyElevatedError as H, IllegalTransitionError as I, ConflictError as J, CrossJoinSourceUnknownError as K, LocaleNotSpecifiedError as L, MissingTranslationError as M, NoydbError as N, OverlayBaseIsVirtualError as O, PartitionExtractionError as P, CrossJoinTooLargeError as Q, ReservedCollectionNameError as R, ScriptViolationError as S, TranslatorNotConfiguredError as T, UnknownDictCodeError as U, DanglingReferenceError as V, DataResidencyError as W, DecryptionError as X, DelegationTargetMissingError as Y, DirectoryDisabledError as Z, ElevationExpiredError as _, DictKeyMissingError as a, FilenameSanitizationError as a0, ForgetStrategyNotConfiguredError as a1, GroupCardinalityError as a2, ImportCapabilityError as a3, IndexRequiredError as a4, IndexWriteFailureError as a5, InvalidKeyError as a6, JoinTooLargeError as a7, KeyringCorruptError as a8, KeyringExpiredError as a9, TierDemoteDeniedError as aA, TierNotGrantedError as aB, UniqueConstraintError as aC, UnknownShardError as aD, UnsupportedIndexOptionError as aE, ValidationError as aF, VaultTemplateNotFoundError as aG, LedgerContentionError as aa, MigrationRequiredError as ab, NetworkError as ac, NoAccessError as ad, NonAdditiveSchemaChangeError as ae, NotFoundError as af, NumberingUncertaintyError as ag, PathEscapeError as ah, PeriodClosedError as ai, PermissionDeniedError as aj, PrivilegeEscalationError as ak, QuiesceTimeoutError as al, ReadOnlyAtInstantError as am, ReadOnlyError as an, ReadOnlyFrameError as ao, RecordCekNotFoundError as ap, ReservedVaultNameError as aq, SchemaFenceError as ar, SchemaLockedError as as, SchemaUpdateError as at, SchemaValidationError as au, SequenceContentionError as av, SequenceOfflineError as aw, ShardProvisioningError as ax, StoreCapabilityError as ay, TamperedError as az, StaticDictReadonlyError as b, SessionExpiredError as c, SessionNotFoundError as d, SessionPolicyError as e, InvariantError as f, RecordLockedError as g, SnapshotNotFoundError as h, DerivationCapExceededError as i, DerivationCycleError as j, DerivationDepthError as k, DerivationOutputShapeError as l, DerivationOutputUnknownError as m, OverlayCollectionUnavailableError as n, OverlayIdMismatchError as o, OverlayNameCollisionError as p, SealedRecordExpiredError as q, SealedRecordMismatchError as r, AttestationError as s, AdoptionStateError as t, BackupLedgerError as u, BundleIntegrityError as v, BundleSealMismatchError as w, BundleVersionConflictError as x, TransferSealError as y, MaterializedViewConfigError as z };
@@ -1361,6 +1361,19 @@ declare class ShardProvisioningError extends NoydbError {
1361
1361
  readonly vaultId: string;
1362
1362
  constructor(vaultId: string, partitionKey: string);
1363
1363
  }
1364
+ /**
1365
+ * Thrown by `VaultGroup.createShard` when `sharding.regionOf` resolves a
1366
+ * required region that doesn't match the placement backend's
1367
+ * `capabilities.region` — the shard would land on a non-compliant backend
1368
+ * (data-residency violation, #271). Raised BEFORE provisioning, so no
1369
+ * vault is created.
1370
+ */
1371
+ declare class DataResidencyError extends NoydbError {
1372
+ readonly vaultId: string;
1373
+ readonly requiredRegion: string;
1374
+ readonly backendRegion: string | undefined;
1375
+ constructor(vaultId: string, requiredRegion: string, backendRegion: string | undefined);
1376
+ }
1364
1377
  /** Thrown when a VaultGroup references a template name that was never registered. */
1365
1378
  declare class VaultTemplateNotFoundError extends NoydbError {
1366
1379
  readonly templateName: string;
@@ -1431,4 +1444,4 @@ declare class RecordCekNotFoundError extends NoydbError {
1431
1444
  constructor(collection: string, id: string);
1432
1445
  }
1433
1446
 
1434
- export { FilenameSanitizationError as $, AmendmentForbiddenError as A, BackupCorruptedError as B, MaterializedViewCycleError as C, DictKeyInUseError as D, MaterializedViewSourceUnknownError as E, FieldFrozenError as F, MaterializedViewTooLargeError as G, AlreadyElevatedError as H, IllegalTransitionError as I, ConflictError as J, CrossJoinSourceUnknownError as K, LocaleNotSpecifiedError as L, MissingTranslationError as M, NoydbError as N, OverlayBaseIsVirtualError as O, PartitionExtractionError as P, CrossJoinTooLargeError as Q, ReservedCollectionNameError as R, ScriptViolationError as S, TranslatorNotConfiguredError as T, UnknownDictCodeError as U, DanglingReferenceError as V, DecryptionError as W, DelegationTargetMissingError as X, DirectoryDisabledError as Y, ElevationExpiredError as Z, ExportCapabilityError as _, DictKeyMissingError as a, ForgetStrategyNotConfiguredError as a0, GroupCardinalityError as a1, ImportCapabilityError as a2, IndexRequiredError as a3, IndexWriteFailureError as a4, InvalidKeyError as a5, JoinTooLargeError as a6, KeyringCorruptError as a7, KeyringExpiredError as a8, LedgerContentionError as a9, TierNotGrantedError as aA, UniqueConstraintError as aB, UnknownShardError as aC, UnsupportedIndexOptionError as aD, ValidationError as aE, VaultTemplateNotFoundError as aF, MigrationRequiredError as aa, NetworkError as ab, NoAccessError as ac, NonAdditiveSchemaChangeError as ad, NotFoundError as ae, NumberingUncertaintyError as af, PathEscapeError as ag, PeriodClosedError as ah, PermissionDeniedError as ai, PrivilegeEscalationError as aj, QuiesceTimeoutError as ak, ReadOnlyAtInstantError as al, ReadOnlyError as am, ReadOnlyFrameError as an, RecordCekNotFoundError as ao, ReservedVaultNameError as ap, SchemaFenceError as aq, SchemaLockedError as ar, SchemaUpdateError as as, SchemaValidationError as at, SequenceContentionError as au, SequenceOfflineError as av, ShardProvisioningError as aw, StoreCapabilityError as ax, TamperedError as ay, TierDemoteDeniedError as az, StaticDictReadonlyError as b, SessionExpiredError as c, SessionNotFoundError as d, SessionPolicyError as e, InvariantError as f, RecordLockedError as g, SnapshotNotFoundError as h, DerivationCapExceededError as i, DerivationCycleError as j, DerivationDepthError as k, DerivationOutputShapeError as l, DerivationOutputUnknownError as m, OverlayCollectionUnavailableError as n, OverlayIdMismatchError as o, OverlayNameCollisionError as p, SealedRecordExpiredError as q, SealedRecordMismatchError as r, AttestationError as s, AdoptionStateError as t, BackupLedgerError as u, BundleIntegrityError as v, BundleSealMismatchError as w, BundleVersionConflictError as x, TransferSealError as y, MaterializedViewConfigError as z };
1447
+ export { ExportCapabilityError as $, AmendmentForbiddenError as A, BackupCorruptedError as B, MaterializedViewCycleError as C, DictKeyInUseError as D, MaterializedViewSourceUnknownError as E, FieldFrozenError as F, MaterializedViewTooLargeError as G, AlreadyElevatedError as H, IllegalTransitionError as I, ConflictError as J, CrossJoinSourceUnknownError as K, LocaleNotSpecifiedError as L, MissingTranslationError as M, NoydbError as N, OverlayBaseIsVirtualError as O, PartitionExtractionError as P, CrossJoinTooLargeError as Q, ReservedCollectionNameError as R, ScriptViolationError as S, TranslatorNotConfiguredError as T, UnknownDictCodeError as U, DanglingReferenceError as V, DataResidencyError as W, DecryptionError as X, DelegationTargetMissingError as Y, DirectoryDisabledError as Z, ElevationExpiredError as _, DictKeyMissingError as a, FilenameSanitizationError as a0, ForgetStrategyNotConfiguredError as a1, GroupCardinalityError as a2, ImportCapabilityError as a3, IndexRequiredError as a4, IndexWriteFailureError as a5, InvalidKeyError as a6, JoinTooLargeError as a7, KeyringCorruptError as a8, KeyringExpiredError as a9, TierDemoteDeniedError as aA, TierNotGrantedError as aB, UniqueConstraintError as aC, UnknownShardError as aD, UnsupportedIndexOptionError as aE, ValidationError as aF, VaultTemplateNotFoundError as aG, LedgerContentionError as aa, MigrationRequiredError as ab, NetworkError as ac, NoAccessError as ad, NonAdditiveSchemaChangeError as ae, NotFoundError as af, NumberingUncertaintyError as ag, PathEscapeError as ah, PeriodClosedError as ai, PermissionDeniedError as aj, PrivilegeEscalationError as ak, QuiesceTimeoutError as al, ReadOnlyAtInstantError as am, ReadOnlyError as an, ReadOnlyFrameError as ao, RecordCekNotFoundError as ap, ReservedVaultNameError as aq, SchemaFenceError as ar, SchemaLockedError as as, SchemaUpdateError as at, SchemaValidationError as au, SequenceContentionError as av, SequenceOfflineError as aw, ShardProvisioningError as ax, StoreCapabilityError as ay, TamperedError as az, StaticDictReadonlyError as b, SessionExpiredError as c, SessionNotFoundError as d, SessionPolicyError as e, InvariantError as f, RecordLockedError as g, SnapshotNotFoundError as h, DerivationCapExceededError as i, DerivationCycleError as j, DerivationDepthError as k, DerivationOutputShapeError as l, DerivationOutputUnknownError as m, OverlayCollectionUnavailableError as n, OverlayIdMismatchError as o, OverlayNameCollisionError as p, SealedRecordExpiredError as q, SealedRecordMismatchError as r, AttestationError as s, AdoptionStateError as t, BackupLedgerError as u, BundleIntegrityError as v, BundleSealMismatchError as w, BundleVersionConflictError as x, TransferSealError as y, MaterializedViewConfigError as z };
@@ -0,0 +1,12 @@
1
+ import {
2
+ MaterializedViewExecutor
3
+ } from "./chunk-6KESZO5D.js";
4
+ import "./chunk-GYAWXHFO.js";
5
+ import "./chunk-OBMYMKGO.js";
6
+ import "./chunk-LSIIPKYT.js";
7
+ import "./chunk-VEIVAYJ7.js";
8
+ import "./chunk-DJF3FXW5.js";
9
+ export {
10
+ MaterializedViewExecutor
11
+ };
12
+ //# sourceMappingURL=executor-44R5CUS2.js.map
@@ -0,0 +1,8 @@
1
+ import {
2
+ GuardExecutor
3
+ } from "./chunk-IVP5IVON.js";
4
+ import "./chunk-DJF3FXW5.js";
5
+ export {
6
+ GuardExecutor
7
+ };
8
+ //# sourceMappingURL=executor-AOACUK7Z.js.map
@@ -0,0 +1,8 @@
1
+ import {
2
+ DerivationExecutor
3
+ } from "./chunk-7HD67R6U.js";
4
+ import "./chunk-DJF3FXW5.js";
5
+ export {
6
+ DerivationExecutor
7
+ };
8
+ //# sourceMappingURL=executor-OKFLQCDW.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  NOYDB_FORMAT_VERSION
3
- } from "./chunk-LGPSCKWZ.js";
3
+ } from "./chunk-SHIUFIPW.js";
4
4
 
5
5
  // src/derivations/fanout-sidecar.ts
6
6
  function recordId(source, sourceId, outputKey) {
@@ -48,4 +48,4 @@ export {
48
48
  loadFanoutSidecar,
49
49
  saveFanoutSidecar
50
50
  };
51
- //# sourceMappingURL=fanout-sidecar-JGHXAJO5.js.map
51
+ //# sourceMappingURL=fanout-sidecar-DCQWJQ6S.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/forget/index.ts","../../src/forget/strategy.ts","../../src/forget/subject-index.ts"],"sourcesContent":["/**\n * `@noy-db/hub/forget` — GDPR right-to-erasure via per-record CEK crypto-shred\n * (#304). Import `withForgetCascade` and pass it to `createNoydb`:\n *\n * ```ts\n * import { createNoydb } from '@noy-db/hub'\n * import { withForgetCascade } from '@noy-db/hub/forget'\n *\n * const db = createNoydb({\n * secret, user,\n * historyStrategy: withHistory(), // ledger for the erasure proof\n * forgetStrategy: withForgetCascade({ subjects: { invoices: 'buyerId' } }),\n * })\n * const result = await db.vault('main').forget('buyer-123')\n * ```\n *\n * The erasure flow (`vault.forget`), the subject-index maintenance hooks, and\n * the tombstone rewrite live in core (`vault.ts` / `collection.ts`) because\n * they touch the write path directly; this subpath only exposes the\n * declaration factory + result types.\n *\n * @module\n */\nexport {\n withForgetCascade,\n NO_FORGET,\n} from './strategy.js'\nexport type {\n SubjectDeclaration,\n ForgetStrategy,\n ForgetResult,\n} from './strategy.js'\nexport type { SubjectRef } from './subject-index.js'\nexport { SUBJECT_INDEX_COLLECTION } from './subject-index.js'\n","/**\n * `withForgetCascade` — declaration surface for GDPR right-to-erasure via\n * per-record CEK crypto-shred (#304, step 2 of the CEK security epic).\n *\n * This file holds only the *declaration* shape and the disabled sentinel.\n * The actual erasure machinery lives in:\n * - `subject-index.ts` — the encrypted `_subject_index` reserved collection\n * - `vault.ts` `forget()` — the per-record tombstone + ledger flow\n * - `collection.ts` `_writeTombstone` — the envelope rewrite\n *\n * A `ForgetStrategy` declares which collections carry erasable subject data\n * and the (dotted-path) field on each record that names the data subject.\n * Declaring a collection here ALSO forces `perRecordKeys: true` for it (a\n * shred can only erase a record whose body is keyed off a per-record CEK),\n * so adopters opt into the CEK foundation transitively.\n *\n * @module\n */\nimport type { LedgerEntry } from '../history/ledger/entry.js'\n\n/**\n * User-supplied declaration passed to {@link withForgetCascade}. Maps a\n * collection name to the record field (dotted path supported, e.g.\n * `'billing.buyerId'`) that identifies the data subject for erasure.\n *\n * ```ts\n * withForgetCascade({ subjects: { invoices: 'buyerId', contacts: 'id' } })\n * ```\n */\nexport interface SubjectDeclaration {\n readonly subjects: Record<string, string>\n}\n\n/**\n * Resolved forget strategy threaded through Noydb → every Vault. Carries\n * the same `subjects` map the user declared. `NO_FORGET` (empty map) is the\n * off-by-default sentinel; `vault.forget()` throws\n * `ForgetStrategyNotConfiguredError` when the map is empty.\n */\nexport interface ForgetStrategy {\n /** Collection → subject-field (dotted path). Empty under `NO_FORGET`. */\n readonly subjects: Readonly<Record<string, string>>\n}\n\n/**\n * Disabled sentinel — no collections declare a subject field. `vault.forget()`\n * refuses with `ForgetStrategyNotConfiguredError`; no write hooks register; no\n * collection is forced into `perRecordKeys`. Non-adopters pay nothing.\n */\nexport const NO_FORGET: ForgetStrategy = { subjects: {} }\n\n/**\n * Declare GDPR crypto-shred for one or more collections.\n *\n * Each declared collection is forced to `perRecordKeys: true` (a shred can\n * only guarantee erasure of a record whose body is keyed off a per-record\n * CEK). On write, Noydb extracts `record[subjectField]` and maintains an\n * encrypted `_subject_index` mapping `subject → [{collection, id}]`, so\n * `vault.forget(subjectId)` can find every record for a subject and rewrite\n * each to a tombstone (body + history permanently undecryptable) while the\n * collection DEK and every other record stay intact.\n *\n * @example\n * ```ts\n * createNoydb({\n * secret, user,\n * forgetStrategy: withForgetCascade({ subjects: { invoices: 'buyerId' } }),\n * })\n * const result = await vault.forget('buyer-123')\n * // → { subject, recordsShredded, historyVersionsShredded, collections, … }\n * ```\n */\nexport function withForgetCascade(opts: SubjectDeclaration): ForgetStrategy {\n return { subjects: { ...opts.subjects } }\n}\n\n/**\n * The outcome of a `vault.forget(subjectId)` call.\n *\n * `unmigratedRecords` lists `collection:id` pairs that were tombstoned but\n * whose body had NOT been migrated to a per-record CEK at shred time (legacy\n * body still under the shared collection DEK). Those records are tombstoned\n * (live envelope + history stripped) but their pre-shred ciphertext, if it\n * leaked into a backup before migration, remains decryptable under the\n * collection DEK — so erasure-completeness is NOT guaranteed for them. Run\n * the per-record-CEK migration pass, then re-forget, to close the gap.\n *\n * Blob attachments (#365): a shredded record's **erasable** blobs (on a\n * `perRecordKeys` collection) are crypto-shredded inline — `blobsShredded`\n * counts those taken to refCount 0 (BlobObject deleted → chunks permanently\n * undecryptable), `blobsRetainedShared` counts those still referenced by\n * another record (shared content legitimately persists for its other owner).\n * `blobResidueCollections` now lists only collections with blobs that could\n * NOT be crypto-shredded: **legacy** blobs (no per-blob `_cek`, chunks under\n * the shared `_blob` DEK — migrate them), or a session without the blob\n * subsystem loaded. An all-erasable subject yields an empty residue list.\n */\nexport interface ForgetResult {\n /** The subject id passed to `forget()`. Echoed for caller convenience. */\n readonly subject: string\n /** Count of live records rewritten to a tombstone. */\n readonly recordsShredded: number\n /** Count of `_history` envelopes tombstoned across all shredded records. */\n readonly historyVersionsShredded: number\n /** Distinct collections that had at least one record shredded. */\n readonly collections: readonly string[]\n /** `collection:id` pairs shredded while still un-migrated (see type docs). */\n readonly unmigratedRecords: readonly string[]\n /** Count of erasable blobs crypto-shredded (refCount → 0, BlobObject deleted). */\n readonly blobsShredded: number\n /** Count of erasable blobs retained because still referenced elsewhere (shared). */\n readonly blobsRetainedShared: number\n /** Collections with blobs that could NOT be crypto-shredded — legacy (no `_cek`) or blobs disabled (see type docs). */\n readonly blobResidueCollections: readonly string[]\n /** The single `op:'forget'` ledger entry appended for this erasure. */\n readonly ledgerEntry: LedgerEntry\n}\n","/**\n * The encrypted subject index (#304).\n *\n * GDPR crypto-shred needs to answer \"which records belong to data subject\n * X?\" portably (the index must travel with the vault/bundle) WITHOUT leaking\n * subject-equivalence to the store. The rejected alternative — an unencrypted\n * subject tag in envelope metadata — would let anyone with store access see\n * which records share a subject. Instead we keep a reserved `_subject_index`\n * collection, encrypted under its OWN DEK (`getDEK('_subject_index')`):\n *\n * - record id = `sha256Hex(subjectId)` — the raw subject id never appears\n * as a key, so the store can't correlate index entries to a known subject.\n * - record body = AES-GCM(JSON `[{ collection, id }]`) under the index DEK.\n *\n * ## Concurrency (RISK #3 — known v1 limitation)\n *\n * `addSubjectRef` / `removeSubjectRef` are read-modify-write with no CAS. The\n * design assumes a SINGLE WRITER (the noy-db single-process write model). Two\n * concurrent writers racing on the SAME subject can lose an entry (last-write\n * wins on the ref list). This is documented, not fixed in v1:\n * `rebuildSubjectIndex` performs a full scan to recover a correct index from\n * the canonical records, so a lost ref is recoverable. A CAS-backed index is\n * deferred to a later slice.\n *\n * @module\n */\nimport { encrypt, decrypt } from '../crypto.js'\nimport type { NoydbStore, EncryptedEnvelope } from '../types.js'\nimport { NOYDB_FORMAT_VERSION } from '../types.js'\n\n/** Reserved collection holding the encrypted subject → records index. */\nexport const SUBJECT_INDEX_COLLECTION = '_subject_index'\n\n/** A single record reference held in a subject's index entry. */\nexport interface SubjectRef {\n readonly collection: string\n readonly id: string\n}\n\ntype GetDEK = (collectionName: string) => Promise<CryptoKey>\n\n/** SHA-256 hex of a UTF-8 string. The subject-index record key derivation. */\nasync function sha256HexString(input: string): Promise<string> {\n const bytes = new TextEncoder().encode(input)\n const digest = await globalThis.crypto.subtle.digest('SHA-256', bytes)\n return Array.from(new Uint8Array(digest))\n .map((b) => b.toString(16).padStart(2, '0'))\n .join('')\n}\n\n/** Stable subject-index record id for a subject id. */\nexport async function subjectKey(subjectId: string): Promise<string> {\n return sha256HexString(subjectId)\n}\n\n/** Read + decrypt the ref list for a subject. Returns `[]` when absent. */\nasync function readRefs(\n adapter: NoydbStore,\n vault: string,\n getDEK: GetDEK,\n encrypted: boolean,\n key: string,\n): Promise<SubjectRef[]> {\n const env = await adapter.get(vault, SUBJECT_INDEX_COLLECTION, key)\n if (!env || !env._data) return []\n if (!encrypted) return JSON.parse(env._data) as SubjectRef[]\n const dek = await getDEK(SUBJECT_INDEX_COLLECTION)\n const json = await decrypt(env._iv, env._data, dek)\n return JSON.parse(json) as SubjectRef[]\n}\n\n/** Encrypt + write a ref list for a subject under its derived key. */\nasync function writeRefs(\n adapter: NoydbStore,\n vault: string,\n getDEK: GetDEK,\n encrypted: boolean,\n key: string,\n refs: SubjectRef[],\n): Promise<void> {\n const json = JSON.stringify(refs)\n let env: EncryptedEnvelope\n if (!encrypted) {\n env = { _noydb: NOYDB_FORMAT_VERSION, _v: 1, _ts: new Date().toISOString(), _iv: '', _data: json }\n } else {\n const dek = await getDEK(SUBJECT_INDEX_COLLECTION)\n const { iv, data } = await encrypt(json, dek)\n env = { _noydb: NOYDB_FORMAT_VERSION, _v: 1, _ts: new Date().toISOString(), _iv: iv, _data: data }\n }\n await adapter.put(vault, SUBJECT_INDEX_COLLECTION, key, env)\n}\n\n/**\n * Add a `{ collection, id }` ref to a subject's index entry (idempotent —\n * a duplicate ref is not appended). Read-modify-write; see the concurrency\n * note in the module docstring.\n */\nexport async function addSubjectRef(\n adapter: NoydbStore,\n vault: string,\n getDEK: GetDEK,\n encrypted: boolean,\n subjectId: string,\n ref: SubjectRef,\n): Promise<void> {\n const key = await subjectKey(subjectId)\n const refs = await readRefs(adapter, vault, getDEK, encrypted, key)\n if (refs.some((r) => r.collection === ref.collection && r.id === ref.id)) return\n refs.push(ref)\n await writeRefs(adapter, vault, getDEK, encrypted, key, refs)\n}\n\n/**\n * Remove a `{ collection, id }` ref from a subject's index entry. When the\n * last ref is removed the (now empty) entry is deleted so the store holds no\n * residual key for an erased subject.\n */\nexport async function removeSubjectRef(\n adapter: NoydbStore,\n vault: string,\n getDEK: GetDEK,\n encrypted: boolean,\n subjectId: string,\n ref: SubjectRef,\n): Promise<void> {\n const key = await subjectKey(subjectId)\n const refs = await readRefs(adapter, vault, getDEK, encrypted, key)\n const next = refs.filter((r) => !(r.collection === ref.collection && r.id === ref.id))\n if (next.length === refs.length) return\n if (next.length === 0) {\n await adapter.delete(vault, SUBJECT_INDEX_COLLECTION, key)\n return\n }\n await writeRefs(adapter, vault, getDEK, encrypted, key, next)\n}\n\n/** Look up every record ref for a subject. Returns `[]` when none exist. */\nexport async function lookupSubject(\n adapter: NoydbStore,\n vault: string,\n getDEK: GetDEK,\n encrypted: boolean,\n subjectId: string,\n): Promise<SubjectRef[]> {\n const key = await subjectKey(subjectId)\n return readRefs(adapter, vault, getDEK, encrypted, key)\n}\n\n/**\n * Rebuild the entire subject index from the canonical records (the recovery\n * path for the documented read-modify-write race). Scans each declared\n * collection, reads `record[subjectField]` (dotted path), and rewrites the\n * index from scratch. Tombstoned (already-shredded) records contribute no\n * ref — their body is gone, so they cannot be re-indexed.\n *\n * `decodeRecord` decrypts an envelope to a plain object (or returns null for\n * a tombstone / unreadable record); supplied by the caller so this module\n * stays free of Collection internals.\n */\nexport async function rebuildSubjectIndex(\n adapter: NoydbStore,\n vault: string,\n getDEK: GetDEK,\n encrypted: boolean,\n subjects: Readonly<Record<string, string>>,\n decodeRecord: (collection: string, id: string, env: EncryptedEnvelope) => Promise<Record<string, unknown> | null>,\n): Promise<number> {\n // Drop every existing index entry first so removed refs don't linger.\n const existing = await adapter.list(vault, SUBJECT_INDEX_COLLECTION)\n for (const k of existing) {\n await adapter.delete(vault, SUBJECT_INDEX_COLLECTION, k)\n }\n\n // subjectId → refs, accumulated across all declared collections.\n const bySubject = new Map<string, SubjectRef[]>()\n for (const [collection, field] of Object.entries(subjects)) {\n const ids = await adapter.list(vault, collection)\n for (const id of ids) {\n if (id.startsWith('_')) continue\n const env = await adapter.get(vault, collection, id)\n if (!env || !env._data) continue // missing or tombstone\n const record = await decodeRecord(collection, id, env)\n if (record === null) continue\n const subjectValue = readDottedPath(record, field)\n if (subjectValue === undefined || subjectValue === null) continue\n const subjectId = coerceSubjectId(subjectValue)\n const list = bySubject.get(subjectId) ?? []\n list.push({ collection, id })\n bySubject.set(subjectId, list)\n }\n }\n\n let entries = 0\n for (const [subjectId, refs] of bySubject) {\n const key = await subjectKey(subjectId)\n await writeRefs(adapter, vault, getDEK, encrypted, key, refs)\n entries++\n }\n return entries\n}\n\n/**\n * Coerce a read subject-field value to a stable string id. Primitives use\n * their natural string form; objects/arrays are JSON-stringified so structural\n * subjects still get a deterministic key (avoids the `[object Object]` trap).\n */\nexport function coerceSubjectId(value: unknown): string {\n if (typeof value === 'string') return value\n if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint') {\n return String(value)\n }\n return JSON.stringify(value)\n}\n\n/** Read a (possibly dotted) field path from a plain record. */\nexport function readDottedPath(record: Record<string, unknown>, field: string): unknown {\n if (!field.includes('.')) return record[field]\n let cursor: unknown = record\n for (const segment of field.split('.')) {\n if (cursor === null || cursor === undefined) return undefined\n cursor = (cursor as Record<string, unknown>)[segment]\n }\n return cursor\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiDO,IAAM,YAA4B,EAAE,UAAU,CAAC,EAAE;AAuBjD,SAAS,kBAAkB,MAA0C;AAC1E,SAAO,EAAE,UAAU,EAAE,GAAG,KAAK,SAAS,EAAE;AAC1C;;;AC3CO,IAAM,2BAA2B;","names":[]}
1
+ {"version":3,"sources":["../../src/forget/index.ts","../../src/forget/strategy.ts","../../src/forget/subject-index.ts"],"sourcesContent":["/**\n * `@noy-db/hub/forget` — GDPR right-to-erasure via per-record CEK crypto-shred\n * (#304). Import `withForgetCascade` and pass it to `createNoydb`:\n *\n * ```ts\n * import { createNoydb } from '@noy-db/hub'\n * import { withForgetCascade } from '@noy-db/hub/forget'\n *\n * const db = createNoydb({\n * secret, user,\n * historyStrategy: withHistory(), // ledger for the erasure proof\n * forgetStrategy: withForgetCascade({ subjects: { invoices: 'buyerId' } }),\n * })\n * const result = await db.vault('main').forget('buyer-123')\n * ```\n *\n * The erasure flow (`vault.forget`), the subject-index maintenance hooks, and\n * the tombstone rewrite live in core (`vault.ts` / `collection.ts`) because\n * they touch the write path directly; this subpath only exposes the\n * declaration factory + result types.\n *\n * @module\n */\nexport {\n withForgetCascade,\n NO_FORGET,\n} from './strategy.js'\nexport type {\n SubjectDeclaration,\n ForgetStrategy,\n ForgetResult,\n} from './strategy.js'\nexport type { SubjectRef } from './subject-index.js'\nexport { SUBJECT_INDEX_COLLECTION } from './subject-index.js'\n","/**\n * `withForgetCascade` — declaration surface for GDPR right-to-erasure via\n * per-record CEK crypto-shred (#304, step 2 of the CEK security epic).\n *\n * This file holds only the *declaration* shape and the disabled sentinel.\n * The actual erasure machinery lives in:\n * - `subject-index.ts` — the encrypted `_subject_index` reserved collection\n * - `vault.ts` `forget()` — the per-record tombstone + ledger flow\n * - `collection.ts` `_writeTombstone` — the envelope rewrite\n *\n * A `ForgetStrategy` declares which collections carry erasable subject data\n * and the (dotted-path) field on each record that names the data subject.\n * Declaring a collection here ALSO forces `perRecordKeys: true` for it (a\n * shred can only erase a record whose body is keyed off a per-record CEK),\n * so adopters opt into the CEK foundation transitively.\n *\n * @module\n */\nimport type { LedgerEntry } from '../history/ledger/entry.js'\n\n/**\n * User-supplied declaration passed to {@link withForgetCascade}. Maps a\n * collection name to the record field (dotted path supported, e.g.\n * `'billing.buyerId'`) that identifies the data subject for erasure.\n *\n * ```ts\n * withForgetCascade({ subjects: { invoices: 'buyerId', contacts: 'id' } })\n * ```\n */\nexport interface SubjectDeclaration {\n readonly subjects: Record<string, string>\n}\n\n/**\n * Resolved forget strategy threaded through Noydb → every Vault. Carries\n * the same `subjects` map the user declared. `NO_FORGET` (empty map) is the\n * off-by-default sentinel; `vault.forget()` throws\n * `ForgetStrategyNotConfiguredError` when the map is empty.\n */\nexport interface ForgetStrategy {\n /** Collection → subject-field (dotted path). Empty under `NO_FORGET`. */\n readonly subjects: Readonly<Record<string, string>>\n}\n\n/**\n * Disabled sentinel — no collections declare a subject field. `vault.forget()`\n * refuses with `ForgetStrategyNotConfiguredError`; no write hooks register; no\n * collection is forced into `perRecordKeys`. Non-adopters pay nothing.\n */\nexport const NO_FORGET: ForgetStrategy = { subjects: {} }\n\n/**\n * Declare GDPR crypto-shred for one or more collections.\n *\n * Each declared collection is forced to `perRecordKeys: true` (a shred can\n * only guarantee erasure of a record whose body is keyed off a per-record\n * CEK). On write, Noydb extracts `record[subjectField]` and maintains an\n * encrypted `_subject_index` mapping `subject → [{collection, id}]`, so\n * `vault.forget(subjectId)` can find every record for a subject and rewrite\n * each to a tombstone (body + history permanently undecryptable) while the\n * collection DEK and every other record stay intact.\n *\n * @example\n * ```ts\n * createNoydb({\n * secret, user,\n * forgetStrategy: withForgetCascade({ subjects: { invoices: 'buyerId' } }),\n * })\n * const result = await vault.forget('buyer-123')\n * // → { subject, recordsShredded, historyVersionsShredded, collections, … }\n * ```\n */\nexport function withForgetCascade(opts: SubjectDeclaration): ForgetStrategy {\n return { subjects: { ...opts.subjects } }\n}\n\n/**\n * The outcome of a `vault.forget(subjectId)` call.\n *\n * `unmigratedRecords` lists `collection:id` pairs that were tombstoned but\n * whose body had NOT been migrated to a per-record CEK at shred time (legacy\n * body still under the shared collection DEK). Those records are tombstoned\n * (live envelope + history stripped) but their pre-shred ciphertext, if it\n * leaked into a backup before migration, remains decryptable under the\n * collection DEK — so erasure-completeness is NOT guaranteed for them. Run\n * the per-record-CEK migration pass, then re-forget, to close the gap.\n *\n * Blob attachments (#365): a shredded record's **erasable** blobs (on a\n * `perRecordKeys` collection) are crypto-shredded inline — `blobsShredded`\n * counts those taken to refCount 0 (BlobObject deleted → chunks permanently\n * undecryptable), `blobsRetainedShared` counts those still referenced by\n * another record (shared content legitimately persists for its other owner).\n * `blobResidueCollections` now lists only collections with blobs that could\n * NOT be crypto-shredded: **legacy** blobs (no per-blob `_cek`, chunks under\n * the shared `_blob` DEK — migrate them), or a session without the blob\n * subsystem loaded. An all-erasable subject yields an empty residue list.\n */\nexport interface ForgetResult {\n /** The subject id passed to `forget()`. Echoed for caller convenience. */\n readonly subject: string\n /** Count of live records rewritten to a tombstone. */\n readonly recordsShredded: number\n /** Count of `_history` envelopes tombstoned across all shredded records. */\n readonly historyVersionsShredded: number\n /** Distinct collections that had at least one record shredded. */\n readonly collections: readonly string[]\n /** `collection:id` pairs shredded while still un-migrated (see type docs). */\n readonly unmigratedRecords: readonly string[]\n /** Count of erasable blobs crypto-shredded (refCount → 0, BlobObject deleted). */\n readonly blobsShredded: number\n /** Count of erasable blobs retained because still referenced elsewhere (shared). */\n readonly blobsRetainedShared: number\n /** Collections with blobs that could NOT be crypto-shredded — legacy (no `_cek`) or blobs disabled (see type docs). */\n readonly blobResidueCollections: readonly string[]\n /**\n * Count of persisted `_idx/<field>/<recordId>` index side-cars hard-deleted\n * across the shredded records (#401). These live under the retained\n * collection DEK, so crypto-shred alone would leave the indexed field VALUES\n * readable — `forget()` must delete them.\n */\n readonly indexPostingsPurged: number\n /**\n * `collection:id:field` entries whose persisted `_idx` side-car could NOT be\n * deleted (#401) — index residue that still leaks the indexed value under the\n * retained collection DEK. Non-empty means erasure is INCOMPLETE: retry, or\n * purge the side-car out of band.\n */\n readonly indexResidue: readonly string[]\n /** The single `op:'forget'` ledger entry appended for this erasure. */\n readonly ledgerEntry: LedgerEntry\n}\n","/**\n * The encrypted subject index (#304).\n *\n * GDPR crypto-shred needs to answer \"which records belong to data subject\n * X?\" portably (the index must travel with the vault/bundle) WITHOUT leaking\n * subject-equivalence to the store. The rejected alternative — an unencrypted\n * subject tag in envelope metadata — would let anyone with store access see\n * which records share a subject. Instead we keep a reserved `_subject_index`\n * collection, encrypted under its OWN DEK (`getDEK('_subject_index')`):\n *\n * - record id = `sha256Hex(subjectId)` — the raw subject id never appears\n * as a key, so the store can't correlate index entries to a known subject.\n * - record body = AES-GCM(JSON `[{ collection, id }]`) under the index DEK.\n *\n * ## Concurrency (RISK #3 — known v1 limitation)\n *\n * `addSubjectRef` / `removeSubjectRef` are read-modify-write with no CAS. The\n * design assumes a SINGLE WRITER (the noy-db single-process write model). Two\n * concurrent writers racing on the SAME subject can lose an entry (last-write\n * wins on the ref list). This is documented, not fixed in v1:\n * `rebuildSubjectIndex` performs a full scan to recover a correct index from\n * the canonical records, so a lost ref is recoverable. A CAS-backed index is\n * deferred to a later slice.\n *\n * @module\n */\nimport { encrypt, decrypt } from '../crypto.js'\nimport type { NoydbStore, EncryptedEnvelope } from '../types.js'\nimport { NOYDB_FORMAT_VERSION } from '../types.js'\n\n/** Reserved collection holding the encrypted subject → records index. */\nexport const SUBJECT_INDEX_COLLECTION = '_subject_index'\n\n/** A single record reference held in a subject's index entry. */\nexport interface SubjectRef {\n readonly collection: string\n readonly id: string\n}\n\ntype GetDEK = (collectionName: string) => Promise<CryptoKey>\n\n/** SHA-256 hex of a UTF-8 string. The subject-index record key derivation. */\nasync function sha256HexString(input: string): Promise<string> {\n const bytes = new TextEncoder().encode(input)\n const digest = await globalThis.crypto.subtle.digest('SHA-256', bytes)\n return Array.from(new Uint8Array(digest))\n .map((b) => b.toString(16).padStart(2, '0'))\n .join('')\n}\n\n/** Stable subject-index record id for a subject id. */\nexport async function subjectKey(subjectId: string): Promise<string> {\n return sha256HexString(subjectId)\n}\n\n/** Read + decrypt the ref list for a subject. Returns `[]` when absent. */\nasync function readRefs(\n adapter: NoydbStore,\n vault: string,\n getDEK: GetDEK,\n encrypted: boolean,\n key: string,\n): Promise<SubjectRef[]> {\n const env = await adapter.get(vault, SUBJECT_INDEX_COLLECTION, key)\n if (!env || !env._data) return []\n if (!encrypted) return JSON.parse(env._data) as SubjectRef[]\n const dek = await getDEK(SUBJECT_INDEX_COLLECTION)\n const json = await decrypt(env._iv, env._data, dek)\n return JSON.parse(json) as SubjectRef[]\n}\n\n/** Encrypt + write a ref list for a subject under its derived key. */\nasync function writeRefs(\n adapter: NoydbStore,\n vault: string,\n getDEK: GetDEK,\n encrypted: boolean,\n key: string,\n refs: SubjectRef[],\n): Promise<void> {\n const json = JSON.stringify(refs)\n let env: EncryptedEnvelope\n if (!encrypted) {\n env = { _noydb: NOYDB_FORMAT_VERSION, _v: 1, _ts: new Date().toISOString(), _iv: '', _data: json }\n } else {\n const dek = await getDEK(SUBJECT_INDEX_COLLECTION)\n const { iv, data } = await encrypt(json, dek)\n env = { _noydb: NOYDB_FORMAT_VERSION, _v: 1, _ts: new Date().toISOString(), _iv: iv, _data: data }\n }\n await adapter.put(vault, SUBJECT_INDEX_COLLECTION, key, env)\n}\n\n/**\n * Add a `{ collection, id }` ref to a subject's index entry (idempotent —\n * a duplicate ref is not appended). Read-modify-write; see the concurrency\n * note in the module docstring.\n */\nexport async function addSubjectRef(\n adapter: NoydbStore,\n vault: string,\n getDEK: GetDEK,\n encrypted: boolean,\n subjectId: string,\n ref: SubjectRef,\n): Promise<void> {\n const key = await subjectKey(subjectId)\n const refs = await readRefs(adapter, vault, getDEK, encrypted, key)\n if (refs.some((r) => r.collection === ref.collection && r.id === ref.id)) return\n refs.push(ref)\n await writeRefs(adapter, vault, getDEK, encrypted, key, refs)\n}\n\n/**\n * Remove a `{ collection, id }` ref from a subject's index entry. When the\n * last ref is removed the (now empty) entry is deleted so the store holds no\n * residual key for an erased subject.\n */\nexport async function removeSubjectRef(\n adapter: NoydbStore,\n vault: string,\n getDEK: GetDEK,\n encrypted: boolean,\n subjectId: string,\n ref: SubjectRef,\n): Promise<void> {\n const key = await subjectKey(subjectId)\n const refs = await readRefs(adapter, vault, getDEK, encrypted, key)\n const next = refs.filter((r) => !(r.collection === ref.collection && r.id === ref.id))\n if (next.length === refs.length) return\n if (next.length === 0) {\n await adapter.delete(vault, SUBJECT_INDEX_COLLECTION, key)\n return\n }\n await writeRefs(adapter, vault, getDEK, encrypted, key, next)\n}\n\n/** Look up every record ref for a subject. Returns `[]` when none exist. */\nexport async function lookupSubject(\n adapter: NoydbStore,\n vault: string,\n getDEK: GetDEK,\n encrypted: boolean,\n subjectId: string,\n): Promise<SubjectRef[]> {\n const key = await subjectKey(subjectId)\n return readRefs(adapter, vault, getDEK, encrypted, key)\n}\n\n/**\n * Rebuild the entire subject index from the canonical records (the recovery\n * path for the documented read-modify-write race). Scans each declared\n * collection, reads `record[subjectField]` (dotted path), and rewrites the\n * index from scratch. Tombstoned (already-shredded) records contribute no\n * ref — their body is gone, so they cannot be re-indexed.\n *\n * `decodeRecord` decrypts an envelope to a plain object (or returns null for\n * a tombstone / unreadable record); supplied by the caller so this module\n * stays free of Collection internals.\n */\nexport async function rebuildSubjectIndex(\n adapter: NoydbStore,\n vault: string,\n getDEK: GetDEK,\n encrypted: boolean,\n subjects: Readonly<Record<string, string>>,\n decodeRecord: (collection: string, id: string, env: EncryptedEnvelope) => Promise<Record<string, unknown> | null>,\n): Promise<number> {\n // Drop every existing index entry first so removed refs don't linger.\n const existing = await adapter.list(vault, SUBJECT_INDEX_COLLECTION)\n for (const k of existing) {\n await adapter.delete(vault, SUBJECT_INDEX_COLLECTION, k)\n }\n\n // subjectId → refs, accumulated across all declared collections.\n const bySubject = new Map<string, SubjectRef[]>()\n for (const [collection, field] of Object.entries(subjects)) {\n const ids = await adapter.list(vault, collection)\n for (const id of ids) {\n if (id.startsWith('_')) continue\n const env = await adapter.get(vault, collection, id)\n if (!env || !env._data) continue // missing or tombstone\n const record = await decodeRecord(collection, id, env)\n if (record === null) continue\n const subjectValue = readDottedPath(record, field)\n if (subjectValue === undefined || subjectValue === null) continue\n const subjectId = coerceSubjectId(subjectValue)\n const list = bySubject.get(subjectId) ?? []\n list.push({ collection, id })\n bySubject.set(subjectId, list)\n }\n }\n\n let entries = 0\n for (const [subjectId, refs] of bySubject) {\n const key = await subjectKey(subjectId)\n await writeRefs(adapter, vault, getDEK, encrypted, key, refs)\n entries++\n }\n return entries\n}\n\n/**\n * Coerce a read subject-field value to a stable string id. Primitives use\n * their natural string form; objects/arrays are JSON-stringified so structural\n * subjects still get a deterministic key (avoids the `[object Object]` trap).\n */\nexport function coerceSubjectId(value: unknown): string {\n if (typeof value === 'string') return value\n if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint') {\n return String(value)\n }\n return JSON.stringify(value)\n}\n\n/** Read a (possibly dotted) field path from a plain record. */\nexport function readDottedPath(record: Record<string, unknown>, field: string): unknown {\n if (!field.includes('.')) return record[field]\n let cursor: unknown = record\n for (const segment of field.split('.')) {\n if (cursor === null || cursor === undefined) return undefined\n cursor = (cursor as Record<string, unknown>)[segment]\n }\n return cursor\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiDO,IAAM,YAA4B,EAAE,UAAU,CAAC,EAAE;AAuBjD,SAAS,kBAAkB,MAA0C;AAC1E,SAAO,EAAE,UAAU,EAAE,GAAG,KAAK,SAAS,EAAE;AAC1C;;;AC3CO,IAAM,2BAA2B;","names":[]}
@@ -1 +1 @@
1
- export { b as ForgetResult, F as ForgetStrategy, N as NO_FORGET, d as SUBJECT_INDEX_COLLECTION, e as SubjectDeclaration, S as SubjectRef, w as withForgetCascade } from '../index-C-SSRIxP.cjs';
1
+ export { b as ForgetResult, F as ForgetStrategy, N as NO_FORGET, d as SUBJECT_INDEX_COLLECTION, e as SubjectDeclaration, S as SubjectRef, w as withForgetCascade } from '../index-BMmajblo.cjs';
@@ -1 +1 @@
1
- export { b as ForgetResult, F as ForgetStrategy, N as NO_FORGET, d as SUBJECT_INDEX_COLLECTION, e as SubjectDeclaration, S as SubjectRef, w as withForgetCascade } from '../index-C-SSRIxP.js';
1
+ export { b as ForgetResult, F as ForgetStrategy, N as NO_FORGET, d as SUBJECT_INDEX_COLLECTION, e as SubjectDeclaration, S as SubjectRef, w as withForgetCascade } from '../index-BMmajblo.js';
@@ -2,10 +2,10 @@ import {
2
2
  NO_FORGET,
3
3
  SUBJECT_INDEX_COLLECTION,
4
4
  withForgetCascade
5
- } from "../chunk-C2OYWD5S.js";
6
- import "../chunk-LGPSCKWZ.js";
7
- import "../chunk-QJKZ5WUP.js";
8
- import "../chunk-HMFC6M2G.js";
5
+ } from "../chunk-KNKNOJFS.js";
6
+ import "../chunk-SHIUFIPW.js";
7
+ import "../chunk-OKOKPYWH.js";
8
+ import "../chunk-DJF3FXW5.js";
9
9
  export {
10
10
  NO_FORGET,
11
11
  SUBJECT_INDEX_COLLECTION,