@noy-db/hub 0.8.0-pre.0 → 0.8.0

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 (624) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/api-OS747DS4.js +18 -0
  3. package/dist/as/index.js +11 -12
  4. package/dist/as/index.js.map +1 -1
  5. package/dist/at/index.js +9 -10
  6. package/dist/attestation/index.js +39 -28
  7. package/dist/attestation/index.js.map +1 -1
  8. package/dist/{backup-7TFRVFLH.js → backup-YE2VQ26S.js} +15 -16
  9. package/dist/backup-YE2VQ26S.js.map +1 -0
  10. package/dist/blobs/index.js +13 -14
  11. package/dist/blobs/index.js.map +1 -1
  12. package/dist/broker/index.js +12 -13
  13. package/dist/broker/index.js.map +1 -1
  14. package/dist/by/index.js +2 -2
  15. package/dist/capsule/contract.d.ts +159 -0
  16. package/dist/capsule/contract.js +95 -0
  17. package/dist/capsule/enclave-aes/bound.d.ts +52 -0
  18. package/dist/capsule/enclave-aes/capabilities.d.ts +2 -0
  19. package/dist/capsule/enclave-aes/classify/compare.d.ts +20 -0
  20. package/dist/{kernel/enclave → capsule/enclave-aes}/classify/find.d.ts +1 -1
  21. package/dist/{kernel/enclave → capsule/enclave-aes}/classify/reveal.d.ts +1 -1
  22. package/dist/{kernel/enclave → capsule/enclave-aes}/classify/verify.d.ts +2 -2
  23. package/dist/{kernel/enclave → capsule/enclave-aes}/classify/write.d.ts +1 -1
  24. package/dist/{kernel/enclave → capsule/enclave-aes}/crypto.d.ts +33 -129
  25. package/dist/capsule/enclave-aes/index.d.ts +113 -0
  26. package/dist/capsule/enclave-aes/index.js +335 -0
  27. package/dist/capsule/enclave-aes/index.js.map +1 -0
  28. package/dist/capsule/enclave-aes/primitives.d.ts +29 -0
  29. package/dist/capsule/index.d.ts +27 -0
  30. package/dist/capsule/plumbing/ct-equal.d.ts +11 -0
  31. package/dist/{kernel/enclave/record-keys → capsule/plumbing}/deterministic.d.ts +8 -21
  32. package/dist/capsule/plumbing/digest.d.ts +122 -0
  33. package/dist/{kernel/enclave/record-keys → capsule/plumbing}/envelope-body.d.ts +44 -48
  34. package/dist/capsule/plumbing/index.d.ts +100 -0
  35. package/dist/capsule/plumbing/lifecycle.d.ts +50 -0
  36. package/dist/{kernel/enclave/record-keys → capsule/plumbing}/record-codec.d.ts +55 -20
  37. package/dist/{kernel/enclave → capsule/plumbing}/record-envelope.d.ts +1 -1
  38. package/dist/capsule/plumbing/rekey-blob.d.ts +33 -0
  39. package/dist/capsule/plumbing/rekey.d.ts +44 -0
  40. package/dist/capsule/plumbing/sealed-slot.d.ts +22 -0
  41. package/dist/capsule/plumbing/sealed-slots.d.ts +37 -0
  42. package/dist/capsule/plumbing/sealing.d.ts +29 -0
  43. package/dist/capsule/plumbing/sign.d.ts +9 -0
  44. package/dist/{kernel/enclave/record-keys → capsule/plumbing}/tombstone.d.ts +2 -2
  45. package/dist/capsule-VOLX3QRQ.js +209 -0
  46. package/dist/cargo/index.js +36 -36
  47. package/dist/{chunk-DF73H4UN.js → chunk-23D6M6VM.js} +5 -5
  48. package/dist/chunk-23D6M6VM.js.map +1 -0
  49. package/dist/{chunk-FH2L2E34.js → chunk-244QBK7Z.js} +4 -4
  50. package/dist/{chunk-FH2L2E34.js.map → chunk-244QBK7Z.js.map} +1 -1
  51. package/dist/{chunk-YSK2CU2Q.js → chunk-2AFX33YA.js} +2 -2
  52. package/dist/{chunk-TKUOEU2F.js → chunk-2GHDLTPE.js} +2 -2
  53. package/dist/{chunk-GYGLAVCX.js → chunk-2MG3SW7Q.js} +6 -2
  54. package/dist/chunk-2MG3SW7Q.js.map +1 -0
  55. package/dist/{chunk-6OWXYZK2.js → chunk-2ODVB6LZ.js} +2 -2
  56. package/dist/{chunk-X25NWUZB.js → chunk-2PVXF5CS.js} +3 -3
  57. package/dist/{chunk-IEX7NK2K.js → chunk-2RH777HH.js} +21 -20
  58. package/dist/{chunk-IEX7NK2K.js.map → chunk-2RH777HH.js.map} +1 -1
  59. package/dist/{chunk-244VXYPG.js → chunk-37EPTBBR.js} +14 -1
  60. package/dist/chunk-37EPTBBR.js.map +1 -0
  61. package/dist/{chunk-NRT6QZQB.js → chunk-3A5DUZ56.js} +6 -6
  62. package/dist/chunk-3A5DUZ56.js.map +1 -0
  63. package/dist/{chunk-ORDURZBU.js → chunk-3EWS67C7.js} +2 -2
  64. package/dist/{chunk-3H5KLDZN.js → chunk-3L2NBKDR.js} +4 -8
  65. package/dist/chunk-3L2NBKDR.js.map +1 -0
  66. package/dist/{chunk-ENAG3IY7.js → chunk-3XJQBBZD.js} +26 -28
  67. package/dist/chunk-3XJQBBZD.js.map +1 -0
  68. package/dist/{chunk-KJFW62P4.js → chunk-42ALPZ2B.js} +652 -662
  69. package/dist/chunk-42ALPZ2B.js.map +1 -0
  70. package/dist/{chunk-FXQBGFOX.js → chunk-4CIQDWRB.js} +8 -8
  71. package/dist/{chunk-HT2AHGQI.js → chunk-4JPMZTJY.js} +2 -2
  72. package/dist/{chunk-FQ5VRHIB.js → chunk-4T3SE27M.js} +5 -9
  73. package/dist/chunk-4T3SE27M.js.map +1 -0
  74. package/dist/{chunk-MKXXMNJH.js → chunk-4V3Q35WG.js} +2 -2
  75. package/dist/{chunk-A6IJU4TK.js → chunk-52MGURXO.js} +2 -2
  76. package/dist/{chunk-IUWCVHQ7.js → chunk-5A4345TG.js} +4 -4
  77. package/dist/{chunk-IUWCVHQ7.js.map → chunk-5A4345TG.js.map} +1 -1
  78. package/dist/{chunk-ISZQJBML.js → chunk-5FE75J4S.js} +6 -6
  79. package/dist/chunk-5FE75J4S.js.map +1 -0
  80. package/dist/chunk-5KC7QYEC.js +565 -0
  81. package/dist/chunk-5KC7QYEC.js.map +1 -0
  82. package/dist/{chunk-NNARWO72.js → chunk-5UMK7GRI.js} +13 -12
  83. package/dist/chunk-5UMK7GRI.js.map +1 -0
  84. package/dist/{chunk-HLEK5VAN.js → chunk-5WWDGFOS.js} +2 -2
  85. package/dist/{chunk-CKNGS5MH.js → chunk-6QVKPHBF.js} +3 -5
  86. package/dist/chunk-6QVKPHBF.js.map +1 -0
  87. package/dist/{chunk-PSIV7CJV.js → chunk-747G6CT3.js} +2 -2
  88. package/dist/chunk-747G6CT3.js.map +1 -0
  89. package/dist/{chunk-LGRLME4M.js → chunk-7R2Q7CPL.js} +16 -16
  90. package/dist/chunk-7R2Q7CPL.js.map +1 -0
  91. package/dist/{chunk-SOIQ4MM4.js → chunk-7XMHMVTS.js} +3 -3
  92. package/dist/{chunk-BUDAGWL5.js → chunk-A4XMIZT3.js} +6 -6
  93. package/dist/{chunk-BUDAGWL5.js.map → chunk-A4XMIZT3.js.map} +1 -1
  94. package/dist/{chunk-4MXI3ODD.js → chunk-AEQGFRU4.js} +3 -3
  95. package/dist/{chunk-7JE7BDYJ.js → chunk-AL6ML4LA.js} +5 -5
  96. package/dist/{chunk-ZUVBC32X.js → chunk-AUKKUPVB.js} +2 -2
  97. package/dist/chunk-BNWA3WG5.js +22 -0
  98. package/dist/chunk-BNWA3WG5.js.map +1 -0
  99. package/dist/{chunk-WY2XXTET.js → chunk-BPWYQ25R.js} +4 -4
  100. package/dist/{chunk-EOVMT6TB.js → chunk-BVCUTXE3.js} +2 -2
  101. package/dist/{chunk-UPD5NWI5.js → chunk-DHHGL42E.js} +13 -16
  102. package/dist/chunk-DHHGL42E.js.map +1 -0
  103. package/dist/{chunk-3JWHAR6E.js → chunk-DIZLQVAA.js} +2 -2
  104. package/dist/{chunk-QWFHIOD2.js → chunk-DLD5LGDS.js} +11 -12
  105. package/dist/chunk-DLD5LGDS.js.map +1 -0
  106. package/dist/{chunk-ZE4CHIED.js → chunk-DQESF6RP.js} +17 -28
  107. package/dist/chunk-DQESF6RP.js.map +1 -0
  108. package/dist/{chunk-IT22PWKV.js → chunk-E2N2T5ZO.js} +2 -2
  109. package/dist/{chunk-3ELRMVJK.js → chunk-EGVJ7TM4.js} +31 -34
  110. package/dist/chunk-EGVJ7TM4.js.map +1 -0
  111. package/dist/{chunk-WNJ4AVGE.js → chunk-EJLV62NI.js} +2 -2
  112. package/dist/{chunk-QBBUZ3I3.js → chunk-EYG2CY2X.js} +11 -11
  113. package/dist/{enclave-27SMF6GF.js → chunk-EZGV6F47.js} +83 -56
  114. package/dist/chunk-EZGV6F47.js.map +1 -0
  115. package/dist/{chunk-LQ4ZHOKP.js → chunk-EZOAKKTB.js} +36 -27
  116. package/dist/chunk-EZOAKKTB.js.map +1 -0
  117. package/dist/{chunk-BJ2IXQ5Q.js → chunk-FFJFE4T7.js} +2 -2
  118. package/dist/{chunk-JCN44NCY.js → chunk-FLPCETP6.js} +2 -2
  119. package/dist/{chunk-5O7D6ZTW.js → chunk-FOEDQATO.js} +2 -2
  120. package/dist/{chunk-VNNRUGMM.js → chunk-FVH5QYY2.js} +2 -2
  121. package/dist/{chunk-ANWPSTZU.js → chunk-G2MVBDFP.js} +23 -26
  122. package/dist/chunk-G2MVBDFP.js.map +1 -0
  123. package/dist/chunk-GMKGGY7V.js +234 -0
  124. package/dist/chunk-GMKGGY7V.js.map +1 -0
  125. package/dist/{chunk-EIPVYUEP.js → chunk-GQ4MF3CM.js} +3 -3
  126. package/dist/chunk-GQ4MF3CM.js.map +1 -0
  127. package/dist/{chunk-PEOZ34EM.js → chunk-GSAK56VF.js} +1 -1
  128. package/dist/chunk-GSAK56VF.js.map +1 -0
  129. package/dist/{chunk-QOOUUR4A.js → chunk-GUZET4SG.js} +10 -4
  130. package/dist/chunk-GUZET4SG.js.map +1 -0
  131. package/dist/{chunk-4AF3TUMP.js → chunk-GZT3NQRA.js} +2 -2
  132. package/dist/{chunk-N5DNADLQ.js → chunk-H23XHRTT.js} +19 -34
  133. package/dist/chunk-H23XHRTT.js.map +1 -0
  134. package/dist/{chunk-MVZ2TPVP.js → chunk-H427H63K.js} +2 -2
  135. package/dist/{chunk-6B3VNR4P.js → chunk-H7JBY4P7.js} +23 -32
  136. package/dist/chunk-H7JBY4P7.js.map +1 -0
  137. package/dist/{chunk-MLPHLJIQ.js → chunk-HS554XAF.js} +2 -2
  138. package/dist/{chunk-HK67PX4J.js → chunk-HW7CMKUG.js} +1 -1
  139. package/dist/chunk-HW7CMKUG.js.map +1 -0
  140. package/dist/{chunk-S57HTZ6X.js → chunk-IMQKWR46.js} +5 -7
  141. package/dist/chunk-IMQKWR46.js.map +1 -0
  142. package/dist/{chunk-FCKWQE2H.js → chunk-IUBMZPHM.js} +7 -7
  143. package/dist/chunk-IUBMZPHM.js.map +1 -0
  144. package/dist/{chunk-UD5EVGZ7.js → chunk-IUT3GWP3.js} +49 -13
  145. package/dist/chunk-IUT3GWP3.js.map +1 -0
  146. package/dist/{chunk-J6UOHJY5.js → chunk-JDEYF3PJ.js} +4 -8
  147. package/dist/{chunk-J6UOHJY5.js.map → chunk-JDEYF3PJ.js.map} +1 -1
  148. package/dist/{chunk-NWHBJQAL.js → chunk-JIBUPZHA.js} +4 -4
  149. package/dist/chunk-JIBUPZHA.js.map +1 -0
  150. package/dist/{chunk-TROR3ALR.js → chunk-JOSPH3E5.js} +2 -2
  151. package/dist/{chunk-F24ZZTHQ.js → chunk-JQYKPKG6.js} +4 -4
  152. package/dist/{chunk-GF5BZ7D4.js → chunk-JSMTXZR3.js} +8 -12
  153. package/dist/chunk-JSMTXZR3.js.map +1 -0
  154. package/dist/chunk-JWWYRR4Q.js +12 -0
  155. package/dist/chunk-JWWYRR4Q.js.map +1 -0
  156. package/dist/{chunk-HBPPGWUM.js → chunk-KZXDLBY6.js} +14 -9
  157. package/dist/chunk-KZXDLBY6.js.map +1 -0
  158. package/dist/{chunk-7VCXZDA4.js → chunk-LIOVX5TJ.js} +7 -11
  159. package/dist/chunk-LIOVX5TJ.js.map +1 -0
  160. package/dist/{chunk-QWGU66MP.js → chunk-LNSVGRHO.js} +5 -7
  161. package/dist/chunk-LNSVGRHO.js.map +1 -0
  162. package/dist/{chunk-MDWKM2XC.js → chunk-M5B2W6YY.js} +3 -3
  163. package/dist/{chunk-F2TDU7MQ.js → chunk-MBMTND6D.js} +2 -2
  164. package/dist/{chunk-K6W7BVZ6.js → chunk-MILI22XQ.js} +3 -3
  165. package/dist/{chunk-YNIUIERI.js → chunk-MXKI4ABF.js} +18 -59
  166. package/dist/chunk-MXKI4ABF.js.map +1 -0
  167. package/dist/{chunk-T2LBQ5DV.js → chunk-MXOQ5JCG.js} +252 -214
  168. package/dist/chunk-MXOQ5JCG.js.map +1 -0
  169. package/dist/{chunk-ZXABPVM6.js → chunk-N7EVQD5S.js} +9 -13
  170. package/dist/chunk-N7EVQD5S.js.map +1 -0
  171. package/dist/{chunk-CF5UU4S7.js → chunk-N7UDP5VU.js} +7 -7
  172. package/dist/{chunk-FQ54DWUQ.js → chunk-NBQ3KK6X.js} +4 -4
  173. package/dist/{chunk-4I522ERM.js → chunk-NCO25JZO.js} +4 -4
  174. package/dist/chunk-NH2UOV3B.js +18 -0
  175. package/dist/chunk-NH2UOV3B.js.map +1 -0
  176. package/dist/{chunk-SI3V7D4G.js → chunk-O2IMQSNA.js} +2 -2
  177. package/dist/{chunk-T52GX4SA.js → chunk-O46CHQT7.js} +4 -4
  178. package/dist/chunk-OIEO4WDL.js +27 -0
  179. package/dist/chunk-OIEO4WDL.js.map +1 -0
  180. package/dist/{chunk-GHLTDZRS.js → chunk-OKSTSITU.js} +25 -4
  181. package/dist/chunk-OKSTSITU.js.map +1 -0
  182. package/dist/{chunk-TOPYQ6GA.js → chunk-OYW3I5M4.js} +6 -6
  183. package/dist/{chunk-X4773RBR.js → chunk-PD64727P.js} +2 -2
  184. package/dist/chunk-PD64727P.js.map +1 -0
  185. package/dist/{chunk-BP6DARYA.js → chunk-PP3K67AJ.js} +4 -4
  186. package/dist/chunk-PP3K67AJ.js.map +1 -0
  187. package/dist/chunk-Q2XRFWOI.js +40 -0
  188. package/dist/chunk-Q2XRFWOI.js.map +1 -0
  189. package/dist/{chunk-AOWGXU6D.js → chunk-Q4UHJ5SN.js} +2 -2
  190. package/dist/{chunk-FW22ZCXT.js → chunk-QBLT6POL.js} +2 -2
  191. package/dist/chunk-QMWY2FDS.js +157 -0
  192. package/dist/chunk-QMWY2FDS.js.map +1 -0
  193. package/dist/{chunk-I3JDRCMW.js → chunk-RB4DOPGZ.js} +10 -10
  194. package/dist/{chunk-32YV3TJT.js → chunk-SMV2HRDU.js} +2 -2
  195. package/dist/{chunk-ODVPTDPK.js → chunk-SV2PM2OY.js} +1 -1
  196. package/dist/chunk-SV2PM2OY.js.map +1 -0
  197. package/dist/{chunk-Z5HTYMMQ.js → chunk-SYNY3VB5.js} +2 -2
  198. package/dist/{chunk-SYVZW77S.js → chunk-TEHHROZL.js} +6 -8
  199. package/dist/chunk-TEHHROZL.js.map +1 -0
  200. package/dist/{chunk-ZSX4S5XB.js → chunk-TKVUE4JF.js} +9 -9
  201. package/dist/{chunk-B57AFBY2.js → chunk-TZZBXPZK.js} +2 -2
  202. package/dist/{chunk-VNPEWFPD.js → chunk-U2FZNEWJ.js} +4 -4
  203. package/dist/chunk-U2FZNEWJ.js.map +1 -0
  204. package/dist/{chunk-5FDLC6G7.js → chunk-UA372JHH.js} +3 -3
  205. package/dist/{chunk-PDCG6PR5.js → chunk-UEFOQH74.js} +2 -2
  206. package/dist/chunk-UEFOQH74.js.map +1 -0
  207. package/dist/{chunk-HVSCEIYL.js → chunk-UIYESRD6.js} +9 -11
  208. package/dist/chunk-UIYESRD6.js.map +1 -0
  209. package/dist/{chunk-B6SJIBQK.js → chunk-V3RWOOSO.js} +4 -4
  210. package/dist/{chunk-HBRLNOHL.js → chunk-V7ADQF5O.js} +4 -4
  211. package/dist/{chunk-L7DOS3TE.js → chunk-VAORSCSU.js} +3 -3
  212. package/dist/chunk-VAORSCSU.js.map +1 -0
  213. package/dist/{chunk-M522UYZ2.js → chunk-VFHCKG5M.js} +6 -10
  214. package/dist/chunk-VFHCKG5M.js.map +1 -0
  215. package/dist/{chunk-DC5QVPV7.js → chunk-VHBKYN2J.js} +3 -3
  216. package/dist/chunk-VHBKYN2J.js.map +1 -0
  217. package/dist/{chunk-WX5ADGTZ.js → chunk-VKI2EB3N.js} +3 -3
  218. package/dist/chunk-VKI2EB3N.js.map +1 -0
  219. package/dist/{chunk-MTL7MXGR.js → chunk-VMV5SBE4.js} +16 -17
  220. package/dist/chunk-VMV5SBE4.js.map +1 -0
  221. package/dist/{chunk-F7XGHL5O.js → chunk-VQDZYB2B.js} +3 -3
  222. package/dist/{chunk-BK2HHQGN.js → chunk-VVOLDVIR.js} +2 -2
  223. package/dist/{chunk-6LMQ5R26.js → chunk-WPOYWFSE.js} +7 -7
  224. package/dist/{chunk-6LMQ5R26.js.map → chunk-WPOYWFSE.js.map} +1 -1
  225. package/dist/{chunk-3F7GLNAE.js → chunk-WXE4W2U6.js} +7 -11
  226. package/dist/chunk-WXE4W2U6.js.map +1 -0
  227. package/dist/{chunk-6K7DPM7D.js → chunk-XQRFSKYM.js} +2 -2
  228. package/dist/{chunk-M7NI3IWE.js → chunk-XSPFDUDG.js} +22 -50
  229. package/dist/chunk-XSPFDUDG.js.map +1 -0
  230. package/dist/{chunk-ID6Z6E66.js → chunk-Y2RKVFKR.js} +2 -2
  231. package/dist/{chunk-6LNL42F5.js → chunk-Y3LPTBG7.js} +12 -12
  232. package/dist/chunk-Y3LPTBG7.js.map +1 -0
  233. package/dist/{chunk-FN5EBVTQ.js → chunk-YRXFFWG4.js} +2 -2
  234. package/dist/classified/index.js +5 -5
  235. package/dist/{classified-marker-W3USLL5M.js → classified-marker-SIYKUU5L.js} +3 -3
  236. package/dist/classified-marker-SIYKUU5L.js.map +1 -0
  237. package/dist/collection-facade-CS7CA2XO.js +47 -0
  238. package/dist/{computed-TPFBX7U4.js → computed-FAD7SED4.js} +3 -3
  239. package/dist/consent/index.js +10 -11
  240. package/dist/consent/index.js.map +1 -1
  241. package/dist/cover/index.js +9 -10
  242. package/dist/custody/index.js +12 -13
  243. package/dist/{dead-filter-U2UYKSZL.js → dead-filter-4F3LWYKH.js} +11 -3
  244. package/dist/dead-filter-4F3LWYKH.js.map +1 -0
  245. package/dist/debug/index.js +11 -2
  246. package/dist/debug/index.js.map +1 -1
  247. package/dist/{delegation-S3AEPW2T.js → delegation-NANZDG4N.js} +13 -16
  248. package/dist/delegation-NANZDG4N.js.map +1 -0
  249. package/dist/derivations/index.js +23 -24
  250. package/dist/derive-XLOJVXPU.js +20 -0
  251. package/dist/directory/index.js +10 -11
  252. package/dist/{dispatch-3CQDJV5Q.js → dispatch-H4HV32AM.js} +5 -5
  253. package/dist/{dispatch-RH4LHKBH.js → dispatch-JDZNGEB3.js} +21 -22
  254. package/dist/dispatch-JDZNGEB3.js.map +1 -0
  255. package/dist/executor-FMPVN6DT.js +35 -0
  256. package/dist/executor-LBBBRTN5.js +8 -0
  257. package/dist/executor-OSRZST2U.js +8 -0
  258. package/dist/export-accessible-RAOJAAU5.js +22 -0
  259. package/dist/extract-partition-JD5CUSTG.js +37 -0
  260. package/dist/{fanout-sidecar-OT6RYLOL.js → fanout-sidecar-L7NHPIOC.js} +13 -15
  261. package/dist/fanout-sidecar-L7NHPIOC.js.map +1 -0
  262. package/dist/find-JRN4RNQ5.js +10 -0
  263. package/dist/forget/index.js +9 -10
  264. package/dist/forget/index.js.map +1 -1
  265. package/dist/guards/index.js +4 -4
  266. package/dist/history/index.js +13 -14
  267. package/dist/history/index.js.map +1 -1
  268. package/dist/i18n/index.js +14 -15
  269. package/dist/i18n/index.js.map +1 -1
  270. package/dist/index.d.ts +8 -8
  271. package/dist/index.js +183 -184
  272. package/dist/index.js.map +1 -1
  273. package/dist/indexing/index.js +5 -5
  274. package/dist/introspection/index.js +11 -12
  275. package/dist/issue-YIVBZUTH.js +19 -0
  276. package/dist/kernel/attestation-types.d.ts +62 -0
  277. package/dist/kernel/collection-config.d.ts +1 -48
  278. package/dist/kernel/collection.d.ts +1 -1
  279. package/dist/kernel/cutover-transform.d.ts +1 -1
  280. package/dist/kernel/errors.d.ts +30 -2
  281. package/dist/kernel/merge-authority.d.ts +1 -1
  282. package/dist/kernel/paths.d.ts +29 -5
  283. package/dist/kernel/prepared-write.d.ts +1 -1
  284. package/dist/kernel/secret-mode.d.ts +1 -1
  285. package/dist/kernel/types.d.ts +42 -5
  286. package/dist/kernel/vault.d.ts +2 -2
  287. package/dist/kernel/write-queue.d.ts +17 -0
  288. package/dist/{ledger-KZPCMVZY.js → ledger-5ZMGE44K.js} +11 -12
  289. package/dist/liberate-WZSZM2W6.js +24 -0
  290. package/dist/link-set-MFXC24VK.js +29 -0
  291. package/dist/{managed-secret-S3MQ6SH6.js → managed-secret-MFTFT22X.js} +10 -11
  292. package/dist/materialized-views/index.js +26 -27
  293. package/dist/{migrate-cek-V7GKJZ7O.js → migrate-cek-DZRFFOHW.js} +2 -2
  294. package/dist/money/index.js +5 -5
  295. package/dist/noydb-ITIGNKUF.js +96 -0
  296. package/dist/overlay-views/index.js +4 -4
  297. package/dist/periods/index.js +12 -13
  298. package/dist/pod/index.js +72 -72
  299. package/dist/{pod-handle-WGDFB4C2.js → pod-handle-A3LET7NO.js} +10 -11
  300. package/dist/pod-handle-A3LET7NO.js.map +1 -0
  301. package/dist/policy/index.js +10 -11
  302. package/dist/port/on/index.d.ts +1 -1
  303. package/dist/port/to/index.d.ts +1 -1
  304. package/dist/port/with/blob-strategy.d.ts +1 -1
  305. package/dist/port/with/classified-strategy.d.ts +1 -1
  306. package/dist/port/with/collection-options.d.ts +1 -1
  307. package/dist/port/with/collection-registries.d.ts +1 -1
  308. package/dist/port/with/lookup-strategy.d.ts +2 -2
  309. package/dist/portability/index.js +8 -8
  310. package/dist/{post-register-SLSXIPBV.js → post-register-7ND27CF2.js} +6 -6
  311. package/dist/post-register-7ND27CF2.js.map +1 -0
  312. package/dist/query/all/index.js +15 -15
  313. package/dist/query/index.js +7 -7
  314. package/dist/query/live/index.js +7 -7
  315. package/dist/query/reduce/index.js +10 -10
  316. package/dist/query/relate/index.js +9 -9
  317. package/dist/reduce/index.js +8 -8
  318. package/dist/register-DT5HZ2LZ.js +30 -0
  319. package/dist/registry-BHRZGZHF.js +8 -0
  320. package/dist/registry-ET6ZFFWA.js +34 -0
  321. package/dist/registry-HXFGLGTG.js +8 -0
  322. package/dist/registry-THCPDEOD.js +23 -0
  323. package/dist/request-withdrawal-AV2MJJKY.js +30 -0
  324. package/dist/{reveal-4BCKPEC2.js → reveal-B2TLP4JQ.js} +10 -9
  325. package/dist/reveal-B2TLP4JQ.js.map +1 -0
  326. package/dist/revoke-6DWIEOCV.js +24 -0
  327. package/dist/satellites/index.js +1 -1
  328. package/dist/schema-update/index.js +2 -2
  329. package/dist/sealed-record/index.js +16 -18
  330. package/dist/sealed-record/index.js.map +1 -1
  331. package/dist/search/index.js +4 -4
  332. package/dist/{seed-4JS2RJ4A.js → seed-XNSE4U3S.js} +15 -18
  333. package/dist/seed-XNSE4U3S.js.map +1 -0
  334. package/dist/sequence/index.js +9 -10
  335. package/dist/session/index.js +9 -10
  336. package/dist/session/index.js.map +1 -1
  337. package/dist/shadow/index.js +2 -2
  338. package/dist/signer-MHGW3OIL.js +23 -0
  339. package/dist/snapshots/index.js +11 -11
  340. package/dist/stale-6GCFMOOR.js +28 -0
  341. package/dist/storage-BYN5LO6Z.js +21 -0
  342. package/dist/store/index.js +1 -1
  343. package/dist/{store-coordination-provider-2O2VUHKW.js → store-coordination-provider-C4BPT5XF.js} +11 -12
  344. package/dist/store-coordination-provider-C4BPT5XF.js.map +1 -0
  345. package/dist/sync/index.js +10 -11
  346. package/dist/sync/index.js.map +1 -1
  347. package/dist/team/index.js +15 -16
  348. package/dist/tiers/index.js +11 -12
  349. package/dist/to/index.js +2 -2
  350. package/dist/transactions/index.js +3 -3
  351. package/dist/util/index.js +1 -1
  352. package/dist/vault-head/index.js +11 -14
  353. package/dist/vault-head/index.js.map +1 -1
  354. package/dist/{verify-RVT67IMH.js → verify-UKALW7C2.js} +14 -12
  355. package/dist/verify-UKALW7C2.js.map +1 -0
  356. package/dist/via/classified/binding.d.ts +2 -2
  357. package/dist/via/classified/config-drift.d.ts +2 -2
  358. package/dist/via/classified/errors.d.ts +1 -1
  359. package/dist/via/lookup/handle.d.ts +4 -4
  360. package/dist/walk-4VPK7AS4.js +20 -0
  361. package/dist/with-audit/attestation/index.d.ts +2 -1
  362. package/dist/with-audit/attestation/issue.d.ts +2 -2
  363. package/dist/with-audit/attestation/revoke.d.ts +2 -2
  364. package/dist/with-audit/attestation/scheme.d.ts +7 -0
  365. package/dist/with-audit/attestation/signer.d.ts +1 -1
  366. package/dist/with-audit/attestation/strategy.d.ts +2 -2
  367. package/dist/with-audit/attestation/types.d.ts +10 -0
  368. package/dist/with-audit/attestation/vault-facade.d.ts +2 -2
  369. package/dist/with-audit/attestation/verifier.d.ts +6 -0
  370. package/dist/with-audit/consent/consent.d.ts +1 -1
  371. package/dist/with-audit/consent/strategy.d.ts +1 -1
  372. package/dist/with-audit/forget/subject-index.d.ts +1 -1
  373. package/dist/with-audit/periods/vault-facade.d.ts +1 -1
  374. package/dist/with-audit/sealed-record/index.d.ts +2 -2
  375. package/dist/with-audit/sealed-record/strategy.d.ts +1 -1
  376. package/dist/with-audit/tiers/index.d.ts +2 -2
  377. package/dist/with-cargo/adopt-partition.d.ts +1 -1
  378. package/dist/with-cargo/extract-partition.d.ts +1 -1
  379. package/dist/with-cargo/floor.d.ts +1 -1
  380. package/dist/with-commit/history/history.d.ts +2 -2
  381. package/dist/with-commit/history/index.d.ts +1 -1
  382. package/dist/with-commit/history/ledger/store.d.ts +1 -1
  383. package/dist/with-commit/history/strategy.d.ts +1 -1
  384. package/dist/with-commit/history/time-machine.d.ts +1 -1
  385. package/dist/with-commit/numbering/index.d.ts +1 -1
  386. package/dist/with-commit/sequence/index.d.ts +1 -1
  387. package/dist/with-commit/vault-head/head.d.ts +1 -1
  388. package/dist/with-commit/vault-head/index.d.ts +1 -1
  389. package/dist/with-commit/vault-head/strategy.d.ts +1 -1
  390. package/dist/with-commit/vault-head/verify.d.ts +1 -1
  391. package/dist/with-formula/derivations/dispatch.d.ts +1 -1
  392. package/dist/with-formula/derivations/fanout-sidecar.d.ts +1 -1
  393. package/dist/with-lookup/indexing/collection-facade.d.ts +1 -1
  394. package/dist/with-lookup/search/collection-facade.d.ts +1 -1
  395. package/dist/with-party/broker/index.d.ts +3 -3
  396. package/dist/with-party/directory/user-envelope/storage.d.ts +1 -1
  397. package/dist/with-party/team/delegation.d.ts +1 -1
  398. package/dist/with-party/team/echo-secret.d.ts +2 -2
  399. package/dist/with-party/team/index.d.ts +1 -1
  400. package/dist/with-party/team/keyring.d.ts +1 -1
  401. package/dist/with-party/team/magic-link-grant.d.ts +1 -1
  402. package/dist/with-party/team/recovery.d.ts +1 -1
  403. package/dist/with-party/team/roster-tag.d.ts +1 -1
  404. package/dist/with-party/team/rotate-recover.d.ts +1 -1
  405. package/dist/with-party/team/wrapped-deks.d.ts +1 -1
  406. package/dist/with-pod/index.d.ts +1 -1
  407. package/dist/with-shape/blobs/blob-compaction.d.ts +1 -1
  408. package/dist/with-shape/blobs/blob-intent.d.ts +1 -1
  409. package/dist/with-shape/blobs/blob-set.d.ts +2 -2
  410. package/dist/with-shape/blobs/legacy-sweep.d.ts +1 -1
  411. package/dist/with-shape/introspection/describe.d.ts +1 -1
  412. package/dist/with-shape/introspection/walk.d.ts +1 -1
  413. package/dist/with-shape/links/lazy-handle.d.ts +1 -1
  414. package/dist/with-shape/links/link-set.d.ts +1 -1
  415. package/dist/with-shape/manifest/derive.d.ts +1 -1
  416. package/dist/with-shape/manifest/storage.d.ts +1 -1
  417. package/dist/with-shape/persisted-schemas/register.d.ts +1 -1
  418. package/dist/with-shape/persisted-schemas/storage.d.ts +1 -1
  419. package/dist/with-shape/satellites/dead-filter.d.ts +1 -1
  420. package/dist/with-shape/satellites/declare.d.ts +1 -1
  421. package/dist/with-shape/satellites/marker.d.ts +1 -1
  422. package/dist/with-shape/satellites/post-register.d.ts +1 -1
  423. package/dist/with-sync/presence.d.ts +5 -10
  424. package/dist/withdraw-accessible-HL7GACUE.js +27 -0
  425. package/dist/withdraw-accessible-HL7GACUE.js.map +1 -0
  426. package/package.json +14 -5
  427. package/dist/api-GVYEKSJE.js +0 -19
  428. package/dist/backup-7TFRVFLH.js.map +0 -1
  429. package/dist/chunk-244VXYPG.js.map +0 -1
  430. package/dist/chunk-3ELRMVJK.js.map +0 -1
  431. package/dist/chunk-3F7GLNAE.js.map +0 -1
  432. package/dist/chunk-3H5KLDZN.js.map +0 -1
  433. package/dist/chunk-6B3VNR4P.js.map +0 -1
  434. package/dist/chunk-6LNL42F5.js.map +0 -1
  435. package/dist/chunk-6QSQQLSE.js +0 -95
  436. package/dist/chunk-6QSQQLSE.js.map +0 -1
  437. package/dist/chunk-7VCXZDA4.js.map +0 -1
  438. package/dist/chunk-ANWPSTZU.js.map +0 -1
  439. package/dist/chunk-BP6DARYA.js.map +0 -1
  440. package/dist/chunk-CKNGS5MH.js.map +0 -1
  441. package/dist/chunk-DC5QVPV7.js.map +0 -1
  442. package/dist/chunk-DE4DH2RZ.js +0 -29
  443. package/dist/chunk-DE4DH2RZ.js.map +0 -1
  444. package/dist/chunk-DF73H4UN.js.map +0 -1
  445. package/dist/chunk-EIPVYUEP.js.map +0 -1
  446. package/dist/chunk-ENAG3IY7.js.map +0 -1
  447. package/dist/chunk-FCKWQE2H.js.map +0 -1
  448. package/dist/chunk-FQ5VRHIB.js.map +0 -1
  449. package/dist/chunk-GF5BZ7D4.js.map +0 -1
  450. package/dist/chunk-GHLTDZRS.js.map +0 -1
  451. package/dist/chunk-GYGLAVCX.js.map +0 -1
  452. package/dist/chunk-HBPPGWUM.js.map +0 -1
  453. package/dist/chunk-HK67PX4J.js.map +0 -1
  454. package/dist/chunk-HVSCEIYL.js.map +0 -1
  455. package/dist/chunk-ISZQJBML.js.map +0 -1
  456. package/dist/chunk-KJFW62P4.js.map +0 -1
  457. package/dist/chunk-L7DOS3TE.js.map +0 -1
  458. package/dist/chunk-LGRLME4M.js.map +0 -1
  459. package/dist/chunk-LP7BEXCT.js +0 -32
  460. package/dist/chunk-LP7BEXCT.js.map +0 -1
  461. package/dist/chunk-LQ4ZHOKP.js.map +0 -1
  462. package/dist/chunk-M522UYZ2.js.map +0 -1
  463. package/dist/chunk-M7NI3IWE.js.map +0 -1
  464. package/dist/chunk-MTL7MXGR.js.map +0 -1
  465. package/dist/chunk-N5DNADLQ.js.map +0 -1
  466. package/dist/chunk-NNARWO72.js.map +0 -1
  467. package/dist/chunk-NRT6QZQB.js.map +0 -1
  468. package/dist/chunk-NWHBJQAL.js.map +0 -1
  469. package/dist/chunk-ODVPTDPK.js.map +0 -1
  470. package/dist/chunk-PDCG6PR5.js.map +0 -1
  471. package/dist/chunk-PEOZ34EM.js.map +0 -1
  472. package/dist/chunk-PSIV7CJV.js.map +0 -1
  473. package/dist/chunk-QOOUUR4A.js.map +0 -1
  474. package/dist/chunk-QWFHIOD2.js.map +0 -1
  475. package/dist/chunk-QWGU66MP.js.map +0 -1
  476. package/dist/chunk-S57HTZ6X.js.map +0 -1
  477. package/dist/chunk-SEE332EV.js +0 -66
  478. package/dist/chunk-SEE332EV.js.map +0 -1
  479. package/dist/chunk-SYVZW77S.js.map +0 -1
  480. package/dist/chunk-T2LBQ5DV.js.map +0 -1
  481. package/dist/chunk-UD5EVGZ7.js.map +0 -1
  482. package/dist/chunk-UPD5NWI5.js.map +0 -1
  483. package/dist/chunk-UYB234ZR.js +0 -479
  484. package/dist/chunk-UYB234ZR.js.map +0 -1
  485. package/dist/chunk-VNPEWFPD.js.map +0 -1
  486. package/dist/chunk-WX5ADGTZ.js.map +0 -1
  487. package/dist/chunk-X4773RBR.js.map +0 -1
  488. package/dist/chunk-YNIUIERI.js.map +0 -1
  489. package/dist/chunk-ZE4CHIED.js.map +0 -1
  490. package/dist/chunk-ZXABPVM6.js.map +0 -1
  491. package/dist/classified-marker-W3USLL5M.js.map +0 -1
  492. package/dist/collection-facade-QU6IJBN3.js +0 -48
  493. package/dist/dead-filter-U2UYKSZL.js.map +0 -1
  494. package/dist/delegation-S3AEPW2T.js.map +0 -1
  495. package/dist/derive-OX7F6TGG.js +0 -21
  496. package/dist/dispatch-RH4LHKBH.js.map +0 -1
  497. package/dist/executor-B6SRO2QS.js +0 -36
  498. package/dist/executor-BI5CHWRY.js +0 -8
  499. package/dist/executor-RBKM5W5K.js +0 -8
  500. package/dist/export-accessible-VMA3YM5V.js +0 -22
  501. package/dist/extract-partition-NF7PXGPP.js +0 -37
  502. package/dist/fanout-sidecar-OT6RYLOL.js.map +0 -1
  503. package/dist/find-LZMP26KF.js +0 -10
  504. package/dist/issue-IHARXWW5.js +0 -18
  505. package/dist/kernel/enclave/classify/compare.d.ts +0 -10
  506. package/dist/kernel/enclave/index.d.ts +0 -87
  507. package/dist/kernel/enclave/record-keys/lifecycle.d.ts +0 -124
  508. package/dist/kernel/enclave/record-keys/rekey-blob.d.ts +0 -88
  509. package/dist/kernel/enclave/record-keys/rekey.d.ts +0 -91
  510. package/dist/kernel/enclave/record-keys/sealed-slot.d.ts +0 -14
  511. package/dist/kernel/enclave/record-keys/sealed-slots.d.ts +0 -123
  512. package/dist/kernel/enclave/record-keys/sealing.d.ts +0 -70
  513. package/dist/liberate-GRLCZMW4.js +0 -24
  514. package/dist/link-set-JCMJ7ULP.js +0 -30
  515. package/dist/noydb-SWQJ3MZS.js +0 -97
  516. package/dist/pod-handle-WGDFB4C2.js.map +0 -1
  517. package/dist/post-register-SLSXIPBV.js.map +0 -1
  518. package/dist/register-F3OYE7MJ.js +0 -31
  519. package/dist/registry-CILQFXFK.js +0 -8
  520. package/dist/registry-XNNYQVKV.js +0 -8
  521. package/dist/registry-YCDZV3VW.js +0 -35
  522. package/dist/registry-ZGYS33TE.js +0 -24
  523. package/dist/request-withdrawal-Z5NC6TXT.js +0 -30
  524. package/dist/reveal-4BCKPEC2.js.map +0 -1
  525. package/dist/revoke-ZL62WC2D.js +0 -23
  526. package/dist/seed-4JS2RJ4A.js.map +0 -1
  527. package/dist/signer-MBZZMXTC.js +0 -24
  528. package/dist/stale-TJ3DYZMQ.js +0 -29
  529. package/dist/storage-SVMKRGCW.js +0 -22
  530. package/dist/store-coordination-provider-2O2VUHKW.js.map +0 -1
  531. package/dist/verify-RVT67IMH.js.map +0 -1
  532. package/dist/walk-HJ42EISE.js +0 -21
  533. package/dist/withdraw-accessible-5NZUPAVA.js +0 -27
  534. /package/dist/{api-GVYEKSJE.js.map → api-OS747DS4.js.map} +0 -0
  535. /package/dist/{computed-TPFBX7U4.js.map → capsule/contract.js.map} +0 -0
  536. /package/dist/{kernel/enclave → capsule/enclave-aes}/broker/proof.d.ts +0 -0
  537. /package/dist/{kernel/enclave → capsule/enclave-aes}/classify/bidx.d.ts +0 -0
  538. /package/dist/{kernel/enclave → capsule/enclave-aes}/classify/digest.d.ts +0 -0
  539. /package/dist/{kernel/enclave → capsule/enclave-aes}/classify/vdig.d.ts +0 -0
  540. /package/dist/{kernel/enclave/classify → capsule/plumbing}/kofn.d.ts +0 -0
  541. /package/dist/{kernel/enclave/classify → capsule/plumbing}/normalize.d.ts +0 -0
  542. /package/dist/{kernel/enclave → capsule/plumbing}/record-aad.d.ts +0 -0
  543. /package/dist/{collection-facade-QU6IJBN3.js.map → capsule-VOLX3QRQ.js.map} +0 -0
  544. /package/dist/{chunk-YSK2CU2Q.js.map → chunk-2AFX33YA.js.map} +0 -0
  545. /package/dist/{chunk-TKUOEU2F.js.map → chunk-2GHDLTPE.js.map} +0 -0
  546. /package/dist/{chunk-6OWXYZK2.js.map → chunk-2ODVB6LZ.js.map} +0 -0
  547. /package/dist/{chunk-X25NWUZB.js.map → chunk-2PVXF5CS.js.map} +0 -0
  548. /package/dist/{chunk-ORDURZBU.js.map → chunk-3EWS67C7.js.map} +0 -0
  549. /package/dist/{chunk-FXQBGFOX.js.map → chunk-4CIQDWRB.js.map} +0 -0
  550. /package/dist/{chunk-HT2AHGQI.js.map → chunk-4JPMZTJY.js.map} +0 -0
  551. /package/dist/{chunk-MKXXMNJH.js.map → chunk-4V3Q35WG.js.map} +0 -0
  552. /package/dist/{chunk-A6IJU4TK.js.map → chunk-52MGURXO.js.map} +0 -0
  553. /package/dist/{chunk-HLEK5VAN.js.map → chunk-5WWDGFOS.js.map} +0 -0
  554. /package/dist/{chunk-SOIQ4MM4.js.map → chunk-7XMHMVTS.js.map} +0 -0
  555. /package/dist/{chunk-4MXI3ODD.js.map → chunk-AEQGFRU4.js.map} +0 -0
  556. /package/dist/{chunk-7JE7BDYJ.js.map → chunk-AL6ML4LA.js.map} +0 -0
  557. /package/dist/{chunk-ZUVBC32X.js.map → chunk-AUKKUPVB.js.map} +0 -0
  558. /package/dist/{chunk-WY2XXTET.js.map → chunk-BPWYQ25R.js.map} +0 -0
  559. /package/dist/{chunk-EOVMT6TB.js.map → chunk-BVCUTXE3.js.map} +0 -0
  560. /package/dist/{chunk-3JWHAR6E.js.map → chunk-DIZLQVAA.js.map} +0 -0
  561. /package/dist/{chunk-IT22PWKV.js.map → chunk-E2N2T5ZO.js.map} +0 -0
  562. /package/dist/{chunk-WNJ4AVGE.js.map → chunk-EJLV62NI.js.map} +0 -0
  563. /package/dist/{chunk-QBBUZ3I3.js.map → chunk-EYG2CY2X.js.map} +0 -0
  564. /package/dist/{chunk-BJ2IXQ5Q.js.map → chunk-FFJFE4T7.js.map} +0 -0
  565. /package/dist/{chunk-JCN44NCY.js.map → chunk-FLPCETP6.js.map} +0 -0
  566. /package/dist/{chunk-5O7D6ZTW.js.map → chunk-FOEDQATO.js.map} +0 -0
  567. /package/dist/{chunk-VNNRUGMM.js.map → chunk-FVH5QYY2.js.map} +0 -0
  568. /package/dist/{chunk-4AF3TUMP.js.map → chunk-GZT3NQRA.js.map} +0 -0
  569. /package/dist/{chunk-MVZ2TPVP.js.map → chunk-H427H63K.js.map} +0 -0
  570. /package/dist/{chunk-MLPHLJIQ.js.map → chunk-HS554XAF.js.map} +0 -0
  571. /package/dist/{chunk-TROR3ALR.js.map → chunk-JOSPH3E5.js.map} +0 -0
  572. /package/dist/{chunk-F24ZZTHQ.js.map → chunk-JQYKPKG6.js.map} +0 -0
  573. /package/dist/{chunk-MDWKM2XC.js.map → chunk-M5B2W6YY.js.map} +0 -0
  574. /package/dist/{chunk-F2TDU7MQ.js.map → chunk-MBMTND6D.js.map} +0 -0
  575. /package/dist/{chunk-K6W7BVZ6.js.map → chunk-MILI22XQ.js.map} +0 -0
  576. /package/dist/{chunk-CF5UU4S7.js.map → chunk-N7UDP5VU.js.map} +0 -0
  577. /package/dist/{chunk-FQ54DWUQ.js.map → chunk-NBQ3KK6X.js.map} +0 -0
  578. /package/dist/{chunk-4I522ERM.js.map → chunk-NCO25JZO.js.map} +0 -0
  579. /package/dist/{chunk-SI3V7D4G.js.map → chunk-O2IMQSNA.js.map} +0 -0
  580. /package/dist/{chunk-T52GX4SA.js.map → chunk-O46CHQT7.js.map} +0 -0
  581. /package/dist/{chunk-TOPYQ6GA.js.map → chunk-OYW3I5M4.js.map} +0 -0
  582. /package/dist/{chunk-AOWGXU6D.js.map → chunk-Q4UHJ5SN.js.map} +0 -0
  583. /package/dist/{chunk-FW22ZCXT.js.map → chunk-QBLT6POL.js.map} +0 -0
  584. /package/dist/{chunk-I3JDRCMW.js.map → chunk-RB4DOPGZ.js.map} +0 -0
  585. /package/dist/{chunk-32YV3TJT.js.map → chunk-SMV2HRDU.js.map} +0 -0
  586. /package/dist/{chunk-Z5HTYMMQ.js.map → chunk-SYNY3VB5.js.map} +0 -0
  587. /package/dist/{chunk-ZSX4S5XB.js.map → chunk-TKVUE4JF.js.map} +0 -0
  588. /package/dist/{chunk-B57AFBY2.js.map → chunk-TZZBXPZK.js.map} +0 -0
  589. /package/dist/{chunk-5FDLC6G7.js.map → chunk-UA372JHH.js.map} +0 -0
  590. /package/dist/{chunk-B6SJIBQK.js.map → chunk-V3RWOOSO.js.map} +0 -0
  591. /package/dist/{chunk-HBRLNOHL.js.map → chunk-V7ADQF5O.js.map} +0 -0
  592. /package/dist/{chunk-F7XGHL5O.js.map → chunk-VQDZYB2B.js.map} +0 -0
  593. /package/dist/{chunk-BK2HHQGN.js.map → chunk-VVOLDVIR.js.map} +0 -0
  594. /package/dist/{chunk-6K7DPM7D.js.map → chunk-XQRFSKYM.js.map} +0 -0
  595. /package/dist/{chunk-ID6Z6E66.js.map → chunk-Y2RKVFKR.js.map} +0 -0
  596. /package/dist/{chunk-FN5EBVTQ.js.map → chunk-YRXFFWG4.js.map} +0 -0
  597. /package/dist/{derive-OX7F6TGG.js.map → collection-facade-CS7CA2XO.js.map} +0 -0
  598. /package/dist/{enclave-27SMF6GF.js.map → computed-FAD7SED4.js.map} +0 -0
  599. /package/dist/{executor-B6SRO2QS.js.map → derive-XLOJVXPU.js.map} +0 -0
  600. /package/dist/{dispatch-3CQDJV5Q.js.map → dispatch-H4HV32AM.js.map} +0 -0
  601. /package/dist/{executor-BI5CHWRY.js.map → executor-FMPVN6DT.js.map} +0 -0
  602. /package/dist/{executor-RBKM5W5K.js.map → executor-LBBBRTN5.js.map} +0 -0
  603. /package/dist/{export-accessible-VMA3YM5V.js.map → executor-OSRZST2U.js.map} +0 -0
  604. /package/dist/{extract-partition-NF7PXGPP.js.map → export-accessible-RAOJAAU5.js.map} +0 -0
  605. /package/dist/{find-LZMP26KF.js.map → extract-partition-JD5CUSTG.js.map} +0 -0
  606. /package/dist/{issue-IHARXWW5.js.map → find-JRN4RNQ5.js.map} +0 -0
  607. /package/dist/{ledger-KZPCMVZY.js.map → issue-YIVBZUTH.js.map} +0 -0
  608. /package/dist/{liberate-GRLCZMW4.js.map → ledger-5ZMGE44K.js.map} +0 -0
  609. /package/dist/{link-set-JCMJ7ULP.js.map → liberate-WZSZM2W6.js.map} +0 -0
  610. /package/dist/{managed-secret-S3MQ6SH6.js.map → link-set-MFXC24VK.js.map} +0 -0
  611. /package/dist/{noydb-SWQJ3MZS.js.map → managed-secret-MFTFT22X.js.map} +0 -0
  612. /package/dist/{migrate-cek-V7GKJZ7O.js.map → migrate-cek-DZRFFOHW.js.map} +0 -0
  613. /package/dist/{register-F3OYE7MJ.js.map → noydb-ITIGNKUF.js.map} +0 -0
  614. /package/dist/{registry-CILQFXFK.js.map → register-DT5HZ2LZ.js.map} +0 -0
  615. /package/dist/{registry-XNNYQVKV.js.map → registry-BHRZGZHF.js.map} +0 -0
  616. /package/dist/{registry-YCDZV3VW.js.map → registry-ET6ZFFWA.js.map} +0 -0
  617. /package/dist/{registry-ZGYS33TE.js.map → registry-HXFGLGTG.js.map} +0 -0
  618. /package/dist/{request-withdrawal-Z5NC6TXT.js.map → registry-THCPDEOD.js.map} +0 -0
  619. /package/dist/{revoke-ZL62WC2D.js.map → request-withdrawal-AV2MJJKY.js.map} +0 -0
  620. /package/dist/{signer-MBZZMXTC.js.map → revoke-6DWIEOCV.js.map} +0 -0
  621. /package/dist/{stale-TJ3DYZMQ.js.map → signer-MHGW3OIL.js.map} +0 -0
  622. /package/dist/{storage-SVMKRGCW.js.map → stale-6GCFMOOR.js.map} +0 -0
  623. /package/dist/{walk-HJ42EISE.js.map → storage-BYN5LO6Z.js.map} +0 -0
  624. /package/dist/{withdraw-accessible-5NZUPAVA.js.map → walk-4VPK7AS4.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/with-formula/derivations/dispatch.ts"],"sourcesContent":["/**\n * Derivation dispatch, lifted out of the kernel spine (#842 part b).\n *\n * `Collection` carried ~380 lines of dispatch logic that belongs to the\n * derivation service, not to the always-on kernel. These are free functions\n * taking an explicit context so the spine keeps only a thin delegator.\n *\n * ## How the spine reaches this module\n *\n * By dynamic `import()`, never a static one. `check-architecture.mjs`'s\n * `port-layering` check forbids the spine from statically importing a\n * `with-*` service; `collection.ts` is grandfathered for ten\n * `with-formula/*` specifiers, but that list is frozen per file and a new\n * one is a violation. A dynamic import is the sanctioned S4 gate recipe, and\n * it keeps this chunk out of the floor bundle for consumers who never fire a\n * derivation.\n *\n * The `Collection` type reference below points back at the spine. That is\n * inward (service → kernel) and so allowed, and it is TYPE-ONLY — erased at\n * build, so no runtime cycle exists.\n *\n * @internal\n */\n\nimport type { NoydbStore } from '../../kernel/types.js'\nimport type { TxContext } from '../../with-commit/tx/transaction.js'\nimport type { DerivationRegistry } from './registry.js'\nimport type { ReadOnlyVaultFacade } from '../../with-audit/guards/types.js'\nimport type { Collection } from '../../kernel/collection.js'\nimport type { EnclaveKey } from '../../kernel/enclave/index.js'\nimport type { EncryptedEnvelope } from '../../kernel/types.js'\nimport type { ledgerAuditHook, WaveContext } from '../../kernel/via/dispatch.js'\nimport { putDerivedOutput, selfWriteFieldEqual } from '../../kernel/via/dispatch.js'\nimport { DerivationCapExceededError } from '../../kernel/errors.js'\nimport { sameTuple, resolveTuple, tupleFromIntermediate, hopCollections } from './trigger-match.js'\nimport { markStale } from './stale.js'\nimport type { DerivationExecutor } from './executor.js'\n\n/** The per-write dispatch context threaded into `putDerivedOutput`. */\ninterface DispatchCtx {\n emit: (e: string, p: unknown) => void\n source: { readonly collection: string; readonly id: string }\n audit: ReturnType<typeof ledgerAuditHook>\n}\n\n/**\n * What the dispatchers need from the collection that owns them. Passing this\n * explicitly is what lets the logic live outside the class.\n */\nexport interface DerivationDeleteCtx {\n readonly derivationSource: {\n registry(): DerivationRegistry\n getCollection(name: string): Collection<Record<string, unknown>>\n getActiveTxContext(): TxContext | null\n getReadOnlyFacade(): ReadOnlyVaultFacade\n }\n /** The collection the delete happened in. */\n readonly collectionName: string\n readonly adapter: NoydbStore\n readonly vault: string\n readonly getDEK: (collectionName: string) => Promise<EnclaveKey>\n readonly storeCiphertext: boolean\n}\n\n/**\n * Erase the derived rows a deleted source record fanned out to, and drop the\n * fan-out sidecars that recorded them.\n *\n * @param eraseRecordShapeToo also erase same-id `shape: 'record'` outputs.\n * Restricted to a source-triggered strategy writing into a DIFFERENT\n * collection — the self-denorm case would re-delete the record just\n * tombstoned, and triggerBy/sibling strategies derive under a different id.\n * @returns rows ACTUALLY deleted, not edges visited (#622).\n */\nexport async function dispatchArrayDerivationsOnDelete(\n ctx: DerivationDeleteCtx,\n id: string,\n eraseRecordShapeToo = false,\n): Promise<number> {\n const { derivationSource, collectionName, adapter, vault, getDEK, storeCiphertext } = ctx\n\n const strategies = derivationSource.registry().strategiesForSource(collectionName)\n if (strategies.length === 0) return 0\n\n const { loadFanoutSidecar, deleteFanoutSidecar } = await import('./fanout-sidecar.js')\n const txCtx = derivationSource.getActiveTxContext()\n let erased = 0\n\n for (const { spec } of strategies) {\n for (const [outputKey, outSpec] of Object.entries(spec.outputs)) {\n if (outSpec.shape === 'record') {\n if (eraseRecordShapeToo && spec.source === collectionName && outSpec.collection !== collectionName) {\n if (await derivationSource.getCollection(outSpec.collection)._internalDelete(id, txCtx)) erased += 1\n }\n continue\n }\n\n const sidecar = await loadFanoutSidecar(adapter, vault, spec.source, id, outputKey, getDEK, storeCiphertext)\n if (!sidecar) continue\n\n const outputCollection = derivationSource.getCollection(outSpec.collection)\n for (const derivedId of sidecar.keys) {\n if (await outputCollection._internalDelete(derivedId, txCtx)) erased += 1\n }\n await deleteFanoutSidecar(adapter, vault, spec.source, id, outputKey)\n }\n }\n\n return erased\n}\n\n/** Adds what the on-write derivation dispatch needs beyond the delete path. */\nexport interface DerivationDispatchCtx extends DerivationDeleteCtx {\n /** Via pipeline, for decoding the stored form back to canonical money shape. */\n readonly via: { canonicalizeStored(r: Record<string, unknown>): Record<string, unknown> } | undefined\n /** Recompute a rollup aggregate onto a parent. Stays on the spine — it walks collections. */\n readonly recomputeRollup: (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n spec: any,\n parentId: string,\n source: { readonly collection: string; readonly id: string },\n wave?: WaveContext,\n ) => Promise<unknown>\n /** Builds the per-write dispatch context threaded into `putDerivedOutput`. */\n readonly dispatchCtx: (source: { readonly collection: string; readonly id: string }) => DispatchCtx\n /** Registers a write on the active transaction for rollback. */\n readonly trackPut: (txCtx: TxContext, collectionName: string, id: string, priorEnvelope: EncryptedEnvelope | null) => void\n}\n\n/**\n * Fire registered derivation strategies for this source collection.\n *\n * Eager mode runs `derive` inline and writes each output; lazy mode records a\n * stale mark for cold-session recompute. Rollups are handled here rather than\n * by the executor — a write to the child recomputes the parent aggregate, and\n * a write to the parent recomputes its own.\n */\nexport async function dispatchDerivations(\n ctx: DerivationDispatchCtx,\n id: string,\n record: Record<string, unknown>,\n version: number,\n wave?: WaveContext,\n /** The pre-write record at `id` in THIS collection (undefined = not\n * captured — no field-match trigger, or a sync-applied wave; null =\n * captured and absent, i.e. a create). Only a `Record` re-fires the OLD\n * matched set alongside the new one (spec §7). */\n prior?: Record<string, unknown> | null,\n): Promise<void> {\n const { derivationSource, collectionName, via, recomputeRollup } = ctx\n\n // `record` is the stored form here (post-quantize) — decode so\n // derive(source, ctx) sees the canonical money shape.\n const incoming = (via ? via.canonicalizeStored(record) : record)\n if (incoming && typeof incoming === 'object' && '_derivedFrom' in incoming) return\n // `prior` is the raw stored pre-write record — canonicalize it the same\n // way as `incoming` before it feeds `resolveTuple` below, or a\n // via-shaped match field (e.g. a money field) compares canonical against\n // raw and never matches the old tuple (Min 5).\n const canonicalPrior = prior != null ? (via ? via.canonicalizeStored(prior) : prior) : prior\n const registry = derivationSource.registry()\n const strategies = registry.strategiesForSource(collectionName)\n if (strategies.length === 0) return\n // Dynamic-import the executor only on the first eager-mode\n // dispatch. Lazy-mode dispatches use `markStale` (a pure helper)\n // which doesn't reach into the executor at all. Keeps the\n // derivation executor chunk out of the floor bundle for any\n // consumer that doesn't fire an eager derivation.\n let executorClass: typeof DerivationExecutor | null = null\n for (const { spec, strategyHash, triggers } of strategies) {\n const mode = typeof spec.lifecycle === 'string' ? spec.lifecycle : spec.lifecycle.mode\n\n // Rollup: a write to the child `from` recomputes the\n // parent at id child[key]; a write to the parent (source = into)\n // recomputes its own aggregate. Handled here (the executor is not run).\n if (spec.rollup) {\n if (mode !== 'eager') continue\n const asParentId = (v: unknown): string | null =>\n (typeof v === 'string' || typeof v === 'number') ? String(v) : null\n let parentId: string | null\n // #1257 — a child that RE-PARENTS strands the old parent's aggregate\n // unless the old key is recomputed too. Reads the prior stored record\n // (canonicalized alongside `incoming`, so a via-shaped key compares like\n // for like). `undefined` prior — a sync-applied wave write or a tiers\n // restore, which do not thread it — degrades to new-parent-only, the\n // pre-#1257 behaviour, rather than guessing.\n let oldParentId: string | null = null\n if (collectionName === spec.rollup.from) {\n parentId = asParentId(incoming[spec.rollup.key])\n const priorKey = canonicalPrior != null ? asParentId(canonicalPrior[spec.rollup.key]) : null\n if (priorKey !== null && priorKey !== parentId) oldParentId = priorKey\n } else {\n parentId = id // a write to the parent recomputes its own aggregate\n }\n if (parentId !== null) await recomputeRollup(spec, parentId, { collection: collectionName, id }, wave)\n // The old parent is recomputed AFTER the new one so a `maxFanout`-style\n // failure on the new parent surfaces before extra work is spent.\n if (oldParentId !== null) await recomputeRollup(spec, oldParentId, { collection: collectionName, id }, wave)\n continue\n }\n\n // Determine how `collectionName` triggers this strategy, and build the list\n // of source records to (re-)derive:\n // • source — re-derive the written record itself (same-id).\n // • sources[] — re-derive the PRIMARY source at the same id.\n // • triggerBy — FK fan-out: re-derive every source record\n // whose `on` field equals the written parent's id.\n // `input` is passed to derive(); `base` is the raw stored source record\n // used as the patch base for a self-write reverse-denorm output.\n const isSource = spec.source === collectionName\n const isSibling = !isSource && (spec.sources?.includes(collectionName) ?? false)\n const triggerEntries = !isSource && !isSibling\n ? triggers.filter((t) => t.collection === collectionName)\n : []\n // #1277 option 2 — a write to an INTERMEDIATE collection fires the trigger\n // too. Without this, re-pointing the intermediate strands every source it\n // used to address: nothing is written to the trigger or source collection,\n // so no other path can notice. Kept separate from `triggerEntries` because\n // the tuple is derived differently (the intermediate IS the written record,\n // so no lookup is needed).\n const hopEntries = !isSource && !isSibling\n ? triggers.filter((t) => hopCollections(t.match).includes(collectionName))\n : []\n\n const runs: Array<{\n input: Record<string, unknown> & { id: string }\n base: Record<string, unknown>\n runId: string\n version: number\n }> = []\n\n if (isSource) {\n runs.push({ input: { ...incoming, id }, base: incoming, runId: id, version })\n } else if (isSibling) {\n const p = await derivationSource.getCollection(spec.source).get(id)\n if (p !== null && p !== undefined) {\n // Raw base for a (rare) sibling self-write; falls back to the\n // resolved primary if the raw read misses.\n const raw = await derivationSource.getCollection(spec.source)._getStoredRecord(id)\n runs.push({ input: { ...p, id }, base: raw ?? p, runId: id, version: 0 })\n }\n } else if (triggerEntries.length > 0 || hopEntries.length > 0) {\n const srcColl = derivationSource.getCollection(spec.source)\n const matched = new Set<string>()\n // One lookup per hop per written record — `take: 'id'` is a direct get,\n // anything else is a single field match on the intermediate. Never per\n // candidate row (#1266's bound).\n const lookup = async (coll: string, field: string, value: string): Promise<Record<string, unknown> | null> => {\n const c = derivationSource.getCollection(coll)\n if (field === 'id') return c._getStoredRecord(value)\n const ids = await c._findMatchingCompositeIds([{ field, value }])\n const first = ids[0]\n return first === undefined ? null : c._getStoredRecord(first)\n }\n // A write to an intermediate collection: fan out on its old ∪ new value.\n // The prior record is the intermediate's own, so #1249's capture already\n // supplies it — the same mechanism, pointed at a third collection.\n for (const trigger of hopEntries) {\n const tuples = [tupleFromIntermediate(trigger.match, collectionName, incoming)]\n if (canonicalPrior != null) {\n const old = tupleFromIntermediate(trigger.match, collectionName, canonicalPrior)\n if (!sameTuple(old, tuples[0]!)) tuples.push(old)\n }\n const ids = new Set<string>()\n for (const tuple of tuples) {\n if (tuple === null) continue\n for (const sid of await srcColl._findMatchingCompositeIds(tuple)) ids.add(sid)\n }\n if (trigger.maxFanout !== undefined && ids.size > trigger.maxFanout) {\n throw new DerivationCapExceededError(\n `triggerBy hop ${collectionName}→${spec.source} [${trigger.match.map(p => p.to).join(',')}]`,\n ids.size, trigger.maxFanout)\n }\n for (const sid of ids) matched.add(sid)\n }\n for (const trigger of triggerEntries) {\n // Union fan-out (spec §7): an update changing any matched component\n // must re-fire BOTH the old and the new matched set, or the old\n // set's derived output goes stale (never re-derived once it no\n // longer matches). `prior` is only ever a `Record` here — a wave\n // dispatch and a create both skip the old tuple outright.\n const tuples = [await resolveTuple(trigger.match, id, incoming, lookup)]\n if (canonicalPrior != null && trigger.match.some((p) => p.from !== 'id')) {\n const old = await resolveTuple(trigger.match, id, canonicalPrior, lookup)\n if (!sameTuple(old, tuples[0]!)) tuples.push(old)\n }\n const ids = new Set<string>()\n for (const tuple of tuples) {\n if (tuple === null) continue // a from-value is absent/non-scalar: matches nothing\n for (const sid of await srcColl._findMatchingCompositeIds(tuple)) ids.add(sid)\n }\n if (trigger.maxFanout !== undefined && ids.size > trigger.maxFanout) {\n throw new DerivationCapExceededError(\n `triggerBy ${collectionName}→${spec.source} [${trigger.match.map(p => p.to).join(',')}]`,\n ids.size, trigger.maxFanout)\n }\n for (const sid of ids) matched.add(sid)\n }\n for (const sid of matched) {\n const raw = await srcColl._getStoredRecord(sid)\n if (raw === null) continue\n runs.push({ input: { ...raw, id: sid }, base: raw, runId: sid, version: 0 })\n }\n }\n\n if (runs.length === 0) continue\n\n if (mode !== 'eager') {\n for (const run of runs) await markStale(registry, spec, run.runId)\n continue\n }\n\n if (executorClass === null) {\n ;({ DerivationExecutor: executorClass } = await import('./executor.js'))\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n for (const run of runs) await runOne(ctx, spec as any, strategyHash, executorClass, run)\n }\n}\n\n/**\n * Run the executor for one (spec, run) pair and write its outputs. Shared by\n * `dispatchDerivations`' eager loop and `dispatchTriggerDerivationsOnDelete`\n * (#1249) — the write-out logic (array diff, record self-write reverse-denorm,\n * normal record output) is identical for a live write and a delete-triggered\n * re-derive; only how `runs` gets built differs.\n */\nasync function runOne(\n ctx: DerivationDispatchCtx,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n spec: any,\n strategyHash: string,\n executorClass: typeof DerivationExecutor,\n run: { input: Record<string, unknown> & { id: string }; base: Record<string, unknown>; runId: string; version: number },\n): Promise<void> {\n const { derivationSource, adapter, vault, getDEK, storeCiphertext, dispatchCtx, trackPut } = ctx\n const execCtx = { vault: derivationSource.getReadOnlyFacade() }\n const outCtx = dispatchCtx({ collection: spec.source, id: run.runId })\n const result = await executorClass.run(spec, run.input, run.version, strategyHash, execCtx)\n for (const key of Object.keys(spec.outputs)) {\n const out = result.outputs[key]\n if (!out) continue\n if (out.kind === 'failed') {\n const err = out.error\n if (spec.strict) throw err\n console.warn(`[derivation] output \"${key}\" for source \"${spec.source}\" id=\"${run.runId}\" failed:`, err)\n continue\n }\n const outSpec = spec.outputs[key]\n if (!outSpec) continue\n const outputCollection = derivationSource.getCollection(outSpec.collection)\n // If we're inside a multi-record transaction, register\n // derived writes as side-effect ops on the active ctx\n // BEFORE they fire. `revertExecuted` walks `_executed` in\n // reverse on rollback, so capturing the pre-write envelope\n // here lets a later mid-batch failure restore this output's\n // prior state alongside the source op. Outside a transaction\n // the context is null and tracking is skipped.\n const txCtx = derivationSource.getActiveTxContext()\n\n // ── Array-shape branch ─────────────────────────────────\n if (out.kind === 'array') {\n // Load the prior key set from the fanout sidecar.\n const { loadFanoutSidecar, saveFanoutSidecar } = await import('./fanout-sidecar.js')\n const prior = await loadFanoutSidecar(adapter, vault, spec.source, run.runId, key, getDEK, storeCiphertext)\n const prevKeys = new Set<string>(prior?.keys ?? [])\n const newKeysList = out.entries.map((e: { key: string }) => e.key)\n const newKeysSet = new Set<string>(newKeysList)\n\n // Diff — delete keys that were in prev but not in new.\n for (const k of prevKeys) {\n if (newKeysSet.has(k)) continue\n await outputCollection._internalDelete(k, txCtx)\n }\n\n // Upsert every entry in the new set. (Slice 1: no\n // identity-skip optimisation; write every row, idempotent\n // at the (collection, id) level.)\n for (const entry of out.entries) {\n if (txCtx !== null) {\n trackPut(txCtx, outSpec.collection, entry.key, await adapter.get(vault, outSpec.collection, entry.key))\n }\n await putDerivedOutput(outputCollection, entry.key, entry.value, outCtx, { source: 'derived' })\n }\n\n // Persist the new key set last, for failure-mode symmetry.\n await saveFanoutSidecar(adapter, vault, {\n source: spec.source,\n sourceId: run.runId,\n outputKey: key,\n outputCollection: outSpec.collection,\n keys: newKeysList,\n }, getDEK, storeCiphertext)\n continue\n }\n\n // ── Record-shape branch ────────────────────────────────\n if (out.skipped === true) {\n // Optional output returned null. Delete the\n // previously-emitted output at this id, if any. Routed\n // through `_internalDelete` so a user-registered\n // `onDelete` on the output collection does NOT\n // fire — this is a system-internal tombstone, not a\n // user-initiated delete. The txCtx hookup captures the\n // prior envelope inside `_internalDelete` for rollback\n // symmetry; delete-of-absent is a silent no-op.\n await outputCollection._internalDelete(run.runId, txCtx)\n continue\n }\n\n // ── Self-write reverse-denorm ───────────────────────────\n // An output back to its own source: patch ONLY the declared\n // `denorm` fields onto the raw stored record, never the whole\n // value (which would clobber user fields / i18n maps and carries\n // the executor's `_derivedFrom` tag). If the patch changes\n // nothing, skip the write — that value-equality is the cycle\n // guard: the self-write re-fires the source-path derivation,\n // which recomputes identical fields and terminates here.\n if (outSpec.shape === 'record' && outSpec.denorm !== undefined && outSpec.collection === spec.source) {\n const value = out.value\n const patched: Record<string, unknown> = { ...run.base }\n let changed = false\n for (const f of outSpec.denorm) {\n if (!selfWriteFieldEqual(run.base[f], value[f])) {\n patched[f] = value[f]\n changed = true\n }\n }\n if (!changed) continue // cycle guard — nothing to write\n if (txCtx !== null) {\n trackPut(txCtx, outSpec.collection, run.runId, await adapter.get(vault, outSpec.collection, run.runId))\n }\n await putDerivedOutput(outputCollection, run.runId, patched, outCtx, { source: 'derived' })\n continue\n }\n\n // ── Normal record output (separate output collection) ──\n if (txCtx !== null) {\n trackPut(txCtx, outSpec.collection, run.runId, await adapter.get(vault, outSpec.collection, run.runId))\n }\n await putDerivedOutput(outputCollection, run.runId, out.value, outCtx, { source: 'derived' })\n }\n}\n\n/**\n * Trigger fan-out for a DELETED parent record (#1249, spec §8). Distinct from\n * the \"record-shape derivations not dispatched on delete\" rule — that is\n * about deleting a SOURCE record; this fires when a TRIGGER collection's\n * record is deleted, re-deriving source records that still exist. Pairs\n * evaluate against the tombstoned record's values; matched sources re-derive\n * through the normal executor (their derive() reads the now-absent parent\n * and decides what that means — the engine never cascades deletes).\n */\nexport async function dispatchTriggerDerivationsOnDelete(\n ctx: DerivationDispatchCtx, id: string, deleted: Record<string, unknown>,\n): Promise<void> {\n const { derivationSource, collectionName } = ctx\n const registry = derivationSource.registry()\n const strategies = registry.strategiesForSource(collectionName)\n if (strategies.length === 0) return\n let executorClass: typeof DerivationExecutor | null = null\n for (const { spec, strategyHash, triggers } of strategies) {\n if (spec.rollup) continue // rollup-on-delete already exists\n if (spec.source === collectionName) continue // source delete: existing rule, untouched\n if (spec.sources?.includes(collectionName)) continue // declared sibling source: same exclusion as the write path's isSibling check\n const entries = triggers.filter((t) => t.collection === collectionName)\n // #1294 — deleting an INTERMEDIATE strands every source it addressed, for\n // the same reason re-pointing one does: nothing is written to the trigger\n // or source collection. The write path handles this; the delete path did\n // not, which made the hop's correctness argument hold for puts only.\n const hopEntries = triggers.filter((t) => hopCollections(t.match).includes(collectionName))\n if (entries.length === 0 && hopEntries.length === 0) continue\n const mode = typeof spec.lifecycle === 'string' ? spec.lifecycle : spec.lifecycle.mode\n const srcColl = derivationSource.getCollection(spec.source)\n const matched = new Set<string>()\n const lookup = async (coll: string, field: string, value: string): Promise<Record<string, unknown> | null> => {\n const c = derivationSource.getCollection(coll)\n if (field === 'id') return c._getStoredRecord(value)\n const found = await c._findMatchingCompositeIds([{ field, value }])\n const first = found[0]\n return first === undefined ? null : c._getStoredRecord(first)\n }\n const cap = (trigger: { maxFanout?: number; match: ReadonlyArray<{ to: string }> }, n: number, label: string): void => {\n if (trigger.maxFanout !== undefined && n > trigger.maxFanout) {\n throw new DerivationCapExceededError(\n `triggerBy ${label} ${collectionName}→${spec.source} [${trigger.match.map(p => p.to).join(',')}] (delete)`,\n n, trigger.maxFanout)\n }\n }\n for (const trigger of entries) {\n // #1294 — resolve the hop here too. The old sync builder compared the raw\n // `from` value against `source[to]`, which for a mapped pair is the\n // wrong side of the relationship: it matched nothing, silently, so a\n // delete through a hop fanned out to no one while a delete through a\n // plain pair worked.\n const tuple = await resolveTuple(trigger.match, id, deleted, lookup)\n if (tuple === null) continue\n const ids = await srcColl._findMatchingCompositeIds(tuple)\n cap(trigger, ids.length, '')\n for (const sid of ids) matched.add(sid)\n }\n for (const trigger of hopEntries) {\n const tuple = tupleFromIntermediate(trigger.match, collectionName, deleted)\n if (tuple === null) continue\n const ids = await srcColl._findMatchingCompositeIds(tuple)\n cap(trigger, ids.length, 'hop')\n for (const sid of ids) matched.add(sid)\n }\n if (matched.size === 0) continue\n if (mode !== 'eager') { for (const sid of matched) await markStale(registry, spec, sid); continue }\n if (executorClass === null) ({ DerivationExecutor: executorClass } = await import('./executor.js'))\n for (const sid of matched) {\n const raw = await srcColl._getStoredRecord(sid)\n if (raw === null) continue\n await runOne(ctx, spec, strategyHash, executorClass, { input: { ...raw, id: sid }, base: raw, runId: sid, version: 0 })\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EA,eAAsB,iCACpB,KACA,IACA,sBAAsB,OACL;AACjB,QAAM,EAAE,kBAAkB,gBAAgB,SAAS,OAAO,QAAQ,gBAAgB,IAAI;AAEtF,QAAM,aAAa,iBAAiB,SAAS,EAAE,oBAAoB,cAAc;AACjF,MAAI,WAAW,WAAW,EAAG,QAAO;AAEpC,QAAM,EAAE,mBAAmB,oBAAoB,IAAI,MAAM,OAAO,8BAAqB;AACrF,QAAM,QAAQ,iBAAiB,mBAAmB;AAClD,MAAI,SAAS;AAEb,aAAW,EAAE,KAAK,KAAK,YAAY;AACjC,eAAW,CAAC,WAAW,OAAO,KAAK,OAAO,QAAQ,KAAK,OAAO,GAAG;AAC/D,UAAI,QAAQ,UAAU,UAAU;AAC9B,YAAI,uBAAuB,KAAK,WAAW,kBAAkB,QAAQ,eAAe,gBAAgB;AAClG,cAAI,MAAM,iBAAiB,cAAc,QAAQ,UAAU,EAAE,gBAAgB,IAAI,KAAK,EAAG,WAAU;AAAA,QACrG;AACA;AAAA,MACF;AAEA,YAAM,UAAU,MAAM,kBAAkB,SAAS,OAAO,KAAK,QAAQ,IAAI,WAAW,QAAQ,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,WAAW,SAAS;AAM7B,YAAM,QAAQ,MAAM,aAAa,QAAQ,OAAO,IAAI,SAAS,MAAM;AACnE,UAAI,UAAU,KAAM;AACpB,YAAM,MAAM,MAAM,QAAQ,0BAA0B,KAAK;AACzD,UAAI,SAAS,IAAI,QAAQ,EAAE;AAC3B,iBAAW,OAAO,IAAK,SAAQ,IAAI,GAAG;AAAA,IACxC;AACA,eAAW,WAAW,YAAY;AAChC,YAAM,QAAQ,sBAAsB,QAAQ,OAAO,gBAAgB,OAAO;AAC1E,UAAI,UAAU,KAAM;AACpB,YAAM,MAAM,MAAM,QAAQ,0BAA0B,KAAK;AACzD,UAAI,SAAS,IAAI,QAAQ,KAAK;AAC9B,iBAAW,OAAO,IAAK,SAAQ,IAAI,GAAG;AAAA,IACxC;AACA,QAAI,QAAQ,SAAS,EAAG;AACxB,QAAI,SAAS,SAAS;AAAE,iBAAW,OAAO,QAAS,OAAM,UAAU,UAAU,MAAM,GAAG;AAAG;AAAA,IAAS;AAClG,QAAI,kBAAkB,KAAM,EAAC,EAAE,oBAAoB,cAAc,IAAI,MAAM,OAAO,wBAAe;AACjG,eAAW,OAAO,SAAS;AACzB,YAAM,MAAM,MAAM,QAAQ,iBAAiB,GAAG;AAC9C,UAAI,QAAQ,KAAM;AAClB,YAAM,OAAO,KAAK,MAAM,cAAc,eAAe,EAAE,OAAO,EAAE,GAAG,KAAK,IAAI,IAAI,GAAG,MAAM,KAAK,OAAO,KAAK,SAAS,EAAE,CAAC;AAAA,IACxH;AAAA,EACF;AACF;","names":[]}
@@ -1,36 +0,0 @@
1
- import {
2
- MaterializedViewExecutor
3
- } from "./chunk-QBBUZ3I3.js";
4
- import "./chunk-NWHBJQAL.js";
5
- import "./chunk-WY2XXTET.js";
6
- import "./chunk-T52GX4SA.js";
7
- import "./chunk-CF5UU4S7.js";
8
- import "./chunk-K6W7BVZ6.js";
9
- import "./chunk-FH2L2E34.js";
10
- import "./chunk-XZHEOSQ2.js";
11
- import "./chunk-F2TDU7MQ.js";
12
- import "./chunk-SUZKW6UR.js";
13
- import "./chunk-VHM7HCKB.js";
14
- import "./chunk-XBKH4FOC.js";
15
- import "./chunk-4I522ERM.js";
16
- import "./chunk-MKXXMNJH.js";
17
- import "./chunk-LGNDFRYC.js";
18
- import "./chunk-5O7D6ZTW.js";
19
- import "./chunk-HLEK5VAN.js";
20
- import "./chunk-DF73H4UN.js";
21
- import "./chunk-GHLTDZRS.js";
22
- import "./chunk-Z5HTYMMQ.js";
23
- import "./chunk-CKNGS5MH.js";
24
- import "./chunk-KJFW62P4.js";
25
- import "./chunk-SEE332EV.js";
26
- import "./chunk-6QSQQLSE.js";
27
- import "./chunk-DE4DH2RZ.js";
28
- import "./chunk-LQ4ZHOKP.js";
29
- import "./chunk-LP7BEXCT.js";
30
- import "./chunk-UYB234ZR.js";
31
- import "./chunk-ODVPTDPK.js";
32
- import "./chunk-244VXYPG.js";
33
- export {
34
- MaterializedViewExecutor
35
- };
36
- //# sourceMappingURL=executor-B6SRO2QS.js.map
@@ -1,8 +0,0 @@
1
- import {
2
- GuardExecutor
3
- } from "./chunk-FN5EBVTQ.js";
4
- import "./chunk-244VXYPG.js";
5
- export {
6
- GuardExecutor
7
- };
8
- //# sourceMappingURL=executor-BI5CHWRY.js.map
@@ -1,8 +0,0 @@
1
- import {
2
- DerivationExecutor
3
- } from "./chunk-MVZ2TPVP.js";
4
- import "./chunk-244VXYPG.js";
5
- export {
6
- DerivationExecutor
7
- };
8
- //# sourceMappingURL=executor-RBKM5W5K.js.map
@@ -1,22 +0,0 @@
1
- import {
2
- buildAccessibleBundle,
3
- exportAccessibleData,
4
- resolveAccessibleCollections
5
- } from "./chunk-WNJ4AVGE.js";
6
- import "./chunk-HBPPGWUM.js";
7
- import "./chunk-IUWCVHQ7.js";
8
- import "./chunk-KJFW62P4.js";
9
- import "./chunk-SEE332EV.js";
10
- import "./chunk-6QSQQLSE.js";
11
- import "./chunk-DE4DH2RZ.js";
12
- import "./chunk-LQ4ZHOKP.js";
13
- import "./chunk-LP7BEXCT.js";
14
- import "./chunk-UYB234ZR.js";
15
- import "./chunk-ODVPTDPK.js";
16
- import "./chunk-244VXYPG.js";
17
- export {
18
- buildAccessibleBundle,
19
- exportAccessibleData,
20
- resolveAccessibleCollections
21
- };
22
- //# sourceMappingURL=export-accessible-VMA3YM5V.js.map
@@ -1,37 +0,0 @@
1
- import {
2
- extractPartition,
3
- extractPartitionCore,
4
- reKeyBlobs,
5
- reKeyClosure,
6
- reKeyLedger,
7
- reKeySchemas,
8
- sealDeks
9
- } from "./chunk-3ELRMVJK.js";
10
- import "./chunk-HBPPGWUM.js";
11
- import "./chunk-IUWCVHQ7.js";
12
- import "./chunk-3H5KLDZN.js";
13
- import "./chunk-ANWPSTZU.js";
14
- import "./chunk-SOIQ4MM4.js";
15
- import "./chunk-4AOERLTV.js";
16
- import "./chunk-I7FD46FF.js";
17
- import "./chunk-CKNGS5MH.js";
18
- import "./chunk-JCN44NCY.js";
19
- import "./chunk-KJFW62P4.js";
20
- import "./chunk-SEE332EV.js";
21
- import "./chunk-6QSQQLSE.js";
22
- import "./chunk-DE4DH2RZ.js";
23
- import "./chunk-LQ4ZHOKP.js";
24
- import "./chunk-LP7BEXCT.js";
25
- import "./chunk-UYB234ZR.js";
26
- import "./chunk-ODVPTDPK.js";
27
- import "./chunk-244VXYPG.js";
28
- export {
29
- extractPartition,
30
- extractPartitionCore,
31
- reKeyBlobs,
32
- reKeyClosure,
33
- reKeyLedger,
34
- reKeySchemas,
35
- sealDeks
36
- };
37
- //# sourceMappingURL=extract-partition-NF7PXGPP.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/with-formula/derivations/fanout-sidecar.ts"],"sourcesContent":["/**\n * Per-source-row fanout sidecar for `shape: 'array'` derivations.\n *\n * Each `(sourceCollection, sourceId, outputKey)` triple gets its own\n * envelope at:\n *\n * _meta/derivations-fanout/<sourceCollection>/<sourceId>/<outputKey>\n *\n * The envelope records the last-emitted derived row ids so the\n * dispatcher can compute the diff on every source-row update in O(1):\n * read prior keys, compute `toDelete = prev \\ new`, write new, persist\n * back.\n *\n * The body is encrypted (AES-GCM under the `_meta` collection DEK) when\n * the vault is encrypted — the `keys[]` are derived-row ids produced by a\n * user-supplied key extractor and can be content-bearing (SKU, tag, email),\n * so a ciphertext-only store must not read them, the derivation graph, or\n * `emittedAt`. Back-compat: sidecars written before this fix are plaintext\n * (`_iv === ''`); `loadFanoutSidecar` dual-reads them.\n *\n * @module\n */\nimport type { NoydbStore, EncryptedEnvelope } from '../../kernel/types.js'\nimport { buildRecordAad, buildRecordEnvelope, encrypt, openEnvelopeJson, type EnclaveKey } from '../../kernel/enclave/index.js'\n\ntype GetDEK = (collectionName: string) => Promise<EnclaveKey>\n\n/** The `_meta` collection name whose DEK encrypts the sidecar body. */\nconst FANOUT_DEK_COLLECTION = '_meta'\n\n/** Magic-prefixed JSON payload at `_meta/<recordId>`. */\nexport interface FanoutSidecar {\n readonly _noydb_fanout: 1\n /** Source collection name. */\n readonly source: string\n /** Source record id. */\n readonly sourceId: string\n /** Strategy output key (the key in `strategy.outputs`). */\n readonly outputKey: string\n /** Output collection name (audit / forensics). */\n readonly outputCollection: string\n /** Derived-row ids last emitted for this (source, output) pair. */\n readonly keys: ReadonlyArray<string>\n /** ISO timestamp of last dispatch. */\n readonly emittedAt: string\n}\n\n/**\n * Build the canonical `_meta` record id for a fanout sidecar.\n *\n * The full path inside the store is `_meta/<this-string>`. We pack the\n * full triple into the id so a single `_meta` collection holds all\n * sidecars (collection-per-source would proliferate names; the\n * existing `_meta` flat namespace is cheaper).\n */\nfunction recordId(source: string, sourceId: string, outputKey: string): string {\n // Use `/` as a separator. None of the components is supposed to\n // contain it (collection names + output keys are bare identifiers;\n // source ids are typically ULIDs / UUIDs / app-chosen strings\n // without slashes). If a future source carries `/` in its id, we'd\n // need an escape; deferred until that's a real case.\n return `derivations-fanout/${source}/${sourceId}/${outputKey}`\n}\n\n/**\n * Read the sidecar; returns `undefined` only when it's legitimately absent\n * (no envelope at that id) — the correct signal for callers to skip\n * orphan-row reconciliation because there's nothing to reconcile against.\n *\n * A PRESENT envelope that fails to decrypt or parse is a data-integrity\n * problem, not an absence, and is deliberately NOT caught here: swallowing\n * it to `undefined` would look identical to \"no sidecar\" and make callers\n * (the array-derivation dispatch in `vault.ts`/`collection.ts`) silently\n * skip deleting stale derived rows on a shrink. Let `openEnvelopeJson`'s\n * `DecryptionError`/`TamperedError` and `JSON.parse` failures propagate,\n * matching the no-catch convention of sibling decrypt call-sites (e.g.\n * `with-audit/consent/consent.ts`'s `decryptEntry`).\n *\n * Dual-reads for back-compat: an envelope with `_iv === ''` is a legacy\n * plaintext sidecar (parse `_data` directly); otherwise the body was\n * encrypted under the `_meta` DEK and is decrypted first.\n */\nexport async function loadFanoutSidecar(\n store: NoydbStore,\n vault: string,\n source: string,\n sourceId: string,\n outputKey: string,\n getDEK: GetDEK,\n encrypted: boolean,\n): Promise<FanoutSidecar | undefined> {\n const envelope = await store.get(vault, '_meta', recordId(source, sourceId, outputKey))\n if (!envelope) return undefined\n // Legacy plaintext (`_iv === ''`) reads directly; encrypted bodies decrypt.\n const json = (!encrypted || envelope._iv === '')\n ? envelope._data\n : await openEnvelopeJson({ collection: '_meta', id: recordId(source, sourceId, outputKey) }, envelope, await getDEK(FANOUT_DEK_COLLECTION))\n const parsed = JSON.parse(json) as FanoutSidecar\n if (parsed._noydb_fanout !== 1) return undefined\n if (!Array.isArray(parsed.keys)) return undefined\n return parsed\n}\n\n/**\n * Persist (insert/replace) the sidecar with a fresh key set. The body is\n * encrypted under the `_meta` DEK when the vault is encrypted (the `keys[]`\n * can be content-bearing); plaintext only in debug/unencrypted vaults.\n */\nexport async function saveFanoutSidecar(\n store: NoydbStore,\n vault: string,\n payload: {\n readonly source: string\n readonly sourceId: string\n readonly outputKey: string\n readonly outputCollection: string\n readonly keys: ReadonlyArray<string>\n },\n getDEK: GetDEK,\n encrypted: boolean,\n): Promise<void> {\n const doc: FanoutSidecar = {\n _noydb_fanout: 1,\n source: payload.source,\n sourceId: payload.sourceId,\n outputKey: payload.outputKey,\n outputCollection: payload.outputCollection,\n keys: payload.keys,\n emittedAt: new Date().toISOString(),\n }\n const id = recordId(payload.source, payload.sourceId, payload.outputKey)\n const prior = await store.get(vault, '_meta', id)\n const json = JSON.stringify(doc)\n const version = (prior?._v ?? 0) + 1\n const identity = { collection: '_meta', id, version }\n let envelope: EncryptedEnvelope\n if (!encrypted) {\n envelope = buildRecordEnvelope(identity, { iv: '', data: json })\n } else {\n const { iv, data } = await encrypt(json, await getDEK(FANOUT_DEK_COLLECTION), buildRecordAad(identity))\n envelope = buildRecordEnvelope(identity, { iv, data })\n }\n await store.put(vault, '_meta', id, envelope)\n}\n\n/** Delete the sidecar (used on source-row delete cascade). */\nexport async function deleteFanoutSidecar(\n store: NoydbStore,\n vault: string,\n source: string,\n sourceId: string,\n outputKey: string,\n): Promise<void> {\n await store.delete(vault, '_meta', recordId(source, sourceId, outputKey))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,IAAM,wBAAwB;AA2B9B,SAAS,SAAS,QAAgB,UAAkB,WAA2B;AAM7E,SAAO,sBAAsB,MAAM,IAAI,QAAQ,IAAI,SAAS;AAC9D;AAoBA,eAAsB,kBACpB,OACA,OACA,QACA,UACA,WACA,QACA,WACoC;AACpC,QAAM,WAAW,MAAM,MAAM,IAAI,OAAO,SAAS,SAAS,QAAQ,UAAU,SAAS,CAAC;AACtF,MAAI,CAAC,SAAU,QAAO;AAEtB,QAAM,OAAQ,CAAC,aAAa,SAAS,QAAQ,KACzC,SAAS,QACT,MAAM,iBAAiB,EAAE,YAAY,SAAS,IAAI,SAAS,QAAQ,UAAU,SAAS,EAAE,GAAG,UAAU,MAAM,OAAO,qBAAqB,CAAC;AAC5I,QAAM,SAAS,KAAK,MAAM,IAAI;AAC9B,MAAI,OAAO,kBAAkB,EAAG,QAAO;AACvC,MAAI,CAAC,MAAM,QAAQ,OAAO,IAAI,EAAG,QAAO;AACxC,SAAO;AACT;AAOA,eAAsB,kBACpB,OACA,OACA,SAOA,QACA,WACe;AACf,QAAM,MAAqB;AAAA,IACzB,eAAe;AAAA,IACf,QAAQ,QAAQ;AAAA,IAChB,UAAU,QAAQ;AAAA,IAClB,WAAW,QAAQ;AAAA,IACnB,kBAAkB,QAAQ;AAAA,IAC1B,MAAM,QAAQ;AAAA,IACd,YAAW,oBAAI,KAAK,GAAE,YAAY;AAAA,EACpC;AACA,QAAM,KAAK,SAAS,QAAQ,QAAQ,QAAQ,UAAU,QAAQ,SAAS;AACvE,QAAM,QAAQ,MAAM,MAAM,IAAI,OAAO,SAAS,EAAE;AAChD,QAAM,OAAO,KAAK,UAAU,GAAG;AAC/B,QAAM,WAAW,OAAO,MAAM,KAAK;AACnC,QAAM,WAAW,EAAE,YAAY,SAAS,IAAI,QAAQ;AACpD,MAAI;AACJ,MAAI,CAAC,WAAW;AACd,eAAW,oBAAoB,UAAU,EAAE,IAAI,IAAI,MAAM,KAAK,CAAC;AAAA,EACjE,OAAO;AACL,UAAM,EAAE,IAAI,KAAK,IAAI,MAAM,QAAQ,MAAM,MAAM,OAAO,qBAAqB,GAAG,eAAe,QAAQ,CAAC;AACtG,eAAW,oBAAoB,UAAU,EAAE,IAAI,KAAK,CAAC;AAAA,EACvD;AACA,QAAM,MAAM,IAAI,OAAO,SAAS,IAAI,QAAQ;AAC9C;AAGA,eAAsB,oBACpB,OACA,OACA,QACA,UACA,WACe;AACf,QAAM,MAAM,OAAO,OAAO,SAAS,SAAS,QAAQ,UAAU,SAAS,CAAC;AAC1E;","names":[]}
@@ -1,10 +0,0 @@
1
- import {
2
- computeBidxTarget
3
- } from "./chunk-LQ4ZHOKP.js";
4
- import "./chunk-LP7BEXCT.js";
5
- import "./chunk-UYB234ZR.js";
6
- import "./chunk-244VXYPG.js";
7
- export {
8
- computeBidxTarget
9
- };
10
- //# sourceMappingURL=find-LZMP26KF.js.map
@@ -1,18 +0,0 @@
1
- import {
2
- issueAttestationCore
3
- } from "./chunk-MTL7MXGR.js";
4
- import "./chunk-QWFHIOD2.js";
5
- import "./chunk-4AOERLTV.js";
6
- import "./chunk-KJFW62P4.js";
7
- import "./chunk-SEE332EV.js";
8
- import "./chunk-6QSQQLSE.js";
9
- import "./chunk-DE4DH2RZ.js";
10
- import "./chunk-LQ4ZHOKP.js";
11
- import "./chunk-LP7BEXCT.js";
12
- import "./chunk-UYB234ZR.js";
13
- import "./chunk-ODVPTDPK.js";
14
- import "./chunk-244VXYPG.js";
15
- export {
16
- issueAttestationCore
17
- };
18
- //# sourceMappingURL=issue-IHARXWW5.js.map
@@ -1,10 +0,0 @@
1
- /** Compare exactly-32-byte tags. XOR-accumulate over all 32 bytes, no early exit. */
2
- export declare function ctEqualTags(a: Uint8Array, b: Uint8Array): boolean;
3
- /**
4
- * Blinded equality of arbitrary-length byte strings: fresh K_e per
5
- * comparison (never stored, never reused), HMAC both sides to 32-byte
6
- * tags, then ctEqualTags. On the digest path the inputs are already
7
- * 32-byte PBKDF2 outputs but still route through this reduction so
8
- * there is exactly ONE comparison construction (spec §3 rule 2).
9
- */
10
- export declare function blindedEqual(a: Uint8Array, b: Uint8Array): Promise<boolean>;
@@ -1,87 +0,0 @@
1
- /**
2
- * **kernel/enclave** — the hub's crypto interior, behind one door.
3
- *
4
- * This barrel is **the fork-swap contract**: a sister project that wants a
5
- * different crypto engine (a different KDF, a hardware-backed keystore, a
6
- * post-quantum wrap algorithm, …) replaces the entire `kernel/enclave/`
7
- * folder wholesale and only has to honor the exports below. Nothing outside
8
- * `kernel/enclave/**` may deep-import `crypto.js` or `record-keys/*` directly
9
- * — `scripts/check-architecture.mjs`'s `enclave-barrel-only` check enforces
10
- * that mechanically. Import sites inside `kernel/enclave/**` keep their
11
- * existing relative imports; this door is for everyone else.
12
- *
13
- * The export list is the OBSERVED contract — exactly the symbols consumed
14
- * from outside this folder today — grouped by the module that defines them:
15
- *
16
- * - key type — `crypto.ts`: `EnclaveKey`, the opaque key type every
17
- * barrel-facing signature traffics in (`= CryptoKey` in
18
- * noy-db's reference enclave; a fork redefines it to its
19
- * own key representation — see the type's own doc for
20
- * the fork contract).
21
- * - crypto ops — `crypto.ts`: AES-256-GCM encrypt/decrypt (+ bytes, AAD,
22
- * deterministic variants), SHA-256 / HMAC-SHA-256 hashing.
23
- * - key lifecycle — `crypto.ts` + `record-keys/lifecycle.ts`: KEK/DEK
24
- * derivation, AES-KW wrap/unwrap, per-record CEK
25
- * wrap/unwrap/import + resolution/re-wrap, HKDF-derived
26
- * presence/sealed-field keys, base64 helpers.
27
- * - record codec — `record-keys/record-codec.ts`: the per-record
28
- * encode/decode engine.
29
- * - sealing — `record-keys/sealing.ts`: the sealed-record grantor
30
- * primitives (seal/revoke/rotate to an `at-*` host).
31
- * - deterministic — `record-keys/deterministic.ts`: blind-equality lookup
32
- * over deterministically-encrypted fields.
33
- * - tombstone — `record-keys/tombstone.ts`: the erased-record residue.
34
- * - envelope body — `record-keys/envelope-body.ts`: the C1 protected-body
35
- * access contract (`openEnvelopeJson`,
36
- * `writeEnvelopeBody`, `hasPerRecordKey`,
37
- * `hasSealedBody`, `envelopeBodyForHash`) — the
38
- * sanctioned door onto
39
- * `_iv`/`_data`/`_cek`/`_sealed` for everyone outside
40
- * this folder.
41
- * - reserved envelopes — `record-keys/sealed-slots.ts`: `makeReservedEnvelopes`,
42
- * the whole-envelope encrypt/decrypt door scoped to a
43
- * declared collection-name prefix (e.g. `_dict_`) —
44
- * `kernel/vault.ts` binds it for `DictionaryHandle`
45
- * (#629 Task 4).
46
- *
47
- * Additive changes only — removing or renaming an export here is breaking
48
- * for any fork. Frozen by `__tests__/enclave-surface-golden.test.ts`.
49
- *
50
- * **Refusal contract:** the barrel above is frozen — every symbol must
51
- * exist in any fork — but the optional groups (sealing, deterministic,
52
- * per-record-key lifecycle) MAY throw `EnclaveNotSupportedError` instead
53
- * of implementing the reference behavior. The core groups (crypto ops,
54
- * record codec, tombstone) MUST NOT throw it — they are load-bearing for
55
- * every consumer regardless of which enclave is wired in. noy-db's own
56
- * enclave supports every group, so it never throws this error.
57
- */
58
- export type { EnclaveKey, EncryptResult } from './crypto.js';
59
- export { encrypt, decrypt, encryptBytes, decryptBytes, encryptBytesWithAAD, decryptBytesWithAAD, encryptDeterministic, decryptDeterministic, sha256Hex, hmacSha256Hex, deriveBlobAddressKey, } from './crypto.js';
60
- export { deriveKey, deriveSecretKey, generateDEK, exportDekSet, importDekSet, generateSalt, generateRecoverySecret, generateIV, wrapKey, unwrapKey, bufferToBase64, base64ToBuffer, derivePresenceKey, deriveDeterministicKey, deriveSealedFieldKey, deriveSealedFieldKeyFromCek, wrapCek, unwrapCek, importCek, encodeEchoParts, deriveEchoKey, } from './crypto.js';
61
- export type { SecretKeyUsage } from './crypto.js';
62
- export type { EchoSecretParts } from './crypto.js';
63
- export { resolveStableCek, rewrapBodyToDek, rewrapEnvelope, applyRewrappedBody, isRewrappedUnder } from './record-keys/lifecycle.js';
64
- export type { RewrappedBody } from './record-keys/lifecycle.js';
65
- export { rekeyEnvelopeToDek, rekeyEnvelopeIfNeeded, envelopeOpensUnderAny } from './record-keys/rekey.js';
66
- export { rekeyBlobSet } from './record-keys/rekey-blob.js';
67
- export { buildRecordEnvelope, buildSealedRecordEnvelope } from './record-envelope.js';
68
- export type { RecordEnvelopeBody } from './record-envelope.js';
69
- export { buildRecordAad, recordAadFor } from './record-aad.js';
70
- export type { RecordIdentity, RecordRef } from './record-aad.js';
71
- export { RecordCodec } from './record-keys/record-codec.js';
72
- export type { SealedShredSlot } from './record-keys/record-codec.js';
73
- export { SEALED_CEK_NS, sealRecordToHost, revokeSealedRecord, rotateRecordCek } from './record-keys/sealing.js';
74
- export type { SealingContext } from './record-keys/sealing.js';
75
- export { findByDet, queryByDet } from './record-keys/deterministic.js';
76
- export type { DeterministicContext } from './record-keys/deterministic.js';
77
- export { isTombstone, isTombstoneShape, buildTombstone, isDeleteMarker, buildDeleteMarker } from './record-keys/tombstone.js';
78
- export { openEnvelopeJson, writeEnvelopeBody, hasPerRecordKey, hasSealedBody, envelopeBodyForHash, envelopeBodySize, verifyRecordIdentity } from './record-keys/envelope-body.js';
79
- export { makeReservedEnvelopes } from './record-keys/sealed-slots.js';
80
- export { deriveVdigSlotKey } from './classify/vdig.js';
81
- export { pbkdf2VerifyDigest } from './classify/digest.js';
82
- export { ctEqualTags } from './classify/compare.js';
83
- export { evaluateKofN } from './classify/kofn.js';
84
- export { deriveClassifyIndexKey, deriveClassifyIndexSalt, mintBidxTag } from './classify/bidx.js';
85
- export { computeBidxTarget } from './classify/find.js';
86
- export { deriveBrokerProofBits, deriveBrokerProofKey, computeBrokerProof, issueChallenge, verifyBrokerProof, } from './broker/proof.js';
87
- export type { BrokerProofCanonicalParts, VerifyBrokerProofArgs, IssuedChallenge } from './broker/proof.js';
@@ -1,124 +0,0 @@
1
- /**
2
- * Per-record CEK lifecycle helpers for the WRITE path.
3
- *
4
- * These are the collection-coupled CEK operations, lifted off `Collection`
5
- * behind narrow deps so the kernel file delegates instead of carrying the
6
- * crypto inline:
7
- *
8
- * - {@link resolveStableCek} — the stable-CEK rule: an update or history
9
- * snapshot reuses the record's existing CEK so a single CEK delete kills
10
- * the whole version chain; a genuine insert (or legacy record being
11
- * migrated) mints a fresh one.
12
- * - {@link rewrapBodyToDek} — move a record body's wrapping from one DEK to
13
- * another (tier elevate/demote, bundle re-key) WITHOUT changing the body
14
- * key: unwrap the CEK under the source DEK, re-encrypt the body under the
15
- * same CEK, re-wrap the CEK under the destination DEK. History-chain
16
- * identity is preserved because the body key never changes.
17
- *
18
- * Both are pure functions over their deps — the `cekCache` ownership stays on
19
- * the collection (its lifetime is tied to `load()`), so callers cache the
20
- * returned key themselves.
21
- */
22
- import { type EnclaveKey } from '../crypto.js';
23
- import type { EncryptedEnvelope } from '../../types.js';
24
- import { type RecordIdentity } from '../record-aad.js';
25
- import type { Lru } from '../../cache/index.js';
26
- /** Dependencies {@link resolveStableCek} needs from its collection. */
27
- export interface StableCekDeps {
28
- /** The collection's per-record CEK cache (`null` → no caching). */
29
- readonly cache: Lru<string, EnclaveKey> | null;
30
- /** Read the record's live envelope (to recover an existing `_cek`). */
31
- getLive(id: string): Promise<EncryptedEnvelope | null>;
32
- /** The DEK the CEK is wrapped under (the collection DEK on the normal path). */
33
- getDEK(): Promise<EnclaveKey>;
34
- }
35
- /**
36
- * Resolve the stable CEK for a record on the write path. Caches the resolved
37
- * key under `id` so an update + its history snapshot share one CEK.
38
- */
39
- export declare function resolveStableCek(deps: StableCekDeps, id: string): Promise<EnclaveKey>;
40
- /** Re-wrapped body bytes + the (optional) CEK to cache. */
41
- export interface RewrappedBody {
42
- readonly _iv: string;
43
- readonly _data: string;
44
- /** Present iff the source envelope carried a CEK (per-record-key record). */
45
- readonly _cek?: string;
46
- /** The body key when one exists, so the caller can cache it; `null` for a legacy record. */
47
- readonly cek: EnclaveKey | null;
48
- }
49
- /**
50
- * Move a record body from `fromDek`/`from` to `toDek`/`to`.
51
- *
52
- * - Per-record-key record (`_cek` present): unwrap the CEK under `fromDek`,
53
- * re-encrypt the body under the SAME CEK, re-wrap the CEK under `toDek`. The
54
- * body key is unchanged → history-chain identity preserved.
55
- * - Legacy record (no `_cek`): decrypt under `fromDek`, re-encrypt under `toDek`
56
- * directly.
57
- *
58
- * ## Why it takes TWO identities (#1041)
59
- *
60
- * A rewrap is the one operation where the identity genuinely **changes**. A
61
- * tier move rewrites `_tier`; a history snapshot lands at a different
62
- * `(collection, id)` entirely. Since AAD binds both, the body must be opened
63
- * under the identity it currently has and re-sealed under the one it is moving
64
- * to. A single identity would be wrong for one end or the other.
65
- *
66
- * ⚠️ **This retires an optimisation, deliberately.** Callers used to compute
67
- * ONE rewrap and reuse the bytes for both a tier move's live write and its
68
- * `_history` snapshot (#728). Those now have different destination identities,
69
- * so they need different AAD and therefore different ciphertext — the same
70
- * bytes cannot satisfy both. Reusing one rewrap for two destinations is now a
71
- * silent corruption, not a saving: it produces a record that opens at one
72
- * address and not the other.
73
- */
74
- export declare function rewrapBodyToDek(from: RecordIdentity, to: RecordIdentity, envelope: Pick<EncryptedEnvelope, '_iv' | '_data' | '_cek' | '_tier' | '_by'>, fromDek: EnclaveKey, toDek: EnclaveKey): Promise<RewrappedBody>;
75
- /**
76
- * Merge an ALREADY-rewrapped {@link RewrappedBody} into `envelope`, keeping
77
- * every field but the re-keyed body (`_iv`/`_data`/`_cek`) unchanged.
78
- *
79
- * Body-field access (`_iv`/`_data`/`_cek`) is sanctioned inside the enclave;
80
- * this lets callers outside it get back a ready-to-store envelope without
81
- * reading those fields themselves. Takes a body the caller has ALREADY
82
- * computed (vs. {@link rewrapEnvelope}, which also runs `rewrapBodyToDek`)
83
- * so a caller building a SECOND envelope from the same rewrap — a tier
84
- * move's live write AND its pre-move `_history` snapshot, #728 — pays the
85
- * unwrap/decrypt/encrypt/wrap crypto once, not twice.
86
- */
87
- export declare function applyRewrappedBody(envelope: EncryptedEnvelope, body: RewrappedBody): EncryptedEnvelope;
88
- /**
89
- * Move a FULL stored envelope from `fromDek` to `toDek`, preserving every
90
- * field other than the re-keyed body (`_iv`/`_data`/`_cek`) unchanged.
91
- * Mirrors the spread-merge idiom `with-audit/tiers/index.ts`'s
92
- * `elevate()`/`demote()` use to apply `rewrapBodyToDek`'s result to the live
93
- * envelope, generalized to any envelope shape (history callers don't bump
94
- * `_v`/`_ts`/`_tier` the way a tier move does).
95
- */
96
- export declare function rewrapEnvelope(identity: RecordIdentity, envelope: EncryptedEnvelope, fromDek: EnclaveKey, toDek: EnclaveKey): Promise<EncryptedEnvelope>;
97
- /**
98
- * Is `envelope` ALREADY wrapped under `dek` (a per-record CEK wrapped under
99
- * `dek`, or — legacy, no `_cek` — the body itself decryptable under `dek`)?
100
- *
101
- * A toDek-first idempotency check for retry-safe rewrap loops (#712 crash
102
- * atomicity, `with-commit/history/history.ts`'s `rewrapHistory`): a crash
103
- * mid-rewrap can strand some entries already moved to `toDek` while others
104
- * remain under `fromDek`. Calling this with `toDek` before attempting the
105
- * `fromDek` rewrap lets the caller skip an already-migrated entry instead of
106
- * re-wrapping it (a re-wrap would be a correctness no-op but doubles as an
107
- * unnecessary write) — and, more importantly, tells a retry loop that this
108
- * entry needs no `fromDek` unwrap attempt at all, so a crash that landed some
109
- * entries under `toDek` doesn't wedge on those already-moved entries.
110
- *
111
- * AES-KW (CEK unwrap) and AES-GCM (direct decrypt) are both authenticated —
112
- * unwrap/decrypt under the wrong key throws, never silently returns garbage
113
- * — so a caught error here reliably means "not wrapped under `dek`", not a
114
- * corrupt envelope (a genuinely corrupt envelope also throws under the
115
- * correct key, but callers that reach this helper only do so as a
116
- * best-effort probe before their own decisive fromDek attempt, which still
117
- * surfaces real corruption).
118
- *
119
- * Body-field access (`_iv`/`_data`/`_cek`) is sanctioned inside the enclave —
120
- * this is the sanctioned door so callers outside it (history.ts) never read
121
- * those fields themselves, preserving the check-architecture body-access
122
- * ratchet.
123
- */
124
- export declare function isRewrappedUnder(identity: RecordIdentity, envelope: Pick<EncryptedEnvelope, '_iv' | '_data' | '_cek'>, dek: EnclaveKey): Promise<boolean>;
@@ -1,88 +0,0 @@
1
- /**
2
- * Re-key a vault's blob set from an old `_blob` DEK to a new one (#1122).
3
- *
4
- * ## The defect this closes
5
- *
6
- * `rotateKeys` re-keys `store.list(vault, <slot>)` plus the derived refs
7
- * `derivedRefsFor` declares. That assumes a DEK slot named `X` protects data
8
- * filed under collection `X`. For `_blob` it is false: the slot is `_blob`, but
9
- * every byte it protects lives in `_blob_index` and `_blob_chunks`. So rotating
10
- * `_blob` minted a fresh DEK, re-encrypted **nothing**, and made every blob in
11
- * the vault permanently unreadable — reported to the user as `TamperedError`,
12
- * i.e. as an attack, when it was self-inflicted. An ordinary `revoke` of a
13
- * whole-vault grantee reaches it, because such a grantee's DEK map contains
14
- * `_blob`.
15
- *
16
- * ## Why this cannot be done by `rekeyEnvelopeIfNeeded` alone
17
- *
18
- * Two of the three surfaces do not have the shape that helper assumes:
19
- *
20
- * - a **chunk** envelope is sealed over raw bytes under a bespoke AAD
21
- * (`{eTag}:{index}:{count}`), not under the record AAD, so the generic
22
- * helper cannot open it;
23
- * - an **index** envelope's body is JSON that may itself carry a wrapped
24
- * per-blob content CEK (`_cek` / `_cekPending`). Re-encrypting the body under
25
- * the new DEK without re-wrapping that CEK leaves a blob whose metadata opens
26
- * and whose bytes never will.
27
- *
28
- * ## Why it lives in the enclave
29
- *
30
- * It reads and writes protected body slots and it unwraps/re-wraps keys — the
31
- * two things `enclave-body-only` reserves to `kernel/enclave/**`, and the same
32
- * reason `rekeyEnvelopeToDek` moved here in #1074. `with-party` orchestrates
33
- * the rotation and must not touch a body to do it.
34
- *
35
- * The blob layout below is duplicated from its owner rather than imported:
36
- * `with-shape/blobs/blob-set.ts` already imports `with-party/team/tiers.js`, so
37
- * a `with-party → with-shape` import would close a cycle, and the kernel may
38
- * not depend on a service. `BlobObject` itself is a kernel type, so only the
39
- * three collection/id string layouts are copied, with their owner named.
40
- *
41
- * @packageDocumentation
42
- */
43
- import { type EnclaveKey } from '../crypto.js';
44
- import type { NoydbStore } from '../../types.js';
45
- /**
46
- * What a rotation did to the blob set.
47
- *
48
- * Deliberately NOT on the enclave barrel: no caller outside this module binds
49
- * it, and that surface is the fork-swap trust boundary, so exporting a type
50
- * nobody consumes is pure widening.
51
- *
52
- * It is a return value rather than a log line because `foreign` and `blobs`
53
- * are the only way to tell "left alone, correctly" from "left alone, because
54
- * the caller passed a wrong `otherDeks` set". Both re-key nothing and both
55
- * return successfully. `rotate-preserves-blobs.test.ts` asserts these counts
56
- * against a direct call for exactly that reason.
57
- */
58
- export interface BlobRekeyReport {
59
- /** Index envelopes moved onto the new DEK. */
60
- readonly blobs: number;
61
- /** Chunk envelopes re-encrypted under the new DEK. */
62
- readonly chunks: number;
63
- /**
64
- * Index envelopes left alone because they open under a DEK the caller holds
65
- * for a DIFFERENT slot — an elevated blob, sealed under `_blob#<tier>`. Those
66
- * are that slot's rotation to do, not this one's.
67
- */
68
- readonly foreign: number;
69
- /** Index envelopes already under the new DEK — a resumed rotation. */
70
- readonly alreadyMoved: number;
71
- }
72
- /**
73
- * Move every blob sealed under `oldDek` onto `newDek`.
74
- *
75
- * Chunks are re-encrypted BEFORE their index entry is re-sealed, and that order
76
- * is the resume property: an index entry still readable under `oldDek` means
77
- * its chunks may be half-moved (each one is probed individually), and an index
78
- * entry readable under `newDek` means its chunks are already done. An
79
- * interrupted rotation is finished by re-running it with the same `newDek`.
80
- *
81
- * `otherDeks` is what keeps a tier-elevated blob from being mistaken for a
82
- * damaged one. Membership in `_blob_index` is by DEK, not by collection name:
83
- * a record elevated to tier N has its blob metadata sealed under `_blob#N`. An
84
- * envelope that opens under NONE of the keys the caller holds is genuinely
85
- * unreadable and throws, exactly as `rekeyEnvelopeIfNeeded` does — silently
86
- * walking past it would turn a loud failure into permanent quiet loss.
87
- */
88
- export declare function rekeyBlobSet(adapter: NoydbStore, vault: string, oldDek: EnclaveKey, newDek: EnclaveKey, otherDeks?: readonly EnclaveKey[]): Promise<BlobRekeyReport>;