@noy-db/hub 0.2.0-pre.27 → 0.2.0-pre.29

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 (280) hide show
  1. package/dist/aggregate/index.cjs +7 -0
  2. package/dist/aggregate/index.cjs.map +1 -1
  3. package/dist/aggregate/index.d.cts +3 -3
  4. package/dist/aggregate/index.d.ts +3 -3
  5. package/dist/aggregate/index.js +5 -5
  6. package/dist/attestation/index.cjs.map +1 -1
  7. package/dist/attestation/index.d.cts +4 -4
  8. package/dist/attestation/index.d.ts +4 -4
  9. package/dist/attestation/index.js +6 -6
  10. package/dist/blobs/index.cjs +2 -2
  11. package/dist/blobs/index.cjs.map +1 -1
  12. package/dist/blobs/index.d.cts +6 -6
  13. package/dist/blobs/index.d.ts +6 -6
  14. package/dist/blobs/index.js +6 -6
  15. package/dist/bundle/index.cjs +947 -6
  16. package/dist/bundle/index.cjs.map +1 -1
  17. package/dist/bundle/index.d.cts +6 -6
  18. package/dist/bundle/index.d.ts +6 -6
  19. package/dist/bundle/index.js +10 -10
  20. package/dist/{chunk-KA5A5CSD.js → chunk-2QDWRK3B.js} +5 -5
  21. package/dist/{chunk-6H4CAHMQ.js → chunk-2UT7HJJR.js} +4 -4
  22. package/dist/{chunk-E5TJAQS7.js → chunk-2ZYIN3BL.js} +2 -2
  23. package/dist/{chunk-CVTPNW2Y.js → chunk-45QJXLLS.js} +8 -8
  24. package/dist/{chunk-H4XFA2LM.js → chunk-4K4QKYK4.js} +3 -3
  25. package/dist/{chunk-RHVYFAVQ.js → chunk-4L6N56B4.js} +2 -2
  26. package/dist/{chunk-EW3H5Y7N.js → chunk-4YD7VZH4.js} +2 -2
  27. package/dist/{chunk-BOMH3637.js → chunk-553CK4E2.js} +3 -3
  28. package/dist/{chunk-I2RX62RX.js → chunk-5PTX7PKD.js} +4 -4
  29. package/dist/{chunk-7DDTFGXY.js → chunk-6BSYMFYS.js} +7 -7
  30. package/dist/chunk-6BSYMFYS.js.map +1 -0
  31. package/dist/{chunk-TESFHBOW.js → chunk-6EKRQ7QF.js} +3 -3
  32. package/dist/{chunk-Q7P4WHTL.js → chunk-7GPQPLGO.js} +2 -2
  33. package/dist/{chunk-AD6RNBAW.js → chunk-A7DNZVAV.js} +1 -1
  34. package/dist/chunk-A7DNZVAV.js.map +1 -0
  35. package/dist/{chunk-OMBPGXCL.js → chunk-ASIGWYRA.js} +2 -2
  36. package/dist/{chunk-IWGVH2RR.js → chunk-AWU4JF7C.js} +6 -6
  37. package/dist/{chunk-SKYBEGHB.js → chunk-BEZ2EV43.js} +2 -2
  38. package/dist/{chunk-EJJTUDNI.js → chunk-BITB3T5Z.js} +3 -3
  39. package/dist/{chunk-6M5JKTUQ.js → chunk-CIZDUAHI.js} +4 -4
  40. package/dist/{chunk-5EITJMUJ.js → chunk-CUPTCF4R.js} +5 -5
  41. package/dist/{chunk-FO5WEDKF.js → chunk-DEE4CRYN.js} +2 -2
  42. package/dist/{chunk-WVYL6HM7.js → chunk-DJO4OYCJ.js} +2 -2
  43. package/dist/{chunk-7JSP3E67.js → chunk-E2MDPPOC.js} +2 -2
  44. package/dist/{chunk-LX4CPLU6.js → chunk-FFKQ65YX.js} +2 -2
  45. package/dist/{chunk-VUUQYWF5.js → chunk-G7ALNCQH.js} +2 -2
  46. package/dist/{chunk-Z3BJF7SF.js → chunk-GGXN73NM.js} +36 -4
  47. package/dist/chunk-GGXN73NM.js.map +1 -0
  48. package/dist/{chunk-HAKEZTA7.js → chunk-JOJPBZSZ.js} +5 -5
  49. package/dist/{chunk-DDOYOMAD.js → chunk-JZ5DS4DP.js} +32 -2
  50. package/dist/chunk-JZ5DS4DP.js.map +1 -0
  51. package/dist/{chunk-C7UIT5XY.js → chunk-K6NVSHAH.js} +4 -4
  52. package/dist/{chunk-3BANVNDH.js → chunk-KJ3K5VZM.js} +2 -2
  53. package/dist/{chunk-ZW2YSN6G.js → chunk-LBILABKZ.js} +4 -4
  54. package/dist/{chunk-K6PCTYAH.js → chunk-LXKBG52H.js} +4 -4
  55. package/dist/{chunk-YYTM4U4J.js → chunk-MPIZQGFA.js} +2 -2
  56. package/dist/{chunk-SID2NJNF.js → chunk-MRJPSXPE.js} +3 -3
  57. package/dist/{chunk-J73KU4AE.js → chunk-MSMDDDDJ.js} +2 -2
  58. package/dist/{chunk-6ZKXFMUG.js → chunk-QBLPY44S.js} +3 -3
  59. package/dist/{chunk-PS6PSEZL.js → chunk-QGBBQKDS.js} +35 -5
  60. package/dist/chunk-QGBBQKDS.js.map +1 -0
  61. package/dist/{chunk-2NYVA6FW.js → chunk-QWJCNXH2.js} +3 -3
  62. package/dist/{chunk-KD253AI5.js → chunk-QXWJQ7UU.js} +23 -4
  63. package/dist/chunk-QXWJQ7UU.js.map +1 -0
  64. package/dist/{chunk-YRQPI67X.js → chunk-RCB6GWTC.js} +2 -2
  65. package/dist/{chunk-PFKAT4NT.js → chunk-REHF3HSJ.js} +5 -5
  66. package/dist/{chunk-FUDVHE2U.js → chunk-SAAJYSVV.js} +2 -2
  67. package/dist/{chunk-VJNV2GRF.js → chunk-SHJ3BRTZ.js} +5 -5
  68. package/dist/{chunk-BMDVFBCL.js → chunk-SQXTKZL7.js} +3 -3
  69. package/dist/{chunk-2KA3PDUR.js → chunk-TMUMMAWV.js} +2 -2
  70. package/dist/{chunk-DONPLWRC.js → chunk-TZGWI5AX.js} +4 -4
  71. package/dist/{chunk-KNJ7MK4B.js → chunk-UBF5JEOJ.js} +2 -2
  72. package/dist/{chunk-FJ3C3ELF.js → chunk-XAYDHD2O.js} +2 -2
  73. package/dist/{chunk-RRCRITDM.js → chunk-XYW2CSCI.js} +3 -3
  74. package/dist/{chunk-LXA2E3VI.js → chunk-ZCMOS4H2.js} +4 -4
  75. package/dist/{chunk-KSKKLVPA.js → chunk-ZDW22N3E.js} +822 -57
  76. package/dist/chunk-ZDW22N3E.js.map +1 -0
  77. package/dist/consent/index.cjs.map +1 -1
  78. package/dist/consent/index.d.cts +5 -5
  79. package/dist/consent/index.d.ts +5 -5
  80. package/dist/consent/index.js +3 -3
  81. package/dist/{crypto-YBKBNPVM.js → crypto-G6XU2V2Y.js} +3 -3
  82. package/dist/{decrypt-partition-CptDdcCx.d.ts → decrypt-partition-5Gt0EcTc.d.ts} +1 -1
  83. package/dist/{decrypt-partition-DmkeOB4I.d.cts → decrypt-partition-DDSArPPW.d.cts} +1 -1
  84. package/dist/{delegation-4JSMM6BB.js → delegation-ZEH4LKEM.js} +5 -5
  85. package/dist/derivations/index.cjs.map +1 -1
  86. package/dist/derivations/index.d.cts +6 -6
  87. package/dist/derivations/index.d.ts +6 -6
  88. package/dist/derivations/index.js +4 -4
  89. package/dist/{dev-unlock-Y9znMkQ2.d.ts → dev-unlock-BF9IhLPn.d.ts} +1 -1
  90. package/dist/{dev-unlock-DUTLA3Sc.d.cts → dev-unlock-CIkHrcRm.d.cts} +1 -1
  91. package/dist/{errors-Dwk2k1xY.d.ts → errors-BAWO5Z5a.d.cts} +25 -1
  92. package/dist/{errors-Dwk2k1xY.d.cts → errors-BAWO5Z5a.d.ts} +25 -1
  93. package/dist/executor-DWVP4BSJ.js +8 -0
  94. package/dist/executor-HB2YMIYC.js +12 -0
  95. package/dist/executor-HO3SIRSF.js +8 -0
  96. package/dist/{fanout-sidecar-OC4QVTS2.js → fanout-sidecar-BMT7I6FI.js} +2 -2
  97. package/dist/forget/index.js +4 -4
  98. package/dist/guards/index.cjs.map +1 -1
  99. package/dist/guards/index.d.cts +6 -6
  100. package/dist/guards/index.d.ts +6 -6
  101. package/dist/guards/index.js +3 -3
  102. package/dist/{hash-DFK7cGdo.d.cts → hash-DfhndFcd.d.cts} +1 -1
  103. package/dist/{hash-Btl9IvQS.d.ts → hash-Jl0qarQx.d.ts} +1 -1
  104. package/dist/history/index.cjs.map +1 -1
  105. package/dist/history/index.d.cts +6 -6
  106. package/dist/history/index.d.ts +6 -6
  107. package/dist/history/index.js +5 -5
  108. package/dist/i18n/index.cjs +98 -1
  109. package/dist/i18n/index.cjs.map +1 -1
  110. package/dist/i18n/index.d.cts +5 -5
  111. package/dist/i18n/index.d.ts +5 -5
  112. package/dist/i18n/index.js +85 -6
  113. package/dist/i18n/index.js.map +1 -1
  114. package/dist/{index-DoxKSsMj.d.cts → index-C1SC1EPe.d.cts} +19 -2
  115. package/dist/{index-CqzZml-D.d.cts → index-DPG2nFmT.d.cts} +28 -5
  116. package/dist/{index-wRwJVVJQ.d.ts → index-DcxTv3zx.d.ts} +28 -5
  117. package/dist/{index-LaexBi3v.d.ts → index-Ddm8D3Oo.d.ts} +19 -2
  118. package/dist/index.cjs +969 -9
  119. package/dist/index.cjs.map +1 -1
  120. package/dist/index.d.cts +16 -16
  121. package/dist/index.d.ts +16 -16
  122. package/dist/index.js +54 -47
  123. package/dist/index.js.map +1 -1
  124. package/dist/indexing/index.cjs.map +1 -1
  125. package/dist/indexing/index.js +4 -4
  126. package/dist/issue-FZRTVGRE.js +12 -0
  127. package/dist/kernel/index.cjs +33 -0
  128. package/dist/kernel/index.cjs.map +1 -1
  129. package/dist/kernel/index.d.cts +5 -5
  130. package/dist/kernel/index.d.ts +5 -5
  131. package/dist/kernel/index.js +9 -7
  132. package/dist/{ledger-XQ4KVFQ6.js → ledger-PMTR2Q62.js} +5 -5
  133. package/dist/materialized-views/index.cjs +7 -0
  134. package/dist/materialized-views/index.cjs.map +1 -1
  135. package/dist/materialized-views/index.d.cts +6 -6
  136. package/dist/materialized-views/index.d.ts +6 -6
  137. package/dist/materialized-views/index.js +8 -8
  138. package/dist/{mime-magic-OiPT1qed.d.ts → mime-magic-BOI-I5dq.d.ts} +1 -1
  139. package/dist/{mime-magic-Co4Pyj-O.d.cts → mime-magic-C0TM7FtF.d.cts} +1 -1
  140. package/dist/noydb-Y3ZLZNXA.js +39 -0
  141. package/dist/overlay-views/index.cjs.map +1 -1
  142. package/dist/overlay-views/index.d.cts +6 -6
  143. package/dist/overlay-views/index.d.ts +6 -6
  144. package/dist/overlay-views/index.js +4 -4
  145. package/dist/periods/index.cjs.map +1 -1
  146. package/dist/periods/index.d.cts +5 -5
  147. package/dist/periods/index.d.ts +5 -5
  148. package/dist/periods/index.js +5 -5
  149. package/dist/{public-envelope-O6X6AUUS.js → public-envelope-S2S2VR3F.js} +4 -4
  150. package/dist/query/index.cjs +37 -0
  151. package/dist/query/index.cjs.map +1 -1
  152. package/dist/query/index.d.cts +3 -3
  153. package/dist/query/index.d.ts +3 -3
  154. package/dist/query/index.js +7 -7
  155. package/dist/{registry-OUZ3VBZA.js → registry-53A55ZZE.js} +3 -3
  156. package/dist/registry-FKL4SLU4.js +8 -0
  157. package/dist/registry-IEU6ATO7.js +8 -0
  158. package/dist/{revoke-QJ2HUM4W.js → revoke-AOCAVR56.js} +6 -6
  159. package/dist/sealed-record/index.cjs.map +1 -1
  160. package/dist/sealed-record/index.d.cts +1 -1
  161. package/dist/sealed-record/index.d.ts +1 -1
  162. package/dist/sealed-record/index.js +2 -2
  163. package/dist/session/index.cjs.map +1 -1
  164. package/dist/session/index.d.cts +6 -6
  165. package/dist/session/index.d.ts +6 -6
  166. package/dist/session/index.js +3 -3
  167. package/dist/shadow/index.cjs.map +1 -1
  168. package/dist/shadow/index.d.cts +5 -5
  169. package/dist/shadow/index.d.ts +5 -5
  170. package/dist/shadow/index.js +2 -2
  171. package/dist/{signer-SCJ6C6HQ.js → signer-JMK6W2Y6.js} +5 -5
  172. package/dist/snapshots/index.cjs.map +1 -1
  173. package/dist/snapshots/index.d.cts +5 -5
  174. package/dist/snapshots/index.d.ts +5 -5
  175. package/dist/snapshots/index.js +4 -4
  176. package/dist/{stale-KKCHF2VB.js → stale-IIIGOHBW.js} +2 -2
  177. package/dist/store/index.cjs.map +1 -1
  178. package/dist/store/index.d.cts +5 -5
  179. package/dist/store/index.d.ts +5 -5
  180. package/dist/store/index.js +2 -2
  181. package/dist/{strategy-D1zjEV3n.d.cts → strategy-8QGs5KQE.d.ts} +21 -2
  182. package/dist/{strategy-YQ1qJWyq.d.ts → strategy-mJExw4LQ.d.cts} +21 -2
  183. package/dist/sync/index.cjs.map +1 -1
  184. package/dist/sync/index.d.cts +4 -4
  185. package/dist/sync/index.d.ts +4 -4
  186. package/dist/sync/index.js +4 -4
  187. package/dist/team/index.cjs.map +1 -1
  188. package/dist/team/index.d.cts +5 -5
  189. package/dist/team/index.d.ts +5 -5
  190. package/dist/team/index.js +8 -8
  191. package/dist/{transition-guard-CJmb8O8q.d.ts → transition-guard-BixCDmBI.d.ts} +1 -1
  192. package/dist/{transition-guard-Dzj68JWC.d.cts → transition-guard-DnAlUf9R.d.cts} +1 -1
  193. package/dist/tx/index.cjs.map +1 -1
  194. package/dist/tx/index.d.cts +5 -5
  195. package/dist/tx/index.d.ts +5 -5
  196. package/dist/tx/index.js +3 -3
  197. package/dist/{types-CwrTuYFI.d.cts → types-Ba1vQ3AY.d.cts} +203 -6
  198. package/dist/{types-CkSWJt0H.d.ts → types-CUmZYJwN.d.ts} +203 -6
  199. package/dist/util/index.cjs.map +1 -1
  200. package/dist/util/index.js +1 -1
  201. package/dist/{with-materialized-view-BVfcPlaE.d.ts → with-materialized-view-Bjx6VYPc.d.ts} +1 -1
  202. package/dist/{with-materialized-view-dPG213gd.d.cts → with-materialized-view-Z_aHLln6.d.cts} +1 -1
  203. package/dist/{with-overlayed-view-zYPQzGGh.d.ts → with-overlayed-view-B8PkL179.d.ts} +1 -1
  204. package/dist/{with-overlayed-view-CJ2UDBol.d.cts → with-overlayed-view-pTOFgHRq.d.cts} +1 -1
  205. package/dist/{with-rollup-BvaJefEs.d.ts → with-rollup-Cd3t01Mz.d.ts} +1 -1
  206. package/dist/{with-rollup-B_zbRi3f.d.cts → with-rollup-D9qQoffP.d.cts} +1 -1
  207. package/package.json +3 -3
  208. package/dist/chunk-7DDTFGXY.js.map +0 -1
  209. package/dist/chunk-AD6RNBAW.js.map +0 -1
  210. package/dist/chunk-DDOYOMAD.js.map +0 -1
  211. package/dist/chunk-KD253AI5.js.map +0 -1
  212. package/dist/chunk-KSKKLVPA.js.map +0 -1
  213. package/dist/chunk-PS6PSEZL.js.map +0 -1
  214. package/dist/chunk-Z3BJF7SF.js.map +0 -1
  215. package/dist/executor-3SVNESQ3.js +0 -8
  216. package/dist/executor-BIW4FT5R.js +0 -12
  217. package/dist/executor-VEZUBJNQ.js +0 -8
  218. package/dist/issue-ZZ2XPOGP.js +0 -12
  219. package/dist/noydb-EY52NVH4.js +0 -39
  220. package/dist/registry-CMEVTOCN.js +0 -8
  221. package/dist/registry-XUBRO5JJ.js +0 -8
  222. /package/dist/{chunk-KA5A5CSD.js.map → chunk-2QDWRK3B.js.map} +0 -0
  223. /package/dist/{chunk-6H4CAHMQ.js.map → chunk-2UT7HJJR.js.map} +0 -0
  224. /package/dist/{chunk-E5TJAQS7.js.map → chunk-2ZYIN3BL.js.map} +0 -0
  225. /package/dist/{chunk-CVTPNW2Y.js.map → chunk-45QJXLLS.js.map} +0 -0
  226. /package/dist/{chunk-H4XFA2LM.js.map → chunk-4K4QKYK4.js.map} +0 -0
  227. /package/dist/{chunk-RHVYFAVQ.js.map → chunk-4L6N56B4.js.map} +0 -0
  228. /package/dist/{chunk-EW3H5Y7N.js.map → chunk-4YD7VZH4.js.map} +0 -0
  229. /package/dist/{chunk-BOMH3637.js.map → chunk-553CK4E2.js.map} +0 -0
  230. /package/dist/{chunk-I2RX62RX.js.map → chunk-5PTX7PKD.js.map} +0 -0
  231. /package/dist/{chunk-TESFHBOW.js.map → chunk-6EKRQ7QF.js.map} +0 -0
  232. /package/dist/{chunk-Q7P4WHTL.js.map → chunk-7GPQPLGO.js.map} +0 -0
  233. /package/dist/{chunk-OMBPGXCL.js.map → chunk-ASIGWYRA.js.map} +0 -0
  234. /package/dist/{chunk-IWGVH2RR.js.map → chunk-AWU4JF7C.js.map} +0 -0
  235. /package/dist/{chunk-SKYBEGHB.js.map → chunk-BEZ2EV43.js.map} +0 -0
  236. /package/dist/{chunk-EJJTUDNI.js.map → chunk-BITB3T5Z.js.map} +0 -0
  237. /package/dist/{chunk-6M5JKTUQ.js.map → chunk-CIZDUAHI.js.map} +0 -0
  238. /package/dist/{chunk-5EITJMUJ.js.map → chunk-CUPTCF4R.js.map} +0 -0
  239. /package/dist/{chunk-FO5WEDKF.js.map → chunk-DEE4CRYN.js.map} +0 -0
  240. /package/dist/{chunk-WVYL6HM7.js.map → chunk-DJO4OYCJ.js.map} +0 -0
  241. /package/dist/{chunk-7JSP3E67.js.map → chunk-E2MDPPOC.js.map} +0 -0
  242. /package/dist/{chunk-LX4CPLU6.js.map → chunk-FFKQ65YX.js.map} +0 -0
  243. /package/dist/{chunk-VUUQYWF5.js.map → chunk-G7ALNCQH.js.map} +0 -0
  244. /package/dist/{chunk-HAKEZTA7.js.map → chunk-JOJPBZSZ.js.map} +0 -0
  245. /package/dist/{chunk-C7UIT5XY.js.map → chunk-K6NVSHAH.js.map} +0 -0
  246. /package/dist/{chunk-3BANVNDH.js.map → chunk-KJ3K5VZM.js.map} +0 -0
  247. /package/dist/{chunk-ZW2YSN6G.js.map → chunk-LBILABKZ.js.map} +0 -0
  248. /package/dist/{chunk-K6PCTYAH.js.map → chunk-LXKBG52H.js.map} +0 -0
  249. /package/dist/{chunk-YYTM4U4J.js.map → chunk-MPIZQGFA.js.map} +0 -0
  250. /package/dist/{chunk-SID2NJNF.js.map → chunk-MRJPSXPE.js.map} +0 -0
  251. /package/dist/{chunk-J73KU4AE.js.map → chunk-MSMDDDDJ.js.map} +0 -0
  252. /package/dist/{chunk-6ZKXFMUG.js.map → chunk-QBLPY44S.js.map} +0 -0
  253. /package/dist/{chunk-2NYVA6FW.js.map → chunk-QWJCNXH2.js.map} +0 -0
  254. /package/dist/{chunk-YRQPI67X.js.map → chunk-RCB6GWTC.js.map} +0 -0
  255. /package/dist/{chunk-PFKAT4NT.js.map → chunk-REHF3HSJ.js.map} +0 -0
  256. /package/dist/{chunk-FUDVHE2U.js.map → chunk-SAAJYSVV.js.map} +0 -0
  257. /package/dist/{chunk-VJNV2GRF.js.map → chunk-SHJ3BRTZ.js.map} +0 -0
  258. /package/dist/{chunk-BMDVFBCL.js.map → chunk-SQXTKZL7.js.map} +0 -0
  259. /package/dist/{chunk-2KA3PDUR.js.map → chunk-TMUMMAWV.js.map} +0 -0
  260. /package/dist/{chunk-DONPLWRC.js.map → chunk-TZGWI5AX.js.map} +0 -0
  261. /package/dist/{chunk-KNJ7MK4B.js.map → chunk-UBF5JEOJ.js.map} +0 -0
  262. /package/dist/{chunk-FJ3C3ELF.js.map → chunk-XAYDHD2O.js.map} +0 -0
  263. /package/dist/{chunk-RRCRITDM.js.map → chunk-XYW2CSCI.js.map} +0 -0
  264. /package/dist/{chunk-LXA2E3VI.js.map → chunk-ZCMOS4H2.js.map} +0 -0
  265. /package/dist/{crypto-YBKBNPVM.js.map → crypto-G6XU2V2Y.js.map} +0 -0
  266. /package/dist/{delegation-4JSMM6BB.js.map → delegation-ZEH4LKEM.js.map} +0 -0
  267. /package/dist/{executor-3SVNESQ3.js.map → executor-DWVP4BSJ.js.map} +0 -0
  268. /package/dist/{executor-BIW4FT5R.js.map → executor-HB2YMIYC.js.map} +0 -0
  269. /package/dist/{executor-VEZUBJNQ.js.map → executor-HO3SIRSF.js.map} +0 -0
  270. /package/dist/{fanout-sidecar-OC4QVTS2.js.map → fanout-sidecar-BMT7I6FI.js.map} +0 -0
  271. /package/dist/{issue-ZZ2XPOGP.js.map → issue-FZRTVGRE.js.map} +0 -0
  272. /package/dist/{ledger-XQ4KVFQ6.js.map → ledger-PMTR2Q62.js.map} +0 -0
  273. /package/dist/{noydb-EY52NVH4.js.map → noydb-Y3ZLZNXA.js.map} +0 -0
  274. /package/dist/{public-envelope-O6X6AUUS.js.map → public-envelope-S2S2VR3F.js.map} +0 -0
  275. /package/dist/{registry-CMEVTOCN.js.map → registry-53A55ZZE.js.map} +0 -0
  276. /package/dist/{registry-OUZ3VBZA.js.map → registry-FKL4SLU4.js.map} +0 -0
  277. /package/dist/{registry-XUBRO5JJ.js.map → registry-IEU6ATO7.js.map} +0 -0
  278. /package/dist/{revoke-QJ2HUM4W.js.map → revoke-AOCAVR56.js.map} +0 -0
  279. /package/dist/{signer-SCJ6C6HQ.js.map → signer-JMK6W2Y6.js.map} +0 -0
  280. /package/dist/{stale-KKCHF2VB.js.map → stale-IIIGOHBW.js.map} +0 -0
@@ -1,18 +1,19 @@
1
1
  import {
2
2
  StoreCoordinationProvider,
3
+ fuseRetrieval,
3
4
  loadFence,
4
5
  runDrainBarrier
5
- } from "./chunk-Z3BJF7SF.js";
6
+ } from "./chunk-GGXN73NM.js";
6
7
  import {
7
8
  resolveSchema
8
9
  } from "./chunk-EMIGCR7X.js";
9
10
  import {
10
11
  TxContext,
11
12
  revertExecuted
12
- } from "./chunk-EJJTUDNI.js";
13
+ } from "./chunk-BITB3T5Z.js";
13
14
  import {
14
15
  OverlayedCollection
15
- } from "./chunk-YYTM4U4J.js";
16
+ } from "./chunk-MPIZQGFA.js";
16
17
  import {
17
18
  NO_AGGREGATE,
18
19
  Query,
@@ -22,39 +23,39 @@ import {
22
23
  decodeMoneyFields,
23
24
  quantizeMoneyFields,
24
25
  validateMoneyFieldPaths
25
- } from "./chunk-PS6PSEZL.js";
26
+ } from "./chunk-QGBBQKDS.js";
26
27
  import {
27
28
  EXPORT_AUDIT_COLLECTION,
28
29
  createExportBlobsHandle,
29
30
  runCompaction
30
- } from "./chunk-RRCRITDM.js";
31
+ } from "./chunk-XYW2CSCI.js";
31
32
  import {
32
33
  LazyQuery,
33
34
  decodeIdxId,
34
35
  encodeIdxId
35
- } from "./chunk-H4XFA2LM.js";
36
+ } from "./chunk-4K4QKYK4.js";
36
37
  import {
37
38
  canonicalGroupKey
38
- } from "./chunk-C7UIT5XY.js";
39
+ } from "./chunk-K6NVSHAH.js";
39
40
  import {
40
41
  readPath
41
- } from "./chunk-3BANVNDH.js";
42
+ } from "./chunk-KJ3K5VZM.js";
42
43
  import {
43
44
  SCHEMAS_COLLECTION,
44
45
  loadPersistedSchema,
45
46
  resolveManagedSecret,
46
47
  savePersistedSchema,
47
48
  saveSealedPassphrase
48
- } from "./chunk-SID2NJNF.js";
49
+ } from "./chunk-MRJPSXPE.js";
49
50
  import {
50
51
  writeNoydbBundle
51
- } from "./chunk-6ZKXFMUG.js";
52
+ } from "./chunk-QBLPY44S.js";
52
53
  import {
53
54
  loadPublicEnvelope,
54
55
  readPublicEnvelope,
55
56
  savePublicEnvelope,
56
57
  validatePublicEnvelopeInput
57
- } from "./chunk-2NYVA6FW.js";
58
+ } from "./chunk-QWJCNXH2.js";
58
59
  import {
59
60
  buildTombstone,
60
61
  isTombstone,
@@ -63,19 +64,20 @@ import {
63
64
  rewrapBodyToDek,
64
65
  rotateRecordCek,
65
66
  sealRecordToHost
66
- } from "./chunk-K6PCTYAH.js";
67
+ } from "./chunk-LXKBG52H.js";
67
68
  import {
68
69
  PERIODS_COLLECTION
69
- } from "./chunk-BOMH3637.js";
70
+ } from "./chunk-553CK4E2.js";
70
71
  import {
71
72
  isDictCollectionName,
72
73
  isStaticDictDescriptor
73
- } from "./chunk-PFKAT4NT.js";
74
+ } from "./chunk-REHF3HSJ.js";
74
75
  import {
75
76
  getAtPath,
76
77
  resolvePolicy,
77
- setAtPathInPlace
78
- } from "./chunk-KD253AI5.js";
78
+ setAtPathInPlace,
79
+ stripI18nFilled
80
+ } from "./chunk-QXWJQ7UU.js";
79
81
  import {
80
82
  ManagedRecoveryNotEnrolledError,
81
83
  PolicyDeniedError,
@@ -97,11 +99,11 @@ import {
97
99
  saveShamirRecoveryEntries,
98
100
  updateAuthenticator,
99
101
  writeMagicLinkGrant
100
- } from "./chunk-IWGVH2RR.js";
102
+ } from "./chunk-AWU4JF7C.js";
101
103
  import {
102
104
  assertTierAccess,
103
105
  dekKey
104
- } from "./chunk-J73KU4AE.js";
106
+ } from "./chunk-MSMDDDDJ.js";
105
107
  import {
106
108
  USER_ENVELOPE_COLLECTION,
107
109
  assertKeyringOpenAllowed,
@@ -126,7 +128,7 @@ import {
126
128
  rotateKeys,
127
129
  saveUserEnvelope,
128
130
  updateKeyringIdentity
129
- } from "./chunk-LXA2E3VI.js";
131
+ } from "./chunk-ZCMOS4H2.js";
130
132
  import {
131
133
  INDEXED_STORE_POLICY
132
134
  } from "./chunk-2QR2PQTT.js";
@@ -136,7 +138,7 @@ import {
136
138
  import {
137
139
  LEDGER_COLLECTION,
138
140
  LEDGER_DELTAS_COLLECTION
139
- } from "./chunk-6H4CAHMQ.js";
141
+ } from "./chunk-2UT7HJJR.js";
140
142
  import {
141
143
  sha256Hex as sha256Hex2
142
144
  } from "./chunk-PDVP3C2I.js";
@@ -148,11 +150,11 @@ import {
148
150
  readDottedPath,
149
151
  rebuildSubjectIndex,
150
152
  removeSubjectRef
151
- } from "./chunk-BMDVFBCL.js";
153
+ } from "./chunk-SQXTKZL7.js";
152
154
  import {
153
155
  NOYDB_BACKUP_VERSION,
154
156
  NOYDB_FORMAT_VERSION
155
- } from "./chunk-AD6RNBAW.js";
157
+ } from "./chunk-A7DNZVAV.js";
156
158
  import {
157
159
  decrypt,
158
160
  encrypt,
@@ -161,7 +163,7 @@ import {
161
163
  unwrapCek,
162
164
  wrapCek,
163
165
  wrapKey
164
- } from "./chunk-7JSP3E67.js";
166
+ } from "./chunk-E2MDPPOC.js";
165
167
  import {
166
168
  AlreadyElevatedError,
167
169
  AttestationError,
@@ -172,6 +174,8 @@ import {
172
174
  DebugReservedFieldError,
173
175
  DerivationCapExceededError,
174
176
  ElevationExpiredError,
177
+ EmbeddingDimMismatchError,
178
+ EmbeddingModelMismatchError,
175
179
  ExportCapabilityError,
176
180
  ForgetStrategyNotConfiguredError,
177
181
  ImportCapabilityError,
@@ -199,7 +203,7 @@ import {
199
203
  UnknownDictCodeError,
200
204
  UnsupportedIndexOptionError,
201
205
  ValidationError
202
- } from "./chunk-DDOYOMAD.js";
206
+ } from "./chunk-JZ5DS4DP.js";
203
207
 
204
208
  // src/policy/storage.ts
205
209
  var META_COLLECTION = "_meta";
@@ -418,6 +422,11 @@ var NO_I18N = {
418
422
  enforceScript(value) {
419
423
  return { value, warnings: [] };
420
424
  },
425
+ computeExemptFills() {
426
+ return /* @__PURE__ */ new Map();
427
+ },
428
+ densify() {
429
+ },
421
430
  buildDictionaryHandle() {
422
431
  throw notEnabled("vault.dictionary()");
423
432
  }
@@ -582,6 +591,354 @@ function searchScan(entries, field, query, opts = {}, tokenizer = tokenize) {
582
591
  return opts.limit !== void 0 ? results.slice(0, opts.limit) : results;
583
592
  }
584
593
 
594
+ // src/search/segment.ts
595
+ var SEGMENTER = new Intl.Segmenter(void 0, { granularity: "word" });
596
+ var segmentTokens = (text) => {
597
+ const out = [];
598
+ if (!text) return out;
599
+ for (const s of SEGMENTER.segment(text)) {
600
+ if (s.isWordLike) out.push({ term: s.segment.normalize("NFKC").toLowerCase(), offset: s.index });
601
+ }
602
+ return out;
603
+ };
604
+ var segmentTokenizer = (text) => segmentTokens(text).map((t) => t.term);
605
+
606
+ // src/search/inverted-index.ts
607
+ var K12 = 1.2;
608
+ var B2 = 0.75;
609
+ var InvertedIndex = class _InvertedIndex {
610
+ // per field: df (term -> #docs), N (#docs), totalLen
611
+ fieldStats = /* @__PURE__ */ new Map();
612
+ docs = [];
613
+ static build(docs) {
614
+ const idx = new _InvertedIndex();
615
+ for (const d of docs) {
616
+ for (const f of d.fields) {
617
+ const tokens = segmentTokens(f.text);
618
+ const tf = /* @__PURE__ */ new Map();
619
+ const firstOffset = /* @__PURE__ */ new Map();
620
+ for (const t of tokens) {
621
+ tf.set(t.term, (tf.get(t.term) ?? 0) + 1);
622
+ if (!firstOffset.has(t.term)) firstOffset.set(t.term, t.offset);
623
+ }
624
+ const doc = { id: d.id, field: f.field, ...f.locale !== void 0 ? { locale: f.locale } : {}, text: f.text, len: tokens.length, tf, firstOffset };
625
+ idx.docs.push(doc);
626
+ let s = idx.fieldStats.get(f.field);
627
+ if (!s) {
628
+ s = { df: /* @__PURE__ */ new Map(), n: 0, totalLen: 0 };
629
+ idx.fieldStats.set(f.field, s);
630
+ }
631
+ s.n += 1;
632
+ s.totalLen += doc.len;
633
+ for (const term of tf.keys()) s.df.set(term, (s.df.get(term) ?? 0) + 1);
634
+ }
635
+ }
636
+ return idx;
637
+ }
638
+ query(query, opts = {}) {
639
+ const terms = segmentTokenizer(query);
640
+ if (terms.length === 0) return [];
641
+ const usePrefix = opts.prefix ?? false;
642
+ const exact = usePrefix ? terms.slice(0, -1) : terms;
643
+ const prefix = usePrefix ? terms[terms.length - 1] : void 0;
644
+ const match = opts.match ?? "any";
645
+ const required = exact.length + (prefix !== void 0 ? 1 : 0);
646
+ const best = /* @__PURE__ */ new Map();
647
+ for (const doc of this.docs) {
648
+ if (opts.fields !== void 0 && !opts.fields.includes(doc.field)) continue;
649
+ const stats = this.fieldStats.get(doc.field);
650
+ const avgdl = stats.totalLen / stats.n || 1;
651
+ let score = 0;
652
+ let matchedCount = 0;
653
+ let snippetOffset = -1;
654
+ const scoreTerm = (tf, df, offset) => {
655
+ if (tf <= 0) return;
656
+ matchedCount += 1;
657
+ if (snippetOffset < 0 && offset >= 0) snippetOffset = offset;
658
+ const idf = Math.log(1 + (stats.n - df + 0.5) / (df + 0.5));
659
+ const denom = tf + K12 * (1 - B2 + B2 * (doc.len / avgdl));
660
+ score += idf * (tf * (K12 + 1) / (denom || 1));
661
+ };
662
+ for (const qt of exact) scoreTerm(doc.tf.get(qt) ?? 0, stats.df.get(qt) ?? 0, doc.firstOffset.get(qt) ?? -1);
663
+ if (prefix !== void 0) {
664
+ const exactSet = new Set(exact);
665
+ let ptf = 0;
666
+ let poff = -1;
667
+ for (const [term, c] of doc.tf) {
668
+ if (term.startsWith(prefix) && !exactSet.has(term)) {
669
+ ptf += c;
670
+ if (poff < 0) poff = doc.firstOffset.get(term) ?? -1;
671
+ }
672
+ }
673
+ if (ptf > 0) {
674
+ let pdf = 0;
675
+ for (const d of this.docs) {
676
+ if (d.field === doc.field && [...d.tf.keys()].some((t) => t.startsWith(prefix))) pdf++;
677
+ }
678
+ scoreTerm(ptf, pdf || 1, poff);
679
+ }
680
+ }
681
+ if (matchedCount === 0) continue;
682
+ if (match === "all" && matchedCount < required) continue;
683
+ const hit = {
684
+ id: doc.id,
685
+ score,
686
+ field: doc.field,
687
+ text: doc.text,
688
+ offset: snippetOffset < 0 ? 0 : snippetOffset,
689
+ ...doc.locale !== void 0 ? { locale: doc.locale } : {}
690
+ };
691
+ const prev = best.get(doc.id);
692
+ if (!prev || hit.score > prev.score) best.set(doc.id, hit);
693
+ }
694
+ const results = [...best.values()].sort((a, b) => b.score - a.score);
695
+ return opts.limit !== void 0 ? results.slice(0, opts.limit) : results;
696
+ }
697
+ toSnapshot() {
698
+ return {
699
+ v: 1,
700
+ fieldStats: [...this.fieldStats].map(([f, s]) => [f, { df: [...s.df], n: s.n, totalLen: s.totalLen }]),
701
+ docs: this.docs.map((d) => ({
702
+ id: d.id,
703
+ field: d.field,
704
+ text: d.text,
705
+ len: d.len,
706
+ tf: [...d.tf],
707
+ firstOffset: [...d.firstOffset],
708
+ ...d.locale !== void 0 ? { locale: d.locale } : {}
709
+ }))
710
+ };
711
+ }
712
+ static fromSnapshot(s) {
713
+ const idx = new _InvertedIndex();
714
+ for (const [f, st] of s.fieldStats) idx.fieldStats.set(f, { df: new Map(st.df), n: st.n, totalLen: st.totalLen });
715
+ for (const d of s.docs) {
716
+ idx.docs.push({
717
+ id: d.id,
718
+ field: d.field,
719
+ text: d.text,
720
+ len: d.len,
721
+ tf: new Map(d.tf),
722
+ firstOffset: new Map(d.firstOffset),
723
+ ...d.locale !== void 0 ? { locale: d.locale } : {}
724
+ });
725
+ }
726
+ return idx;
727
+ }
728
+ };
729
+
730
+ // src/search/snippet.ts
731
+ function extractSnippet(text, offset, window = 80) {
732
+ const chars = Array.from(text);
733
+ if (chars.length <= window) return text;
734
+ const cpOffset = Array.from(text.slice(0, Math.max(0, offset))).length;
735
+ const half = Math.floor(window / 2);
736
+ let start = Math.max(0, cpOffset - half);
737
+ const end = Math.min(chars.length, start + window);
738
+ start = Math.max(0, end - window);
739
+ const body = chars.slice(start, end).join("");
740
+ return `${start > 0 ? "\u2026" : ""}${body}${end < chars.length ? "\u2026" : ""}`;
741
+ }
742
+
743
+ // src/search/index-store.ts
744
+ var MemoryIndexStore = class {
745
+ index;
746
+ get built() {
747
+ return this.index !== void 0;
748
+ }
749
+ async ensureBuilt(build) {
750
+ if (this.index === void 0) this.index = InvertedIndex.build(build());
751
+ return this.index;
752
+ }
753
+ markDirty() {
754
+ this.index = void 0;
755
+ }
756
+ async flush() {
757
+ }
758
+ };
759
+
760
+ // src/search/build-docs.ts
761
+ function buildStringFieldEntries(record, textIndexes, only) {
762
+ const fields = only ? textIndexes.filter((f) => only.includes(f)) : textIndexes;
763
+ const out = [];
764
+ for (const field of fields) {
765
+ for (const leaf of getAtPath(record, field)) {
766
+ if (typeof leaf === "string" && leaf !== "") out.push({ field, text: leaf });
767
+ }
768
+ }
769
+ return out;
770
+ }
771
+ function buildI18nFieldEntries(record, i18nFields, textIndexes, only) {
772
+ const fields = (only ? textIndexes.filter((f) => only.includes(f)) : textIndexes).filter((f) => f in i18nFields);
773
+ const out = [];
774
+ for (const field of fields) {
775
+ for (const leaf of getAtPath(record, field)) {
776
+ if (!leaf || typeof leaf !== "object" || Array.isArray(leaf)) continue;
777
+ for (const [locale, val] of Object.entries(leaf)) {
778
+ if (typeof val === "string" && val !== "") out.push({ field, locale, text: val });
779
+ }
780
+ }
781
+ }
782
+ return out;
783
+ }
784
+ function buildDictKeyFieldEntries(record, dictKeyFields, labelMaps, textIndexes, only) {
785
+ const fields = (only ? textIndexes.filter((f) => only.includes(f)) : textIndexes).filter((f) => f in dictKeyFields);
786
+ const out = [];
787
+ for (const field of fields) {
788
+ const map = labelMaps.get(field);
789
+ if (!map) continue;
790
+ for (const leaf of getAtPath(record, field)) {
791
+ const keys = typeof leaf === "string" ? [leaf] : Array.isArray(leaf) ? leaf.filter((k) => typeof k === "string") : [];
792
+ for (const key of keys) {
793
+ const labels = map.get(key);
794
+ if (!labels) continue;
795
+ for (const [locale, label] of Object.entries(labels)) {
796
+ if (label !== "") out.push({ field, locale, text: label });
797
+ }
798
+ }
799
+ }
800
+ }
801
+ return out;
802
+ }
803
+ function buildBlobFieldEntries(filenamesByField) {
804
+ const out = [];
805
+ for (const [field, names] of filenamesByField) {
806
+ for (const name of names) if (name !== "") out.push({ field, text: name });
807
+ }
808
+ return out;
809
+ }
810
+
811
+ // src/search/serialize.ts
812
+ function serializeIndex(idx) {
813
+ return JSON.stringify(idx.toSnapshot());
814
+ }
815
+ function deserializeIndex(json) {
816
+ return InvertedIndex.fromSnapshot(JSON.parse(json));
817
+ }
818
+
819
+ // src/search/persisted-index-store.ts
820
+ function fpEqual(a, b) {
821
+ return a.count === b.count && a.maxVersion === b.maxVersion;
822
+ }
823
+ var PersistedIndexStore = class {
824
+ constructor(cb) {
825
+ this.cb = cb;
826
+ this.debounceMs = cb.debounceMs ?? 1e3;
827
+ }
828
+ cb;
829
+ index;
830
+ timer = null;
831
+ lastBuild;
832
+ debounceMs;
833
+ get built() {
834
+ return this.index !== void 0;
835
+ }
836
+ async ensureBuilt(build) {
837
+ this.lastBuild = build;
838
+ if (this.index !== void 0) return this.index;
839
+ const loaded = await this.cb.load();
840
+ if (loaded !== null && fpEqual(loaded.fingerprint, this.cb.currentFingerprint())) {
841
+ this.index = deserializeIndex(loaded.json);
842
+ return this.index;
843
+ }
844
+ this.index = InvertedIndex.build(build());
845
+ await this.persist();
846
+ return this.index;
847
+ }
848
+ markDirty() {
849
+ this.index = void 0;
850
+ if (this.timer) clearTimeout(this.timer);
851
+ this.timer = setTimeout(() => {
852
+ this.timer = null;
853
+ void this.rebuildAndPersist().catch(() => {
854
+ });
855
+ }, this.debounceMs);
856
+ }
857
+ /** Force an immediate persist (cancels any pending debounce). */
858
+ async flush() {
859
+ if (this.timer) {
860
+ clearTimeout(this.timer);
861
+ this.timer = null;
862
+ }
863
+ await this.rebuildAndPersist();
864
+ }
865
+ /** Delete the persisted blob and drop the in-memory index (forget/erasure). */
866
+ async removePersisted() {
867
+ if (this.timer) {
868
+ clearTimeout(this.timer);
869
+ this.timer = null;
870
+ }
871
+ this.index = void 0;
872
+ await this.cb.remove();
873
+ }
874
+ /** Rebuild using the last known build thunk, then persist. */
875
+ async rebuildAndPersist() {
876
+ if (this.lastBuild === void 0) return;
877
+ if (this.index === void 0) {
878
+ this.index = InvertedIndex.build(this.lastBuild());
879
+ }
880
+ await this.persist();
881
+ }
882
+ async persist() {
883
+ if (this.index === void 0) return;
884
+ await this.cb.save(serializeIndex(this.index), this.cb.currentFingerprint());
885
+ }
886
+ };
887
+
888
+ // src/embeddings/cosine.ts
889
+ function cosine(a, b) {
890
+ if (a.length !== b.length) return 0;
891
+ let dot = 0, na = 0, nb = 0;
892
+ for (let i = 0; i < a.length; i++) {
893
+ const x = a[i], y = b[i];
894
+ dot += x * y;
895
+ na += x * x;
896
+ nb += y * y;
897
+ }
898
+ if (na === 0 || nb === 0) return 0;
899
+ return dot / (Math.sqrt(na) * Math.sqrt(nb));
900
+ }
901
+
902
+ // src/embeddings/descriptor.ts
903
+ function embeddingSourceText(record, source) {
904
+ const fields = typeof source === "string" ? [source] : source;
905
+ const parts = [];
906
+ for (const f of fields) {
907
+ for (const leaf of getAtPath(record, f)) {
908
+ if (typeof leaf === "string" && leaf !== "") parts.push(leaf);
909
+ }
910
+ }
911
+ return parts.join(" ");
912
+ }
913
+
914
+ // src/embeddings/vector-set.ts
915
+ var VectorSet = class {
916
+ vectors;
917
+ get loaded() {
918
+ return this.vectors !== void 0;
919
+ }
920
+ async ensureLoaded(load) {
921
+ if (this.vectors === void 0) this.vectors = await load();
922
+ }
923
+ markDirty() {
924
+ this.vectors = void 0;
925
+ }
926
+ cosineTopK(query, k, opts = {}) {
927
+ const all = this.vectors ?? [];
928
+ const minScore = opts.minScore ?? -Infinity;
929
+ const hits = [];
930
+ for (const v of all) {
931
+ if (opts.expectModel !== void 0 && v.model !== opts.expectModel) {
932
+ throw new EmbeddingModelMismatchError(opts.expectModel, v.model);
933
+ }
934
+ const score = cosine(query, v.vec);
935
+ if (score >= minScore) hits.push({ id: v.id, score });
936
+ }
937
+ hits.sort((a, b) => b.score - a.score);
938
+ return hits.slice(0, k);
939
+ }
940
+ };
941
+
585
942
  // src/indexing/unique-constraints.ts
586
943
  var UniqueConstraintSet = class {
587
944
  constructor(collectionName, uniqueDefs) {
@@ -913,7 +1270,7 @@ async function resolveStaleOnRead(accessor, outputCollection, id) {
913
1270
  }
914
1271
  const sourceWithId = { ...source, id };
915
1272
  if (DerivationExecutor === null) {
916
- ({ DerivationExecutor } = await import("./executor-VEZUBJNQ.js"));
1273
+ ({ DerivationExecutor } = await import("./executor-DWVP4BSJ.js"));
917
1274
  }
918
1275
  const ctx = { vault: accessor.getReadOnlyFacade() };
919
1276
  const result = await DerivationExecutor.run(spec, sourceWithId, 0, strategyHash, ctx);
@@ -1111,6 +1468,33 @@ var Collection = class {
1111
1468
  * Declared via the `i18nFields` collection option.
1112
1469
  */
1113
1470
  i18nFields;
1471
+ /**
1472
+ * #308 L1 — the configured string fields exposed to `retrieve()`. `undefined`
1473
+ * for ordinary collections, so the search path costs nothing when unused.
1474
+ */
1475
+ textIndexes;
1476
+ /**
1477
+ * #308 L1 — the session-scoped lexical index store. `undefined` (so the dirty
1478
+ * poke + retrieve are zero-cost) unless `textIndexes` is non-empty.
1479
+ */
1480
+ searchIndexStore;
1481
+ /**
1482
+ * #435 — the densify-enabled subset of {@link i18nFields} (fields whose
1483
+ * descriptor opts in via `densifyOnWrite: true`). `undefined` when none opt
1484
+ * in, so the write path skips all densify work for ordinary collections.
1485
+ */
1486
+ i18nDensifyFields;
1487
+ /**
1488
+ * #308 L2 — embedding config for write-time vector derivation. `undefined`
1489
+ * for ordinary collections (zero cost). When set, `put()` encodes the
1490
+ * source field(s) and stores an encrypted `_vec` sidecar.
1491
+ */
1492
+ embeddings;
1493
+ /**
1494
+ * #308 L2 — in-memory vector set, populated lazily from `_vec` sidecars.
1495
+ * `undefined` when no embedding config is declared.
1496
+ */
1497
+ vectorSet;
1114
1498
  /**
1115
1499
  * Map of field name → `DictKeyDescriptor` for fields declared with
1116
1500
  * `dictKey()`. Used by `get()`/`list()` to add `<field>Label` virtual
@@ -1137,6 +1521,12 @@ var Collection = class {
1137
1521
  * Signature: `(dictName, key, locale, fallback?) => Promise<string | undefined>`
1138
1522
  */
1139
1523
  dictLabelResolver;
1524
+ /**
1525
+ * #308 L1 — async callback provided by the Vault to open a dynamic
1526
+ * dictionary handle (for label-map pre-computation in the search index).
1527
+ * Only used in `resolveDictLabelMaps()`; static dicts bypass this entirely.
1528
+ */
1529
+ getDictionary;
1140
1530
  /**
1141
1531
  * Synchronous callback provided by the Vault that validates
1142
1532
  * i18nText fields on `put()`. Throws `MissingTranslationError` when
@@ -1297,11 +1687,25 @@ var Collection = class {
1297
1687
  this.refEnforcer = opts.refEnforcer;
1298
1688
  this.joinResolver = opts.joinResolver;
1299
1689
  this.i18nFields = opts.i18nFields;
1690
+ this.textIndexes = opts.textIndexes;
1691
+ this.searchIndexStore = opts.textIndexes && opts.textIndexes.length > 0 ? opts.textIndexPersist ? new PersistedIndexStore(this.buildPersistedIndexCallbacks()) : new MemoryIndexStore() : void 0;
1692
+ const densifyFields = opts.i18nFields ? Object.fromEntries(
1693
+ Object.entries(opts.i18nFields).filter(([, d]) => d.options.densifyOnWrite === true)
1694
+ ) : {};
1695
+ this.i18nDensifyFields = Object.keys(densifyFields).length > 0 ? densifyFields : void 0;
1696
+ if (opts.embeddings && opts.crdt) {
1697
+ throw new Error(
1698
+ `Collection "${opts.name}": embeddings are not supported on CRDT collections (L2). Use a non-CRDT collection for semantic search.`
1699
+ );
1700
+ }
1701
+ this.embeddings = opts.embeddings;
1702
+ this.vectorSet = opts.embeddings ? new VectorSet() : void 0;
1300
1703
  this.dictKeyFields = opts.dictKeyFields;
1301
1704
  if (opts.moneyFields) validateMoneyFieldPaths(opts.moneyFields);
1302
1705
  this.moneyFields = opts.moneyFields;
1303
1706
  this.computed = opts.computed;
1304
1707
  this.dictLabelResolver = opts.dictLabelResolver;
1708
+ this.getDictionary = opts.getDictionary;
1305
1709
  this.i18nPutValidator = opts.i18nPutValidator;
1306
1710
  this.autoTranslateHook = opts.autoTranslateHook;
1307
1711
  this.defaultLocale = opts.defaultLocale;
@@ -1470,7 +1874,7 @@ var Collection = class {
1470
1874
  }
1471
1875
  }
1472
1876
  if (this.materializedViewSource !== void 0) {
1473
- const { resolveStaleMVOnRead } = await import("./stale-KKCHF2VB.js");
1877
+ const { resolveStaleMVOnRead } = await import("./stale-IIIGOHBW.js");
1474
1878
  await resolveStaleMVOnRead(this.materializedViewSource, this.name);
1475
1879
  }
1476
1880
  let record;
@@ -1616,6 +2020,32 @@ var Collection = class {
1616
2020
  if (busAfterPut) await this.subsystemBus.dispatch("afterPut", event);
1617
2021
  }
1618
2022
  }
2023
+ /**
2024
+ * #435 — resolve the prior stored record (with its `_i18nFilled` marker) for
2025
+ * densify. Eager: in-memory cache; lazy: LRU then adapter. undefined if absent.
2026
+ */
2027
+ async resolveDensifyPrior(id) {
2028
+ if (this.lazy && this.lru) {
2029
+ const cached = this.lru.get(id);
2030
+ if (cached) return cached.record;
2031
+ const env = await this.adapter.get(this.vault, this.name, id);
2032
+ if (!env) return void 0;
2033
+ const rec = await this.decryptRecord(env);
2034
+ return rec === null ? void 0 : rec;
2035
+ }
2036
+ await this.ensureHydrated();
2037
+ return this.cache.get(id)?.record;
2038
+ }
2039
+ /**
2040
+ * #435 — densify provenance for a record: which i18n slots were auto-filled,
2041
+ * e.g. `{ name: ['en'] }`. undefined when nothing was filled. The marker is
2042
+ * stripped from ordinary reads; this is the sanctioned audit accessor.
2043
+ */
2044
+ async i18nProvenance(id) {
2045
+ const prior = await this.resolveDensifyPrior(id);
2046
+ const marker = prior?.["_i18nFilled"];
2047
+ return marker && Object.keys(marker).length > 0 ? marker : void 0;
2048
+ }
1619
2049
  /**
1620
2050
  * Validate a record against this collection's schema WITHOUT writing it.
1621
2051
  * Returns the (possibly coerced) record on success; throws
@@ -1730,6 +2160,16 @@ var Collection = class {
1730
2160
  setAtPathInPlace(obj, field, translated);
1731
2161
  }
1732
2162
  }
2163
+ let densifyPrior;
2164
+ let exemptFills;
2165
+ if (this.i18nDensifyFields) {
2166
+ densifyPrior = await this.resolveDensifyPrior(id);
2167
+ exemptFills = this.i18nStrategy.computeExemptFills(
2168
+ densifyPrior,
2169
+ record,
2170
+ this.i18nDensifyFields
2171
+ );
2172
+ }
1733
2173
  if (this.i18nFields) {
1734
2174
  const obj = record;
1735
2175
  for (const [field, descriptor] of Object.entries(this.i18nFields)) {
@@ -1737,18 +2177,38 @@ var Collection = class {
1737
2177
  for (const leaf of getAtPath(obj, field)) {
1738
2178
  if (!leaf || typeof leaf !== "object" || Array.isArray(leaf)) continue;
1739
2179
  const leafMap = leaf;
1740
- const { value: cleaned } = this.i18nStrategy.enforceScript(
2180
+ const { value: cleaned, warnings } = this.i18nStrategy.enforceScript(
1741
2181
  leafMap,
1742
2182
  field,
1743
- descriptor
2183
+ descriptor,
2184
+ exemptFills?.get(field)
1744
2185
  );
1745
2186
  if (cleaned !== leafMap) Object.assign(leafMap, cleaned);
2187
+ const mode = descriptor.options.onScriptViolation;
2188
+ if (mode === "warn" || mode === "filter") {
2189
+ for (const w of warnings) {
2190
+ this.emitter.emit("i18n:script-violation", {
2191
+ vault: this.vault,
2192
+ collection: this.name,
2193
+ id,
2194
+ mode,
2195
+ warning: w
2196
+ });
2197
+ }
2198
+ }
1746
2199
  }
1747
2200
  }
1748
2201
  }
1749
2202
  if (this.i18nPutValidator !== void 0) {
1750
2203
  this.i18nPutValidator(record);
1751
2204
  }
2205
+ if (this.i18nDensifyFields) {
2206
+ this.i18nStrategy.densify(
2207
+ record,
2208
+ densifyPrior,
2209
+ this.i18nDensifyFields
2210
+ );
2211
+ }
1752
2212
  if (this.refEnforcer !== void 0) {
1753
2213
  await this.refEnforcer.enforceRefsOnPut(this.name, record);
1754
2214
  }
@@ -1827,6 +2287,7 @@ var Collection = class {
1827
2287
  }
1828
2288
  await this.onDirty?.(this.name, id, "put", version2);
1829
2289
  this.emitter.emit("change", { vault: this.vault, collection: this.name, id, action: "put" });
2290
+ this.searchIndexStore?.markDirty();
1830
2291
  await this.onAccess?.("put", id);
1831
2292
  await this.dispatchDerivations(id, record, version2);
1832
2293
  await this.dispatchMaterializedViews(id, record);
@@ -1868,6 +2329,15 @@ var Collection = class {
1868
2329
  }
1869
2330
  const envelope = await this.encryptRecord(record, version, cek, options?.source, options?.sourceTs);
1870
2331
  await this.adapter.put(this.vault, this.name, id, envelope);
2332
+ if (this.embeddings) {
2333
+ const text = embeddingSourceText(record, this.embeddings.source);
2334
+ const vec = await this.embeddings.encode(text);
2335
+ if (vec.length !== this.embeddings.dim) throw new EmbeddingDimMismatchError("embeddings", this.embeddings.dim, vec.length);
2336
+ const body = JSON.stringify({ vec: Array.from(vec), model: this.embeddings.model, dim: this.embeddings.dim });
2337
+ const vecEnv = await this.encryptJsonString(body, version);
2338
+ await this.adapter.put(this.vault, "_vec", id, vecEnv);
2339
+ this.vectorSet?.markDirty();
2340
+ }
1871
2341
  if (this.ledger) {
1872
2342
  const appendInput = {
1873
2343
  op: "put",
@@ -1898,6 +2368,7 @@ var Collection = class {
1898
2368
  id,
1899
2369
  action: "put"
1900
2370
  });
2371
+ this.searchIndexStore?.markDirty();
1901
2372
  await this.onAccess?.("put", id);
1902
2373
  await this.dispatchDerivations(id, record, version);
1903
2374
  await this.dispatchMaterializedViews(id, record);
@@ -1929,7 +2400,7 @@ var Collection = class {
1929
2400
  if (mode === "eager") {
1930
2401
  if (executor === null) {
1931
2402
  ;
1932
- ({ MaterializedViewExecutor: executor } = await import("./executor-BIW4FT5R.js"));
2403
+ ({ MaterializedViewExecutor: executor } = await import("./executor-HB2YMIYC.js"));
1933
2404
  }
1934
2405
  await executor.refresh(reg, {
1935
2406
  getCollection: (name) => this.materializedViewSource.getCollection(name),
@@ -1938,7 +2409,7 @@ var Collection = class {
1938
2409
  });
1939
2410
  } else if (mode === "lazy") {
1940
2411
  if (staleHelpers === null) {
1941
- staleHelpers = await import("./stale-KKCHF2VB.js");
2412
+ staleHelpers = await import("./stale-IIIGOHBW.js");
1942
2413
  }
1943
2414
  staleHelpers.markMVStale(registry, reg.spec.name);
1944
2415
  }
@@ -2112,7 +2583,7 @@ var Collection = class {
2112
2583
  continue;
2113
2584
  }
2114
2585
  if (DerivationExecutor === null) {
2115
- ({ DerivationExecutor } = await import("./executor-VEZUBJNQ.js"));
2586
+ ({ DerivationExecutor } = await import("./executor-DWVP4BSJ.js"));
2116
2587
  }
2117
2588
  for (const run of runs) {
2118
2589
  const ctx = { vault: this.derivationSource.getReadOnlyFacade() };
@@ -2131,7 +2602,7 @@ var Collection = class {
2131
2602
  const outputCollection = this.derivationSource.getCollection(outSpec.collection);
2132
2603
  const txCtx = this.derivationSource.getActiveTxContext();
2133
2604
  if (out.kind === "array") {
2134
- const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-OC4QVTS2.js");
2605
+ const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-BMT7I6FI.js");
2135
2606
  const prior = await loadFanoutSidecar(
2136
2607
  this.adapter,
2137
2608
  this.vault,
@@ -2421,6 +2892,7 @@ var Collection = class {
2421
2892
  id,
2422
2893
  action: "delete"
2423
2894
  });
2895
+ this.searchIndexStore?.markDirty();
2424
2896
  await this.onAccess?.("delete", id);
2425
2897
  if (!internal) {
2426
2898
  await this.dispatchMaterializedViewsOnDelete(id);
@@ -2494,7 +2966,7 @@ var Collection = class {
2494
2966
  for (const [outputKey, outSpec] of Object.entries(spec.outputs)) {
2495
2967
  if (outSpec.shape !== "array") continue;
2496
2968
  if (helpers === null) {
2497
- helpers = await import("./fanout-sidecar-OC4QVTS2.js");
2969
+ helpers = await import("./fanout-sidecar-BMT7I6FI.js");
2498
2970
  }
2499
2971
  const sidecar = await helpers.loadFanoutSidecar(
2500
2972
  this.adapter,
@@ -2534,7 +3006,7 @@ var Collection = class {
2534
3006
  if (mode === "eager") {
2535
3007
  if (executor === null) {
2536
3008
  ;
2537
- ({ MaterializedViewExecutor: executor } = await import("./executor-BIW4FT5R.js"));
3009
+ ({ MaterializedViewExecutor: executor } = await import("./executor-HB2YMIYC.js"));
2538
3010
  }
2539
3011
  await executor.refresh(reg, {
2540
3012
  getCollection: (name) => this.materializedViewSource.getCollection(name),
@@ -2543,7 +3015,7 @@ var Collection = class {
2543
3015
  });
2544
3016
  } else if (mode === "lazy") {
2545
3017
  if (staleHelpers === null) {
2546
- staleHelpers = await import("./stale-KKCHF2VB.js");
3018
+ staleHelpers = await import("./stale-IIIGOHBW.js");
2547
3019
  }
2548
3020
  staleHelpers.markMVStale(registry, reg.spec.name);
2549
3021
  }
@@ -2566,7 +3038,7 @@ var Collection = class {
2566
3038
  );
2567
3039
  }
2568
3040
  if (this.materializedViewSource !== void 0) {
2569
- const { resolveStaleMVOnRead } = await import("./stale-KKCHF2VB.js");
3041
+ const { resolveStaleMVOnRead } = await import("./stale-IIIGOHBW.js");
2570
3042
  await resolveStaleMVOnRead(this.materializedViewSource, this.name);
2571
3043
  }
2572
3044
  await this.ensureHydrated();
@@ -2602,9 +3074,255 @@ var Collection = class {
2602
3074
  }
2603
3075
  await this.ensureHydrated();
2604
3076
  const entries = [];
2605
- for (const [id, e] of this.cache) entries.push({ id, record: e.record });
3077
+ for (const [id, e] of this.cache) entries.push({ id, record: stripI18nFilled(e.record) });
2606
3078
  return searchScan(entries, field, query, opts);
2607
3079
  }
3080
+ /** #308 L1 — build IndexDoc[] for the configured text fields over the live cache. */
3081
+ buildRetrievalDocs(labelMaps, blobFilenames, only) {
3082
+ const docs = [];
3083
+ for (const [id, e] of this.cache) {
3084
+ const rec = stripI18nFilled(e.record);
3085
+ const fields = buildStringFieldEntries(rec, this.textIndexes ?? [], only);
3086
+ if (this.i18nFields) fields.push(...buildI18nFieldEntries(rec, this.i18nFields, this.textIndexes ?? [], only));
3087
+ if (this.dictKeyFields) fields.push(...buildDictKeyFieldEntries(rec, this.dictKeyFields, labelMaps, this.textIndexes ?? [], only));
3088
+ const blobNames = blobFilenames.get(id);
3089
+ if (blobNames) fields.push(...buildBlobFieldEntries(blobNames));
3090
+ if (fields.length > 0) docs.push({ id, fields });
3091
+ }
3092
+ return docs;
3093
+ }
3094
+ /** #308 L1 — true iff any configured text index is also a blob field (gates ALL slot I/O). */
3095
+ hasIndexedBlobFields(only) {
3096
+ if (!this.blobFields || !this.textIndexes) return false;
3097
+ const fields = only ? this.textIndexes.filter((f) => only.includes(f)) : this.textIndexes;
3098
+ return fields.some((f) => f in this.blobFields);
3099
+ }
3100
+ /**
3101
+ * #308 L1 — resolve `recordId -> (blobField -> filenames[])` by listing slots
3102
+ * for the configured blob fields of each cached record. Blob slot metadata is
3103
+ * NOT inline on the record: it lives in a separate `_blob_slots_*` collection,
3104
+ * so this costs ONE `blob(id).list()` (a `listSlots`) per record at build time
3105
+ * — the heaviest indexing source. Fully gated by {@link hasIndexedBlobFields};
3106
+ * non-blob (and blob-but-not-indexed) collections do ZERO slot I/O.
3107
+ */
3108
+ async resolveBlobFilenames(only) {
3109
+ const out = /* @__PURE__ */ new Map();
3110
+ if (!this.hasIndexedBlobFields(only)) return out;
3111
+ const indexed = (only ? this.textIndexes.filter((f) => only.includes(f)) : this.textIndexes).filter((f) => f in this.blobFields);
3112
+ const indexedSet = new Set(indexed);
3113
+ for (const id of this.cache.keys()) {
3114
+ let slots;
3115
+ try {
3116
+ slots = await this.blob(id).list();
3117
+ } catch {
3118
+ continue;
3119
+ }
3120
+ let byField;
3121
+ for (const slot of slots) {
3122
+ if (!indexedSet.has(slot.name) || !slot.filename) continue;
3123
+ if (!byField) {
3124
+ byField = /* @__PURE__ */ new Map();
3125
+ out.set(id, byField);
3126
+ }
3127
+ const names = byField.get(slot.name);
3128
+ if (names) names.push(slot.filename);
3129
+ else byField.set(slot.name, [slot.filename]);
3130
+ }
3131
+ }
3132
+ return out;
3133
+ }
3134
+ /** #308 L1 — field -> (key -> {locale->label}) for dictKey fields; static from table, dynamic via getDictionary().list(). */
3135
+ async resolveDictLabelMaps() {
3136
+ const maps = /* @__PURE__ */ new Map();
3137
+ if (!this.dictKeyFields || !this.textIndexes) return maps;
3138
+ for (const field of this.textIndexes) {
3139
+ const desc = this.dictKeyFields[field];
3140
+ if (!desc) continue;
3141
+ const m = /* @__PURE__ */ new Map();
3142
+ if (isStaticDictDescriptor(desc)) {
3143
+ for (const [key, labels] of Object.entries(desc.table)) m.set(key, labels);
3144
+ } else {
3145
+ if (this.getDictionary) {
3146
+ const handle = await this.getDictionary(desc.name);
3147
+ for (const e of await handle.list()) m.set(e.key, e.labels);
3148
+ }
3149
+ }
3150
+ maps.set(field, m);
3151
+ }
3152
+ return maps;
3153
+ }
3154
+ /** #308 L1.5 — force-persist the lexical index now (e.g. on save/idle). Persists only when textIndexPersist is enabled; a no-op otherwise. */
3155
+ async flushIndex() {
3156
+ if (!this.searchIndexStore) return;
3157
+ await this.ensureHydrated();
3158
+ const labelMaps = await this.resolveDictLabelMaps();
3159
+ const blobFilenames = await this.resolveBlobFilenames();
3160
+ await this.searchIndexStore.ensureBuilt(() => this.buildRetrievalDocs(labelMaps, blobFilenames));
3161
+ await this.searchIndexStore.flush?.();
3162
+ }
3163
+ /** #308 L2 — load + decrypt all _vec sidecars into StoredVector[] for the VectorSet. */
3164
+ buildVectorLoad() {
3165
+ return async () => {
3166
+ const ids = await this.adapter.list(this.vault, "_vec");
3167
+ const out = [];
3168
+ for (const id of ids) {
3169
+ const env = await this.adapter.get(this.vault, "_vec", id);
3170
+ if (!env) continue;
3171
+ const body = await this.decryptJsonString(env);
3172
+ if (body === null) continue;
3173
+ const parsed = JSON.parse(body);
3174
+ out.push({ id, vec: new Float32Array(parsed.vec), model: parsed.model });
3175
+ }
3176
+ return out;
3177
+ };
3178
+ }
3179
+ /**
3180
+ * #308 L1.5 — build the PersistedIndexCallbacks bridge: crypto lives here
3181
+ * (collection has getDEK / encryptJsonString / decryptJsonString / adapter),
3182
+ * the index store itself is crypto-free.
3183
+ *
3184
+ * Fingerprint encoding: body-wrap approach — save(json, fp) stores
3185
+ * JSON.stringify({ fp, idx: json }) as the encrypted body so the standard
3186
+ * EncryptedEnvelope shape is never extended. load() decrypts and JSON.parses
3187
+ * the wrapper back out.
3188
+ *
3189
+ * Cache shape: this.cache stores { record, version } — currentFingerprint()
3190
+ * iterates over e.version.
3191
+ */
3192
+ buildPersistedIndexCallbacks() {
3193
+ const FT = "_ftindex";
3194
+ return {
3195
+ load: async () => {
3196
+ const env = await this.adapter.get(this.vault, FT, this.name);
3197
+ if (!env) return null;
3198
+ const body = await this.decryptJsonString(env);
3199
+ if (body === null) return null;
3200
+ try {
3201
+ const wrapped = JSON.parse(body);
3202
+ return { json: wrapped.idx, fingerprint: wrapped.fp };
3203
+ } catch {
3204
+ return null;
3205
+ }
3206
+ },
3207
+ save: async (json, fp) => {
3208
+ const body = JSON.stringify({ fp, idx: json });
3209
+ const env = await this.encryptJsonString(body, fp.count);
3210
+ await this.adapter.put(this.vault, FT, this.name, env);
3211
+ },
3212
+ remove: async () => {
3213
+ await this.adapter.delete(this.vault, FT, this.name);
3214
+ },
3215
+ currentFingerprint: () => {
3216
+ let maxVersion = 0;
3217
+ for (const e of this.cache.values()) if (e.version > maxVersion) maxVersion = e.version;
3218
+ return { count: this.cache.size, maxVersion };
3219
+ }
3220
+ };
3221
+ }
3222
+ /** #308 L1 — pre-build the lexical index (e.g. on open) so the first retrieve() pays no build scan. */
3223
+ async warmIndex() {
3224
+ if (!this.searchIndexStore) return;
3225
+ if (this.lazy) {
3226
+ throw new Error(
3227
+ `Collection "${this.name}": warmIndex() requires eager mode (prefetch: true).`
3228
+ );
3229
+ }
3230
+ await this.ensureHydrated();
3231
+ const built = this.searchIndexStore.built;
3232
+ const labelMaps = built ? /* @__PURE__ */ new Map() : await this.resolveDictLabelMaps();
3233
+ const blobFilenames = built ? /* @__PURE__ */ new Map() : await this.resolveBlobFilenames();
3234
+ await this.searchIndexStore.ensureBuilt(() => this.buildRetrievalDocs(labelMaps, blobFilenames));
3235
+ }
3236
+ /** #308 — retrieval. mode: 'lexical' (default) | 'semantic' (L2) | 'hybrid' (L3). */
3237
+ async retrieve(query, opts = {}) {
3238
+ const hits = opts.mode === "semantic" ? await this.retrieveSemantic(query, opts) : opts.mode === "hybrid" ? await this.retrieveHybrid(query, opts) : await this.retrieveLexical(query, opts);
3239
+ return opts.within ? this.applyWithin(hits, opts.within) : hits;
3240
+ }
3241
+ /** #308 L3 — keep only hits whose id matches the structured query, re-rank 1-based. */
3242
+ applyWithin(hits, within) {
3243
+ const ids = new Set(within._idArray());
3244
+ return hits.filter((h) => ids.has(h.id)).map((h, i) => ({ ...h, rank: i + 1 }));
3245
+ }
3246
+ /** #308 L1 — client-side lexical retrieval; ranked { id, score, field, snippet, locale? }. */
3247
+ async retrieveLexical(query, opts) {
3248
+ if (!this.searchIndexStore) {
3249
+ throw new Error(`Collection "${this.name}": retrieve() requires a textIndexes config.`);
3250
+ }
3251
+ if (this.lazy) {
3252
+ throw new Error(
3253
+ `Collection "${this.name}": retrieve() requires eager mode (prefetch: true).`
3254
+ );
3255
+ }
3256
+ await this.ensureHydrated();
3257
+ const built = this.searchIndexStore.built;
3258
+ const labelMaps = built ? /* @__PURE__ */ new Map() : await this.resolveDictLabelMaps();
3259
+ const blobFilenames = built ? /* @__PURE__ */ new Map() : await this.resolveBlobFilenames();
3260
+ const index = await this.searchIndexStore.ensureBuilt(() => this.buildRetrievalDocs(labelMaps, blobFilenames));
3261
+ const hits = index.query(query, {
3262
+ ...opts.limit !== void 0 ? { limit: opts.limit } : {},
3263
+ ...opts.match ? { match: opts.match } : {},
3264
+ ...opts.prefix ? { prefix: opts.prefix } : {},
3265
+ ...opts.fields ? { fields: opts.fields } : {}
3266
+ });
3267
+ const window = opts.snippetWindow ?? 80;
3268
+ return hits.map((h, i) => {
3269
+ const base = {
3270
+ id: h.id,
3271
+ score: h.score,
3272
+ rank: i + 1,
3273
+ field: h.field,
3274
+ snippet: extractSnippet(h.text, h.offset, window),
3275
+ ...h.locale !== void 0 ? { locale: h.locale } : {},
3276
+ ...opts.includeRecord ? (() => {
3277
+ const e = this.cache.get(h.id);
3278
+ return e ? { record: stripI18nFilled(e.record) } : {};
3279
+ })() : {}
3280
+ };
3281
+ return base;
3282
+ });
3283
+ }
3284
+ /** #308 L3 — hybrid: fuse lexical (L1) + semantic (L2) by RRF. Requires embeddings. */
3285
+ async retrieveHybrid(query, opts) {
3286
+ if (!this.embeddings) {
3287
+ throw new Error(`Collection "${this.name}": retrieve({mode:'hybrid'}) requires an embeddings config.`);
3288
+ }
3289
+ const [lex, sem] = await Promise.all([
3290
+ this.retrieveLexical(query, opts),
3291
+ this.retrieveSemantic(query, opts)
3292
+ ]);
3293
+ return fuseRetrieval([lex, sem], opts.limit !== void 0 ? { limit: opts.limit } : {});
3294
+ }
3295
+ /** #308 L2 — semantic branch of retrieve(): encode query → similarTo(). */
3296
+ async retrieveSemantic(query, opts) {
3297
+ if (!this.embeddings) throw new Error(`Collection "${this.name}": retrieve({mode:'semantic'}) requires an embeddings config.`);
3298
+ if (this.lazy) throw new Error(`Collection "${this.name}": retrieve() requires eager mode (prefetch: true).`);
3299
+ const qVec = await this.embeddings.encode(query);
3300
+ return this.similarTo(qVec, {
3301
+ ...opts.limit !== void 0 ? { k: opts.limit } : {},
3302
+ ...opts.minScore !== void 0 ? { minScore: opts.minScore } : {},
3303
+ ...opts.includeRecord ? { includeRecord: true } : {}
3304
+ });
3305
+ }
3306
+ /** #308 L2 — raw-vector kNN over the encrypted vector set (decrypted in the trusted tier).
3307
+ * Snippet is '' for vector hits in v1 (semantic match isn't span-located). */
3308
+ async similarTo(vector, opts = {}) {
3309
+ if (!this.embeddings || !this.vectorSet) throw new Error(`Collection "${this.name}": similarTo() requires an embeddings config.`);
3310
+ if (this.lazy) throw new Error(`Collection "${this.name}": similarTo() requires eager mode (prefetch: true).`);
3311
+ await this.ensureHydrated();
3312
+ await this.vectorSet.ensureLoaded(this.buildVectorLoad());
3313
+ const hits = this.vectorSet.cosineTopK(vector, opts.k ?? 10, {
3314
+ ...opts.minScore !== void 0 ? { minScore: opts.minScore } : {},
3315
+ expectModel: this.embeddings.model
3316
+ });
3317
+ return hits.map((h, i) => {
3318
+ const base = { id: h.id, score: h.score, rank: i + 1, field: "(vector)", snippet: "" };
3319
+ if (opts.includeRecord) {
3320
+ const e = this.cache.get(h.id);
3321
+ if (e) base.record = stripI18nFilled(e.record);
3322
+ }
3323
+ return base;
3324
+ });
3325
+ }
2608
3326
  // ─── Bulk operations ─────────────────────────────────────
2609
3327
  /**
2610
3328
  * Put many records in one call. Each item is processed sequentially
@@ -2774,6 +3492,7 @@ var Collection = class {
2774
3492
  // back to a linear scan otherwise.
2775
3493
  getIndexes: () => this.getIndexes(),
2776
3494
  lookupById: (id) => this.cache.get(id)?.record,
3495
+ snapshotEntries: () => [...this.cache.entries()].map(([id, e]) => ({ id, record: e.record })),
2777
3496
  ...this.moneyFields ? { moneyFields: this.moneyFields } : {}
2778
3497
  };
2779
3498
  const resolver = this.joinResolver;
@@ -3204,6 +3923,7 @@ var Collection = class {
3204
3923
  async _applyRemoteChange(id, action) {
3205
3924
  await this._invalidateCacheEntry(id);
3206
3925
  this.emitter.emit("change", { vault: this.vault, collection: this.name, id, action });
3926
+ this.searchIndexStore?.markDirty();
3207
3927
  }
3208
3928
  /** @internal — the current in-memory record without a store read (for conflict capture). */
3209
3929
  _peekCached(id) {
@@ -3516,7 +4236,7 @@ var Collection = class {
3516
4236
  const hasStaticDisplay = hasDict && this.dictKeyFields !== void 0 && Object.values(this.dictKeyFields).some(
3517
4237
  (d) => isStaticDictDescriptor(d) && d.displayLocale !== void 0
3518
4238
  );
3519
- if (!locale && !hasStaticDisplay) return result;
4239
+ if (!locale && !hasStaticDisplay) return stripI18nFilled(result);
3520
4240
  const layer = localeOpts?._layer ?? "read";
3521
4241
  if (locale && hasI18n && this.i18nFields) {
3522
4242
  result = this.i18nStrategy.applyI18nLocale(result, this.i18nFields, locale, localeOpts?.fallback, layer);
@@ -3583,7 +4303,7 @@ var Collection = class {
3583
4303
  }
3584
4304
  result = withLabels;
3585
4305
  }
3586
- return result;
4306
+ return stripI18nFilled(result);
3587
4307
  }
3588
4308
  /**
3589
4309
  * Low-level: encrypt a pre-serialised JSON string into an EncryptedEnvelope.
@@ -3702,6 +4422,19 @@ var Collection = class {
3702
4422
  }
3703
4423
  return { purged, residue };
3704
4424
  }
4425
+ /** #308 L2 — drop a record's encrypted _vec sidecar on erasure (a vector is text-invertible).
4426
+ * Called by vault.ts forget() inside a resilient try/catch; residue is reported in ForgetResult. */
4427
+ async _purgeVector(id) {
4428
+ await this.adapter.delete(this.vault, "_vec", id);
4429
+ this.vectorSet?.markDirty();
4430
+ }
4431
+ /** #308 L1.5 — drop the persisted lexical-index blob (forget/erasure): an opaque
4432
+ * all-records index must not survive crypto-shred. Idempotent; no-op without persist. */
4433
+ async _purgeSearchIndex() {
4434
+ const store = this.searchIndexStore;
4435
+ if (store && "removePersisted" in store) await store.removePersisted();
4436
+ else store?.markDirty();
4437
+ }
3705
4438
  /**
3706
4439
  * Bulk-load the persisted-index mirror from `_idx/<field>/*` side-cars
3707
4440
  * on first lazy-mode query. Idempotent — subsequent calls short-circuit
@@ -6966,6 +7699,10 @@ var Vault = class {
6966
7699
  collOpts.onCrossTierAccess = (event) => this.emitCrossTier(event);
6967
7700
  if (this.syncAdapter !== void 0) collOpts.syncAdapter = this.syncAdapter;
6968
7701
  if (options?.i18nFields !== void 0) collOpts.i18nFields = options.i18nFields;
7702
+ if (options?.embeddings !== void 0) collOpts.embeddings = options.embeddings;
7703
+ if (options?.textIndexes !== void 0) collOpts.textIndexes = options.textIndexes;
7704
+ if (options?.warmIndexOnOpen !== void 0) collOpts.warmIndexOnOpen = options.warmIndexOnOpen;
7705
+ if (options?.textIndexPersist !== void 0) collOpts.textIndexPersist = options.textIndexPersist;
6969
7706
  if (options?.moneyFields !== void 0) collOpts.moneyFields = options.moneyFields;
6970
7707
  if (options?.computed !== void 0) collOpts.computed = options.computed;
6971
7708
  if (options?.dictKeyFields !== void 0) {
@@ -6978,6 +7715,7 @@ var Vault = class {
6978
7715
  const handle = this.dictionary(dictName);
6979
7716
  return handle.resolveLabel(key, locale, fallback);
6980
7717
  };
7718
+ collOpts.getDictionary = async (name) => this.dictionary(name);
6981
7719
  collOpts.dictKeyFields = options.dictKeyFields;
6982
7720
  }
6983
7721
  if (options?.i18nFields !== void 0 || options?.dictKeyFields !== void 0) {
@@ -6991,6 +7729,10 @@ var Vault = class {
6991
7729
  }
6992
7730
  coll = new Collection(collOpts);
6993
7731
  this.collectionCache.set(collectionName, coll);
7732
+ if (options?.warmIndexOnOpen === true && options.prefetch !== false) {
7733
+ void coll.warmIndex().catch(() => {
7734
+ });
7735
+ }
6994
7736
  if (options?.persistJsonSchema === true && options.schema !== void 0 && (options.schemaUpdate?.length ?? 0) === 0) {
6995
7737
  const validator = options.schema;
6996
7738
  const work = (async () => {
@@ -7100,6 +7842,16 @@ var Vault = class {
7100
7842
  this.#fenceWatcher = void 0;
7101
7843
  this.#fenceCoordinationStarted = false;
7102
7844
  }
7845
+ /** @internal #308 L1.5 — best-effort flush of all open collections' persisted
7846
+ * lexical indexes on close(). Called fire-and-forget from noydb.close().
7847
+ * Correctness is backstopped by the fingerprint: a missed flush → rebuild on
7848
+ * next load. Only collections with textIndexPersist have a flush(); others no-op. */
7849
+ async _flushSearchIndexes() {
7850
+ for (const coll of this.collectionCache.values()) {
7851
+ await coll.flushIndex().catch(() => {
7852
+ });
7853
+ }
7854
+ }
7103
7855
  /** @internal Drive one heartbeat + watch cycle deterministically (tests). */
7104
7856
  async _fenceTick() {
7105
7857
  this._ensureFenceCoordination();
@@ -7646,12 +8398,12 @@ var Vault = class {
7646
8398
  if (!fieldSchema) {
7647
8399
  throw new AttestationError(`issueAttestation: collection '${collectionName}' has no attestation field-schema. Declare it via vault.collection('${collectionName}', { attestation: { fields: [...] } }).`);
7648
8400
  }
7649
- const { issueAttestationCore } = await import("./issue-ZZ2XPOGP.js");
8401
+ const { issueAttestationCore } = await import("./issue-FZRTVGRE.js");
7650
8402
  const out = await issueAttestationCore(this.makeIssueContext(), { collection: collectionName, id, fieldSchema });
7651
8403
  return { docId: out.docId, qr: out.qr, keyId: out.keyId, publicKeyB64: out.publicKeyB64 };
7652
8404
  }
7653
8405
  async getDocumentSigningPublicKey() {
7654
- const { loadSigner, loadOrCreateSigner } = await import("./signer-SCJ6C6HQ.js");
8406
+ const { loadSigner, loadOrCreateSigner } = await import("./signer-JMK6W2Y6.js");
7655
8407
  const existing = await loadSigner(this.adapter, this.name, this.getDEK);
7656
8408
  if (existing) return { keyId: existing.keyId, publicKeyB64: existing.publicKeyB64 };
7657
8409
  if (this.keyring.role !== "owner") {
@@ -7677,19 +8429,19 @@ var Vault = class {
7677
8429
  };
7678
8430
  }
7679
8431
  async revokeAttestation(docId) {
7680
- const { revokeDocCore } = await import("./revoke-QJ2HUM4W.js");
8432
+ const { revokeDocCore } = await import("./revoke-AOCAVR56.js");
7681
8433
  await revokeDocCore(this.makeRevokeContext(), docId);
7682
8434
  }
7683
8435
  async unrevokeAttestation(docId) {
7684
- const { unrevokeDocCore } = await import("./revoke-QJ2HUM4W.js");
8436
+ const { unrevokeDocCore } = await import("./revoke-AOCAVR56.js");
7685
8437
  await unrevokeDocCore(this.makeRevokeContext(), docId);
7686
8438
  }
7687
8439
  async getRevokedDocIds() {
7688
- const { getRevokedDocIdsCore } = await import("./revoke-QJ2HUM4W.js");
8440
+ const { getRevokedDocIdsCore } = await import("./revoke-AOCAVR56.js");
7689
8441
  return getRevokedDocIdsCore(this.makeRevokeContext());
7690
8442
  }
7691
8443
  async publishRevocationList() {
7692
- const { publishRevocationListCore } = await import("./revoke-QJ2HUM4W.js");
8444
+ const { publishRevocationListCore } = await import("./revoke-AOCAVR56.js");
7693
8445
  return publishRevocationListCore(this.makeRevokeContext());
7694
8446
  }
7695
8447
  makeRevokeContext() {
@@ -8174,6 +8926,11 @@ var Vault = class {
8174
8926
  const idxPurge = await coll._purgePersistedIndexes(ref2.id);
8175
8927
  indexPostingsPurged += idxPurge.purged;
8176
8928
  for (const field of idxPurge.residue) indexResidue.push(`${ref2.collection}:${ref2.id}:${field}`);
8929
+ try {
8930
+ await coll._purgeVector(ref2.id);
8931
+ } catch {
8932
+ indexResidue.push(`${ref2.collection}:${ref2.id}:_vec`);
8933
+ }
8177
8934
  if (blobsEnabled) {
8178
8935
  const r = await this.collection(ref2.collection).blob(ref2.id).shredAllForRecord();
8179
8936
  blobsShredded += r.shredded.length;
@@ -8188,6 +8945,13 @@ var Vault = class {
8188
8945
  }
8189
8946
  await this._removeSubjectRef(subjectId, ref2);
8190
8947
  }
8948
+ for (const collName of collections) {
8949
+ try {
8950
+ await this.collection(collName)._purgeSearchIndex();
8951
+ } catch {
8952
+ indexResidue.push(`${collName}:_ftindex`);
8953
+ }
8954
+ }
8191
8955
  const subjectHash = await sha256Hex2(subjectId);
8192
8956
  const ledger = this.getLedgerOrNull();
8193
8957
  if (!ledger) {
@@ -8348,7 +9112,7 @@ var Vault = class {
8348
9112
  async _initDerivations(handles) {
8349
9113
  if (handles.length === 0) return;
8350
9114
  const [{ DerivationRegistry }, { ReadOnlyVaultFacade }] = await Promise.all([
8351
- import("./registry-CMEVTOCN.js"),
9115
+ import("./registry-IEU6ATO7.js"),
8352
9116
  import("./read-only-facade-EX6WZZBP.js")
8353
9117
  ]);
8354
9118
  const registry = new DerivationRegistry();
@@ -8379,7 +9143,7 @@ var Vault = class {
8379
9143
  */
8380
9144
  async _initMaterializedViews(handles) {
8381
9145
  if (handles.length === 0) return;
8382
- const { MaterializedViewRegistry } = await import("./registry-OUZ3VBZA.js");
9146
+ const { MaterializedViewRegistry } = await import("./registry-53A55ZZE.js");
8383
9147
  const registry = new MaterializedViewRegistry();
8384
9148
  this.materializedViewRegistry = registry;
8385
9149
  const db = this;
@@ -8403,7 +9167,7 @@ var Vault = class {
8403
9167
  */
8404
9168
  async _initOverlayedViews(handles) {
8405
9169
  if (handles.length === 0) return;
8406
- const { OverlayedViewRegistry } = await import("./registry-XUBRO5JJ.js");
9170
+ const { OverlayedViewRegistry } = await import("./registry-FKL4SLU4.js");
8407
9171
  const registry = new OverlayedViewRegistry();
8408
9172
  const mvRegistry = this.materializedViewRegistry;
8409
9173
  const overlayNames = /* @__PURE__ */ new Set();
@@ -8450,13 +9214,13 @@ var Vault = class {
8450
9214
  if (!reg) {
8451
9215
  throw new Error(`refreshView: no MV registered with name "${name}"`);
8452
9216
  }
8453
- const { MaterializedViewExecutor } = await import("./executor-BIW4FT5R.js");
9217
+ const { MaterializedViewExecutor } = await import("./executor-HB2YMIYC.js");
8454
9218
  const result = await MaterializedViewExecutor.refresh(reg, {
8455
9219
  getCollection: (n) => this.collection(n),
8456
9220
  getActiveTxContext: () => this.noydb._activeTxContextOrNull,
8457
9221
  getQueryContext: () => this
8458
9222
  });
8459
- const { clearMVStale } = await import("./stale-KKCHF2VB.js");
9223
+ const { clearMVStale } = await import("./stale-IIIGOHBW.js");
8460
9224
  clearMVStale(registry, name);
8461
9225
  return result;
8462
9226
  }
@@ -8472,7 +9236,7 @@ var Vault = class {
8472
9236
  if (registry === null) return { derived: 0, failed: 0 };
8473
9237
  const strategies = registry.strategiesForSource(sourceCollection);
8474
9238
  if (strategies.length === 0) return { derived: 0, failed: 0 };
8475
- const { DerivationExecutor } = await import("./executor-VEZUBJNQ.js");
9239
+ const { DerivationExecutor } = await import("./executor-DWVP4BSJ.js");
8476
9240
  const sourceColl = this.collection(sourceCollection);
8477
9241
  const records = await sourceColl.list();
8478
9242
  const ctx = { vault: this.derivationFacade ?? new (await import("./read-only-facade-EX6WZZBP.js")).ReadOnlyVaultFacade(this, "derivation") };
@@ -8497,7 +9261,7 @@ var Vault = class {
8497
9261
  if (!outSpec) continue;
8498
9262
  const outputColl = this.collection(outSpec.collection);
8499
9263
  if (out.kind === "array") {
8500
- const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-OC4QVTS2.js");
9264
+ const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-BMT7I6FI.js");
8501
9265
  const prior = await loadFanoutSidecar(this.adapter, this.name, spec.source, id, key);
8502
9266
  const prevKeys = new Set(prior?.keys ?? []);
8503
9267
  const newKeysList = out.entries.map((e) => e.key);
@@ -8719,7 +9483,7 @@ var Vault = class {
8719
9483
  * collection.
8720
9484
  */
8721
9485
  async delegate(opts) {
8722
- const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-4JSMM6BB.js");
9486
+ const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-ZEH4LKEM.js");
8723
9487
  if (!this.keyring.kek) {
8724
9488
  throw new ValidationError(
8725
9489
  "issueDelegation: keyring.kek is null \u2014 issuing a delegation requires a tier-1 unlock. Re-authenticate at tier 1 (passphrase) first."
@@ -8741,7 +9505,7 @@ var Vault = class {
8741
9505
  * if the id does not exist.
8742
9506
  */
8743
9507
  async revokeDelegation(id) {
8744
- const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-4JSMM6BB.js");
9508
+ const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-ZEH4LKEM.js");
8745
9509
  await revokeDelegation(this.adapter, this.name, id);
8746
9510
  void DELEGATIONS_COLLECTION;
8747
9511
  }
@@ -9211,7 +9975,7 @@ var Vault = class {
9211
9975
  * @see docs/subsystems/public-envelope.md
9212
9976
  */
9213
9977
  async getPublicEnvelope(opts = {}) {
9214
- const { readPublicEnvelope: readPublicEnvelope2 } = await import("./public-envelope-O6X6AUUS.js");
9978
+ const { readPublicEnvelope: readPublicEnvelope2 } = await import("./public-envelope-S2S2VR3F.js");
9215
9979
  return readPublicEnvelope2(this.adapter, this.name, opts);
9216
9980
  }
9217
9981
  /**
@@ -10931,7 +11695,7 @@ var Noydb = class {
10931
11695
  if (!facade) return;
10932
11696
  const ctx = { existing, vault: facade, userId: e.userId, role: e.role };
10933
11697
  await registry.runChecks(e.collection, incoming, ctx);
10934
- const { GuardExecutor } = await import("./executor-3SVNESQ3.js");
11698
+ const { GuardExecutor } = await import("./executor-HO3SIRSF.js");
10935
11699
  for (const g of guards) {
10936
11700
  await GuardExecutor.checkFrozenFields(g, e.docId, existing, incoming, e.computedFieldNames);
10937
11701
  }
@@ -11947,6 +12711,7 @@ var Noydb = class {
11947
12711
  }
11948
12712
  this.syncEngines.clear();
11949
12713
  for (const v of this.vaultCache.values()) v._stopFenceCoordination();
12714
+ for (const v of this.vaultCache.values()) void v._flushSearchIndexes();
11950
12715
  this.disableTabCoordination();
11951
12716
  this.keyringCache.clear();
11952
12717
  this.vaultCache.clear();
@@ -13137,4 +13902,4 @@ export {
13137
13902
  Noydb,
13138
13903
  createNoydb
13139
13904
  };
13140
- //# sourceMappingURL=chunk-KSKKLVPA.js.map
13905
+ //# sourceMappingURL=chunk-ZDW22N3E.js.map