@noy-db/hub 0.2.0-pre.28 → 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 (274) hide show
  1. package/dist/aggregate/index.cjs.map +1 -1
  2. package/dist/aggregate/index.d.cts +3 -3
  3. package/dist/aggregate/index.d.ts +3 -3
  4. package/dist/aggregate/index.js +5 -5
  5. package/dist/attestation/index.cjs.map +1 -1
  6. package/dist/attestation/index.d.cts +4 -4
  7. package/dist/attestation/index.d.ts +4 -4
  8. package/dist/attestation/index.js +6 -6
  9. package/dist/blobs/index.cjs +2 -2
  10. package/dist/blobs/index.cjs.map +1 -1
  11. package/dist/blobs/index.d.cts +6 -6
  12. package/dist/blobs/index.d.ts +6 -6
  13. package/dist/blobs/index.js +6 -6
  14. package/dist/bundle/index.cjs +864 -1
  15. package/dist/bundle/index.cjs.map +1 -1
  16. package/dist/bundle/index.d.cts +6 -6
  17. package/dist/bundle/index.d.ts +6 -6
  18. package/dist/bundle/index.js +10 -10
  19. package/dist/{chunk-42EGY2FQ.js → chunk-2QDWRK3B.js} +5 -5
  20. package/dist/{chunk-7GKDVWMD.js → chunk-2UT7HJJR.js} +4 -4
  21. package/dist/{chunk-E5TJAQS7.js → chunk-2ZYIN3BL.js} +2 -2
  22. package/dist/{chunk-DQ6XF2K2.js → chunk-45QJXLLS.js} +8 -8
  23. package/dist/{chunk-H4XFA2LM.js → chunk-4K4QKYK4.js} +3 -3
  24. package/dist/{chunk-RHVYFAVQ.js → chunk-4L6N56B4.js} +2 -2
  25. package/dist/{chunk-EW3H5Y7N.js → chunk-4YD7VZH4.js} +2 -2
  26. package/dist/{chunk-GVEUI7VR.js → chunk-553CK4E2.js} +3 -3
  27. package/dist/{chunk-YYLFXX2K.js → chunk-5PTX7PKD.js} +4 -4
  28. package/dist/{chunk-4FHKQDHN.js → chunk-6BSYMFYS.js} +7 -7
  29. package/dist/chunk-6BSYMFYS.js.map +1 -0
  30. package/dist/{chunk-TESFHBOW.js → chunk-6EKRQ7QF.js} +3 -3
  31. package/dist/{chunk-Q7P4WHTL.js → chunk-7GPQPLGO.js} +2 -2
  32. package/dist/{chunk-QSLIT4JZ.js → chunk-A7DNZVAV.js} +1 -1
  33. package/dist/{chunk-QSLIT4JZ.js.map → chunk-A7DNZVAV.js.map} +1 -1
  34. package/dist/{chunk-OMBPGXCL.js → chunk-ASIGWYRA.js} +2 -2
  35. package/dist/{chunk-QBC2TZHC.js → chunk-AWU4JF7C.js} +6 -6
  36. package/dist/{chunk-SKYBEGHB.js → chunk-BEZ2EV43.js} +2 -2
  37. package/dist/{chunk-EJJTUDNI.js → chunk-BITB3T5Z.js} +3 -3
  38. package/dist/{chunk-WH7G2YEE.js → chunk-CIZDUAHI.js} +4 -4
  39. package/dist/{chunk-ENC4C6XW.js → chunk-CUPTCF4R.js} +5 -5
  40. package/dist/{chunk-FO5WEDKF.js → chunk-DEE4CRYN.js} +2 -2
  41. package/dist/{chunk-HI7FY7QZ.js → chunk-DJO4OYCJ.js} +2 -2
  42. package/dist/{chunk-7JSP3E67.js → chunk-E2MDPPOC.js} +2 -2
  43. package/dist/{chunk-LX4CPLU6.js → chunk-FFKQ65YX.js} +2 -2
  44. package/dist/{chunk-VUUQYWF5.js → chunk-G7ALNCQH.js} +2 -2
  45. package/dist/{chunk-M2VZQ24Q.js → chunk-GGXN73NM.js} +36 -4
  46. package/dist/chunk-GGXN73NM.js.map +1 -0
  47. package/dist/{chunk-IMY4FXYE.js → chunk-JOJPBZSZ.js} +5 -5
  48. package/dist/{chunk-DDOYOMAD.js → chunk-JZ5DS4DP.js} +32 -2
  49. package/dist/chunk-JZ5DS4DP.js.map +1 -0
  50. package/dist/{chunk-345PYZD6.js → chunk-K6NVSHAH.js} +4 -4
  51. package/dist/{chunk-3BANVNDH.js → chunk-KJ3K5VZM.js} +2 -2
  52. package/dist/{chunk-ZW2YSN6G.js → chunk-LBILABKZ.js} +4 -4
  53. package/dist/{chunk-DMWUOV7X.js → chunk-LXKBG52H.js} +4 -4
  54. package/dist/{chunk-YYTM4U4J.js → chunk-MPIZQGFA.js} +2 -2
  55. package/dist/{chunk-JEQB2KVI.js → chunk-MRJPSXPE.js} +3 -3
  56. package/dist/{chunk-J73KU4AE.js → chunk-MSMDDDDJ.js} +2 -2
  57. package/dist/{chunk-7TBCLM52.js → chunk-QBLPY44S.js} +3 -3
  58. package/dist/{chunk-2M62POB5.js → chunk-QGBBQKDS.js} +35 -5
  59. package/dist/chunk-QGBBQKDS.js.map +1 -0
  60. package/dist/{chunk-PPF7Z2YQ.js → chunk-QWJCNXH2.js} +3 -3
  61. package/dist/{chunk-6LD37AMK.js → chunk-QXWJQ7UU.js} +2 -2
  62. package/dist/{chunk-YRQPI67X.js → chunk-RCB6GWTC.js} +2 -2
  63. package/dist/{chunk-HQ242WNG.js → chunk-REHF3HSJ.js} +5 -5
  64. package/dist/{chunk-FUDVHE2U.js → chunk-SAAJYSVV.js} +2 -2
  65. package/dist/{chunk-AHDQYG7P.js → chunk-SHJ3BRTZ.js} +5 -5
  66. package/dist/{chunk-RG5KLMEU.js → chunk-SQXTKZL7.js} +3 -3
  67. package/dist/{chunk-2KA3PDUR.js → chunk-TMUMMAWV.js} +2 -2
  68. package/dist/{chunk-SWGVCSIY.js → chunk-TZGWI5AX.js} +4 -4
  69. package/dist/{chunk-KNJ7MK4B.js → chunk-UBF5JEOJ.js} +2 -2
  70. package/dist/{chunk-FJ3C3ELF.js → chunk-XAYDHD2O.js} +2 -2
  71. package/dist/{chunk-DCYWBKQ2.js → chunk-XYW2CSCI.js} +3 -3
  72. package/dist/{chunk-VSL3W2MO.js → chunk-ZCMOS4H2.js} +4 -4
  73. package/dist/{chunk-3LHTFCU2.js → chunk-ZDW22N3E.js} +744 -51
  74. package/dist/chunk-ZDW22N3E.js.map +1 -0
  75. package/dist/consent/index.cjs.map +1 -1
  76. package/dist/consent/index.d.cts +5 -5
  77. package/dist/consent/index.d.ts +5 -5
  78. package/dist/consent/index.js +3 -3
  79. package/dist/{crypto-YBKBNPVM.js → crypto-G6XU2V2Y.js} +3 -3
  80. package/dist/{decrypt-partition-BtGtE-19.d.ts → decrypt-partition-5Gt0EcTc.d.ts} +1 -1
  81. package/dist/{decrypt-partition-Cqi5gcOl.d.cts → decrypt-partition-DDSArPPW.d.cts} +1 -1
  82. package/dist/{delegation-4JSMM6BB.js → delegation-ZEH4LKEM.js} +5 -5
  83. package/dist/derivations/index.cjs.map +1 -1
  84. package/dist/derivations/index.d.cts +6 -6
  85. package/dist/derivations/index.d.ts +6 -6
  86. package/dist/derivations/index.js +4 -4
  87. package/dist/{dev-unlock-D0p9cQzN.d.ts → dev-unlock-BF9IhLPn.d.ts} +1 -1
  88. package/dist/{dev-unlock-Cts_iiVv.d.cts → dev-unlock-CIkHrcRm.d.cts} +1 -1
  89. package/dist/{errors-Dwk2k1xY.d.ts → errors-BAWO5Z5a.d.cts} +25 -1
  90. package/dist/{errors-Dwk2k1xY.d.cts → errors-BAWO5Z5a.d.ts} +25 -1
  91. package/dist/executor-DWVP4BSJ.js +8 -0
  92. package/dist/executor-HB2YMIYC.js +12 -0
  93. package/dist/executor-HO3SIRSF.js +8 -0
  94. package/dist/{fanout-sidecar-DSBVAR2P.js → fanout-sidecar-BMT7I6FI.js} +2 -2
  95. package/dist/forget/index.js +4 -4
  96. package/dist/guards/index.cjs.map +1 -1
  97. package/dist/guards/index.d.cts +6 -6
  98. package/dist/guards/index.d.ts +6 -6
  99. package/dist/guards/index.js +3 -3
  100. package/dist/{hash-DA75XwW2.d.cts → hash-DfhndFcd.d.cts} +1 -1
  101. package/dist/{hash-BtDtwguU.d.ts → hash-Jl0qarQx.d.ts} +1 -1
  102. package/dist/history/index.cjs.map +1 -1
  103. package/dist/history/index.d.cts +6 -6
  104. package/dist/history/index.d.ts +6 -6
  105. package/dist/history/index.js +5 -5
  106. package/dist/i18n/index.cjs.map +1 -1
  107. package/dist/i18n/index.d.cts +5 -5
  108. package/dist/i18n/index.d.ts +5 -5
  109. package/dist/i18n/index.js +6 -6
  110. package/dist/{index-CVnt2Qmq.d.cts → index-C1SC1EPe.d.cts} +19 -2
  111. package/dist/{index-CP24aYCp.d.cts → index-DPG2nFmT.d.cts} +28 -5
  112. package/dist/{index-BidHvmWf.d.ts → index-DcxTv3zx.d.ts} +28 -5
  113. package/dist/{index-DxBNV54L.d.ts → index-Ddm8D3Oo.d.ts} +19 -2
  114. package/dist/index.cjs +874 -3
  115. package/dist/index.cjs.map +1 -1
  116. package/dist/index.d.cts +16 -16
  117. package/dist/index.d.ts +16 -16
  118. package/dist/index.js +54 -47
  119. package/dist/index.js.map +1 -1
  120. package/dist/indexing/index.cjs.map +1 -1
  121. package/dist/indexing/index.js +4 -4
  122. package/dist/issue-FZRTVGRE.js +12 -0
  123. package/dist/kernel/index.cjs +33 -0
  124. package/dist/kernel/index.cjs.map +1 -1
  125. package/dist/kernel/index.d.cts +5 -5
  126. package/dist/kernel/index.d.ts +5 -5
  127. package/dist/kernel/index.js +9 -7
  128. package/dist/{ledger-PLMSH7LD.js → ledger-PMTR2Q62.js} +5 -5
  129. package/dist/materialized-views/index.cjs.map +1 -1
  130. package/dist/materialized-views/index.d.cts +6 -6
  131. package/dist/materialized-views/index.d.ts +6 -6
  132. package/dist/materialized-views/index.js +8 -8
  133. package/dist/{mime-magic--NcogI82.d.ts → mime-magic-BOI-I5dq.d.ts} +1 -1
  134. package/dist/{mime-magic-i2VSlkPM.d.cts → mime-magic-C0TM7FtF.d.cts} +1 -1
  135. package/dist/noydb-Y3ZLZNXA.js +39 -0
  136. package/dist/overlay-views/index.cjs.map +1 -1
  137. package/dist/overlay-views/index.d.cts +6 -6
  138. package/dist/overlay-views/index.d.ts +6 -6
  139. package/dist/overlay-views/index.js +4 -4
  140. package/dist/periods/index.cjs.map +1 -1
  141. package/dist/periods/index.d.cts +5 -5
  142. package/dist/periods/index.d.ts +5 -5
  143. package/dist/periods/index.js +5 -5
  144. package/dist/{public-envelope-7MTH2PVE.js → public-envelope-S2S2VR3F.js} +4 -4
  145. package/dist/query/index.cjs +30 -0
  146. package/dist/query/index.cjs.map +1 -1
  147. package/dist/query/index.d.cts +3 -3
  148. package/dist/query/index.d.ts +3 -3
  149. package/dist/query/index.js +7 -7
  150. package/dist/{registry-OUZ3VBZA.js → registry-53A55ZZE.js} +3 -3
  151. package/dist/registry-FKL4SLU4.js +8 -0
  152. package/dist/registry-IEU6ATO7.js +8 -0
  153. package/dist/{revoke-DBAGKIDA.js → revoke-AOCAVR56.js} +6 -6
  154. package/dist/sealed-record/index.cjs.map +1 -1
  155. package/dist/sealed-record/index.d.cts +1 -1
  156. package/dist/sealed-record/index.d.ts +1 -1
  157. package/dist/sealed-record/index.js +2 -2
  158. package/dist/session/index.cjs.map +1 -1
  159. package/dist/session/index.d.cts +6 -6
  160. package/dist/session/index.d.ts +6 -6
  161. package/dist/session/index.js +3 -3
  162. package/dist/shadow/index.cjs.map +1 -1
  163. package/dist/shadow/index.d.cts +5 -5
  164. package/dist/shadow/index.d.ts +5 -5
  165. package/dist/shadow/index.js +2 -2
  166. package/dist/{signer-ADFJNS5W.js → signer-JMK6W2Y6.js} +5 -5
  167. package/dist/snapshots/index.cjs.map +1 -1
  168. package/dist/snapshots/index.d.cts +5 -5
  169. package/dist/snapshots/index.d.ts +5 -5
  170. package/dist/snapshots/index.js +4 -4
  171. package/dist/{stale-BCIE3SMC.js → stale-IIIGOHBW.js} +2 -2
  172. package/dist/store/index.cjs.map +1 -1
  173. package/dist/store/index.d.cts +5 -5
  174. package/dist/store/index.d.ts +5 -5
  175. package/dist/store/index.js +2 -2
  176. package/dist/{strategy-BoITAb2H.d.ts → strategy-8QGs5KQE.d.ts} +1 -1
  177. package/dist/{strategy-DDNvt_UD.d.cts → strategy-mJExw4LQ.d.cts} +1 -1
  178. package/dist/sync/index.cjs.map +1 -1
  179. package/dist/sync/index.d.cts +4 -4
  180. package/dist/sync/index.d.ts +4 -4
  181. package/dist/sync/index.js +4 -4
  182. package/dist/team/index.cjs.map +1 -1
  183. package/dist/team/index.d.cts +5 -5
  184. package/dist/team/index.d.ts +5 -5
  185. package/dist/team/index.js +8 -8
  186. package/dist/{transition-guard-BZhOlrFT.d.ts → transition-guard-BixCDmBI.d.ts} +1 -1
  187. package/dist/{transition-guard-Bekgaxux.d.cts → transition-guard-DnAlUf9R.d.cts} +1 -1
  188. package/dist/tx/index.cjs.map +1 -1
  189. package/dist/tx/index.d.cts +5 -5
  190. package/dist/tx/index.d.ts +5 -5
  191. package/dist/tx/index.js +3 -3
  192. package/dist/{types-B_eCkuEI.d.cts → types-Ba1vQ3AY.d.cts} +160 -4
  193. package/dist/{types-84nsWSDF.d.ts → types-CUmZYJwN.d.ts} +160 -4
  194. package/dist/util/index.cjs.map +1 -1
  195. package/dist/util/index.js +1 -1
  196. package/dist/{with-materialized-view-CAMGQroY.d.ts → with-materialized-view-Bjx6VYPc.d.ts} +1 -1
  197. package/dist/{with-materialized-view-DKMaZmkJ.d.cts → with-materialized-view-Z_aHLln6.d.cts} +1 -1
  198. package/dist/{with-overlayed-view-FnOf1v6H.d.ts → with-overlayed-view-B8PkL179.d.ts} +1 -1
  199. package/dist/{with-overlayed-view--lWXImbV.d.cts → with-overlayed-view-pTOFgHRq.d.cts} +1 -1
  200. package/dist/{with-rollup-xi-mkY6Y.d.ts → with-rollup-Cd3t01Mz.d.ts} +1 -1
  201. package/dist/{with-rollup-C5875Ad5.d.cts → with-rollup-D9qQoffP.d.cts} +1 -1
  202. package/package.json +3 -3
  203. package/dist/chunk-2M62POB5.js.map +0 -1
  204. package/dist/chunk-3LHTFCU2.js.map +0 -1
  205. package/dist/chunk-4FHKQDHN.js.map +0 -1
  206. package/dist/chunk-DDOYOMAD.js.map +0 -1
  207. package/dist/chunk-M2VZQ24Q.js.map +0 -1
  208. package/dist/executor-3SVNESQ3.js +0 -8
  209. package/dist/executor-PJHMRZWJ.js +0 -12
  210. package/dist/executor-VEZUBJNQ.js +0 -8
  211. package/dist/issue-JSGGSVY4.js +0 -12
  212. package/dist/noydb-PHXA5E6I.js +0 -39
  213. package/dist/registry-CMEVTOCN.js +0 -8
  214. package/dist/registry-XUBRO5JJ.js +0 -8
  215. /package/dist/{chunk-42EGY2FQ.js.map → chunk-2QDWRK3B.js.map} +0 -0
  216. /package/dist/{chunk-7GKDVWMD.js.map → chunk-2UT7HJJR.js.map} +0 -0
  217. /package/dist/{chunk-E5TJAQS7.js.map → chunk-2ZYIN3BL.js.map} +0 -0
  218. /package/dist/{chunk-DQ6XF2K2.js.map → chunk-45QJXLLS.js.map} +0 -0
  219. /package/dist/{chunk-H4XFA2LM.js.map → chunk-4K4QKYK4.js.map} +0 -0
  220. /package/dist/{chunk-RHVYFAVQ.js.map → chunk-4L6N56B4.js.map} +0 -0
  221. /package/dist/{chunk-EW3H5Y7N.js.map → chunk-4YD7VZH4.js.map} +0 -0
  222. /package/dist/{chunk-GVEUI7VR.js.map → chunk-553CK4E2.js.map} +0 -0
  223. /package/dist/{chunk-YYLFXX2K.js.map → chunk-5PTX7PKD.js.map} +0 -0
  224. /package/dist/{chunk-TESFHBOW.js.map → chunk-6EKRQ7QF.js.map} +0 -0
  225. /package/dist/{chunk-Q7P4WHTL.js.map → chunk-7GPQPLGO.js.map} +0 -0
  226. /package/dist/{chunk-OMBPGXCL.js.map → chunk-ASIGWYRA.js.map} +0 -0
  227. /package/dist/{chunk-QBC2TZHC.js.map → chunk-AWU4JF7C.js.map} +0 -0
  228. /package/dist/{chunk-SKYBEGHB.js.map → chunk-BEZ2EV43.js.map} +0 -0
  229. /package/dist/{chunk-EJJTUDNI.js.map → chunk-BITB3T5Z.js.map} +0 -0
  230. /package/dist/{chunk-WH7G2YEE.js.map → chunk-CIZDUAHI.js.map} +0 -0
  231. /package/dist/{chunk-ENC4C6XW.js.map → chunk-CUPTCF4R.js.map} +0 -0
  232. /package/dist/{chunk-FO5WEDKF.js.map → chunk-DEE4CRYN.js.map} +0 -0
  233. /package/dist/{chunk-HI7FY7QZ.js.map → chunk-DJO4OYCJ.js.map} +0 -0
  234. /package/dist/{chunk-7JSP3E67.js.map → chunk-E2MDPPOC.js.map} +0 -0
  235. /package/dist/{chunk-LX4CPLU6.js.map → chunk-FFKQ65YX.js.map} +0 -0
  236. /package/dist/{chunk-VUUQYWF5.js.map → chunk-G7ALNCQH.js.map} +0 -0
  237. /package/dist/{chunk-IMY4FXYE.js.map → chunk-JOJPBZSZ.js.map} +0 -0
  238. /package/dist/{chunk-345PYZD6.js.map → chunk-K6NVSHAH.js.map} +0 -0
  239. /package/dist/{chunk-3BANVNDH.js.map → chunk-KJ3K5VZM.js.map} +0 -0
  240. /package/dist/{chunk-ZW2YSN6G.js.map → chunk-LBILABKZ.js.map} +0 -0
  241. /package/dist/{chunk-DMWUOV7X.js.map → chunk-LXKBG52H.js.map} +0 -0
  242. /package/dist/{chunk-YYTM4U4J.js.map → chunk-MPIZQGFA.js.map} +0 -0
  243. /package/dist/{chunk-JEQB2KVI.js.map → chunk-MRJPSXPE.js.map} +0 -0
  244. /package/dist/{chunk-J73KU4AE.js.map → chunk-MSMDDDDJ.js.map} +0 -0
  245. /package/dist/{chunk-7TBCLM52.js.map → chunk-QBLPY44S.js.map} +0 -0
  246. /package/dist/{chunk-PPF7Z2YQ.js.map → chunk-QWJCNXH2.js.map} +0 -0
  247. /package/dist/{chunk-6LD37AMK.js.map → chunk-QXWJQ7UU.js.map} +0 -0
  248. /package/dist/{chunk-YRQPI67X.js.map → chunk-RCB6GWTC.js.map} +0 -0
  249. /package/dist/{chunk-HQ242WNG.js.map → chunk-REHF3HSJ.js.map} +0 -0
  250. /package/dist/{chunk-FUDVHE2U.js.map → chunk-SAAJYSVV.js.map} +0 -0
  251. /package/dist/{chunk-AHDQYG7P.js.map → chunk-SHJ3BRTZ.js.map} +0 -0
  252. /package/dist/{chunk-RG5KLMEU.js.map → chunk-SQXTKZL7.js.map} +0 -0
  253. /package/dist/{chunk-2KA3PDUR.js.map → chunk-TMUMMAWV.js.map} +0 -0
  254. /package/dist/{chunk-SWGVCSIY.js.map → chunk-TZGWI5AX.js.map} +0 -0
  255. /package/dist/{chunk-KNJ7MK4B.js.map → chunk-UBF5JEOJ.js.map} +0 -0
  256. /package/dist/{chunk-FJ3C3ELF.js.map → chunk-XAYDHD2O.js.map} +0 -0
  257. /package/dist/{chunk-DCYWBKQ2.js.map → chunk-XYW2CSCI.js.map} +0 -0
  258. /package/dist/{chunk-VSL3W2MO.js.map → chunk-ZCMOS4H2.js.map} +0 -0
  259. /package/dist/{crypto-YBKBNPVM.js.map → crypto-G6XU2V2Y.js.map} +0 -0
  260. /package/dist/{delegation-4JSMM6BB.js.map → delegation-ZEH4LKEM.js.map} +0 -0
  261. /package/dist/{executor-3SVNESQ3.js.map → executor-DWVP4BSJ.js.map} +0 -0
  262. /package/dist/{executor-PJHMRZWJ.js.map → executor-HB2YMIYC.js.map} +0 -0
  263. /package/dist/{executor-VEZUBJNQ.js.map → executor-HO3SIRSF.js.map} +0 -0
  264. /package/dist/{fanout-sidecar-DSBVAR2P.js.map → fanout-sidecar-BMT7I6FI.js.map} +0 -0
  265. /package/dist/{issue-JSGGSVY4.js.map → issue-FZRTVGRE.js.map} +0 -0
  266. /package/dist/{ledger-PLMSH7LD.js.map → ledger-PMTR2Q62.js.map} +0 -0
  267. /package/dist/{noydb-PHXA5E6I.js.map → noydb-Y3ZLZNXA.js.map} +0 -0
  268. /package/dist/{public-envelope-7MTH2PVE.js.map → public-envelope-S2S2VR3F.js.map} +0 -0
  269. /package/dist/{registry-CMEVTOCN.js.map → registry-53A55ZZE.js.map} +0 -0
  270. /package/dist/{registry-OUZ3VBZA.js.map → registry-FKL4SLU4.js.map} +0 -0
  271. /package/dist/{registry-XUBRO5JJ.js.map → registry-IEU6ATO7.js.map} +0 -0
  272. /package/dist/{revoke-DBAGKIDA.js.map → revoke-AOCAVR56.js.map} +0 -0
  273. /package/dist/{signer-ADFJNS5W.js.map → signer-JMK6W2Y6.js.map} +0 -0
  274. /package/dist/{stale-BCIE3SMC.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-M2VZQ24Q.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-2M62POB5.js";
26
+ } from "./chunk-QGBBQKDS.js";
26
27
  import {
27
28
  EXPORT_AUDIT_COLLECTION,
28
29
  createExportBlobsHandle,
29
30
  runCompaction
30
- } from "./chunk-DCYWBKQ2.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-345PYZD6.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-JEQB2KVI.js";
49
+ } from "./chunk-MRJPSXPE.js";
49
50
  import {
50
51
  writeNoydbBundle
51
- } from "./chunk-7TBCLM52.js";
52
+ } from "./chunk-QBLPY44S.js";
52
53
  import {
53
54
  loadPublicEnvelope,
54
55
  readPublicEnvelope,
55
56
  savePublicEnvelope,
56
57
  validatePublicEnvelopeInput
57
- } from "./chunk-PPF7Z2YQ.js";
58
+ } from "./chunk-QWJCNXH2.js";
58
59
  import {
59
60
  buildTombstone,
60
61
  isTombstone,
@@ -63,20 +64,20 @@ import {
63
64
  rewrapBodyToDek,
64
65
  rotateRecordCek,
65
66
  sealRecordToHost
66
- } from "./chunk-DMWUOV7X.js";
67
+ } from "./chunk-LXKBG52H.js";
67
68
  import {
68
69
  PERIODS_COLLECTION
69
- } from "./chunk-GVEUI7VR.js";
70
+ } from "./chunk-553CK4E2.js";
70
71
  import {
71
72
  isDictCollectionName,
72
73
  isStaticDictDescriptor
73
- } from "./chunk-HQ242WNG.js";
74
+ } from "./chunk-REHF3HSJ.js";
74
75
  import {
75
76
  getAtPath,
76
77
  resolvePolicy,
77
78
  setAtPathInPlace,
78
79
  stripI18nFilled
79
- } from "./chunk-6LD37AMK.js";
80
+ } from "./chunk-QXWJQ7UU.js";
80
81
  import {
81
82
  ManagedRecoveryNotEnrolledError,
82
83
  PolicyDeniedError,
@@ -98,11 +99,11 @@ import {
98
99
  saveShamirRecoveryEntries,
99
100
  updateAuthenticator,
100
101
  writeMagicLinkGrant
101
- } from "./chunk-QBC2TZHC.js";
102
+ } from "./chunk-AWU4JF7C.js";
102
103
  import {
103
104
  assertTierAccess,
104
105
  dekKey
105
- } from "./chunk-J73KU4AE.js";
106
+ } from "./chunk-MSMDDDDJ.js";
106
107
  import {
107
108
  USER_ENVELOPE_COLLECTION,
108
109
  assertKeyringOpenAllowed,
@@ -127,7 +128,7 @@ import {
127
128
  rotateKeys,
128
129
  saveUserEnvelope,
129
130
  updateKeyringIdentity
130
- } from "./chunk-VSL3W2MO.js";
131
+ } from "./chunk-ZCMOS4H2.js";
131
132
  import {
132
133
  INDEXED_STORE_POLICY
133
134
  } from "./chunk-2QR2PQTT.js";
@@ -137,7 +138,7 @@ import {
137
138
  import {
138
139
  LEDGER_COLLECTION,
139
140
  LEDGER_DELTAS_COLLECTION
140
- } from "./chunk-7GKDVWMD.js";
141
+ } from "./chunk-2UT7HJJR.js";
141
142
  import {
142
143
  sha256Hex as sha256Hex2
143
144
  } from "./chunk-PDVP3C2I.js";
@@ -149,11 +150,11 @@ import {
149
150
  readDottedPath,
150
151
  rebuildSubjectIndex,
151
152
  removeSubjectRef
152
- } from "./chunk-RG5KLMEU.js";
153
+ } from "./chunk-SQXTKZL7.js";
153
154
  import {
154
155
  NOYDB_BACKUP_VERSION,
155
156
  NOYDB_FORMAT_VERSION
156
- } from "./chunk-QSLIT4JZ.js";
157
+ } from "./chunk-A7DNZVAV.js";
157
158
  import {
158
159
  decrypt,
159
160
  encrypt,
@@ -162,7 +163,7 @@ import {
162
163
  unwrapCek,
163
164
  wrapCek,
164
165
  wrapKey
165
- } from "./chunk-7JSP3E67.js";
166
+ } from "./chunk-E2MDPPOC.js";
166
167
  import {
167
168
  AlreadyElevatedError,
168
169
  AttestationError,
@@ -173,6 +174,8 @@ import {
173
174
  DebugReservedFieldError,
174
175
  DerivationCapExceededError,
175
176
  ElevationExpiredError,
177
+ EmbeddingDimMismatchError,
178
+ EmbeddingModelMismatchError,
176
179
  ExportCapabilityError,
177
180
  ForgetStrategyNotConfiguredError,
178
181
  ImportCapabilityError,
@@ -200,7 +203,7 @@ import {
200
203
  UnknownDictCodeError,
201
204
  UnsupportedIndexOptionError,
202
205
  ValidationError
203
- } from "./chunk-DDOYOMAD.js";
206
+ } from "./chunk-JZ5DS4DP.js";
204
207
 
205
208
  // src/policy/storage.ts
206
209
  var META_COLLECTION = "_meta";
@@ -588,6 +591,354 @@ function searchScan(entries, field, query, opts = {}, tokenizer = tokenize) {
588
591
  return opts.limit !== void 0 ? results.slice(0, opts.limit) : results;
589
592
  }
590
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
+
591
942
  // src/indexing/unique-constraints.ts
592
943
  var UniqueConstraintSet = class {
593
944
  constructor(collectionName, uniqueDefs) {
@@ -919,7 +1270,7 @@ async function resolveStaleOnRead(accessor, outputCollection, id) {
919
1270
  }
920
1271
  const sourceWithId = { ...source, id };
921
1272
  if (DerivationExecutor === null) {
922
- ({ DerivationExecutor } = await import("./executor-VEZUBJNQ.js"));
1273
+ ({ DerivationExecutor } = await import("./executor-DWVP4BSJ.js"));
923
1274
  }
924
1275
  const ctx = { vault: accessor.getReadOnlyFacade() };
925
1276
  const result = await DerivationExecutor.run(spec, sourceWithId, 0, strategyHash, ctx);
@@ -1117,12 +1468,33 @@ var Collection = class {
1117
1468
  * Declared via the `i18nFields` collection option.
1118
1469
  */
1119
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;
1120
1481
  /**
1121
1482
  * #435 — the densify-enabled subset of {@link i18nFields} (fields whose
1122
1483
  * descriptor opts in via `densifyOnWrite: true`). `undefined` when none opt
1123
1484
  * in, so the write path skips all densify work for ordinary collections.
1124
1485
  */
1125
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;
1126
1498
  /**
1127
1499
  * Map of field name → `DictKeyDescriptor` for fields declared with
1128
1500
  * `dictKey()`. Used by `get()`/`list()` to add `<field>Label` virtual
@@ -1149,6 +1521,12 @@ var Collection = class {
1149
1521
  * Signature: `(dictName, key, locale, fallback?) => Promise<string | undefined>`
1150
1522
  */
1151
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;
1152
1530
  /**
1153
1531
  * Synchronous callback provided by the Vault that validates
1154
1532
  * i18nText fields on `put()`. Throws `MissingTranslationError` when
@@ -1309,15 +1687,25 @@ var Collection = class {
1309
1687
  this.refEnforcer = opts.refEnforcer;
1310
1688
  this.joinResolver = opts.joinResolver;
1311
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;
1312
1692
  const densifyFields = opts.i18nFields ? Object.fromEntries(
1313
1693
  Object.entries(opts.i18nFields).filter(([, d]) => d.options.densifyOnWrite === true)
1314
1694
  ) : {};
1315
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;
1316
1703
  this.dictKeyFields = opts.dictKeyFields;
1317
1704
  if (opts.moneyFields) validateMoneyFieldPaths(opts.moneyFields);
1318
1705
  this.moneyFields = opts.moneyFields;
1319
1706
  this.computed = opts.computed;
1320
1707
  this.dictLabelResolver = opts.dictLabelResolver;
1708
+ this.getDictionary = opts.getDictionary;
1321
1709
  this.i18nPutValidator = opts.i18nPutValidator;
1322
1710
  this.autoTranslateHook = opts.autoTranslateHook;
1323
1711
  this.defaultLocale = opts.defaultLocale;
@@ -1486,7 +1874,7 @@ var Collection = class {
1486
1874
  }
1487
1875
  }
1488
1876
  if (this.materializedViewSource !== void 0) {
1489
- const { resolveStaleMVOnRead } = await import("./stale-BCIE3SMC.js");
1877
+ const { resolveStaleMVOnRead } = await import("./stale-IIIGOHBW.js");
1490
1878
  await resolveStaleMVOnRead(this.materializedViewSource, this.name);
1491
1879
  }
1492
1880
  let record;
@@ -1899,6 +2287,7 @@ var Collection = class {
1899
2287
  }
1900
2288
  await this.onDirty?.(this.name, id, "put", version2);
1901
2289
  this.emitter.emit("change", { vault: this.vault, collection: this.name, id, action: "put" });
2290
+ this.searchIndexStore?.markDirty();
1902
2291
  await this.onAccess?.("put", id);
1903
2292
  await this.dispatchDerivations(id, record, version2);
1904
2293
  await this.dispatchMaterializedViews(id, record);
@@ -1940,6 +2329,15 @@ var Collection = class {
1940
2329
  }
1941
2330
  const envelope = await this.encryptRecord(record, version, cek, options?.source, options?.sourceTs);
1942
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
+ }
1943
2341
  if (this.ledger) {
1944
2342
  const appendInput = {
1945
2343
  op: "put",
@@ -1970,6 +2368,7 @@ var Collection = class {
1970
2368
  id,
1971
2369
  action: "put"
1972
2370
  });
2371
+ this.searchIndexStore?.markDirty();
1973
2372
  await this.onAccess?.("put", id);
1974
2373
  await this.dispatchDerivations(id, record, version);
1975
2374
  await this.dispatchMaterializedViews(id, record);
@@ -2001,7 +2400,7 @@ var Collection = class {
2001
2400
  if (mode === "eager") {
2002
2401
  if (executor === null) {
2003
2402
  ;
2004
- ({ MaterializedViewExecutor: executor } = await import("./executor-PJHMRZWJ.js"));
2403
+ ({ MaterializedViewExecutor: executor } = await import("./executor-HB2YMIYC.js"));
2005
2404
  }
2006
2405
  await executor.refresh(reg, {
2007
2406
  getCollection: (name) => this.materializedViewSource.getCollection(name),
@@ -2010,7 +2409,7 @@ var Collection = class {
2010
2409
  });
2011
2410
  } else if (mode === "lazy") {
2012
2411
  if (staleHelpers === null) {
2013
- staleHelpers = await import("./stale-BCIE3SMC.js");
2412
+ staleHelpers = await import("./stale-IIIGOHBW.js");
2014
2413
  }
2015
2414
  staleHelpers.markMVStale(registry, reg.spec.name);
2016
2415
  }
@@ -2184,7 +2583,7 @@ var Collection = class {
2184
2583
  continue;
2185
2584
  }
2186
2585
  if (DerivationExecutor === null) {
2187
- ({ DerivationExecutor } = await import("./executor-VEZUBJNQ.js"));
2586
+ ({ DerivationExecutor } = await import("./executor-DWVP4BSJ.js"));
2188
2587
  }
2189
2588
  for (const run of runs) {
2190
2589
  const ctx = { vault: this.derivationSource.getReadOnlyFacade() };
@@ -2203,7 +2602,7 @@ var Collection = class {
2203
2602
  const outputCollection = this.derivationSource.getCollection(outSpec.collection);
2204
2603
  const txCtx = this.derivationSource.getActiveTxContext();
2205
2604
  if (out.kind === "array") {
2206
- const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-DSBVAR2P.js");
2605
+ const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-BMT7I6FI.js");
2207
2606
  const prior = await loadFanoutSidecar(
2208
2607
  this.adapter,
2209
2608
  this.vault,
@@ -2493,6 +2892,7 @@ var Collection = class {
2493
2892
  id,
2494
2893
  action: "delete"
2495
2894
  });
2895
+ this.searchIndexStore?.markDirty();
2496
2896
  await this.onAccess?.("delete", id);
2497
2897
  if (!internal) {
2498
2898
  await this.dispatchMaterializedViewsOnDelete(id);
@@ -2566,7 +2966,7 @@ var Collection = class {
2566
2966
  for (const [outputKey, outSpec] of Object.entries(spec.outputs)) {
2567
2967
  if (outSpec.shape !== "array") continue;
2568
2968
  if (helpers === null) {
2569
- helpers = await import("./fanout-sidecar-DSBVAR2P.js");
2969
+ helpers = await import("./fanout-sidecar-BMT7I6FI.js");
2570
2970
  }
2571
2971
  const sidecar = await helpers.loadFanoutSidecar(
2572
2972
  this.adapter,
@@ -2606,7 +3006,7 @@ var Collection = class {
2606
3006
  if (mode === "eager") {
2607
3007
  if (executor === null) {
2608
3008
  ;
2609
- ({ MaterializedViewExecutor: executor } = await import("./executor-PJHMRZWJ.js"));
3009
+ ({ MaterializedViewExecutor: executor } = await import("./executor-HB2YMIYC.js"));
2610
3010
  }
2611
3011
  await executor.refresh(reg, {
2612
3012
  getCollection: (name) => this.materializedViewSource.getCollection(name),
@@ -2615,7 +3015,7 @@ var Collection = class {
2615
3015
  });
2616
3016
  } else if (mode === "lazy") {
2617
3017
  if (staleHelpers === null) {
2618
- staleHelpers = await import("./stale-BCIE3SMC.js");
3018
+ staleHelpers = await import("./stale-IIIGOHBW.js");
2619
3019
  }
2620
3020
  staleHelpers.markMVStale(registry, reg.spec.name);
2621
3021
  }
@@ -2638,7 +3038,7 @@ var Collection = class {
2638
3038
  );
2639
3039
  }
2640
3040
  if (this.materializedViewSource !== void 0) {
2641
- const { resolveStaleMVOnRead } = await import("./stale-BCIE3SMC.js");
3041
+ const { resolveStaleMVOnRead } = await import("./stale-IIIGOHBW.js");
2642
3042
  await resolveStaleMVOnRead(this.materializedViewSource, this.name);
2643
3043
  }
2644
3044
  await this.ensureHydrated();
@@ -2677,6 +3077,252 @@ var Collection = class {
2677
3077
  for (const [id, e] of this.cache) entries.push({ id, record: stripI18nFilled(e.record) });
2678
3078
  return searchScan(entries, field, query, opts);
2679
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
+ }
2680
3326
  // ─── Bulk operations ─────────────────────────────────────
2681
3327
  /**
2682
3328
  * Put many records in one call. Each item is processed sequentially
@@ -2846,6 +3492,7 @@ var Collection = class {
2846
3492
  // back to a linear scan otherwise.
2847
3493
  getIndexes: () => this.getIndexes(),
2848
3494
  lookupById: (id) => this.cache.get(id)?.record,
3495
+ snapshotEntries: () => [...this.cache.entries()].map(([id, e]) => ({ id, record: e.record })),
2849
3496
  ...this.moneyFields ? { moneyFields: this.moneyFields } : {}
2850
3497
  };
2851
3498
  const resolver = this.joinResolver;
@@ -3276,6 +3923,7 @@ var Collection = class {
3276
3923
  async _applyRemoteChange(id, action) {
3277
3924
  await this._invalidateCacheEntry(id);
3278
3925
  this.emitter.emit("change", { vault: this.vault, collection: this.name, id, action });
3926
+ this.searchIndexStore?.markDirty();
3279
3927
  }
3280
3928
  /** @internal — the current in-memory record without a store read (for conflict capture). */
3281
3929
  _peekCached(id) {
@@ -3774,6 +4422,19 @@ var Collection = class {
3774
4422
  }
3775
4423
  return { purged, residue };
3776
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
+ }
3777
4438
  /**
3778
4439
  * Bulk-load the persisted-index mirror from `_idx/<field>/*` side-cars
3779
4440
  * on first lazy-mode query. Idempotent — subsequent calls short-circuit
@@ -7038,6 +7699,10 @@ var Vault = class {
7038
7699
  collOpts.onCrossTierAccess = (event) => this.emitCrossTier(event);
7039
7700
  if (this.syncAdapter !== void 0) collOpts.syncAdapter = this.syncAdapter;
7040
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;
7041
7706
  if (options?.moneyFields !== void 0) collOpts.moneyFields = options.moneyFields;
7042
7707
  if (options?.computed !== void 0) collOpts.computed = options.computed;
7043
7708
  if (options?.dictKeyFields !== void 0) {
@@ -7050,6 +7715,7 @@ var Vault = class {
7050
7715
  const handle = this.dictionary(dictName);
7051
7716
  return handle.resolveLabel(key, locale, fallback);
7052
7717
  };
7718
+ collOpts.getDictionary = async (name) => this.dictionary(name);
7053
7719
  collOpts.dictKeyFields = options.dictKeyFields;
7054
7720
  }
7055
7721
  if (options?.i18nFields !== void 0 || options?.dictKeyFields !== void 0) {
@@ -7063,6 +7729,10 @@ var Vault = class {
7063
7729
  }
7064
7730
  coll = new Collection(collOpts);
7065
7731
  this.collectionCache.set(collectionName, coll);
7732
+ if (options?.warmIndexOnOpen === true && options.prefetch !== false) {
7733
+ void coll.warmIndex().catch(() => {
7734
+ });
7735
+ }
7066
7736
  if (options?.persistJsonSchema === true && options.schema !== void 0 && (options.schemaUpdate?.length ?? 0) === 0) {
7067
7737
  const validator = options.schema;
7068
7738
  const work = (async () => {
@@ -7172,6 +7842,16 @@ var Vault = class {
7172
7842
  this.#fenceWatcher = void 0;
7173
7843
  this.#fenceCoordinationStarted = false;
7174
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
+ }
7175
7855
  /** @internal Drive one heartbeat + watch cycle deterministically (tests). */
7176
7856
  async _fenceTick() {
7177
7857
  this._ensureFenceCoordination();
@@ -7718,12 +8398,12 @@ var Vault = class {
7718
8398
  if (!fieldSchema) {
7719
8399
  throw new AttestationError(`issueAttestation: collection '${collectionName}' has no attestation field-schema. Declare it via vault.collection('${collectionName}', { attestation: { fields: [...] } }).`);
7720
8400
  }
7721
- const { issueAttestationCore } = await import("./issue-JSGGSVY4.js");
8401
+ const { issueAttestationCore } = await import("./issue-FZRTVGRE.js");
7722
8402
  const out = await issueAttestationCore(this.makeIssueContext(), { collection: collectionName, id, fieldSchema });
7723
8403
  return { docId: out.docId, qr: out.qr, keyId: out.keyId, publicKeyB64: out.publicKeyB64 };
7724
8404
  }
7725
8405
  async getDocumentSigningPublicKey() {
7726
- const { loadSigner, loadOrCreateSigner } = await import("./signer-ADFJNS5W.js");
8406
+ const { loadSigner, loadOrCreateSigner } = await import("./signer-JMK6W2Y6.js");
7727
8407
  const existing = await loadSigner(this.adapter, this.name, this.getDEK);
7728
8408
  if (existing) return { keyId: existing.keyId, publicKeyB64: existing.publicKeyB64 };
7729
8409
  if (this.keyring.role !== "owner") {
@@ -7749,19 +8429,19 @@ var Vault = class {
7749
8429
  };
7750
8430
  }
7751
8431
  async revokeAttestation(docId) {
7752
- const { revokeDocCore } = await import("./revoke-DBAGKIDA.js");
8432
+ const { revokeDocCore } = await import("./revoke-AOCAVR56.js");
7753
8433
  await revokeDocCore(this.makeRevokeContext(), docId);
7754
8434
  }
7755
8435
  async unrevokeAttestation(docId) {
7756
- const { unrevokeDocCore } = await import("./revoke-DBAGKIDA.js");
8436
+ const { unrevokeDocCore } = await import("./revoke-AOCAVR56.js");
7757
8437
  await unrevokeDocCore(this.makeRevokeContext(), docId);
7758
8438
  }
7759
8439
  async getRevokedDocIds() {
7760
- const { getRevokedDocIdsCore } = await import("./revoke-DBAGKIDA.js");
8440
+ const { getRevokedDocIdsCore } = await import("./revoke-AOCAVR56.js");
7761
8441
  return getRevokedDocIdsCore(this.makeRevokeContext());
7762
8442
  }
7763
8443
  async publishRevocationList() {
7764
- const { publishRevocationListCore } = await import("./revoke-DBAGKIDA.js");
8444
+ const { publishRevocationListCore } = await import("./revoke-AOCAVR56.js");
7765
8445
  return publishRevocationListCore(this.makeRevokeContext());
7766
8446
  }
7767
8447
  makeRevokeContext() {
@@ -8246,6 +8926,11 @@ var Vault = class {
8246
8926
  const idxPurge = await coll._purgePersistedIndexes(ref2.id);
8247
8927
  indexPostingsPurged += idxPurge.purged;
8248
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
+ }
8249
8934
  if (blobsEnabled) {
8250
8935
  const r = await this.collection(ref2.collection).blob(ref2.id).shredAllForRecord();
8251
8936
  blobsShredded += r.shredded.length;
@@ -8260,6 +8945,13 @@ var Vault = class {
8260
8945
  }
8261
8946
  await this._removeSubjectRef(subjectId, ref2);
8262
8947
  }
8948
+ for (const collName of collections) {
8949
+ try {
8950
+ await this.collection(collName)._purgeSearchIndex();
8951
+ } catch {
8952
+ indexResidue.push(`${collName}:_ftindex`);
8953
+ }
8954
+ }
8263
8955
  const subjectHash = await sha256Hex2(subjectId);
8264
8956
  const ledger = this.getLedgerOrNull();
8265
8957
  if (!ledger) {
@@ -8420,7 +9112,7 @@ var Vault = class {
8420
9112
  async _initDerivations(handles) {
8421
9113
  if (handles.length === 0) return;
8422
9114
  const [{ DerivationRegistry }, { ReadOnlyVaultFacade }] = await Promise.all([
8423
- import("./registry-CMEVTOCN.js"),
9115
+ import("./registry-IEU6ATO7.js"),
8424
9116
  import("./read-only-facade-EX6WZZBP.js")
8425
9117
  ]);
8426
9118
  const registry = new DerivationRegistry();
@@ -8451,7 +9143,7 @@ var Vault = class {
8451
9143
  */
8452
9144
  async _initMaterializedViews(handles) {
8453
9145
  if (handles.length === 0) return;
8454
- const { MaterializedViewRegistry } = await import("./registry-OUZ3VBZA.js");
9146
+ const { MaterializedViewRegistry } = await import("./registry-53A55ZZE.js");
8455
9147
  const registry = new MaterializedViewRegistry();
8456
9148
  this.materializedViewRegistry = registry;
8457
9149
  const db = this;
@@ -8475,7 +9167,7 @@ var Vault = class {
8475
9167
  */
8476
9168
  async _initOverlayedViews(handles) {
8477
9169
  if (handles.length === 0) return;
8478
- const { OverlayedViewRegistry } = await import("./registry-XUBRO5JJ.js");
9170
+ const { OverlayedViewRegistry } = await import("./registry-FKL4SLU4.js");
8479
9171
  const registry = new OverlayedViewRegistry();
8480
9172
  const mvRegistry = this.materializedViewRegistry;
8481
9173
  const overlayNames = /* @__PURE__ */ new Set();
@@ -8522,13 +9214,13 @@ var Vault = class {
8522
9214
  if (!reg) {
8523
9215
  throw new Error(`refreshView: no MV registered with name "${name}"`);
8524
9216
  }
8525
- const { MaterializedViewExecutor } = await import("./executor-PJHMRZWJ.js");
9217
+ const { MaterializedViewExecutor } = await import("./executor-HB2YMIYC.js");
8526
9218
  const result = await MaterializedViewExecutor.refresh(reg, {
8527
9219
  getCollection: (n) => this.collection(n),
8528
9220
  getActiveTxContext: () => this.noydb._activeTxContextOrNull,
8529
9221
  getQueryContext: () => this
8530
9222
  });
8531
- const { clearMVStale } = await import("./stale-BCIE3SMC.js");
9223
+ const { clearMVStale } = await import("./stale-IIIGOHBW.js");
8532
9224
  clearMVStale(registry, name);
8533
9225
  return result;
8534
9226
  }
@@ -8544,7 +9236,7 @@ var Vault = class {
8544
9236
  if (registry === null) return { derived: 0, failed: 0 };
8545
9237
  const strategies = registry.strategiesForSource(sourceCollection);
8546
9238
  if (strategies.length === 0) return { derived: 0, failed: 0 };
8547
- const { DerivationExecutor } = await import("./executor-VEZUBJNQ.js");
9239
+ const { DerivationExecutor } = await import("./executor-DWVP4BSJ.js");
8548
9240
  const sourceColl = this.collection(sourceCollection);
8549
9241
  const records = await sourceColl.list();
8550
9242
  const ctx = { vault: this.derivationFacade ?? new (await import("./read-only-facade-EX6WZZBP.js")).ReadOnlyVaultFacade(this, "derivation") };
@@ -8569,7 +9261,7 @@ var Vault = class {
8569
9261
  if (!outSpec) continue;
8570
9262
  const outputColl = this.collection(outSpec.collection);
8571
9263
  if (out.kind === "array") {
8572
- const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-DSBVAR2P.js");
9264
+ const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-BMT7I6FI.js");
8573
9265
  const prior = await loadFanoutSidecar(this.adapter, this.name, spec.source, id, key);
8574
9266
  const prevKeys = new Set(prior?.keys ?? []);
8575
9267
  const newKeysList = out.entries.map((e) => e.key);
@@ -8791,7 +9483,7 @@ var Vault = class {
8791
9483
  * collection.
8792
9484
  */
8793
9485
  async delegate(opts) {
8794
- const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-4JSMM6BB.js");
9486
+ const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-ZEH4LKEM.js");
8795
9487
  if (!this.keyring.kek) {
8796
9488
  throw new ValidationError(
8797
9489
  "issueDelegation: keyring.kek is null \u2014 issuing a delegation requires a tier-1 unlock. Re-authenticate at tier 1 (passphrase) first."
@@ -8813,7 +9505,7 @@ var Vault = class {
8813
9505
  * if the id does not exist.
8814
9506
  */
8815
9507
  async revokeDelegation(id) {
8816
- const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-4JSMM6BB.js");
9508
+ const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-ZEH4LKEM.js");
8817
9509
  await revokeDelegation(this.adapter, this.name, id);
8818
9510
  void DELEGATIONS_COLLECTION;
8819
9511
  }
@@ -9283,7 +9975,7 @@ var Vault = class {
9283
9975
  * @see docs/subsystems/public-envelope.md
9284
9976
  */
9285
9977
  async getPublicEnvelope(opts = {}) {
9286
- const { readPublicEnvelope: readPublicEnvelope2 } = await import("./public-envelope-7MTH2PVE.js");
9978
+ const { readPublicEnvelope: readPublicEnvelope2 } = await import("./public-envelope-S2S2VR3F.js");
9287
9979
  return readPublicEnvelope2(this.adapter, this.name, opts);
9288
9980
  }
9289
9981
  /**
@@ -11003,7 +11695,7 @@ var Noydb = class {
11003
11695
  if (!facade) return;
11004
11696
  const ctx = { existing, vault: facade, userId: e.userId, role: e.role };
11005
11697
  await registry.runChecks(e.collection, incoming, ctx);
11006
- const { GuardExecutor } = await import("./executor-3SVNESQ3.js");
11698
+ const { GuardExecutor } = await import("./executor-HO3SIRSF.js");
11007
11699
  for (const g of guards) {
11008
11700
  await GuardExecutor.checkFrozenFields(g, e.docId, existing, incoming, e.computedFieldNames);
11009
11701
  }
@@ -12019,6 +12711,7 @@ var Noydb = class {
12019
12711
  }
12020
12712
  this.syncEngines.clear();
12021
12713
  for (const v of this.vaultCache.values()) v._stopFenceCoordination();
12714
+ for (const v of this.vaultCache.values()) void v._flushSearchIndexes();
12022
12715
  this.disableTabCoordination();
12023
12716
  this.keyringCache.clear();
12024
12717
  this.vaultCache.clear();
@@ -13209,4 +13902,4 @@ export {
13209
13902
  Noydb,
13210
13903
  createNoydb
13211
13904
  };
13212
- //# sourceMappingURL=chunk-3LHTFCU2.js.map
13905
+ //# sourceMappingURL=chunk-ZDW22N3E.js.map